From f01cb4abcea5cc6e8bb1bced6f3f31f488a0a9ba Mon Sep 17 00:00:00 2001 From: dev_ljl <2590379346@qq.com> Date: Fri, 27 Jun 2025 17:56:05 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=85=A5=E9=A9=BB=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E3=80=81=E4=BA=BA=E5=91=98=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/property/floor/model.d.ts | 1 + .../views/property/resident/person/data.ts | 71 +++++- .../views/property/resident/person/index.vue | 35 +-- .../resident/person/person-detail.vue | 33 +-- .../property/resident/person/person-modal.vue | 9 +- .../resident/person/query-unit-list.vue | 44 +++- .../resident/person/query-user-list.vue | 25 +- .../src/views/property/resident/unit/data.ts | 5 +- .../property/resident/unit/unit-modal.vue | 7 +- .../src/views/property/room/room-select.vue | 218 ++++++++++++++++++ apps/web-antd/src/views/property/unit/data.ts | 150 ++++++++++-- .../src/views/property/unit/index.vue | 15 -- 12 files changed, 506 insertions(+), 107 deletions(-) create mode 100644 apps/web-antd/src/views/property/room/room-select.vue diff --git a/apps/web-antd/src/api/property/floor/model.d.ts b/apps/web-antd/src/api/property/floor/model.d.ts index f1376f8c..ef66bde1 100644 --- a/apps/web-antd/src/api/property/floor/model.d.ts +++ b/apps/web-antd/src/api/property/floor/model.d.ts @@ -1,6 +1,7 @@ import type { PageQuery, BaseEntity } from '#/api/common'; export interface FloorVO { + id: string | number; /** * 社区编码 */ 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 26c5ee59..0fcbf63d 100644 --- a/apps/web-antd/src/views/property/resident/person/data.ts +++ b/apps/web-antd/src/views/property/resident/person/data.ts @@ -1,6 +1,9 @@ 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"; + export const querySchema: FormSchemaGetter = () => [ { @@ -8,6 +11,22 @@ export const querySchema: FormSchemaGetter = () => [ fieldName: 'unitId', label: '所属单位', }, + { + component: 'ApiSelect', + fieldName: 'unitId', + label: '所属单位', + componentProps: { + api: getUnitList, + resultField: 'data', + labelField: 'label', + valueField: 'value', + immediate: true, + debounceTime: 500, + allowClear: true, + placeholder: '请选择所属单位', + }, + rules: 'required', + }, { component: 'Input', fieldName: 'userName', @@ -16,7 +35,7 @@ export const querySchema: FormSchemaGetter = () => [ { component: 'Select', componentProps: { - options: getDictOptions('wy_state'), + options: getDictOptions('wy_rzryzt'), }, fieldName: 'state', label: '状态', @@ -49,6 +68,11 @@ export const columns: VxeGridProps['columns'] = [ { title: '性别', field: 'gender', + slots:{ + default: ({row})=>{ + return renderDict(row.gender,'wy_rzryzt') + } + } }, { field: 'img', @@ -75,7 +99,11 @@ export const columns: VxeGridProps['columns'] = [ { title: '状态', field: 'state', - // slots: { default: 'state' }, + slots:{ + default: ({row})=>{ + return renderDict(row.state,'wy_rzryzt') + } + } }, { title: '备注', @@ -114,13 +142,13 @@ export const modalSchema: FormSchemaGetter = () => [ formItemClass: 'col-span-2', rules:'selectRequired', }, - { - label: '入驻位置', - fieldName: 'locathon', - component: 'Input', - rules:'required', - formItemClass: 'col-span-2', - }, + // { + // label: '入驻位置', + // fieldName: 'locathon', + // component: 'Input', + // rules:'required', + // formItemClass: 'col-span-2', + // }, { label: '人脸图片', fieldName: 'img', @@ -131,7 +159,6 @@ export const modalSchema: FormSchemaGetter = () => [ }, formItemClass: 'col-span-2', }, - { label: '入驻时间', fieldName: 'time', @@ -147,6 +174,14 @@ export const modalSchema: FormSchemaGetter = () => [ fieldName: 'carNumber', component: 'Input', }, + { + label: '人员状态', + fieldName: 'state', + component: 'Select', + componentProps: { + options: getDictOptions('wy_rzryzt'), + }, + }, { label: '备注', fieldName: 'remark', @@ -235,3 +270,19 @@ export const carColumns: VxeGridProps['columns'] = [ 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 }[] = []; + + res.rows.forEach((r: any) => { + data.push({ + value: r.name, + label: r.id, + }); + }); + return data; +} diff --git a/apps/web-antd/src/views/property/resident/person/index.vue b/apps/web-antd/src/views/property/resident/person/index.vue index 85a93526..50d4af5a 100644 --- a/apps/web-antd/src/views/property/resident/person/index.vue +++ b/apps/web-antd/src/views/property/resident/person/index.vue @@ -14,7 +14,7 @@ import { import { personExport, personList, - personRemove, + personRemove, personUpdate, } from '#/api/property/resident/person'; import type { PersonForm } from '#/api/property/resident/person/model'; import { commonDownloadExcel } from '#/utils/file/download'; @@ -22,7 +22,8 @@ import { commonDownloadExcel } from '#/utils/file/download'; import personModal from './person-modal.vue'; import personDetail from './person-detail.vue'; import { columns, querySchema } from './data'; -// import {TableSwitch} from "#/components/table"; +import {useAccess} from "@vben/access"; +import {TableSwitch} from "#/components/table"; const formOptions: VbenFormProps = { commonConfig: { @@ -44,8 +45,6 @@ const gridOptions: VxeGridProps = { // 点击行选中 // trigger: 'row', }, - // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 - // columns: columns(), columns, height: 'auto', keepSource: true, @@ -80,6 +79,7 @@ const [PersonDetail, personDetailApi] = useVbenModal({ connectedComponent: personDetail, }); +const { hasAccessByCodes } = useAccess(); function handleAdd() { modalApi.setData({}); @@ -120,7 +120,6 @@ function handleInfo(row: Required) { personDetailApi.setData({ id: row.id }); personDetailApi.open(); } - + - - - - - - - - - - diff --git a/apps/web-antd/src/views/property/resident/person/person-detail.vue b/apps/web-antd/src/views/property/resident/person/person-detail.vue index d0e2fd81..19af66ee 100644 --- a/apps/web-antd/src/views/property/resident/person/person-detail.vue +++ b/apps/web-antd/src/views/property/resident/person/person-detail.vue @@ -8,11 +8,10 @@ import dayjs from 'dayjs'; import duration from 'dayjs/plugin/duration'; import relativeTime from 'dayjs/plugin/relativeTime'; -// import {personInfo} from '#/api/property/resident/person'; +import {personInfo} from '#/api/property/resident/person'; import type {Person} from "#/api/property/resident/person/model"; import {accessControlColumns,carColumns} from "#/views/property/resident/person/data"; -// import {personList} from "#/api/property/resident/person"; -// import {renderDict} from "#/utils/render"; +import {renderDict, renderDictValue} from "#/utils/render"; dayjs.extend(duration); @@ -36,11 +35,9 @@ async function handleOpenChange(open: boolean) { } modalApi.modalLoading(true); - // const {id} = modalApi.getData() as { id: number | string }; - // const response = await personInfo(id); - const response = {id:1}; + const {id} = modalApi.getData() as { id: number | string }; // 赋值 - personDetail.value = response; + personDetail.value = await personInfo(id); modalApi.modalLoading(false); } @@ -52,25 +49,31 @@ async function handleOpenChange(open: boolean) { - {{ '入驻人员' }} + {{ personDetail.userName+'-'+personDetail.phone}} + - {{ '单位名称' }} + {{personDetail.unitName+'-'+personDetail.unitId }} - {{ '单位名称' }} + {{ personDetail.locathon }} - {{ '单位名称' }} + {{ personDetail.img }} - {{ '单位名称' }} + {{ personDetail.time}} - {{ '单位名称' }} + {{personDetail.carNumber}} + + + - {{ '单位名称' }} + {{ personDetail.remark }} @@ -85,7 +88,7 @@ async function handleOpenChange(open: boolean) { - +