Selaa lähdekoodia

SMT看板数据提交

callm 1 vuosi sitten
vanhempi
commit
0ca4ae68f7

+ 22 - 20
src/components/smtechart/bottom/bottom1Chart/chart.vue

@@ -342,27 +342,29 @@
                                     fontSize:14,
                                 },
                                 lineSmooth: true,
-                                markLine: {
-                                    silent: true,
-                                    data: [
-                                        {
-                                            type: 'average',
-                                            name: '平均值'
-                                        }
-                                    ],
-                                    precision: 0,
-                                    label: {
-                                        normal: {
-                                            formatter: '平均值: \n {c}'
-                                        }
-                                    },
-                                    lineStyle: {
-                                        fontSize: 16,
-                                        normal: {
-                                            color: 'rgba(248,211,81,.7)'
-                                        }
-                                    }
+                              markLine: {
+                                silent: true,
+                                data: [
+                                  {yAxis: 98}
+                                  /*{
+                                    type: 'average',
+                                    value:80,
+                                    name: '平均值'
+                                  }*/
+                                ],
+                                precision: 0,
+                                label: {
+                                  normal: {
+                                    formatter: '目标线: \n {c}'
+                                  }
                                 },
+                                lineStyle: {
+                                  normal: {
+                                    fontSize: 16,
+                                    color: 'rgba(248,211,81,.7)'
+                                  }
+                                }
+                              },
                                 tooltip: {
                                     position: 'top',
                                     formatter: '{c} %',

+ 105 - 0
src/components/smtechart/centerLeft/centerChartRate/index.vue

@@ -0,0 +1,105 @@
+<template>
+  <div>
+    <!-- 通过率/达标率 -->
+    <Echart
+        :options="options"
+        :id="id"
+        height="100px"
+        width="150px"
+    ></Echart>
+  </div>
+</template>
+
+<script>
+import Echart from '@/common/echart'
+export default {
+  data () {
+    return {
+      options: {},
+    };
+  },
+  components: {
+    Echart,
+  },
+  props: {
+    id: {
+      type: String,
+      required: true,
+      default: "chartRate"
+    },
+    tips: {
+      type: Number,
+      required: true,
+      default: 50
+    },
+    colorObj: {
+      type: Object,
+      default: function () {
+        return {
+          textStyle: "#3fc0fb",
+          series: {
+            color: ["#00bcd44a", "transparent"],
+            dataColor: {
+              normal: "#03a9f4",
+              shadowColor: "#97e2f5"
+            }
+          }
+        };
+      }
+    }
+  },
+  watch: {
+    // tips 是会变更的数据,所以进行监听
+    tips: {
+      handler (newData) {
+        this.options = {
+          title:{
+            text: newData * 1 + "%",
+            x: "center",
+            y: "center",
+            textStyle: {
+              color: this.colorObj.textStyle,
+              fontSize: 15
+            }
+          },
+          series: [
+            {
+              type: "pie",
+              radius: ["95%", "80%"],
+              center: ["50%", "50%"],
+              hoverAnimation: false,
+              color: this.colorObj.series.color,
+              label: {
+                normal: {
+                  show: false
+                }
+              },
+              data: [
+                {
+                  value: newData,
+                  itemStyle: {
+                    normal: {
+                      color: this.colorObj.series.dataColor.normal,
+                      shadowBlur: 10,
+                      shadowColor: this.colorObj.series.dataColor.shadowColor
+                    }
+                  }
+                },
+                {
+                  value: 100 - newData
+                }
+              ],
+              height: '90%',
+            }
+          ]
+        }
+      },
+      immediate: true,
+      deep: true
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 186 - 0
src/components/smtechart/centerLeft/centerLeft1ALLChart/chart.vue

@@ -0,0 +1,186 @@
+<template>
+  <div>
+    <!-- 年度开工率 -->
+    <Echart
+      :options="options"
+      id="centerLeft1ALLChart"
+      height="250px"
+      width="450px"
+      ref="column-board"
+    ></Echart>
+  </div>
+</template>
+
+<script>
+import Echart from '@/common/echart'
+//import { formatDate } from '../../../../utils/index.js'
+export default {
+    data () {
+    return {
+      timing :null,
+      options:{
+        tooltip: {
+          trigger: 'axis',
+          axisPointer: {
+            type: 'shadow'
+          }
+        },
+        legend: {
+          textStyle: {
+            fontSize: 18
+          },
+          itemWidth: 29,
+          itemHeight: 19
+        },
+        grid: {
+          left: '0%',
+          right: '0%',
+          bottom: '3%',
+          containLabel: true
+        },
+        xAxis: [
+          {
+            type: 'category',
+            axisLabel: {
+              show: false,
+              fontSize: 16,
+              fontWeight: "bold"
+            }
+          }
+        ],
+        yAxis: [
+          {
+            type: 'value',
+            axisLabel: {
+              fontSize: 16
+            }
+          },
+
+        ],
+        series: [
+          {
+            name: '计划数',
+            type: 'bar',
+            barWidth: 70,
+            emphasis: {
+              focus: 'series'
+            },
+            data:[],
+            label: {
+              show: true,
+              position: 'top',
+              fontSize:14,
+              fontWeight: "bold"
+            },
+          },
+          {
+            name: '投入数',
+            type: 'bar',
+            barWidth: 70,
+            emphasis: {
+              focus: 'series'
+            },
+            data:[],
+            label: {
+              show: true,
+              position: 'top',
+              color:'#fff'
+            },
+          },
+          {
+            name: '产出数',
+            type: 'bar',
+            stack: 'Ad',
+            barWidth: 70,
+            data:[],
+            emphasis: {
+              focus: 'series'
+            },
+            label: {
+              show: true,
+              position: 'top',
+              color:'#fff'
+            }
+          },
+          {
+            name: '不良数',
+            type: 'bar',
+            barWidth: 70,
+            data:[],
+            label: {
+              show: true,
+              position: 'top',
+              color:'#fff'
+            },
+            emphasis: {
+              focus: 'series'
+            }
+          }
+        ]
+      },
+    };
+  },
+  components: {
+    Echart, //子组件
+  },
+  props: {
+    cdata: {
+      type: Object,
+      default: () => ({})
+    },
+  },
+
+  mounted() {
+    this.getdata();
+    this.refreshdata();
+  },
+  beforeDestroy () {
+    clearInterval(this.timing)
+  },
+  methods: {
+    refreshdata() {
+      this.timing = setInterval(() => {
+        this.getdata(); //获取-数据
+      }, 30000);
+    },
+    async getdata() {
+      //20220211 -+formatDate(new Date()
+      var caller = 'MAKEQTY';
+      if (sessionStorage.getItem('li_code') == '所有'){
+        caller = 'SMT!MAKEQTY!ALL';
+      }
+      await this.$http.get("kanban/datalist.action?caller="+caller+"&_noc=1&page=1&pageSize=100",{
+        params: {
+          condition: "1=1",
+        }
+      }).then((result)=>{
+                        let dataList = JSON.parse(result.data.data);
+                        let series0 = new Array();
+                        let series1 = new Array();
+                        let series2 = new Array();
+                        let series3 = new Array();
+                        let xAxis0 = new Array();
+                        for (let index = 0; index < dataList.length; index++) {
+                          const element = dataList[index];
+                          xAxis0.push(element.inqty);
+                          series0.push(element.planqty);
+                          //投入
+                          series1.push(element.inqty);
+                          //产出
+                          series2.push(element.outqty);
+                          //不良
+                          series3.push(element.ngqty);
+                        }
+                        this.options.xAxis[0].data = xAxis0;
+                        this.options.series[0].data = series0;
+                        this.options.series[1].data = series1;
+                        this.options.series[2].data = series2;
+                        this.options.series[3].data = series3;
+                      },(result)=>{
+                        console.error(result)
+                      }
+              );
+    }
+  }
+}
+</script>

+ 44 - 0
src/components/smtechart/centerLeft/centerLeft1ALLChart/index.vue

@@ -0,0 +1,44 @@
+<template>
+  <div>
+    <Chart :cdata="cdata" />
+  </div>
+</template>
+
+<script>
+import Chart from './chart.vue'
+export default {
+  data () {
+    return {
+      cdata: {
+        rateData:[
+        ]
+      }
+    };
+  },
+  components: {
+    Chart,
+  },
+  mounted () {
+    //this.setData();
+  },
+  beforeDestroy () {
+    clearInterval(this.intervalId);
+    this.chart.dispose()
+    this.chart.clear()
+    this.chart=null
+  },
+  methods: {
+    // 根据自己的业务情况修改
+    setData () {
+      for (let i = 0; i < this.cdata.barData.length -1; i++) {
+        let rate = this.cdata.barData[i] / this.cdata.lineData[i];
+        this.cdata.rateData.push(rate.toFixed(2));
+      }
+      console.log(this)
+    },
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 81 - 0
src/components/smtechart/centerLeft/centerLeft1Chart/chart.vue

@@ -0,0 +1,81 @@
+<template>
+  <div>
+    <Echart
+      :options="options"
+      id="centreLeft1Chart"
+      height="350px"
+      width="315px"
+    ></Echart>
+  </div>
+</template>
+
+<script>
+import Echart from '@/common/echart'
+export default {
+  data () {
+    return {
+      options: {},
+    };
+  },
+  components: {
+    Echart,
+  },
+  props: {
+    cdata: {
+      type: Object,
+      default: () => ({})
+    },
+  },
+  watch: {
+    cdata: {
+      handler (newData) {
+        this.options = {
+          color: [
+            "#37a2da",
+            "#32c5e9",
+            "#9fe6b8",
+            "#ffdb5c",
+            "#ff9f7f",
+            "#fb7293",
+            "#e7bcf3",
+            "#8378ea"
+          ],
+          tooltip: {
+            trigger: "item",
+            formatter: "{a} <br/>{b} : {c} ({d}%)"
+          },
+          toolbox: {
+            show: true
+          },
+          calculable: true,
+          legend: {
+            orient: "vertical",
+            icon: "circle",
+            bottom: 0,
+            x: "center",
+            data: newData.cdata,
+            textStyle: {
+              color: "#fff",
+            },
+          },
+          series: [
+            {
+              name: "不良现象统计",
+              type: "pie",
+              radius: [15, 60],
+              roseType: "area",
+              center: ["50%", "30%"],
+              data: newData.seriesData,
+            }
+          ]
+        }
+      },
+      immediate: true,
+      deep: true
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 92 - 0
src/components/smtechart/centerLeft/centerLeft1Chart/index.vue

@@ -0,0 +1,92 @@
+<template>
+  <div>
+    <Chart :cdata="cdata" />
+  </div>
+</template>
+
+<script>
+import Chart from './chart.vue';
+import { formatDate } from '../../../../utils/index.js';
+export default {
+  data () {
+    return {
+      cdata: {
+        intervalId :null,
+        xData:[],// ["data1", "data2", "data3", "data4", "data5", "data6"],
+        seriesData:[] /* [
+          { value: 10, name: "data1" },
+          { value: 5, name: "data2" },
+          { value: 15, name: "data3" },
+          { value: 25, name: "data4" },
+          { value: 20, name: "data5" },
+          { value: 35, name: "data6" }
+        ]*/
+      }
+    }
+  },
+  components: {
+    Chart,
+  },
+  mounted () {
+    this.getdata();
+    this.refreshdata();
+  },
+  beforeDestroy () {
+    clearInterval(this.intervalId);
+    this.chart.dispose()
+    this.chart.clear()
+    this.chart=null
+  },
+  methods: {
+    refreshdata() {
+      this.intervalId = setInterval(() => {
+        this.getdata(); //获取-数据
+      }, 30000);
+    },
+    async getdata() {
+      //20220211 -+formatDate(new Date()
+      var caller = 'NGREASONF';
+      if (sessionStorage.getItem('li_code') == '所有'){
+        caller = 'NGREASONF!ALL';
+      }
+      await this.$http.get("kanban/datalist.action?caller="+caller+"&_noc=1&page=1&pageSize=100",
+              {
+                params: {
+                  condition: "mb_ymd="+formatDate(new Date())
+                }
+              }).then((result)=>{
+                        let dataList = JSON.parse(result.data.data);
+                        let xData0 = new Array();
+                        let seriesData0 = new Array();
+                        let sum1 = 0;
+                        let totalsum = 0;
+                        for (let index = 0; index < dataList.length; index++) {
+                          const element = dataList[index];
+                          let ob = new Object();
+                          xData0.push(element.mb_badname);
+                          ob.value = element.v_cn;
+                          ob.name = element.mb_badname;
+                          seriesData0.push(ob);
+                          sum1 +=element.v_cn;
+                          totalsum = element.v_sum;
+                        }
+                      if(totalsum-sum1>0){
+                        xData0.push('其它');
+                        let ob = new Object();
+                        ob.value = totalsum-sum1;
+                        ob.name = '其它';
+                        seriesData0.push(ob);
+                      }
+                       this.cdata.xData = xData0;
+                       this.cdata.seriesData = seriesData0;
+                      },(result)=>{
+                        console.error(result)
+                      }
+              );
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 203 - 0
src/views/smt/centerLeft1ALL.vue

@@ -0,0 +1,203 @@
+<template>
+  <div id="centerLeft1ALL">
+    <div class="bg-color-black">
+      <div class="d-flex pt-2 pl-2">
+        <span>
+          <icon name="chart-bar" class="text-icon"></icon>
+        </span>
+        <span class="fs-xl text mx-2 mb-1 pl-3">工单完成情况统计</span>
+      </div>
+      <div class="d-flex jc-center columnperent">
+         <CenterLeft1ALLChart/>
+      </div>
+      <div class="d-flex circleperent">
+          <div class="item"  v-for="item in rate" :key="item.id">
+          <span>{{ item.title }}</span>
+          <CenterChart :id="item.id" :tips="item.tips" :colorObj="item.colorData"/>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import CenterLeft1ALLChart from '@/components/smtechart/centerLeft/centerLeft1ALLChart'
+import CenterChart from '@/components/smtechart/centerLeft/centerChartRate'
+export default {
+  data() {
+    return {
+      titleItem:[],
+      config: {
+        data: [],
+        showValue: true
+      },
+      // 通过率和达标率的组件复用数据
+      rate: [
+        {
+          id: 'centerRate1',
+          tips: 50,
+          colorData: {
+            textStyle: '#31b4fb',
+            series: {
+              color: ['rgba(19,122,244,0.29)', 'transparent'],
+              dataColor: {
+                normal: '#137af4',
+                shadowColor: '#80e0f5'
+              }
+            }
+          }
+        },
+        {
+          id: 'centerRate2',
+          tips: 60,
+          colorData: {
+            textStyle: '#43cfe9',
+            series: {
+              color: ['#00bcd44a', 'transparent'],
+              dataColor: {
+                normal: '#32C5E9',
+                shadowColor: '#9fe5f5'
+              }
+            }
+          }
+        },
+        {
+          id: 'centerRate3',
+          tips: 60,
+          colorData: {
+            textStyle: '#6ad59c',
+            series: {
+              color: ['rgba(25,161,95,0.29)', 'transparent'],
+              dataColor: {
+                normal: '#00a11a',
+                shadowColor: '#6cda9c'
+              }
+            }
+          }
+        }
+      ],
+      intervalId :null
+    }
+  },
+  components: {
+    CenterLeft1ALLChart,
+    CenterChart
+  },
+  mounted() {
+    this.changeTiming()
+  },
+  beforeDestroy () {
+   clearInterval(this.intervalId)
+    this.chart.dispose()
+    this.chart.clear()
+    this.chart=null
+  },
+  methods: {
+    changeTiming() {
+      this.changeNumber();
+      this.intervalId =  setInterval(() => {
+        this.changeNumber()
+      }, 20000)
+    },
+    async changeNumber() {
+      var caller2 = 'MakeComRate';
+      if (sessionStorage.getItem('li_code') == '所有'){
+        caller2 = 'SMT!MakeComRate!ALL';
+      }
+      //工单关闭率
+      await this.$http.get("kanban/datalist.action?caller="+caller2+"&_noc=1&page=1&pageSize=100",{
+        params: {
+          condition: "1=1",
+        }
+      }).then((result)=>{
+                let dataList = JSON.parse(result.data.data);
+                for (let index = 0; index < dataList.length; index++) {
+                  const element = dataList[index];
+                  this.rate[index].tips = element.rate;
+                  this.rate[index].title = element.title;
+                }
+              },(result)=>{
+                console.error(result)
+              }
+          );
+
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+$box-height: 420px;
+$box-width: 500px;
+#centerLeft1ALL {
+  padding: 0px;
+  height: $box-height;
+  font-size: 50px;
+  width: $box-width;
+  border-radius: 10px;
+  .bg-color-black {
+    height: $box-height - 10px;
+    border-radius: 10px;
+    padding: 5px;
+  }
+
+  .circleperent {
+    width: 100%;
+    display: flex;
+    flex-wrap: wrap;
+    .item {
+      width: 33%;
+      height: 118px;
+      span {
+        margin-top: 15px;
+        font-size: 18px;
+        display: flex;
+        justify-content: center;
+      }
+    }
+  }
+  .columnperent {
+    width: 100%;
+    display: flex;
+  }
+  .text {
+    color: #FFE900;
+  }
+  .dv-dec-3 {
+    position: relative;
+    width: 150px;
+    height: 20px;
+    top: -3px;
+  }
+
+  .bottom-data {
+    .item-box {
+      & > div {
+        padding-right: 5px;
+      }
+      font-size: 14px;
+      float: right;
+      position: relative;
+      width: 50%;
+      color: #d3d6dd;
+      .dv-digital-flop {
+        width: 120px;
+        height: 30px;
+      }
+      // 金币
+      .coin {
+        position: relative;
+        top: 6px;
+        font-size: 20px;
+        color: #ffc107;
+      }
+      .colorYellow {
+        color: yellowgreen;
+      }
+      p {
+        text-align: center;
+      }
+    }
+  }
+}
+</style>

+ 7 - 1
src/views/smt/index.vue

@@ -92,9 +92,12 @@
               </dv-border-box-12>
             </div>
             <div>
-              <dv-border-box-12>
+              <dv-border-box-12 v-show="linecode!='所有'">
                 <up2 />
               </dv-border-box-12>
+              <dv-border-box-12 v-show="linecode=='所有'">
+                <centerLeft1ALL />
+              </dv-border-box-12>
             </div>
             <div>
               <dv-border-box-12>
@@ -126,6 +129,8 @@ import up3 from './up3'
 import bottom1 from './bottom1'
 import bottom2 from './bottom2'
 import { mapState } from "vuex"
+import centerLeft1ALL from "@/views/smt/centerLeft1ALL.vue";
+
 export default {
   mixins: [ drawMixin ],
   computed: {
@@ -145,6 +150,7 @@ export default {
     }
   },
   components: {
+    centerLeft1ALL,
     up1,
     up2,
     up3,