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">
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import {Page, useVbenModal, type VbenFormProps} from '@vben/common-ui';
|
||||
import {getVxePopupContainer} from '@vben/utils';
|
||||
import {Modal, Popconfirm, Space} from 'ant-design-vue';
|
||||
import FloorTree from "./floor-tree.vue"
|
||||
|
||||
import {
|
||||
@@ -15,11 +15,13 @@ import {
|
||||
roomList,
|
||||
roomRemove,
|
||||
} from '#/api/property/room';
|
||||
import type { RoomForm } from '#/api/property/room/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
import type {RoomForm} from '#/api/property/room/model';
|
||||
import {commonDownloadExcel} from '#/utils/file/download';
|
||||
|
||||
import roomModal from './room-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import {columns, querySchema} from './data';
|
||||
import DeptTree from "#/views/system/user/dept-tree.vue";
|
||||
import {ref} from "vue";
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
@@ -58,7 +60,19 @@ const gridOptions: VxeGridProps = {
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
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,
|
||||
@@ -89,7 +103,7 @@ function handleAdd() {
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<RoomForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.setData({id: row.id});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -175,6 +200,6 @@ function handleDownloadExcel() {
|
||||
</template>
|
||||
</BasicTable>
|
||||
</div>
|
||||
<RoomModal @reload="tableApi.query()" />
|
||||
<RoomModal @reload="tableApi.query()"/>
|
||||
</Page>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user