hfxc226 пре 2 година
родитељ
комит
459a8f7e4b

+ 32 - 11
src/views/opc/Opc.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="main" @click.ctrl="handleClickAdd">
     <img :src="imgUrl" width="1920px" alt="">
-    <div class="icon" style="right:20px">
+    <!--    <div class="icon" style="right:20px">
       <a-button type="primary" icon="appstore" size="large" @click="visibleRight=true" />
-    </div>
+    </div>-->
     <div v-if="dotList !=null && dotList.length>0">
       <div v-for="item in dotList" :key="item.id">
         <VueDragResize
@@ -50,7 +50,7 @@
         </VueDragResize>
       </div>
     </div>
-    <a-drawer
+    <!--    <a-drawer
       title="点位配置"
       placement="right"
       :closable="false"
@@ -85,7 +85,12 @@
           <a-button v-show="!record.positionFlag" type="link" icon="eye" @click="handleShow(record,1)" />
         </span>
       </a-table>
-    </a-drawer>
+    </a-drawer>-->
+    <div>
+      <a-button-group>
+        <a-button v-for="item in list" :key="item.id" :disabled="positionId===item.id" @click="getOpcInfo(item.id)">{{ item.name }}</a-button>
+      </a-button-group>
+    </div>
     <BaseChartInfo ref="baseChartInfo" @ok="handleOk"/>
     <BaseForm ref="baseForm" @ok="handleOk"/>
 
@@ -94,7 +99,7 @@
 
 <script>
 import VueDragResize from 'vue-drag-resize'
-import { getSbPositionTree, fetchSbPosition } from '@/api/sb/position'
+import { getSbPositionTree, fetchSbPosition, querySbPosition } from '@/api/sb/position'
 import { queryRemoteOpc, updateRemoteOpc } from '@/api/remote/opc'
 import BaseChartInfo from './modules/BaseChartInfo.vue'
 import BaseForm from '@/views/remote/opc/modules/BaseForm.vue'
@@ -104,14 +109,17 @@ export default {
     VueDragResize,
     BaseChartInfo,
     BaseForm
-
   },
   data () {
     return {
       visibleRight: false,
+      parentId: '',
       positionId: '',
       treeData: [],
+      list: [],
+      visible: false,
       optDot: null,
+      positionName: '',
       imgUrl: '',
       dotList: [],
       columns: [
@@ -129,11 +137,10 @@ export default {
     }
   },
   created () {
+    this.parentId = this.$route.query.parentId
     this.positionId = this.$route.query.line
     this.setTree()
-    if (this.positionId || this.positionId !== '') {
-      this.getOpcInfo()
-    }
+    this.getOpcInfo(this.positionId)
   },
   methods: {
     resize (newRect) {
@@ -181,9 +188,11 @@ export default {
     handleShow (val, key) {
       val.positionFlag = key
     },
-    getOpcInfo () {
+    getOpcInfo (positionId) {
+      this.positionId = positionId
       fetchSbPosition({ id: this.positionId }).then(res => {
         this.imgUrl = res.data.opcImg
+        this.positionName = res.data.name
         console.log(this.imgUrl)
       })
       queryRemoteOpc({ line: this.positionId })
@@ -195,6 +204,9 @@ export default {
         })
     },
     setTree (record = {}) {
+      querySbPosition({ parentId: this.parentId }).then(res => {
+        this.list = res.data
+      })
       getSbPositionTree({ opcFlag: 1 }).then(res => {
         this.treeData = res.data
       })
@@ -222,8 +234,17 @@ export default {
         imgYposition: e.y + 50
       })
     },
+    afterVisibleChange (val) {
+      console.log('visible', val)
+    },
+    showDrawer () {
+      this.visible = true
+    },
+    onClose () {
+      this.visible = false
+    },
     handleOk () {
-      this.getOpcInfo()
+      this.getOpcInfo(this.positionId)
     }
   }
 }

+ 21 - 9
src/views/opc/OpcInfo.vue

@@ -53,7 +53,7 @@
         </VueDragResize>
       </div>
     </div>
-    <a-drawer
+    <!-- <a-drawer
       title="点位列表"
       placement="right"
       :closable="false"
@@ -75,7 +75,7 @@
         </a-tree-select>
       </div>
       <br>
-      <!-- <a-table
+      <a-table
         :columns="columns"
         :data-source="dotList"
         :pagination="{ pageSize: 100 }"
@@ -86,8 +86,13 @@
           <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-drawer>
+      </a-table>
+    </a-drawer> -->
+    <div>
+      <a-button-group>
+        <a-button v-for="item in list" :key="item.id" :disabled="positionId===item.id" @click="getOpcInfo(item.id)">{{ item.name }}</a-button>
+      </a-button-group>
+    </div>
     <BaseChartInfo ref="baseChartInfo" @ok="handleOk"/>
     <detail ref="detailModal" @ok="handleOk" />
 
@@ -96,7 +101,7 @@
 
 <script>
 import VueDragResize from 'vue-drag-resize'
-import { getSbPositionTree, fetchSbPosition } from '@/api/sb/position'
+import { getSbPositionTree, fetchSbPosition, querySbPosition } from '@/api/sb/position'
 import { queryRemoteOpc, updateRemoteOpc,
   fetchRemoteOpc
 } from '@/api/remote/opc'
@@ -114,6 +119,8 @@ export default {
       visibleRight: false,
       positionId: '',
       treeData: [],
+      parentId: '',
+      list: [],
       optDot: null,
       imgUrl: '',
       dotList: [],
@@ -133,14 +140,17 @@ export default {
     }
   },
   created () {
+    this.parentId = this.$route.query.parentId
     this.positionId = this.$route.query.line
+    querySbPosition({ parentId: this.parentId }).then(res => {
+      this.list = res.data
+    })
     this.getImg()
     getSbPositionTree({ opcFlag: 1 }).then(res => {
       this.treeData = res.data
     })
     this.timer = setInterval(() => {
-      console.log(this.positionId)
-      this.getOpcInfo()
+      this.getOpcInfo(this.positionId)
     }, 5000)
   },
   destroyed () {
@@ -173,7 +183,8 @@ export default {
     handleShow (val, key) {
       this.dotList[val].positionFlag = key
     },
-    getOpcInfo () {
+    getOpcInfo (positionId) {
+      this.positionId = positionId
       queryRemoteOpc({ line: this.positionId })
         .then((res) => {
           this.dotList = res.data
@@ -181,6 +192,7 @@ export default {
             item.isActive = false
           })
         })
+      this.getImg()
     },
     getImg () {
       fetchSbPosition({ id: this.positionId }).then(res => {
@@ -188,7 +200,7 @@ export default {
       })
     },
     handleChange () {
-      this.getOpcInfo()
+      this.getOpcInfo(this.positionId)
       this.getImg()
     },
     handleInfo (remoteOpc) {

+ 1 - 1
src/views/remote/opc-log/RemoteOpcLog.vue

@@ -206,7 +206,7 @@ export default {
           ...this.queryParam,
           dataScope: {
             sortBy: 'desc',
-            sortName: 'update_time'
+            sortName: 'created_time'
           }
         }
         return getRemoteOpcLogPage(Object.assign(parameter, this.queryParam))

+ 35 - 8
src/views/remote/opc/OpcPosition.vue

@@ -1,17 +1,44 @@
 <template>
-  <SbPosition :opc-flag="1"/>
+  <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
+    <h1 style="margin:20px auto; text-align: center"> DCS车间-数据展示 </h1>
+    <a-card v-for="position in treeData" :key="position.key" :title="position.title">
+      <a-card-grid v-for="child in position.children" :key="child.key" style="cursor: pointer;width:25%;text-align:center" @click="showScreen(child, position.key)">
+        {{ child.title }}
+      </a-card-grid>
+    </a-card>
+  </a-card>
 </template>
 
 <script>
-import SbPosition from '@/views/sb/position/SbPosition'
+
+import { getSbPositionTree } from '@/api/sb/position'
+
 export default {
-  name: 'OpcPositionNot',
+  name: 'OpcPosition',
   components: {
-    SbPosition
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      treeData: [],
+      visible: true
+    }
+  },
+  props: {
+  },
+  created () {
+    getSbPositionTree({ opcFlag: 1 }).then(res => {
+      this.treeData = res.data
+    })
+  },
+  methods: {
+    showScreen (position, parentId) {
+      const a = document.createElement('a')
+      a.href = '/opc?line=' + position.key + '&parentId=' + parentId
+      a.target = '_blank'
+      a.click()
+    }
   }
 }
 </script>
-
-<style scoped>
-
-</style>

+ 4 - 4
src/views/remote/opc/OpcPositionForProducer.vue

@@ -1,8 +1,8 @@
 <template>
   <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
-    <h1 style="margin:20px auto; text-align: center"> DCS展示车间 </h1>
+    <h1 style="margin:20px auto; text-align: center"> DCS车间-数据展示 </h1>
     <a-card v-for="position in treeData" :key="position.key" :title="position.title">
-      <a-card-grid v-for="child in position.children" :key="child.key" style="cursor: pointer;width:25%;text-align:center" @click="showScreen(child)">
+      <a-card-grid v-for="child in position.children" :key="child.key" style="cursor: pointer;width:25%;text-align:center" @click="showScreen(child, position.key)">
         {{ child.title }}
       </a-card-grid>
     </a-card>
@@ -33,9 +33,9 @@ export default {
     })
   },
   methods: {
-    showScreen (position) {
+    showScreen (position, parentId) {
       const a = document.createElement('a')
-      a.href = '/opc/info?line=' + position.key
+      a.href = '/opc/info?line=' + position.key + '&parentId=' + parentId
       a.target = '_blank'
       a.click()
     }