haojianlong 5 роки тому
батько
коміт
ffd5285b9d
1 змінених файлів з 20 додано та 107 видалено
  1. 20 107
      src/components/point/dynamicdata/delRelationDialog.vue

+ 20 - 107
src/components/point/dynamicdata/delRelationDialog.vue

@@ -6,7 +6,8 @@
         <div style="margin:10px 0;">有多个设备标识对应了该设备实例,是否一并清除对应关系?</div>
         <el-row class="bgf5">
           <el-col :span="18">
-            <el-table :data="ltableData" style="width: 100%;max-height:400px;" height="calc(100% - 160px)" @selection-change="changeSelection">
+            <el-table :data="ltableData" style="width: 100%;max-height:400px;" height="calc(100% - 160px)" @selection-change="changeSelection"
+              ref="ltable">
               <el-table-column label="设备标识" align="right" class-name="bgfff">
                 <el-table-column label="数据源" prop="Datasource" align="right" class-name="bgfff" show-overflow-tooltip></el-table-column>
                 <el-table-column label="位置标签" prop="LocationFlag" align="right" class-name="bgfff" show-overflow-tooltip>
@@ -35,7 +36,8 @@
             <div class="pr-10 font-default tr">{{ltableData[0].Datasource}}</div>
           </el-col>
           <el-col :span="18">
-            <el-table :data="rtableData" style="width: 100%;max-height:400px;" height="calc(100% - 160px)" @selection-change="changeSelection">
+            <el-table :data="rtableData" style="width: 100%;max-height:400px;" height="calc(100% - 160px)" @selection-change="changeSelection"
+              ref="rtable">
               <el-table-column label="设备实例" class-name="bgfff">
                 <el-table-column type="selection" class-name="bgf5"></el-table-column>
                 <el-table-column label="设备实例名称" prop="EquipLocalName" class-name="bgf5" show-overflow-tooltip></el-table-column>
@@ -73,113 +75,9 @@ export default {
     //弹窗显示
     showDialog(row) {
       this.loading = true;
+      this.dialogVisible = true;
       //需先用对象请求接口返回所需对象
-      console.log(row);
-      let param = [];
-      let o1 = {
-        ObjectID: row.ObjectID,
-        TypeName: row.TypeName
-      };
-      let o2 = {
-        EquipmentMark: row.EquipmentMark,
-        SubTypeCode: row.SubTypeCode
-      };
-      let Objs = [];
-      let Points = [];
-      Objs.push(o1);
-      Points.push(o2);
-      let object = {
-        Objs: Objs,
-        Points: Points
-      };
-      param.push(object);
-      this.param = param;
-      setTimeout(() => {
-        this.loading = false;
-      }, 800);
-      let res = [
-        {
-          Objs: [
-            {
-              BuildLocalName: "南主楼",
-              EquipLocalName: "路演休闲大厅风机盘管",
-              FloorLocalName: "F3",
-              ObjectID: "dd825b8d300811e98edb056b3a4c3ca8",
-              ProjectId: "Pj1101020006",
-              RoomLocalName: "路演休闲大厅 42",
-              SpaceType: "默认分区",
-              SubTypeCode: "ATFC",
-              SubTypeName: "ATFC",
-              TypeCode: "Eq",
-              TypeName: "设备"
-            }
-            // {
-            //   BuildLocalName: "南主楼",
-            //   EquipLocalName: "路演休闲大厅3333风机盘管",
-            //   FloorLocalName: "F3",
-            //   ObjectID: "dd825b8d300811e98edb056b3a4c3cau",
-            //   ProjectId: "Pj1101020006",
-            //   RoomLocalName: "路演休闲大厅 42",
-            //   SpaceType: "默认分区",
-            //   SubTypeCode: "ATFC",
-            //   SubTypeName: "ATFC",
-            //   TypeCode: "Eq",
-            //   TypeName: "设备"
-            // }
-          ],
-          Points: [
-            {
-              Datasource: "2112",
-              EquipmentMark: "1",
-              LocationFlag: ["俄1231232"],
-              ProjectId: "Pj1101020006",
-              SubTypeCode: "SISU",
-              SubTypeName: "喷灌机组",
-              TypeCode: "Eq",
-              TypeName: "设备"
-            }
-            // {
-            //   Datasource: "2112",
-            //   EquipmentMark: "2",
-            //   LocationFlag: ["俄1231232"],
-            //   ProjectId: "Pj1101020006",
-            //   SubTypeCode: "SISU",
-            //   SubTypeName: "喷灌机组",
-            //   TypeCode: "Eq",
-            //   TypeName: "设备"
-            // },
-            // {
-            //   Datasource: "2112",
-            //   EquipmentMark: "3",
-            //   LocationFlag: ["俄1231232"],
-            //   ProjectId: "Pj1101020006",
-            //   SubTypeCode: "SISU",
-            //   SubTypeName: "喷灌机组",
-            //   TypeCode: "Eq",
-            //   TypeName: "设备"
-            // },
-            // {
-            //   Datasource: "2112",
-            //   EquipmentMark: "5",
-            //   LocationFlag: ["俄1231232"],
-            //   ProjectId: "Pj1101020006",
-            //   SubTypeCode: "SISU",
-            //   SubTypeName: "喷灌机组",
-            //   TypeCode: "Eq",
-            //   TypeName: "设备"
-            // }
-          ]
-        }
-      ];
-      this.ltableData = res[0].Points;
-      this.rtableData = res[0].Objs;
-      // objs->实例 point-实例标识
-      if (res[0].Objs.length > 1 || res[0].Points.length > 1) {
-        this.dialogWidth = "60%";
-      }
       this.getDynamicQueryPrompt(row)
-      console.log(this.ltableData);
-      this.dialogVisible = true;
     },
     handleClick() { },
     handleClose(done) {
@@ -223,7 +121,22 @@ export default {
       })
       Promise.all([promise1, promise2]).then(res => {
         console.log(res)
+        this.ltableData = res[1].Content
+        this.rtableData = res[0].Content
+        if (this.ltableData.length > 1 || this.rtableData.length > 1) {
+          this.dialogWidth = "60%";
+        }
+        this.$nextTick(() => {
+          this.toggleSelection(row);
+        })
+        this.loading = false;
       })
+    },
+    //设置默认选中
+    toggleSelection(row) {
+      console.log(row)
+      this.ltableData.length > this.rtableData.length ?
+        this.$refs.ltable.toggleRowSelection(row) : this.$refs.rtable.toggleRowSelection(row)
     }
   },
   mounted() { },