diff --git a/src/views/modules/monitoring/qualityInspectionCurrent.vue b/src/views/modules/monitoring/qualityInspectionCurrent.vue
index c71229a..c82d156 100644
--- a/src/views/modules/monitoring/qualityInspectionCurrent.vue
+++ b/src/views/modules/monitoring/qualityInspectionCurrent.vue
@@ -17,7 +17,7 @@
查询
- 新增
+
@@ -51,7 +51,7 @@
@operate-event="handleOperations"
@refreshDataList="getDataList"
/>
-
+
@@ -90,6 +90,10 @@ const FakeChart = {
typeList: {
type: Array,
default: () => []
+ },
+ seriesData: {
+ type: Array,
+ default: () => []
}
},
data() {
@@ -97,9 +101,17 @@ const FakeChart = {
chart: null,
defaultOpts: {
title: {
- text: '统计数据'
+ text: '检测类型统计数据'
},
tooltip: {},
+ legend: {
+ orient: 'vertical',
+ top: 10,
+ right: 20,
+ data: [
+ /** dynamic */
+ ]
+ },
xAxis: {
data: [
/** dynamic */
@@ -126,6 +138,22 @@ const FakeChart = {
},
immediate: true
},
+ typeList: {
+ handler: function(val, oldVal) {
+ if (val && val !== oldVal) {
+ this.defaultOpts.legend.data.push(...val)
+ }
+ },
+ immediate: true
+ },
+ seriesData: {
+ handler: function(val, oldVal) {
+ if (val && val !== oldVal) {
+ this.defaultOpts.series.push(...val)
+ }
+ },
+ immediate: true
+ },
defaultOpts: {
handler: function(val) {
console.log('defaullt opts change: ', val)
@@ -200,6 +228,8 @@ export default {
this.showGraph = value === dict[0] ? false : true
},
getDataList() {
+ this.showGraph = false
+ this.dataType = '表格'
this.echartCategories = null
this.echartCheckTypes.splice(0)
/** 设置默认日期 */
@@ -227,7 +257,7 @@ export default {
this.dataListDynamic = this.parseDynamicData(res.data.data) || []
- console.log('dyname', this.dataListDynamic)
+ this.buildGraphData()
})
},
@@ -272,6 +302,34 @@ export default {
})
},
+ buildGraphData() {
+ /** 构造 echart 需要的数据 */
+ const result = []
+
+ this.echartCheckTypes.forEach(ect => {
+ result.push({ name: ect, type: 'bar', data: [] })
+ })
+
+ this.dataListDynamic.forEach((inspection, index) => {
+ console.log('inspection: ', inspection)
+ this.echartCategories.forEach(cate => {
+ if (cate in inspection) {
+ result[index].data.push(inspection[cate])
+ } else {
+ result[index].data.push('0')
+ }
+ })
+ })
+
+ this.echartsData = result
+ // [
+ // { name: '11', type: 'bar', data: [/**产线1*/ 2, /**产线2*/ 3] },
+ // { name: '222', type: 'bar', data: [1, 2, 3] }
+ // ]
+
+ console.log('echarts data: ', this.echartsData)
+ },
+
fetchList(type, startTime, endTime) {
switch (type) {
case 'sx':