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

客户退货产品处理审批流程修改
inOrOut
outerInfo字段

Z 2 лет назад
Родитель
Сommit
b55f766247

+ 8 - 3
src/views/bpm/handleTask/components/saleOrder/customerReturnGoods/customerReturnOrder.vue

@@ -305,8 +305,9 @@
             </template>
             <!--////-->
             <!--  ///  生产员审核 -->
-            <template v-slot:inOrOut="{ row }">
-              <el-form-item prop="inOrOut">
+            <template v-slot:inOrOut="{ row,$index }">
+              <el-form-item :prop="'detailList.' + $index + '.inOrOut'"
+                            :rules="{ required: true, trigger: 'change', message: '请选择' }">
                 <el-select v-if="isTrue" v-model="row.inOrOut" @change="()=>row.outerInfo=''">
                   <el-option label="内部" :value="1"/>
                   <el-option label="外部" :value="2"/>
@@ -314,7 +315,9 @@
                 <div v-else>{{ row.inOrOut && (row.inOrOut == 1 ? '内部' : '外部') }}</div>
               </el-form-item>
             </template>
-
+            <template v-slot:headerInOrOut="{ column }">
+              <span class="is-required">{{ column.label }}</span>
+            </template>
             <template v-slot:outerInfo="{ row }">
               <el-form-item prop="outerInfo">
                 <el-input v-if="isTrue&&row.inOrOut==2" v-model="row.outerInfo"></el-input>
@@ -726,6 +729,8 @@ export default {
             label: '内部或外部',
             align: 'center',
             slot: 'inOrOut',
+            headerSlot: 'headerInOrOut'
+
           },
           {
             minWidth: 120,

+ 151 - 150
src/views/bpm/handleTask/components/saleOrder/customerReturnGoods/submit.vue

@@ -44,7 +44,7 @@
         type="success"
         size="mini"
         @click="handleAudit(1)"
-        >通过
+      >通过
       </el-button>
 
       <el-button
@@ -53,148 +53,100 @@
         size="mini"
         v-if="taskDefinitionKey !== 'stater'"
         @click="handleAudit(0)"
-        >驳回
+      >驳回
       </el-button>
     </div>
   </el-col>
 </template>
 
 <script>
-  import {
-    approveTaskWithVariablesAPI,
-    saleReturnUpdateAPI
-  } from '@/api/bpm/components/saleManage/saleorder';
-  import { listAllUserBind } from '@/api/system/organization';
-  import { EventBus } from './eventBus.js';
-  import outin from '@/api/warehouseManagement/outin';
-  // 流程实例的详情页,可用于审批
-  //qcId techId produceId
-  export default {
-    name: '',
-    components: {
-      //   Parser
+import {
+  approveTaskWithVariablesAPI,
+  saleReturnUpdateAPI
+} from '@/api/bpm/components/saleManage/saleorder';
+import {listAllUserBind} from '@/api/system/organization';
+import {EventBus} from './eventBus.js';
+import outin from '@/api/warehouseManagement/outin';
+// 流程实例的详情页,可用于审批
+//qcId techId produceId
+export default {
+  name: '',
+  components: {
+    //   Parser
+  },
+  props: {
+    businessId: {
+      default: ''
     },
-    props: {
-      businessId: {
-        default: ''
-      },
-      taskId: {
-        default: ''
+    taskId: {
+      default: ''
+    },
+    id: {
+      default: ''
+    },
+    taskDefinitionKey: {
+      default: ''
+    }
+  },
+  data() {
+    return {
+      form: {
+        userId: '',
+        reason: ''
       },
-      id: {
-        default: ''
+      submitParams: {
+        QCLeader: 'qcId',
+        techLeader: 'techId',
+        produceLeader: 'produceId'
       },
-      taskDefinitionKey: {
-        default: ''
-      }
-    },
-    data() {
-      return {
-        form: {
-          userId: '',
-          reason: ''
-        },
-        submitParams: {
-          QCLeader: 'qcId',
-          techLeader: 'techId',
-          produceLeader: 'produceId'
-        },
-        rules: {
-          reason: {
-            required: true,
-            message: '请输入审批建议',
-            trigger: 'blur'
-          },
-          userId: { required: true, message: '请选择指派人', trigger: 'change' }
+      rules: {
+        reason: {
+          required: true,
+          message: '请输入审批建议',
+          trigger: 'blur'
         },
-        userOptions: [],
-        activeComp: '',
-        permissionType: ''
-      };
-    },
-    async created() {
-      this.userOptions = [];
-      listAllUserBind().then((data) => {
-        this.userOptions.push(...data);
-      });
-      this.activeComp = this.taskDefinitionKey;
-      EventBus.$on('getActiveCompValue', (row) => {
-        this.activeComp = row.activeComp;
-        this.permissionType = row.permissionType;
-      });
-    },
-    mounted() {},
-    methods: {
-      //保存表格数据
-      async handleAudit(pass) {
-        let data = await this.getTableValue();
-        this.$refs.formRef.validate(async (validate) => {
-          if ((!validate || !data) && !!pass)
-            return this.$message.warning('有必填项未填,请检查');
-          if (this.permissionType == 'update' && !!pass)
-            await saleReturnUpdateAPI(data);
-          let variables = {
-            pass: !!pass
-          };
-          if (this.submitParams[this.taskDefinitionKey]) {
-            variables[this.submitParams[this.taskDefinitionKey]] =
-              this.form.userId;
-          }
-          // 销售退货入库
-          if (this.taskDefinitionKey === 'storeman' && !!pass) {
-            // 获取销售退货入库信息
-            let storageData = await this.getReturnStorage();
-            // 是否已经入库
-            if (storageData.isStorage) {
-              approveTaskWithVariablesAPI({
-                id: this.taskId,
-                reason: this.form.reason,
-                variables
-              }).then((res) => {
-                if (res.code != '-1') {
-                  this.$emit('handleAudit', {
-                    status: pass,
-                    title: !pass ? '驳回' : ''
-                  });
-                }
-              });
-            } else {
-              // 入库来源storageSource 0-正常  1-外部(外部跳过内部审核流程)
-              storageData.storageSource = 1;
-              // 获取货位信息(判断货位信息是否填写)
-              let houseListLength = storageData.outInDetailAddPOList.map(
-                (item) => {
-                  return item.houseList.length;
-                }
-              );
-              let boolen = houseListLength.every((item) => item > 0);
-              if (boolen) {
-                console.log(storageData);
-                try {
-                  const res = await outin.save(storageData);
-                  console.log(res);
-                  if (res.code == 0) {
-                    approveTaskWithVariablesAPI({
-                      id: this.taskId,
-                      reason: this.form.reason,
-                      variables
-                    }).then((res) => {
-                      if (res.code != '-1') {
-                        this.$emit('handleAudit', {
-                          status: pass,
-                          title: !pass ? '驳回' : ''
-                        });
-                      }
-                    });
-                  }
-                } catch (error) {
-                  console.error('保存失败:', error);
-                }
-              } else {
-                this.$message.error('请选择物品货位信息');
-              }
-            }
-          } else {
+        userId: {required: true, message: '请选择指派人', trigger: 'change'}
+      },
+      userOptions: [],
+      activeComp: '',
+      permissionType: ''
+    };
+  },
+  async created() {
+    this.userOptions = [];
+    listAllUserBind().then((data) => {
+      this.userOptions.push(...data);
+    });
+    this.activeComp = this.taskDefinitionKey;
+    EventBus.$on('getActiveCompValue', (row) => {
+      this.activeComp = row.activeComp;
+      this.permissionType = row.permissionType;
+    });
+  },
+  mounted() {
+  },
+  methods: {
+    //保存表格数据
+    async handleAudit(pass) {
+      let data = await this.getTableValue();
+      let updateCode = '1' //判断saleReturnUpdateAPI方法是否执行成功
+      this.$refs.formRef.validate(async (validate) => {
+        if ((!validate || !data) && !!pass) return this.$message.warning('有必填项未填,请检查');
+        if (this.permissionType == 'update' && !!pass) updateCode = await saleReturnUpdateAPI(data);
+        if (typeof updateCode !== 'string') return
+        let variables = {
+          pass: !!pass
+        };
+        if (this.submitParams[this.taskDefinitionKey]) {
+          variables[this.submitParams[this.taskDefinitionKey]] =
+            this.form.userId;
+        }
+        // 销售退货入库
+        if (this.taskDefinitionKey === 'storeman' && !!pass) {
+          // 获取销售退货入库信息
+          let storageData = await this.getReturnStorage();
+          // 是否已经入库
+          if (storageData.isStorage) {
             approveTaskWithVariablesAPI({
               id: this.taskId,
               reason: this.form.reason,
@@ -207,28 +159,77 @@
                 });
               }
             });
+          } else {
+            // 入库来源storageSource 0-正常  1-外部(外部跳过内部审核流程)
+            storageData.storageSource = 1;
+            // 获取货位信息(判断货位信息是否填写)
+            let houseListLength = storageData.outInDetailAddPOList.map(
+              (item) => {
+                return item.houseList.length;
+              }
+            );
+            let boolen = houseListLength.every((item) => item > 0);
+            if (boolen) {
+              console.log(storageData);
+              try {
+                const res = await outin.save(storageData);
+                console.log(res);
+                if (res.code == 0) {
+                  approveTaskWithVariablesAPI({
+                    id: this.taskId,
+                    reason: this.form.reason,
+                    variables
+                  }).then((res) => {
+                    if (res.code != '-1') {
+                      this.$emit('handleAudit', {
+                        status: pass,
+                        title: !pass ? '驳回' : ''
+                      });
+                    }
+                  });
+                }
+              } catch (error) {
+                console.error('保存失败:', error);
+              }
+            } else {
+              this.$message.error('请选择物品货位信息');
+            }
           }
-        });
-      },
-      getTableValue() {
-        return new Promise((resolve, reject) => {
-          this.$emit('getTableValue', async (data) => {
-            resolve(await data);
-          });
-        });
-      },
-      getReturnStorage() {
-        return new Promise((resolve, reject) => {
-          this.$emit('getReturnStorage', async (data) => {
-            resolve(await data);
+        } else {
+          approveTaskWithVariablesAPI({
+            id: this.taskId,
+            reason: this.form.reason,
+            variables
+          }).then((res) => {
+            if (res.code != '-1') {
+              this.$emit('handleAudit', {
+                status: pass,
+                title: !pass ? '驳回' : ''
+              });
+            }
           });
+        }
+      });
+    },
+    getTableValue() {
+      return new Promise((resolve, reject) => {
+        this.$emit('getTableValue', async (data) => {
+          resolve(await data);
         });
-      }
+      });
     },
-    beforeDestroy() {
-      EventBus.$off('getActiveCompValue');
+    getReturnStorage() {
+      return new Promise((resolve, reject) => {
+        this.$emit('getReturnStorage', async (data) => {
+          resolve(await data);
+        });
+      });
     }
-  };
+  },
+  beforeDestroy() {
+    EventBus.$off('getActiveCompValue');
+  }
+};
 </script>
 
 <style lang="scss"></style>