Browse Source

优化

master
陈裕财 3 years ago
parent
commit
269658e2ed
  1. 66
      src/views/xm/core/xmProduct/XmProductEdit.vue
  2. 2
      src/views/xm/core/xmProject/XmProjectEdit.vue

66
src/views/xm/core/xmProduct/XmProductEdit.vue

@ -98,7 +98,7 @@
</el-form> </el-form>
<el-row v-if="opType==='add'" style="float:right;"> <el-row v-if="opType==='add'" style="float:right;">
<el-button type="primary" @click="editSubmit">保存</el-button>
<el-button type="primary" @click="addSubmit">保存</el-button>
</el-row> </el-row>
</el-row> </el-row>
</section> </section>
@ -132,7 +132,7 @@ export default {
} }
}, },
}, },
props: ["xmProduct", "visible", "opType"],
props: ["xmProduct", "visible", "opType",'selProject'],
watch: { watch: {
xmProduct: { xmProduct: {
handler() { handler() {
@ -271,40 +271,34 @@ export default {
this.$emit("cancel"); this.$emit("cancel");
}, },
//XmProduct @submit="afterAddSubmit" //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) { editSomeFields(row, fieldName, $event) {
if(this.opType==='add'){ if(this.opType==='add'){

2
src/views/xm/core/xmProject/XmProjectEdit.vue

@ -532,7 +532,7 @@
this.$notify({position:'bottom-left',showClose:true,message: "只有初始状态的项目可以修改,如确实需要修改,请进行项目变更审批", type: 'error' }); this.$notify({position:'bottom-left',showClose:true,message: "只有初始状态的项目可以修改,如确实需要修改,请进行项目变更审批", type: 'error' });
return; 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) => { this.$refs.editForm.validate((valid) => {
if (valid) { if (valid) {
this.$confirm('确认提交吗?'+msg, '提示', {}).then(() => { this.$confirm('确认提交吗?'+msg, '提示', {}).then(() => {

Loading…
Cancel
Save