物业之前,新工作台
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>
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ function handleChangeCheckhouses(val: string[]) {
|
||||
function contextMenuFun(val: { type: string; value: string }) {
|
||||
switch (val.type) {
|
||||
case 'edit':
|
||||
console.log('你选择了:', val);
|
||||
router.push({
|
||||
path: '/house/addHouse',
|
||||
query: {
|
||||
@@ -56,7 +55,6 @@ function contextMenuFun(val: { type: string; value: string }) {
|
||||
console.log('你选择了:', val);
|
||||
break;
|
||||
case 'main':
|
||||
console.log('你选择了:', val);
|
||||
router.push({
|
||||
path: '/house/HouseDetails',
|
||||
query: {
|
||||
@@ -65,7 +63,6 @@ function contextMenuFun(val: { type: string; value: string }) {
|
||||
});
|
||||
break;
|
||||
case 'delete':
|
||||
console.log('你选择了:', val);
|
||||
deleteHouseApi(val.value).then(() => {
|
||||
ElMessage.success('删除成功');
|
||||
houseStore.switchBuilding(houseStore.currentBuildingInfo.id);
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
<div class="Unit_top flex align-center justify-between">
|
||||
<div>
|
||||
<span class="text-size-16px text-color-black text-widget-bold mr-30px">
|
||||
<strong>{{ houseStore.currentBuildingInfo.buildingName }}</strong>
|
||||
<strong>{{ houseStore.currentBuildingInfo?.buildingName }}</strong>
|
||||
</span>
|
||||
<span class="mr-30px">楼栋朝向:{{ houseStore.currentBuildingInfo.buildToward }}</span>
|
||||
<span class="mr-30px">楼高:{{ houseStore.currentBuildingInfo.buildTall }}(m)</span>
|
||||
<span class="mr-30px">楼栋结构:{{ houseStore.currentBuildingInfo.buildStructure }} </span>
|
||||
<span class="mr-30px">楼栋朝向:{{ houseStore.currentBuildingInfo?.buildToward }}</span>
|
||||
<span class="mr-30px">楼高:{{ houseStore.currentBuildingInfo?.buildTall ? `${houseStore.currentBuildingInfo?.buildTall}(m)` : '' }}</span>
|
||||
<span class="mr-30px">楼栋结构:{{ houseStore.currentBuildingInfo?.buildStructure }} </span>
|
||||
</div>
|
||||
<div class="rightActions">
|
||||
<span class="mr-20px" @click="handleAddHouse">+增加房屋</span>
|
||||
<span class="mr-20px">收费标准设置</span>
|
||||
<!-- <span class="mr-20px">收费标准设置</span> -->
|
||||
<span @click="deleteAllhouse">删除</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -35,7 +35,6 @@ function handleAddHouse() {
|
||||
|
||||
function deleteAllhouse() {
|
||||
const checkhouse = houseStore.checkoutHouses;
|
||||
console.log(checkhouse);
|
||||
if (checkhouse.length > 0) {
|
||||
let deletecount = 0;
|
||||
checkhouse.forEach((item) => {
|
||||
|
||||
Reference in New Issue
Block a user