Просмотр исходного кода

室间质控统计看板调整

shenqilong 11 месяцев назад
Родитель
Сommit
d9bc02cf59

+ 29 - 3
src/views/InterLaboratory/interStatistics/botChart.vue

@@ -35,13 +35,39 @@ export default {
                     }
                 },
                 toolbox: {
+                    show: true,
                     feature: {
-
-                        bottom: '10',
-                        dataView: { show: true, readOnly: false },
+                        dataView: { show: true, readOnly: false,
+                            optionToContent: function (opt) {
+                                var axisData = opt.xAxis[0].data// x轴作为条件,y轴需改成yAxis[0].data;
+                                var series = opt.series
+                                var tdHeads = '<td  style="padding:0 10px">年份</td>'
+                                series.forEach(function (item) {
+                                    tdHeads += '<td style="padding: 0 10px">' + item.name + '</td>'
+                                })
+                                var table = '<table border="1" style="margin-left:20px;border-collapse:collapse;font-size:14px;text-align:center;color:#666"><tbody><tr>' + tdHeads + '</tr>'
+                                var tdBodys = ''
+                                for (var i = 0, l = axisData.length; i < l; i++) {
+                                    for (var j = 0; j < series.length; j++) {
+                                        if (typeof (series[j].data[i]) === 'object') {
+                                            tdBodys += '<td>' + series[j].data[i].value + '</td>'
+                                        } else {
+                                            tdBodys += '<td>' + series[j].data[i] + '</td>'
+                                        }
+                                    }
+                                    table += '<tr><td style="padding: 0 10px">' + axisData[i] + '</td>' + tdBodys + '</tr>'
+                                    tdBodys = ''
+                                }
+                                table += '</tbody></table>'
+                                return table
+                            }
+                        },
                         magicType: { show: true, type: ['line', 'bar'] },
                         restore: { show: true },
                         saveAsImage: { show: true }
+                    },
+                    iconStyle: {
+                        borderColor: 'white'
                     }
                 },
                 legend: {

+ 1 - 1
src/views/InterLaboratory/interStatistics/index.vue

@@ -354,7 +354,7 @@ export default {
             this.result2 = []
             this.result3 = []
             const yearStr = `('${this.yearArr.join("', '")}')`
-            const sql = `select 年度 as niandu,评价结果 as jieguo, COALESCE(COUNT(*), 0) AS count FROM v_sjzpjgpj WHERE 年度 IN ${yearStr} GROUP BY CONCAT(年度, ' ',评价结果)`
+            const sql = `select 年度 as niandu,评价结果 as jieguo, COALESCE(COUNT(*), 0) AS count FROM v_sjzpjgpj WHERE 年度 IN ${yearStr} and 状态 = '已完成' GROUP BY CONCAT(年度, ' ',评价结果)`
             this.$common.request('sql', sql).then((res) => {
                 const data = res.variables.data
                 for (var item of this.yearArr) {