quwangxin %!s(int64=2) %!d(string=hai) anos
pai
achega
6b71a61110

+ 2 - 2
src/views/saleOrder/components/plan-submit.vue

@@ -67,9 +67,9 @@
         <el-button @click="submit(2)" type="primary" :loading="loading"
           >提交并发布</el-button
         >
-        <!-- <el-button type="primary" @click="submit(1)" :loading="loading"
+        <el-button type="primary" @click="submit(1)" :loading="loading"
           >提交</el-button
-        > -->
+        >
       </div>
     </div>
   </el-dialog>

+ 52 - 77
src/views/saleOrder/salesToProduction.vue

@@ -561,87 +561,62 @@
       async publishData(type) {
         let params = deepClone(this.form);
         params.categoryId = params.salesOrders[0]?.categoryId;
-
-        const code = await getCode('product_order_code');
-        const data = {
-          productionPlan: params,
-          workOrder: {
-            productionPlanCode: params.code,
-            code: code,
-            formingNum: params.contractNum,
-            formingWeight: params.sumOrderWeight,
-            produceVersionId: params.produceVersionId,
-            status: 4,
-            model: params.model,
-            brandNo: params.brandNo,
-            categoryId: params.categoryId
-          }
-        };
-        if (this.$route.query.type == 'edit') {
-          data.workOrder.productionPlanId = params.id;
+        if (this.$route.query.type != 'edit') {
+          delete params.id;
         }
+        if (type === 2) {
+          const code = await getCode('product_order_code');
+          const data = {
+            productionPlan: params,
+            workOrder: {
+              productionPlanCode: params.code,
+              code: code,
+              formingNum: params.contractNum,
+              formingWeight: params.sumOrderWeight,
+              produceVersionId: params.produceVersionId,
+              status: 4,
+              model: params.model,
+              brandNo: params.brandNo,
+              categoryId: params.categoryId,
+              productCode: params.productCode,
+              productName: params.productName
+            }
+          };
+          if (this.$route.query.type == 'edit') {
+            data.workOrder.productionPlanId = params.id;
+          }
 
-        const key = getRouteTabKey();
-        releaseSave(data)
-          .then(() => {
-            this.$message.success('发布成功!');
-            this.$router.push({
-              path: '/productionPlan'
+          const key = getRouteTabKey();
+          releaseSave(data)
+            .then(() => {
+              this.$message.success('发布成功!');
+              this.$router.push({
+                path: '/productionPlan'
+              });
+              removePageTab({ key });
+            })
+            .catch(() => {
+              this.$message.error('发布失败,请重新发布!');
             });
-            removePageTab({ key });
-          })
-          .catch(() => {
-            this.$message.error('发布失败,请重新发布!');
-          });
-
-        // let request =
-        //   this.$route.query.type == 'edit' ? updateSaleToPlan : saveSaleToPlan;
-        // if (this.$route.query.type != 'edit') {
-        //   delete params.id;
-        // }
+        } else {
+          let request =
+            this.$route.query.type == 'edit'
+              ? updateSaleToPlan
+              : saveSaleToPlan;
 
-        // request(params)
-        //   .then(async (res) => {
-        //     // reloadPageTab({ fullPath: '/saleOrder' });
-        //     // if (type == 1) {
-        //     //   // 提交
-        //     //   this.$router.push({
-        //     //     path: '/productionPlan'
-        //     //   });
-        //     // } else {
-        //     //   // 提交并发布
-        //     //   this.$router.push({
-        //     //     path: '/productionPlan/workOrderPublish',
-        //     //     query: {
-        //     //       type: 2,
-        //     //       id: res
-        //     //     }
-        //     //   });
-        //     // }
-        //     const code = await getCode('product_order_code');
-        //     const params = [
-        //       {
-        //         productionPlanCode: params.code,
-        //         productionPlanId: res,
-        //         code: code,
-        //         formingNum: this.form.contractNum,
-        //         formingWeight: this.form.sumOrderWeight
-        //       }
-        //     ];
-        //     const data = await release(params);
-        //     if (data) {
-        //       this.$message.success('发布成功!');
-        //     } else {
-        //       this.$message.error('发布失败,请重新发布!');
-        //     }
-        //     this.$router.push({
-        //       path: '/productionPlan'
-        //     });
-        //     removePageTab({ key });
-        //   })
-        //   .catch(() => {
-        //     this.$message.error('发布失败,请重新发布!');
-        //   });
+          request(params)
+            .then(async (res) => {
+              reloadPageTab({ fullPath: '/saleOrder' });
+              // 提交
+              this.$router.push({
+                path: '/productionPlan'
+              });
+              removePageTab({ key });
+            })
+            .catch(() => {
+              this.$message.error('提交失败,请重新提交!');
+            });
+        }
       }
     }
   };