Browse Source

opc配置

408249787 2 years ago
parent
commit
00ce7b26af
2 changed files with 19 additions and 10 deletions
  1. 13 8
      src/views/opc/OpcInfo.vue
  2. 6 2
      src/views/opc/modules/BaseChartInfo.vue

+ 13 - 8
src/views/opc/OpcInfo.vue

@@ -21,9 +21,9 @@
         @dragstop="resize">
         <a-tooltip>
           <template slot="title">
-            {{ item.positionNum }}
+            {{ item.result }}
           </template>
-          <div class="info" @click="handleInfo(item)"> {{ item.positionNum }}</div>
+          <div class="info" @click="handleInfo(item)"> {{ item.result }}</div>
         </a-tooltip>
       </VueDragResize>
     </div>
@@ -44,12 +44,12 @@
           :showSearch="true"
           v-model="positionId"
           placeholder="请选择"
+          @change="getOpcInfo"
         >
         </a-tree-select>
-        <a-button type="primary" @click="getOpcInfo">搜索</a-button>
       </div>
       <br>
-      <a-table
+      <!-- <a-table
         :columns="columns"
         :data-source="dotList"
         :pagination="{ pageSize: 100 }"
@@ -60,7 +60,7 @@
           <a-button style="color:#ccc" v-show="record.positionFlag" type="link" icon="eye-invisible" @click="handleShow(index,0)" />
           <a-button v-show="!record.positionFlag" type="link" icon="eye" @click="handleShow(index,1)" />
         </span>
-      </a-table>
+      </a-table> -->
     </a-drawer>
     <BaseChartInfo ref="baseChartInfo" @ok="handleOk"/>
   </div>
@@ -86,6 +86,7 @@ export default {
       optDot: null,
       imgUrl: '',
       dotList: [],
+      timer: null,
       columns: [
         {
           title: '位号',
@@ -103,7 +104,13 @@ export default {
   created () {
     this.positionId = this.$route.query.line
     this.setTree()
-    this.getOpcInfo()
+    this.timer = setInterval(() => {
+      console.log(this.positionId)
+      this.getOpcInfo()
+    }, 5000)
+  },
+  destroyed () {
+    clearInterval(this.timer)
   },
   methods: {
     resize (newRect) {
@@ -135,11 +142,9 @@ export default {
     getOpcInfo () {
       fetchSbPosition({ id: this.positionId }).then(res => {
         this.imgUrl = res.data.opcImg
-        console.log(this.imgUrl)
       })
       queryRemoteOpc({ line: this.positionId })
         .then((res) => {
-          console.log(res.data)
           this.dotList = res.data
           this.dotList.forEach(item => {
             item.isActive = false

+ 6 - 2
src/views/opc/modules/BaseChartInfo.vue

@@ -21,7 +21,7 @@
               </a-col>
               <a-col :span="10">
                 <a-form-item label="时间跨度" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-                  <a-select default-value="1" v-model="queryParam.searchType" style="width: 120px">
+                  <a-select v-model="queryParam.searchType" style="width: 120px">
                     <a-select-option value="1">
                       10分钟
                     </a-select-option>
@@ -63,7 +63,9 @@ export default {
       form: this.$form.createForm(this),
       visible: false,
       confirmLoading: false,
-      queryParam: {},
+      queryParam: {
+        searchType: '1'
+      },
       remoteOpc: null,
       positionNum: null,
       chart1: null,
@@ -90,6 +92,8 @@ export default {
     base (remoteOpc) {
       this.visible = true
       this.remoteOpc = remoteOpc
+      this.queryParam.createdTimeEnd = this.BaseTool.Date.formatter(new Date(), this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+      this.getInfo()
       /* this.$nextTick(() => {
         this.createChart(this.dataList)
       }) */