This commit is contained in:
1378012178@qq.com 2025-06-30 10:05:31 +08:00
commit 732d2a1e06
3 changed files with 41 additions and 11 deletions

View File

@ -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 });
/**
*

View File

@ -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[] = [

View File

@ -19,6 +19,14 @@
离线
</span>
</template>
<template v-if="column.dataIndex === 'delFlag'">
<span v-if="record.delFlag ==='0'" style="color:green">
启用
</span>
<span v-else style="color:red">
停用
</span>
</template>
</template>
<!--操作栏-->
<template #action="{ record }">
@ -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({