xiaost пре 9 месеци
родитељ
комит
fe188f0203

+ 64 - 16
src/components/iqcechart/up11Chart/chart.vue

@@ -4,7 +4,7 @@
         :options="options"
         id="up11Chart"
         height="180px"
-        width="570px"
+        width="590px"
         ref="column-board"
     ></Echart>
   </div>
@@ -36,10 +36,10 @@ export default {
           top:8,
         },
         grid: {
-          left: '4%',
+          left: '3%',
           right: '1%',
           bottom: '3%',
-          top: 65,
+          top: 50,
           containLabel: true
         },
         xAxis: [
@@ -57,13 +57,21 @@ export default {
             type: 'value',
             axisLabel: {
               fontSize: 16
+            },
+            splitLine: {
+              show: true,
+              lineStyle: {
+                // 使用深浅的间隔色
+                type: "dashed",
+                color: ['#aaa', '#aaa']
+              }
             }
           },
         ],
         series: [
           {
             name: '数量',
-            type: 'bar',
+            type: 'line',
             barWidth: 20,
             emphasis: {
               focus: 'series'
@@ -108,23 +116,63 @@ export default {
       }, 30000);
     },
     async getdata() {
-      var caller = 'KB!IQC!CHECK7DAYDATA';
+      var caller = 'KB!IQC!CHECK7DAYDATA1';
       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();
-            for (let index = 0; index < dataList.length; index++) {
-              const element = dataList[index];
-              xAxis0.push(element.v_checkman);
-              //数量
-              series0.push(element.v_count);
+      }).then((result)=> {
+        let dataList = JSON.parse(result.data.data);
+        let series = new Array();
+        // 构建最终数据结构
+        let seriesdata = new Array();
+        if (dataList.length > 0) {
+              // 生成最近7天日期数组(包含今天)
+              const today = new Date()
+              const dateRange = Array.from({length: 7}, (_, i) => {
+                const d = new Date(today)
+                d.setDate(d.getDate() - 6 + i) // 从6天前到今天
+                return `${String(d.getMonth() + 1).padStart(2, '0')}${String(d.getDate()).padStart(2, '0')}`
+              })
+
+              // 按检查员分组并建立日期映射
+              const grouped = dataList.reduce((acc, item) => {
+                if (!acc[item.v_checkman]) {
+                  acc[item.v_checkman] = {}
+                }
+                acc[item.v_checkman][item.v_ymd] = item.v_count
+                return acc
+              }, {})
+
+              seriesdata = Object.keys(grouped).map(name => ({
+                name: name,
+                data: dateRange.map(ymd => grouped[name][ymd] || null)
+              }))
+
+              for (let value of seriesdata) {
+                series.push({
+                  name: value.name,
+                  type: 'line',
+                  data: value.data,
+                  symbolSize: 4,
+                  lineStyle: {
+                    width: 3
+                  },
+                  label: {
+                    show: false,
+                    position: 'top',
+                    fontSize:15,
+                    color:'inherit',
+                    fontWeight: "bold"
+                  },
+                  emphasis: {
+                    focus: 'series'
+                  }
+                });
+              }
+              this.options.xAxis[0].data = dateRange;
+              this.options.series = series;
             }
-           this.options.xAxis[0].data = xAxis0;
-           this.options.series[0].data = series0;
           },(result)=>{
             console.error(result)
           }

+ 1 - 1
src/components/iqcechart/up1Chart/chart.vue

@@ -4,7 +4,7 @@
         :options="options"
         id="up1Chart"
         height="250px"
-        width="570px"
+        width="590px"
         ref="column-board"
     ></Echart>
   </div>

+ 1 - 1
vue.config.js

@@ -11,7 +11,7 @@ module.exports = {
   devServer: {
     proxy: {
       "/mes":{           // /proxy_url 这个用来和根路径 baseURL 进行匹配
-        target:'http://192.168.1.92:8088/mes/',     // target: http://112.48.67.154:8088/mes/ http://192.168.1.92:8088/mes/' ,这个是填写跨域的请求域名+端口号,也就是要请求的URL(不包含URL路径)
+        target:'http://112.48.67.154:8088/mes/',     // target: http://112.48.67.154:8088/mes/ http://192.168.1.92:8088/mes/' ,这个是填写跨域的请求域名+端口号,也就是要请求的URL(不包含URL路径)
         changeOrigin: true,  // 是否允许跨域请求,在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
         pathRewrite: {   // 路径重写
           '^/mes': '' // 替换target中的请求地址,原请求为 http://127.0.0.1:8000/kuayu 实际请求为 http://127.0.0.1:8000/proxy_url/kuayu