feat:房屋收费选择单位

This commit is contained in:
2025-09-11 16:42:56 +08:00
parent e7e610c970
commit abb7999767
7 changed files with 101 additions and 60 deletions

View File

@@ -60,6 +60,14 @@ export interface HouseChargeVO {
chargeStatus: string;
personId: string;
/**
* 单位
*/
residentUnitText: string;
/**
* 单位面积
*/
area: number;
}
export interface HouseChargeForm extends BaseEntity {

View File

@@ -36,6 +36,7 @@ export interface Resident_unitVO {
*/
location: string;
locations: string[];
locationDetail: string;
/**
* 入驻时间

View File

@@ -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: '业主',

View File

@@ -59,11 +59,11 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="计费时间">
{{ houseChargeDetail.startTime + ' 至 ' + houseChargeDetail.endTime }}
</DescriptionsItem>
<DescriptionsItem label="房间">
{{ room?.roomNumber }}
<DescriptionsItem label="单位">
{{ houseChargeDetail?.residentUnitText }}
</DescriptionsItem>
<DescriptionsItem label="房间面积">
{{ `建筑面积:${room?.area} 套内面积:${room?.insideInArea}` }}
<DescriptionsItem label="单位面积">
{{ `${houseChargeDetail?.area} (㎡)` }}
</DescriptionsItem>
<DescriptionsItem label="单价">
{{ costItem?.unitPrice }}

View File

@@ -121,11 +121,11 @@ async function handleClosed() {
<DescriptionsItem label="计费起始">
{{ record.startTime }}
</DescriptionsItem>
<DescriptionsItem label="房间">
{{ room?.roomNumber }}
<DescriptionsItem label="单位">
{{ record.residentUnitText }}
</DescriptionsItem>
<DescriptionsItem label="面积(㎡)">
{{ `${room?.area} 套内面积:${room?.insideInArea}` }}
<DescriptionsItem label="单位面积">
{{ `${record.area} ` }}
</DescriptionsItem>
<DescriptionsItem label="单价">
{{ costItem?.unitPrice }}

View File

@@ -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);
}
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
<BasicForm>
<template #roomInfo="slotProps">
<div>
{{slotProps.field.value}}
</div>
</template>
<template #area="slotProps">
<div>
{{slotProps.field.value}}
</div>
</template>
</BasicForm>
</BasicModal>
</template>

View File

@@ -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() {
<DescriptionsItem label="计费起始">
{{ record.startTime }}
</DescriptionsItem>
<DescriptionsItem label="房间">
{{ room?.roomNumber }}
<DescriptionsItem label="单位">
{{ record.residentUnitText }}
</DescriptionsItem>
<DescriptionsItem label="面积(㎡)">
{{ `${room?.area} 套内面积:${room?.insideInArea}` }}
<DescriptionsItem label="单位面积">
{{ `${record.area} ` }}
</DescriptionsItem>
<DescriptionsItem label="单价">
{{ costItem?.unitPrice }}