lb #1

Merged
gtz217 merged 128 commits from lb into develop 2022-09-20 14:53:17 +08:00
Showing only changes of commit 3c4af47e2d - Show all commits

View File

@ -17,7 +17,7 @@
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="$hasPermission('monitoring:qualityinspectionrecord:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<!-- <el-button v-if="$hasPermission('monitoring:qualityinspectionrecord:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> -->
</el-form-item>
</el-form>
@ -51,7 +51,7 @@
@operate-event="handleOperations"
@refreshDataList="getDataList"
/>
<fake-chart v-else :categories="echartCategories" :type-list="echartCheckTypes" />
<fake-chart v-else :categories="echartCategories" :type-list="echartCheckTypes" :series-data="echartsData" />
</el-row>
</el-col>
</el-row>
@ -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':