From 7f542de90bba8086842ecf84216b597b7e49b059 Mon Sep 17 00:00:00 2001 From: zcxlsm Date: Mon, 28 Jul 2025 15:24:45 +0800 Subject: [PATCH] feat(property): 1 --- .../api/property/resident/person/model.d.ts | 4 + .../views/property/resident/person/data.ts | 105 ++++++++++------ .../property/resident/person/person-modal.vue | 115 +++++++++--------- .../src/views/property/resident/unit/data.ts | 2 +- .../property/resident/unit/unit-modal.vue | 86 ++++++------- 5 files changed, 174 insertions(+), 138 deletions(-) diff --git a/apps/web-antd/src/api/property/resident/person/model.d.ts b/apps/web-antd/src/api/property/resident/person/model.d.ts index d748edb1..83b2c7a5 100644 --- a/apps/web-antd/src/api/property/resident/person/model.d.ts +++ b/apps/web-antd/src/api/property/resident/person/model.d.ts @@ -71,6 +71,10 @@ export interface PersonVO { */ authGroupId?: string | number + authBegDate?: string + + authEndDate?: string + } export interface PersonForm extends BaseEntity { diff --git a/apps/web-antd/src/views/property/resident/person/data.ts b/apps/web-antd/src/views/property/resident/person/data.ts index 4508aa87..d868e6c7 100644 --- a/apps/web-antd/src/views/property/resident/person/data.ts +++ b/apps/web-antd/src/views/property/resident/person/data.ts @@ -1,11 +1,10 @@ -import type { FormSchemaGetter } from '#/adapter/form'; -import type { VxeGridProps } from '#/adapter/vxe-table'; -import { getDictOptions } from '#/utils/dict'; -import { renderDict } from '#/utils/render'; -import { resident_unitList } from '#/api/property/resident/unit'; -import { authGroupList } from '#/api/sis/authGroup'; -import type { AuthGroupVO, AuthGroupQuery } from '#/api/sis/authGroup/model'; -import { toRaw } from 'vue'; +import type { FormSchemaGetter } from '#/adapter/form' +import type { VxeGridProps } from '#/adapter/vxe-table' +import { getDictOptions } from '#/utils/dict' +import { renderDict } from '#/utils/render' +import { resident_unitList } from '#/api/property/resident/unit' +import { authGroupList } from '#/api/sis/authGroup' +import type { AuthGroupVO, AuthGroupQuery } from '#/api/sis/authGroup/model' export const querySchema: FormSchemaGetter = () => [ { @@ -37,7 +36,7 @@ export const querySchema: FormSchemaGetter = () => [ fieldName: 'state', label: '状态', }, -]; +] export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, @@ -52,7 +51,7 @@ export const columns: VxeGridProps['columns'] = [ // }, { title: '员工编号', - field: 'userId', + field: 'id', width: 100, }, { @@ -70,7 +69,7 @@ export const columns: VxeGridProps['columns'] = [ field: 'gender', slots: { default: ({ row }) => { - return renderDict(row.gender, 'sys_user_sex'); + return renderDict(row.gender, 'sys_user_sex') }, }, width: 100, @@ -105,7 +104,7 @@ export const columns: VxeGridProps['columns'] = [ field: 'state', slots: { default: ({ row }) => { - return renderDict(row.state, 'wy_rzryzt'); + return renderDict(row.state, 'wy_rzryzt') }, }, width: 100, @@ -122,9 +121,9 @@ export const columns: VxeGridProps['columns'] = [ title: '操作', minWidth: 180, }, -]; +] -let authGroupArr: AuthGroupVO[] = []; +let authGroupArr: AuthGroupVO[] = [] export const modalSchema: FormSchemaGetter = () => [ { label: '主键id', @@ -140,17 +139,20 @@ export const modalSchema: FormSchemaGetter = () => [ fieldName: 'userName', component: 'Input', rules: 'required', + formItemClass: 'col-span-1', }, { label: '联系电话', fieldName: 'phone', component: 'Input', rules: 'required', + formItemClass: 'col-span-1', }, { label: '性别', fieldName: 'gender', component: 'Select', + formItemClass: 'col-span-2', componentProps: { options: getDictOptions('sys_user_sex'), }, @@ -161,20 +163,23 @@ export const modalSchema: FormSchemaGetter = () => [ fieldName: 'idCard', component: 'Input', rules: 'required', + formItemClass: 'col-span-1', }, { label: '邮箱', fieldName: 'email', component: 'Input', + formItemClass: 'col-span-1', }, { label: '人员状态', fieldName: 'state', component: 'Select', componentProps: { - options: getDictOptions('wy_rzryzt'), + options: getDictOptions('wy_rzryzt') }, rules: 'selectRequired', + formItemClass: 'col-span-2', }, // { // label: '入住员工', @@ -187,7 +192,7 @@ export const modalSchema: FormSchemaGetter = () => [ label: '所属单位', fieldName: 'unitId', component: 'Select', - formItemClass: 'col-span-2', + formItemClass: 'col-span-4', rules: 'selectRequired', }, // { @@ -207,37 +212,66 @@ export const modalSchema: FormSchemaGetter = () => [ valueFormat: 'YYYY-MM-DD HH:mm:ss', }, rules: 'required', + formItemClass: 'col-span-1', }, { label: '车牌号码', fieldName: 'carNumber', component: 'Input', + formItemClass: 'col-span-3', + }, + { + label: '修改权限', + fieldName: 'authSwitch', + component: 'Switch', + formItemClass: 'col-span-1', + componentProps: { + class: 'w-auto', + + }, + defaultValue: false, + dependencies: { + show: (values) => { + return typeof values.id !== 'undefined' + }, + triggerFields: ['id'], + }, + }, { label: '授权期限', fieldName: 'authTime', component: 'RangePicker', + formItemClass: 'col-span-1', componentProps: { + class: 'w-auto', showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, dependencies: { show: (values) => { - return typeof values.id !== 'undefined'; + return typeof values.id !== 'undefined' }, - triggerFields: ['id'], + disabled:(values) => { + return !values.authSwitch + }, + triggerFields: ['id', 'authSwitch'], }, }, { label: '通行权限组', fieldName: 'authGroupId', component: 'ApiSelect', + formItemClass: 'col-span-2', dependencies: { show: (values) => { - return typeof values.id !== 'undefined'; + return typeof values.id !== 'undefined' }, - triggerFields: ['id'], + disabled:(values) => { + return !values.authSwitch + }, + triggerFields: ['id', 'authSwitch'], }, componentProps: { allowClear: true, @@ -248,14 +282,13 @@ export const modalSchema: FormSchemaGetter = () => [ api: async () => { if (!authGroupArr || authGroupArr.length == 0) { const params: AuthGroupQuery = { - groupType: 2, pageNum: 1, pageSize: 500, - }; - const res = await authGroupList(params); - authGroupArr = res.rows; + } + const res = await authGroupList(params) + authGroupArr = res.rows } - return authGroupArr; + return authGroupArr }, }, }, @@ -267,15 +300,15 @@ export const modalSchema: FormSchemaGetter = () => [ // accept: 'image/*', // 可选拓展名或者mime类型 ,拼接 maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型 }, - formItemClass: 'col-span-2', + formItemClass: 'col-span-3', }, { label: '备注', fieldName: 'remark', component: 'Textarea', - formItemClass: 'col-span-2', + formItemClass: 'col-span-3', }, -]; +] //门禁记录 export const accessControlColumns: VxeGridProps['columns'] = [ @@ -311,7 +344,7 @@ export const accessControlColumns: VxeGridProps['columns'] = [ title: '状态', field: 'locathon', }, -]; +] //车辆记录 export const carColumns: VxeGridProps['columns'] = [ @@ -355,22 +388,22 @@ export const carColumns: VxeGridProps['columns'] = [ title: '备注', field: 'remark', }, -]; +] export async function getUnitList(): Promise< { value: number; label: string }[] > { const queryParam = { pageNum: 1000, pageSize: 1, - }; - const res = await resident_unitList(queryParam); - const data: { value: number; label: string }[] = []; + } + const res = await resident_unitList(queryParam) + const data: { value: number; label: string }[] = [] res.rows.forEach((r: any) => { data.push({ value: r.id, label: r.name, - }); - }); - return data; + }) + }) + return data } diff --git a/apps/web-antd/src/views/property/resident/person/person-modal.vue b/apps/web-antd/src/views/property/resident/person/person-modal.vue index 06d9678a..1a67c0a9 100644 --- a/apps/web-antd/src/views/property/resident/person/person-modal.vue +++ b/apps/web-antd/src/views/property/resident/person/person-modal.vue @@ -1,38 +1,38 @@ @@ -132,16 +133,10 @@ function getUnitInfo(unit: { name: string }) { diff --git a/apps/web-antd/src/views/property/resident/unit/data.ts b/apps/web-antd/src/views/property/resident/unit/data.ts index 07242e71..f78ea30f 100644 --- a/apps/web-antd/src/views/property/resident/unit/data.ts +++ b/apps/web-antd/src/views/property/resident/unit/data.ts @@ -176,7 +176,7 @@ export const modalSchema: FormSchemaGetter = () => [ }, { label: '', - fieldName: 'time', + fieldName: 'Placeholder', component: '' }, { diff --git a/apps/web-antd/src/views/property/resident/unit/unit-modal.vue b/apps/web-antd/src/views/property/resident/unit/unit-modal.vue index c4310ad3..d2eb4c91 100644 --- a/apps/web-antd/src/views/property/resident/unit/unit-modal.vue +++ b/apps/web-antd/src/views/property/resident/unit/unit-modal.vue @@ -1,23 +1,23 @@