Explorar o código

fix: 首页优化

liujt hai 2 semanas
pai
achega
4b823e4756
Modificáronse 2 ficheiros con 47 adicións e 21 borrados
  1. 1 1
      manifest.json
  2. 46 20
      pages/home/pages/manage/manage.vue

+ 1 - 1
manifest.json

@@ -2,7 +2,7 @@
     "name" : "智慧工厂",
     "appid" : "__UNI__45B3907",
     "description" : "",
-    "versionName" : "V1.0.4.08",
+    "versionName" : "V1.0.4.09",
     "versionCode" : "100",
     "transformPx" : false,
     "h5" : {

+ 46 - 20
pages/home/pages/manage/manage.vue

@@ -59,7 +59,7 @@
             <!-- <view class="data-divider"></view> -->
             <view class="data-row">
               <text class="data-label">生产总量</text>
-              <text class="data-value">{{ production.yearTotal }}</text>
+              <text class="data-value">{{ production.yearTotal }}<text class="data-unit">件</text></text>
             </view>
           </view>
           <view class="data-card orange">
@@ -71,7 +71,7 @@
             <!-- <view class="data-divider"></view> -->
             <view class="data-row">
               <text class="data-label">生产总量</text>
-              <text class="data-value">{{ production.monthTotal }}</text>
+              <text class="data-value">{{ production.monthTotal }}<text class="data-unit">件</text></text>
             </view>
           </view>
         </view>
@@ -242,41 +242,41 @@ export default {
           // 混合图表:柱状图(订单量) + 折线图(订单金额)
           series: [
             { name: '月订单量', data: [], type: 'bar' },
-            { name: '去年同期订单量', data: [], type: 'bar' },
+            { name: '月订单量', data: [], type: 'bar' }, // 去年
             { name: '月订单金额', data: [], type: 'line' },
-            { name: '去年同期订单金额', data: [], type: 'line' }
+            { name: '月订单金额', data: [], type: 'line' } // 去年
           ]
         },
         productionChart: {
           series: [
             { name: '生产工单', data: [], type: 'bar' },
-            { name: '去年同期工单', data: [], type: 'bar' },
+            { name: '生产工单', data: [], type: 'bar' },  // 去年
             { name: '生产总量', data: [], type: 'line' },
-            { name: '去年同期总量', data: [], type: 'line' }
+            { name: '生产总量', data: [], type: 'line' }  // 去年
           ]
         },
         purchaseChart: {
           series: [
             { name: '采购数量', data: [], type: 'bar' },
-            { name: '去年同期数量', data: [], type: 'bar' },
+            { name: '采购数量', data: [], type: 'bar' }, // 去年
             { name: '采购金额', data: [], type: 'line' },
-            { name: '去年同期金额', data: [], type: 'line' }
+            { name: '采购金额', data: [], type: 'line' } // 去年
           ]
         },
         materialChart: {
           series: [
             { name: '采购入库', data: [], type: 'bar' },
-            { name: '去年同期入库', data: [], type: 'bar' },
+            { name: '采购入库', data: [], type: 'bar' }, // 去年
             { name: '领料出库', data: [], type: 'line' },
-            { name: '去年同期出库', data: [], type: 'line' }
+            { name: '领料出库', data: [], type: 'line' } // 去年
           ]
         },
         finishedChart: {
           series: [
             { name: '生产入库', data: [], type: 'bar' },
-            { name: '去年同期入库', data: [], type: 'bar' },
+            { name: '生产入库', data: [], type: 'bar' }, // 去年
             { name: '发货出库', data: [], type: 'line' },
-            { name: '去年同期发货', data: [], type: 'line' }
+            { name: '发货出库', data: [], type: 'line' } // 去年
           ]
         }
       }
@@ -337,9 +337,13 @@ export default {
 
       // purchaseChart: 采购走势图
       this.chartData.purchaseChart.series[0].data = quantityArr
+      this.chartData.purchaseChart.series[0].name = '采购数量'
       this.chartData.purchaseChart.series[1].data = lastQuantityArr
+      this.chartData.purchaseChart.series[1].name = '采购数量'
       this.chartData.purchaseChart.series[2].data = amountArr
+      this.chartData.purchaseChart.series[2].name = '采购金额'
       this.chartData.purchaseChart.series[3].data = lastAmountArr
+      this.chartData.purchaseChart.series[3].name = '采购金额'
 
       // 数据更新后刷新图表
       this.$nextTick(() => {
@@ -391,9 +395,13 @@ export default {
 
       // productionChart: 生产走势图
       this.chartData.productionChart.series[0].data = thisOrderArr
+      this.chartData.productionChart.series[0].name = '生产工单'
       this.chartData.productionChart.series[1].data = lastOrderArr
+      this.chartData.productionChart.series[1].name = '生产工单'
       this.chartData.productionChart.series[2].data = thisFormedArr
+      this.chartData.productionChart.series[2].name = '生产总量'
       this.chartData.productionChart.series[3].data = lastFormedArr
+      this.chartData.productionChart.series[3].name = '生产总量'
 
       // 数据更新后刷新图表
       this.$nextTick(() => {
@@ -433,15 +441,23 @@ export default {
 
       // 物料走势图:采购入库 + 领料出库
       this.chartData.materialChart.series[0].data = cgArr
+      this.chartData.materialChart.series[0].name = '采购入库'
       this.chartData.materialChart.series[1].data = lastCgArr
+      this.chartData.materialChart.series[1].name = '采购入库'
       this.chartData.materialChart.series[2].data = llArr
+      this.chartData.materialChart.series[2].name = '领料出库'
       this.chartData.materialChart.series[3].data = lastLlArr
+      this.chartData.materialChart.series[3].name = '领料出库'
 
       // 成品走势图:生产入库 + 发货出库
       this.chartData.finishedChart.series[0].data = scArr
+      this.chartData.finishedChart.series[0].name = '生产入库'
       this.chartData.finishedChart.series[1].data = lastScArr
+      this.chartData.finishedChart.series[1].name = '生产入库'
       this.chartData.finishedChart.series[2].data = fhArr
+      this.chartData.finishedChart.series[2].name = '发货出库'
       this.chartData.finishedChart.series[3].data = lastFhArr
+      this.chartData.finishedChart.series[3].name = '发货出库'
 
       // 数据更新后刷新图表
       this.$nextTick(() => {
@@ -512,9 +528,13 @@ export default {
       })
 
       this.chartData.marketingChart.series[0].data = quantityArr
+      this.chartData.marketingChart.series[0].name = '月订单量'
       this.chartData.marketingChart.series[1].data = lastQuantityArr
+      this.chartData.marketingChart.series[1].name = '月订单量'
       this.chartData.marketingChart.series[2].data = amountArr
+      this.chartData.marketingChart.series[2].name = '月订单金额'
       this.chartData.marketingChart.series[3].data = lastAmountArr
+      this.chartData.marketingChart.series[3].name = '月订单金额'
 
       // 数据更新后刷新图表
       this.$nextTick(() => {
@@ -575,6 +595,7 @@ export default {
 
         // 当前月份,categories 和 data 只显示到当月
         const currentMonthNum = new Date().getMonth() + 1
+        const year = this.currentYear
         const months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
         const categories = months.slice(0, currentMonthNum)
 
@@ -603,39 +624,44 @@ export default {
               color: '#fff',
               fontSize: 12
             },
-            formatter: (function(chartId) {
+            formatter: (function(chartId, year) {
               var isAmountChart = chartId === 'marketingChart' || chartId === 'purchaseChart'
               return function(params) {
                 if (!params || !params.length) return ''
-                var date = params[0].axisValue
+                var date = year + '年' + params[0].axisValue + '月'
                 var thisYear = []
                 var lastYear = []
                 for (var i = 0; i < params.length; i++) {
                   var item = params[i]
-                  if (item.seriesName.indexOf('去年') !== -1) {
+                  if (item.seriesIndex % 2 === 1) {
                     lastYear.push(item)
                   } else {
                     thisYear.push(item)
                   }
                 }
+                function getUnit(seriesName) {
+                  if (seriesName.indexOf('生产总量') !== -1) return '件'
+                  if (isAmountChart && seriesName.indexOf('金额') !== -1) return '万元'
+                  return ''
+                }
                 var result = date
                 if (thisYear.length) {
-                  result += '\n今年:\n'
+                  result += '\n'
                   for (var j = 0; j < thisYear.length; j++) {
-                    var unit = (isAmountChart && thisYear[j].seriesName.indexOf('金额') !== -1) ? '万元' : ''
+                    var unit = getUnit(thisYear[j].seriesName)
                     result += ' ' + thisYear[j].seriesName + '  ' + thisYear[j].value + unit + '\n'
                   }
                 }
                 if (lastYear.length) {
-                  result += '去年\n'
+                  result += '去年同期\n'
                   for (var k = 0; k < lastYear.length; k++) {
-                    var unit2 = (isAmountChart && lastYear[k].seriesName.indexOf('金额') !== -1) ? '万元' : ''
+                    var unit2 = getUnit(lastYear[k].seriesName)
                     result += ' ' + lastYear[k].seriesName + '  ' + lastYear[k].value + unit2 + '\n'
                   }
                 }
                 return result
               }
-            })(domId)
+            })(domId, year)
           },
           legend: {
             show: false