123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <!--
- * @Author:
- * @Date: 2023-03-01 19:20:44
- * @LastEditors: Please set LastEditors
- * @LastEditTime: 2024-03-13 17:45:49
- * @Description: kxs files
- * @filePath:
- -->
- <script lang="ts">
- // 声明额外的选项
- export default {
- name: "Add"
- };
- </script>
- <script setup lang="ts">
- import { inject, ref } from "vue";
- import { useRenderIcon } from "@/components/ReIcon/src/hooks";
- import { postUserList } from "@/api/system";
- import { ElMessage, ElMessageBox } from "element-plus";
- import { http } from "@/utils/http";
- import { dataResult } from "@/api/apiResult";
- // 获取URLLIST
- import { getGroupUrl } from "@/utils/getUrl/getUrl"
- // 获取当前板块接口列表
- const UserUrl = await getGroupUrl(['User']);
- import Upload from "@iconify-icons/ri/upload-2-fill"
- import Close from "@iconify-icons/ri/close-fill"
- const props = defineProps<{
- submit: {
- type: Function;
- default: () => {};
- };
- addVisible: {
- type: Boolean;
- default: false;
- };
- width: {
- type: Number;
- default: 50;
- };
- }>();
- // 表单数据
- let UpdateForm = ref({
- RealName: "",
- AdminName: "",
- PassWord: "",
- RoleId: "",
- });
- // 传参选项数据
- const optionList = [
- { Id: '1', label: '推荐' },
- { Id: '2', label: '实物' },
- { Id: '3', label: '虚拟商品' },
- ]
- // 选项卡参数(默认值为列表某项的id)
- const activeId = ref('1')
- // 提交函数
- const submit = async () => {
- const { status, info }: any = await postUserList(UpdateForm.value);
- // const { status, info }: any = await URL.postUserList.url(UpdateForm.value);
- if (status === "1") {
- ElMessage({
- message: "新增成功",
- type: "success"
- });
- UpdateForm.value = {
- AdminName: "",
- RealName: "",
- RoleId: "",
- PassWord: "",
- };
- } else {
- ElMessageBox.alert(info, "提示", {
- confirmButtonText: "关闭",
- type: "warning"
- });
- };
- };
- const closeFn: any = inject('closeAddVisible');
- // 关闭弹窗回调函数
- const closeVisible = () => {
- UpdateForm.value = {
- AdminName: "",
- RealName: "",
- RoleId: "",
- PassWord: "",
- };
- closeFn();
- };
- </script>
- <template lang="pug">
- .main
- el-dialog(v-model='props.addVisible' width="50%" title="新增" @close="closeVisible()")
- //- 有选项卡模板
- el-tabs(v-model="activeId" class="demo-tabs" @tab-click="handleClick")
- el-tab-pane(label="选项卡一" name="1")
- el-form(:model='UpdateForm' label-position="right" label-width="100px")
- el-form-item(label='账户名称' prop="RealName")
- el-input(v-model='UpdateForm.RealName' autocomplete='off' class="!w-[230px]"
- placeholder="请输入账户名称")
- el-form-item(label='用户名' prop="AdminName")
- el-input(v-model='UpdateForm.AdminName' autocomplete='off' class="!w-[230px]"
- placeholder="请输入用户名")
- el-form-item(label='密码' prop="PassWord")
- el-input(v-model='UpdateForm.PassWord' autocomplete='off' class="!w-[230px]"
- placeholder="请输入密码")
- el-form-item(label="角色:", prop="RoleId")
- el-select(
- v-model="UpdateForm.RoleId",
- placeholder="请选择用户角色",
- clearable,
- class="!w-[230px]"
- )
- el-option(:label="item.label", :value="item.Id" v-for="(item,index) in optionList")
- el-tab-pane(label="选项卡二" name="2")
- el-form(:model='UpdateForm' label-position="right" label-width="100px")
- el-form-item(label='账户名称' prop="RealName")
- el-input(v-model='UpdateForm.RealName' autocomplete='off' class="!w-[230px]"
- placeholder="请输入账户名称")
- el-form-item(label='用户名' prop="AdminName")
- el-input(v-model='UpdateForm.AdminName' autocomplete='off' class="!w-[230px]"
- placeholder="请输入用户名")
- el-form-item(label='密码' prop="PassWord")
- el-input(v-model='UpdateForm.PassWord' autocomplete='off' class="!w-[230px]"
- placeholder="请输入密码")
- el-form-item(label="角色:", prop="RoleId")
- el-select(
- v-model="UpdateForm.RoleId",
- placeholder="请选择用户角色",
- clearable,
- class="!w-[230px]"
- )
- el-option(:label="item.label", :value="item.Id" v-for="(item,index) in optionList")
- //- 无选项卡模板
- el-form(:model='UpdateForm' label-position="right" label-width="100px")
- el-form-item(label='账户名称' prop="RealName")
- el-input(v-model='UpdateForm.RealName' autocomplete='off' class="!w-[230px]"
- placeholder="请输入账户名称")
- el-form-item(label='用户名' prop="AdminName")
- el-input(v-model='UpdateForm.AdminName' autocomplete='off' class="!w-[230px]"
- placeholder="请输入用户名")
- el-form-item(label='密码' prop="PassWord")
- el-input(v-model='UpdateForm.PassWord' autocomplete='off' class="!w-[230px]"
- placeholder="请输入密码")
- el-form-item(label="角色:", prop="RoleId")
- el-select(
- v-model="UpdateForm.RoleId",
- placeholder="请选择用户角色",
- clearable,
- class="!w-[230px]"
- )
- el-option(:label="item.label", :value="item.Id" v-for="(item,index) in optionList")
- el-button(
- :icon="useRenderIcon(Close)",
- :loading="loading",
- @click="closeVisible()"
- ) 关闭
- el-button(
- type="primary",
- :icon="useRenderIcon(Upload)",
- :loading="loading",
- @click="submit"
- ) 确认提交
- </template>
- <style scoped lang="scss">
- :deep(.el-dropdown-menu__item i) {
- margin: 0;
- }
- :deep(.el-form-item__label) {
- font-weight: 700;
- }
- :deep(.el-pagination) {
- flex-flow: wrap;
- }
- :deep(.is-draggable) {
- max-height: 80vh;
- overflow: auto;
- }
- :deep(.el-dialog__header) {
- position: sticky;
- top: 0;
- z-index: 2;
- background: #fff;
- }
- .collapsedom {
- padding: 0 20px;
- background-color: #fff;
- }
- .ovh-x {
- height: 40vh;
- overflow-y: auto;
- }
- :deep(.el-descriptions__header) {
- margin: 16px 0 !important;
- }
- </style>
|