|
|
@@ -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('提交失败,请重新提交!');
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|