|
@@ -1,6 +1,22 @@
|
|
|
<template>
|
|
|
<div class="realtime-data">
|
|
|
- <navigation-name :msg="companyName" show-time show-other/>
|
|
|
+ <navigation-name :msg="companyName" show-time show-other>
|
|
|
+ <div style="margin-left: 20px;">
|
|
|
+ <el-select
|
|
|
+ v-model="acquisitionStationId"
|
|
|
+ popper-class="jg-select"
|
|
|
+ :popper-append-to-body="false"
|
|
|
+ placeholder="采集站数据"
|
|
|
+ @change="changeAcquisitionStation"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in acquisitionStationList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"/>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </navigation-name>
|
|
|
<div style="font-weight: bolder;font-size: 30px;padding-top: 16px;text-align: center">
|
|
|
{{ factoryName }}
|
|
|
<!--数据显示-->
|
|
@@ -65,6 +81,7 @@ import PositionModal from '@/components/PositionModal'
|
|
|
import { mapState, mapMutations } from 'vuex'
|
|
|
import { findCollectEntityInfo } from '@/api/CollectEntity'
|
|
|
import { findColumnsByTableName } from '@/api/TableConfig'
|
|
|
+import { findAll, findCurrentAcquisitionStation, updateAcquisitionStation } from '@/api/AcquisitionStation'
|
|
|
|
|
|
export default {
|
|
|
name: 'Data',
|
|
@@ -76,23 +93,12 @@ export default {
|
|
|
return {
|
|
|
tableColumns: [],
|
|
|
tableDataWrapper: [],
|
|
|
- timer: null,
|
|
|
+ acquisitionStationList: [],
|
|
|
+ acquisitionStationId: null,
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
- this.timer = setInterval(() => {
|
|
|
- if (this.clientCode) {
|
|
|
- this.fetchData()
|
|
|
- window.clearInterval(this.timer)
|
|
|
- this.timer = null
|
|
|
- }
|
|
|
- }, 1000)
|
|
|
- },
|
|
|
- beforeDestroy () {
|
|
|
- if (this.timer) {
|
|
|
- window.clearInterval(this.timer)
|
|
|
- this.timer = null
|
|
|
- }
|
|
|
+ this.fetchData()
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState({
|
|
@@ -122,7 +128,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapMutations(['SET_WORKSHOP_NAME']),
|
|
|
+ ...mapMutations(['SET_ACQUISITION_STATION_ID']),
|
|
|
getPositionArr() {
|
|
|
const obj = {}
|
|
|
this.tableData.forEach(e => {
|
|
@@ -159,32 +165,43 @@ export default {
|
|
|
}
|
|
|
this.$refs.positionModal.showModal(row.id, entity)
|
|
|
},
|
|
|
- fetchData() {
|
|
|
- findColumnsByTableName({
|
|
|
+ async fetchData() {
|
|
|
+ await findAll().then(res => {
|
|
|
+ this.acquisitionStationList = res.data
|
|
|
+ })
|
|
|
+ await findCurrentAcquisitionStation().then(res => {
|
|
|
+ this.acquisitionStationId = res.data.id
|
|
|
+ this.SET_ACQUISITION_STATION_ID(res.data.id)
|
|
|
+ })
|
|
|
+ await findColumnsByTableName({
|
|
|
tableName: 'Data',
|
|
|
clientCode: this.clientCode
|
|
|
}).then(res => {
|
|
|
console.log('findColumnsByTableName =>', res.data)
|
|
|
if (res && res.code === '200') {
|
|
|
this.tableColumns = res.data
|
|
|
-
|
|
|
- findCollectEntityInfo().then(res => {
|
|
|
- console.log('findCollectEntityInfo =>', res.data)
|
|
|
- this.SET_WORKSHOP_NAME(res.data[0].collectStationName)
|
|
|
- // 按照实体分类, 对应第二列
|
|
|
- const tableDataWrapper = []
|
|
|
- handleData(tableDataWrapper, res.data)
|
|
|
- this.tableDataWrapper = tableDataWrapper
|
|
|
- })
|
|
|
} else {
|
|
|
this.$message.error(res.message)
|
|
|
}
|
|
|
})
|
|
|
+ await this.getCollectEntity()
|
|
|
+ },
|
|
|
+ getCollectEntity() {
|
|
|
+ const entityParams = {
|
|
|
+ acquisitionStationId: this.acquisitionStationId
|
|
|
+ }
|
|
|
+ findCollectEntityInfo(entityParams).then(res => {
|
|
|
+ console.log('findCollectEntityInfo =>', res.data)
|
|
|
+ // 按照实体分类, 对应第二列
|
|
|
+ const tableDataWrapper = []
|
|
|
+ handleData(tableDataWrapper, res.data)
|
|
|
+ this.tableDataWrapper = tableDataWrapper
|
|
|
+ })
|
|
|
const handleData = (dataArr, data) => {
|
|
|
for (const item of data) {
|
|
|
const obj = {
|
|
|
id: item.id,
|
|
|
- first: item.collectStationName,
|
|
|
+ first: item.acquisitionStationName,
|
|
|
second: item.entityName,
|
|
|
startType: item.startType,
|
|
|
limitValue: item.limitValue,
|
|
@@ -199,12 +216,16 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- },
|
|
|
- watch: {
|
|
|
- clientCode(newVal) {
|
|
|
- if (newVal) {
|
|
|
- this.fetchData()
|
|
|
+ async changeAcquisitionStation(acquisitionStationId) {
|
|
|
+ console.log('切换采集站', acquisitionStationId)
|
|
|
+ this.SET_ACQUISITION_STATION_ID(acquisitionStationId)
|
|
|
+ const params = {
|
|
|
+ id: acquisitionStationId,
|
|
|
+ status: 1
|
|
|
}
|
|
|
+ await updateAcquisitionStation(params).then(res => {
|
|
|
+ this.getCollectEntity()
|
|
|
+ })
|
|
|
},
|
|
|
},
|
|
|
}
|
|
@@ -247,4 +268,48 @@ export default {
|
|
|
height: 100%;
|
|
|
}
|
|
|
}
|
|
|
+ /deep/ .el-input__inner {
|
|
|
+ background-color: #ebebeb;
|
|
|
+ box-shadow: inset 0.1rem 0.1rem 0.1rem #AAA7A7, inset -0.1rem -0.1rem 0.1rem #FFFFFF;
|
|
|
+ border: none;
|
|
|
+ font-size: 16px;
|
|
|
+ color: #666666;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .el-input-group__append, .el-input-group__prepend {
|
|
|
+ background-color: transparent;
|
|
|
+ font-size: 14px;
|
|
|
+ box-shadow: 0.1rem 0.1rem 0.1rem #aaa7a7, -0.05rem -0.05rem 0.05rem #FFFFFF;
|
|
|
+ color: #333333;
|
|
|
+ border: none;
|
|
|
+ border-radius: 4px;
|
|
|
+ padding: 0 10px;
|
|
|
+ width: 1px;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .jg-select {
|
|
|
+ padding: 10px;
|
|
|
+ background-color: #ebebeb;
|
|
|
+ box-shadow: 0.1rem 0.1rem 0.1rem #AAA7A7, -0.1rem -0.1rem 0.1rem #FFFFFF;
|
|
|
+
|
|
|
+ .el-select-dropdown__item {
|
|
|
+ box-shadow: 0.1rem 0.1rem 0.1rem #AAA7A7, -0.1rem -0.1rem 0.1rem #FFFFFF;
|
|
|
+ margin: 8px 3px;
|
|
|
+ border-radius: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .el-select-dropdown__item.selected {
|
|
|
+ font-weight: normal;
|
|
|
+ color: #FFFFFF;
|
|
|
+ background-color: #A20D13;
|
|
|
+ border-radius: 5px;
|
|
|
+ box-shadow: inset 0.2rem 0.2rem 0.5rem #6E090C, inset -0.2rem -0.2rem 0.5rem #C71016;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .popper__arrow {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+
|
|
|
</style>
|