This commit is contained in:
tdg930622 2024-12-27 15:11:12 +08:00
parent 921785c49c
commit e429080c42

View File

@ -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();
}
}
}