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() { 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.$parent.getList();
this.handleClose();
this.$message.success("操作成功"); this.$message.success("操作成功");
}) });
}else {
contactPerson.debtorAdd(this.respondentObj).then(res => {
this.$parent.getList()
this.handleClose()
this.$message.success("操作成功");
})
} }
} });
}) };
}else { const dialogTypeToHandler = {
this.$refs.ruleFormAgent.validate((valid) => { '被申请人': () => handleFormSubmit('ruleFormRespondent', this.respondentObj, contactPerson.debtorAdd, contactPerson.contactPersonUpdate),
if (valid) { '申请人代理人': () => handleFormSubmit('ruleFormAgent', this.agentObj, contactPerson.agentAdd, contactPerson.contactPersonUpdate)
this.agentObj.caseId = this.eventDialog.caseId; };
if (this.eventDialog.personId){ // diglogType
contactPerson.contactPersonUpdate({...this.agentObj, id: this.eventDialog.personId}).then(res => { const handler = dialogTypeToHandler[this.diglogType];
this.$parent.getList() if (handler) {
this.handleClose() handler();
this.$message.success("操作成功");
})
}else {
contactPerson.agentAdd(this.agentObj).then(res => {
this.$parent.getList()
this.handleClose()
this.$message.success("操作成功");
})
}
}
})
} }
} }
} }