|
@@ -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 {
|