diff --git a/oms_web/oms_vue/src/views/project/order/OrderDetail.vue b/oms_web/oms_vue/src/views/project/order/OrderDetail.vue index 4d5a46af..83545ce3 100644 --- a/oms_web/oms_vue/src/views/project/order/OrderDetail.vue +++ b/oms_web/oms_vue/src/views/project/order/OrderDetail.vue @@ -276,7 +276,6 @@
-

历史订单记录

{{ form.projectName + 'Rev.' + activeContractVersionTab }} @@ -352,15 +351,19 @@ + + +
@@ -381,6 +384,7 @@ import SelectCustomer from "@/views/system/customer/selectCustomer.vue"; import SelectPartner from "@/views/system/partner/selectPartner.vue"; import SelectUser from "@/views/system/user/selectUser.vue"; import SelectProject from "@/views/project/info/SelectProject.vue"; +import SelectCommitType from "./SelectCommitType.vue"; export default { name: "OrderDetail", @@ -391,6 +395,7 @@ export default { SelectUser, ProductConfig, SelectProject, + SelectCommitType, }, props: { visible: { @@ -428,6 +433,7 @@ export default { selectPartnerVisible: false, selectUserVisible: false, selectProjectVisible: false, + selectCommitTypeVisible: false, isProjectSelected: false, canUpdate: false, // 新增 canUpdate 属性 uploadFinalFile: false, // 新增 uploadFinalFile 属性 @@ -623,7 +629,7 @@ export default { getOrder(this.orderId).then(response => { this.form = {...response.data.projectOrderInfo}; - + this.title=this.form.projectName+"Rev."+this.form.versionCode this.isProjectSelected = true; // 兼容版本号为空的情况 if (!this.form.versionCode) { @@ -705,6 +711,7 @@ export default { }); this.activeContractVersionTab = currentVersion; // 如果有项目ID,则加载项目信息 + console.log(this.projectId) if (this.projectId) { getProject(this.projectId).then(response => { this.handleProjectSelected(response.data.project); @@ -776,27 +783,73 @@ export default { this.isProjectSelected = false; this.resetForm("form"); }, - /** 提交按钮 */ - submitForm() { - this.$refs["form"].validate(valid => { - if (valid) { - const action = this.isEdit ? updateOrder : addOrder; - action(this.form).then(response => { - this.msgSuccess(this.isEdit ? "修改成功" : "新增成功"); - if (!this.isEdit) { - this.form.id = response.data.id; // Assuming backend returns the new order ID in response.data.id - this.isEdit = true; // Mark as edit mode - this.title = "修改订单"; // Change title - this.activeTab = 'contract'; // Switch to contract tab - this.$emit('success'); // Refresh parent list - } else { - this.handleClose(); - this.$emit('success'); - } - }); + /** 提交数据到后端 */ + _performSubmit() { + const action = this.isEdit ? updateOrder : addOrder; + action(this.form).then(response => { + this.msgSuccess(this.form.orderStatus === '0' ? "保存成功" : "提交成功"); + if (!this.isEdit && this.form.orderStatus === '0') { + // If it was a new draft, update the form to allow file uploads etc. + this.form.id = response.data.id; + this.isEdit = true; + this.title = "修改订单"; + this.activeTab = 'contract'; + this.$emit('success'); + } else { + this.handleClose(); + this.$emit('success'); } }); }, + /** 保存草稿 */ + saveDraft() { + if (!this.form.projectCode) { + this.msgError("项目编号为必填"); + return; + } + + const checkDiscount = (list) => { + if (!list) return true; + return list.every(item => item.discount === null || item.discount === undefined || item.discount <= 1); + }; + + const allDiscountsValid = checkDiscount(this.form.softwareProjectProductInfoList) && + checkDiscount(this.form.hardwareProjectProductInfoList) && + checkDiscount(this.form.maintenanceProjectProductInfoList); + + if (!allDiscountsValid) { + this.msgError("折扣不能大于100%"); + return; + } + + this.form.orderStatus = '0'; + this._performSubmit(); + }, + /** 提交审批 */ + submitForApproval() { + const contractFiles = this.currentContractFiles; + const hasBusinessApprovalFile = contractFiles && contractFiles.length > 0 && contractFiles[0].id !== -1; + + if (!hasBusinessApprovalFile) { + this.msgError("请补充商务审批文件"); + return; + } + + this.$refs["form"].validate(valid => { + if (valid) { + this.selectCommitTypeVisible = true; + } else { + this.msgError("请完善表单"); + } + }); + }, + /** 处理合同和流程类型选择 */ + handleCommitTypeSelected(data) { + this.form.processTemplate = data.processTemplate; + this.form.processType = data.processType; + this.form.orderStatus = '1'; + this._performSubmit(); + }, /** BG改变事件 */ handleBgChange(value) { this.form.industryType = null; @@ -909,14 +962,6 @@ export default { this.selectProjectVisible = false; }, - /** 选择用户按钮操作 */ - handleSelectUser() { - this.msgWarning("选择用户功能待实现"); - }, - /** 选择合作伙伴按钮操作 */ - handleSelectPartner() { - this.msgWarning("选择合作伙伴功能待实现"); - }, formatApproveStatus(status) { const statusMap = { diff --git a/oms_web/oms_vue/src/views/project/order/index.vue b/oms_web/oms_vue/src/views/project/order/index.vue index c4c1169d..57bda658 100644 --- a/oms_web/oms_vue/src/views/project/order/index.vue +++ b/oms_web/oms_vue/src/views/project/order/index.vue @@ -54,7 +54,7 @@ - 新增 + 新增 删除 @@ -248,7 +248,10 @@ export default { /** 新增按钮操作 */ handleAdd(projectId = null) { this.currentOrderId = null; + console.log("projectId:", projectId) + if (projectId) { this.currentProjectIdForOrder = projectId; // Store projectId + } this.open = true; this.title = "添加订单"; },