7/13 水电表解绑房屋

This commit is contained in:
Zy
2026-07-13 08:06:08 +08:00
parent 298f93380c
commit 4efb535730
10 changed files with 128 additions and 73 deletions

View File

@@ -133,11 +133,15 @@
> -->
<el-button
link
v-if="!scope.row.houseName"
type="primary"
@click="handleOpenDialog('UpdateHouse', scope.row)"
v-has-permi="['equipment:edithouse:electricitydevice']"
>绑定房屋</el-button
>
<el-button v-else link type="primary" @click="handleUnbind(scope.row)" v-has-permi="['equipment:edithouse:electricitydevice']"
>解绑房屋</el-button
>
<!-- <el-dropdown style="vertical-align: text-top">
<el-button link type="primary">
<div>
@@ -248,6 +252,7 @@
<script setup name="WaterDevice" lang="ts">
import {
ElectricityDeviceMakerQrcode,
ElectricityDeviceUnbind,
getElectricityDeviceTimeRangeUsedWater,
listElectricityDevice,
updateElectricityDevice
@@ -259,6 +264,8 @@ import { checkPermi } from '@/utils/permission';
import { Upload } from '@element-plus/icons-vue';
import { CascaderValue, UploadProps, UploadRawFile } from 'element-plus';
import { exportImagesToZip } from '@/utils/exportZip';
import { WaterDeviceVO } from '@/api/system/SdbWaterDevice/type';
import { waterDeviceUnbind } from '@/api/system/SdbWaterDevice';
const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/electricityDevice/upload';
@@ -490,6 +497,17 @@ const handleOpenDialog = (type: 'usedWater' | 'Upload' | 'UpdateHouse', row: Ele
}
};
// 解绑房屋
function handleUnbind(data: ElectricityDeviceVO) {
ElectricityDeviceUnbind(data.deviceCode)
.then(() => {
ElMessage.success('解绑成功');
})
.finally(() => {
getList();
});
}
function getTree() {
treedata.value = [];
houseStore.getCurrentVilageTreeHouse().then((res) => {

View File

@@ -129,9 +129,18 @@
>
<!-- <el-button link type="primary" @click="handleUpdate(scope.row.deviceCode)">最新抄表记录</el-button> -->
<el-button link type="primary" @click="handleOpenDialog('UpdateHouse', scope.row)" v-has-permi="['equipment:edithouse:waterdevice']"
<el-button
v-if="!scope.row.houseName"
link
type="primary"
@click="handleOpenDialog('UpdateHouse', scope.row)"
v-has-permi="['equipment:edithouse:waterdevice']"
>绑定房屋</el-button
>
<el-button v-else link type="primary" @click="handleUnbind(scope.row)" v-has-permi="['equipment:edithouse:waterdevice']"
>解绑房屋</el-button
>
<!-- <el-dropdown style="vertical-align: text-top">
<el-button link type="primary">
<div>
@@ -309,7 +318,8 @@ import {
WaterDeviceMakerQrcode,
updateWaterDevice,
WaterDeviceUpdateBin,
latestRecord
latestRecord,
waterDeviceUnbind
} from '@/api/system/SdbWaterDevice';
import { WaterDeviceVO } from '@/api/system/SdbWaterDevice/type';
import { useHouseStore } from '@/store/modules/house';
@@ -637,6 +647,17 @@ function handleUpdate(id: string) {
});
}
// 解绑房屋
function handleUnbind(data: WaterDeviceVO) {
waterDeviceUnbind(data.deviceCode)
.then(() => {
ElMessage.success('解绑成功');
})
.finally(() => {
getList();
});
}
/** 提交按钮 */
const submitForm = () => {
if (dialogType.value === 'usedWater') {