فهرست منبع

feat(工单统计): 重构工单统计功能以包含更多工单类型

liujt 2 ماه پیش
والد
کامیت
adee7dd9b7

+ 30 - 1
src/api/bpm/components/inspectionManage/index.js

@@ -1,6 +1,13 @@
 import request from '@/utils/request';
 import store from '@/store';
 import Vue from 'vue';
+import {
+  getMyPage,
+} from '@/api/mes/produceOrder/index.js';
+import {
+  getList as getInspectionWorkList
+} from '@/api/qms/inspectionWork/index.js';
+import { getPlanOrderList } from '@/api/warehouseManagement/inventory';
 
 /**
  * 查询量具送检信息
@@ -36,10 +43,32 @@ export async function getList(params) {
 // 我的工单统计
 export async function statistics(params) {
   const res = await request.get('/eam/PdaWorkOrder/statistics', { params });
+  const productionsRes = await getMyPage({
+    queryTermination: 0,
+    pageNum: 1,
+    size: 1,
+    statusList: [4, 5, 7],
+    workCenterIds: store.state.user.info.workCenterIds
+  })
+
+  const inspectionWorkRes = await getInspectionWorkList({
+    pageNum: 1,
+    size: 1,
+    currentLoginUserId: store.state.user.info.userId,
+    status: 0,
+  })
+
+  const workRes = await getPlanOrderList({
+    pageNum: 1,
+    size: 1,
+    executorId: store.state.user.info.userId,
+    status: 0,
+  })
+  const totalCount = res.data.data.total + productionsRes.count + inspectionWorkRes.count + workRes.count + 0
   if (res.data.code == 0) {
     store.dispatch('user/setMenuBadge', {
       path: '/tickets',
-      value: res.data.data.total || 0,
+      value: totalCount || 0,
       color: 'danger'
     });
     // console.log('-----statistics---user--------');

+ 44 - 8
src/views/bpm/tickets/index.vue

@@ -35,6 +35,13 @@
   import inspectionWork from './inspectionWork';
   import productions from './productions';
   import work from './work';
+  import {
+    getMyPage,
+  } from '@/api/mes/produceOrder/index.js';
+  import {
+    getList
+  } from '@/api/qms/inspectionWork/index.js';
+  import { getPlanOrderList } from '@/api/warehouseManagement/inventory';
   export default {
     components: {
       patrolInspection,
@@ -90,26 +97,55 @@
       }
     },
     methods: {
-      setCount() {
-        statistics().then((data) => {
+      async setCount() {
+        const productionsRes = await getMyPage({
+          queryTermination: 0,
+          pageNum: 1,
+          size: 1,
+          statusList: [4, 5, 7],
+          workCenterIds: this.$store.state.user.info.workCenterIds
+        })
+
+        const inspectionWorkRes = await getList({
+          pageNum: 1,
+          size: 1,
+          currentLoginUserId: this.$store.state.user.info.userId,
+          status: 0,
+        })
+
+        const workRes = await getPlanOrderList({
+          pageNum: 1,
+          size: 1,
+          executorId: this.$store.state.user.info.userId,
+          status: 0,
+        })
+
+        const eamRes = await statistics()
+        console.log('productionsRes~~~', productionsRes);
+        // statistics().then((data) => {
           this.tabOptions = this.tabOptions.map((item) => {
             console.log(item);
             switch (item.key) {
               case 'maintenance':
-                return { ...item, count: data.maintenanceNum };
+                return { ...item, count: eamRes.maintenanceNum };
               case 'patrolInspection':
-                return { ...item, count: data.patrolInspection };
+                return { ...item, count: eamRes.patrolInspection };
               case 'delivery':
-                return { ...item, count: data.quantityNum };
+                return { ...item, count: eamRes.quantityNum };
               case 'repair':
-                return { ...item, count: data.repairsNum };
+                return { ...item, count: eamRes.repairsNum };
+              case 'productions':
+                return { ...item, count: productionsRes.count || 0 };
               case 'inspectionWork':
-                return { ...item, count: data.inspectionWork || 0 };
+                return { ...item, count: inspectionWorkRes.count || 0 };
+              case 'work':
+                return { ...item, count: workRes.count || 0 }; 
               default:
                 return item;
             }
           });
-        });
+          console.log('tabOptions~~~', this.tabOptions);
+        // });
       }
     }
   };

+ 3 - 1
src/views/bpm/tickets/inspectionWork/index.vue

@@ -688,11 +688,13 @@
           where.status = this.way == 'todo' ? 0 : 1;
         // }
 
-        return getList({
+        this.$emit('recount');
+        const res = await getList({
           ...where,
           pageNum: page,
           size: limit
         });
+        return res;
       },
       search(where) {
         this.$refs.table.reload({

+ 1 - 3
src/views/bpm/tickets/productions/index.vue

@@ -981,8 +981,6 @@
       /* 表格数据源 */
       async datasource({ page, limit, where, order }) {
         console.log(this.tabValue, '888');
-        let statusList = this.tabValue == 1 ? [4, 5, 7] : [this.tabValue];
-
         let params = {
           ...where,
           ...order,
@@ -1003,7 +1001,7 @@
         let res = await URL({ ...params });
 
         this.loadTaskNames(res.list);
-
+        this.$emit('recount');
         return res;
       },
 

+ 4 - 2
src/views/bpm/tickets/work/index.vue

@@ -173,10 +173,12 @@
         this.$refs.disposeDialogRef.open(row.id);
       },
       /* 表格数据源 */
-      datasource({ page, limit, where, order }) {
+      async datasource({ page, limit, where, order }) {
         where.status = this.way == 'todo' ? 0 : 2;
         where.executorId = this.userInfo.userId;
-        return getPlanOrderList({ pageNum: page, size: limit, ...where });
+        this.$emit('recount');
+        const res = await getPlanOrderList({ pageNum: page, size: limit, ...where });
+        return res;
       },
       async changeEnable(row) {
         const res = await putRoles(row);