liu xiaoping 1 éve
szülő
commit
58a9ab35d3

+ 9 - 0
src/api/Workshop/index.js

@@ -7,6 +7,7 @@ import request from '@/utils/request'
 const WorkshopApi = {
   workshop: '/workshop',
   findAll: '/workshop/findAll',
+  findByAcquisitionStationId: '/workshop/findByAcquisitionStationId',
 }
 
 export function findAll(parameter) {
@@ -16,3 +17,11 @@ export function findAll(parameter) {
     params: parameter
   })
 }
+
+export function findByAcquisitionStationId(parameter) {
+  return request({
+    url: WorkshopApi.findByAcquisitionStationId,
+    method: 'get',
+    params: parameter
+  })
+}

+ 42 - 36
src/components/DataModal/common/RealtimeLine.vue

@@ -17,16 +17,17 @@
 </template>
 
 <script>
-import { historyChartAllData } from '@/api/HistoryData'
-import { findAll } from '@/api/Workshop'
-import { findLayout, findYMax } from '@/api/DashboardLayout'
+import {historyChartAllData} from '@/api/HistoryData'
+import {findByAcquisitionStationId} from '@/api/Workshop'
+import {findYMax} from '@/api/DashboardLayout'
 import moment from 'moment'
-import { mapState } from 'vuex'
+import {mapState} from 'vuex'
 
 const codeMap = {
   ELECTRIC: '电流',
   VIBRATION: '振动',
-  NOISE: '噪声'
+  NOISE: '噪声',
+  FEEDBACK: '反馈'
 }
 
 export default {
@@ -40,8 +41,6 @@ export default {
       chartList: {},
       initCompleted: false,
       canUpdate: true,
-      x: 3,
-      y: 3,
       yMaxMap: {},
     }
   },
@@ -49,7 +48,9 @@ export default {
     ...mapState({
       realtimeDataMap: (state, getter) => state.queue.realtimeDataMap,
       lastTime: (state, getter) => state.queue.lastTime,
-      acquisitionStationId: state => state.company.acquisitionStationId,
+      acquisitionStation: state => state.company.acquisitionStation,
+      x: state => state.company.acquisitionStation.xQuantity,
+      y: state => state.company.acquisitionStation.yQuantity,
     }),
     chartBoxStyle() {
       const baseX = this.x === 1 ? 99 : 90
@@ -218,12 +219,6 @@ export default {
   methods: {
     async initData() {
       this.initCompleted = false
-      await findLayout().then(layOutRes => {
-        if (layOutRes && layOutRes.code === '200') {
-          this.x = layOutRes.data.xQuantity
-          this.y = layOutRes.data.yQuantity
-        }
-      })
       await findYMax().then(res => {
         if (res && res.code === '200') {
           const yMaxMap = {}
@@ -233,23 +228,30 @@ export default {
           this.yMaxMap = yMaxMap
         }
       })
-      await findAll({ acquisitionStationId: this.acquisitionStationId }).then(res => {
+      await findByAcquisitionStationId({ acquisitionStationId: this.acquisitionStation.id }).then(res => {
         if (res && res.code === '200') {
           const obj = {}
+          const arrNotTags = []
           res.data.forEach((val, index) => {
-            obj[val.workshopCode] = val
+            if (val.tagList && val.tagList.length > 0) {
+              obj[val.workshopCode] = val
+            } else {
+              arrNotTags.push(val)
+            }
           })
           this.workshopList = obj
+          for (const item of arrNotTags) {
+            this.$message.warning(item.workshopName + '未配置标签或者标签未启用!!!')
+          }
         }
       })
-
     },
     async fetchData() {
       const params = {
         start: moment().subtract(5, 'minutes').valueOf(),
         end: moment().valueOf(),
         step: 2,
-        acquisitionStationId: this.acquisitionStationId
+        acquisitionStationId: this.acquisitionStation.id
       }
       await historyChartAllData(params).then(res => {
         if (res && res.code === '200') {
@@ -282,8 +284,10 @@ export default {
           return colors[1]
         case '噪声':
           return colors[2]
-        default:
+        case '反馈':
           return colors[3]
+        default:
+          return colors[4]
       }
     },
     getLegendName(name) {
@@ -301,24 +305,26 @@ export default {
     },
     updateChart() {
       this.canUpdate = false
-      try {
-        this.timeList.push(this.lastTime)
-        this.timeList.shift()
-        for (const key in this.chartList) {
-          const opt = {
-            xAxis: {
-              data: this.timeList
-            },
-            series: []
-          }
-          for (const e of this.workshopList[key].tagList) {
-            this.chartData[e.code].shift()
-            this.chartData[e.code].push(this.realtimeDataMap[e.code])
-            const data = this.chartData[e.code]
-            opt.series.push({ data })
-          }
-          this.chartList[key].setOption(opt)
+
+      this.timeList.push(this.lastTime)
+      this.timeList.shift()
+      for (const key in this.chartList) {
+        const opt = {
+          xAxis: {
+            data: this.timeList
+          },
+          series: []
+        }
+        for (const e of this.workshopList[key].tagList) {
+          this.chartData[e.code].shift()
+          this.chartData[e.code].push(this.realtimeDataMap[e.code])
+          const data = this.chartData[e.code]
+          opt.series.push({ data })
         }
+        this.chartList[key].setOption(opt)
+      }
+
+      try {
       } catch (e) {
         console.error(e)
       } finally {

+ 1 - 1
src/components/DataModal/common/RealtimeTable.vue

@@ -162,7 +162,7 @@ export default {
               item[msg.tableColumn] = msg.value
             }
           }
-          item.status = item[item.startType] > item.limitValue
+          item.status = item.FEEDBACK === 1
         }
         this.tableData = tableData
       }

+ 3 - 1
src/components/PositionModal/index.vue

@@ -180,7 +180,9 @@ export default {
   },
   methods: {
     showModal(collectEntityId, collectEntity) {
-      this.collectEntity = collectEntity
+      const filteredCollectEntity = collectEntity
+      filteredCollectEntity.tagList = collectEntity.tagList.filter(e => e.tableColumn !== 'FEEDBACK')
+      this.collectEntity = filteredCollectEntity
       this.collectEntityId = collectEntityId
       this.activeName = 'meterShow'
       this.outerVisible = true

+ 5 - 0
src/store/modules/company.js

@@ -10,6 +10,7 @@ const company = {
     companyName: '',
     factoryName: '',
     acquisitionStationId: null,
+    acquisitionStation: {},
     workshop: '',
   },
 
@@ -17,6 +18,9 @@ const company = {
     SET_ACQUISITION_STATION_ID: (state, payload) => {
       state.acquisitionStationId = payload
     },
+    SET_ACQUISITION_STATION: (state, payload) => {
+      state.acquisitionStation = payload
+    },
     SET_WORKSHOP_NAME: (state, payload) => {
       state.workshop = payload
     },
@@ -36,6 +40,7 @@ const company = {
       })
       findCurrentAcquisitionStation().then(res => {
         commit('SET_ACQUISITION_STATION_ID', res.data.id)
+        commit('SET_ACQUISITION_STATION', res.data)
         commit('SET_WORKSHOP_NAME', res.data.name)
       })
     },

+ 1 - 1
src/utils/request.js

@@ -5,7 +5,7 @@ import qs from 'qs'
 // 创建 axios 实例
 const request = axios.create({
   // API 请求的默认前缀
-  // baseURL: 'http://192.168.1.130:5000/api',
+  // baseURL: 'http://192.168.50.126:5000/api',
   baseURL: 'http://localhost:5000/api',
   // baseURL: 'http://120.48.81.85:15002/api',
   timeout: 3600000, // 请求超时时间

+ 3 - 2
src/views/Data.vue

@@ -125,7 +125,7 @@ export default {
               item[msg.tableColumn] = msg.value
             }
           }
-          item.status = item[item.startType] > item.limitValue
+          item.status = item.FEEDBACK === 1
         }
         return tableDataWrapper
       } else {
@@ -137,7 +137,7 @@ export default {
     },
   },
   methods: {
-    ...mapMutations(['SET_ACQUISITION_STATION_ID', 'SET_WORKSHOP_NAME']),
+    ...mapMutations(['SET_ACQUISITION_STATION_ID', 'SET_ACQUISITION_STATION', 'SET_WORKSHOP_NAME']),
     getPositionArr() {
       const obj = {}
       this.tableData.forEach(e => {
@@ -230,6 +230,7 @@ export default {
       }
       await updateAcquisitionStation(params).then(res => {
         this.getCollectEntity()
+        this.SET_ACQUISITION_STATION(res.data)
         this.SET_WORKSHOP_NAME(res.data.name)
       })
     },

+ 1 - 0
vue.config.js

@@ -143,6 +143,7 @@ const vueConfig = {
       '/api': {
         // target: 'http://192.168.1.130:5000',
         target: 'http://localhost:5000',
+        // target: 'http://192.168.50.126:5000',
         // target: 'http://120.48.81.85:15002',
         pathRewrite: { '^/api': '' },
         secure: false,