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
authTime: any[]
rosterType?: string | number
}
export interface PersonForm extends BaseEntity {
@ -293,7 +297,7 @@ export interface Person extends BaseEntity {
* @param file excel文件
*/
export interface PerssonImportParam {
updateSupport: boolean;
unitId: number;
file: Blob | File;
updateSupport: boolean
unitId: number
file: Blob | File
}

View File

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

View File

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

View File

@ -5,31 +5,16 @@ import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils';
import { getDictOptions } from '#/utils/dict';
import { personLibList } from '#/api/sis/personLib';
import type { PersonLibQuery, PersonLibVO } from '#/api/sis/personLib/model';
import { renderDict } from '#/utils/render'
import { log } from 'console'
let libArr: PersonLibVO[] = [];
export const querySchema: FormSchemaGetter = () => [
{
label: '图片库',
fieldName: 'libId',
component: 'ApiSelect',
label: '人员标签',
fieldName: 'rosterType',
component: 'Select',
componentProps: {
resultField: 'list', // 根据API返回结构调整
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;
},
options: getDictOptions('roster_type'),
},
},
{
@ -63,6 +48,11 @@ export const columns: VxeGridProps['columns'] = [
{
title: '性别',
field: 'sex',
slots:{
default: ({row}) =>{
return renderDict(row.sex, 'sys_user_sex')
}
}
},
{
title: '邮箱',
@ -75,6 +65,11 @@ export const columns: VxeGridProps['columns'] = [
{
title: '证件类型',
field: 'certificateType',
slots:{
default: ({row}) =>{
return renderDict(row.certificateType, 'sys_certificate_type')
}
}
},
{
title: '证件号码',
@ -84,6 +79,16 @@ export const columns: VxeGridProps['columns'] = [
title: '出生日期',
field: 'birthDate',
},
{
title: '人员标签',
field: 'rosterType',
slots: {
default: ({ row }) => {
return renderDict(row.rosterType, 'roster_type')
},
},
width: 100,
},
{
field: 'action',
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 = () => [
{
label: '图片库',
fieldName: 'libIds',
component: 'ApiSelect',
label: '人员标签',
fieldName: 'rosterType',
component: 'Select',
rules: 'required',
componentProps: {
resultField: 'list', // 根据API返回结构调整
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;
},
options: getDictOptions('roster_type'),
},
},
{