tj
This commit is contained in:
parent
921785c49c
commit
e429080c42
@ -244,44 +244,29 @@ export default {
|
|||||||
},
|
},
|
||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
if(!this.$clickThrottle()) { return }//防止重复点击
|
if(!this.$clickThrottle()) { return }//防止重复点击
|
||||||
if (this.diglogType === '被申请人'){
|
const handleFormSubmit = (formRef, obj, addFunc, updateFunc) => {
|
||||||
this.$refs.ruleFormRespondent.validate((valid) => {
|
this.$refs[formRef].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.respondentObj.caseId = this.eventDialog.caseId;
|
obj.caseId = this.eventDialog.caseId;
|
||||||
if (this.eventDialog.personId){
|
const params = { ...obj, id: this.eventDialog.personId };
|
||||||
contactPerson.contactPersonUpdate({...this.respondentObj, id: this.eventDialog.personId}).then(res => {
|
const requestFunc = this.eventDialog.personId ? updateFunc : addFunc;
|
||||||
this.$parent.getList()
|
|
||||||
this.handleClose()
|
requestFunc(params).then(() => {
|
||||||
this.$message.success("操作成功");
|
this.$parent.getList();
|
||||||
})
|
this.handleClose();
|
||||||
}else {
|
this.$message.success("操作成功");
|
||||||
contactPerson.debtorAdd(this.respondentObj).then(res => {
|
});
|
||||||
this.$parent.getList()
|
|
||||||
this.handleClose()
|
|
||||||
this.$message.success("操作成功");
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}else {
|
};
|
||||||
this.$refs.ruleFormAgent.validate((valid) => {
|
const dialogTypeToHandler = {
|
||||||
if (valid) {
|
'被申请人': () => handleFormSubmit('ruleFormRespondent', this.respondentObj, contactPerson.debtorAdd, contactPerson.contactPersonUpdate),
|
||||||
this.agentObj.caseId = this.eventDialog.caseId;
|
'申请人代理人': () => handleFormSubmit('ruleFormAgent', this.agentObj, contactPerson.agentAdd, contactPerson.contactPersonUpdate)
|
||||||
if (this.eventDialog.personId){
|
};
|
||||||
contactPerson.contactPersonUpdate({...this.agentObj, id: this.eventDialog.personId}).then(res => {
|
// 根据 diglogType 调用对应的处理函数
|
||||||
this.$parent.getList()
|
const handler = dialogTypeToHandler[this.diglogType];
|
||||||
this.handleClose()
|
if (handler) {
|
||||||
this.$message.success("操作成功");
|
handler();
|
||||||
})
|
|
||||||
}else {
|
|
||||||
contactPerson.agentAdd(this.agentObj).then(res => {
|
|
||||||
this.$parent.getList()
|
|
||||||
this.handleClose()
|
|
||||||
this.$message.success("操作成功");
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user