Procházet zdrojové kódy

form组件升级,产品库新增字段添加

asd26269546 před 2 roky
rodič
revize
c2010c0806

+ 1 - 1
src/assets/styles/element-ui.scss

@@ -121,7 +121,7 @@
 }
 
 .el-form-item{
-  padding: 0 10px!important;
+  padding: 0!important;
 }
 
 .el-form-item__label{

+ 31 - 3
src/components/byForm/index.vue

@@ -127,11 +127,24 @@
                     v-else-if="i.type == 'slot'">
                     {{i.slotName}}插槽占位符
                 </slot>
+				<div v-else-if="i.type == 'json'">
+					<byForm
+						:formConfig="i.json"
+						:formOption="formOption"
+						v-model="formData[i.prop]"
+						ref="byform"
+					>
+					</byForm>
+				</div>
 			</el-form-item>
 		</el-form>
 	</div>
 </template>
-  
+<script>
+	export default {
+	  name: "byForm", 
+	}
+</script>
 <script  setup>
 import { set } from '@vueuse/shared'
 import { reactive } from 'vue'
@@ -166,6 +179,7 @@ const formData = computed(() => {
 })
 const formDataReset = ref({...proxy.modelValue})
 const commonsEmit = (prop,item) => {
+	console.log(formData)
 	if(item.fn) {
 		item.fn(prop)
 	}
@@ -191,7 +205,7 @@ const dateFormatInit = ((itemType) => {
 		datetimerange:"YYYY-MM-DD hh:mm:ss",
 		daterange:"YYYY-MM-DD hh:mm:ss",
 	}
-
+	console.log(formatObj)
 	return formatObj[itemType]
 })
 
@@ -260,7 +274,10 @@ const getFormat = (formatStr, props) => {
 }
 
 //初始化所有表单
+
 const formDataInit = () => {
+	
+	
 	var map = {
 		input: '',
 		radio: null,
@@ -280,26 +297,37 @@ const formDataInit = () => {
 		Upload: { path: null, id: null, name: null },
 		password:'',
 		treeSelect:'',
+		json:{},
 	}
 	const formDataCopy = { ...formData.value }
 	for (let i = 0; i < proxy.formConfig.length; i++) {
 		const element = proxy.formConfig[i]
 		
 		if(formDataCopy[element.prop] || element.type === 'slot') {
-			break;
+			continue
 		}
+			
 		if(map[element.itemType] != undefined){
 			formData.value[element.prop] = map[element.itemType]
 		}else{
 			formData.value[element.prop] = element.multiple ? [] :  map[element.type]
 		}
+		
 	}
+	
 	emit('update:modelValue', formData.value)
 }
 
 const handleSubmit = (onSubmit) => {
 	proxy.$refs['byForm'].validate((valid) => {
 		if (valid) {
+			const form = { ...formData.value }
+			proxy.formConfig.map(item => {
+				if(item.type == 'json') {
+					form[item.prop] = JSON.stringify(form[item.prop])
+				}
+			})
+			emit('update:modelValue', form)
 			onSubmit()
 		} else {
 			ElMessage({

+ 38 - 11
src/components/byTable/demo.vue

@@ -14,8 +14,8 @@
 				:table-events="{
 					//element talbe事件都能传
 					'row-click': handleRowClick,
-					'cell-contextmenu':handleRowClick.apply,
-					'select-all':select
+					'cell-contextmenu': handleRowClick.apply,
+					'select-all': select,
 				}"
 				:action-list="[
 					{
@@ -27,7 +27,7 @@
 				]"
 				@get-list="getList"
 			>
-				<template  #slotName='{item}'>
+				<template #slotName="{ item }">
 					{{ item.createTime }}
 				</template>
 			</byTable>
@@ -69,7 +69,7 @@ const align = ref('center')
 const tableHeight = ref(null)
 const border = ref(true)
 const sourceList = ref({
-	data:[],
+	data: [],
 	pagination: {
 		total: 3,
 		pageNum: 1,
@@ -85,7 +85,7 @@ const selectConfig = computed(() => {
 		{
 			label: '合同状态1',
 			prop: 'tdaProductId',
-			
+
 			data: [
 				{
 					label: '已关闭',
@@ -108,7 +108,7 @@ const selectConfig = computed(() => {
 const config = computed(() => {
 	return [
 		{
-			type:"selection",
+			type: 'selection',
 			attrs: {
 				label: '角色名称',
 				prop: 'remark',
@@ -148,10 +148,10 @@ const config = computed(() => {
 						name: 'el-switch',
 						data: row.menuCheckStrictly,
 						change: (e) => {
-							console.log(e,'change事件')
+							console.log(e, 'change事件')
 						},
 						click: (e) => {
-							console.log(e,'click事件')
+							console.log(e, 'click事件')
 						},
 					},
 				]
@@ -163,7 +163,7 @@ const config = computed(() => {
 				align: align.value,
 				width: 200,
 				prop: 'createTime',
-				slot:"slotName"
+				slot: 'slotName',
 			},
 		},
 		{
@@ -308,6 +308,34 @@ const formConfig = computed(() => {
 			slotName: 'slot',
 			label: '插槽',
 		},
+		
+		{
+			//使用此功能需要初始化prop数据至少是对象
+			type: 'json',
+			prop: 'standardJson',
+			json: [
+				{
+					type: 'input',
+					prop: 'englishName',
+					label: '英文名',
+				},
+				{
+					type: 'input',
+					prop: 'code',
+					label: '备注',
+				},
+				{
+					type: 'input',
+					prop: 'netWeight',
+					label: '净重',
+				},
+				{
+					type: 'input',
+					prop: 'customhouse',
+					label: '海关编码',
+				},
+			],
+		},
 	]
 })
 
@@ -316,7 +344,7 @@ const sleep = (time = 1000) => {
 }
 const getList = async (res) => {
 	console.log(sourceList.value)
-	console.log({...sourceList.value.pagination,...res})
+	console.log({ ...sourceList.value.pagination, ...res })
 	loading.value = true
 	proxy.get('/system/role/list?pageNum=1&pageSize=10').then((message) => {
 		console.log(message)
@@ -334,7 +362,6 @@ const select = (row, column, cell) => {
 		dangerouslyUseHTMLString: true, // Be careful :)
 		message: `点了全选`,
 	})
-
 }
 const handleRowClick = (row, column, cell) => {
 	ElMessage({

+ 31 - 1
src/views/product/product/index.vue

@@ -279,7 +279,9 @@ const fileList = ref([]);
 const fileListCopy = ref([]);
 
 let formData = reactive({
-  data: {},
+  data: {
+  },
+  
 });
 const formOption = reactive({
   inline: true,
@@ -351,6 +353,32 @@ const formConfig = computed(() => {
       label: "备注",
       itemType: "textarea",
     },
+    {
+			type: 'json',
+			prop: 'standardJson',
+			json: [
+				{
+					type: 'input',
+					prop: 'englishName',
+					label: '英文名',
+				},
+        {
+					type: 'input',
+					prop: 'code',
+					label: '备注',
+				},
+        {
+					type: 'input',
+					prop: 'netWeight',
+					label: '净重',
+				},
+        {
+					type: 'input',
+					prop: 'customhouse',
+					label: '海关编码',
+				},
+			],
+		},
   ];
 });
 const newPassword = () => {
@@ -411,6 +439,7 @@ const openModal = () => {
     definition: "1",
     type: "1",
     fileList: [],
+    standardJson:{},
   };
 
   fileList.value = [];
@@ -474,6 +503,7 @@ const getDtl = (row) => {
     fileListCopy.value = [...fileList.value];
     res.type = res.type + ""; //type回显
     res.definition = "1"; //产品
+    res.standardJson = JSON.parse(res.standardJson);
     formData.data = res;
     dialogVisible.value = true;
   });

+ 478 - 411
src/views/system/user2/index.vue

@@ -1,453 +1,520 @@
 <template>
-  <div class="user">
-    <div class="tree">
-      <treeList :data="treeListData" v-model="sourceList.pagination.tenantId" node-key="id" @change="treeChange">
-      </treeList>
-    </div>
-    <div class="content">
-      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading"
-        highlight-current-row :selectConfig="selectConfig" searchKey="userName" :table-events="{
-          //element talbe事件都能传
-          select: select,
-        }" :action-list="[
-  {
-    text: '添加用户',
-    action: () => openModal('add'),
-    disabled: !sourceList.pagination.tenantId,
-  },
-]" @get-list="getList">
-        <template #slotName="{ item }">
-          {{ item.createTime }}
-        </template>
-      </byTable>
-    </div>
-    <el-dialog :title="modalType == 'add' ? '新增' : '编辑'" v-model="dialogVisible" width="500" v-loading="loading">
-      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
-        <template #account>
-          <el-input style="width: 150px; margin-right: 10px" v-model="formData.data.userName"
-            placeholder="请输入用户名"></el-input>
-          <el-input style="width: 150px; margin-right: 10px" v-model="formData.data.password" placeholder="密码"></el-input>
-          <span style="color: #409eff; cursor: pointer" @click="newPassword">随机生成</span>
-        </template>
-      </byForm>
-      <template #footer>
-        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading">
-          确 定
-        </el-button>
-      </template>
-    </el-dialog>
-    <el-dialog title="修改密码" v-model="roomDialogVisible" width="300" :before-close="handleClose" v-loading="loading">
-      <template #footer>
-        <el-input v-model="password" type="password" placeholder="请输入新密码" show-password style="margin-bottom:20px" />
-        <el-button @click="roomDialogVisible = false" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitPassword(password)" size="large" :loading="submitLoading">
-          确 定
-        </el-button>
-      </template>
-    </el-dialog>
-  </div>
+	<div class="user">
+		<div class="tree">
+			<treeList
+				:data="treeListData"
+				v-model="sourceList.pagination.tenantId"
+				node-key="id"
+				@change="treeChange"
+			>
+			</treeList>
+		</div>
+		<div class="content">
+			<byTable
+				:source="sourceList.data"
+				:pagination="sourceList.pagination"
+				:config="config"
+				:loading="loading"
+				highlight-current-row
+				:selectConfig="selectConfig"
+				searchKey="userName"
+				:table-events="{
+					//element talbe事件都能传
+					select: select,
+				}"
+				:action-list="[
+					{
+						text: '添加用户',
+						action: () => openModal('add'),
+						disabled: !sourceList.pagination.tenantId,
+					},
+				]"
+				@get-list="getList"
+			>
+				<template #slotName="{ item }">
+					{{ item.createTime }}
+				</template>
+			</byTable>
+		</div>
+		<el-dialog
+			:title="modalType == 'add' ? '新增' : '编辑'"
+			v-model="dialogVisible"
+			width="500"
+			v-loading="loading"
+		>
+			<byForm
+				:formConfig="formConfig"
+				:formOption="formOption"
+				v-model="formData.data"
+				:rules="rules"
+				ref="byform"
+			>
+				<template #account>
+					<el-input
+						style="width: 150px; margin-right: 10px"
+						v-model="formData.data.userName"
+						placeholder="请输入用户名"
+					></el-input>
+					<el-input
+						style="width: 150px; margin-right: 10px"
+						v-model="formData.data.password"
+						placeholder="密码"
+					></el-input>
+					<span
+						style="color: #409eff; cursor: pointer"
+						@click="newPassword"
+						>随机生成</span
+					>
+				</template>
+			</byForm>
+			<template #footer>
+				<el-button @click="dialogVisible = false" size="large"
+					>取 消</el-button
+				>
+				<el-button
+					type="primary"
+					@click="submitForm('byform')"
+					size="large"
+					:loading="submitLoading"
+				>
+					确 定
+				</el-button>
+			</template>
+		</el-dialog>
+		<el-dialog
+			title="修改密码"
+			v-model="roomDialogVisible"
+			width="300"
+			:before-close="handleClose"
+			v-loading="loading"
+		>
+			<template #footer>
+				<el-input
+					v-model="password"
+					type="password"
+					placeholder="请输入新密码"
+					show-password
+					style="margin-bottom: 20px"
+				/>
+				<el-button @click="roomDialogVisible = false" size="large"
+					>取 消</el-button
+				>
+				<el-button
+					type="primary"
+					@click="submitPassword(password)"
+					size="large"
+					:loading="submitLoading"
+				>
+					确 定
+				</el-button>
+			</template>
+		</el-dialog>
+	</div>
 </template>
   
 <script setup>
 /* eslint-disable vue/no-unused-components */
-import { ElMessage, ElMessageBox } from "element-plus";
-import byTable from "@/components/byTable/index";
-import byForm from "@/components/byForm/index";
-import treeList from "@/components/treeList/index";
-import { computed, defineComponent, ref } from "vue";
-const loading = ref(false);
-const submitLoading = ref(false);
+import { ElMessage, ElMessageBox } from 'element-plus'
+import byTable from '@/components/byTable/index'
+import byForm from '@/components/byForm/index'
+import treeList from '@/components/treeList/index'
+import { computed, defineComponent, ref } from 'vue'
+const loading = ref(false)
+const submitLoading = ref(false)
 const sourceList = ref({
-  data: [],
-  pagination: {
-    total: 3,
-    pageNum: 1,
-    pageSize: 10,
-  },
-});
-let dialogVisible = ref(false);
-let modalType = ref("add");
+	data: [],
+	pagination: {
+		total: 3,
+		pageNum: 1,
+		pageSize: 10,
+	},
+})
+let dialogVisible = ref(false)
+let modalType = ref('add')
 let rules = ref({
-  roleKey: [{ required: true, message: "请选择部门", trigger: "blur" }],
-  nickName: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
-  userName: [{ required: true, message: "用户名不能为空", trigger: "blur" }],
-});
-const userId = ref("");
-const { proxy } = getCurrentInstance();
-const password = ref("");
+	roleKey: [{ required: true, message: '请选择部门', trigger: 'blur' }],
+	nickName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
+	userName: [{ required: true, message: '用户名不能为空', trigger: 'blur' }],
+})
+const userId = ref('')
+const { proxy } = getCurrentInstance()
+const password = ref('')
 const roomDialogVisible = ref(false)
 const selectConfig = computed(() => {
-  return [];
-});
+	return []
+})
 const config = computed(() => {
-  return [
-    {
-      attrs: {
-        label: "部门",
-        prop: "deptName",
-      },
-    },
-    {
-      attrs: {
-        label: "姓名",
-        prop: "nickName",
-        align: "left",
-      },
-    },
-    {
-      attrs: {
-        label: "用户名",
-        prop: "userName",
-      },
-    },
-    {
-      attrs: {
-        label: "系统用户",
-        prop: "userType",
-      },
-      render(userType) {
-        return userType == 1 ? "是" : "否";
-      },
-    },
-    {
-      attrs: {
-        label: "手机号",
-        prop: "phonenumber",
-      },
-    },
-    {
-      attrs: {
-        label: "工号",
-        prop: "jobNumber",
-      },
-    },
-    {
-      attrs: {
-        label: "操作",
-        width: "200",
-        align: "right",
-      },
-      // 渲染 el-button,一般用在最后一列。
-      renderHTML(row) {
-        return [
-          {
-            attrs: {
-              label: "修改密码",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              userId.value = row.userId;
-              roomDialogVisible.value = true
-            },
-          },
-          {
-            attrs: {
-              label: "修改",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              if (!sourceList.value.pagination.tenantId) {
-                ElMessage({
-                  message: '请选择租户',
-                  type: 'warning',
-                });
-                return
-              }
-              getDtl(row);
-            },
-          },
-          {
-            attrs: {
-              label: "删除",
-              type: "danger",
-              text: true,
-            },
-            el: "button",
-            click() {
-              // 弹窗提示是否删除
-              ElMessageBox.confirm(
-                "此操作将永久删除该数据, 是否继续?",
-                "提示",
-                {
-                  confirmButtonText: "确定",
-                  cancelButtonText: "取消",
-                  type: "warning",
-                }
-              ).then(() => {
-                // 删除
-                proxy
-                  .post(
-                    "/tenantUser/" + row.userId,
-                    {
-                      id: row.userId,
-                    },
-                    "delete"
-                  )
-                  .then((res) => {
-                    ElMessage({
-                      message: "删除成功",
-                      type: "success",
-                    });
-                    getList();
-                  });
-              });
-            },
-          },
-        ];
-      },
-    },
-  ];
-});
+	return [
+		{
+			attrs: {
+				label: '部门',
+				prop: 'deptName',
+			},
+		},
+		{
+			attrs: {
+				label: '姓名',
+				prop: 'nickName',
+				align: 'left',
+			},
+		},
+		{
+			attrs: {
+				label: '用户名',
+				prop: 'userName',
+			},
+		},
+		{
+			attrs: {
+				label: '系统用户',
+				prop: 'userType',
+			},
+			render(userType) {
+				return userType == 1 ? '是' : '否'
+			},
+		},
+		{
+			attrs: {
+				label: '手机号',
+				prop: 'phonenumber',
+			},
+		},
+		{
+			attrs: {
+				label: '工号',
+				prop: 'jobNumber',
+			},
+		},
+		{
+			attrs: {
+				label: '操作',
+				width: '200',
+				align: 'right',
+			},
+			// 渲染 el-button,一般用在最后一列。
+			renderHTML(row) {
+				return [
+					{
+						attrs: {
+							label: '修改密码',
+							type: 'primary',
+							text: true,
+						},
+						el: 'button',
+						click() {
+							userId.value = row.userId
+							roomDialogVisible.value = true
+						},
+					},
+					{
+						attrs: {
+							label: '修改',
+							type: 'primary',
+							text: true,
+						},
+						el: 'button',
+						click() {
+							if (!sourceList.value.pagination.tenantId) {
+								ElMessage({
+									message: '请选择租户',
+									type: 'warning',
+								})
+								return
+							}
+							getDtl(row)
+						},
+					},
+					{
+						attrs: {
+							label: '删除',
+							type: 'danger',
+							text: true,
+						},
+						el: 'button',
+						click() {
+							// 弹窗提示是否删除
+							ElMessageBox.confirm(
+								'此操作将永久删除该数据, 是否继续?',
+								'提示',
+								{
+									confirmButtonText: '确定',
+									cancelButtonText: '取消',
+									type: 'warning',
+								}
+							).then(() => {
+								// 删除
+								proxy
+									.post(
+										'/tenantUser/' + row.userId,
+										{
+											id: row.userId,
+										},
+										'delete'
+									)
+									.then((res) => {
+										ElMessage({
+											message: '删除成功',
+											type: 'success',
+										})
+										getList()
+									})
+							})
+						},
+					},
+				]
+			},
+		},
+	]
+})
 
 let formData = reactive({
-  data: {},
-});
+	data: {},
+})
 const formOption = reactive({
-  inline: true,
-  labelWidth: 100,
-  itemWidth: 100,
-  rules: [],
-});
-const byform = ref(null);
-const treeListData = ref([]);
+	inline: true,
+	labelWidth: 100,
+	itemWidth: 100,
+	rules: [],
+})
+const byform = ref(null)
+const treeListData = ref([])
 const formConfig = computed(() => {
-  return [
-    {
-      type: "treeSelect",
-      prop: "deptId",
-      label: "部门名称",
-      data: [],
-    },
-    {
-      type: "input",
-      prop: "nickName",
-      label: "姓名",
-      required: true,
-      itemWidth: 50,
-      //disabled:true,
-      itemType: "text",
-    },
-    {
-      type: "slot",
-      prop: "userName",
-      slotName: "account",
-      label: "账户信息",
-    },
-    {
-      type: "radio",
-      prop: "userType",
-      label: "系统用户",
-      required: true,
-      disabled: true,
-      border: true,
-      data: [
-        {
-          label: "是",
-          id: 1,
-        },
-        {
-          label: "否",
-          id: 0,
-        },
-      ],
-    },
-    {
-      type: "select",
-      label: "角色",
-      prop: "roleIds",
-      multiple: true,
-      isLoad: {
-        url: `/tenantRole/list?pageNum=1&pageSize=10000&tenantId=${sourceList.value.pagination.tenantId}`,
-        labelKey: "roleName",
-        labelVal: "roleId",
-        method: "get",
-        resUrl: "rows",
-      },
-    },
-    {
-      type: "input",
-      prop: "phonenumber",
-      label: "手机号",
-      required: true,
-      itemWidth: 50,
-      //disabled:true,
-      itemType: "text",
-    },
-    {
-      type: "input",
-      prop: "jobNumber",
-      label: "工号",
-      required: true,
-      itemWidth: 50,
-      //disabled:true,
-      itemType: "text",
-    },
-  ];
-});
+	return [
+		{
+			type: 'treeSelect',
+			prop: 'deptId',
+			label: '部门名称',
+			data: [],
+		},
+		{
+			type: 'input',
+			prop: 'nickName',
+			label: '姓名',
+			required: true,
+			itemWidth: 50,
+			//disabled:true,
+			itemType: 'text',
+		},
+		{
+			type: 'slot',
+			prop: 'userName',
+			slotName: 'account',
+			label: '账户信息',
+		},
+		{
+			type: 'radio',
+			prop: 'userType',
+			label: '系统用户',
+			required: true,
+			disabled: true,
+			border: true,
+			data: [
+				{
+					label: '是',
+					id: 1,
+				},
+				{
+					label: '否',
+					id: 0,
+				},
+			],
+		},
+		{
+			type: 'select',
+			label: '角色',
+			prop: 'roleIds',
+			multiple: true,
+			isLoad: {
+				url: `/tenantRole/list?pageNum=1&pageSize=10000&tenantId=${sourceList.value.pagination.tenantId}`,
+				labelKey: 'roleName',
+				labelVal: 'roleId',
+				method: 'get',
+				resUrl: 'rows',
+			},
+		},
+		{
+			type: 'input',
+			prop: 'phonenumber',
+			label: '手机号',
+			required: true,
+			itemWidth: 50,
+			//disabled:true,
+			itemType: 'text',
+		},
+		{
+			type: 'input',
+			prop: 'jobNumber',
+			label: '工号',
+			required: true,
+			itemWidth: 50,
+			//disabled:true,
+			itemType: 'text',
+		},
+	]
+})
 const newPassword = () => {
-  formData.data.password = generatePassword();
-};
+	formData.data.password = generatePassword()
+}
 const generatePassword = () => {
-  var length = 12,
-    charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
-    password = "";
-  for (var i = 0, n = charset.length; i < length; ++i) {
-    password += charset.charAt(Math.floor(Math.random() * n));
-  }
-  return password;
-};
+	var length = 12,
+		charset =
+			'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
+		password = ''
+	for (var i = 0, n = charset.length; i < length; ++i) {
+		password += charset.charAt(Math.floor(Math.random() * n))
+	}
+	return password
+}
 
 const getTreeList = () => {
-  proxy.post("/tenantInfo/list").then((message) => {
-    message.map((item) => {
-      item.label = item.enterpriseName;
-      item.id = item.tenantId;
-      item.children = [];
-    });
+	proxy.post('/tenantInfo/list').then((message) => {
+		message.map((item) => {
+			item.label = item.enterpriseName
+			item.id = item.tenantId
+			item.children = []
+		})
 
-    treeListData.value = message;
-    console.log(treeListData.value);
-  });
-};
+		treeListData.value = message
+		console.log(treeListData.value)
+	})
+}
 const getList = async (req) => {
-  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
-  loading.value = true;
-  proxy.get("/tenantUser/list", sourceList.value.pagination).then((message) => {
-    message.rows.map((item) => {
-      item.deptName = item.dept ? item.dept.deptName : item.dept;
-    });
-    sourceList.value.data = message.rows;
-    sourceList.value.pagination.total = message.total;
-    setTimeout(() => {
-      loading.value = false;
-    }, 200);
-  });
-};
+	sourceList.value.pagination = { ...sourceList.value.pagination, ...req }
+	loading.value = true
+	proxy
+		.get('/tenantUser/list', sourceList.value.pagination)
+		.then((message) => {
+			message.rows.map((item) => {
+				item.deptName = item.dept ? item.dept.deptName : item.dept
+			})
+			sourceList.value.data = message.rows
+			sourceList.value.pagination.total = message.total
+			setTimeout(() => {
+				loading.value = false
+			}, 200)
+		})
+}
 
 const treeChange = (e) => {
-  console.log(e);
-  sourceList.value.pagination.tenantId = e.id;
-  getList({ tenantId: e.id });
-  getDept()
-
-};
+	console.log(e)
+	sourceList.value.pagination.tenantId = e.id
+	getList({ tenantId: e.id })
+	getDept()
+}
 
 const openModal = () => {
-  dialogVisible.value = true;
-  modalType.value = "add";
-  formData.data = {
-    userType: 1,
-  };
-};
-const TreetenantId = ref("");
+	dialogVisible.value = true
+	modalType.value = 'add'
+	formData.data = {
+		userType: 1,
+	}
+}
+const TreetenantId = ref('')
 const selection = ref({
-  data: [],
-});
+	data: [],
+})
 const select = (_selection, row) => {
-  selection.value.data = _selection;
-  console.log(_selection.length);
-};
+	selection.value.data = _selection
+	console.log(_selection.length)
+}
 
-const tree = ref(null);
+const tree = ref(null)
 const submitForm = () => {
-  byform.value.handleSubmit((valid) => {
-    const method = modalType.value == "add" ? "POST" : "PUT";
-    console.log(method);
-    proxy
-      .post(
-        "/tenantUser",
-        {
-          ...formData.data,
-          tenantId: sourceList.value.pagination.tenantId,
-        },
-        method
-      )
-      .then((res) => {
-        ElMessage({
-          message: modalType.value == "add" ? "添加成功" : "编辑成功",
-          type: "success",
-        });
-        dialogVisible.value = false;
-        getList();
-      });
-  });
-};
+	byform.value.handleSubmit((valid) => {
+		const method = modalType.value == 'add' ? 'POST' : 'PUT'
+		console.log(method)
+		proxy
+			.post(
+				'/tenantUser',
+				{
+					...formData.data,
+					tenantId: sourceList.value.pagination.tenantId,
+				},
+				method
+			)
+			.then((res) => {
+				ElMessage({
+					message: modalType.value == 'add' ? '添加成功' : '编辑成功',
+					type: 'success',
+				})
+				dialogVisible.value = false
+				getList()
+			})
+	})
+}
 const recursive = (data) => {
-  data.map((item) => {
-    item.label = item.deptName;
-    item.id = item.deptId;
-    if (item.children) {
-      recursive(item.children);
-    } else {
-      item.children = [];
-    }
-  });
-};
+	data.map((item) => {
+		item.label = item.deptName
+		item.id = item.deptId
+		if (item.children) {
+			recursive(item.children)
+		} else {
+			item.children = []
+		}
+	})
+}
 const getDept = () => {
-  proxy.get("/tenantDept/list", {
-    pageNum: 1,
-    tenantId: sourceList.value.pagination.tenantId,
-  }).then((message) => {
-    recursive(message.data);
-    formConfig.value[0].data = proxy.handleTree(message.data, "deptId");
-    console.log(formConfig.value[0].data)
-  });
-};
+	proxy
+		.get('/tenantDept/list', {
+			pageNum: 1,
+			tenantId: sourceList.value.pagination.tenantId,
+		})
+		.then((message) => {
+			recursive(message.data)
+			formConfig.value[0].data = proxy.handleTree(message.data, 'deptId')
+			console.log(formConfig.value[0].data)
+		})
+}
 
 const submitPassword = (password1) => {
-  if (!password1) {
-    ElMessage({
-      message: "请输入新密码",
-      type: "warning",
-    });
-    return;
-  }
-  proxy
-    .post(
-      "/tenantUser/resetPwd",
-      {
-        password: password1,
-        userId: userId.value,
-      },
-      "PUT"
-    )
-    .then((res) => {
-      ElMessage({
-        message: "重置成功",
-        type: "success",
-      });
-      roomDialogVisible.value = false;
-      password.value = "";
-    });
-};
+	if (!password1) {
+		ElMessage({
+			message: '请输入新密码',
+			type: 'warning',
+		})
+		return
+	}
+	proxy
+		.post(
+			'/tenantUser/resetPwd',
+			{
+				password: password1,
+				userId: userId.value,
+			},
+			'PUT'
+		)
+		.then((res) => {
+			ElMessage({
+				message: '重置成功',
+				type: 'success',
+			})
+			roomDialogVisible.value = false
+			password.value = ''
+		})
+}
 
 const getDtl = (row) => {
-  formData.data = { ...row };
-  modalType.value = "edit";
-  console.log(modalType.value);
-  dialogVisible.value = true;
-};
-getTreeList();
-getList();
+	formData.data = { ...row }
+	modalType.value = 'edit'
+	console.log(modalType.value)
+	dialogVisible.value = true
+}
+getTreeList()
+getList()
 </script>
   
 <style lang="scss" scoped>
 .user {
-  padding: 20px;
-  display: flex;
-  justify-content: space-between;
+	padding: 20px;
+	display: flex;
+	justify-content: space-between;
 
-  .tree {
-    width: 300px;
-  }
+	.tree {
+		width: 300px;
+	}
 
-  .content {
-    width: calc(100% - 320px);
-  }
+	.content {
+		width: calc(100% - 320px);
+	}
 }
 </style>