feat:房屋收费选择单位
This commit is contained in:
@@ -60,6 +60,14 @@ export interface HouseChargeVO {
|
|||||||
chargeStatus: string;
|
chargeStatus: string;
|
||||||
|
|
||||||
personId: string;
|
personId: string;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
residentUnitText: string;
|
||||||
|
/**
|
||||||
|
* 单位面积
|
||||||
|
*/
|
||||||
|
area: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HouseChargeForm extends BaseEntity {
|
export interface HouseChargeForm extends BaseEntity {
|
||||||
|
@@ -36,6 +36,7 @@ export interface Resident_unitVO {
|
|||||||
*/
|
*/
|
||||||
location: string;
|
location: string;
|
||||||
locations: string[];
|
locations: string[];
|
||||||
|
locationDetail: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入驻时间
|
* 入驻时间
|
||||||
|
@@ -35,8 +35,8 @@ export const querySchema: FormSchemaGetter = () => [
|
|||||||
export const columns: VxeGridProps['columns'] = [
|
export const columns: VxeGridProps['columns'] = [
|
||||||
{type: 'checkbox', width: 60},
|
{type: 'checkbox', width: 60},
|
||||||
{
|
{
|
||||||
title: '房屋',
|
title: '单位',
|
||||||
field: 'roomName',
|
field: 'residentUnitText',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -104,12 +104,33 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '房屋',
|
label: '单位',
|
||||||
fieldName: 'roomId',
|
fieldName: 'residentUnitId',
|
||||||
component: 'TreeSelect',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
},
|
},
|
||||||
rules: 'selectRequired',
|
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: '业主',
|
label: '业主',
|
||||||
|
@@ -59,11 +59,11 @@ async function handleOpenChange(open: boolean) {
|
|||||||
<DescriptionsItem label="计费时间">
|
<DescriptionsItem label="计费时间">
|
||||||
{{ houseChargeDetail.startTime + ' 至 ' + houseChargeDetail.endTime }}
|
{{ houseChargeDetail.startTime + ' 至 ' + houseChargeDetail.endTime }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="房间">
|
<DescriptionsItem label="单位">
|
||||||
{{ room?.roomNumber }}
|
{{ houseChargeDetail?.residentUnitText }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="房间面积">
|
<DescriptionsItem label="单位面积">
|
||||||
{{ `建筑面积:${room?.area} 套内面积:${room?.insideInArea}` }}
|
{{ `${houseChargeDetail?.area} (㎡)` }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="单价">
|
<DescriptionsItem label="单价">
|
||||||
{{ costItem?.unitPrice }}
|
{{ costItem?.unitPrice }}
|
||||||
|
@@ -121,11 +121,11 @@ async function handleClosed() {
|
|||||||
<DescriptionsItem label="计费起始">
|
<DescriptionsItem label="计费起始">
|
||||||
{{ record.startTime }}
|
{{ record.startTime }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="房间">
|
<DescriptionsItem label="单位">
|
||||||
{{ room?.roomNumber }}
|
{{ record.residentUnitText }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="面积(㎡)">
|
<DescriptionsItem label="单位面积">
|
||||||
{{ `${room?.area} (套内面积:${room?.insideInArea})` }}
|
{{ `${record.area} (㎡)` }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="单价">
|
<DescriptionsItem label="单价">
|
||||||
{{ costItem?.unitPrice }}
|
{{ costItem?.unitPrice }}
|
||||||
|
@@ -20,6 +20,7 @@ import type { CostItemSettingVO } from '#/api/property/costManagement/costItemSe
|
|||||||
import { getDictOptions } from '#/utils/dict';
|
import { getDictOptions } from '#/utils/dict';
|
||||||
import { personList } from '#/api/property/resident/person';
|
import { personList } from '#/api/property/resident/person';
|
||||||
import { renderDictValue } from '#/utils/render';
|
import { renderDictValue } from '#/utils/render';
|
||||||
|
import {resident_unitInfo, resident_unitList} from "#/api/property/resident/unit";
|
||||||
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ const title = computed(() => {
|
|||||||
const [BasicForm, formApi] = useVbenForm({
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
// 默认占满两列
|
// 默认占满两列
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-1',
|
||||||
// 默认label宽度 px
|
// 默认label宽度 px
|
||||||
labelWidth: 80,
|
labelWidth: 80,
|
||||||
// 通用配置项 会影响到所有表单项
|
// 通用配置项 会影响到所有表单项
|
||||||
@@ -54,7 +55,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
|||||||
|
|
||||||
const [BasicModal, modalApi] = useVbenModal({
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
// 在这里更改宽度
|
// 在这里更改宽度
|
||||||
class: 'w-[550px]',
|
class: 'w-[70%]',
|
||||||
fullscreenButton: false,
|
fullscreenButton: false,
|
||||||
onBeforeClose,
|
onBeforeClose,
|
||||||
onClosed: handleClosed,
|
onClosed: handleClosed,
|
||||||
@@ -64,10 +65,10 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
modalApi.modalLoading(true);
|
modalApi.modalLoading(true);
|
||||||
await initRoomOptions();
|
await queryCostItemOptions(null);
|
||||||
await queryCostItemOptions();
|
|
||||||
await initCostTypeOptions();
|
await initCostTypeOptions();
|
||||||
await queryPersonData();
|
await queryPersonData();
|
||||||
|
await queryUnitData();
|
||||||
const { id } = modalApi.getData() as { id?: number | string };
|
const { id } = modalApi.getData() as { id?: number | string };
|
||||||
isUpdate.value = !!id;
|
isUpdate.value = !!id;
|
||||||
|
|
||||||
@@ -111,46 +112,10 @@ async function handleClosed() {
|
|||||||
resetInitialized();
|
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 = {
|
let params = {
|
||||||
pageSize: 1000,
|
pageSize: 1000,
|
||||||
pageNum: 1,
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BasicModal :title="title">
|
<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>
|
</BasicModal>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -6,7 +6,6 @@ import {cloneDeep} from '@vben/utils';
|
|||||||
|
|
||||||
import {useVbenForm} from '#/adapter/form';
|
import {useVbenForm} from '#/adapter/form';
|
||||||
import {
|
import {
|
||||||
houseChargeAdd,
|
|
||||||
houseChargeInfo,
|
houseChargeInfo,
|
||||||
houseChargeUpdate
|
houseChargeUpdate
|
||||||
} from '#/api/property/costManagement/houseCharge';
|
} from '#/api/property/costManagement/houseCharge';
|
||||||
@@ -123,11 +122,11 @@ async function handleClosed() {
|
|||||||
<DescriptionsItem label="计费起始">
|
<DescriptionsItem label="计费起始">
|
||||||
{{ record.startTime }}
|
{{ record.startTime }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="房间">
|
<DescriptionsItem label="单位">
|
||||||
{{ room?.roomNumber }}
|
{{ record.residentUnitText }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="面积(㎡)">
|
<DescriptionsItem label="单位面积">
|
||||||
{{ `${room?.area} (套内面积:${room?.insideInArea})` }}
|
{{ `${record.area} (㎡)` }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="单价">
|
<DescriptionsItem label="单价">
|
||||||
{{ costItem?.unitPrice }}
|
{{ costItem?.unitPrice }}
|
||||||
|
Reference in New Issue
Block a user