92 lines
2.6 KiB
Vue
92 lines
2.6 KiB
Vue
<template>
|
|
<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="楼层\单元" max-width="100">
|
|
<template #default="{ row }">
|
|
<span>{{ row }}楼</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
min-width="260"
|
|
align="center"
|
|
:label="`${unit.unitNo}单元`"
|
|
v-for="(unit, index) in houseStore.currentHouseInfoList?.units.length > 0 ? 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';
|
|
import { checkPermi } from '@/utils/permission';
|
|
|
|
const houseStore = useHouseStore();
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
const router = useRouter();
|
|
const menutlist = [
|
|
{ label: '编辑', value: 'edit' },
|
|
// { label: '收费标准', value: 'money' },
|
|
{ label: '详情', value: 'main' }
|
|
];
|
|
|
|
if (checkPermi(['house:delete:house'])) {
|
|
menutlist.push({ label: '删除', value: 'delete' });
|
|
}
|
|
function handleChangeCheckhouses(val: string[]) {
|
|
houseStore.checkoutHousesFun([]);
|
|
houseStore.checkoutHousesFun(val);
|
|
}
|
|
function contextMenuFun(val: { type: string; value: string }) {
|
|
switch (val.type) {
|
|
case 'edit':
|
|
router.push({
|
|
path: '/house/editHouse',
|
|
query: {
|
|
id: val.value
|
|
}
|
|
});
|
|
break;
|
|
case 'money':
|
|
break;
|
|
case 'main':
|
|
router.push({
|
|
path: '/house/HouseDetails',
|
|
query: {
|
|
id: val.value
|
|
}
|
|
});
|
|
break;
|
|
case 'delete':
|
|
if (!checkPermi(['house:delete:house'])) {
|
|
break;
|
|
}
|
|
|
|
proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').then(() => {
|
|
deleteHouseApi(val.value).then(() => {
|
|
houseStore.switchBuilding(houseStore.currentBuildingInfo.id);
|
|
proxy?.$modal.msgSuccess('删除成功');
|
|
});
|
|
});
|
|
break;
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.TableBox {
|
|
.el-table {
|
|
height: calc(100% - 500px);
|
|
}
|
|
}
|
|
</style>
|