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