update 员工管理去掉筛选按钮

This commit is contained in:
2026-04-15 17:57:15 +08:00
parent 3746fd8388
commit 76ece9d5f8

View File

@@ -1,18 +1,24 @@
<template>
<div class="layout-padding-auto layout-padding-view">
<div class="mb-5">
<el-input v-model="queryForm.nickname" style="max-width: 300px" :placeholder="$t('staffManage.inputNickNameTip')" class="input-with-select" @keyup.enter="queryStaffs">
<el-input
v-model="queryForm.nickname"
style="max-width: 300px"
:placeholder="$t('staffManage.inputNickNameTip')"
class="input-with-select"
@keyup.enter="queryStaffs"
>
<template #append>
<el-button :icon="Search" @click="queryStaffs" />
</template>
</el-input>
<el-popover :width="400" trigger="click" :teleported="false" v-model:visible="visible">
<template #reference>
<!-- <template #reference>
<el-button class="ml-5" text>
<i class="mdi mdi-filter-outline text-xl"></i>
</el-button>
</template>
</template> -->
<div>
<header class="flex justify-between items-center px-3">
<h3>{{ $t('staffManage.filter') }}</h3>
@@ -97,11 +103,11 @@
</template>
<script lang="tsx" setup>
import {Audit, changeStatus, deleteStaff, getStaffList, IStaff, IStaffQuery, StaffStatusEnum, StaffStatusMap} from '/@/api/admin/staffManage';
import {ITableRenderColumn} from '/@/components/TableRender/types';
import {formatTimestamp} from '/@/utils/formatTime';
import {Search} from '@element-plus/icons-vue';
import {ElButton} from 'element-plus';
import { Audit, changeStatus, deleteStaff, getStaffList, IStaff, IStaffQuery, StaffStatusEnum, StaffStatusMap } from '/@/api/admin/staffManage';
import { ITableRenderColumn } from '/@/components/TableRender/types';
import { formatTimestamp } from '/@/utils/formatTime';
import { Search } from '@element-plus/icons-vue';
import { ElButton } from 'element-plus';
import EditForm from './editForm.vue';
import InviteForm from './inviteForm.vue';
import { useMessage, useMessageBox } from '/@/hooks/message';
@@ -117,8 +123,8 @@ const inviteFormRef = ref<InstanceType<typeof InviteForm>>();
const visible = ref(false);
const props = defineProps<{
deptId?: string;
posts: {postId: string; postName: string}[];
roles: {roleId: string; roleName: string}[];
posts: { postId: string; postName: string }[];
roles: { roleId: string; roleName: string }[];
}>();
const pagination = reactive({
current: 1,
@@ -164,9 +170,9 @@ const queryParams = ref<IStaffQuery>({
size: 10,
});
const statusType = [
{label: t(`staffManage.all`), value: ''},
{label: t(`staffManage.unlocked`), value: StaffStatusEnum.UNLOCKED},
{label: t(`staffManage.locked`), value: StaffStatusEnum.LOCKED},
{ label: t(`staffManage.all`), value: '' },
{ label: t(`staffManage.unlocked`), value: StaffStatusEnum.UNLOCKED },
{ label: t(`staffManage.locked`), value: StaffStatusEnum.LOCKED },
];
const tableData = ref<IStaff[]>([]);
const tableColumns = computed<ITableRenderColumn<IStaff & Audit>[]>(() => [
@@ -174,7 +180,8 @@ const tableColumns = computed<ITableRenderColumn<IStaff & Audit>[]>(() => [
label: '',
type: 'index',
},
{ // SPDM CODE
{
// SPDM CODE
label: t('staffManage.username'),
prop: 'username',
},
@@ -223,18 +230,18 @@ const tableColumns = computed<ITableRenderColumn<IStaff & Audit>[]>(() => [
label: t('common.action'),
fixed: 'right',
width: 200,
renderDefault: ({row}: {row: IStaff}) => {
renderDefault: ({ row }: { row: IStaff }) => {
return (
<>
<ElButton type="primary" link onClick={() => updateStaff(row.staffId)}>
{ t('common.editBtn')}
{t('common.editBtn')}
</ElButton>
<ElButton type="primary" link onClick={() => handleChangeStatus(row.staffId, row.status)}>
{row.status === StaffStatusEnum.UNLOCKED ? t('staffManage.lock') : t('staffManage.unlock')}
</ElButton>
<ElButton type="primary" link onClick={() => handleDelete(row.staffId)}>
{ t('common.delBtn')}
{t('common.delBtn')}
</ElButton>
</>
);
@@ -243,16 +250,16 @@ const tableColumns = computed<ITableRenderColumn<IStaff & Audit>[]>(() => [
]);
const currentChangeHandle = (value: number) => {
pagination.current = value;
const {current, size, ...rest} = queryParams.value;
queryParams.value = {...rest, size, current: value};
const { current, size, ...rest } = queryParams.value;
queryParams.value = { ...rest, size, current: value };
getDataList();
};
const sizeChangeHandle = (value: number) => {
pagination.size = value;
const {current, size, ...rest} = queryParams.value;
queryParams.value = {...rest, size: value, current: 1};
const { current, size, ...rest } = queryParams.value;
queryParams.value = { ...rest, size: value, current: 1 };
getDataList();
};
const resetFields = () => {
@@ -264,7 +271,7 @@ const resetFields = () => {
getDataList();
};
const tableStyle = {
cellStyle: {textAlign: 'center'},
cellStyle: { textAlign: 'center' },
headerCellStyle: {
textAlign: 'center',
background: 'var(--el-table-row-hover-bg-color)',
@@ -273,16 +280,16 @@ const tableStyle = {
};
const queryStaffs = () => {
const {size} = queryParams.value;
const { size } = queryParams.value;
const {phone, nickname, email, status, roles, posts} = queryForm.value;
const { phone, nickname, email, status, roles, posts } = queryForm.value;
const params: IStaffQuery = {
...(phone && {phone}),
...(nickname && {nickname}),
...(email && {email}),
...(status && {status}),
...(roles.length && {roles}),
...(posts.length && {posts}),
...(phone && { phone }),
...(nickname && { nickname }),
...(email && { email }),
...(status && { status }),
...(roles.length && { roles }),
...(posts.length && { posts }),
size,
current: 1,
};
@@ -298,8 +305,8 @@ const getDataList = async () => {
pagination.current = data.current;
pagination.total = data.total;
tableData.value = data.records.map((item: any) => {
const {postList, roleList, email, status, staffId, userInfo, deptList} = item;
const {phone, nickname, username} = userInfo;
const { postList, roleList, email, status, staffId, userInfo, deptList } = item;
const { phone, nickname, username } = userInfo;
const posts = postList.map((post: any) => post.postId);
const roles = roleList.map((role: any) => role.roleId);
const depts = deptList;