Browse Source

add tools linkEquiplocalName

haojianlong 5 years ago
parent
commit
501d559a8b

+ 1 - 1
src/components/dialogs/changeRea.vue

@@ -32,7 +32,7 @@
             </el-table-column>
             <el-table-column label="安装位置">
               <template slot-scope="scope">
-                {{scope.row.LedgerParam.Siteinstall?scope.row.LedgerParam.Siteinstall.InstallLocation:"--"}}
+                {{scope.row.LedgerParam?scope.row.LedgerParam.Siteinstall?scope.row.LedgerParam.Siteinstall.InstallLocation:"--":"--"}}
               </template>
             </el-table-column>
           </el-table>

+ 15 - 4
src/components/dialogs/list/systemType.vue

@@ -9,7 +9,7 @@
           <el-row>
             <el-col :span="10">
               <span>系统所属建筑</span>
-              <el-select v-model="buildId" placeholder="请选择">
+              <el-select v-model="buildId" placeholder="请选择" @change="getTableData">
                 <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                 </el-option>
               </el-select>
@@ -50,7 +50,7 @@
 </template>
 <script>
 import myPagination from "@/components/ledger/lib/myPagination";
-import { queryLinkSys, getSpaceFloor } from "@/api/scan/request"
+import { queryLinkSys, getSpaceFloor, equipLinkSys } from "@/api/scan/request"
 import tools from "@/utils/scan/tools"
 import { mapGetters } from 'vuex'
 export default {
@@ -71,6 +71,7 @@ export default {
       default: ""
     },
     device: {},
+    curDevice:'',//设备id
     type: {
       type: String,
       default: "read"
@@ -168,6 +169,7 @@ export default {
     },
 
     getChange() {
+      this.createRelatSys()
       if (this.multipleSelection.length >= 2) {
         this.$confirm("确定关联多个系统?").then(_ => {
           this.$emit("change", this.multipleSelection)
@@ -193,7 +195,6 @@ export default {
         })
       }
     },
-
     //点击详情
     lookDeatils(infos) {
       this.iframeSrc =
@@ -208,7 +209,6 @@ export default {
         infos.category.substring(2, 4);
       this.iframeShow = true;
     },
-
     //根据设备类型-查询系统关联专业
     getTableData() {
       let param = {
@@ -230,6 +230,17 @@ export default {
         this.allData = res.Content
         this.tableData = res.Content
       })
+    },
+    //添加设备关联系统关系
+    createRelatSys(){
+      let param = {
+        EquipId:this.curDevice,
+        SysIdList:[]
+      }
+      this.multipleSelection.map(t => {
+        param.SysIdList.push(t.SysID)
+      })
+      equipLinkSys(param, res => {})
     }
   },
   watch: {

+ 13 - 7
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" :dialog="myDialog" :type="onlyRead?'read':'edit'" @change="changeSystemType"></system-type>
+    <system-type :device="mess" :curDevice="curDevice" :dialog="myDialog" :type="onlyRead?'read':'edit'" @change="changeSystemType"></system-type>
     <!-- 关联资产 -->
     <change-rea @changeProperty="changeProperty" :dialog="myDialog" :category="deviceType"></change-rea>
     <look-pic :dialog="myDialog" :keysArr="picsArr"></look-pic>
@@ -192,16 +192,17 @@ export default {
       qrcodeUrl: "", //二维码图片地址
       loading: false,
       deviceType: {}, //族3位编码及名称
-      floorData: []
+      floorData: [],
+      curDevice:'',//当前点击的设备id
     };
   },
   created() { },
   computed: {
     ...mapGetters("layout", ["projectId", "secret", "userId"]),
-    showTypes () {
-      return this.onlyRead?
-        [{value: "all", label: '全部'}, {value: "Visible", label: '只看要采集的信息'}]: 
-        [{value: "all", label: '全部'}, {value: "Visible", label: '只看要采集的信息'}, {value: "partInfo", label: '隐藏自动填充的信息点'}]
+    showTypes() {
+      return this.onlyRead ?
+        [{ value: "all", label: '全部' }, { value: "Visible", label: '只看要采集的信息' }] :
+        [{ value: "all", label: '全部' }, { value: "Visible", label: '只看要采集的信息' }, { value: "partInfo", label: '隐藏自动填充的信息点' }]
     }
   },
   methods: {
@@ -261,6 +262,9 @@ export default {
             _this.hot = null;
           }
           if (res.Content && res.Content.length) {
+            if (this.onlyRead) {
+              this.getBatch(res.Content)
+            }
             _this.initTable();
           }
         })
@@ -392,7 +396,8 @@ export default {
         },
         {
           data: "LinkEquipLocalName",
-          readOnly: true
+          readOnly: true,
+          renderer: tools.LinkEquipLocalName
         }, {
           data: "linkSystem",
           renderer: text.systemList,
@@ -596,6 +601,7 @@ export default {
         //关联系统
         case 'linkSystem':
           if (!this.onlyRead) {
+            this.curDevice = infos.EquipID;
             this.systemList = this.tableData[row.row].LinkSystem || [];
             this.myDialog.systemType = true;
           }

+ 10 - 0
src/utils/scan/tools.js

@@ -309,6 +309,16 @@ tools.hasRelation = function(instance, td, row, col, prop, value, cellProperties
     return td;
 }
 
+//关联的资产
+tools.LinkEquipLocalName = function(instance, td, row, col, prop, value, cellProperties) {
+    if (value) {
+        td.innerHTML = value;
+    } else {
+        td.innerHTML = instance.getDataAtRowProp(row,'LinkEquipName');
+    }
+    return td;
+}
+
 tools.num = function(instance, td, row, col, prop, value, cellProperties) {
     td.style.color = "#409EFF";
     td.style.cursor = "pointer";