Ver código fonte

fix:5631【流程待办审批领料出库审批】提示锁库不足,但是审批通过也出库了;实际这个也是有库存的’

mlchen 1 semana atrás
pai
commit
2adca6673c

+ 10 - 9
src/views/bpm/handleTask/formParser/formParserDialog.vue

@@ -352,26 +352,27 @@ export default {
       storageData.isMes = 1;
       try {
         this.isSaveLoading = true;
-        await storageApi.outStorage(storageData);
-        approveTaskWithVariables({
+        const approveRes = await approveTaskWithVariables({
           id: this.form.id,
           reason: this.form.reason,
           businessId: this.businessId,
           variables: {
             pass: true
           }
-        }).then((res) => {
-          if (res.data.code != '-1') {
-            this.$message.success(`出库成功!`);
-            this.$emit('reload');
-            this.cancel();
-          }
-          this.isSaveLoading = false;
         });
+        if (approveRes.data.code == '-1') {
+          throw new Error(approveRes.data.msg || '审批失败');
+        }
+        await storageApi.outStorage(storageData);
+        this.$message.success(`出库成功!`);
+        this.$emit('reload');
+        this.cancel();
       } catch (error) {
         this.isSaveLoading = false;
         console.error('出库失败:', error);
+        return;
       }
+      this.isSaveLoading = false;
     },
 
     async _approveTaskWithVariables(status) {