فهرست منبع

优化:设备组详情支持修改

范志成 4 ماه پیش
والد
کامیت
d65933b1b3

+ 2 - 0
smsb-modules/smsb-device/src/main/java/com/inspur/device/service/impl/SmsbDeviceGroupRelServiceImpl.java

@@ -110,6 +110,8 @@ public class SmsbDeviceGroupRelServiceImpl implements ISmsbDeviceGroupRelService
     public Boolean updateByBo(SmsbDeviceGroupRelBo bo) {
         SmsbDeviceGroupRel update = MapstructUtils.convert(bo, SmsbDeviceGroupRel.class);
         validEntityBeforeSave(update);
+        SmsbDeviceVo device = deviceMapper.getDeviceVoByIdentifier(update.getDeviceIdentifier());
+        update.setDeviceName(device.getName());
         return baseMapper.updateById(update) > 0;
     }
 

+ 22 - 5
smsb-plus-ui/src/views/smsb/deviceGroup/index.vue

@@ -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);