From 9a7c2aa6ede37d75e341868b98b57ee27b0e5ffc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9B=B9=E7=A3=8A?= <45566618@qq.com>
Date: Mon, 30 Jun 2025 08:50:11 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B8=A9=E6=B9=BF=E5=BA=A6=E5=88=A0=E9=99=A4?=
=?UTF-8?q?=E6=94=B9=E5=81=9C=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/iot/yiweilian/humid.api.ts | 4 +--
src/views/iot/yiweilian/humid.data.ts | 8 ++++++
src/views/iot/yiweilian/index.vue | 40 +++++++++++++++++++++------
3 files changed, 41 insertions(+), 11 deletions(-)
diff --git a/src/views/iot/yiweilian/humid.api.ts b/src/views/iot/yiweilian/humid.api.ts
index dfc1aa8..a2bf6ff 100644
--- a/src/views/iot/yiweilian/humid.api.ts
+++ b/src/views/iot/yiweilian/humid.api.ts
@@ -4,7 +4,7 @@ enum Api {
list = '/iot/yiweilian/humidDevice/list',
insertDevice = '/iot/yiweilian/humidDevice/insertDevice',
updateDevice = '/iot/yiweilian/humidDevice/updateDevice',
- deleteDevice = '/iot/yiweilian/humidDevice/deleteDevice',
+ delFlagDevice = '/iot/yiweilian/humidDevice/delFlagDevice',
getDeviceParameters = '/iot/yiweilian/humidDevice/getDeviceParameters',
updateDeviceRealTime = '/iot/yiweilian/humidDevice/updateDeviceRealTime',
logList = '/iot/yiweilian/humidDevice/logList',
@@ -33,7 +33,7 @@ export const updateDevice = (params?) => defHttp.get({ url: Api.updateDevice, pa
* 删除
* @param params
*/
-export const deleteDevice = (params?) => defHttp.get({ url: Api.deleteDevice, params });
+export const delFlagDevice = (params?) => defHttp.get({ url: Api.delFlagDevice, params });
/**
* 获取设备配置参数
diff --git a/src/views/iot/yiweilian/humid.data.ts b/src/views/iot/yiweilian/humid.data.ts
index 66e1a3b..1bdf047 100644
--- a/src/views/iot/yiweilian/humid.data.ts
+++ b/src/views/iot/yiweilian/humid.data.ts
@@ -75,6 +75,14 @@ export const columns: BasicColumn[] = [
return record.status?(record.status=='0'?'在线':'离线'):'';
},
},
+ {
+ title: '启用状态',
+ align: "center",
+ dataIndex: 'delFlag',
+ customRender:({record})=>{
+ return record.delFlag?(record.delFlag=='0'?'启用':'停用'):'';
+ },
+ },
];
export const searchFormSchema: FormSchema[] = [
diff --git a/src/views/iot/yiweilian/index.vue b/src/views/iot/yiweilian/index.vue
index de1b3ca..fa54325 100644
--- a/src/views/iot/yiweilian/index.vue
+++ b/src/views/iot/yiweilian/index.vue
@@ -19,6 +19,14 @@
离线
+
+
+ 启用
+
+
+ 停用
+
+
@@ -38,7 +46,7 @@
import { useListPage } from '/@/hooks/system/useListPage';
import { useUserStore } from '/@/store/modules/user';
import {Modal} from "ant-design-vue";
- import {list, deleteDevice, updateDeviceRealTime} from './humid.api';
+ import {list, delFlagDevice, updateDeviceRealTime} from './humid.api';
import { columns, searchFormSchema } from './humid.data';
import {useModal} from "@/components/Modal";
import {useDrawer} from "@/components/Drawer";
@@ -100,22 +108,35 @@
{
label: '抄表',
onClick: handleRead.bind(null, record),
+ ifShow: ()=>{ return record.delFlag == 0 }
},
{
label: '编辑',
onClick: handleEdit.bind(null, record),
+ ifShow: ()=>{ return record.delFlag == 0 }
},
{
- label: '删除',
+ label: '启用',
popConfirm: {
- title: '是否确认删除',
- confirm: handleDelete.bind(null, record),
+ title: '是否确认启用',
+ confirm: activateDevice.bind(null, record,'0'),
placement: 'topLeft',
},
+ ifShow: ()=>{ return record.delFlag == '1' }
+ },
+ {
+ label: '停用',
+ popConfirm: {
+ title: '是否确认停用',
+ confirm: activateDevice.bind(null, record,'1'),
+ placement: 'topLeft',
+ },
+ ifShow: ()=>{ return record.delFlag == '0' }
},
{
label: '日志',
- onClick: handleApiLogAlarm.bind(null, record),
+ onClick: handleApiLogAlarm.bind(null, record),
+ ifShow: ()=>{ return record.delFlag == '0' }
},
{
label: '同步',
@@ -155,12 +176,13 @@
});
}
- // 删除
- async function handleDelete(record: Recordable) {
+ // 启用/停用
+ async function activateDevice(record: Recordable,flag) {
const params = {
'sn' : record.sn,
+ 'delFlag' : flag
};
- await deleteDevice(params);
+ await delFlagDevice(params);
handleSuccess();
}
@@ -169,7 +191,7 @@
apiLogAlarmModal.value.showLogAlarm(record);
}
-
+
//护理单元回调
function handleHldyParams(params){
defHttp.post({