feat:房间查询
This commit is contained in:
@@ -21,8 +21,8 @@ const emit = defineEmits<{
|
||||
select: [];
|
||||
}>();
|
||||
|
||||
const selectDeptId = defineModel('selectDeptId', {
|
||||
required: true,
|
||||
const selectFloorId = defineModel('selectFloorId', {
|
||||
default: '',
|
||||
type: Array as PropType<string[]>,
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ const showTreeSkeleton = ref<boolean>(true);
|
||||
async function loadTree() {
|
||||
showTreeSkeleton.value = true;
|
||||
searchValue.value = '';
|
||||
selectDeptId.value = [];
|
||||
selectFloorId.value = [];
|
||||
const ret = await communityTree(3);
|
||||
deptTreeArray.value = ret;
|
||||
showTreeSkeleton.value = false;
|
||||
@@ -50,6 +50,9 @@ async function handleReload() {
|
||||
await loadTree();
|
||||
emit('reload');
|
||||
}
|
||||
function selectNode(selectedKeys, e) {
|
||||
emit('select',e.node.level);
|
||||
}
|
||||
|
||||
onMounted(loadTree);
|
||||
</script>
|
||||
@@ -86,14 +89,14 @@ onMounted(loadTree);
|
||||
<Tree
|
||||
v-bind="$attrs"
|
||||
v-if="deptTreeArray.length > 0"
|
||||
v-model:selected-keys="selectDeptId"
|
||||
v-model:selected-keys="selectFloorId"
|
||||
:class="$attrs.class"
|
||||
:field-names="{ title: 'label', key: 'id' }"
|
||||
:show-line="{ showLeafIcon: false }"
|
||||
:tree-data="deptTreeArray"
|
||||
:virtual="false"
|
||||
default-expand-all
|
||||
@select="$emit('select')"
|
||||
@select="selectNode"
|
||||
>
|
||||
<template #title="{ label }">
|
||||
<span v-if="label.indexOf(searchValue) > -1">
|
||||
|
@@ -20,6 +20,8 @@ import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import roomModal from './room-modal.vue';
|
||||
import {columns, querySchema} from './data';
|
||||
import DeptTree from "#/views/system/user/dept-tree.vue";
|
||||
import {ref} from "vue";
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
@@ -59,6 +61,18 @@ const gridOptions: VxeGridProps = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({page}, formValues = {}) => {
|
||||
Reflect.deleteProperty(formValues, 'communityId');
|
||||
Reflect.deleteProperty(formValues, 'buildingId');
|
||||
Reflect.deleteProperty(formValues, 'floorId');
|
||||
if (selectFloorId.value.length === 1) {
|
||||
if (level.value == 1) {
|
||||
formValues.communityId = selectFloorId.value[0];
|
||||
} else if (level.value == 2) {
|
||||
formValues.buildingId = selectFloorId.value[0];
|
||||
} else {
|
||||
formValues.floorId = selectFloorId.value[0];
|
||||
}
|
||||
}
|
||||
return await roomList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@@ -117,12 +131,23 @@ function handleDownloadExcel() {
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
});
|
||||
}
|
||||
|
||||
const selectFloorId = ref<string[]>([]);
|
||||
const level = ref<number>();
|
||||
|
||||
function handleSelectFloor(nodeLevel: number) {
|
||||
level.value = nodeLevel;
|
||||
tableApi.reload()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true" style="width: 100%">
|
||||
<div class="flex h-full gap-[15px]">
|
||||
<FloorTree></FloorTree>
|
||||
<FloorTree v-model:select-floor-id="selectFloorId"
|
||||
class="w-[260px]"
|
||||
@reload="() => tableApi.reload()"
|
||||
@select="handleSelectFloor"></FloorTree>
|
||||
<BasicTable class="flex-1 overflow-hidden" table-title="房间信息列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
|
Reference in New Issue
Block a user