fzq #31

Closed
fanzhiqin wants to merge 215 commits from fzq into test
4 changed files with 115 additions and 13 deletions
Showing only changes of commit a0253cc235 - Show all commits

View File

@ -58,6 +58,7 @@ t.routes['设备分组'] = 'Equipment Groups'
t.routes['设备信息'] = 'Equipment Details' t.routes['设备信息'] = 'Equipment Details'
t.routes['设备参数状态监控'] = 'Current Equipment State' t.routes['设备参数状态监控'] = 'Current Equipment State'
t.routes['设备分组报警信息'] = 'Equipment Group Alarm' t.routes['设备分组报警信息'] = 'Equipment Group Alarm'
t.routes['设备历史参数'] = 'Equipment Historical Parameters'
t.routes['质量检测类型'] = 'Quality Inpection Types' t.routes['质量检测类型'] = 'Quality Inpection Types'
t.routes['质量检测信息'] = 'Quality Inpection Details' t.routes['质量检测信息'] = 'Quality Inpection Details'

View File

@ -59,6 +59,7 @@ t.routes['设备分组'] = '设备分组'
t.routes['设备信息'] = '设备信息' t.routes['设备信息'] = '设备信息'
t.routes['设备参数状态监控'] = '设备参数状态监控' t.routes['设备参数状态监控'] = '设备参数状态监控'
t.routes['设备分组报警信息'] = '设备分组报警信息' t.routes['设备分组报警信息'] = '设备分组报警信息'
t.routes['设备历史参数'] = '设备历史参数'
t.routes['质量检测类型'] = '质量检测类型' t.routes['质量检测类型'] = '质量检测类型'
t.routes['质量检测信息'] = '质量检测信息' t.routes['质量检测信息'] = '质量检测信息'

View File

@ -75,7 +75,14 @@ const tableConfigs = [
}, },
{ prop: 'quantityTime', name: i18n.t('realtime.productionSnapshotTime'), filter: timeFilter }, { prop: 'quantityTime', name: i18n.t('realtime.productionSnapshotTime'), filter: timeFilter },
{ prop: 'statusTime', name: i18n.t('realtime.statusSnapshotTime'), 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'] } // { prop: 'operations', name: i18n.t('handle'), fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
] ]
@ -186,23 +193,19 @@ export default {
selectionChangeHandle(val) { selectionChangeHandle(val) {
this.dataListSelections = val this.dataListSelections = val
}, },
handleOperations({ type, data: id }) { handleOperations({ type, data }) {
switch (type) { switch (type) {
case 'view-alarm': case 'view-alarm':
const { name, code } = this.dataList.find(item => item.id === id) const { equipmentId: id } = data
this.$router.push({ this.$router.push({
name: 'monitoring-equipmentGroupAlarm', name: 'monitoring-equipmentHistoricalParameters',
params: { params: { id }
groupName: name,
groupCode: code,
id
}
}) })
break break
case 'edit': // case 'edit':
return this.addOrUpdateHandle(id) // return this.addOrUpdateHandle(id)
case 'delete': // case 'delete':
return this.deleteHandle(id) // return this.deleteHandle(id)
} }
}, },
// / // /

View File

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