1、绿植租赁订单
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
2025-06-30 14:45:06 +08:00
parent d24d03457a
commit 9eac725934
11 changed files with 148 additions and 76 deletions

View File

@@ -3,7 +3,7 @@ import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import {cloneDeep, getPopupContainer, handleNode} from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { resident_unitAdd, resident_unitInfo, resident_unitUpdate } from '#/api/property/resident/unit';
@@ -11,6 +11,7 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
import RoomSelect from "#/views/property/room/room-select.vue";
import {communityTree} from "#/api/property/community";
const emit = defineEmits<{ reload: [] }>();
@@ -57,7 +58,7 @@ const [BasicModal, modalApi] = useVbenModal({
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
initLocationOptions()
if (isUpdate.value && id) {
const record = await resident_unitInfo(id);
await formApi.setValues(record);
@@ -87,6 +88,42 @@ async function handleConfirm() {
modalApi.lock(false);
}
}
/**
* 入驻位置数据
*/
async function initLocationOptions() {
const locationList = await communityTree(5);
const splitStr = '/';
handleNode(locationList, 'label', splitStr, function (node: any) {
if (node.level != 5) {
node.disabled = true;
}
});
formApi.updateSchema([
{
componentProps: () => ({
class: 'w-full',
fieldNames: {
key: 'id',
label: 'label',
value: 'code',
children: 'children',
},
getPopupContainer,
placeholder: '请选择入驻位置',
showSearch: true,
treeData: locationList,
treeDefaultExpandAll: true,
treeLine: { showLeafIcon: false },
// 筛选的字段
treeNodeFilterProp: 'label',
// 选中后显示在输入框的值
treeNodeLabelProp: 'fullName',
}),
fieldName: 'location',
},
]);
}
async function handleClosed() {
await formApi.resetForm();
@@ -97,9 +134,9 @@ async function handleClosed() {
<template>
<BasicModal :title="title">
<BasicForm>
<template #location="slotProps">
<RoomSelect v-bind="slotProps" :isUpdate="isUpdate" :level="2"/>
</template>
<!-- <template #location="slotProps">-->
<!-- <RoomSelect v-bind="slotProps" :isUpdate="isUpdate" :level="2"/>-->
<!-- </template>-->
</BasicForm>
</BasicModal>
</template>