فهرست منبع

检测看板代码优化

cfort 2 سال پیش
والد
کامیت
8345d014de

+ 23 - 15
src/views/system/jbdHome/board/checkBoard.vue

@@ -42,7 +42,7 @@
 <script>
     import screenfull from 'screenfull'
     import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
-    import { acceptList, colors, getRandomColor } from './data.js'
+    import { colors, getRandomColor } from './data.js'
     export default {
         name: 'checkBoard',
         components: {
@@ -69,7 +69,8 @@
                     ],
                     data: [],
                     rowNum: 7,
-                    columnWidth: ['350','100','100','90']
+                    columnWidth: ['350','100','100','90'],
+		            waitTime: 1500
                 },
                 middleCardData: {
                     acceptData:[],
@@ -95,15 +96,21 @@
                 this.allView()
             }
 
-            this.updateAll()
-
-            if (this.timer){
-                clearInterval(this.timer)
-            }
-
-            this.timer = setInterval(() => {
+            const sql = 'select lei_xing_ming_che from t_mjjclx'
+            curdPost('sql', sql).then(res => {
+                const { data = [] } = res.variables || {}
+                this.acceptList = data.map(i => i.lei_xing_ming_che)
                 this.updateAll()
-            }, 1000 * 10)
+    
+                if (this.timer){
+                    clearInterval(this.timer)
+                }
+                
+    
+                this.timer = setInterval(() => {
+                    this.updateAll()
+                }, 1000 * 10)
+            })
         },
         beforeDestroy() {
             if (screenfull.isFullscreen) {
@@ -244,11 +251,11 @@
             getMiddleData() {
                 // 获取检测数据
                 // const sql1 = `select tm.jian_ce_xiang_mu_, tm.jian_ce_lei_bie_, IFNULL(rw.qi_wang_wan_cheng, '') as qi_wang_wan_cheng, rw.zhuang_tai_, ipe.NAME_ from t_rwfpb rw, ibps_party_employee ipe, t_mjjcnlfw tm where rw.jian_ce_yuan_ = ipe.ID_ and rw.jian_ce_xiang_mu_ = tm.id_ and rw.create_time_ like '${this.month}%'`
-                const sql1 = `select tm.jian_ce_xiang_mu_, IFNULL(jc.jian_ce_shi_jian_, '') as startDate, IFNULL(jc.update_time_, '') as endDate, ipe.NAME_ as names from ibps_party_employee ipe, t_mjjcnlfw tm, t_jchzb jc where jc.jian_ce_yuan_ = ipe.ID_ and jc.jian_ce_xiang_mu_ = tm.id_ and jc.jian_ce_zhuang_ta = '已完成' and jc.create_time_ like '${this.month}%' order by jc.create_time_ desc`
+                const sql1 = `select tm.jian_ce_xiang_mu_, IFNULL(jc.jian_ce_shi_jian_, '') as startDate, IFNULL(jc.update_time_, '') as endDate, ipe.NAME_ as names from ibps_party_employee ipe, t_mjjcnlfw tm, t_jchzb jc where jc.jian_ce_yuan_ = ipe.ID_ and jc.jian_ce_xiang_mu_ = tm.id_ and jc.jian_ce_zhuang_ta = '已完成' and jc.jian_ce_shi_jian_ like '${this.month}%' order by jc.jian_ce_shi_jian_ desc`
                 // 获取检测受理类型数据
                 let sqlStr = ''
-                acceptList.forEach((item, index) => {
-                    sqlStr += `count(tm.jian_ce_lei_bie_ = '${item}' or null) as r${index}${index === acceptList.length - 1 ? '' : ', '}`
+                this.acceptList.forEach((item, index) => {
+                    sqlStr += `count(tm.jian_ce_lei_bie_ = '${item}' or null) as r${index}${index === this.acceptList.length - 1 ? '' : ', '}`
                 })
                 const sql2 = `select ${sqlStr} from t_jchzb tj, t_mjjcnlfw tm where tj.jian_ce_xiang_mu_ = tm.id_ and tj.create_time_ like '${this.month}%'`
                 // console.log(sqlStr, sql2)
@@ -275,10 +282,10 @@
 
                     let result = []
                     let tempRes = Object.values(data2[0])
-                    acceptList.forEach((item, index) => {
+                    this.acceptList.forEach((item, index) => {
                         let o = {
                             name: item,
-                            value: tempRes[index]
+                            value: tempRes[index] ? tempRes[index] : null
                         }
                         result.push(o)
                     })
@@ -543,6 +550,7 @@
                         background: rgba(255, 255, 255, 0);
                         border: none;
                         color: #fff;
+                        font-size: 16px;
                     }
                 }
             }

+ 6 - 3
src/views/system/jbdHome/board/component/testing/middleCard.vue

@@ -21,7 +21,7 @@
                     :config="tableData"
                     style="width: 100%; height: 100%"
                 />
-                <div v-else :class="$style.no_data">暂无数据</div>
+                <div v-else :class="$style.no_data">当前月份暂无已完成的检测项目数据</div>
             </div>
         </div>
         <dv-decoration-10 :dur="15"/>
@@ -52,9 +52,12 @@
             },
             list: {
                 handler(value) {
-                    this.tableData = JSON.parse(JSON.stringify(value))
+                    if ((!this.tableData.data || (value.data.length !== this.tableData.data.length))) {
+                        this.tableData = JSON.parse(JSON.stringify(value))
+                    }
                 },
-                immediate: true
+                immediate: true,
+                deep: true
             }
         },
         data() {

+ 30 - 60
src/views/system/jbdHome/board/data.js

@@ -1,5 +1,30 @@
 import echarts from "echarts"
 
+const rowLimit = (params, max) => {
+    let result = ''
+    //一行显示几个字
+    let rowMax = max
+    let rowNumber = Math.ceil(params.length / rowMax)
+    // 超过 3 个字换行
+    if (params.length > 3) {
+        for (let p = 0; p < rowNumber; p++) {
+            let tempStr = ''
+            let start = p * rowMax
+            let end = start + rowMax
+            if (p == rowNumber - 1) {
+                tempStr = params.substring(start, params.length);
+            } else {
+                tempStr = params.substring(start, end) + '\n'
+            }
+            result += tempStr
+        }
+
+    } else {
+        result = params
+    }
+    return result
+}
+
 export const acceptOption1 = {
     // 图表标题
     title: {
@@ -28,28 +53,7 @@ export const acceptOption1 = {
                 fill: '#fff'
             },
             formatter (params) {
-                let result = ''
-                //一行显示几个字
-                let rowMax = 2
-                let rowNumber = Math.ceil(params.length / rowMax)
-                // 超过 3 个字换行
-                if (params.length > 3) {
-                    for (let p = 0; p < rowNumber; p++) {
-                        let tempStr = ''
-                        let start = p * rowMax
-                        let end = start + rowMax
-                        if (p == rowNumber - 1) {
-                            tempStr = params.substring(start, params.length);
-                        } else {
-                            tempStr = params.substring(start, end) + '\n'
-                        }
-                        result += tempStr
-                    }
-    
-                } else {
-                    result = params
-                }
-                return result
+                return rowLimit(params, 2)
             }
         },
         axisLine: {
@@ -124,23 +128,6 @@ export const acceptOption1 = {
     }
 }
 
-export const acceptList = [
-    '细胞鉴别',
-    '无菌检查',
-    '支原体检查',
-    '成瘤性检查',
-    '致瘤性检查',
-    '细胞活性检测',
-    '生物学有效性',
-    '免疫学反应检测',
-    '细菌内毒素检测',
-    '残留物检测',
-    '制剂检查',
-    '免疫细胞检测',
-    '细胞内、外源病毒因子检查',
-    '其他检测'
-]
-
 export const colors = [
     '#d20962',
     '#f47721',
@@ -275,6 +262,9 @@ export const taskOption = {
         axisLabel: {
             style: {
                 fill: '#fff'
+            },
+            formatter (params) {
+                return rowLimit(params, 2)
             }
         },
         axisLine: {
@@ -598,27 +588,7 @@ export const sampleOption = {
                 fill: '#fff'
             },
             formatter (params) {
-                let result = ''
-                //一行显示几个字
-                let rowMax = 3
-                let rowNumber = Math.ceil(params.length / rowMax)
-                if (params.length > rowMax) {
-                    for (let p = 0; p < rowNumber; p++) {
-                        let tempStr = ''
-                        let start = p * rowMax
-                        let end = start + rowMax
-                        if (p == rowNumber - 1) {
-                            tempStr = params.substring(start, params.length);
-                        } else {
-                            tempStr = params.substring(start, end) + '\n'
-                        }
-                        result += tempStr
-                    }
-    
-                } else {
-                    result = params
-                }
-                return result
+                return rowLimit(params, 3)
             }
         },
         axisLine: {