瀏覽代碼

部分bug解决

cz 2 年之前
父節點
當前提交
f2e6a48a9a
共有 3 個文件被更改,包括 836 次插入772 次删除
  1. 10 2
      src/components/headerBar/header-bar.vue
  2. 427 378
      src/views/system/tenant/index.vue
  3. 399 392
      src/views/system/user2/index.vue

+ 10 - 2
src/components/headerBar/header-bar.vue

@@ -110,7 +110,7 @@
           trigger="click"
         >
           <div class="dropdown-box">
-            {{ userData }}
+            {{ nickName }}
           </div>
           <template #dropdown>
             <el-dropdown-menu>
@@ -136,6 +136,7 @@ import Cookies from "js-cookie";
 import { ElMessageBox, ElNotification } from "element-plus";
 import useUserStore from "@/store/modules/user";
 import usePermissionStore from "@/store/modules/permission";
+import { ref } from "vue";
 const router = useRouter();
 const userStore = useUserStore();
 const permissionStore = usePermissionStore();
@@ -146,7 +147,7 @@ const isChildMenu = ref(false);
 const menuData = ref([]);
 const barData = ref([]);
 const userData = ref(Cookies.get("username") || "");
-
+let nickName = ref("");
 const routerInit = () => {
   //二维转一维
   const arr = [];
@@ -220,8 +221,15 @@ function routerPush(i) {
   isChildMenu.value = false;
 }
 
+const getInfo = () => {
+  userStore.getInfo().then((res) => {
+    nickName.value = res.user.nickName;
+  });
+};
+
 onMounted(() => {
   routerInit();
+  getInfo();
 });
 </script>
   

+ 427 - 378
src/views/system/tenant/index.vue

@@ -1,408 +1,457 @@
 <template>
-	<div class="tenant">
-		<!-- <Banner /> -->
-		<div class="content">
-			<byTable
-				
-				:source="sourceList.data"
-				:pagination="sourceList.pagination"
-				:config="config"
-				:loading="loading"
-				highlight-current-row
-				:selectConfig="selectConfig"
-				:table-events="{
-					//element talbe事件都能传
-					'select': select,
-				}"
-				:action-list="[
-					{
-						text: '权限配置',
-						plain: true,
-						//type: 'warning',
-						action: () => openRoomModal(),
-						disabled:selection.data.length != 1,
-					},
-					{
-						text: '添加租户',
-						action: () => openModal('add'),
-					},
-				]"
-				@get-list="getList"
-			>
-				<template #slotName="{ item }">
-					{{ item.createTime }}
-				</template>
-			</byTable>
-		</div>
-		<el-dialog
-			:title="modalType == 'add' ? '新增' : '编辑'"
-			v-model="dialogVisible"
-			width="800"
-			v-loading="loading"
-		>
-			<byForm
-				:formConfig="formConfig"
-				:formOption="formOption"
-				v-model="formData.data"
-				:rules="rules"
-				ref="byform"
-			>
-				
-			</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="500"
-			:before-close="handleClose"
-			v-loading="loading">
-				
-				<el-tree
-					:data="treeData"
-					:show-checkbox="true"
-					v-model="formData.treeData"
-					ref="tree"
-					node-key="id"
-				>
-				</el-tree>
-			<template #footer>
-				<el-button @click="roomDialogVisible = false" size="large"
-					>取 消</el-button
-				>
-				<el-button
-					type="primary"
-					@click="submitTree('byform')"
-					size="large"
-					:loading="submitLoading">
-					确 定
-				</el-button>
-			</template>
-		</el-dialog>
-	</div>
+  <div class="tenant">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: '权限配置',
+            plain: true,
+            //type: 'warning',
+            action: () => openRoomModal(),
+            disabled: selection.data.length != 1,
+          },
+          {
+            text: '添加租户',
+            action: () => openModal('add'),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '新增' : '编辑'"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+      </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="500"
+      :before-close="handleClose"
+      v-loading="loading"
+    >
+      <el-tree
+        :data="treeData"
+        :show-checkbox="true"
+        v-model="formData.treeData"
+        ref="tree"
+        node-key="id"
+      >
+      </el-tree>
+      <template #footer>
+        <el-button @click="roomDialogVisible = false" size="large"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          @click="submitTree('byform')"
+          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 { 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 { 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 roomDialogVisible = ref(false)
-let modalType = ref('add')
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let roomDialogVisible = ref(false);
+let modalType = ref("add");
 let rules = ref({
-	tenantId: [{ required: true, message: '请输入活动名称', trigger: 'blur' }],
-	password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
-	enterpriseName: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
-})
-const { proxy } = getCurrentInstance()
+  tenantId: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
+  password: [{ required: true, message: "请输入密码", trigger: "blur" }],
+  enterpriseName: [
+    { required: true, message: "请输入企业名称", trigger: "blur" },
+  ],
+});
+const { proxy } = getCurrentInstance();
 const selectConfig = computed(() => {
-	return [
-		{
-			label: '审核状态',
-			prop: 'flowStatus',
-			data: [
-				{
-					label: '审核中',
-					value: '1',
-				},
-				{
-					label: '审核通过',
-					value: '2',
-				},
-				{
-					label: '审核不通过',
-					value: '3',
-				},
-			],
-		},
-		{
-			label: '启用状态',
-			prop: 'status',
-			data: [
-				{
-					label: '启用',
-					value: '1',
-				},
-				{
-					label: '禁用',
-					value: '0',
-				},
-			],
-		},
-	]
-})
+  return [
+    {
+      label: "审核状态",
+      prop: "flowStatus",
+      data: [
+        {
+          label: "审核中",
+          value: "1",
+        },
+        {
+          label: "审核通过",
+          value: "2",
+        },
+        {
+          label: "审核不通过",
+          value: "3",
+        },
+      ],
+    },
+    {
+      label: "启用状态",
+      prop: "status",
+      data: [
+        {
+          label: "启用",
+          value: "1",
+        },
+        {
+          label: "禁用",
+          value: "0",
+        },
+      ],
+    },
+  ];
+});
 const config = computed(() => {
-	return [
-		{
-			type: 'selection',
-			attrs: {
-				label: '多选',
-				prop: 'remark',
-			},
-		},
-		{
-			attrs: {
-				label: '企业名称',
-				prop: 'enterpriseName',
-			},
-		},
-		{
-			attrs: {
-				label: '租户id',
-				prop: 'tenantId',
-				align: 'center',
-			},
-		},
-		{
-			attrs: {
-				label: '已创建账号数',
-				prop: 'accountCount',
-				align: 'center',
-			},
-		},
-		{
-			attrs: {
-				label: '审核状态',
-				width: 100,
-				prop: 'flowStatus',
-			},
-			render(flowStatus) {
-				//1审核中 2审核通过 3审核不通过
-				return flowStatus == 1
-					? '审核中'
-					: flowStatus == 2
-					? '审核通过'
-					: '审核不通过'
-			},
-		},
-		{
-			attrs: {
-				label: '启用状态',
-				prop: 'createTime',
-			},
-			render(status) {
-				return status ? '启用' : '禁用'
-			},
-		},
-		{
-			attrs: {
-				label: '操作',
-				width: '200',
-				align: 'right',
-			},
-			// 渲染 el-button,一般用在最后一列。
-			renderHTML(row) {
-				return [
-					{
-						attrs: {
-							label: '修改',
-							type: 'primary',
-							text: true,
-						},
-						el: 'button',
-						click() {
-							getDtl(row)
-						},
-					},
-					// {
-					// 	attrs: {
-					// 		label: '删除',
-					// 		type: 'danger',
-					// 		text: true,
-					// 		disabled:true,
-					// 	},
-					// 	el: 'button',
-					// 	click() {
-					// 		// 弹窗提示是否删除
-					// 		ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
-					// 			confirmButtonText: '确定',
-					// 			cancelButtonText: '取消',
-					// 			type: 'warning',
-					// 		})
-					// 			.then(() => {
-					// 				// 删除
-					// 				proxy.post('/tenantInfo/delete', {
-					// 					id: row.id,
-					// 				}).then((res) => {
-					// 					ElMessage({
-					// 						message: '删除成功',
-					// 						type: 'success',
-					// 					})
-					// 					getList()
-					// 				})
-					// 			})
-					// 	},
-					// },
-				]
-			},
-		},
-	]
-})
+  return [
+    {
+      type: "selection",
+      attrs: {
+        label: "多选",
+        prop: "remark",
+      },
+    },
+    {
+      attrs: {
+        label: "企业名称",
+        prop: "enterpriseName",
+      },
+    },
+    {
+      attrs: {
+        label: "租户id",
+        prop: "tenantId",
+        align: "center",
+      },
+    },
+    {
+      attrs: {
+        label: "已创建账号数",
+        prop: "accountCount",
+        align: "center",
+      },
+    },
+    {
+      attrs: {
+        label: "审核状态",
+        width: 100,
+        prop: "flowStatus",
+      },
+      render(flowStatus) {
+        //1审核中 2审核通过 3审核不通过
+        return flowStatus == 1
+          ? "审核中"
+          : flowStatus == 2
+          ? "审核通过"
+          : "审核不通过";
+      },
+    },
+    {
+      attrs: {
+        label: "启用状态",
+        prop: "status",
+      },
+      render(status) {
+        return status ? "启用" : "禁用";
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          // {
+          //   attrs: {
+          //     label: "修改",
+          //     type: "primary",
+          //     text: true,
+          //   },
+          //   el: "button",
+          //   click() {
+          //     getDtl(row);
+          //   },
+          // },
+          {
+            attrs: {
+              label: row.status == 1 ? "禁用" : "启用",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              changeStatus(row);
+            },
+          },
+          // {
+          //   attrs: {
+          //     label: "发布",
+          //     type: "primary",
+          //     text: true,
+          //     bg: true,
+          //   },
+          //   el: "button",
+          //   click() {
+          //     setPublish(row);
+          //   },
+          // },
+
+          // {
+          // 	attrs: {
+          // 		label: '删除',
+          // 		type: 'danger',
+          // 		text: true,
+          // 		disabled:true,
+          // 	},
+          // 	el: 'button',
+          // 	click() {
+          // 		// 弹窗提示是否删除
+          // 		ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+          // 			confirmButtonText: '确定',
+          // 			cancelButtonText: '取消',
+          // 			type: 'warning',
+          // 		})
+          // 			.then(() => {
+          // 				// 删除
+          // 				proxy.post('/tenantInfo/delete', {
+          // 					id: row.id,
+          // 				}).then((res) => {
+          // 					ElMessage({
+          // 						message: '删除成功',
+          // 						type: 'success',
+          // 					})
+          // 					getList()
+          // 				})
+          // 			})
+          // 	},
+          // },
+        ];
+      },
+    },
+  ];
+});
 
 let formData = reactive({
-	data:{},
-	treeData:[],
-})
+  data: {},
+  treeData: [],
+});
 const formOption = reactive({
-	inline: true,
-	labelWidth: 100,
-	itemWidth: 100,
-	rules: [],
-})
-const byform = ref(null)
-const treeData = ref([])
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const treeData = ref([]);
 const formConfig = computed(() => {
-	return [
-		{
-			type: 'input',
-			prop: 'tenantId',
-			label: '租户id',
-			required: true,
-			itemWidth: 100,
-			//disabled:true,
-			itemType: 'text',
-		},
-		{
-			type: 'input',
-			prop: 'enterpriseName',
-			label: '企业名称',
-		},
-		{
-			type: 'radio',
-			prop: 'status',
-			label: '启用状态',
-			border: true,
-			data: [
-				{
-					label: '启用',
-					value: 1,
-				},
-				{
-					label: '禁用',
-					value: 0,
-				},
-			],
-		},
-		{
-			type: 'title',
-			title: '管理员信息',
-		},
-		{
-			type: 'input',
-			itemType: 'password',
-			prop: 'password',
-			label: '密码',
-		},
-	]
-})
+  return [
+    {
+      type: "input",
+      prop: "tenantId",
+      label: "租户id",
+      required: true,
+      itemWidth: 100,
+      //disabled:true,
+      itemType: "text",
+    },
+    {
+      type: "input",
+      prop: "enterpriseName",
+      label: "企业名称",
+    },
+    {
+      type: "radio",
+      prop: "status",
+      label: "启用状态",
+      border: true,
+      data: [
+        {
+          label: "启用",
+          value: 1,
+        },
+        {
+          label: "禁用",
+          value: 0,
+        },
+      ],
+    },
+    {
+      type: "title",
+      title: "管理员信息",
+    },
+    {
+      type: "input",
+      itemType: "password",
+      prop: "password",
+      label: "密码",
+    },
+  ];
+});
 const getList = async (req) => {
-	sourceList.value.pagination = { ...sourceList.value.pagination, ...req }
-	loading.value = true
-	proxy.post('/tenantInfo/page',sourceList.value.pagination).then((message) => {
-		console.log(message)
-		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
+    .post("/tenantInfo/page", sourceList.value.pagination)
+    .then((message) => {
+      console.log(message);
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
 const openModal = () => {
-	dialogVisible.value = true
-	modalType.value = 'add'
-	formData.data = {}
-	
-}
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {};
+};
 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 openRoomModal = () => {
-	
-	roomDialogVisible.value = true
-	
-	proxy.get('/tenantInfo/roleMenuTreeSelect/' + selection.value.data[0].tenantId).then((res) => {
-		if(res.code == 200){
-			treeData.value = res.menus
-			formData.treeData = res.checkedKeys
-			tree.value.setCheckedKeys(res.checkedKeys)
-		}
-	})
-	
-}
-const tree = ref(null)
-const submitTree = () => {
-	proxy.post('/tenantInfo/bindingMenu', {
-		tenantId: selection.value.data[0].tenantId,
-		menuIdList: tree.value.getCheckedKeys()
-	}).then((res) => {
-		ElMessage({
-			message: '保存成功',
-			type: 'success',
-		})
-		roomDialogVisible.value = false
-	})
-}
-
+  roomDialogVisible.value = true;
 
+  proxy
+    .get("/tenantInfo/roleMenuTreeSelect/" + selection.value.data[0].tenantId)
+    .then((res) => {
+      if (res.code == 200) {
+        treeData.value = res.menus;
+        formData.treeData = res.checkedKeys;
+        tree.value.setCheckedKeys(res.checkedKeys);
+      }
+    });
+};
+const tree = ref(null);
+const submitTree = () => {
+  proxy
+    .post("/tenantInfo/bindingMenu", {
+      tenantId: selection.value.data[0].tenantId,
+      menuIdList: tree.value.getCheckedKeys(),
+    })
+    .then((res) => {
+      ElMessage({
+        message: "保存成功",
+        type: "success",
+      });
+      roomDialogVisible.value = false;
+    });
+};
 
 const submitForm = () => {
-	console.log(byform.value)
-	byform.value.handleSubmit((valid) => {
-		submitLoading.value = true
-		
-		proxy.post('/tenantInfo/' + modalType.value,formData.data).then((res) => {
-			ElMessage({
-				message: modalType.value == 'add' ? '添加成功' : '编辑成功',
-				type: 'success',
-			})
-			dialogVisible.value = false
-			submitLoading.value = false
-			getList()
-		})
-	})
-}
+  console.log(byform.value);
+  byform.value.handleSubmit((valid) => {
+    submitLoading.value = true;
+
+    proxy.post("/tenantInfo/" + modalType.value, formData.data).then((res) => {
+      ElMessage({
+        message: modalType.value == "add" ? "添加成功" : "编辑成功",
+        type: "success",
+      });
+      dialogVisible.value = false;
+      submitLoading.value = false;
+      getList();
+    });
+  });
+};
 
 const getDtl = (row) => {
-	proxy.post('/tenantInfo/detail', { id: row.id }).then((res) => {
-		formData.data = res
-		console.log(formData)
-		modalType.value = 'edit'
-		dialogVisible.value = true
-	})
-}
+  proxy.post("/tenantInfo/detail", { id: row.id }).then((res) => {
+    formData.data = res;
+    console.log(formData);
+    modalType.value = "edit";
+    dialogVisible.value = true;
+  });
+};
 
-getList()
+const changeStatus = (row) => {
+  modalType.value = "edit";
+  let status = row.status ? 0 : 1;
+  proxy.post("/tenantInfo/detail", { id: row.id }).then((res) => {
+    res.status = status;
+    formData.data = res;
+    ElMessageBox.confirm("你是否确认此操作?", "提示", {
+      confirmButtonText: "确定",
+      cancelButtonText: "取消",
+      type: "warning",
+    }).then(() => {
+      // 删除
+      proxy
+        .post("/tenantInfo/" + modalType.value, formData.data)
+        .then((res) => {
+          ElMessage({
+            message: "操作成功",
+            type: "success",
+          });
+          getList();
+        });
+    });
+  });
+};
+getList();
 </script>
   
 <style lang="scss" scoped>
 .tenant {
-	padding: 20px;
+  padding: 20px;
 }
 </style>

+ 399 - 392
src/views/system/user2/index.vue

@@ -1,431 +1,438 @@
 <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="500"
-			:before-close="handleClose"
-			v-loading="loading"
-		>
-			<template #footer>
-				<el-button @click="roomDialogVisible = false" size="large"
-					>取 消</el-button
-				>
-				<el-button
-					type="primary"
-					@click="submitTree('byform')"
-					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="500"
+      :before-close="handleClose"
+      v-loading="loading"
+    >
+      <template #footer>
+        <el-button @click="roomDialogVisible = false" size="large"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          @click="submitTree('byform')"
+          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 { proxy } = getCurrentInstance()
+  roleKey: [{ required: true, message: "请选择部门", trigger: "blur" }],
+  nickName: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
+  userName: [{ required: true, message: "用户名不能为空", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
 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() {
-							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() {
+              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',
-		},
+  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: [
         {
-            type: 'slot',
-            prop: 'userName',
-            slotName: 'account',
-            label:"账户信息"
+          label: "是",
+          id: 1,
         },
-		{
-			type: 'radio',
-			prop: 'userType',
-			label: '系统用户',
-			required: 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',
-				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',
-		},
-	]
-})
+        {
+          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 = []
-		})
-		
-		treeListData.value = message
-		console.log(treeListData.value)
-	})
+  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);
+  });
+};
 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 })
-}
+  console.log(e);
+  sourceList.value.pagination.tenantId = e.id;
+  getList({ tenantId: e.id });
+};
 
 const openModal = () => {
-	dialogVisible.value = true
-	modalType.value = 'add'
-	formData.data = {}
-}
-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 getDept = () => {
-    proxy.get('/system/user/deptTree')
-        .then((res) => {
-            formConfig.value[0].data = res.data
-        })
-}
+  proxy.get("/system/user/deptTree").then((res) => {
+    formConfig.value[0].data = res.data;
+  });
+};
 
 const getDtl = (row) => {
-	formData.data = {...row}
-	modalType.value = 'edit'
-	console.log(modalType.value)
-	dialogVisible.value = true
-}
-getTreeList()
-getList()
-getDept()
+  formData.data = { ...row };
+  modalType.value = "edit";
+  console.log(modalType.value);
+  dialogVisible.value = true;
+};
+getTreeList();
+getList();
+getDept();
 </script>
   
 <style lang="scss" scoped>
 .user {
-	padding: 20px;
-	display: flex;
-	justify-content: space-between;
-	.tree {
-		width: 300px;
-	}
-	.content {
-		width: calc(100% - 320px);
-	}
+  padding: 20px;
+  display: flex;
+  justify-content: space-between;
+  .tree {
+    width: 300px;
+  }
+  .content {
+    width: calc(100% - 320px);
+  }
 }
 </style>