whj 1 yıl önce
ebeveyn
işleme
884cb58fde

+ 15 - 0
src/api/purchase/purchase-order.js

@@ -61,6 +61,21 @@ export function getPurchaseReport (parameter) {
     }
   })
 }
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getPieByCondition (parameter) {
+  return axios({
+    url: '/longyanpurchaseorder/order/getPieByCondition?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
 /**
  * page func
  * parameter: { }

+ 2 - 1
src/router/generator-platform-routers.js

@@ -425,7 +425,8 @@ const constantRouterComponents = {
   'PurchaseOrderReportByTime': () => import('@/views/purchase/purchase-order-report/PurchaseOrderReportByTime'),
   'PurchaseOrderReportByFifity': () => import('@/views/purchase/purchase-order-report/PurchaseOrderReportByFifity'),
   'Inventory': () => import('@/views/purchase/inventory/Inventory.vue'),
-  'InventoryList': () => import('@/views/purchase/inventory-list/InventoryList.vue')
+  'InventoryList': () => import('@/views/purchase/inventory-list/InventoryList.vue'),
+  'PurchaseOrderReportPie': () => import('@/views/purchase/purchase-order-report/PurchaseOrderReportPie.vue')
 }
 
 // 前端未找到页面路由(固定不用改)

+ 173 - 49
src/views/purchase/purchase-order-report/PurchaseOrderReportPie.vue

@@ -26,12 +26,21 @@
           </div>
           <a-tab-pane loading="true" tab="图形统计" key="1">
             <a-row>
-              <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
+              <a-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
                 <chart-view :chartOption="chartOption1" width="100%" height="600px" />
               </a-col>
+              <a-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
+                <chart-view :chartOption="chartOption2" width="100%" height="600px" />
+              </a-col>
+              <a-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
+                <chart-view :chartOption="chartOption3" width="100%" height="600px" />
+              </a-col>
+              <a-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
+                <chart-view :chartOption="chartOption4" width="100%" height="600px" />
+              </a-col>
             </a-row>
           </a-tab-pane>
-          <a-tab-pane loading="true" tab="表格统计" key="2">
+          <!-- <a-tab-pane loading="true" tab="表格统计" key="2">
             <a-row>
               <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
                 <div style="padding: 10px">
@@ -53,7 +62,7 @@
                 </div>
               </a-col>
             </a-row>
-          </a-tab-pane>
+          </a-tab-pane> -->
         </a-tabs>
       </div>
     </a-card>
@@ -68,7 +77,7 @@ import PrintInRepairReport from '@/views/dashboard/modules/PrintInRepairReport'
 import Detail from './modules/Detail'
 
 import moment from 'moment'
-import { getPurchaseReport, exportOrder, exportOrderDetail } from '@/api/purchase/purchase-order'
+import { getPieByCondition, exportOrder, exportOrderDetail } from '@/api/purchase/purchase-order'
 
 export default {
   name: 'Analysis',
@@ -104,7 +113,7 @@ export default {
       },
       visible: true,
       chart: null, // 创建一个chart变量
-      chartsData: [],
+      chartsData: [[], [], [], []],
       // 表头
       columns: [
         {
@@ -133,67 +142,179 @@ export default {
           scopedSlots: { customRender: 'action' }
         }
       ],
-      typeMap: {}
+      typeMap: {},
+      cptcodeMap: {}
     }
   },
   computed: {
     chartOption1 () {
+      console.log(this.chartsData)
+      const data = this.chartsData[1].map(item => {
+        return {
+          value: item.num,
+          name: this.cptcodeMap[item.type]
+        }
+      })
       return {
-        // tooltip: {
-        //   trigger: 'axis',
-        //   axisPointer: {
-        //     type: 'shadow'
-        //   }
-        // },
-        legend: {},
+        title: {
+          left: 'center',
+          text: '采购类型统计'
+        },
+        legend: {
+          top: '10%'
+        },
         grid: {
           left: '3%',
           right: '4%',
           bottom: '3%',
           containLabel: true
         },
-        yAxis: {
-          type: 'value',
-          boundaryGap: [0, 0.01]
+        series: [
+          {
+            type: 'pie',
+            center: ['50%', '50%'],
+            radius: [0, 100],
+            label: {
+              formatter: `{b}:{c}`,
+              textBorderColor: '#000',
+              textBorderWidth: 0,
+              fontSize: 16,
+              overflow: 'breakAll',
+              labelLine: {
+                length: 3
+              }
+            },
+
+            data: data
+          }
+        ]
+      }
+    },
+    chartOption2 () {
+      console.log(this.chartsData)
+      const data = this.chartsData[2].map(item => {
+        return {
+          value: item.num,
+          name: item.type
+        }
+      })
+      return {
+        title: {
+          left: 'center',
+          text: '业务类型统计'
+        },
+        legend: {
+          top: '10%'
         },
-        xAxis: {
-          type: 'category',
-          data: this.chartsData.map(item => this.BaseTool.Table.getMapText(this.typeMap, item.purchaseType))
+        grid: {
+          left: '3%',
+          right: '4%',
+          bottom: '3%',
+          containLabel: true
         },
         series: [
           {
-            name: '采购单总数',
-            type: 'bar',
-            data: this.chartsData.map(item => item.orderTotalNum),
-            itemStyle: {
-              normal: {
-                label: {
-                  show: true, // 开启显示
-                  position: 'top', // 在上方显示
-                  textStyle: { // 数值样式
-                    color: 'black',
-                    fontSize: 16
-                  }
-                }
+            type: 'pie',
+            center: ['50%', '50%'],
+            radius: [0, 100],
+            label: {
+              formatter: `{b}:{c}`,
+              textBorderColor: '#000',
+              textBorderWidth: 0,
+              fontSize: 16,
+              overflow: 'breakAll',
+              labelLine: {
+                length: 3
               }
-            }
-          },
+            },
+
+            data: data
+          }
+        ]
+      }
+    },
+    chartOption3 () {
+      console.log(this.chartsData)
+      const data = this.chartsData[3].map(item => {
+        return {
+          value: item.num,
+          name: this.flagMap[item.type]
+        }
+      })
+      return {
+        title: {
+          left: 'center',
+          text: '采购厂区统计'
+        },
+        legend: {
+          top: '10%'
+        },
+        grid: {
+          left: '3%',
+          right: '4%',
+          bottom: '3%',
+          containLabel: true
+        },
+        series: [
           {
-            name: '备件总数',
-            type: 'bar',
-            data: this.chartsData.map(item => item.spareTotalNum),
-            itemStyle: {
-              normal: {
-                label: {
-                  show: true, // 开启显示
-                  position: 'top', // 在上方显示
-                  textStyle: { // 数值样式
-                    color: 'black',
-                    fontSize: 16
-                  }
-                }
+            type: 'pie',
+            center: ['50%', '50%'],
+            radius: [0, 100],
+            label: {
+              formatter: `{b}:{c}`,
+              textBorderColor: '#000',
+              textBorderWidth: 0,
+              fontSize: 16,
+              overflow: 'breakAll',
+              labelLine: {
+                length: 3
               }
-            }
+            },
+
+            data: data
+          }
+        ]
+      }
+    },
+    chartOption4 () {
+      console.log(this.chartsData)
+      const data = this.chartsData[4].map(item => {
+        return {
+          value: item.num,
+          name: this.deptMap[item.type]
+        }
+      })
+      return {
+        title: {
+          left: 'center',
+          text: '申请部门统计'
+        },
+        legend: {
+          top: '10%'
+        },
+        grid: {
+          left: '3%',
+          right: '4%',
+          bottom: '3%',
+          containLabel: true
+        },
+        series: [
+          {
+            type: 'pie',
+            center: ['50%', '50%'],
+            radius: [0, 100],
+            label: {
+              formatter: `{b}:{c}`,
+              textBorderColor: '#000',
+              textBorderWidth: 0,
+              fontSize: 16,
+              overflow: 'breakAll',
+              labelLine: {
+                length: 3
+              }
+            },
+
+            data: data
           }
         ]
       }
@@ -201,6 +322,9 @@ export default {
   },
   created () {
     this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.LONG_YAN_PURCHASE_TYPE)
+    this.cptcodeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.LONG_YAN_PURCHASE_ORDER_PLAN_TYPE)
+    this.flagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PROJECT_NEW_AND_OLD)
+    this.deptMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YONG_YOU_DEPT)
   },
   mounted () {
     this.$nextTick(function () {
@@ -217,7 +341,7 @@ export default {
       this.queryParam.createdTimeEnd = this.BaseTool.Date.formatter(date, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
     },
     getData () {
-      getPurchaseReport(this.queryParam)
+      getPieByCondition()
         .then(res => {
           this.chartsData = res.data
         })