408249787 2 سال پیش
والد
کامیت
5cb1022559
1فایلهای تغییر یافته به همراه10 افزوده شده و 6 حذف شده
  1. 10 6
      src/views/opc/OpcInfo.vue

+ 10 - 6
src/views/opc/OpcInfo.vue

@@ -44,7 +44,7 @@
           :showSearch="true"
           v-model="positionId"
           placeholder="请选择"
-          @change="getOpcInfo"
+          @change="handleChange"
         >
         </a-tree-select>
       </div>
@@ -102,7 +102,10 @@ export default {
   },
   created () {
     this.positionId = this.$route.query.line
-    this.setTree()
+    this.getImg()
+    getSbPositionTree({ opcFlag: 1 }).then(res => {
+      this.treeData = res.data
+    })
     this.timer = setInterval(() => {
       console.log(this.positionId)
       this.getOpcInfo()
@@ -147,13 +150,14 @@ export default {
           })
         })
     },
-    setTree (record = {}) {
+    getImg () {
       fetchSbPosition({ id: this.positionId }).then(res => {
         this.imgUrl = res.data.opcImg
       })
-      getSbPositionTree({ opcFlag: 1 }).then(res => {
-        this.treeData = res.data
-      })
+    },
+    handleChange () {
+      this.getOpcInfo()
+      this.getImg()
     },
     handleInfo (remoteOpc) {
       const model = this.$refs.baseChartInfo