|
|
|
@ -188,6 +188,7 @@ 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"; |
|
|
|
@ -656,14 +657,53 @@ export default { |
|
|
|
this.$message.warning("请选择需报价的单号") |
|
|
|
return |
|
|
|
} |
|
|
|
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; |
|
|
|
this.assertProjectsCompleted(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((error) => { |
|
|
|
const message = typeof error === 'string' ? error : (error && error.message) || '项目状态校验失败' |
|
|
|
this.$message.warning(message) |
|
|
|
}) |
|
|
|
}, |
|
|
|
assertProjectsCompleted(list) { |
|
|
|
const projectIds = [...new Set((list || []).map(item => item.projectId).filter(id => id))] |
|
|
|
if (projectIds.length === 0) { |
|
|
|
return Promise.reject('项目号不能为空') |
|
|
|
} |
|
|
|
return Promise.all(projectIds.map(projectId => this.assertProjectCompleted(projectId).then(() => null).catch((error) => { |
|
|
|
return typeof error === 'string' ? error : (error && error.message) || ('项目状态校验失败,项目:' + projectId) |
|
|
|
}))).then((results) => { |
|
|
|
const errors = results.filter(Boolean) |
|
|
|
if (errors.length) { |
|
|
|
return Promise.reject(errors.join(';')) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
assertProjectCompleted(projectId) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
queryProjectByCustomer({ |
|
|
|
site: this.$store.state.user.site, |
|
|
|
projectId |
|
|
|
}).then(({data}) => { |
|
|
|
if (!(data && data.code === 0 && data.rows && data.rows.length === 1)) { |
|
|
|
reject('未找到对应项目信息,项目:' + projectId) |
|
|
|
return |
|
|
|
} |
|
|
|
if (data.rows[0].status !== '已完成') { |
|
|
|
reject('项目【' + projectId + '】未审批,不允许发起报价!') |
|
|
|
return |
|
|
|
} |
|
|
|
resolve(data.rows[0]) |
|
|
|
}).catch((error) => { |
|
|
|
reject(error) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
buildBatchQuotePayload(list){ |
|
|
|
return list.map(item=>({ |
|
|
|
|