Переглянути джерело

平台设备维护:监控主机新增 代码提交

jingyuanchao 11 місяців тому
батько
коміт
64be6fe224

+ 10 - 0
src/api/iot/deviceInfo.js

@@ -28,3 +28,13 @@ export function getProductDisplayName(type) {
     method: 'get',
   })
 }
+
+
+// 查询定时任务调度列表
+export function editDvrHostDevice(query) {
+  return request({
+    url: '/iot/deviceInfo/editDvrHostDevice',
+    method: 'post',
+    data: query
+  })
+}

+ 17 - 26
src/views/iot/deviceInfo/dialog.addDvrHost.vue

@@ -22,7 +22,7 @@
             <el-col :span="12">
               <el-form-item prop="iotCode" label="所属主机">
                 <el-select
-                  prop="checkRole"
+                  prop="iotCode"
                   label="检查人员"
                   v-model="formData.iotCode"
                   placeholder="请选择所属主机"
@@ -131,7 +131,7 @@
 
 <script>
 import {mapMutations, mapState} from "vuex";
-import {getProductDisplayName} from "@/api/iot/deviceInfo";
+import {addDvrHostDevice, editDvrHostDevice, getProductDisplayName, updateDvrHostDevice} from "@/api/iot/deviceInfo";
 import KSelect from "@/components/common/userselect.vue";
 import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
 import {addConfig, updateConfig} from "@/api/system/config";
@@ -185,6 +185,8 @@ export default {
     reset(other = {}) {
       return {
         id: null,
+        orgId: null,
+        iotCode: null,
         deviceName: null,
         deviceProduct: null,
         serverIp: "",
@@ -202,21 +204,15 @@ export default {
       }
 
     },
-    async show(id, orgId, name,other = {}) {
-      if (id) {
-        this.title = '编辑' + name;
-        this.formData = await this.refresh(id);
-      } else {
-        this.formData.orgId = orgId;
-        console.log("this.formData.orgId",this.formData.orgId)
-        this.title = '新增' + name;
-        this.initData();
-        this.formData = this.reset(other);
-      }
-      this.isShow = true;
+    async show(orgId, name, other = {}) {
+      this.formData = this.reset(other);
+      this.formData.orgId = orgId;
+      this.title = '新增' + name;
+      this.initData();
       this.$nextTick(() => {
         this.$refs.form.clearValidate(); // 确保在 DOM 更新之后清除表单验证状态
       });
+      this.isShow = true;
     },
 
     // 事件
@@ -230,19 +226,14 @@ export default {
     async onSubmit() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          if (this.formData.id != undefined) {
-            updateConfig(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addConfig(this.form).then(response => {
+          editDvrHostDevice(this.formData).then(r => {
+            if (!this.formData.id) {
               this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
+            } else {
+              this.$modal.msgSuccess("修改成功");
+            }
+            this.onHide();
+          })
         }
       });
     },

+ 1 - 1
src/views/iot/deviceInfo/index.vue

@@ -383,7 +383,7 @@ export default {
     },
     addHost(other = {}){
       if (this.activeName=='dvs'){
-        this.$refs.addDvrHostDialog.show(null,this.queryParams.orgId,'监控主机',other = {});
+        this.$refs.addDvrHostDialog.show(this.queryParams.orgId,'监控主机',other = {});
       }
 
     }