Przeglądaj źródła

fix:设备维护所有维护完成时,数值不对修改

zhangjingyuan 1 rok temu
rodzic
commit
784a087cd9

+ 41 - 39
src/views/system/jbdHome/board/component/CarouselTabl.vue

@@ -1,51 +1,53 @@
 <template>
-  <div style="width: 100%;height: 100%;background-color: rgba(6,30,93,.5);overflow: hidden;">
-    <div class="title" style="vertical-align: top; height: 10%;font-size: 16px;color: white;">{{ title }}</div>
-    <div style="width:100%;height: 90%;display: inline-block;background-color: #06163f;" v-show="showChart">
-      <dv-scroll-board :config="configData" style="width:100%;height:100%" />
+    <div style="width: 100%;height: 100%;background-color: rgba(6,30,93,.5);overflow: hidden;">
+        <div class="title" style="vertical-align: top; height: 10%;font-size: 16px;color: white;">{{ title }}</div>
+        <div v-show="showChart" style="width:100%;height: 90%;display: inline-block;background-color: #06163f;">
+            <dv-scroll-board :config="configData" style="width:100%;height:100%" />
+        </div>
+        <div v-if="!showChart" style="background: #061237;width: 100%;height: 100%;display: flex;justify-content: center;align-items: center;">
+            <div style="color: #c7c7c7">目前无数据</div>
+        </div>
     </div>
-    <div style="background: #061237;width: 100%;height: 100%;display: flex;justify-content: center;align-items: center;" v-if="!showChart">
-      <div style="color: #c7c7c7">目前无数据</div>
-    </div>
-  </div>
 </template>
 
 <script>
 export default {
-  data() {
-    return {
-      configData: {},
-      showChart: true,
-    };
-  },
-  props: {
-    info: {
-      type: Object,
-      default: {},
+    props: {
+        info: {
+            type: Object,
+            default: () => {
+                return {}
+            }
+        },
+        title: {
+            type: String,
+            default: ''
+        }
     },
-    title: {
-      type: String,
-      default: "",
+    data () {
+        return {
+            configData: {},
+            showChart: true
+        }
     },
-  },
-  mounted() {
-    let this_ = this;
-    if(this_.info.data[0] == 999 ){
-        this.showChart = false;
-        return
-    }
-  },
-  watch: {
-    info: {
-      handler(newVal, oldVal) {
-        this.configData = { ...newVal }
-      },
-      deep: true,
-      immediate: true
+    watch: {
+        info: {
+            handler (newVal, oldVal) {
+                this.configData = { ...newVal }
+            },
+            deep: true,
+            immediate: true
+        }
+    },
+    mounted () {
+        const this_ = this
+        if (this_.info.data[0] == 999) {
+            this.showChart = false
+            return
+        }
     }
-  }
 
-};
+}
 </script>
 <style lang="scss" module>
-</style>
+</style>

+ 80 - 78
src/views/system/jbdHome/board/component/equipmentBoardTopcard.vue

@@ -1,92 +1,94 @@
 <template>
-  <div id="top-bar" style="width:100%;height:100%">
-    <div class="content">
-      <div class="bar">
-        <div v-for="(item, index) in topBarData" :key="index" class="item">
-          <div v-for="(v, i) in item.children" :key="i" class="box1" >
-            <div class="label" style="text-align: center; ">{{ v.label }}</div>
-            <div class="count" style="display: flex;justify-content: center;">
-              <div v-if=" v.label.includes('计划')||v.label.includes('申请')" :style="{color:'#9966FF'}" style="font-weight:bold;font-size: 27px;">{{v.value}}</div>
-              <div v-else-if="v.label.includes('报废/停用')" :style="{color:'#FF0066'}" style="font-weight:bold;font-size: 27px;">{{v.value}}</div>
-              <div v-else-if="v.label.includes('受限')" :style="{color:'#CCFF33'}" style="font-weight:bold;font-size: 27px;">{{v.value}}</div>
-              <div v-else-if="v.label.includes('已')||v.label.includes('完成')||v.label.includes('正常')||v.label.includes('率')" :style="{color:'#00b56a'}" style="font-weight:bold;font-size: 27px;">{{v.value}}</div>
-              <div v-else :style="{color:'#66CCCC'}" style="font-weight:bold;font-size: 27px;">{{v.value}}</div>
-              <div class="unit" style="line-height: 34px;">{{ v.unit }}</div>
+    <div id="top-bar" style="width:100%;height:100%">
+        <div class="content">
+            <div class="bar">
+                <div v-for="(item, index) in topBarData" :key="index" class="item">
+                    <div v-for="(v, i) in item.children" :key="i" class="box1">
+                        <div class="label" style="text-align: center; ">{{ v.label }}</div>
+                        <div class="count" style="display: flex;justify-content: center;">
+                            <div v-if=" v.label.includes('计划')||v.label.includes('申请')" :style="{color:'#9966FF'}" style="font-weight:bold;font-size: 27px;">{{ v.value }}</div>
+                            <div v-else-if="v.label.includes('报废/停用')" :style="{color:'#FF0066'}" style="font-weight:bold;font-size: 27px;">{{ v.value }}</div>
+                            <div v-else-if="v.label.includes('受限')" :style="{color:'#CCFF33'}" style="font-weight:bold;font-size: 27px;">{{ v.value }}</div>
+                            <div v-else-if="v.label.includes('已')||v.label.includes('完成')||v.label.includes('正常')||v.label.includes('率')" :style="{color:'#00b56a'}" style="font-weight:bold;font-size: 27px;">{{ v.value }}</div>
+                            <div v-else :style="{color:'#66CCCC'}" style="font-weight:bold;font-size: 27px;">{{ v.value }}</div>
+                            <div class="unit" style="line-height: 34px;">{{ v.unit }}</div>
+                        </div>
+                    </div>
+                </div>
             </div>
-          </div>  
         </div>
-      </div>
+        <dv-decoration-10 />
     </div>
-    <dv-decoration-10 />
-  </div>
 </template>
 <script>
-import color from '@/store/modules/ibps/modules/color';
+import color from '@/store/modules/ibps/modules/color'
 export default {
-  name: "topBar",
-  props: {
-    info: {
-      type: Array,
-      default: [],
+    name: 'top-bar',
+    components: {},
+    props: {
+        info: {
+            type: Array,
+            default: () => {
+                return []
+            }
+        }
     },
-  },
-  components: {},
-  watch: {
-    info(v) {
-      this.update();
+    data () {
+        return {
+            topBarData: [],
+            fontColor: [
+                '#d20962',
+                '#f47721',
+                '#7ac143',
+                '#00a78e',
+                '#00bce4',
+                '#7d3f98',
+                '#037ef3',
+                '#f85a40',
+                '#00c16e',
+                '#ffd900',
+                '#0cb9c1',
+                '#7552cc'
+            ]
+        }
     },
-  },
-  data() {
-    return {
-      topBarData: [],
-      fontColor: [
-        "#d20962",
-        "#f47721",
-        "#7ac143",
-        "#00a78e",
-        "#00bce4",
-        "#7d3f98",
-        "#037ef3",
-        "#f85a40",
-        "#00c16e",
-        "#ffd900",
-        "#0cb9c1",
-        "#7552cc",
-      ],
-    };
-  },
-  created() {
-    this.update();
-  },
-  methods: {
-    //随机颜色
-    getRandom(minNum, maxNum) {
-      if (arguments.length === 1) {
-        return parseInt(Math.random() * minNum + 1, 10);
-      } else {
-        return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
-      }
+    watch: {
+        info (v) {
+            this.update()
+        }
     },
-    // 数据更新
-    update() {
-      this.info.forEach((item) => {
-        item.children.forEach((i) => {
-          i.data = {
-            number: [i.value],
-            content: "{nt}",
-            toFixed: 1,
-            textAlign: "center",
-            style: {
-              fill: this.fontColor[this.getRandom(0, 11)],
-            },
-          };
-          i.unit = i.danwei;
-        });
-      });
-      this.topBarData = JSON.parse(JSON.stringify(this.info));
+    created () {
+        this.update()
     },
-  },
-};
+    methods: {
+    // 随机颜色
+        getRandom (minNum, maxNum) {
+            if (arguments.length === 1) {
+                return parseInt(Math.random() * minNum + 1, 10)
+            } else {
+                return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10)
+            }
+        },
+        // 数据更新
+        update () {
+            this.info.forEach((item) => {
+                item.children.forEach((i) => {
+                    i.data = {
+                        number: [i.value],
+                        content: '{nt}',
+                        toFixed: 1,
+                        textAlign: 'center',
+                        style: {
+                            fill: this.fontColor[this.getRandom(0, 11)]
+                        }
+                    }
+                    i.unit = i.danwei
+                })
+            })
+            this.topBarData = JSON.parse(JSON.stringify(this.info))
+        }
+    }
+}
 </script>
 <style lang="scss" scoped>
 .content{

+ 0 - 4
src/views/system/jbdHome/board/component/moreBar.vue

@@ -38,7 +38,6 @@ export default {
         getMiddleLeft () {
             const this_ = this
             const series = []
-            console.log(this_.info, this_.info.config.idSelector, '12')
             if (this_.info.data.source[0] === 999) {
                 this.showChart = false
                 return
@@ -60,7 +59,6 @@ export default {
             if (this_.info.config.idSelector === 'eqFinish') {
                 let max = 0
                 this_.info.data.source.forEach(item => {
-                    console.log(item.设备总数)
                     if (item.设备总数 > max) {
                         max = item.设备总数
                     }
@@ -76,13 +74,11 @@ export default {
                 let wanchengmax = 0
                 let max = 0
                 this_.info.data.source.forEach(item => {
-                    console.log(item.计划数)
                     if (item.计划数 > max) {
                         jihuamax = item.计划数
                     }
                 })
                 this_.info.data.source.forEach(item => {
-                    console.log(item.完成数)
                     if (item.完成数 > wanchengmax) {
                         wanchengmax = item.完成数
                     }

+ 0 - 4
src/views/system/jbdHome/board/component/zhuzhuangtu.vue

@@ -36,10 +36,6 @@ export default {
     methods: {
         getMiddleLeft () {
             var chartDom = document.getElementById(this.info.config.idSelector)
-            // console.log(chartDom.getBoundingClientRect().height, 'chartDom')
-            // const domHeight = parseInt(chartDom.getBoundingClientRect().height)
-            // let interval =
-            // var myChart = echarts.init(chartDom)
             const ay = this.info.data
             let yc
             ay[0] > ay[1] ? yc = ay[0] : yc = ay[1]

+ 26 - 20
src/views/system/jbdHome/board/equipmentBoard.vue

@@ -79,7 +79,6 @@
 <script>
 import screenfull from 'screenfull'
 import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
-import data from '@/components/ibps-icon-select/data'
 export default {
     name: 'check-board',
     components: {
@@ -143,12 +142,12 @@ export default {
             allWeihuSheBeiData: {
                 data: [{ name: '待处理', value: 0 }, { name: '已完成', value: 0 }],
                 config: { title: '检验科设备维护完成情况', idSelector: 'allWeihuShebei' },
-                color: ['#3870e0', '#FFFF66']
+                color: ['#3870e0', '#339933']
             },
             allJiaozhunSheBeiData: {
                 data: [{ name: '计划数', value: 0 }, { name: '完成数', value: 0 }],
                 config: { title: '检验科设备检定/校准完成情况', idSelector: 'allJiaozhunShebei' },
-                color: ['#3870e0', '#FFFF66']
+                color: ['#3870e0', '#339933']
             }
         }
     },
@@ -483,10 +482,9 @@ export default {
             this_.$store.getters.level.second ? didian = this_.$store.getters.level.second : didian = this_.$store.getters.level.first
             didian.includes(',') ? didian = didian.split(',')[0] : ''
             // 计划数,查询设备维护计划表完成数
-            const sql1 = `select DISTINCT(a.bian_zhi_bu_men_) ,name_,COUNT(*) AS total FROM t_mjsbwhbyjlby AS a JOIN ibps_party_position AS b ON a.bian_zhi_bu_men_ = b.id_ WHERE (a.bian_zhi_shi_jian LIKE '%${this_.today}%' OR a.create_time_ LIKE '%${this_.today}%') AND a.shi_fou_guo_shen_ != '已完成' AND a.di_dian_ = '${didian}' GROUP BY a.bian_zhi_bu_men_`
-            console.log(sql1, '计划数')
+            const sql1 = `select DISTINCT(a.bian_zhi_bu_men_) ,name_,COUNT(*) AS total FROM t_mjsbwhbyjlby AS a JOIN ibps_party_position AS b ON a.bian_zhi_bu_men_ = b.id_ WHERE a.ji_hua_shi_jian_ LIKE '%${this_.today}%' AND a.shi_fou_guo_shen_ != '已完成' AND a.di_dian_ = '${didian}' GROUP BY a.bian_zhi_bu_men_`
             //   维护记录数
-            const sql2 = `select DISTINCT(a.bian_zhi_bu_men_) ,name_,COUNT(*) AS total FROM t_mjsbwhbyjlby AS a JOIN ibps_party_position AS b ON a.bian_zhi_bu_men_ = b.id_ WHERE (a.bian_zhi_shi_jian LIKE '%${this_.today}%' OR a.create_time_ LIKE '%${this_.today}%') AND a.shi_fou_guo_shen_ = '已完成' AND a.di_dian_ = '${didian}' GROUP BY a.bian_zhi_bu_men_`
+            const sql2 = `select DISTINCT(a.bian_zhi_bu_men_) ,name_,COUNT(*) AS total FROM t_mjsbwhbyjlby AS a JOIN ibps_party_position AS b ON a.bian_zhi_bu_men_ = b.id_ WHERE a.ji_hua_shi_jian_ LIKE '%${this_.today}%' AND a.shi_fou_guo_shen_ = '已完成' AND a.di_dian_ = '${didian}' GROUP BY a.bian_zhi_bu_men_`
             this.weihuBarData.data.dimensions = ['product', '待处理', '已完成']
             let data1, data2
             await Promise.all([curdPost('sql', sql1), curdPost('sql', sql2)]).then(([res1, res2]) => {
@@ -497,35 +495,43 @@ export default {
                     data2 = res2.variables.data
                 }
             })
-            data2 = []
             const source = []
             data1.forEach((item, index) => {
                 source.push({
                     product: item.name_,
-                    '待处理': item.total,
+                    '待处理': item.total || 0,
                     '已完成': 0
                 })
             })
             data2.forEach(item => {
                 let lock = true
-                source.forEach((el, index) => {
-                    if (item.name_ === el.product) {
-                        source[index]['完成数'] = item.total
-                        lock = false
-                    } else if (lock && index === source.length - 1) {
-                        source.push({
-                            product: item.name_,
-                            '待处理': 0,
-                            '已完成': item.total
-                        })
-                    }
-                })
+                if (source.length > 0) {
+                    source.forEach((el, index) => {
+                        if (item.name_ === el.product) {
+                            source[index]['完成数'] = item.total
+                            lock = false
+                        } else if (lock && index === source.length - 1) {
+                            source.push({
+                                product: item.name_,
+                                '待处理': 0,
+                                '已完成': item.total || 0
+                            })
+                        }
+                    })
+                } else {
+                    source.push({
+                        product: item.name_,
+                        '待处理': 0,
+                        '已完成': item.total || 0
+                    })
+                }
             })
             let allPlan = 0; let finishs = 0
             source.forEach(item => {
                 allPlan += item['待处理']
                 finishs += item['已完成']
             })
+            console.log(source, 'source2')
             this.allWeihuSheBeiData.data[0].value = allPlan
             this.allWeihuSheBeiData.data[1].value = finishs
             this.moreBarData.data.source.forEach(item => {