fix:建筑管理、楼层管理
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
2025-07-30 15:27:32 +08:00
parent 48f0011e78
commit 8f6dc2ba11
6 changed files with 47 additions and 31 deletions

View File

@@ -29,7 +29,7 @@ export interface BuildingVO {
/**
* 建筑类型('1住宅','2商业','3:混合')
*/
buildType: number;
buildType: string;
/**
* 电梯数量

View File

@@ -1,15 +1,15 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import {computed, ref} from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import {useVbenModal} from '@vben/common-ui';
import {$t} from '@vben/locales';
import {cloneDeep} from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { buildingAdd, buildingInfo, buildingUpdate } from '#/api/property/building';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import {useVbenForm} from '#/adapter/form';
import {buildingAdd, buildingInfo, buildingUpdate} from '#/api/property/building';
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import { modalSchema } from './data';
import {modalSchema} from './data';
const emit = defineEmits<{ reload: [] }>();
@@ -34,7 +34,7 @@ const [BasicForm, formApi] = useVbenForm({
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
@@ -54,11 +54,12 @@ const [BasicModal, modalApi] = useVbenModal({
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
const {id} = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await buildingInfo(id);
record.buildType = record.buildType.toString();
await formApi.setValues(record);
}
await markInitialized();
@@ -70,7 +71,7 @@ const [BasicModal, modalApi] = useVbenModal({
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
const {valid} = await formApi.validate();
if (!valid) {
return;
}
@@ -95,7 +96,7 @@ async function handleClosed() {
<template>
<BasicModal :title="title">
<BasicForm />
<BasicForm/>
</BasicModal>
</template>

View File

@@ -105,12 +105,20 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '总层数',
fieldName: 'floorCount',
component: 'Input',
component: 'InputNumber',
componentProps: {
min:1,
precision:0,
},
},
{
label: '单元数',
fieldName: 'unitCount',
component: 'Input',
component: 'InputNumber',
componentProps: {
min:1,
precision:0,
},
},
{
label: '建筑类型',
@@ -124,14 +132,17 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '电梯数量',
fieldName: 'elevatorCount',
component: 'Input',
component: 'InputNumber',
componentProps: {
min:0,
precision:0,
},
},
{
label: '竣工日期',
fieldName: 'completionDate',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
},

View File

@@ -54,7 +54,7 @@ export const modalSchema: FormSchemaGetter = () => [
},
{
component: 'TreeSelect',
fieldName: 'unitId',
fieldName: 'buildingId',
defaultValue: undefined,
label: '社区建筑',
rules: 'selectRequired',
@@ -80,11 +80,19 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '房间数量',
fieldName: 'roomCount',
component: 'Input',
component: 'InputNumber',
componentProps: {
min:0,
precision:0,
},
},
{
label: '层高',
fieldName: 'floorHeight',
component: 'Input',
component: 'InputNumber',
componentProps: {
min:0,
precision:0,
},
},
];

View File

@@ -90,12 +90,12 @@ async function handleConfirm() {
* 初始化城市
*/
async function setupCommunitySelect() {
const areaList = await communityTree(3);
const areaList = await communityTree(2);//楼层关联建筑
// 选中后显示在输入框的值 即父节点 / 子节点
// addFullName(areaList, 'areaName', ' / ');
const splitStr = '/';
handleNode(areaList, 'label', splitStr, function (node: any) {
if (node.level != 3) {
if (node.level != 2) {
node.disabled = true;
}
});
@@ -120,7 +120,7 @@ async function setupCommunitySelect() {
// 选中后显示在输入框的值
treeNodeLabelProp: 'fullName',
}),
fieldName: 'unitId',
fieldName: 'buildingId',
},
]);
}

View File

@@ -1,13 +1,9 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import {
useVbenVxeGrid,