Просмотр исходного кода

Merge branch 'moss_dev2' of https://gogs.zfire.top/zfire-front/zfire-newmall-admin into linwenxin_dev

# Conflicts:
#	src/views/bigViews/dataView1/components/orderStatistics.vue
#	src/views/bigViews/dataView1/components/orderTrend.vue
#	src/views/bigViews/dataView1/components/workOrderStatistics.vue
#	src/views/bigViews/dataView1/components/workOrderTrend.vue
linwenxin 1 год назад
Родитель
Сommit
c6da58ddce

+ 46 - 0
src/api/bigView.js

@@ -0,0 +1,46 @@
+import request, { postBlob, getBlob, handleImport } from '@/utils/request'
+
+// 辅配件统计
+export function getMaterialStats(params) {
+  return request({
+    url: '/big/getLarge4',
+    method: 'post',
+    params
+  })
+}
+
+// 工单统计
+export function getWorkorderStats(params) {
+  return request({
+    url: '/big/getLarge5',
+    method: 'post',
+    params
+  })
+}
+
+// 订单统计
+export function getOrderStats(params) {
+  return request({
+    url: '/big/getLarge7',
+    method: 'post',
+    params
+  })
+}
+
+// 订单金额趋势
+export function getOrderTrend(params) {
+  return request({
+    url: '/big/getLarge8',
+    method: 'post',
+    params
+  })
+}
+
+// 订单金额趋势
+export function getWorkorderTrend(params) {
+  return request({
+    url: '/big/getLarge6',
+    method: 'post',
+    params
+  })
+}

+ 3 - 1
src/components/moduleEnclosure.vue

@@ -61,11 +61,12 @@ export default {
   z-index: 999;
 }
 .am-moduleEnclosureTitle-div {
-  width: 100%;
   height: 20px;
   display: flex;
   flex-direction: row;
   align-items: center;
+  flex-shrink: 0;
+  margin-right: 20px;
 }
 .am-moduleEnclosureTitle {
   width: 100%;
@@ -73,6 +74,7 @@ export default {
   display: flex;
   flex-direction: row;
   align-items: center;
+  justify-content: space-between;
   margin-top: -4px;
   font-size: 14px;
   font-family: Source Han Sans CN, Source Han Sans CN-Bold;

+ 81 - 26
src/views/bigViews/dataView1/components/accessoryStatistics.vue

@@ -1,37 +1,92 @@
 <template>
-  <moduleEnclosure title="近30日辅配件统计">
-    <div class="heat-lay">
-    </div>
-  </moduleEnclosure>
+	<moduleEnclosure title="近30日辅配件统计">
+		<div class="all-container">
+			<div class="item">
+				<div class="title">辅材销售</div>
+				<div class="num">{{statsData.fcxs || 0}}单</div>
+			</div>
+			<div class="item">
+				<div class="title">辅材退货</div>
+				<div class="num">{{statsData.fcth || 0}}单</div>
+			</div>
+			<div class="item">
+				<div class="title">配件销售</div>
+				<div class="num">{{statsData.pjxs || 0}}单</div>
+			</div>
+			<div class="item">
+				<div class="title">配件退货</div>
+				<div class="num">{{statsData.pjth || 0}}单</div>
+			</div>
+			<div class="item">
+				<div class="title">新件待返还</div>
+				<div class="num">{{statsData.xjdfh || 0}}件</div>
+			</div>
+			<div class="item">
+				<div class="title">旧件待返还</div>
+				<div class="num">{{statsData.jjdfh || 0}}件</div>
+			</div>
+			<div class="item">
+				<div class="title">旧件待返厂</div>
+				<div class="num">{{statsData.jjdfc || 0}}件</div>
+			</div>
+		</div>
+	</moduleEnclosure>
 </template>
 
 <script>
-import moduleEnclosure from '@/components/moduleEnclosure.vue';
-export default {
-  components: {
-    moduleEnclosure,
-  },
-  data() {
-    return {
-      
-    };
-  },
-  mounted() {
+	import moduleEnclosure from '@/components/moduleEnclosure.vue';
+	import { getMaterialStats } from '@/api/bigView.js';
 
-  },
-  beforeUnmount() {
+	export default {
+		components: {
+			moduleEnclosure,
+		},
+		
+		data() {
+			return {
+				statsData: {},
+			};
+		},
 
-  },
-  methods: {
+		mounted() {
+			this.getData();
+		},
 
-  },
-};
+		beforeUnmount() {
+
+		},
+
+		methods: {
+			getData() {
+				getMaterialStats().then(res => {
+					this.statsData = res.data;
+				})
+			},
+		},
+	};
 </script>
 
 <style scoped lang="scss">
-.heat-lay {
-  width: 100%;
-  height: 100%;
- 
+.all-container {
+	width: 100%;
+	height: 100%;
+	padding-top: 12px;
+	box-sizing: border-box;
+	display: flex;
+	flex-wrap: wrap;
+	.item {
+		width: 25%;
+		height: 50%;
+		.title {
+			font-size: 14px;
+			color: #ffffff;
+			margin-bottom: 8px;
+		}
+		.num {
+			color: #33a8c9;
+			font-size: 18px;
+			font-weight: bold;
+		}
+	}
 }
-</style>
+</style>

+ 161 - 14
src/views/bigViews/dataView1/components/orderAmountTrend.vue

@@ -1,43 +1,190 @@
 <template>
   <moduleEnclosure title="近30日订单金额趋势">
-    <div class="dvScrollBoardView">
-      
+    <div class="all-container">
+      <div id="orderEcharts2" style="width: 100%; height: 100%"></div>
     </div>
   </moduleEnclosure>
 </template>
 
 <script>
+import * as echarts from 'echarts';
 import moduleEnclosure from '@/components/moduleEnclosure.vue';
-import img0 from '@/assets/xia.png';
-import img1 from '@/assets/shang.png';
-import img2 from '@/assets/y1.png';
-import img3 from '@/assets/y2.png';
-import img4 from '@/assets/y3.png';
-import { getQuery13, getQuery14 } from '@/api/bigView.js';
-var timeling = 5000;
+import { getOrderTrend } from '@/api/bigView.js';
+
 export default {
   components: {
     moduleEnclosure,
   },
+
   data() {
     return {
-     
+      
     };
   },
-  mounted() {
-    
+
+  async mounted() {
+    getOrderTrend().then(res => {
+      this.initEcharts(res.data);
+    })
   },
+
   beforeUnmount() {
     
   },
+
   methods: {
-    
+    getDate() {
+      const today = new Date();
+      const dates = [];
+      
+      for (let i = 0; i < 30; i++) {
+        const d = new Date();
+        d.setDate(today.getDate() - i);
+        dates.push(d.toISOString().split('T')[0].slice(5, 11));
+      }
+      
+      return dates;
+    },
+
+    initEcharts(data) {
+      var chartDom = document.getElementById('orderEcharts2');
+      var myChart = echarts.init(chartDom);
+      var option;
+
+      option = {
+        title: {
+          text: ''
+        },
+        tooltip: {
+          trigger: 'axis',
+          transitionDuration: 0,
+          backgroundColor: '#092a66',
+          borderColor: '#0462b5',
+          borderRadius: 8,
+          borderWidth: 2,
+          padding: [5, 10],
+          axisPointer: {
+            type: 'line',
+            lineStyle: {
+              type: 'dashed',
+              color: '#8AB1DC',
+            },
+          },
+          textStyle: {
+            color: '#ffffff'
+          }
+        },
+        legend: {
+          icon: 'circle',
+          data: ['新增销售金额', '新增辅材金额', '新增配件金额', '新增增值金额'],
+          textStyle: {
+            color: '#ffffff'
+          },
+          right: 0,
+        },
+        grid: {
+          left: '3%',
+          right: '4%',
+          bottom: '3%',
+          containLabel: true
+        },
+        toolbox: {
+          // feature: {
+          //   saveAsImage: {}
+          // }
+        },
+        xAxis: {
+          type: 'category',
+          boundaryGap: false,
+          axisLine: {
+            lineStyle: {
+              color: '#ffffff', // x轴文字颜色
+            }
+          },
+          splitLine: {
+            show: true,
+            lineStyle: {
+              color: '#364D95', // x轴辅助线颜色
+            }
+          },
+          data: this.getDate()
+        },
+        yAxis: {
+          type: 'value',
+          name: "(元)",
+          nameTextStyle: {
+            color: "#aaa",
+            nameLocation: "start",
+            align: 'right'
+          },
+          axisLine: {
+            lineStyle: {
+              color: '#ffffff', // y轴文字颜色
+            }
+          },
+          splitLine: {
+            show: true,
+            lineStyle: {
+              color: '#364D95', // y轴辅助线颜色
+            }
+          }
+        },
+        series: [
+          {
+            name: '新增销售金额',
+            type: 'line',
+            stack: 'Total',
+            itemStyle: {
+              normal: {
+                color: '#FDFE02',
+              },
+            },
+            data: data.map(o => o.sxddje)
+          },
+          {
+            name: '新增辅材金额',
+            type: 'line',
+            stack: 'Total',
+            itemStyle: {
+              normal: {
+                color: '#44E28F',
+              },
+            },
+            data: data.map(o => o.fcddje)
+          },
+          {
+            name: '新增配件金额',
+            type: 'line',
+            stack: 'Total',
+            itemStyle: {
+              normal: {
+                color: '#41C5E2',
+              },
+            },
+            data: data.map(o => o.pjddje)
+          },
+          {
+            name: '新增增值金额',
+            type: 'line',
+            stack: 'Total',
+            itemStyle: {
+              normal: {
+                color: '#D73A79',
+              },
+            },
+            data: data.map(o => o.zzddje)
+          }
+        ]
+      };
+
+      option && myChart.setOption(option);
+    }
   },
 };
 </script>
 
 <style scoped lang="scss">
-.dvScrollBoardView {
+.all-container {
   width: 100%;
   height: 100%;
   box-sizing: border-box;

+ 81 - 208
src/views/bigViews/dataView1/components/orderStatistics.vue

@@ -1,225 +1,98 @@
 <template>
   <moduleEnclosure title="近30日累计订单统计">
-    <div
-      style="
-        width: 100%;
-        height: 100%;
-        box-sizing: border-box;
-        padding-top: 12px;
-        position: relative;
-      "
-    >
-      <div
-        id="echarts5"
-        style="width: 100%; height: 100%"
-        class="echarts5div"
-      ></div>
+    <div class="all-container">
+      <div class="table-container">
+        <div class="th row">
+          <div>订单类型</div>
+          <div>累计订单数</div>
+          <div>累计订单金额</div>
+        </div>
+        <div class="td row">
+          <div>销售订单</div>
+          <div>{{statsData.sxdds}}</div>
+          <div>{{statsData.sxddje}}</div>
+        </div>
+        <div class="td row">
+          <div>辅材订单</div>
+          <div>{{statsData.fcdds}}</div>
+          <div>{{statsData.fcddje}}</div>
+        </div>
+        <div class="td row">
+          <div>配件订单</div>
+          <div>{{statsData.pjdds}}</div>
+          <div>{{statsData.pjddje}}</div>
+        </div>
+        <div class="td row">
+          <div>增值订单</div>
+          <div>{{statsData.zzdds}}</div>
+          <div>{{statsData.zzddje}}</div>
+        </div>
+      </div>
     </div>
   </moduleEnclosure>
 </template>
 
 <script>
-import moduleEnclosure from '@/components/moduleEnclosure.vue';
-import * as echarts from 'echarts';
-import { getQuery8 } from '@/api/bigView.js';
-import { csize } from '@/utils/const.js';
-import bus from '@/utils/eventBus.js';
-export default {
-  components: { moduleEnclosure },
-  data() {
-    return {
-      myChart: null,
-      list: [],
-      aaaaa: false,
-    };
-  },
-  watch: {
-    aaaaa() {
-      if (this.aaaaa) {
-        bus.emit('autoplay', false);
-      } else {
-        bus.emit('autoplay', true);
-      }
+  import moduleEnclosure from '@/components/moduleEnclosure.vue';
+	import { getOrderStats } from '@/api/bigView.js';
+  export default {
+    components: { moduleEnclosure },
+
+    data() {
+      return {
+        statsData: {},
+      };
     },
-  },
-  mounted() {
-    // this.timeId = getQuery8((res) => {
-    //   this.echarts_5(res.data);
-    // }, 50000);
-  },
-  beforeUnmount() {
-    this.timeId();
-  },
-  methods: {
-    echarts_5(value = []) {
-      this.list = value.sort((a, b) => {
-        return b.cut - a.cut;
-      });
-      if (this.myChart) {
-        this.myChart.dispose();
-      }
-      this.myChart = new echarts.init(document.getElementById('echarts5'));
-      this.myChart.setOption({
-        tooltip: {
-          formatter: function (params) {
-            return `<div style="color:#fff;">${params.seriesName}: ${params.name} (${params.percent}%)</div>`;
-          },
-          trigger: 'item',
-          transitionDuration: 0,
-          backgroundColor: '#092a66',
-          borderColor: '#0462b5',
-          borderRadius: 8,
-          borderWidth: 2,
-          padding: [0, 0],
-          axisPointer: {
-            type: 'line',
-            lineStyle: {
-              type: 'dashed',
-              color: '#8AB1DC',
-            },
-          },
-        },
-        // visualMap: {
-        //   show: false,
-        //   min: 400,
-        //   max: 500,
-        //   inRange: {},
-        // },
-        series: [
-          {
-            name: '类型',
-            type: 'pie',
-            radius: ['50%', '70%'],
-            center: ['50%', '50%'],
-            color: ['#21c8fb', '#ffc737', '#ea539b', '#59cfe6', '#8061ff'],
-            data: this.list
-              .slice(0, 8)
-              .map((item) => {
-                return {
-                  name: item.btype,
-                  value: item.cut,
-                };
-              })
-              .filter((item) => item.value > 0),
-            roseType: 'radius',
-            label: {
-              normal: {
-                formatter: ['{b|{b}:{d}%}', '{c|{c}单}'].join('\n'),
-                rich: {
-                  b: {
-                    color: '#fff',
-                    fontSize: csize(11),
-                    lineHeight: csize(11),
-                  },
-                  c: {
-                    color: 'rgb(98,137,169)',
-                    fontSize: csize(11),
-                    lineHeight: csize(11),
-                    height: csize(11),
-                  },
-                },
-              },
-            },
-            labelLine: {
-              normal: {
-                lineStyle: {
-                  color: 'rgb(98,137,169)',
-                },
-                smooth: 0.2,
-                length: 10,
-                length2: 20,
-              },
-            },
-          },
-        ],
-      });
+
+    mounted() {
+      this.getData();
+    },
+
+    beforeUnmount() {
+      
+    },
+
+    methods: {
+      getData() {
+				getOrderStats().then(res => {
+					this.statsData = res.data;
+				})
+			},
     },
-  },
-};
+  };
 </script>
 <style scoped lang="scss">
-.niiono {
-  position: fixed;
-  top: 0;
-  left: 0;
-  right: 0;
-  bottom: 0;
-  z-index: 1999;
-}
-.biuhoij {
-  display: inline-block;
-  position: absolute !important;
-  top: -8px;
-  right: -18px;
-}
-.minwiuhdu {
-  width: 150px;
-  text-align: right;
-}
-.setwidth {
-  width: 200px;
-  text-align: center;
-}
-table {
+.all-container {
   width: 100%;
-  border-collapse: collapse;
+  height: 100%;
+  box-sizing: border-box;
+  padding-top: 12px;
+  position: relative;
 }
-
-table caption {
-  font-size: 2em;
-  font-weight: bold;
-  margin: 1em 0;
-}
-
-th,
-td {
-  border: 1px solid #ddd;
-  text-align: center;
-  padding: 6px 6px;
-}
-
-table thead tr {
-  background-color: #008c8c;
-  color: #fff;
-}
-
-table tbody tr:nth-child(odd) {
-  background-color: #eee;
-}
-
-table tbody tr:hover {
-  background-color: #ccc;
-}
-table tfoot tr td {
-  padding-right: 20px;
-}
-.echarts5div {
-  position: absolute;
-  left: 0;
-  bottom: -14px;
-}
-.classbtns {
-  width: 80px;
-  height: 28px;
+.table-container {
+  height: 100%;
   display: flex;
-  flex-direction: row;
-  align-items: center;
-  border: 2px solid #0e72e6;
-  cursor: pointer;
-  transform: translatex(-10px);
-  div {
-    width: 100%;
-    height: 100%;
-    text-align: center;
-    line-height: 28px;
-  }
-
-  div:nth-child(1) {
-    border-right: 2px solid #0e72e6;
-  }
-  .select {
-    background: #0e72e6;
-    color: #bbd4ff;
+  flex-direction: column;
+  justify-content: space-between;
+  .row {
+    display: flex;
+    &.th {
+      font-weight: bold;
+      color: #26A3CE;
+    }
+    &.td {
+      color: #ffffff;
+    }
+    div {
+      flex: 1;
+      font-size: 14px;
+      &:nth-child(2) {
+        text-align: center;
+      }
+      &:nth-child(3) {
+        text-align: right;
+      }
+    }
   }
 }
 </style>

+ 135 - 42
src/views/bigViews/dataView1/components/orderTrend.vue

@@ -1,15 +1,16 @@
 <template>
   <moduleEnclosure title="近30日订单趋势">
-    <div id="main3" style="width: 100%; height: 100%"></div>
+    <div id="orderEcharts1" style="width: 100%; height: 100%"></div>
   </moduleEnclosure>
 </template>
 
 <script>
 import moduleEnclosure from '@/components/moduleEnclosure.vue';
 import * as echarts from 'echarts';
-import { getQuery10 } from '@/api/bigView.js';
+import { getOrderTrend } from '@/api/bigView.js';
 import { csize } from '@/utils/const.js';
 let myChart4;
+
 export default {
   components: {
     moduleEnclosure,
@@ -20,40 +21,50 @@ export default {
     };
   },
   mounted() {
-    // this.timeId = getQuery10((res) => {
-    //   this.init_myChart2(res.data);
-    // }, 40000);
+    getOrderTrend().then(res => {
+      this.initEcharts(res.data);
+    })
   },
+
   beforeUnmount() {
-    this.timeId();
+    
   },
+
   methods: {
-    init_myChart2(value) {
-      var times = value.map((item) => {
-        var str1 = item.ddate.split(' ')[0];
-        return str1.slice(5);
+    getDate() {
+      const today = new Date();
+      const dates = [];
+      
+      for (let i = 0; i < 30; i++) {
+        const d = new Date();
+        d.setDate(today.getDate() - i);
+        dates.push(d.toISOString().split('T')[0].slice(5, 11));
+      }
+      
+      return dates;
+    },
+
+    initEcharts(data) {
+      var times = this.getDate();
+      var data1 = data.map((item) => {
+        return item.sxdds || 0;
+      });
+      var data2 = data.map((item) => {
+        return item.fcdds || 0;
       });
-      var data1 = value.map((item) => {
-        return item.completeOrder || 0;
+      var data3 = data.map((item) => {
+        return item.pjdds || 0;
       });
-      var data2 = value.map((item) => {
-        return item.totalOrder || 0;
+      var data4 = data.map((item) => {
+        return item.zzdds || 0;
       });
       if (myChart4) {
         myChart4.dispose();
       }
-      myChart4 = new echarts.init(document.getElementById('main3'));
+      myChart4 = new echarts.init(document.getElementById('orderEcharts1'));
       myChart4.setOption({
         tooltip: {
           trigger: 'axis',
-          formatter: function (params) {
-            var res = '';
-            for (var i = 0, l = params.length; i < l; i++) {
-              res +=
-                '' + params[i].seriesName + ' : ' + params[i].value + '<br>';
-            }
-            return `<div style="color:#fff;">${res}</div>`;
-          },
           transitionDuration: 0,
           backgroundColor: '#092a66',
           borderColor: '#0462b5',
@@ -67,6 +78,9 @@ export default {
               color: '#8AB1DC',
             },
           },
+          textStyle: {
+            color: '#ffffff'
+          }
         },
         legend: {
           icon: 'circle',
@@ -75,18 +89,16 @@ export default {
           itemGap: 10,
           top: '16',
           right: '10',
-          data: ['维修新增', '维修完成'],
+          data: ['新增销售单', '新增辅材单', '新增配件单', '新增增值单'],
           textStyle: {
-            fontSize: csize(16),
-            color: '#8AB1DC',
+            color: '#ffffff',
           },
         },
         grid: {
-          x: csize(65),
-          y: csize(50),
-          x2: csize(30),
-          y2: csize(30),
-          containLabel: false,
+          left: '3%',
+          right: '4%',
+          bottom: '3%',
+          containLabel: true
         },
         xAxis: [
           {
@@ -96,7 +108,6 @@ export default {
               interval: Math.floor(times.length / 10),
               showMinLabel: true, //是否显示最小 tick 的 label
               showMaxLabel: true, //是否显示最大 tick 的 label
-              fontSize: csize(12),
             },
             axisLine: {
               show: false,
@@ -113,9 +124,11 @@ export default {
         yAxis: [
           {
             type: 'value',
-            name: '单',
+            name: '/台)',
             nameTextStyle: {
-              fontSize: csize(16),
+              color: "#aaa",
+              nameLocation: "start",
+              // align: 'right'
             },
             axisLine: {
               show: false,
@@ -141,7 +154,7 @@ export default {
         ],
         series: [
           {
-            name: '维修新增',
+            name: '新增销售单',
             type: 'line',
             smooth: true,
             showSymbol: false,
@@ -160,11 +173,11 @@ export default {
                   [
                     {
                       offset: 0,
-                      color: 'rgba(137, 189, 27, 0.3)',
+                      color: 'rgba(253, 173, 96, 0.3)',
                     },
                     {
                       offset: 0.8,
-                      color: 'rgba(137, 189, 27, 0)',
+                      color: 'rgba(253, 173, 96, 0)',
                     },
                   ],
                   false
@@ -175,13 +188,13 @@ export default {
             },
             itemStyle: {
               normal: {
-                color: '#F34799',
+                color: '#FDAD60',
               },
             },
             data: data1,
           },
           {
-            name: '维修完成',
+            name: '新增辅材单',
             type: 'line',
             smooth: true,
             showSymbol: false,
@@ -200,11 +213,11 @@ export default {
                   [
                     {
                       offset: 0,
-                      color: 'rgba(0, 136, 212, 0.3)',
+                      color: 'rgba(68, 226, 143, 0.3)',
                     },
                     {
                       offset: 0.8,
-                      color: 'rgba(0, 136, 212, 0)',
+                      color: 'rgba(68, 226, 143, 0)',
                     },
                   ],
                   false
@@ -215,11 +228,91 @@ export default {
             },
             itemStyle: {
               normal: {
-                color: '#38A0D6',
+                color: '#44E28F',
               },
             },
             data: data2,
           },
+          {
+            name: '新增配件单',
+            type: 'line',
+            smooth: true,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2,
+              },
+            },
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(
+                  0,
+                  0,
+                  0,
+                  1,
+                  [
+                    {
+                      offset: 0,
+                      color: 'rgba(160, 61, 239, 0.3)',
+                    },
+                    {
+                      offset: 0.8,
+                      color: 'rgba(160, 61, 239, 0)',
+                    },
+                  ],
+                  false
+                ),
+                shadowColor: 'rgba(0, 0, 0, 0.1)',
+                shadowBlur: 10,
+              },
+            },
+            itemStyle: {
+              normal: {
+                color: '#A03DEF',
+              },
+            },
+            data: data3,
+          },
+          {
+            name: '新增增值单',
+            type: 'line',
+            smooth: true,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2,
+              },
+            },
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(
+                  0,
+                  0,
+                  0,
+                  1,
+                  [
+                    {
+                      offset: 0,
+                      color: 'rgba(65, 197, 226, 0.3)',
+                    },
+                    {
+                      offset: 0.8,
+                      color: 'rgba(65, 197, 226, 0)',
+                    },
+                  ],
+                  false
+                ),
+                shadowColor: 'rgba(0, 0, 0, 0.1)',
+                shadowBlur: 10,
+              },
+            },
+            itemStyle: {
+              normal: {
+                color: '#41C5E2',
+              },
+            },
+            data: data4,
+          },
         ],
       });
     },

+ 103 - 226
src/views/bigViews/dataView1/components/workOrderStatistics.vue

@@ -1,232 +1,109 @@
 <template>
-  <moduleEnclosure title="近30天累计工单统计">
-    <div id="main4" style="width: 100%; height: 100%"></div>
-  </moduleEnclosure>
+	<moduleEnclosure title="近30天累计工单统计">
+		<div class="all-container">
+			<div class="table-container">
+        <div class="th row">
+          <div>订单类型</div>
+          <div>数量</div>
+          <div>占比</div>
+        </div>
+        <div class="td row">
+          <div>累计安装台数</div>
+          <div>{{statsData.azgd || 0}}</div>
+          <div>{{statsData.azgdzb || 0}}%</div>
+        </div>
+				<div class="td row">
+          <div>累计维修台数</div>
+          <div>{{statsData.wxgd || 0}}</div>
+          <div>{{statsData.wxgdzb || 0}}%</div>
+        </div>
+				<div class="td row">
+          <div>累计清洗台数</div>
+          <div>{{statsData.qxgd || 0}}</div>
+          <div>{{statsData.qxgdzb || 0}}%</div>
+        </div>
+				<div class="td row">
+          <div>增值服务工单</div>
+          <div>{{statsData.zzgd || 0}}</div>
+          <div>{{statsData.zzgdzb || 0}}%</div>
+        </div>
+				<div class="td row">
+          <div>维保工程工单</div>
+          <div>{{statsData.wbgd || 0}}</div>
+          <div>{{statsData.wbgdzb || 0}}%</div>
+        </div>
+			</div>
+		</div>
+	</moduleEnclosure>
 </template>
 
 <script>
-import moduleEnclosure from '@/components/moduleEnclosure.vue';
-import * as echarts from 'echarts';
-import { getQuery9 } from '@/api/bigView.js';
-import { csize } from '@/utils/const.js';
-let myChart1;
-export default {
-  components: {
-    moduleEnclosure,
-  },
-  data() {
-    return {
-      myChart: null,
-    };
-  },
-  mounted() {
-    // this.timeId = getQuery9((res) => {
-    //   this.eac(res.data);
-    // }, 60000);
-  },
-  beforeUnmount() {
-    this.timeId();
-  },
-  methods: {
-    eac(value) {
-      var names = [];
-      var fz = 2000;
-      var values1 = [...value].sort((a, b) => {
-        return b.cut - a.cut;
-      });
-      var values2 = [...value].sort((a, b) => {
-        return b.machine_num - a.machine_num;
-      });
-      for (var i = 0; i < 4; i++) {
-        var name1 = values1[i].sales_type;
-        var name2 = values2[i].sales_type;
-        if (!~names.indexOf(name1)) {
-          names.push(name1);
-        }
-        if (!~names.indexOf(name2)) {
-          names.push(name2);
-        }
-      }
-      var obj = {
-        sales_type: '其他',
-        cut: 0,
-        machine_num: 0,
-      };
-      var list = value.filter((item) => {
-        if (
-          ~names.indexOf(item.sales_type) ||
-          item.cut > fz ||
-          item.machine_num > fz
-        ) {
-          return true;
-        } else {
-          obj.cut += item.cut;
-          obj.machine_num += item.machine_num;
-          return false;
-        }
-      });
-      list.push(obj);
-      var dataAxis = list.map((item) => item.sales_type);
-      var data1 = list.map((item) => item.cut);
-      var data2 = list.map((item) => item.machine_num);
-      var option = {
-        tooltip: {
-          trigger: 'axis',
-          formatter: function (params) {
-            var res = '新增工单' + ' : ' + params[0].value + '<br/>';
-            res += '设备总量' + ' : ' + params[1].value + '<br/>';
-            return `<div style="color:#fff;"><div>${params[0].name}</div>${res}</div>`;
-          },
-          transitionDuration: 0,
-          backgroundColor: '#092a66',
-          borderColor: '#0462b5',
-          borderRadius: 8,
-          borderWidth: 2,
-          padding: [5, 10],
-          axisPointer: {
-            type: 'line',
-            lineStyle: {
-              type: 'dashed',
-              color: '#8AB1DC',
-            },
-          },
-        },
-        title: {
-          text: '',
-          subtext: '',
-        },
-        legend: {
-          icon: 'circle',
-          itemWidth: 8,
-          itemHeight: 8,
-          itemGap: 10,
-          top: '16',
-          right: '10',
-          data: ['新增工单', '设备总量'],
-          textStyle: {
-            fontSize: csize(16),
-            color: '#8AB1DC',
-          },
-        },
-        grid: {
-          x: csize(65),
-          y: csize(50),
-          x2: csize(30),
-          y2: csize(30),
-        },
-        xAxis: {
-          data: dataAxis,
-          axisLabel: {
-            /*inside: true,*/
-            interval: 0,
-            textStyle: {
-              fontSize: csize(16),
-            },
-          },
-          axisTick: {
-            show: false,
-          },
-          axisLine: {
-            show: false,
-            symbol: ['none', 'arrow'],
-            symbolOffset: 12,
-            lineStyle: {
-              fontSize: csize(12),
-              color: '#8AB1DC',
-            },
-          },
-        },
-        yAxis: [
-          {
-            type: 'value',
-            name: '单',
-            nameTextStyle: {
-              fontSize: csize(16),
-            },
-            axisLine: {
-              show: false,
-              lineStyle: {
-                color: '#8AB1DC',
-              },
-            },
-            axisLabel: {
-              margin: 10,
-              textStyle: {
-                fontSize: csize(12),
-              },
-            },
-            splitLine: {
-              lineStyle: {
-                color: '#364D95',
-              },
-            },
-            axisTick: {
-              show: false,
-            },
-          },
-        ],
-        dataZoom: [
-          {
-            type: 'inside',
-          },
-        ],
-        series: [
-          {
-            name: '新增工单',
-            type: 'bar',
-            barGap: 0.2,
-            barWidth: 8,
-            itemStyle: {
-              normal: {
-                show: true,
-                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-                  {
-                    offset: 0,
-                    color: '#35d4cb',
-                  },
-                  {
-                    offset: 1,
-                    color: '#3cf8ed',
-                  },
-                ]),
-                barBorderRadius: 10,
-              },
-            },
-            data: data1,
-          },
-          {
-            name: '设备总量',
-            type: 'bar',
-            barGap: 0.2,
-            barWidth: 8,
-            itemStyle: {
-              normal: {
-                show: true,
-                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-                  {
-                    offset: 0,
-                    color: '#3077bd',
-                  },
-                  {
-                    offset: 1,
-                    color: '#3d99fd',
-                  },
-                ]),
-                barBorderRadius: 10,
-              },
-            },
-            data: data2,
-          },
-        ],
-      };
-      if (myChart1) {
-        myChart1.dispose();
-      }
-      myChart1 = new echarts.init(document.getElementById('main4'));
-      myChart1.setOption(option);
-    },
-  },
-};
+	import moduleEnclosure from '@/components/moduleEnclosure.vue';
+	import { getWorkorderStats } from '@/api/bigView.js';
+
+	export default {
+		components: {
+			moduleEnclosure,
+		},
+		data() {
+			return {
+				statsData: {},
+			};
+		},
+
+		mounted() {
+			this.getData();
+		},
+
+		beforeUnmount() {
+			
+		},
+
+		methods: {
+			getData() {
+				getWorkorderStats().then(res => {
+					this.statsData = res.data;
+				})
+			},
+		},
+	};
 </script>
 
-<style></style>
+<style scoped lang="scss">
+.all-container {
+  width: 100%;
+  height: 100%;
+  box-sizing: border-box;
+  padding-top: 12px;
+  position: relative;
+}
+.table-container {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-between;
+  .row {
+    display: flex;
+    &.th {
+      font-weight: bold;
+      color: #26A3CE;
+    }
+    &.td {
+      color: #ffffff;
+			div:last-child {
+				color: #e4f824;
+			}
+    }
+    div {
+      flex: 1;
+      font-size: 14px;
+      &:nth-child(2) {
+        text-align: center;
+      }
+      &:nth-child(3) {
+        text-align: right;
+      }
+    }
+  }
+}
+</style>

+ 152 - 164
src/views/bigViews/dataView1/components/workOrderTrend.vue

@@ -1,59 +1,87 @@
 <template>
   <moduleEnclosure title="近30天工单趋势">
-    <div id="main2" style="width: 100%; height: 100%"></div>
+	  <template v-slot:rightce>
+	    <div class="tabbar">
+	    	<div
+          class="tab"
+          :class="tabCurrent == item ? 'active' : ''"
+          v-for="(item, index) in tabList"
+          :key="index"
+          @click="changeTab(item)">
+          {{item}}
+        </div>
+	    </div>
+	  </template>
+		<div class="all-container">
+      <div id="workorderEcharts1" style="width: 100%; height: 100%"></div>
+    </div>
   </moduleEnclosure>
 </template>
 
 <script>
 import moduleEnclosure from '@/components/moduleEnclosure.vue';
 import * as echarts from 'echarts';
-import { getQuery11 } from '@/api/bigView.js';
-import { csize } from '@/utils/const.js';
-let myChart3;
+import { getWorkorderTrend } from '@/api/bigView.js';
+
 export default {
   components: {
     moduleEnclosure,
   },
   data() {
     return {
-      myChart2: null,
+      tabList: [],
+      tabCurrent: '',
+      tableData: [],
     };
   },
+
   mounted() {
-    // this.timeId = getQuery11((res) => {
-    //   this.init_myChart2(res.data);
-    // }, 30000);
+    this.initData();
   },
+
   beforeUnmount() {
-    this.timeId();
+    
   },
+
   methods: {
-    init_myChart2(value) {
-      var times = value.map((item) => {
-        var str1 = item.ddate.split(' ')[0];
-        return str1.slice(5);
-      });
-      var data1 = value.map((item) => {
-        return item.completeMachine;
-      });
-      var data2 = value.map((item) => {
-        return item.completeOrder;
-      });
-      if (myChart3) {
-        myChart3.dispose();
+    getDate() {
+      const today = new Date();
+      const dates = [];
+      
+      for (let i = 0; i < 30; i++) {
+        const d = new Date();
+        d.setDate(today.getDate() - i);
+        dates.push(d.toISOString().split('T')[0].slice(5, 11));
       }
-      myChart3 = new echarts.init(document.getElementById('main2'));
-      myChart3.setOption({
+      
+      return dates;
+    },
+
+    changeTab(item) {
+      this.tabCurrent = item;
+      this.initEcharts();
+    },
+
+    initData() {
+      getWorkorderTrend().then(res => {
+        this.tabList = res.data.map(o => o.lx);
+        this.tabCurrent = this.tabList[0];
+        this.tableData = res.data;
+        this.initEcharts();
+      })
+    },
+
+    initEcharts() {
+      var chartDom = document.getElementById('workorderEcharts1');
+      var myChart = echarts.init(chartDom);
+      var option;
+
+      option = {
+        title: {
+          text: ''
+        },
         tooltip: {
           trigger: 'axis',
-          formatter: function (params) {
-            var res = '';
-            for (var i = 0, l = params.length; i < l; i++) {
-              res +=
-                '' + params[i].seriesName + ' : ' + params[i].value + '<br>';
-            }
-            return `<div style="color:#fff;">${res}</div>`;
-          },
           transitionDuration: 0,
           backgroundColor: '#092a66',
           borderColor: '#0462b5',
@@ -67,164 +95,124 @@ export default {
               color: '#8AB1DC',
             },
           },
+          textStyle: {
+            color: '#ffffff'
+          }
         },
         legend: {
           icon: 'circle',
-          itemWidth: 8,
-          itemHeight: 8,
-          itemGap: 10,
-          top: '16',
-          right: '10',
-          data: ['新增', '完成'],
+          data: ['已完工', '未完工'],
           textStyle: {
-            fontSize: csize(16),
-            color: '#8AB1DC',
+            color: '#ffffff'
           },
+          right: 0,
         },
         grid: {
-          x: csize(65),
-          y: csize(50),
-          x2: csize(30),
-          y2: csize(30),
-          containLabel: false,
+          left: '3%',
+          right: '4%',
+          bottom: '3%',
+          containLabel: true
         },
-        xAxis: [
-          {
-            type: 'category',
-            boundaryGap: false,
-            axisLabel: {
-              interval: Math.floor(times.length / 10),
-              showMinLabel: true, //是否显示最小 tick 的 label
-              showMaxLabel: true, //是否显示最大 tick 的 label
-              fontSize: csize(12),
-            },
-            axisLine: {
-              show: false,
-              lineStyle: {
-                color: '#8AB1DC',
-              },
-            },
-            axisTick: {
-              show: false,
-            },
-            data: times,
+        toolbox: {
+          // feature: {
+          //   saveAsImage: {}
+          // }
+        },
+        xAxis: {
+          type: 'category',
+          boundaryGap: false,
+          axisLine: {
+            lineStyle: {
+              color: '#ffffff', // x轴文字颜色
+            }
           },
-        ],
-        yAxis: [
-          {
-            type: 'value',
-            name: '单',
-            nameTextStyle: {
-              fontSize: csize(16),
-            },
-            axisLine: {
-              show: false,
-              lineStyle: {
-                color: '#8AB1DC',
-              },
-            },
-            axisLabel: {
-              margin: 10,
-              textStyle: {
-                fontSize: csize(12),
-              },
-            },
-            splitLine: {
-              lineStyle: {
-                color: '#364D95',
-              },
-            },
-            axisTick: {
-              show: false,
-            },
+          splitLine: {
+            show: true,
+            lineStyle: {
+              color: '#364D95', // x轴辅助线颜色
+            }
+          },
+          data: this.getDate()
+        },
+        yAxis: {
+          type: 'value',
+          name: "(单/台)",
+          nameTextStyle: {
+            color: "#aaa",
+            nameLocation: "start",
+            // align: 'right'
           },
-        ],
+          axisLine: {
+            lineStyle: {
+              color: '#ffffff', // y轴文字颜色
+            }
+          },
+          splitLine: {
+            show: true,
+            lineStyle: {
+              color: '#364D95', // y轴辅助线颜色
+            }
+          }
+        },
         series: [
           {
-            name: '新增',
+            name: '已完工',
             type: 'line',
-            smooth: true,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2,
-              },
-            },
-            areaStyle: {
-              normal: {
-                color: new echarts.graphic.LinearGradient(
-                  0,
-                  0,
-                  0,
-                  1,
-                  [
-                    {
-                      offset: 0,
-                      color: 'rgba(137, 189, 27, 0.3)',
-                    },
-                    {
-                      offset: 0.8,
-                      color: 'rgba(137, 189, 27, 0)',
-                    },
-                  ],
-                  false
-                ),
-                shadowColor: 'rgba(0, 0, 0, 0.1)',
-                shadowBlur: 10,
-              },
-            },
+            stack: 'Total',
             itemStyle: {
               normal: {
-                color: '#1cc840',
+                color: '#FDFE02',
               },
             },
-            data: data1,
+            data: this.tableData.find(o => o.lx == this.tabCurrent).unitNum
           },
           {
-            name: '完成',
+            name: '未完工',
             type: 'line',
-            smooth: true,
-            showSymbol: false,
-            lineStyle: {
-              normal: {
-                width: 2,
-              },
-            },
-            areaStyle: {
-              normal: {
-                color: new echarts.graphic.LinearGradient(
-                  0,
-                  0,
-                  0,
-                  1,
-                  [
-                    {
-                      offset: 0,
-                      color: 'rgba(0, 136, 212, 0.3)',
-                    },
-                    {
-                      offset: 0.8,
-                      color: 'rgba(0, 136, 212, 0)',
-                    },
-                  ],
-                  false
-                ),
-                shadowColor: 'rgba(0, 0, 0, 0.1)',
-                shadowBlur: 10,
-              },
-            },
+            stack: 'Total',
             itemStyle: {
               normal: {
-                color: '#43bbfb',
+                color: '#44E28F',
               },
             },
-            data: data2,
+            data: this.tableData.find(o => o.lx == this.tabCurrent).unitNumWwg
           },
-        ],
-      });
-    },
+        ]
+      };
+
+      option && myChart.setOption(option);
+    }
   },
 };
 </script>
 
-<style></style>
+<style scoped lang="scss">
+.all-container {
+  width: 100%;
+  height: 100%;
+  box-sizing: border-box;
+  padding-top: 16px;
+}
+.tabbar{
+  display: flex;
+  flex-wrap: wrap;
+  .tab{
+    width: 50px;
+    color: #ffffff;
+    border: 1px solid #254280;
+    font-size: 12px;
+    font-weight: bold;
+    padding: 2px 0;
+    margin-right: 10px;
+    text-align: center;
+    cursor: pointer;
+    &:last-child {
+      margin-right: 0;
+    }
+  }
+  .active{
+    border: 1px solid #153781;
+    color: #1a8dc8;
+  }
+}
+</style>

+ 6 - 6
src/views/bigViews/dataView1/index.vue

@@ -5,17 +5,17 @@
         <zj-page-container direction="row">
           <div style="width: 26%">
             <zj-page-container>
-              <div class="module-inner-margin h47">
+              <div class="module-inner-margin" style="height: 28%">
                 <!-- 辅配件统计 -->
                 <accessoryStatistics />
               </div>
-              <div class="module-inner-margin h53">
+              <div class="module-inner-margin" style="height: 38%">
                 <!-- 工单统计 -->
                 <workOrderStatistics />
               </div>
               <div
                 class="module-inner-margin"
-                style="min-height: 30.32%; height: 30.32%"
+                style="min-height: 30.32%; height: 44.32%"
               >
                 <!-- 工单趋势 -->
                 <workOrderTrend />
@@ -34,15 +34,15 @@
           </div>
           <div style="width: 26%">
             <zj-page-container>
-              <div class="module-inner-margin h47">
+              <div class="module-inner-margin" style="height: 28%">
                 <orderStatistics />
               </div>
-              <div class="module-inner-margin h53">
+              <div class="module-inner-margin" style="height: 38%">
                 <orderTrend />
               </div>
               <div
                 class="module-inner-margin"
-                style="min-height: 30.32%; height: 30.32%"
+                style="min-height: 30.32%; height: 44.32%"
               >
                 <orderAmountTrend />
               </div>