|
|
@@ -537,7 +537,6 @@
|
|
|
import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
|
|
|
import purchaseNeedList from '@/views/purchasingManage/purchasePlanManage/components/purchaseNeed-list.vue';
|
|
|
import inquiryList from './inquiryList.vue';
|
|
|
- import { getInventoryTotalAPI } from '@/api/wms';
|
|
|
import modalTitle from '@/BIZComponents/modalTitle.vue';
|
|
|
import {
|
|
|
contactDetail,
|
|
|
@@ -789,18 +788,7 @@
|
|
|
},
|
|
|
productList: info.productList || []
|
|
|
};
|
|
|
- const codeList = form.productList
|
|
|
- .filter((item) => item.productCode)
|
|
|
- .map((item) => item.productCode);
|
|
|
- let inventoryTotalList = await getInventoryTotalAPI(codeList);
|
|
|
- form.productList
|
|
|
- .filter((item) => item.productCode)
|
|
|
- .forEach((item) => {
|
|
|
- let find =
|
|
|
- inventoryTotalList.find((key) => key.code == item.productCode) ||
|
|
|
- {};
|
|
|
- item.availableCountBase = find.availableCountBase;
|
|
|
- });
|
|
|
+
|
|
|
this.$refs.inventoryTable &&
|
|
|
this.$refs.inventoryTable.putTableValue(form.productList);
|
|
|
},
|
|
|
@@ -840,12 +828,18 @@
|
|
|
this.$set(this.form, 'relationCode', data.planCode);
|
|
|
const res = await getplanDetail(data.id);
|
|
|
this.$set(this.form, 'isFirstProcess', res.isFirstProcess);
|
|
|
- if (res.detailList.lenght > 1) {
|
|
|
- this.$refs.planTableListRef.open(res);
|
|
|
+
|
|
|
+ let info = await getProductsBySource({
|
|
|
+ relationId: this.form.relationId,
|
|
|
+ relationType: this.form.relationType
|
|
|
+ });
|
|
|
+ info['rawDetailList'] = info.rawList;
|
|
|
+ info['outputDetailList'] = info.outputList;
|
|
|
+ if (info.productList.lenght > 1) {
|
|
|
+ this.$refs.planTableListRef.open(info);
|
|
|
} else {
|
|
|
- this.putTableValue(res);
|
|
|
+ this.putTableValue(info);
|
|
|
}
|
|
|
-
|
|
|
// let form = {
|
|
|
// contractVO: {
|
|
|
// ...this.form
|
|
|
@@ -861,7 +855,6 @@
|
|
|
// });
|
|
|
// this.$refs.inventoryTable &&
|
|
|
// this.$refs.inventoryTable.putTableValue(form.productList);
|
|
|
- // await this.getLinkInfo(cusInfo?.base?.id)
|
|
|
},
|
|
|
//选择核价单
|
|
|
handInquiry(e) {
|
|
|
@@ -879,76 +872,54 @@
|
|
|
this.$set(this.form, 'relationCode', data.inquiryCode);
|
|
|
const res = await getpurchaseinquiry(data.id);
|
|
|
this.$set(this.form, 'isFirstProcess', res.isFirstProcess);
|
|
|
- res['rawDetailList'] = res.rawList;
|
|
|
- res['outputDetailList'] = res.outputList;
|
|
|
- if (res.detailList.lenght > 1) {
|
|
|
- this.$refs.planTableListRef.open(res);
|
|
|
- } else {
|
|
|
- this.putTableValue(res);
|
|
|
- }
|
|
|
- },
|
|
|
|
|
|
- async putTableValue({ detailList, rawDetailList, outputDetailList }) {
|
|
|
- console.log(detailList, 'detailList');
|
|
|
let info = await getProductsBySource({
|
|
|
relationId: this.form.relationId,
|
|
|
relationType: this.form.relationType,
|
|
|
-
|
|
|
- supplierId: this.form.relationType == 3 ? this.winnerSuppleIds : ''
|
|
|
+ supplierId: this.winnerSuppleIds
|
|
|
});
|
|
|
- let form = {
|
|
|
- contractVO: {
|
|
|
- ...this.form
|
|
|
- },
|
|
|
- productList: detailList || []
|
|
|
+ info['rawDetailList'] = info.rawList;
|
|
|
+ info['outputDetailList'] = info.outputList;
|
|
|
+ if (info.productList.lenght > 1) {
|
|
|
+ this.$refs.planTableListRef.open(info);
|
|
|
+ } else {
|
|
|
+ this.putTableValue(info);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.form = {
|
|
|
+ ...this.form,
|
|
|
+ partbId: info.partbId,
|
|
|
+ partbName: info.partbName,
|
|
|
+ partbAddress: info.partaAddress,
|
|
|
+ partbLinkId: info.partaAddress,
|
|
|
+ partbLinkName: info.partbLinkName,
|
|
|
+ partbEmail: info.partbEmail,
|
|
|
+ partbTel: info.partbTel
|
|
|
};
|
|
|
- if (this.form.relationType == 3) {
|
|
|
- this.form = {
|
|
|
- ...this.form,
|
|
|
- partbId: info.partbId,
|
|
|
- partbName: info.partbName,
|
|
|
- partbAddress: info.partaAddress,
|
|
|
- partbLinkId: info.partaAddress,
|
|
|
- partbLinkName: info.partbLinkName,
|
|
|
- partbEmail: info.partbEmail,
|
|
|
- partbTel: info.partbTel
|
|
|
- };
|
|
|
- await this.getLinkInfo(info.partbId);
|
|
|
- this.$nextTick(() => {
|
|
|
- let firstLink =
|
|
|
- this.linkNameOptions.find((item) => item.ifChief == 1) || {};
|
|
|
- this.form = Object.assign({}, this.form, {
|
|
|
- partbLinkId: firstLink.id || this.linkNameOptions[0]?.id,
|
|
|
- partbLinkName:
|
|
|
- firstLink.linkName || this.linkNameOptions[0]?.linkName,
|
|
|
- partbTel:
|
|
|
- firstLink.mobilePhone || this.linkNameOptions[0]?.mobilePhone
|
|
|
- });
|
|
|
- this.setProductInfo();
|
|
|
+ await this.getLinkInfo(info.partbId);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let firstLink =
|
|
|
+ this.linkNameOptions.find((item) => item.ifChief == 1) || {};
|
|
|
+ this.form = Object.assign({}, this.form, {
|
|
|
+ partbLinkId: firstLink.id || this.linkNameOptions[0]?.id,
|
|
|
+ partbLinkName:
|
|
|
+ firstLink.linkName || this.linkNameOptions[0]?.linkName,
|
|
|
+ partbTel:
|
|
|
+ firstLink.mobilePhone || this.linkNameOptions[0]?.mobilePhone
|
|
|
});
|
|
|
- }
|
|
|
+ this.setProductInfo();
|
|
|
+ });
|
|
|
+ await this.changeParent({ id: info.partbId });
|
|
|
+ },
|
|
|
+
|
|
|
+ async putTableValue({ productList, rawDetailList, outputDetailList }) {
|
|
|
|
|
|
- const codeList = [
|
|
|
- ...form.productList,
|
|
|
- ...rawDetailList,
|
|
|
- ...outputDetailList
|
|
|
- ].map((item) => item.productCode);
|
|
|
- let inventoryTotalList = await getInventoryTotalAPI(codeList);
|
|
|
- [...form.productList, ...rawDetailList, ...outputDetailList].forEach(
|
|
|
- (item) => {
|
|
|
- let find =
|
|
|
- inventoryTotalList.find((key) => key.code == item.productCode) ||
|
|
|
- {};
|
|
|
- item.availableCountBase = find.availableCountBase;
|
|
|
- }
|
|
|
- );
|
|
|
this.$refs.inventoryTable &&
|
|
|
- this.$refs.inventoryTable.putTableValue(form.productList);
|
|
|
+ this.$refs.inventoryTable.putTableValue(productList);
|
|
|
this.$refs.rawDetailListRef &&
|
|
|
this.$refs.rawDetailListRef.putTableValue(rawDetailList); //原料
|
|
|
this.$refs.outputDetailListRef &&
|
|
|
this.$refs.outputDetailListRef.putTableValue(outputDetailList);
|
|
|
- await this.changeParent({ id: info.partbId });
|
|
|
},
|
|
|
|
|
|
// //选择需求类型
|
|
|
@@ -1221,8 +1192,7 @@
|
|
|
contractNo: obj.contractNo,
|
|
|
relationId: obj.id,
|
|
|
relationName: obj.contractName,
|
|
|
- relationCode: obj.contractNo,
|
|
|
-
|
|
|
+ relationCode: obj.contractNo
|
|
|
});
|
|
|
|
|
|
await this.getPlanInfo(this.form.contractId);
|