feat(property): 人员管理增加人员标签功能
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
zcxlsm 2025-08-08 15:09:54 +08:00
parent c3f43f6e71
commit 5494d206d4
5 changed files with 85 additions and 74 deletions

View File

@ -24,7 +24,7 @@ export interface PersonVO {
/** /**
* *
*/ */
gender: number gender: string | number
/** /**
* *
@ -75,6 +75,10 @@ export interface PersonVO {
authEndDate?: string authEndDate?: string
authTime: any[]
rosterType?: string | number
} }
export interface PersonForm extends BaseEntity { export interface PersonForm extends BaseEntity {
@ -293,7 +297,7 @@ export interface Person extends BaseEntity {
* @param file excel文件 * @param file excel文件
*/ */
export interface PerssonImportParam { export interface PerssonImportParam {
updateSupport: boolean; updateSupport: boolean
unitId: number; unitId: number
file: Blob | File; file: Blob | File
} }

View File

@ -41,19 +41,10 @@ export const querySchema: FormSchemaGetter = () => [
export const columns: VxeGridProps['columns'] = [ export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 }, { type: 'checkbox', width: 60 },
// { // {
// title: '号', // title: '员工编号',
// field: 'id', // field: 'id',
// slots: { // width: 100,
// default: ({ rowIndex }) => {
// return (rowIndex + 1).toString();
// },
// },
// }, // },
{
title: '员工编号',
field: 'id',
width: 100,
},
{ {
title: '员工名称', title: '员工名称',
field: 'userName', field: 'userName',
@ -62,7 +53,7 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '联系电话', title: '联系电话',
field: 'phone', field: 'phone',
width: 100, width: 120,
}, },
{ {
title: '性别', title: '性别',
@ -72,18 +63,18 @@ export const columns: VxeGridProps['columns'] = [
return renderDict(row.gender, 'sys_user_sex') return renderDict(row.gender, 'sys_user_sex')
}, },
}, },
width: 100, width: 80,
}, },
{ {
field: 'img', field: 'img',
title: '人脸图片', title: '人脸图片',
slots: { default: 'img' }, slots: { default: 'img' },
minWidth: 80, width: 100,
}, },
{ {
title: '所属单位', title: '所属单位',
field: 'unitName', field: 'unitName',
width: 100, width: 160,
}, },
// { // {
// title: '入驻位置', // title: '入驻位置',
@ -93,10 +84,18 @@ export const columns: VxeGridProps['columns'] = [
title: '入驻时间', title: '入驻时间',
field: 'time', field: 'time',
width: 100, width: 100,
formatter: ({ cellValue }) => {
return cellValue ? new Date(cellValue).toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '-') : ''
}
}, },
{ {
title: '车牌号码', title: '人员标签',
field: 'carNumber', field: 'rosterType',
slots: {
default: ({ row }) => {
return renderDict(row.rosterType, 'roster_type')
},
},
width: 100, width: 100,
}, },
{ {
@ -112,14 +111,13 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '备注', title: '备注',
field: 'remark', field: 'remark',
width: 100,
}, },
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',
slots: { default: 'action' }, slots: { default: 'action' },
title: '操作', title: '操作',
minWidth: 180, width: 200,
}, },
] ]
@ -236,7 +234,24 @@ export const modalSchema: FormSchemaGetter = () => [
}, },
triggerFields: ['id'], triggerFields: ['id'],
}, },
},
{
label: '人员标签',
fieldName: 'rosterType',
component: 'Select',
formItemClass: 'col-span-1',
componentProps: {
options: getDictOptions('roster_type')
},
dependencies: {
show: (values) => {
return typeof values.id !== 'undefined'
},
disabled: (values) => {
return !values.authSwitch
},
triggerFields: ['id', 'authSwitch'],
},
}, },
{ {
label: '授权期限', label: '授权期限',
@ -253,7 +268,7 @@ export const modalSchema: FormSchemaGetter = () => [
show: (values) => { show: (values) => {
return typeof values.id !== 'undefined' return typeof values.id !== 'undefined'
}, },
disabled:(values) => { disabled: (values) => {
return !values.authSwitch return !values.authSwitch
}, },
triggerFields: ['id', 'authSwitch'], triggerFields: ['id', 'authSwitch'],
@ -263,12 +278,12 @@ export const modalSchema: FormSchemaGetter = () => [
label: '通行权限组', label: '通行权限组',
fieldName: 'authGroupId', fieldName: 'authGroupId',
component: 'ApiSelect', component: 'ApiSelect',
formItemClass: 'col-span-2', formItemClass: 'col-span-1',
dependencies: { dependencies: {
show: (values) => { show: (values) => {
return typeof values.id !== 'undefined' return typeof values.id !== 'undefined'
}, },
disabled:(values) => { disabled: (values) => {
return !values.authSwitch return !values.authSwitch
}, },
triggerFields: ['id', 'authSwitch'], triggerFields: ['id', 'authSwitch'],
@ -393,8 +408,8 @@ export async function getUnitList(): Promise<
{ value: number; label: string }[] { value: number; label: string }[]
> { > {
const queryParam = { const queryParam = {
pageNum: 1000, pageNum: 1,
pageSize: 1, pageSize: 1000,
} }
const res = await resident_unitList(queryParam) const res = await resident_unitList(queryParam)
const data: { value: number; label: string }[] = [] const data: { value: number; label: string }[] = []

View File

@ -165,11 +165,6 @@ function handleInfo(row: Required<PersonForm>) {
<Avatar :src="row.img" v-if="row.img" /> <Avatar :src="row.img" v-if="row.img" />
<span v-else></span> <span v-else></span>
</template> </template>
<template #state="{ row }">
<TableSwitch :checkedValue="1" :unCheckedValue="0" v-model:value="row.state" :api="() => personUpdate(row)"
:disabled="!hasAccessByCodes(['property:person:edit'])" @reload="() => tableApi.query()" />
</template>
<template #action="{ row }"> <template #action="{ row }">
<Space> <Space>
<ghost-button @click.stop="handleInfo(row)"> <ghost-button @click.stop="handleInfo(row)">

View File

@ -72,7 +72,9 @@ const [BasicModal, modalApi] = useVbenModal({
const record = await personInfo(id) const record = await personInfo(id)
userId.value = record.userId userId.value = record.userId
unitId.value = record.unitId.toString() unitId.value = record.unitId.toString()
record.gender = record.gender?.toString()
record.state = record.state?.toString() record.state = record.state?.toString()
record.rosterType = record.rosterType?.toString()
record.authTime = [record.authBegDate, record.authEndDate] record.authTime = [record.authBegDate, record.authEndDate]
await formApi.setValues(record) await formApi.setValues(record)
} }

View File

@ -5,31 +5,16 @@ import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import { personLibList } from '#/api/sis/personLib'; import { renderDict } from '#/utils/render'
import type { PersonLibQuery, PersonLibVO } from '#/api/sis/personLib/model'; import { log } from 'console'
let libArr: PersonLibVO[] = [];
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {
label: '图片库', label: '人员标签',
fieldName: 'libId', fieldName: 'rosterType',
component: 'ApiSelect', component: 'Select',
componentProps: { componentProps: {
resultField: 'list', // 根据API返回结构调整 options: getDictOptions('roster_type'),
labelField: 'libName',
valueField: 'id',
// immediate: true,
api: async () => {
if (!libArr || libArr.length == 0) {
const params: PersonLibQuery = {
pageNum: 1,
pageSize: 500,
};
const res = await personLibList(params);
libArr = res.rows;
}
return libArr;
},
}, },
}, },
{ {
@ -63,6 +48,11 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '性别', title: '性别',
field: 'sex', field: 'sex',
slots:{
default: ({row}) =>{
return renderDict(row.sex, 'sys_user_sex')
}
}
}, },
{ {
title: '邮箱', title: '邮箱',
@ -75,6 +65,11 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '证件类型', title: '证件类型',
field: 'certificateType', field: 'certificateType',
slots:{
default: ({row}) =>{
return renderDict(row.certificateType, 'sys_certificate_type')
}
}
}, },
{ {
title: '证件号码', title: '证件号码',
@ -84,6 +79,16 @@ export const columns: VxeGridProps['columns'] = [
title: '出生日期', title: '出生日期',
field: 'birthDate', field: 'birthDate',
}, },
{
title: '人员标签',
field: 'rosterType',
slots: {
default: ({ row }) => {
return renderDict(row.rosterType, 'roster_type')
},
},
width: 100,
},
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',
@ -93,29 +98,19 @@ export const columns: VxeGridProps['columns'] = [
}, },
]; ];
const test = getDictOptions('roster_type');
test.forEach(item => {
console.log('item',item)
});
export const modalSchema: FormSchemaGetter = () => [ export const modalSchema: FormSchemaGetter = () => [
{ {
label: '图片库', label: '人员标签',
fieldName: 'libIds', fieldName: 'rosterType',
component: 'ApiSelect', component: 'Select',
rules: 'required', rules: 'required',
componentProps: { componentProps: {
resultField: 'list', // 根据API返回结构调整 options: getDictOptions('roster_type'),
labelField: 'libName',
valueField: 'id',
mode: 'multiple',
// immediate: true,
api: async () => {
if (!libArr || libArr.length == 0) {
const params: PersonLibQuery = {
pageNum: 1,
pageSize: 500,
};
const res = await personLibList(params);
libArr = res.rows;
}
return libArr;
},
}, },
}, },
{ {