|
@@ -1,65 +1,101 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="user-page">
|
|
<div class="user-page">
|
|
|
- <SearchForm ref="searchFormRef"
|
|
|
|
|
|
|
+ <SearchForm
|
|
|
|
|
+ ref="searchFormRef"
|
|
|
:departmentList="departmentList"
|
|
:departmentList="departmentList"
|
|
|
- :roleData="roleData"
|
|
|
|
|
- @get-table-data="onSearchCommit"
|
|
|
|
|
- @reset-form="onResetForm"/>
|
|
|
|
|
- <div class="user-list" >
|
|
|
|
|
- <BasicTable
|
|
|
|
|
- :columns="columns"
|
|
|
|
|
- :data-source="userList"
|
|
|
|
|
- :row-key="(row) => row.userId"
|
|
|
|
|
- ref="basicTableRef"
|
|
|
|
|
- :pagination="{ total: total, pageSize: params.pageSize, hideOnSinglePage: false }"
|
|
|
|
|
- :actionColumn="actionColumn"
|
|
|
|
|
- :tableSetting="{
|
|
|
|
|
- size: false,
|
|
|
|
|
- redo: false,
|
|
|
|
|
- fullscreen: false,
|
|
|
|
|
- striped: false,
|
|
|
|
|
- setting: false,
|
|
|
|
|
- }"
|
|
|
|
|
- @update:checked-row-keys="onCheckedRow"
|
|
|
|
|
- virtual-scroll
|
|
|
|
|
- @page-num-change="handlePageNumChange"
|
|
|
|
|
- @page-size-change="handlePageSizeChange"
|
|
|
|
|
- >
|
|
|
|
|
- <template #tableTitle>
|
|
|
|
|
- <el-space align="center">
|
|
|
|
|
- <el-button type="primary" @click="openAddSingleDrawer">
|
|
|
|
|
- <template #icon>
|
|
|
|
|
- <el-icon>
|
|
|
|
|
- <Plus />
|
|
|
|
|
- </el-icon>
|
|
|
|
|
- </template>
|
|
|
|
|
- 添加用户
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <el-button @click="openAddAdminDrawer" v-if="isSysTenant">
|
|
|
|
|
- <template #icon>
|
|
|
|
|
- <el-icon>
|
|
|
|
|
- <Plus />
|
|
|
|
|
- </el-icon>
|
|
|
|
|
- </template>
|
|
|
|
|
- 添加租户管理员
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <el-button
|
|
|
|
|
- color="#1890FF"
|
|
|
|
|
- @click="openAddMultipleDrawer"
|
|
|
|
|
- style="margin-left: 18px"
|
|
|
|
|
- plain
|
|
|
|
|
- >
|
|
|
|
|
- <template #icon>
|
|
|
|
|
- <el-icon>
|
|
|
|
|
- <DocumentAdd />
|
|
|
|
|
- </el-icon>
|
|
|
|
|
- </template>
|
|
|
|
|
- 批量导入
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </el-space>
|
|
|
|
|
- </template>
|
|
|
|
|
- </BasicTable>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ :roleData="roleData"
|
|
|
|
|
+ @get-table-data="onSearchCommit"
|
|
|
|
|
+ @reset-form="onResetForm"
|
|
|
|
|
+ />
|
|
|
|
|
+ <el-card>
|
|
|
|
|
+ <template #header>
|
|
|
|
|
+ <el-space align="center">
|
|
|
|
|
+ <el-button type="primary" @click="openAddSingleDrawer">
|
|
|
|
|
+ <template #icon>
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <Plus />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ 添加用户
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button @click="openAddAdminDrawer" v-if="isSysTenant">
|
|
|
|
|
+ <template #icon>
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <Plus />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ 添加租户管理员
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button color="#1890FF" @click="openAddMultipleDrawer" style="margin-left: 18px" plain>
|
|
|
|
|
+ <template #icon>
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <DocumentAdd />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ 批量导入
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </el-space>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <el-table height="calc(100vh - 340px)" :data="userList">
|
|
|
|
|
+ <el-table-column label="工号" prop="staffNo">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.staffNo }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="登录账号" prop="username" />
|
|
|
|
|
+ <el-table-column label="姓名" prop="realname" />
|
|
|
|
|
+ <el-table-column label="手机" prop="mobile" />
|
|
|
|
|
+ <el-table-column label="状态" prop="isDisabled">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
|
|
+ <el-tag :type="!scope.row.isDisabled ? 'success' : 'danger'">
|
|
|
|
|
+ {{ !scope.row.isDisabled ? '正常' : '锁定' }}</el-tag
|
|
|
|
|
+ >
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="角色" prop="roleList">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
|
|
+ {{ tranformRoleList(scope.row.roleList) }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="组织" prop="deptList">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
|
|
+ {{ tranformDeptList(scope.row.deptList) }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="认证方式" prop="certify" />
|
|
|
|
|
+ <el-table-column label="创建时间" prop="createdAt" />
|
|
|
|
|
+ <el-table-column label="操作" width="200">
|
|
|
|
|
+ <template #default="scope ">
|
|
|
|
|
+ <el-space>
|
|
|
|
|
+ <el-button v-if="scope.row.roleType !== RoleTypeEnum.SUPER_ADMIN" type="primary" :icon="Edit" text @click="handleEdit(scope.row)" />
|
|
|
|
|
+ <el-button v-if="scope.row.roleType !== RoleTypeEnum.SUPER_ADMIN" type="primary" :icon="Delete" text @click="handleDelete(scope.row.id)" />
|
|
|
|
|
+ <el-button type="primary" text @click="handleResetCode(scope.row.id)">重置密码</el-button>
|
|
|
|
|
+ </el-space>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+
|
|
|
|
|
+ <section class="mt-4 flex justify-end">
|
|
|
|
|
+ <el-pagination
|
|
|
|
|
+ background
|
|
|
|
|
+ layout="total, sizes, prev, pager, next"
|
|
|
|
|
+ :page-sizes="[10, 30, 50]"
|
|
|
|
|
+ :total="total"
|
|
|
|
|
+ v-model:page-size="params.pageSize"
|
|
|
|
|
+ v-model:current-page="params.pageNumber"
|
|
|
|
|
+ @change="loadPageData"
|
|
|
|
|
+ />
|
|
|
|
|
+ </section>
|
|
|
|
|
+ </el-card>
|
|
|
<CreateDrawer
|
|
<CreateDrawer
|
|
|
ref="createDrawerRef"
|
|
ref="createDrawerRef"
|
|
|
:title="drawerTitle"
|
|
:title="drawerTitle"
|
|
@@ -88,14 +124,10 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
- import { h, reactive, ref, onMounted } from 'vue';
|
|
|
|
|
|
|
+ import { reactive, ref, onMounted } from 'vue';
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
- import { Plus, DocumentAdd } from '@element-plus/icons-vue';
|
|
|
|
|
|
|
+ import { Plus, DocumentAdd, Edit, Delete } from '@element-plus/icons-vue';
|
|
|
import { isEmpty } from 'lodash-es';
|
|
import { isEmpty } from 'lodash-es';
|
|
|
- import editIcon from '@/assets/images/table/table-edit.png';
|
|
|
|
|
- import deleteIcon from '@/assets/images/table/table-delete.png';
|
|
|
|
|
- import { BasicTable, BasicColumn } from '@/components/Table';
|
|
|
|
|
- import { columns } from './columns';
|
|
|
|
|
import { EditType, OptionsProps, SearchParamsProps } from './types';
|
|
import { EditType, OptionsProps, SearchParamsProps } from './types';
|
|
|
import { RoleTypeEnum } from '@/types/role/constants';
|
|
import { RoleTypeEnum } from '@/types/role/constants';
|
|
|
import useSceneInfos from '@/hooks/useSceneInfos';
|
|
import useSceneInfos from '@/hooks/useSceneInfos';
|
|
@@ -104,18 +136,18 @@
|
|
|
import { getUserList, UserLisItem, deleteUser } from '@/api/system/user-operate';
|
|
import { getUserList, UserLisItem, deleteUser } from '@/api/system/user-operate';
|
|
|
import { ResultEnum } from '@/enums/httpEnum';
|
|
import { ResultEnum } from '@/enums/httpEnum';
|
|
|
import { useTargetTenantIdSetting } from '@/utils/useTargetTenantIdSetting';
|
|
import { useTargetTenantIdSetting } from '@/utils/useTargetTenantIdSetting';
|
|
|
|
|
+ import type { RoleListItem } from '@/api/system/user-operate';
|
|
|
|
|
+ import type {DeptTreeItem } from '@/api/system/user-query'
|
|
|
import SearchForm from './component/SearchForm.vue';
|
|
import SearchForm from './component/SearchForm.vue';
|
|
|
import AddUser from './component/AddUser.vue';
|
|
import AddUser from './component/AddUser.vue';
|
|
|
- import ActionColomns from './component/ActionColomns.vue';
|
|
|
|
|
import CreateDrawer from './CreateDrawer.vue';
|
|
import CreateDrawer from './CreateDrawer.vue';
|
|
|
import ResetCodeDrawer from './ResetCodeDrawer.vue';
|
|
import ResetCodeDrawer from './ResetCodeDrawer.vue';
|
|
|
import CreateAdminDrawer from './CreateAdminDrawer.vue';
|
|
import CreateAdminDrawer from './CreateAdminDrawer.vue';
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const sceneInfos = useSceneInfos();
|
|
const sceneInfos = useSceneInfos();
|
|
|
const { calculateTreeData } = sceneInfos;
|
|
const { calculateTreeData } = sceneInfos;
|
|
|
const userList = ref<UserLisItem[]>([]);
|
|
const userList = ref<UserLisItem[]>([]);
|
|
|
const searchFormRef = ref<InstanceType<typeof SearchForm>>();
|
|
const searchFormRef = ref<InstanceType<typeof SearchForm>>();
|
|
|
- const basicTableRef = ref<InstanceType<typeof BasicTable>>();
|
|
|
|
|
const createDrawerRef = ref<InstanceType<typeof CreateDrawer>>();
|
|
const createDrawerRef = ref<InstanceType<typeof CreateDrawer>>();
|
|
|
const ResetCodeDrawerRef = ref<InstanceType<typeof ResetCodeDrawer>>();
|
|
const ResetCodeDrawerRef = ref<InstanceType<typeof ResetCodeDrawer>>();
|
|
|
const createAdminDrawerRef = ref<InstanceType<typeof CreateAdminDrawer>>();
|
|
const createAdminDrawerRef = ref<InstanceType<typeof CreateAdminDrawer>>();
|
|
@@ -129,43 +161,6 @@
|
|
|
const createAdminType = ref(EditType.create);
|
|
const createAdminType = ref(EditType.create);
|
|
|
const { isSysTenant } = useTargetTenantIdSetting();
|
|
const { isSysTenant } = useTargetTenantIdSetting();
|
|
|
|
|
|
|
|
- const actionColumn: BasicColumn = reactive({
|
|
|
|
|
- width: 150,
|
|
|
|
|
- title: '操作',
|
|
|
|
|
- prop: 'action',
|
|
|
|
|
- key: 'action',
|
|
|
|
|
- fixed: 'right',
|
|
|
|
|
- render(record) {
|
|
|
|
|
- return h(ActionColomns as any, {
|
|
|
|
|
- space: 20,
|
|
|
|
|
- color: '#629bf9',
|
|
|
|
|
- style: 'img',
|
|
|
|
|
- size: 16,
|
|
|
|
|
- actionIcons: ( record.row.roleType !== RoleTypeEnum.SUPER_ADMIN ?[
|
|
|
|
|
- {
|
|
|
|
|
- label: '编辑',
|
|
|
|
|
- icon: editIcon,
|
|
|
|
|
- onClick: handleEdit.bind(null, record.row),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '删除',
|
|
|
|
|
- icon: deleteIcon,
|
|
|
|
|
- onClick: handleDelete.bind(null, record.row),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '重置密码',
|
|
|
|
|
- onClick: handleResetCode.bind(null, record.row),
|
|
|
|
|
- },
|
|
|
|
|
- ] : [
|
|
|
|
|
- {
|
|
|
|
|
- label: '重置密码',
|
|
|
|
|
- onClick: handleResetCode.bind(null, record.row),
|
|
|
|
|
- },
|
|
|
|
|
- ]),
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
function onCheckedRow(keys) {
|
|
function onCheckedRow(keys) {
|
|
|
rowKeys.value = keys;
|
|
rowKeys.value = keys;
|
|
|
rowKeysName.value = tableData.value
|
|
rowKeysName.value = tableData.value
|
|
@@ -179,7 +174,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function reloadTable() {
|
|
function reloadTable() {
|
|
|
- loadPageData()
|
|
|
|
|
|
|
+ loadPageData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const openAddSingleDrawer = () => {
|
|
const openAddSingleDrawer = () => {
|
|
@@ -190,7 +185,6 @@
|
|
|
} else {
|
|
} else {
|
|
|
createDrawerRef.value?.openDrawer();
|
|
createDrawerRef.value?.openDrawer();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
};
|
|
};
|
|
|
const openAddAdminDrawer = () => {
|
|
const openAddAdminDrawer = () => {
|
|
|
createAdminTitle.value = '添加租户管理员';
|
|
createAdminTitle.value = '添加租户管理员';
|
|
@@ -230,15 +224,15 @@
|
|
|
type: 'warning',
|
|
type: 'warning',
|
|
|
})
|
|
})
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
- deleteUser({ userId: record.id }).then(res => {
|
|
|
|
|
|
|
+ deleteUser({ userId: record.id }).then((res) => {
|
|
|
if (res.code === ResultEnum.SUCCESS) {
|
|
if (res.code === ResultEnum.SUCCESS) {
|
|
|
ElMessage({
|
|
ElMessage({
|
|
|
type: 'success',
|
|
type: 'success',
|
|
|
message: '删除成功',
|
|
message: '删除成功',
|
|
|
});
|
|
});
|
|
|
- loadPageData()
|
|
|
|
|
|
|
+ loadPageData();
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
})
|
|
})
|
|
|
.catch(() => {
|
|
.catch(() => {
|
|
|
ElMessage({
|
|
ElMessage({
|
|
@@ -249,7 +243,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
|
- loadPageData()
|
|
|
|
|
|
|
+ loadPageData();
|
|
|
getAllDepartments().then((res) => {
|
|
getAllDepartments().then((res) => {
|
|
|
departmentList.value = calculateTreeData(
|
|
departmentList.value = calculateTreeData(
|
|
|
res,
|
|
res,
|
|
@@ -257,7 +251,7 @@
|
|
|
1,
|
|
1,
|
|
|
);
|
|
);
|
|
|
});
|
|
});
|
|
|
- const res = await getRoles() || [];
|
|
|
|
|
|
|
+ const res = (await getRoles()) || [];
|
|
|
roleData.value = res.map((item: any) => {
|
|
roleData.value = res.map((item: any) => {
|
|
|
return {
|
|
return {
|
|
|
value: item.id,
|
|
value: item.id,
|
|
@@ -270,8 +264,8 @@
|
|
|
const params = reactive<SearchParamsProps>({
|
|
const params = reactive<SearchParamsProps>({
|
|
|
pageNumber: 1,
|
|
pageNumber: 1,
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
- queryParam: {}
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ queryParam: {},
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
// 获取页面数据
|
|
// 获取页面数据
|
|
|
const total = ref(0);
|
|
const total = ref(0);
|
|
@@ -282,28 +276,30 @@
|
|
|
Object.entries(searchFormData).forEach(([key, value]) => {
|
|
Object.entries(searchFormData).forEach(([key, value]) => {
|
|
|
if (!isEmpty(value)) {
|
|
if (!isEmpty(value)) {
|
|
|
if (['deptId, roleId'].includes(key)) {
|
|
if (['deptId, roleId'].includes(key)) {
|
|
|
- params.queryParam[key] = value
|
|
|
|
|
|
|
+ params.queryParam[key] = value;
|
|
|
}
|
|
}
|
|
|
params.queryParam[queryType] = queryTypeContent;
|
|
params.queryParam[queryType] = queryTypeContent;
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
// 删除多余参数
|
|
// 删除多余参数
|
|
|
delteExtraParams(queryType);
|
|
delteExtraParams(queryType);
|
|
|
- getUserList(params).then(res => {
|
|
|
|
|
|
|
+ getUserList(params).then((res) => {
|
|
|
userList.value = res.records;
|
|
userList.value = res.records;
|
|
|
- userList.value.forEach(item =>{item.certify = "本地认证";})
|
|
|
|
|
|
|
+ userList.value.forEach((item) => {
|
|
|
|
|
+ item.certify = '本地认证';
|
|
|
|
|
+ });
|
|
|
total.value = res.totalRow;
|
|
total.value = res.totalRow;
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
const extraParams = ['realname', 'mobile', 'staffNo'];
|
|
const extraParams = ['realname', 'mobile', 'staffNo'];
|
|
|
const delteExtraParams = (type) => {
|
|
const delteExtraParams = (type) => {
|
|
|
- const needDeleteArr = extraParams.filter(item => item !== type);
|
|
|
|
|
- needDeleteArr.forEach(item => {
|
|
|
|
|
|
|
+ const needDeleteArr = extraParams.filter((item) => item !== type);
|
|
|
|
|
+ needDeleteArr.forEach((item) => {
|
|
|
delete params.queryParam[item];
|
|
delete params.queryParam[item];
|
|
|
});
|
|
});
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
// 获取列表数据
|
|
// 获取列表数据
|
|
|
const onSearchCommit = () => {
|
|
const onSearchCommit = () => {
|
|
@@ -313,22 +309,19 @@
|
|
|
// 重置列表数据
|
|
// 重置列表数据
|
|
|
const onResetForm = () => {
|
|
const onResetForm = () => {
|
|
|
params.pageNumber = 1;
|
|
params.pageNumber = 1;
|
|
|
- params.pageSize = 10
|
|
|
|
|
- params.queryParam = {}
|
|
|
|
|
|
|
+ params.pageSize = 10;
|
|
|
|
|
+ params.queryParam = {};
|
|
|
loadPageData();
|
|
loadPageData();
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- // 分页跳转
|
|
|
|
|
- const handlePageNumChange = (pageNum) => {
|
|
|
|
|
- params.pageNumber = pageNum;
|
|
|
|
|
- loadPageData();
|
|
|
|
|
|
|
+ const tranformRoleList = (arr: RoleListItem[]) => {
|
|
|
|
|
+ if (arr && arr.length === 0) return '--';
|
|
|
|
|
+ return arr?.map((item) => item.roleName).join(',');
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 更换页面
|
|
|
|
|
- const handlePageSizeChange = (size) => {
|
|
|
|
|
- params.pageNumber = 1;
|
|
|
|
|
- params.pageSize = size;
|
|
|
|
|
- loadPageData();
|
|
|
|
|
|
|
+ const tranformDeptList = (arr: DeptTreeItem[]) => {
|
|
|
|
|
+ if (arr && arr.length === 0) return '--';
|
|
|
|
|
+ return arr?.map((item) => item.deptName).join(',');
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
<style scoped>
|
|
<style scoped>
|