物业之前,新工作台
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
}"
|
||||
:key="index"
|
||||
>
|
||||
<div class="buildingname" @click="switchBuilding(item.id)">{{ item.buildingName ?? '测试数据' }}</div>
|
||||
<div class="buildingname" @click="switchBuilding(item.id ?? null)">{{ item.buildingName ?? '测试数据' }}</div>
|
||||
<div class="buildactions flex align-center justify-around">
|
||||
<el-icon class="pointer hover-color-blue" @click="editBuilding(item.id)"><Setting /></el-icon>
|
||||
<el-icon class="pointer hover-color-red" @click="deleteBuilding(item.id)"><Delete /></el-icon>
|
||||
@@ -27,10 +27,12 @@
|
||||
<script setup lang="ts">
|
||||
import { deleteBuildingApi } from '@/api/system/house';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { switchBuilding } = houseStore; // 方法
|
||||
const { currentBuildingInfoList, currentBuildingInfo } = storeToRefs(houseStore); // 数据
|
||||
const router = useRouter();
|
||||
|
||||
const handleAddBuilding = () => {
|
||||
router.push({
|
||||
path: '/house/addbuilding'
|
||||
@@ -47,12 +49,9 @@ const editBuilding = (id: number) => {
|
||||
const deleteBuilding = (id: number) => {
|
||||
deleteBuildingApi(id)
|
||||
.then(() => {
|
||||
console.log('删除成功');
|
||||
houseStore.deleteBuildingFun(id);
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('删除失败');
|
||||
});
|
||||
.catch(() => {});
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user