房屋管理功能完成,接下来储藏室

This commit is contained in:
Zy
2026-04-09 12:40:17 +08:00
parent 6e998d4e87
commit 267a9a5f29
19 changed files with 1569 additions and 451 deletions

View File

@@ -1,43 +1,56 @@
<template>
<div class="TableBox p-5 h-full">
<el-table border :data="houseStore.currentFloorInfoList">
<el-table-column align="center" fixed label="楼层\单元" min-width="85">
<template #default="{ row }">
<span>{{ row }}楼</span>
</template>
</el-table-column>
<el-table-column
min-width="160"
class="column"
align="center"
:label="`${unit.unitNo}单元`"
v-for="(unit, index) in houseStore.currentHouseInfoList?.units ?? []"
:key="index"
>
<template #default="{ row }">
<houseItem @contextmenufun="contextMenuFun" @change="handleChange" :menu-list="menutlist" :unit="unit.floors" :f-idx="row"></houseItem>
</template>
</el-table-column>
</el-table>
<div class="TableBox p-5 h-full" v-if="houseStore.currentHouseInfoList !== null">
<el-checkbox-group @change="handleChangeCheckhouses" v-model="houseStore.checkoutHouses">
<el-table border :data="houseStore.currentFloorInfoList">
<el-table-column align="center" fixed label="楼层\单元" min-width="85">
<template #default="{ row }">
<span>{{ row }}楼</span>
</template>
</el-table-column>
<el-table-column
min-width="160"
class="column"
align="center"
:label="`${unit.unitNo}单元`"
v-for="(unit, index) in houseStore.currentHouseInfoList?.units ?? []"
:key="index"
>
<template #default="{ row }">
<houseItem @contextmenufun="contextMenuFun" :menu-list="menutlist" :unit="unit.floors" :f-idx="row"></houseItem>
</template>
</el-table-column>
</el-table>
</el-checkbox-group>
</div>
</template>
<script setup lang="ts">
import { deleteHouseApi } from '@/api/system/house';
import houseItem from './houseItem.vue';
import { useHouseStore } from '@/store/modules/house';
const houseStore = useHouseStore();
const { currentHouseInfoList, currentFloorInfoList } = storeToRefs(houseStore); // 数据
console.log(currentHouseInfoList);
const router = useRouter();
const menutlist = [
{ label: '编辑', value: 'edit' },
{ label: '收费标准', value: 'money' },
{ label: '详情', value: 'main' },
{ label: '删除', value: 'delete' }
];
function handleChangeCheckhouses(val: string[]) {
houseStore.checkoutHousesFun([]);
houseStore.checkoutHousesFun(val);
}
function contextMenuFun(val: { type: string; value: string }) {
switch (val.type) {
case 'edit':
console.log('你选择了:', val);
router.push({
path: '/house/addHouse',
query: {
id: val.value
}
});
break;
case 'money':
console.log('你选择了:', val);
@@ -47,13 +60,13 @@ function contextMenuFun(val: { type: string; value: string }) {
break;
case 'delete':
console.log('你选择了:', val);
houseStore.deleteHouseFun(val.value);
deleteHouseApi(val.value).then(() => {
ElMessage.success('删除成功');
houseStore.switchBuilding(houseStore.currentBuildingInfo.id);
});
break;
}
}
function handleChange(data: string[]) {
houseStore.checkoutHousesFun(data);
}
</script>
<style scoped lang="scss">