|
|
|
@ -188,7 +188,6 @@ import { |
|
|
|
quotationInformationSearch2, // 询价信息列表查询 |
|
|
|
} from '@/api/quotation/quotationInformation.js' |
|
|
|
import {batchSaveQuote} from "../../../api/quote/quote"; |
|
|
|
import {queryProjectByCustomer} from "../../../api/project/project"; |
|
|
|
import DictDataSelect from "../sys/dict-data-select.vue"; |
|
|
|
import {quotationInformationSearchByAnyField} from "../../../api/quotation/quotationInformation"; |
|
|
|
import FilterSearch from "../../common/filterSearch.vue"; |
|
|
|
@ -624,11 +623,7 @@ export default { |
|
|
|
}, |
|
|
|
// 报价 |
|
|
|
batchQuotation(){ |
|
|
|
this.assertSelectedProjectsCompleted(this.quotationSelections).then(() => { |
|
|
|
this.saveBatchQuotationHeader(this.quotationSelections); |
|
|
|
}).catch((msg) => { |
|
|
|
this.$message.warning(typeof msg === 'string' ? msg : '校验项目状态失败') |
|
|
|
}) |
|
|
|
this.saveBatchQuotationHeader(this.quotationSelections); |
|
|
|
}, |
|
|
|
// 批量新增报价信息 |
|
|
|
saveBatchQuotationHeader(list){ |
|
|
|
@ -661,35 +656,14 @@ export default { |
|
|
|
this.$message.warning("请选择需报价的单号") |
|
|
|
return |
|
|
|
} |
|
|
|
this.assertSelectedProjectsCompleted(this.quotationSelections).then(() => { |
|
|
|
this.quotationSelections = this.quotationSelections.map(item=>({ |
|
|
|
...item, |
|
|
|
qty: undefined, |
|
|
|
currency: undefined, |
|
|
|
createBy: this.$store.state.user.name, |
|
|
|
site: this.$store.state.user.site, |
|
|
|
})) |
|
|
|
this.quoteVisible = true; |
|
|
|
}).catch((msg) => { |
|
|
|
this.$message.warning(typeof msg === 'string' ? msg : '校验项目状态失败') |
|
|
|
}) |
|
|
|
}, |
|
|
|
assertSelectedProjectsCompleted(list) { |
|
|
|
const site = this.$store.state.user.site |
|
|
|
const uniqueIds = [...new Set((list || []).map(item => item.projectId).filter(Boolean))] |
|
|
|
if (!uniqueIds.length) { |
|
|
|
return Promise.reject('项目号不能为空') |
|
|
|
} |
|
|
|
return Promise.all(uniqueIds.map(projectId => |
|
|
|
queryProjectByCustomer({ site, projectId }).then(({data}) => { |
|
|
|
if (!(data && data.code === 0 && data.rows && data.rows.length === 1)) { |
|
|
|
return Promise.reject('未找到项目:' + projectId) |
|
|
|
} |
|
|
|
if (data.rows[0].status !== '已完成') { |
|
|
|
return Promise.reject('询价单项目 ' + projectId + ' 单据状态必须为已完成,当前状态:' + data.rows[0].status) |
|
|
|
} |
|
|
|
}) |
|
|
|
)) |
|
|
|
this.quotationSelections = this.quotationSelections.map(item=>({ |
|
|
|
...item, |
|
|
|
qty: undefined, |
|
|
|
currency: undefined, |
|
|
|
createBy: this.$store.state.user.name, |
|
|
|
site: this.$store.state.user.site, |
|
|
|
})) |
|
|
|
this.quoteVisible = true; |
|
|
|
}, |
|
|
|
buildBatchQuotePayload(list){ |
|
|
|
return list.map(item=>({ |
|
|
|
|