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.$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("操作成功");
})
}
}
})
} }
} }
} }