From 269658e2edb9a32330e8fb3de734f643aee47ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Mon, 25 Jul 2022 01:31:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/xm/core/xmProduct/XmProductEdit.vue | 66 +++++++++---------- src/views/xm/core/xmProject/XmProjectEdit.vue | 2 +- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/src/views/xm/core/xmProduct/XmProductEdit.vue b/src/views/xm/core/xmProduct/XmProductEdit.vue index 0cb45441..79310746 100644 --- a/src/views/xm/core/xmProduct/XmProductEdit.vue +++ b/src/views/xm/core/xmProduct/XmProductEdit.vue @@ -98,7 +98,7 @@ - 保存 + 保存 @@ -132,7 +132,7 @@ export default { } }, }, - props: ["xmProduct", "visible", "opType"], + props: ["xmProduct", "visible", "opType",'selProject'], watch: { xmProduct: { handler() { @@ -271,40 +271,34 @@ export default { this.$emit("cancel"); }, //新增提交XmProduct 产品表 父组件监听@submit="afterAddSubmit" - editSubmit: function () { - this.$refs.editForm.validate((valid) => { - if (valid) { - this.$confirm("确认提交吗?", "提示", {}).then(() => { - this.load.edit = true; - let params = Object.assign({}, this.editForm); - params.branchId = this.userInfo.branchId; - addXmProduct(params) - .then((res) => { - this.load.edit = false; - var tips = res.data.tips; - if (tips.isOk) { - //this.$refs['editForm'].resetFields(); - this.$emit("submit"); // @submit="afterAddSubmit" - } - this.$notify({ - position: "bottom-left", - showClose: true, - message: tips.msg, - type: tips.isOk ? "success" : "error", - }); - }) - .catch((err) => (this.load.edit = false)); - }); - } else { - this.$notify({ - position: "bottom-left", - showClose: true, - message: "表单验证不通过,请修改后提交", - type: "error", - }); - } - }); - }, + addSubmit: function () { + + this.$refs.editForm.validate((valid) => { + if (valid) { + debugger; + var msg=this.selProject&&this.selProject.id?'将自动关联项目【'+(this.selProject.name?this.selProject.name:this.selProject.id)+'】':''; + this.$confirm('确认提交吗?'+msg, '提示', {}).then(() => { + this.load.add=true + let params = Object.assign({}, this.editForm); + if(this.selProject &&this.selProject.id){ + params.links=[{projectId:this.selProject.id}] + } + params.branchId=this.userInfo.branchId + addXmProduct(params).then((res) => { + this.load.add=false + var tips=res.data.tips; + if(tips.isOk){ + //this.$refs['addForm'].resetFields(); + this.$emit('submit',res.data.data);// @submit="afterAddSubmit" + } + this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' }); + }).catch( err => this.load.add=false); + }); + }else{ + this.$notify({position:'bottom-left',showClose:true,message: "表单检查不通过", type: 'error' }); + } + }); + }, editSomeFields(row, fieldName, $event) { if(this.opType==='add'){ diff --git a/src/views/xm/core/xmProject/XmProjectEdit.vue b/src/views/xm/core/xmProject/XmProjectEdit.vue index cede6a22..3cdfa599 100644 --- a/src/views/xm/core/xmProject/XmProjectEdit.vue +++ b/src/views/xm/core/xmProject/XmProjectEdit.vue @@ -532,7 +532,7 @@ this.$notify({position:'bottom-left',showClose:true,message: "只有初始状态的项目可以修改,如确实需要修改,请进行项目变更审批", type: 'error' }); return; } - var msg=this.xmProduct&&this.xmProduct.id?'将自动关联产品【'+this.xmProduct.productName+'】':''; + var msg=this.xmProduct&&this.xmProduct.id?'将自动关联产品【'+(this.xmProduct.productName?this.xmProduct.productName:this.xmProduct.id)+'】':''; this.$refs.editForm.validate((valid) => { if (valid) { this.$confirm('确认提交吗?'+msg, '提示', {}).then(() => {