Browse Source

多品类车间看板修改

callm 1 year ago
parent
commit
dd727edc81

+ 242 - 24
src/components/dplechart/bottom/bottomLeft2Chart/index.vue

@@ -1,44 +1,262 @@
 <template>
   <div>
-    <Chart :cdata="cdata" />
+    <!-- 年度开工率 -->
+    <Echart
+        :options="options"
+        id="bottomLeft2Chart"
+        height="480px"
+        width="100%"
+        ref="column-board"
+    ></Echart>
   </div>
 </template>
 
 <script>
-import Chart from './chart.vue'
+import Echart from '@/common/echart'
+//import { formatDate } from '../../../../utils/index.js'
 export default {
   data () {
     return {
-      cdata: {
-        rateData:[
+      timing :null,
+      options:{
+        tooltip: {
+          trigger: 'axis',
+          axisPointer: {
+            type: 'shadow'
+          }
+        },
+        legend: {
+          textStyle: {
+            fontSize: 18
+          },
+          itemWidth: 29,
+          itemHeight: 19
+        },
+        grid: {
+          left: '3%',
+          right: '4%',
+          bottom: '3%',
+          containLabel: true
+        },
+        xAxis: [
+          {
+            type: 'category',
+            data:[],
+            axisLabel: {
+              fontSize: 16,
+              fontWeight: "bold"
+            }
+          }
+        ],
+        yAxis: [
+          {
+            type: 'value',
+            axisLabel: {
+              fontSize: 16
+            }
+          },
+          {
+            type: 'value',
+            name: 'rate',
+            min: 0,
+            max: 100,
+            interval: 20,
+            nameTextStyle: {
+              fontSize: 20
+            },
+            axisLabel: {
+              formatter: '{value}%',
+              fontSize: 16
+            }
+          }
+
+        ],
+        series: [
+          {
+            name: '投入',
+            type: 'bar',
+            barWidth: 15,
+            emphasis: {
+              focus: 'series'
+            },
+            data:[],
+            label: {
+              show: true,
+              position: 'top',
+              fontSize:14,
+              fontWeight: "bold"
+            },
+          },
+          {
+            name: '产出',
+            type: 'bar',
+            barWidth: 15,
+            stack: 'Ad',
+            emphasis: {
+              focus: 'series'
+            },
+            data:[],
+            label: {
+              show: true,
+              position: 'inside',
+              fontSize:14,
+              fontWeight: "bold"
+            },
+          },
+          {
+            name: '不良',
+            type: 'bar',
+            stack: 'Ad',
+            barWidth: 10,
+            data:[],
+            //data: [12, 22, 32, 12, 32, 12, 32],
+            emphasis: {
+              focus: 'series'
+            }
+          },
+          {
+            name: '良率%',
+            type: 'line',
+            data:[],
+            yAxisIndex: 1,
+            symbolSize: 8,
+            label: {
+              show: true,
+              position: 'top',
+              color:'#fff'
+            },
+            tooltip: {
+              valueFormatter: function (value) {
+                return value + '%';
+              }
+            },
+            lineStyle: {
+              width: 4
+            },
+            itemStyle: {
+              normal: {
+                barBorderRadius: 6,
+                color:  "rgba(156,107,211,0.8)"
+                /* color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
+                   { offset: 0, color: "rgba(156,107,211,0.8)" },
+                   { offset: 0.2, color: "rgba(156,107,211,0.5)" },
+                   { offset: 1, color: "rgba(156,107,211,0.2)" }
+                 ])*/
+              }
+            },
+            emphasis: {
+              focus: 'series'
+            }
+          }, {
+            name: 'UPH',
+            type: 'bar',
+            barWidth: 15,
+            data:[],
+            //data: [12, 22, 32, 12, 32, 12, 32],
+            emphasis: {
+              focus: 'series'
+            },
+            label: {
+              show: true,
+              position: 'top',
+              fontSize:14,
+              fontWeight: "bold"
+            }
+          }
         ]
-      }
+      },
     };
   },
   components: {
-    Chart,
+    Echart, //子组件
+  },
+  props: {
+    cdata: {
+      type: Object,
+      default: () => ({})
+    },
   },
-  mounted () {
-    //this.setData();
+
+  mounted() {
+    this.getdata();
+    this.refreshdata();
   },
   beforeDestroy () {
-    clearInterval(this.intervalId);
-    this.chart.dispose()
-    this.chart.clear()
-    this.chart=null
+    clearInterval(this.timing)
   },
   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)
+    refreshdata() {
+      this.timing = setInterval(() => {
+        this.getdata(); //获取-数据
+      }, 30000);
     },
+    async getdata() {
+      //20220211 -+formatDate(new Date()
+      var caller = 'WCDAYTURNOUT';
+      if (sessionStorage.getItem('li_code') == '所有'){
+        caller = 'WCDAYTURNOUT!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 xAxis0 = new Array();
+            let series0 = new Array();
+            let series1 = new Array();
+            let series2 = new Array();
+            let series3 = new Array();
+            let series4 = new Array();
+            for (let index = 0; index < dataList.length; index++) {
+              const element = dataList[index];
+              xAxis0.push(element.sp_wccode);
+              //投入
+              series0.push(element.v_inqty);
+              //产出
+              series1.push(element.v_outqty);
+              //不良
+              series2.push(element.v_ngqty);
+              //良率
+              series3.push(element.v_okrate);
+              //UPH
+              series4.push(element.uph);
+            }
+            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;
+            this.options.series[4].data = series4;
+            /*let myChart = this.$children[0].chart;
+            myChart.setOption({
+               xAxis: {
+                 data: xAxis0
+               },
+               series: [
+                 {
+                   // 根据名字对应到相应的系列
+                   name: '投入',
+                   data: series0
+                 },
+                 {
+                   name: '产出',
+                   data: series2
+                 }, {
+                   name: '不良',
+                   data: series3
+                 },
+                 {
+                   name: '不良率%',
+                   data: series4
+                 },
+               ]
+             });*/
+          },(result)=>{
+            console.error(result)
+          }
+      );
+    }
   }
-};
-</script>
-
-<style lang="scss" scoped>
-</style>
+}
+</script>

+ 105 - 0
src/components/dplechart/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/dplechart/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 = 'DPL!MAKEQTY';
+      if (sessionStorage.getItem('li_code') == '所有'){
+        caller = 'DPL!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/dplechart/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>

+ 1 - 1
src/components/dplechart/centerLeft/centerLeft1Chart/index.vue

@@ -10,8 +10,8 @@ import { formatDate } from '../../../../utils/index.js';
 export default {
   data () {
     return {
-      intervalId :null,
       cdata: {
+        intervalId :null,
         xData:[],// ["data1", "data2", "data3", "data4", "data5", "data6"],
         seriesData:[] /* [
           { value: 10, name: "data1" },

+ 1 - 1
src/views/dpl/center.vue

@@ -63,7 +63,7 @@ export default {
         headerBGC: '#0f1325', //表头
         oddRowBGC: '#0f1325', //奇数行
         evenRowBGC: '#171c33', //偶数行
-        columnWidth: [150,110,140],
+        columnWidth: [150,90,110],
         align: ['center']
       },
       timing : null,

+ 203 - 0
src/views/dpl/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/dplechart/centerLeft/centerLeft1ALLChart'
+import CenterChart from '@/components/dplechart/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 = 'DPL!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 - 2
src/views/dpl/index.vue

@@ -49,7 +49,7 @@
                 </span>
                   <el-dropdown-menu slot="dropdown">
                     <el-dropdown-item ><router-link to="dip"> DIP车间 </router-link></el-dropdown-item>
-                    <el-dropdown-item ><router-link to="package"> 点胶车间 </router-link></el-dropdown-item>
+                    <el-dropdown-item ><router-link to="dj"> 点胶车间 </router-link></el-dropdown-item>
                     <el-dropdown-item ><router-link to="package"> 包装车间 </router-link></el-dropdown-item>
                     <el-dropdown-item ><router-link to="assembly"> 组装车间 </router-link></el-dropdown-item>
                     <el-dropdown-item ><router-link to="smt">SMT车间</router-link></el-dropdown-item>
@@ -73,9 +73,12 @@
           <!-- 第三行数据 -->
           <div class="content-box">
             <div>
-              <dv-border-box-12>
+              <dv-border-box-12 v-show="linecode!='所有'">
                 <centerLeft_two />
               </dv-border-box-12>
+              <dv-border-box-12 v-show="linecode=='所有'">
+                <centerLeft1ALL />
+              </dv-border-box-12>
             </div>
             <div>
               <dv-border-box-12>
@@ -123,6 +126,7 @@ import centerRight1 from './centerRight1'
 import center from './center'
 import bottomLeft2 from './bottomLeft2'
 import bottomRight from './bottomRight'
+import centerLeft1ALL from "@/views/dpl/centerLeft1ALL.vue";
 
 export default {
   mixins: [ drawMixin ],
@@ -143,6 +147,7 @@ export default {
     }
   },
   components: {
+    centerLeft1ALL,
     centerLeft1,
     centerLeft_two,
     centerRight1,