Ver código fonte

modify link system dialog

haojianlong 5 anos atrás
pai
commit
86975f62de

+ 11 - 29
src/components/dialogs/list/systemType.vue

@@ -78,7 +78,6 @@ export default {
       type: String,
       default: "read"
     },
-    //默认值
     list: {
       type: [Array]
     }
@@ -90,7 +89,6 @@ export default {
       systemList: [],
       allData: [],
       multipleSelection: [],
-      changeData: [],
       iframeSrc: "",
       iframeShow: false,
       buildId: 'all', //查询条件
@@ -153,43 +151,27 @@ export default {
     },
     handleSelectionChange(val) {
       this.multipleSelection = val;
-      if (this.changeData.length) {
-        this.multipleSelection = this.changeData
-        this.changeData = []
-      }
     },
-
     //设置默认
     toggleSelection(rows) {
-      if (rows) {
-        rows.forEach(row => {
-          this.$refs.multipleTable.toggleRowSelection(row);
-        });
-      } else {
-        this.$refs.multipleTable.clearSelection();
+      this.$refs.multipleTable.clearSelection();
+      if (rows.length&&this.list.length) {
+        rows.map(row => {
+          this.list.map(t => {
+            if(row.SysID == t.SysID){
+              this.$refs.multipleTable.toggleRowSelection(row)
+            }
+          })
+        })
       }
     },
-
+    //确认
     getChange() {
       this.createRelatSys()
       this.$emit("change", this.multipleSelection)
       this.dialog.systemType = false
       this.multipleSelection = []
     },
-
-    //设置默认选中项
-    getSelected(list, all) {
-      let map = []
-      if (all && all.length && list && list.length) {
-        all.map((item, index) => {
-          list.map(child => {
-            if (item.id == child.id) {
-              this.$refs.multipleTable.toggleRowSelection(item)
-            }
-          })
-        })
-      }
-    },
     //点击详情
     lookDeatils(infos) {
       this.iframeSrc =
@@ -224,7 +206,7 @@ export default {
       queryLinkSys(param, res => {
         this.allData = res.Content
         this.tableData = res.Content
-        this.multipleSelection = []
+        this.toggleSelection(res.Content)
       })
     },
     //添加设备关联系统关系

+ 2 - 1
src/components/ledger/handsontables/device.vue

@@ -54,7 +54,7 @@
     </div>
     <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
     <!-- 关联的系统 -->
-    <system-type :device="mess" :curDevice="curDevice" :dialog="myDialog" :type="onlyRead?'read':'edit'" @change="changeSystemType"></system-type>
+    <system-type :device="mess" :curDevice="curDevice" :dialog="myDialog" :type="onlyRead?'read':'edit'" @change="changeSystemType" :list="systemList"></system-type>
     <!-- 关联资产 -->
     <change-rea @changeProperty="changeProperty" :dialog="myDialog" :category="deviceType"></change-rea>
     <look-pic :dialog="myDialog" :keysArr="picsArr"></look-pic>
@@ -178,6 +178,7 @@ export default {
       messKey: null,
       imgsArr: [], //临时保存的图片key数组
       picsArr: [], //临时设备图片keys数组
+      systemList:[], //关联的系统
       copyMain: null,
       graphyId: null,
       assetGroupList: [],

+ 2 - 1
src/views/ledger/facility/addfacility.vue

@@ -43,7 +43,7 @@
     <maintainer-dialog @changeMaintainer="changeMaintainer" ref="maintainer" :dialog="myDialog"></maintainer-dialog>
     <insurer-dialog @changeInsurer="changeInsurer" ref="insurer" :dialog="myDialog"></insurer-dialog>
     <pic-dialog :read="onlyRead ? true : false" :dialog="myDialog" :keysArr="picsArr" @change="changePics"></pic-dialog>
-    <system-type :device="category" :dialog="myDialog" :type="onlyRead?'read':'edit'" @change="changeSystemType"></system-type>
+    <system-type :device="category" :dialog="myDialog" :type="onlyRead?'read':'edit'" @change="changeSystemType" :list="systemList"></system-type>
     <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
   </div>
 </template>
@@ -125,6 +125,7 @@ export default {
       filesArr: [], //保存临时的文件key
       imgsArr: [], //临时保存的图片key数组
       picsArr: [], //临时设备图片keys数组
+      systemList:[], //关联的系统
       systemId: null,
       graphyId: null,
       id: 0,