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:混合') * 建筑类型('1住宅','2商业','3:混合')
*/ */
buildType: number; buildType: string;
/** /**
* 电梯数量 * 电梯数量

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,18 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import { import {
useVbenVxeGrid, useVbenVxeGrid,
vxeCheckboxChecked, vxeCheckboxChecked,
type VxeGridProps type VxeGridProps
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import { import {
@@ -138,8 +134,8 @@ function handleDownloadExcel() {
<a-button <a-button
:disabled="!vxeCheckboxChecked(tableApi)" :disabled="!vxeCheckboxChecked(tableApi)"
danger danger
type="primary" type="primary"
v-access:code="['property:floor:remove']" v-access:code="['property:floor:remove']"
@click="handleMultiDelete"> @click="handleMultiDelete">
{{ $t('pages.common.delete') }} {{ $t('pages.common.delete') }}
</a-button> </a-button>