Browse Source

修改单独报工请求接口

695593266@qq.com 9 months ago
parent
commit
24f406b9db

+ 9 - 0
src/api/produce/index.js

@@ -30,6 +30,15 @@ export async function listTask(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 单独报工获取工序列表
+export async function singleListTask(data) {
+  const res = await request.post('/main/producetask/listTaskByWindow', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 // bom 信息
 
 export async function getByTaskId(data) {

+ 6 - 0
src/store/modules/user.js

@@ -44,6 +44,8 @@ export default {
   state: {
     // 当前登录用户信息
     info: null,
+
+    allInfo: null,
     // 当前登录用户的菜单
     menus: null,
     // 当前登录用户的权限
@@ -62,6 +64,10 @@ export default {
     setUserInfo(state, info) {
       state.info = info;
     },
+
+    setAllInfo(state, info) {
+      state.allInfo = info;
+    },
     // 设置登录用户的菜单
     setMenus(state, menus) {
       state.menus = menus;

+ 41 - 14
src/views/produce/index.vue

@@ -355,7 +355,8 @@
     checkOutsourceMaterial,
     listTask,
     factoryworkstationPage,
-    nextTask
+    nextTask,
+    singleListTask
   } from '@/api/produce/index';
 
   export default {
@@ -592,21 +593,47 @@
 
       // 获取工序列表
       getTaskList() {
-        listTask().then((res) => {
-          res.map((v) => {
-            v.newName = `${v.workCenterName}-${v.name}`;
+        console.log(
+          localStorage.getItem('singleUserInfo'),
+          'localStorage.getItem'
+        );
+
+        console.log(this.$store.state.user, 'this.$store.state.user.allInfo');
+        if (localStorage.getItem('singleUserInfo') == '1') {
+          singleListTask(this.$store.state.user.allInfo).then((res) => {
+            res.map((v) => {
+              v.newName = `${v.workCenterName}-${v.name}`;
+            });
+            this.produceTaskList = res;
+            this.arr = JSON.parse(JSON.stringify(this.produceTaskList));
+            //默认选择第一个工序
+            if (this.produceTaskList?.length) {
+              this.$store.commit('user/setTaskObj', this.produceTaskList[0]);
+              this.$nextTick(() => {
+                this.$refs.taskListRef.setCurrentKey(
+                  this.produceTaskList[0].id
+                );
+              });
+            }
           });
-          this.produceTaskList = res;
-          this.arr = JSON.parse(JSON.stringify(this.produceTaskList));
-          //默认选择第一个工序
-          if (this.produceTaskList?.length) {
-            this.$store.commit('user/setTaskObj', this.produceTaskList[0]);
-            this.$nextTick(() => {
-              this.$refs.taskListRef.setCurrentKey(this.produceTaskList[0].id);
+        } else {
+          listTask().then((res) => {
+            res.map((v) => {
+              v.newName = `${v.workCenterName}-${v.name}`;
             });
-          }
-          // newName
-        });
+            this.produceTaskList = res;
+            this.arr = JSON.parse(JSON.stringify(this.produceTaskList));
+            //默认选择第一个工序
+            if (this.produceTaskList?.length) {
+              this.$store.commit('user/setTaskObj', this.produceTaskList[0]);
+              this.$nextTick(() => {
+                this.$refs.taskListRef.setCurrentKey(
+                  this.produceTaskList[0].id
+                );
+              });
+            }
+          });
+        }
       },
 
       // 获取工位

+ 6 - 0
src/views/produceOrder/index.vue

@@ -500,12 +500,18 @@
             align: 'center',
             width: 120,
             formatter: (row) => {
+              if (row.bomType == 1) {
+                return '产品(PBOM)';
+              }
               if (row.bomType == 2) {
                 return '加工(MBOM)';
               }
               if (row.bomType == 3) {
                 return '装配(ABOM)';
               }
+              // if (row.bomType == 4) {
+              //   return '装配(EBOM)';
+              // }
               return '';
             }
           },