Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
fyy 2025-07-02 09:49:00 +08:00
commit f84c4037fb
4 changed files with 396 additions and 300 deletions

View File

@ -1,6 +1,7 @@
import type { FormSchemaGetter } from '#/adapter/form'; import type {FormSchemaGetter} from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict"; import {getDictOptions} from "#/utils/dict";
import {renderDict} from "#/utils/render";
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
@ -17,7 +18,7 @@ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:getDictOptions('wy_khlx') options: getDictOptions('wy_khlx')
}, },
fieldName: 'customerType', fieldName: 'customerType',
label: '客户类型', label: '客户类型',
@ -25,7 +26,7 @@ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:getDictOptions('wy_zlfs') options: getDictOptions('wy_zlfs')
}, },
fieldName: 'rentalType', fieldName: 'rentalType',
label: '租赁方式', label: '租赁方式',
@ -33,7 +34,7 @@ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:getDictOptions('pro_charging_status') options: getDictOptions('pro_charging_status')
}, },
fieldName: 'paymentStatus', fieldName: 'paymentStatus',
label: '支付状态', label: '支付状态',
@ -42,83 +43,107 @@ 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: 'orderNo', field: 'orderNo',
width:100 width: 100
}, },
{ {
title: '客户名称', title: '客户名称',
field: 'customerName', field: 'customerName',
width:100 width: 100
}, },
{ {
title: '客户类型', title: '客户类型',
field: 'customerType', field: 'customerType',
slots: {default: 'customerType'}, slots: {
width:100 default: ({ row }) => {
return renderDict(row.customerType, 'wy_khlx');
},
},
width: 100
}, },
{ {
title: '租赁周期', title: '租赁周期',
field: 'rentalPeriod', field: 'rentalPeriod',
slots: {default: 'rentalPeriod'}, slots: {
width:100 default: ({ row }) => {
return renderDict(row.rentalPeriod, 'wy_sjdw');
},
},
width: 100
}, },
{ {
title: '租赁开始时间', title: '租赁开始时间',
field: 'startTime', field: 'startTime',
width:120 width: 120
}, },
{ {
title: '租赁结束时间', title: '租赁结束时间',
field: 'endTime', field: 'endTime',
width:120 width: 120
}, },
{ {
title: '应付总额', title: '应付总额',
field: 'totalAmount', field: 'totalAmount',
width:100 width: 100
}, },
{ {
title: '租赁方式', title: '租赁方式',
field: 'rentalType', field: 'rentalType',
slots: {default: 'rentalType'}, slots: {
width:100 default: ({ row }) => {
return renderDict(row.rentalType, 'wy_zlfs');
},
},
width: 100
}, },
{ {
title: '租赁商品', title: '租赁商品',
field: 'planId', field: 'planId',
slots: {default: 'planId'}, // slots: {default: 'planId'},
width:100 width: 100
}, },
{ {
title: '支付状态', title: '支付状态',
field: 'paymentStatus', field: 'paymentStatus',
slots: {default: 'paymentStatus'}, slots: {
width:100 default: ({ row }) => {
return renderDict(row.paymentStatus, 'pro_charging_status');
},
},
width: 100
}, },
{ {
title: '是否续租', title: '是否续租',
field: 'isRelet', field: 'isRelet',
slots: {default: 'isRelet'}, slots: {
width:100 default: ({ row }) => {
return renderDict(row.isRelet, 'wy_sf');
},
},
width: 100
}, },
{ {
title: '合同状态', title: '合同状态',
field: 'contractStatus', field: 'contractStatus',
slots: {default: 'contractStatus'}, slots: {
width:100 default: ({ row }) => {
return renderDict(row.contractStatus, 'wy_htzt');
},
},
width: 100
}, },
{ {
title: '签署时间', title: '签署时间',
field: 'signTime', field: 'signTime',
width:100 width: 100
}, },
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',
slots: { default: 'action' }, slots: {default: 'action'},
title: '操作', title: '操作',
minWidth: 180, minWidth: 180,
}, },
@ -134,12 +159,6 @@ export const modalSchema: FormSchemaGetter = () => [
triggerFields: [''], triggerFields: [''],
}, },
}, },
// {
// label: '订单号',
// fieldName: 'orderNo',
// component: 'Input',
// rules: 'required',
// },
{ {
label: '客户名称', label: '客户名称',
fieldName: 'customerName', fieldName: 'customerName',
@ -151,7 +170,7 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'customerType', fieldName: 'customerType',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:getDictOptions('wy_khlx') options: getDictOptions('wy_khlx')
}, },
rules: 'selectRequired', rules: 'selectRequired',
}, },
@ -160,7 +179,7 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'rentalPeriod', fieldName: 'rentalPeriod',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:getDictOptions('wy_time_unit') options: getDictOptions('wy_time_unit')
}, },
rules: 'selectRequired', rules: 'selectRequired',
}, },
@ -180,33 +199,45 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'rentalType', fieldName: 'rentalType',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:getDictOptions('wy_zlfs') options: getDictOptions('wy_zlfs')
}, },
rules: 'selectRequired', rules: 'selectRequired',
formItemClass:'col-span-2' formItemClass: 'col-span-2'
}, },
{ {
label: '租赁方案id', label: '租赁方案',
fieldName: 'planId', fieldName: 'planId',
component: 'Input', component: 'Select',
dependencies: { dependencies: {
// 仅当 租赁方式 为 2套餐 时显示 // 仅当 租赁方式 为 2套餐 时显示
show: (formValues) => formValues.rentalType === '2', show: (formValues) => formValues.rentalType === '2',
triggerFields: ['rentalType'], triggerFields: ['rentalType'],
}, },
rules: 'required', rules: 'selectRequired',
formItemClass:'col-span-2' formItemClass: 'col-span-2'
}, },
{ {
label: '绿植产品id', label: '方案详情',
fieldName: 'productId', fieldName: 'planInfo',
component: 'Input', component: 'Input',
dependencies: {
// 仅当 租赁方式 为 2套餐 时显示
show: (formValues) => formValues.rentalType === '2' && formValues.planId != null,
triggerFields: ['rentalType'],
},
formItemClass: 'col-span-2'
},
{
label: '绿植产品',
fieldName: 'productId',
component: 'Select',
dependencies: { dependencies: {
// 仅当 租赁方式 为 1单点 时显示 // 仅当 租赁方式 为 1单点 时显示
show: (formValues) => formValues.rentalType === '1', show: (formValues) => formValues.rentalType === '1',
triggerFields: ['rentalType'], triggerFields: ['rentalType'],
}, },
rules: 'required', rules: 'selectRequired',
formItemClass: 'col-span-2'
}, },
{ {
label: '租赁数量', label: '租赁数量',
@ -215,29 +246,31 @@ export const modalSchema: FormSchemaGetter = () => [
componentProps: { componentProps: {
min: 1, min: 1,
precision: 0, precision: 0,
step: 1 step: 1,
placeholder:'租赁数量不可超出绿植产品库存数量'
}, },
dependencies: { dependencies: {
// 仅当 租赁方式 为 1单点 时显示 // 仅当 租赁方式 为 1单点 时显示
show: (formValues) => formValues.rentalType === '1', show: (formValues) => formValues.rentalType === '1',
triggerFields: ['rentalType'], triggerFields: ['rentalType', 'productId'],
}, },
rules: 'required', rules: 'required',
}, },
{ // {
label: '应付总额', // label: '应付总额',
fieldName: 'totalAmount', // fieldName: 'totalAmount',
component: 'Input', // component: 'Input',
rules: 'required', // rules: 'required',
}, // },
{ // {
label: '支付状态', // label: '支付状态',
fieldName: 'paymentStatus', // fieldName: 'paymentStatus',
component: 'Select', // component: 'Select',
componentProps: { // componentProps: {
}, // options: getDictOptions('pro_charging_status'),
rules: 'selectRequired', // },
}, // rules: 'selectRequired',
// },
// { // {
// label: '是否续租', // label: '是否续租',
// fieldName: 'isRelet', // fieldName: 'isRelet',
@ -255,6 +288,17 @@ export const modalSchema: FormSchemaGetter = () => [
componentProps: { componentProps: {
options: getDictOptions('wy_htzt'), options: getDictOptions('wy_htzt'),
}, },
rules: 'selectRequired'
},
{
label: '合同编号',
fieldName: 'contractCode',
component: 'Input',
dependencies: {
show: (formValues) => formValues.contractStatus != null && formValues.contractStatus != 1,
triggerFields: ['contractStatus'],
},
rules: 'required'
}, },
{ {
label: '签署时间', label: '签署时间',
@ -262,8 +306,13 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
showTime: true, showTime: true,
format: 'YYYY-MM-DD HH:mm:ss', format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD',
}, },
dependencies: {
show: (formValues) => formValues.contractStatus != null && formValues.contractStatus != 1,
triggerFields: ['contractStatus'],
},
rules: 'required'
}, },
]; ];

View File

@ -1,23 +1,230 @@
<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 { rentalOrderAdd, rentalOrderInfo, rentalOrderUpdate } from '#/api/property/rentalOrder'; import {
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; rentalOrderAdd,
rentalOrderInfo,
import { modalSchema } from './data'; rentalOrderUpdate
} from '#/api/property/rentalOrder';
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import {plantsProductList} from "#/api/property/productManagement";
import {rentalPlanList} from "#/api/property/rentalPlan";
import {getDictOptions} from "#/utils/dict";
import type {PropertyVO} from "#/api/property/productManagement/model";
import type {RentalPlanVO} from "#/api/property/rentalPlan/model";
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false); const isUpdate = ref(false);
const planList = ref<RentalPlanVO[]>([]);
const plantsList = ref<PropertyVO[]>([]);
const title = computed(() => { const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add'); return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
}); });
const modalSchema = [
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '客户名称',
fieldName: 'customerName',
component: 'Input',
rules: 'required',
},
{
label: '客户类型',
fieldName: 'customerType',
component: 'Select',
componentProps: {
options: getDictOptions('wy_khlx')
},
rules: 'selectRequired',
},
{
label: '租赁周期',
fieldName: 'rentalPeriod',
component: 'Select',
componentProps: {
options: getDictOptions('wy_time_unit')
},
rules: 'selectRequired',
},
{
label: '租赁时间',
fieldName: 'rentalTime',
component: 'RangePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
},
rules: 'selectRequired',
},
{
label: '租赁方式',
fieldName: 'rentalType',
component: 'Select',
componentProps: {
options: getDictOptions('wy_zlfs')
},
rules: 'selectRequired',
formItemClass: 'col-span-2'
},
{
label: '租赁方案',
fieldName: 'planId',
component: 'Select',
dependencies: {
// 2
show: (formValues: any) => formValues.rentalType === '2',
triggerFields: ['rentalType'],
},
rules: 'selectRequired',
formItemClass: 'col-span-2'
},
{
label: '方案详情',
fieldName: 'planInfo',
component: 'Input',
dependencies: {
// 2
show: (formValues: any) => formValues.rentalType === '2' && formValues.planId != null,
triggerFields: ['rentalType'],
},
formItemClass: 'col-span-2',
componentProps: {}
},
{
label: '绿植产品',
fieldName: 'productId',
component: 'ApiSelect',
dependencies: {
// 1
show: (formValues: any) => formValues.rentalType === '1',
triggerFields: ['rentalType'],
},
rules: 'selectRequired',
formItemClass: 'col-span-2',
componentProps: {
api: async () => {
const res = await plantsProductList({pageNum: 1, pageSize: 1000, inventory: 1});
plantsList.value = res.rows || [];
return plantsList.value.map(item => ({
label: item.plantName + '-' + item.plantCode + '\xa0\xa0租金' + item.rent + '\xa0\xa0库存数量' + item.inventory,
value: item.id,
}));
},
onChange: async (value: string) => {
const plants = plantsList.value.find(item => item.id === value);
if (plants) {
formApi.updateSchema([{
componentProps: () => ({
min: 1,
max: plants.inventory,
precision: 0,
}),
fieldName: 'productNum',
}])
}
},
showSearch: true,
filterOption: (input: any, option: any) =>
option.label.toLowerCase().includes(input.toLowerCase()),
}
},
{
label: '租赁数量',
fieldName: 'productNum',
component: 'InputNumber',
componentProps: {
min: 1,
precision: 0,
step: 1,
placeholder: '租赁数量不可超出绿植产品库存数量'
},
dependencies: {
// 1
show: (formValues: any) => formValues.rentalType === '1',
triggerFields: ['rentalType', 'productId'],
},
rules: 'required',
},
{
label: '应付总额',
fieldName: 'totalAmount',
component: 'span',
dependencies: {
// 1
show: (formValues: any) => formValues.totalAmount,
triggerFields: ['totalAmount'],
},
},
// {
// label: '',
// fieldName: 'paymentStatus',
// component: 'Select',
// componentProps: {
// options: getDictOptions('pro_charging_status'),
// },
// rules: 'selectRequired',
// },
// {
// label: '',
// fieldName: 'isRelet',
// component: 'RadioGroup',
// componentProps: {
// buttonStyle: 'solid',
// optionType: 'button',
// options: getDictOptions('wy_sf'),
// },
// },
{
label: '合同状态',
fieldName: 'contractStatus',
component: 'Select',
componentProps: {
options: getDictOptions('wy_htzt'),
},
rules: 'selectRequired'
},
{
label: '合同编号',
fieldName: 'contractCode',
component: 'Input',
dependencies: {
show: (formValues: any) => formValues.contractStatus != null && formValues.contractStatus != 1,
triggerFields: ['contractStatus'],
},
rules: 'required'
},
{
label: '签署时间',
fieldName: 'signTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
},
dependencies: {
show: (formValues: any) => formValues.contractStatus != null && formValues.contractStatus != 1,
triggerFields: ['contractStatus'],
},
rules: 'required'
},
];
const [BasicForm, formApi] = useVbenForm({ const [BasicForm, formApi] = useVbenForm({
commonConfig: { commonConfig: {
// //
@ -29,12 +236,13 @@ const [BasicForm, formApi] = useVbenForm({
class: 'w-full', class: 'w-full',
} }
}, },
schema: modalSchema(), schema: modalSchema,
showDefaultActions: false, showDefaultActions: false,
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),
@ -53,10 +261,10 @@ const [BasicModal, modalApi] = useVbenModal({
return null; return null;
} }
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;
await getPlanList()
// await getPlantsList()
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await rentalOrderInfo(id); const record = await rentalOrderInfo(id);
await formApi.setValues(record); await formApi.setValues(record);
@ -70,12 +278,18 @@ 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;
} }
// getValuesreadonly // getValuesreadonly
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
if (data.rentalType == 1) {
data.planId = undefined;
} else {
data.productId = undefined;
data.productNum = undefined;
}
await (isUpdate.value ? rentalOrderUpdate(data) : rentalOrderAdd(data)); await (isUpdate.value ? rentalOrderUpdate(data) : rentalOrderAdd(data));
resetInitialized(); resetInitialized();
emit('reload'); emit('reload');
@ -87,15 +301,70 @@ async function handleConfirm() {
} }
} }
//绿
async function getPlantsList() {
let params = {
pageNum: 1,
pageSize: 1000,
inventory: 0
}
const res = await plantsProductList(params)
plantsList.value = res.rows
// formApi.updateSchema([
// {
// componentProps: () => ({
// class: 'w-full',
// options: res.rows.map(item => ({
// label: item.plantName + '-' + item.plantCode + '\xa0\xa0' + item.rent + '\xa0\xa0' + item.inventory,
// value: item.id,
// })),
// placeholder: '绿',
// showSearch: true,
// filterOption: (input: any, option: any) =>
// option.label.toLowerCase().includes(input.toLowerCase()),
// }),
// fieldName: 'productId',
// },
// ]);
}
//绿
async function getPlanList() {
let params = {
pageNum: 1,
pageSize: 1000,
state: 0,
}
const res = await rentalPlanList(params)
planList.value = res.rows
formApi.updateSchema([
{
componentProps: () => ({
class: 'w-full',
options: res.rows.map(item => ({
label: item.planName,
value: item.id,
})),
placeholder: '请选择绿植',
showSearch: true,
filterOption: (input: any, option: any) =>
option.label.toLowerCase().includes(input.toLowerCase()),
}),
fieldName: 'planId',
},
]);
}
async function handleClosed() { async function handleClosed() {
await formApi.resetForm(); await formApi.resetForm();
resetInitialized(); resetInitialized();
} }
</script> </script>
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm /> <BasicForm/>
</BasicModal> </BasicModal>
</template> </template>

View File

@ -10,7 +10,6 @@ import { resident_unitAdd, resident_unitInfo, resident_unitUpdate } from '#/api/
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data'; import { modalSchema } from './data';
import RoomSelect from "#/views/property/room/room-select.vue";
import {communityTree} from "#/api/property/community"; import {communityTree} from "#/api/property/community";
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
@ -134,9 +133,6 @@ async function handleClosed() {
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm> <BasicForm>
<!-- <template #location="slotProps">-->
<!-- <RoomSelect v-bind="slotProps" :isUpdate="isUpdate" :level="2"/>-->
<!-- </template>-->
</BasicForm> </BasicForm>
</BasicModal> </BasicModal>
</template> </template>

View File

@ -1,218 +0,0 @@
<script lang="ts" setup>
import {onMounted, ref, watch} from 'vue';
import {Select} from 'ant-design-vue';
import {communityList} from "#/api/property/community";
import {buildingList} from "#/api/property/building";
import {unitList} from "#/api/property/unit";
import {floorList} from "#/api/property/floor";
import {roomList} from "#/api/property/room";
defineOptions({name: 'RoomSelect'});
const props = withDefaults(defineProps<{
disabled?: boolean;
isUpdate?: boolean;
level?:number;
}>(), {
disabled: false,
isUpdate: false,
level:5
});
const communityData = ref<any[]>([]);
const buildingData = ref<any[]>([]);
const unitData = ref<any[]>([]);
const floorData = ref<any[]>([]);
const roomData = ref<any[]>([]);
const communityValue = ref();
const buildingValue = ref();
const unitValue = ref();
const floorValue = ref();
const roomValue = ref();
const changeData=ref();
onMounted(() => {
queryCommunity()
});
const emit = defineEmits(['update:roomCode']);
async function queryCommunity() {
const queryData = {
pageSize: 100,
pageNum: 1,
state: 1,
}
const res = await communityList(queryData);
communityData.value = res.rows.map((item) => ({
label: item.communityName,
value: item.id,
}));
}
async function queryBuilding() {
const queryData = {
pageSize: 100,
pageNum: 1,
state: 1,
communityCode: communityValue.value
}
const res = await buildingList(queryData);
buildingData.value = res.rows.map((item) => ({
label: item.buildingName,
value: item.id,
}));
}
async function queryUnit() {
const queryData = {
pageSize: 100,
pageNum: 1,
state: 1,
buildingCode: buildingValue.value
}
const res = await unitList(queryData);
unitData.value = res.rows.map((item) => ({
label: item.unitName,
value: item.id,
}));
}
async function queryFloor() {
const queryData = {
pageSize: 100,
pageNum: 1,
state: 1,
unitCode: unitValue.value
}
const res = await floorList(queryData);
floorData.value = res.rows.map((item) => ({
label: item.floorName,
value: item.id,
}));
}
async function queryRoom() {
const queryData = {
pageSize: 100,
pageNum: 1,
state: 1,
floorCode: floorValue.value
}
const res = await roomList(queryData);
roomData.value = res.rows.map((item) => ({
label: item.roomCode,
value: item.id,
}));
}
const handleChangeCommunity = (val: string) => {
communityValue.value = val;
buildingValue.value = undefined;
unitValue.value = undefined;
floorValue.value = undefined;
roomValue.value = undefined;
queryBuilding()
};
const handleChangeBuilding = (val: string) => {
buildingValue.value = val;
unitValue.value = undefined;
floorValue.value = undefined;
roomValue.value = undefined;
queryUnit()
};
const handleChangeUnit = (val: string) => {
unitValue.value = val;
floorValue.value = undefined;
roomValue.value = undefined;
queryFloor()
};
const handleChangeFloor = (val: string) => {
floorValue.value = val;
roomValue.value = undefined;
queryRoom()
};
const handleChangeRoom = (val: string) => {
roomValue.value = val;
};
watch(() => props.isUpdate,
(newX) => {
console.log(newX, '==========================')
}, {immediate: true})
watch(() => roomValue.value,
(newX) => {
emit('update:roomCode', newX);
console.log(newX, '==========================roomCode')
},)
const filterOption = (input: string, option: any) => {
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};
</script>
<template>
<div>
<Select
v-if="props.level>1"
v-model:value="communityValue"
show-search
placeholder="请选择区域"
:options="communityData"
:filter-option="filterOption"
@change="handleChangeCommunity"
style="width: 20%"
></Select>
<Select
v-if="props.level>1"
v-model:value="buildingValue"
show-search
:disabled="!communityValue"
placeholder="请选择建筑"
:options="buildingData"
:filter-option="filterOption"
@change="handleChangeBuilding"
@focus="queryBuilding"
style="width: 20%"
></Select>
<Select
v-if="props.level>2"
v-model:value="unitValue"
:disabled="!buildingValue"
show-search
placeholder="请选择单元"
:options="unitData"
:filter-option="filterOption"
@change="handleChangeUnit"
@focus="queryUnit"
style="width: 20%"
></Select>
<Select
v-if="props.level>3"
v-model:value="floorValue"
:disabled="!unitValue"
show-search
placeholder="请选择楼层"
:options="floorData"
:filter-option="filterOption"
@change="handleChangeFloor"
@focus="queryFloor"
style="width: 20%"
></Select>
<Select
v-if="props.level>4"
v-model:value="roomValue"
:disabled="!floorValue"
show-search
placeholder="请选择房间"
:options="roomData"
:filter-option="filterOption"
@change="handleChangeRoom"
@focus="queryRoom"
style="width: 20%"
></Select>
</div>
</template>