|
|
@@ -119,9 +119,10 @@
|
|
|
<el-table-column label="备注" align="left" prop="remark" width="250" :show-overflow-tooltip="true"/>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
|
|
|
<template #default="scope">
|
|
|
- <!-- <el-tooltip content="修改" placement="top">-->
|
|
|
- <!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['digital:deviceGroup:edit']"></el-button>-->
|
|
|
- <!-- </el-tooltip>-->
|
|
|
+ <el-tooltip content="修改" placement="top">
|
|
|
+ <el-button link type="primary" icon="Edit" @click="handleUpdateDevice(scope.row)"
|
|
|
+ v-hasPermi="['digital:deviceGroup:edit']"></el-button>
|
|
|
+ </el-tooltip>
|
|
|
<el-tooltip content="删除" placement="top">
|
|
|
<el-button link type="primary" icon="Delete" @click="handleDeleteDevice(scope.row)"
|
|
|
v-hasPermi="['digital:deviceGroup:remove']"></el-button>
|
|
|
@@ -189,7 +190,8 @@ import {
|
|
|
import {
|
|
|
getGroupRelByGroupId,
|
|
|
addDeviceGroupRel,
|
|
|
- delDeviceGroupRel
|
|
|
+ delDeviceGroupRel,
|
|
|
+ updateDeviceGroupRel
|
|
|
} from '@/api/smsb/digital/deviceGroupRel';
|
|
|
import {
|
|
|
listDevice
|
|
|
@@ -347,6 +349,17 @@ const handleAddDevice = () => {
|
|
|
addDeviceLog.title = "添加设备";
|
|
|
}
|
|
|
|
|
|
+/** 修改设备信息 */
|
|
|
+const handleUpdateDevice = async (row?: DeviceGroupRelVO) => {
|
|
|
+ reset();
|
|
|
+ // const _id = row?.id || ids.value[0]
|
|
|
+ // const res = await getDeviceGroup(_id);
|
|
|
+ getListRel();
|
|
|
+ Object.assign(dataRel.form, row);
|
|
|
+ addDeviceLog.visible = true;
|
|
|
+ addDeviceLog.title = "修改设备信息";
|
|
|
+}
|
|
|
+
|
|
|
/** 取消按钮 */
|
|
|
const cancel = () => {
|
|
|
reset();
|
|
|
@@ -421,7 +434,11 @@ const submitFormRel = () => {
|
|
|
deviceGroupRelFormRef.value?.validate(async (valid: boolean) => {
|
|
|
if (valid) {
|
|
|
buttonLoading.value = true;
|
|
|
- await addDeviceGroupRel(dataRel.form).finally(() => buttonLoading.value = false);
|
|
|
+ if (dataRel.form.id) {
|
|
|
+ await updateDeviceGroupRel(dataRel.form).finally(() => buttonLoading.value = false);
|
|
|
+ } else {
|
|
|
+ await addDeviceGroupRel(dataRel.form).finally(() => buttonLoading.value = false);
|
|
|
+ }
|
|
|
proxy?.$modal.msgSuccess("操作成功");
|
|
|
addDeviceLog.visible = false;
|
|
|
const res = await getGroupRelByGroupId(groupId.value);
|