|
@@ -0,0 +1,196 @@
|
|
|
+<!--
|
|
|
+ * @Author:
|
|
|
+ * @Date: 2023-03-01 19:20:44
|
|
|
+ * @LastEditors: Please set LastEditors
|
|
|
+ * @LastEditTime: 2024-03-08 18:01:37
|
|
|
+ * @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 Upload from "@iconify-icons/ri/upload-2-fill"
|
|
|
+import Close from "@iconify-icons/ri/close-fill"
|
|
|
+const props = defineProps<{
|
|
|
+ editVisible: {
|
|
|
+ type: Boolean;
|
|
|
+ default: false;
|
|
|
+ };
|
|
|
+ width: {
|
|
|
+ type: Number;
|
|
|
+ default: 50;
|
|
|
+ };
|
|
|
+ formData: {
|
|
|
+ type: Object;
|
|
|
+ default: {};
|
|
|
+ };
|
|
|
+}>();
|
|
|
+// 表单数据
|
|
|
+let UpdateForm: any = 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);
|
|
|
+ if (status === "1") {
|
|
|
+ ElMessage({
|
|
|
+ message: "修改成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ UpdateForm.value = {
|
|
|
+ AdminName: "",
|
|
|
+ RealName: "",
|
|
|
+ RoleId: "",
|
|
|
+ PassWord: "",
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ ElMessageBox.alert(info, "提示", {
|
|
|
+ confirmButtonText: "关闭",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ };
|
|
|
+};
|
|
|
+// 关闭弹窗回调函数
|
|
|
+const closeVisible = inject('closeEditVisible');
|
|
|
+const openVisible = async () => {
|
|
|
+ //通过ID获取表格数据
|
|
|
+ const { data, info }: any = await postUserList(props.formData.id);
|
|
|
+ UpdateForm.value = data
|
|
|
+ // 通过表格项获取数据
|
|
|
+ UpdateForm.value = props.formData
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<template lang="pug">
|
|
|
+.main
|
|
|
+ el-dialog(v-model='props.editVisible' width="50%" title="修改" @close="closeVisible()" @open="openVisible")
|
|
|
+ //- 有选项卡模板
|
|
|
+ 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>
|