forked from mt-fe-group/mt-yd-ui
add 设备历史参数
This commit is contained in:
parent
13df2016b9
commit
a0253cc235
@ -58,6 +58,7 @@ t.routes['设备分组'] = 'Equipment Groups'
|
||||
t.routes['设备信息'] = 'Equipment Details'
|
||||
t.routes['设备参数状态监控'] = 'Current Equipment State'
|
||||
t.routes['设备分组报警信息'] = 'Equipment Group Alarm'
|
||||
t.routes['设备历史参数'] = 'Equipment Historical Parameters'
|
||||
t.routes['质量检测类型'] = 'Quality Inpection Types'
|
||||
t.routes['质量检测信息'] = 'Quality Inpection Details'
|
||||
|
||||
|
@ -59,6 +59,7 @@ t.routes['设备分组'] = '设备分组'
|
||||
t.routes['设备信息'] = '设备信息'
|
||||
t.routes['设备参数状态监控'] = '设备参数状态监控'
|
||||
t.routes['设备分组报警信息'] = '设备分组报警信息'
|
||||
t.routes['设备历史参数'] = '设备历史参数'
|
||||
t.routes['质量检测类型'] = '质量检测类型'
|
||||
t.routes['质量检测信息'] = '质量检测信息'
|
||||
|
||||
|
@ -75,7 +75,14 @@ const tableConfigs = [
|
||||
},
|
||||
{ prop: 'quantityTime', name: i18n.t('realtime.productionSnapshotTime'), filter: timeFilter },
|
||||
{ prop: 'statusTime', name: i18n.t('realtime.statusSnapshotTime'), filter: timeFilter },
|
||||
{ prop: 'alarm', name: i18n.t('realtime.recentParamValue'), buttonContent: i18n.t('realtime.view'), subcomponent: TableTextComponent, actionName: 'view-alarm' }
|
||||
{
|
||||
prop: 'alarm',
|
||||
name: i18n.t('realtime.recentParamValue'),
|
||||
buttonContent: i18n.t('realtime.view'),
|
||||
subcomponent: TableTextComponent,
|
||||
emitFullData: true,
|
||||
actionName: 'view-alarm'
|
||||
}
|
||||
// { prop: 'operations', name: i18n.t('handle'), fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
@ -186,23 +193,19 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
handleOperations({ type, data }) {
|
||||
switch (type) {
|
||||
case 'view-alarm':
|
||||
const { name, code } = this.dataList.find(item => item.id === id)
|
||||
const { equipmentId: id } = data
|
||||
this.$router.push({
|
||||
name: 'monitoring-equipmentGroupAlarm',
|
||||
params: {
|
||||
groupName: name,
|
||||
groupCode: code,
|
||||
id
|
||||
}
|
||||
name: 'monitoring-equipmentHistoricalParameters',
|
||||
params: { id }
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
// case 'edit':
|
||||
// return this.addOrUpdateHandle(id)
|
||||
// case 'delete':
|
||||
// return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
|
@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" @keyup.enter.native="getDataList()">
|
||||
<el-form-item :label="'当前设备id'">
|
||||
<strong>{{ $route.params.id }}</strong></el-form-item
|
||||
>
|
||||
</el-form>
|
||||
|
||||
<!-- <base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { calcMaxHeight } from '@/utils'
|
||||
import { timeFilter } from '@/utils/filters'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import i18n from '@/i18n'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import { pick } from 'lodash/object'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
calcMaxHeight,
|
||||
tableConfigs: [],
|
||||
dataList: [],
|
||||
dataListLoading: false,
|
||||
dataListSelections: []
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
mouted() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentValueMonitor/runLog/${this.$route.params.id}`),
|
||||
method: 'get'
|
||||
}).then(({ data: res }) => {
|
||||
if (
|
||||
res &&
|
||||
res.code === 0 &&
|
||||
res.data &&
|
||||
res.data.length > 0 &&
|
||||
res.data[0].nameData &&
|
||||
res.data[0].nameData.length > 0 &&
|
||||
res.data[0].data &&
|
||||
res.data[0].data.length > 0
|
||||
) {
|
||||
this.setTableProps(res.data[0].nameData)
|
||||
this.setTableData(res.data[0].data)
|
||||
} else {
|
||||
this.dataList = []
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
setTableProps(nameData) {
|
||||
this.tableConfigs = [
|
||||
{
|
||||
type: 'index',
|
||||
name: i18n.t('index')
|
||||
},
|
||||
{ prop: 'time', name: '时间', filter: timeFilter },
|
||||
{ prop: 'plcCode', name: 'PLC 编码' },
|
||||
{ prop: 'equName', name: '设备名称' },
|
||||
{ prop: 'equCode', name: '设备编码' },
|
||||
// ...['数值1', '数值2', '数值3'].map(name => {
|
||||
// return { prop: name, name }
|
||||
// })
|
||||
...Array.from(new Set(nameData.map(item => item.name))).map(name => ({ prop: name, name }))
|
||||
]
|
||||
},
|
||||
setTableData(data) {
|
||||
this.dataList = data.map(item => {
|
||||
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
|
||||
if (item.data && item.data.length > 0) {
|
||||
item.data.forEach(param => {
|
||||
rowItem[param.dynamicName] = param.dynamicValue
|
||||
})
|
||||
}
|
||||
return rowItem
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user