From abb79997679e760db792fb547f11d97975567593 Mon Sep 17 00:00:00 2001 From: dev_ljl <2590379346@qq.com> Date: Thu, 11 Sep 2025 16:42:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=88=BF=E5=B1=8B=E6=94=B6=E8=B4=B9?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../costManagement/houseCharge/model.d.ts | 8 ++ .../src/api/property/resident/unit/model.d.ts | 1 + .../costManagement/houseCharge/data.ts | 31 +++++- .../houseCharge/house-charge-detail.vue | 8 +- .../houseCharge/house-charge-refund.vue | 8 +- .../houseCharge/houseCharge-add.vue | 96 +++++++++++-------- .../houseCharge/houseCharge-update.vue | 9 +- 7 files changed, 101 insertions(+), 60 deletions(-) diff --git a/apps/web-antd/src/api/property/costManagement/houseCharge/model.d.ts b/apps/web-antd/src/api/property/costManagement/houseCharge/model.d.ts index 7abe3229..5d48ef7e 100644 --- a/apps/web-antd/src/api/property/costManagement/houseCharge/model.d.ts +++ b/apps/web-antd/src/api/property/costManagement/houseCharge/model.d.ts @@ -60,6 +60,14 @@ export interface HouseChargeVO { chargeStatus: string; personId: string; + /** + * 单位 + */ + residentUnitText: string; + /** + * 单位面积 + */ + area: number; } export interface HouseChargeForm extends BaseEntity { diff --git a/apps/web-antd/src/api/property/resident/unit/model.d.ts b/apps/web-antd/src/api/property/resident/unit/model.d.ts index 1c6d50df..dfe50c8a 100644 --- a/apps/web-antd/src/api/property/resident/unit/model.d.ts +++ b/apps/web-antd/src/api/property/resident/unit/model.d.ts @@ -36,6 +36,7 @@ export interface Resident_unitVO { */ location: string; locations: string[]; + locationDetail: string; /** * 入驻时间 diff --git a/apps/web-antd/src/views/property/costManagement/houseCharge/data.ts b/apps/web-antd/src/views/property/costManagement/houseCharge/data.ts index a004056d..00b53669 100644 --- a/apps/web-antd/src/views/property/costManagement/houseCharge/data.ts +++ b/apps/web-antd/src/views/property/costManagement/houseCharge/data.ts @@ -35,8 +35,8 @@ export const querySchema: FormSchemaGetter = () => [ export const columns: VxeGridProps['columns'] = [ {type: 'checkbox', width: 60}, { - title: '房屋', - field: 'roomName', + title: '单位', + field: 'residentUnitText', minWidth: 150, }, { @@ -104,12 +104,33 @@ export const modalSchema: FormSchemaGetter = () => [ }, }, { - label: '房屋', - fieldName: 'roomId', - component: 'TreeSelect', + label: '单位', + fieldName: 'residentUnitId', + component: 'Select', componentProps: { }, rules: 'selectRequired', + formItemClass: 'col-span-2', + }, + { + label: '入驻房间', + fieldName: 'roomInfo', + component: 'Input', + dependencies: { + show: (fromValue) => fromValue.residentUnitId, + triggerFields: ['residentUnitId'], + }, + formItemClass: 'col-span-2', + }, + { + label: '单位面积', + fieldName: 'area', + component: 'Input', + dependencies: { + show: (fromValue) => fromValue.residentUnitId, + triggerFields: ['residentUnitId'], + }, + formItemClass: 'col-span-2', }, { label: '业主', diff --git a/apps/web-antd/src/views/property/costManagement/houseCharge/house-charge-detail.vue b/apps/web-antd/src/views/property/costManagement/houseCharge/house-charge-detail.vue index c10c48cf..18da12b9 100644 --- a/apps/web-antd/src/views/property/costManagement/houseCharge/house-charge-detail.vue +++ b/apps/web-antd/src/views/property/costManagement/houseCharge/house-charge-detail.vue @@ -59,11 +59,11 @@ async function handleOpenChange(open: boolean) { {{ houseChargeDetail.startTime + ' 至 ' + houseChargeDetail.endTime }} - - {{ room?.roomNumber }} + + {{ houseChargeDetail?.residentUnitText }} - - {{ `建筑面积:${room?.area} 套内面积:${room?.insideInArea}` }} + + {{ `${houseChargeDetail?.area} (㎡)` }} {{ costItem?.unitPrice }} diff --git a/apps/web-antd/src/views/property/costManagement/houseCharge/house-charge-refund.vue b/apps/web-antd/src/views/property/costManagement/houseCharge/house-charge-refund.vue index 9a67aad1..dc24e1ac 100644 --- a/apps/web-antd/src/views/property/costManagement/houseCharge/house-charge-refund.vue +++ b/apps/web-antd/src/views/property/costManagement/houseCharge/house-charge-refund.vue @@ -121,11 +121,11 @@ async function handleClosed() { {{ record.startTime }} - - {{ room?.roomNumber }} + + {{ record.residentUnitText }} - - {{ `${room?.area} (套内面积:${room?.insideInArea})` }} + + {{ `${record.area} (㎡)` }} {{ costItem?.unitPrice }} diff --git a/apps/web-antd/src/views/property/costManagement/houseCharge/houseCharge-add.vue b/apps/web-antd/src/views/property/costManagement/houseCharge/houseCharge-add.vue index 09442391..9e25ed3e 100644 --- a/apps/web-antd/src/views/property/costManagement/houseCharge/houseCharge-add.vue +++ b/apps/web-antd/src/views/property/costManagement/houseCharge/houseCharge-add.vue @@ -20,6 +20,7 @@ import type { CostItemSettingVO } from '#/api/property/costManagement/costItemSe import { getDictOptions } from '#/utils/dict'; import { personList } from '#/api/property/resident/person'; import { renderDictValue } from '#/utils/render'; +import {resident_unitInfo, resident_unitList} from "#/api/property/resident/unit"; const emit = defineEmits<{ reload: [] }>(); @@ -32,7 +33,7 @@ const title = computed(() => { const [BasicForm, formApi] = useVbenForm({ commonConfig: { // 默认占满两列 - formItemClass: 'col-span-2', + formItemClass: 'col-span-1', // 默认label宽度 px labelWidth: 80, // 通用配置项 会影响到所有表单项 @@ -54,7 +55,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff( const [BasicModal, modalApi] = useVbenModal({ // 在这里更改宽度 - class: 'w-[550px]', + class: 'w-[70%]', fullscreenButton: false, onBeforeClose, onClosed: handleClosed, @@ -64,10 +65,10 @@ const [BasicModal, modalApi] = useVbenModal({ return null; } modalApi.modalLoading(true); - await initRoomOptions(); - await queryCostItemOptions(); + await queryCostItemOptions(null); await initCostTypeOptions(); await queryPersonData(); + await queryUnitData(); const { id } = modalApi.getData() as { id?: number | string }; isUpdate.value = !!id; @@ -111,46 +112,10 @@ async function handleClosed() { resetInitialized(); } -/** - * 房间数据 - */ -async function initRoomOptions() { - const roomList = await communityTree(4); - const splitStr = '/'; - handleNode(roomList, 'label', splitStr, function (node: any) { - if (node.level != 4) { - node.disabled = true; - } - }); - formApi.updateSchema([ - { - componentProps: () => ({ - class: 'w-full', - fieldNames: { - key: 'id', - label: 'label', - value: 'code', - children: 'children', - }, - placeholder: '请选择房间', - showSearch: true, - treeData: roomList, - treeDefaultExpandAll: true, - treeLine: { showLeafIcon: false }, - // 筛选的字段 - treeNodeFilterProp: 'label', - // 选中后显示在输入框的值 - treeNodeLabelProp: 'fullName', - }), - fieldName: 'roomId', - }, - ]); -} - /** * 查询费用项设置 */ -async function queryCostItemOptions(costType: string) { +async function queryCostItemOptions(costType: string|null) { let params = { pageSize: 1000, pageNum: 1, @@ -233,10 +198,57 @@ async function queryPersonData() { }, ]); } +//查询入驻单位数据 +async function queryUnitData() { + let params = { + pageSize: 1000, + pageNum: 1, + }; + const res = await resident_unitList(params); + const options = res.rows.map((unit) => ({ + label:unit.name, + value: unit.id, + })); + formApi.updateSchema([ + { + componentProps: () => ({ + options: options, + showSearch: true, + optionFilterProp: 'label', + optionLabelProp: 'label', + onChange: async (value: string) => { + if (value) { + await queryRoomByUnit(value); + } + }, + }), + fieldName: 'residentUnitId', + }, + ]); +} + +async function queryRoomByUnit(unitId: string) { + let unitInfo = await resident_unitInfo(unitId); + if(unitInfo&&unitInfo.locationDetail){ + await formApi.setFieldValue('roomInfo', unitInfo.locationDetail); + await formApi.setFieldValue('area', unitInfo.area); + } +} diff --git a/apps/web-antd/src/views/property/costManagement/houseCharge/houseCharge-update.vue b/apps/web-antd/src/views/property/costManagement/houseCharge/houseCharge-update.vue index 620cd3ef..ece8fcf4 100644 --- a/apps/web-antd/src/views/property/costManagement/houseCharge/houseCharge-update.vue +++ b/apps/web-antd/src/views/property/costManagement/houseCharge/houseCharge-update.vue @@ -6,7 +6,6 @@ import {cloneDeep} from '@vben/utils'; import {useVbenForm} from '#/adapter/form'; import { - houseChargeAdd, houseChargeInfo, houseChargeUpdate } from '#/api/property/costManagement/houseCharge'; @@ -123,11 +122,11 @@ async function handleClosed() { {{ record.startTime }} - - {{ room?.roomNumber }} + + {{ record.residentUnitText }} - - {{ `${room?.area} (套内面积:${room?.insideInArea})` }} + + {{ `${record.area} (㎡)` }} {{ costItem?.unitPrice }}