|
@@ -26,16 +26,47 @@
|
|
<template #roles="{ row }">
|
|
<template #roles="{ row }">
|
|
{{ row.roles.map((item) => item.name).join('、') }}
|
|
{{ row.roles.map((item) => item.name).join('、') }}
|
|
</template>
|
|
</template>
|
|
- <template #enable="{ row }">
|
|
|
|
- {{ row.enable ? '启用' : '禁用' }}
|
|
|
|
|
|
+ <template #enable="{ col, row }">
|
|
|
|
+ <status-tag :value="row[col.colKey]" type="enable"></status-tag>
|
|
|
|
+ </template>
|
|
|
|
+ <template #operate="{ row }">
|
|
|
|
+ <div class="table-operations">
|
|
|
|
+ <t-link
|
|
|
|
+ v-perm="'user_LINK_UpdatePwd'"
|
|
|
|
+ theme="primary"
|
|
|
|
+ hover="color"
|
|
|
|
+ @click="handleModifyPwd(row)"
|
|
|
|
+ >
|
|
|
|
+ 修改密码
|
|
|
|
+ </t-link>
|
|
|
|
+
|
|
|
|
+ <t-link
|
|
|
|
+ v-perm="'user_LINK_Update'"
|
|
|
|
+ theme="primary"
|
|
|
|
+ hover="color"
|
|
|
|
+ @click="handleEdit(row)"
|
|
|
|
+ >
|
|
|
|
+ 修改
|
|
|
|
+ </t-link>
|
|
|
|
+ <t-link
|
|
|
|
+ v-perm="'user_LINK_Enable'"
|
|
|
|
+ :theme="row.enable ? 'danger' : 'success'"
|
|
|
|
+ hover="color"
|
|
|
|
+ @click="handleEnable(row)"
|
|
|
|
+ >
|
|
|
|
+ {{ row.enable ? '禁用' : '启用' }}
|
|
|
|
+ </t-link>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
</t-table>
|
|
</t-table>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
<AddUserDialog
|
|
<AddUserDialog
|
|
v-model:visible="showAddUserDialog"
|
|
v-model:visible="showAddUserDialog"
|
|
:curRow="curRow"
|
|
:curRow="curRow"
|
|
@success="addSuccess"
|
|
@success="addSuccess"
|
|
></AddUserDialog>
|
|
></AddUserDialog>
|
|
|
|
+
|
|
<UpdateUserPwdDialog
|
|
<UpdateUserPwdDialog
|
|
v-model:visible="showUpdateUserPwdDialog"
|
|
v-model:visible="showUpdateUserPwdDialog"
|
|
:curRow="curRow"
|
|
:curRow="curRow"
|
|
@@ -52,69 +83,24 @@ import useFetchTable from '@/hooks/useFetchTable';
|
|
import AddUserDialog from './add-user-dialog.vue';
|
|
import AddUserDialog from './add-user-dialog.vue';
|
|
import UpdateUserPwdDialog from './update-user-pwd-dialog.vue';
|
|
import UpdateUserPwdDialog from './update-user-pwd-dialog.vue';
|
|
import { toggleUserStatus } from '@/api/user';
|
|
import { toggleUserStatus } from '@/api/user';
|
|
-import { MessagePlugin } from 'tdesign-vue-next';
|
|
|
|
|
|
+import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
|
|
const showAddUserDialog = ref(false);
|
|
const showAddUserDialog = ref(false);
|
|
const showUpdateUserPwdDialog = ref(false);
|
|
const showUpdateUserPwdDialog = ref(false);
|
|
const curRow = ref(null);
|
|
const curRow = ref(null);
|
|
-const toggleStatus = (row) => {
|
|
|
|
- toggleUserStatus({ id: row.id, enable: !row.enable }).then(() => {
|
|
|
|
- MessagePlugin.success('操作成功');
|
|
|
|
- search();
|
|
|
|
- });
|
|
|
|
-};
|
|
|
|
|
|
+
|
|
const columns = [
|
|
const columns = [
|
|
{ colKey: 'id', title: '用户ID', width: 200 },
|
|
{ colKey: 'id', title: '用户ID', width: 200 },
|
|
- { colKey: 'realName', title: '姓名' },
|
|
|
|
|
|
+ { colKey: 'realName', title: '姓名', minWidth: 140 },
|
|
{ colKey: 'genderStr', title: '性别', width: 80 },
|
|
{ colKey: 'genderStr', title: '性别', width: 80 },
|
|
{ colKey: 'mobileNumber', title: '手机', width: 160 },
|
|
{ colKey: 'mobileNumber', title: '手机', width: 160 },
|
|
|
|
+ { colKey: 'orgName', title: '所属节点', width: 160 },
|
|
{ colKey: 'roles', title: '角色' },
|
|
{ colKey: 'roles', title: '角色' },
|
|
{ colKey: 'enable', title: '状态', width: 100 },
|
|
{ colKey: 'enable', title: '状态', width: 100 },
|
|
{
|
|
{
|
|
title: '管理',
|
|
title: '管理',
|
|
colKey: 'operate',
|
|
colKey: 'operate',
|
|
fixed: 'right',
|
|
fixed: 'right',
|
|
- width: 230,
|
|
|
|
- cell: (h, { row }) => {
|
|
|
|
- return (
|
|
|
|
- <div class="table-operations">
|
|
|
|
- <t-link
|
|
|
|
- v-perm="user_LINK_UpdatePwd"
|
|
|
|
- theme="primary"
|
|
|
|
- hover="color"
|
|
|
|
- onClick={(e) => {
|
|
|
|
- e.stopPropagation();
|
|
|
|
- curRow.value = row;
|
|
|
|
- showUpdateUserPwdDialog.value = true;
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- 修改密码
|
|
|
|
- </t-link>
|
|
|
|
- <t-link
|
|
|
|
- v-perm="user_LINK_Update"
|
|
|
|
- theme="primary"
|
|
|
|
- hover="color"
|
|
|
|
- onClick={(e) => {
|
|
|
|
- e.stopPropagation();
|
|
|
|
- curRow.value = row;
|
|
|
|
- showAddUserDialog.value = true;
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- 修改
|
|
|
|
- </t-link>
|
|
|
|
- <t-link
|
|
|
|
- v-perm="user_LINK_Enable"
|
|
|
|
- theme={row.enable ? 'danger' : 'success'}
|
|
|
|
- hover="color"
|
|
|
|
- onClick={(e) => {
|
|
|
|
- e.stopPropagation();
|
|
|
|
- toggleStatus(row);
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- {row.enable ? '禁用' : '启用'}
|
|
|
|
- </t-link>
|
|
|
|
- </div>
|
|
|
|
- );
|
|
|
|
- },
|
|
|
|
|
|
+ width: 200,
|
|
},
|
|
},
|
|
];
|
|
];
|
|
|
|
|
|
@@ -132,6 +118,37 @@ const handleAdd = () => {
|
|
showAddUserDialog.value = true;
|
|
showAddUserDialog.value = true;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+const handleEdit = (row) => {
|
|
|
|
+ curRow.value = row;
|
|
|
|
+ showAddUserDialog.value = true;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const handleEnable = (row) => {
|
|
|
|
+ const name = !row.enable ? '启用' : '禁用';
|
|
|
|
+
|
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
|
+ header: `${name}提示`,
|
|
|
|
+ body: `是否${name}该用户?`,
|
|
|
|
+ confirmBtn: '确定',
|
|
|
|
+ cancelBtn: '取消',
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
+ confirmDia.hide();
|
|
|
|
+ const res = await toggleUserStatus({
|
|
|
|
+ id: row.id,
|
|
|
|
+ enable: !row.enable,
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+ if (!res) return;
|
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
|
+ row.enable = !row.enable;
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const handleModifyPwd = (row) => {
|
|
|
|
+ curRow.value = row;
|
|
|
|
+ showUpdateUserPwdDialog.value = true;
|
|
|
|
+};
|
|
|
|
+
|
|
const addSuccess = () => {
|
|
const addSuccess = () => {
|
|
showAddUserDialog.value = false;
|
|
showAddUserDialog.value = false;
|
|
MessagePlugin.success('操作成功');
|
|
MessagePlugin.success('操作成功');
|
|
@@ -142,5 +159,3 @@ const updatePwdSuccess = () => {
|
|
MessagePlugin.success('操作成功');
|
|
MessagePlugin.success('操作成功');
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
-
|
|
|
|
-<style></style>
|
|
|