diff --git a/src/views/modules/project/projectInfo/com_project_info_part.vue b/src/views/modules/project/projectInfo/com_project_info_part.vue index 97657ce..a7bd742 100644 --- a/src/views/modules/project/projectInfo/com_project_info_part.vue +++ b/src/views/modules/project/projectInfo/com_project_info_part.vue @@ -1257,13 +1257,45 @@ import CodeGeneration from "../../code/generation.vue"; columnProp: "partDesc", headerAlign: "center", align: "left", - columnLabel: "物料名称", + columnLabel: "产品描述", columnHidden: false, columnImage: false, status: true, fixed: '', columnWidth: 300 }, + { + userId: this.$store.state.user.name, + functionId: 101002001, + serialNumber: '101002001Table4ApplicationDesc', + tableId: "101002001Table4", + tableName: "项目物料", + columnProp: "applicationDesc", + headerAlign: "center", + align: "left", + columnLabel: "应用描述", + columnHidden: false, + columnImage: false, + status: true, + fixed: '', + columnWidth: 160 + }, + { + userId: this.$store.state.user.name, + functionId: 101002001, + serialNumber: '101002001Table4ProductCategory', + tableId: "101002001Table4", + tableName: "项目物料", + columnProp: "productCategory", + headerAlign: "center", + align: "center", + columnLabel: "产品类别", + columnHidden: false, + columnImage: false, + status: true, + fixed: '', + columnWidth: 120 + }, { userId: this.$store.state.user.name, functionId: 101002001, diff --git a/src/views/modules/quotation/requestForQuote.vue b/src/views/modules/quotation/requestForQuote.vue index d2f7bcf..e708598 100644 --- a/src/views/modules/quotation/requestForQuote.vue +++ b/src/views/modules/quotation/requestForQuote.vue @@ -1039,6 +1039,7 @@ export default { projectId: undefined, projectName: undefined, customerId: undefined, + status: '已完成', }, // 项目集合 projectList: [], @@ -2666,17 +2667,23 @@ export default { } this.confirmProjectPart(); if (this.modalData.flag === '1') { - this.saveLoading = true - quotationInformationSave(this.modalData).then(({data}) => { - this.saveLoading = false - if (data && data.code === 0) { - this.modalFlag = false; - this.searchData.quotationBatchNo = data.quotationBatchNo - this.$message.success('操作成功') - this.getDataList() - } else { - this.$message(data.msg) - } + this.assertProjectCompleted(this.modalData.projectId, '新增询价').then(() => { + this.saveLoading = true + quotationInformationSave(this.modalData).then(({data}) => { + this.saveLoading = false + if (data && data.code === 0) { + this.modalFlag = false; + this.searchData.quotationBatchNo = data.quotationBatchNo + this.$message.success('操作成功') + this.getDataList() + } else { + this.$message(data.msg) + } + }).catch(() => { + this.saveLoading = false + }) + }).catch((msg) => { + this.$message.warning(typeof msg === 'string' ? msg : '校验项目状态失败') }) } else { quotationInformationEdit(this.modalData).then(({data}) => { @@ -3438,6 +3445,7 @@ export default { searchProjectInfoList() { this.projectList = []; this.searchProjectData.customerId = this.modalData.customerNo + this.searchProjectData.status = '已完成' searchProjectInfoList(this.searchProjectData).then(({data}) => { if (data && data.code === 0) { this.projectList = data.rows @@ -3455,6 +3463,7 @@ export default { projectId: undefined, projectName: undefined, customerId: undefined, + status: '已完成', } }, projectClickRow(row) { @@ -3631,6 +3640,30 @@ export default { this.$message.error(error) }) }, + assertProjectCompleted(projectId, actionText) { + return new Promise((resolve, reject) => { + if (!projectId) { + reject('项目号不能为空') + return + } + queryProjectByCustomer({ + site: this.$store.state.user.site, + projectId + }).then(({data}) => { + if (!(data && data.code === 0 && data.rows && data.rows.length === 1)) { + reject('未找到对应项目信息') + return + } + if (data.rows[0].status !== '已完成') { + reject('仅项目单据状态为已完成时允许' + actionText + ',当前状态:' + data.rows[0].status) + return + } + resolve(data.rows[0]) + }).catch((error) => { + reject(error) + }) + }) + }, handleQueryProjectByCustomer(){ let params = { site:this.$store.state.user.site, @@ -3640,6 +3673,14 @@ export default { queryProjectByCustomer(params).then(({data})=>{ if (data && data.code === 0 ){ if (data.rows && data.rows.length === 1){ + if (this.modalData.flag === '1' && data.rows[0].status !== '已完成') { + this.$message.warning('仅项目单据状态为已完成时允许新增询价,当前状态:' + data.rows[0].status) + this.modalData.projectId = '' + this.modalData.projectName = '' + this.modalData.finalCustomerId = '' + this.modalData.finalCustomerName = '' + return + } this.modalData.projectName = data.rows[0].projectName this.modalData.finalCustomerId = data.rows[0].finalCustomerId this.modalData.finalCustomerName = data.rows[0].finalCustomerName diff --git a/src/views/modules/quotation/toBeQuoted.vue b/src/views/modules/quotation/toBeQuoted.vue index a0adc6b..53b093b 100644 --- a/src/views/modules/quotation/toBeQuoted.vue +++ b/src/views/modules/quotation/toBeQuoted.vue @@ -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"; @@ -623,7 +624,11 @@ export default { }, // 报价 batchQuotation(){ - this.saveBatchQuotationHeader(this.quotationSelections); + this.assertSelectedProjectsCompleted(this.quotationSelections).then(() => { + this.saveBatchQuotationHeader(this.quotationSelections); + }).catch((msg) => { + this.$message.warning(typeof msg === 'string' ? msg : '校验项目状态失败') + }) }, // 批量新增报价信息 saveBatchQuotationHeader(list){ @@ -652,14 +657,35 @@ 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.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) + } + }) + )) }, buildBatchQuotePayload(list){ return list.map(item=>({ diff --git a/src/views/modules/quote/index.vue b/src/views/modules/quote/index.vue index fc2e922..54addef 100644 --- a/src/views/modules/quote/index.vue +++ b/src/views/modules/quote/index.vue @@ -1025,26 +1025,30 @@ export default { }) }, handleSaveQuote(){ - let params = { - ...this.saveQuote, - status: '草稿', - action: 'Y', - createBy: this.$store.state.user.name, - } - this.saveLoading = true - saveQuote(params).then(({data})=>{ - if (data && data.code === 0){ - this.saveVisible = false - this.quoteForm.quoteVersionNo = data.quoteVersionNo - this.$message.success(data.msg) - }else { - this.$message.warning(data.msg) + this.assertProjectCompleted(this.saveQuote.projectNo).then(() => { + let params = { + ...this.saveQuote, + status: '草稿', + action: 'Y', + createBy: this.$store.state.user.name, } - this.handleSearch(0); - this.saveLoading = false - }).catch((error)=>{ - this.$message.error(error) - this.saveLoading = false + this.saveLoading = true + saveQuote(params).then(({data})=>{ + if (data && data.code === 0){ + this.saveVisible = false + this.quoteForm.quoteVersionNo = data.quoteVersionNo + this.$message.success(data.msg) + }else { + this.$message.warning(data.msg) + } + this.handleSearch(0); + this.saveLoading = false + }).catch((error)=>{ + this.$message.error(error) + this.saveLoading = false + }) + }).catch((msg) => { + this.$message.warning(typeof msg === 'string' ? msg : '校验项目状态失败') }) }, handleUpdateQuote(){ @@ -1153,6 +1157,14 @@ export default { queryProjectByCustomer(params).then(({data})=>{ if (data && data.code === 0 ){ if (data.rows && data.rows.length === 1){ + if (!this.saveQuote.id && data.rows[0].status !== '已完成') { + this.$message.warning('仅项目单据状态为已完成时允许报价,当前状态:' + data.rows[0].status) + this.saveQuote.projectNo = '' + this.saveQuote.projectDesc = '' + this.saveQuote.finalCustomerNo = '' + this.saveQuote.finalCustomerDesc = '' + return + } this.saveQuote.projectDesc = data.rows[0].projectName this.saveQuote.finalCustomerNo = data.rows[0].finalCustomerId this.saveQuote.finalCustomerDesc = data.rows[0].finalCustomerName @@ -1349,18 +1361,46 @@ export default { this.insideInquiryVisible = true }, dblclickInsideInquiry(row){ - this.saveQuote.insideInquiryNo = row.quotationNo - this.saveQuote.customerNo = row.customerNo - this.saveQuote.customerDesc = row.customerDesc - this.saveQuote.projectNo = row.projectId - this.saveQuote.projectDesc = row.projectName - this.saveQuote.quoter = row.quoter - this.saveQuote.quoterName = row.quoterName - this.saveQuote.finalCustomerNo = row.finalCustomerId - this.saveQuote.finalCustomerDesc = row.finalCustomerName - this.saveQuote.purchase = row.tracker - this.saveQuote.purchaseName = row.trackerName - this.insideInquiryVisible = false + this.assertProjectCompleted(row.projectId).then(() => { + this.saveQuote.insideInquiryNo = row.quotationNo + this.saveQuote.customerNo = row.customerNo + this.saveQuote.customerDesc = row.customerDesc + this.saveQuote.projectNo = row.projectId + this.saveQuote.projectDesc = row.projectName + this.saveQuote.quoter = row.quoter + this.saveQuote.quoterName = row.quoterName + this.saveQuote.finalCustomerNo = row.finalCustomerId + this.saveQuote.finalCustomerDesc = row.finalCustomerName + this.saveQuote.purchase = row.tracker + this.saveQuote.purchaseName = row.trackerName + this.insideInquiryVisible = false + }).catch((msg) => { + this.$message.warning(typeof msg === 'string' ? msg : '校验项目状态失败') + }) + }, + assertProjectCompleted(projectId) { + return new Promise((resolve, reject) => { + if (!projectId) { + reject('项目号不能为空') + return + } + queryProjectByCustomer({ + site: this.$store.state.user.site, + projectId + }).then(({data}) => { + if (!(data && data.code === 0 && data.rows && data.rows.length === 1)) { + reject('未找到对应项目信息') + return + } + if (data.rows[0].status !== '已完成') { + reject('仅项目单据状态为已完成时允许报价,当前状态:' + data.rows[0].status) + return + } + resolve(data.rows[0]) + }).catch((error) => { + reject(error) + }) + }) }, searchInsideInquiry(){ searchQuotationByQuotationNo(this.insideInquiry).then(({data}) => {