瀏覽代碼

检测委托受理→检测报告发放

cfort 2 年之前
父節點
當前提交
3d1790846d

+ 19 - 11
src/views/system/jbdHome/board/checkBoard.vue

@@ -320,19 +320,25 @@
             getBottomData() {
                 // 获取检测委托受理情况数据
                 const sql1 = `select tm.zhuang_tai_ as state, DATE_FORMAT(tm.create_time_, '%Y-%m-%d %H:%i:%s') as time from t_mjwtsqb tm where tm.create_time_ like '${this.year}%'`
+                // 获取报告发放数据
+                const sql2 = `select zhuang_tai_ as state, DATE_FORMAT(create_time_, '%Y-%m-%d %H:%i:%s') as time from t_mjjcbg where create_time_ LIKE '${this.year}%'`
                 // 获取样品 收样/留样/不合格数量
                 const sql4 = `select count(a.id_) as receive, count(a.shi_fou_liu_yang_ = '是' or null) as keep, count(a.yan_shou_zhuang_t = '残缺' or null) as incomplete, count(a.jie_yang_zhuang_t = '待确认' or null) as unReceive from (select id_, shi_fou_liu_yang_, yan_shou_zhuang_t, jie_yang_zhuang_t from t_mjypdjb where create_time_ like '${this.month}%' group by yang_pin_bian_hao) as a`
                 Promise.all([
                     curdPost('sql', sql1),
-                    curdPost('sql', sql4),
-                ]).then(([ res1, res4]) => {
+                    curdPost('sql', sql2),
+                    curdPost('sql', sql4)
+                ]).then(([ res1, res2, res4]) => {
                     this.bottomCardData.flag = false
-                    const data1 = res1.variables.data
-                    const data4 = res4.variables.data
+                    const data1 = res1.variables && res1.variables.data
+                    const data2 = res2.variables && res2.variables.data
+                    const data4 = res4.variables && res4.variables.data
                     // console.log(data1, data2, data3, data4)
 
                     let trust = new Array(12).fill(0)
                     let accepted = new Array(12).fill(0)
+                    let reports = new Array(12).fill(0)
+                    let compile = new Array(12).fill(0)
                     // let task = new Array(12).fill(0)
                     // let complete = new Array(12).fill(0)
                     data1.forEach(item => {
@@ -342,13 +348,13 @@
                         }
                         trust[index]++
                     })
-                    // data2.forEach(item => {
-                    //     const index = parseInt(item.time.slice(5,7)) - 1
-                    //     if (item.state === '已完成') {
-                    //         complete[index]++
-                    //     }
-                    //     task[index]++
-                    // })
+                    data2.forEach(item => {
+                        const index = parseInt(item.time.slice(5,7)) - 1
+                        if (item.state && item.state.includes('完成')) {
+                            reports[index]++
+                        }
+                        compile[index]++
+                    })
                     // let taskCount = task.reduce((pre, cur) => pre + cur)
                     // let completeCount = complete.reduce((pre, cur) => pre + cur)
                     // let year = [
@@ -364,6 +370,8 @@
                     let sample = [data4[0].unReceive, data4[0].receive, data4[0].incomplete, data4[0].keep]
                     this.bottomCardData.trust = trust
                     this.bottomCardData.accepted = accepted
+                    this.bottomCardData.reports = reports
+                    this.bottomCardData.compile = compile
                     // this.bottomCardData.task = task
                     // this.bottomCardData.complete = complete
                     // this.bottomCardData.year = year

+ 3 - 4
src/views/system/jbdHome/board/component/testing/bottomCard.vue

@@ -35,7 +35,7 @@
 </template>
 <script>
     import echarts from 'echarts'
-    import { trustOption, sampleOption, monthOption, yearOption, satisfaction, contract } from '../../data'
+    import { trustOption, reportOption, sampleOption, monthOption, yearOption, satisfaction, contract } from '../../data'
     export default {
         name: 'topBar',
         props: {
@@ -70,15 +70,14 @@
                 const observe = echarts.init(document.getElementById('observe'))
 
                 // 设置图表数据
-                trustOption.series[0].data = this.info.trust
-                trustOption.series[1].data = this.info.accepted
+                reportOption.series[0].data = this.info.reports
                 sampleOption.series[0].data = this.info.sample
                 // monthOption.series[0].data = this.info.task
                 // monthOption.series[1].data = this.info.complete
                 // yearOption.series[0].data = this.info.year
 
                 // 渲染
-                trust.setOption(trustOption)
+                trust.setOption(reportOption)
                 sample.setOption(sampleOption)
                 satisfied.setOption(satisfaction)
                 observe.setOption(contract)

+ 88 - 0
src/views/system/jbdHome/board/data.js

@@ -483,6 +483,94 @@ export const trustOption = {
     }
 }
 
+export const reportOption = {
+    title: {
+        show: true,
+        text: '检测报告月度发放量',
+        textStyle: {
+            color: '#fff',
+            fontSize: 20,
+            fontWeight: '600'
+        },
+        textAlign: 'center',
+        left: '50%',
+        top: '20px'
+    },
+    grid: {
+        top: '80px'
+    },
+    xAxis: {
+        type: 'category',
+        data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+        axisTick: {
+            alignWithLabel: true
+        },
+        axisLabel: {
+            style: {
+                fill: '#fff'
+            }
+        },
+        axisLine: {
+            lineStyle: {
+                color: '#fff'
+            }
+        }
+    },
+    yAxis: {
+        type: 'value',
+        name: '',
+        nameTextStyle: {
+            color: '#fff',
+            fontSize: 14
+        },
+        splitLine: {
+            show: false
+        },
+        axisLine: {
+            lineStyle: {
+                color: '#fff'
+            }
+        }
+    },
+    series: [{
+        type: 'bar',
+        name: '',
+        data: [],
+        barMaxWidth: '35px',
+        itemStyle: {
+            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+                { offset: 0, color: "#83bff6" },
+                { offset: 0.5, color: "#188df0" },
+                { offset: 1, color: "#188df0" },
+            ])
+        },
+        emphasis: {
+            itemStyle: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+                    { offset: 0, color: "#2378f7" },
+                    { offset: 0.7, color: "#2378f7" },
+                    { offset: 1, color: "#83bff6" },
+                ])
+            }
+        },
+        label: {
+            show: true,
+            position: 'top',
+            textStyle: {
+                color: '#fff',
+                fontSize: 14
+            },
+            formatter (params) {
+                return params.value ? params.value : ''
+            }
+        }
+    }],
+    tooltip: {
+        show: true,
+        trigger: 'axis'
+    }
+}
+
 export const sampleOption = {
     title: {
         show: true,