diff --git a/src/views/modules/project/projectInfo/com_projectInfo-add-or-update.vue b/src/views/modules/project/projectInfo/com_projectInfo-add-or-update.vue index 03d5480..a832a27 100644 --- a/src/views/modules/project/projectInfo/com_projectInfo-add-or-update.vue +++ b/src/views/modules/project/projectInfo/com_projectInfo-add-or-update.vue @@ -1063,6 +1063,32 @@ } return true }, + hasProjectManager () { + if (this.dataForm.projectManagerList && this.dataForm.projectManagerList.length > 0) { + return true + } + return !!(this.dataForm.projectManagerName && String(this.dataForm.projectManagerName).trim()) + }, + validateManagerRequiredFields () { + if (!this.hasProjectManager()) { + return true + } + const missing = [] + if (this.dataForm.projectAmount === null || this.dataForm.projectAmount === undefined || String(this.dataForm.projectAmount).trim() === '') { + missing.push('项目年销售额') + } + if (!this.dataForm.finalCustomerId || String(this.dataForm.finalCustomerId).trim() === '') { + missing.push('直接客户') + } + if (!this.dataForm.customerRemark || String(this.dataForm.customerRemark).trim() === '') { + missing.push('客户应用/要求') + } + if (missing.length) { + this.$message.warning('项目经理不为空时,' + missing.join('、') + '不能为空') + return false + } + return true + }, agreeSubmit () { if (!this.canAgreeAction()) { this.$message.warning('当前状态不允许同意') @@ -1081,6 +1107,9 @@ this.$message.warning('当前状态不允许驳回') return } + if (!this.validateManagerRequiredFields()) { + return + } this.rejectOpinion = '' this.submitModalFlag = true }, @@ -1096,6 +1125,9 @@ this.$message.warning('节点权限加载中,请稍后重试') return } + if (!this.validateManagerRequiredFields()) { + return + } if (nodeConclusion === 'Y' && !this.validateSubmitRequiredFields()) { return } 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 be237ca..0eb1c85 100644 --- a/src/views/modules/project/projectInfo/com_project_info_part.vue +++ b/src/views/modules/project/projectInfo/com_project_info_part.vue @@ -975,7 +975,7 @@ - + @@ -2234,6 +2234,15 @@ import CodeGeneration from "../../code/generation.vue"; }) }, + onProjectPartAdded (hasTemporaryPart) { + this.searchTable() + if (hasTemporaryPart !== false && this.searchData.status === '已完成') { + this.$message.success('已新增临时物料,项目状态已回退为草稿') + this.searchData.status = '草稿' + } + this.$emit('refreshProjectList') + }, + addModal () { if (this.searchData.projectId === "" || this.searchData.projectId == null) { this.$alert('请选择项目!', '错误', { @@ -2786,8 +2795,8 @@ import CodeGeneration from "../../code/generation.vue"; if (this.modalData.flag === '1' || this.modalData.flag === '3') { partInformationSave2(this.modalData).then(({data}) => { if (data && data.code === 0) { - this.searchTable() this.modalFlag = false + this.onProjectPartAdded(this.modalData.status === 'N') this.$message({ message: '操作成功', type: 'success', @@ -2948,6 +2957,7 @@ import CodeGeneration from "../../code/generation.vue"; return } let tempData = { + site: this.searchData.site, projectId: this.searchData.projectId, customerNo: this.searchData.customerId, createBy: this.$store.state.user.name, @@ -2956,8 +2966,9 @@ import CodeGeneration from "../../code/generation.vue"; } addProjectPart2(tempData).then(({data}) => { if (data && data.code === 0) { - this.searchTable() + const hasTemporaryPart = this.partList2.some(item => item && item.status === 'N') this.partModelFlag = false + this.onProjectPartAdded(hasTemporaryPart) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' diff --git a/src/views/modules/project/projectInfo/projectInfo.vue b/src/views/modules/project/projectInfo/projectInfo.vue index d467cbe..c041a56 100644 --- a/src/views/modules/project/projectInfo/projectInfo.vue +++ b/src/views/modules/project/projectInfo/projectInfo.vue @@ -273,7 +273,7 @@ - + @@ -1696,7 +1696,8 @@ site: this.currentRow.site, projectId: this.currentRow.projectId, username: this.$store.state.user.name, - customerId: this.currentRow.customerId + customerId: this.currentRow.customerId, + status: this.currentRow.status } this.$refs.projectPart.init(inData) }, @@ -2205,6 +2206,9 @@ this.$message.warning('仅草稿状态的单据允许下达') return } + if (!this.validateManagerRequiredFields(row)) { + return + } this.$confirm('确认下达该项目?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', @@ -2274,6 +2278,35 @@ this.filterVisible = false this.isFilterSearch = true }, + hasProjectManager (source) { + if (!source) { + return false + } + if (source.projectManagerList && source.projectManagerList.length > 0) { + return true + } + return !!(source.projectManagerName && String(source.projectManagerName).trim()) + }, + validateManagerRequiredFields (source) { + if (!this.hasProjectManager(source)) { + return true + } + const missing = [] + if (source.projectAmount === null || source.projectAmount === undefined || String(source.projectAmount).trim() === '') { + missing.push('项目年销售额') + } + if (!source.finalCustomerId || String(source.finalCustomerId).trim() === '') { + missing.push('直接客户') + } + if (!source.customerRemark || String(source.customerRemark).trim() === '') { + missing.push('客户应用/要求') + } + if (missing.length) { + this.$message.warning('项目经理不为空时,' + missing.join('、') + '不能为空') + return false + } + return true + }, }, activated() { diff --git a/src/views/modules/project/projectInfo/projectInfoQuery.vue b/src/views/modules/project/projectInfo/projectInfoQuery.vue index d6e6f89..6c8eaf2 100644 --- a/src/views/modules/project/projectInfo/projectInfoQuery.vue +++ b/src/views/modules/project/projectInfo/projectInfoQuery.vue @@ -231,7 +231,7 @@ :save-visible="false" :remove-visible="false"> - + @@ -1004,7 +1004,8 @@ site: this.currentRow.site, projectId: this.currentRow.projectId, username: this.$store.state.user.name, - customerId: this.currentRow.customerId + customerId: this.currentRow.customerId, + status: this.currentRow.status } this.$refs.projectPart.init(inData) },