Browse Source

筛查id存在则是修改,否则是新增

new-ays
1747191978@qq.com 3 months ago
parent
commit
37fa3f5e67
  1. 49
      acupuncture-前台/src/views/screening/h5eva.vue

49
acupuncture-前台/src/views/screening/h5eva.vue

@ -316,7 +316,8 @@ export default {
open: false, open: false,
loading: false, loading: false,
disabled: true, disabled: true,
detailList: {}, detailList: {}, //
detailId: null, // id
tenantId: "", tenantId: "",
tenantName: "", tenantName: "",
stepNum: 1, // stepNum: 1, //
@ -649,7 +650,9 @@ export default {
// //
handleContinue() { handleContinue() {
this.form = { ...this.form, ...this.detailList }; this.form = { ...this.form, ...this.detailList };
setTimeout(() => {
this.open = false; this.open = false;
}, 200);
}, },
// //
handleResult() { handleResult() {
@ -673,6 +676,7 @@ export default {
this.detailList = {}; this.detailList = {};
if (res.data.list.length) { if (res.data.list.length) {
let data = res.data.list[0]; let data = res.data.list[0];
this.detailId = data.id;
data.detailList.forEach((item) => { data.detailList.forEach((item) => {
this.detailList[item.questionCode] = item.answer; this.detailList[item.questionCode] = item.answer;
}); });
@ -901,10 +905,28 @@ export default {
centerId: this.tenantId, centerId: this.tenantId,
}, },
}; };
// detailId
if (this.detailId) {
this.loading = true;
this.handlesaveCommit();
} else {
create(params).then(async (res) => { create(params).then(async (res) => {
this.loading = true; this.loading = true;
this.detailId = res.data.detailId; this.detailId = res.data.detailId;
this.id = res.data.id; this.handlesaveCommit();
});
}
}
});
} catch (error) {
this.loading = false;
this.disabled = false;
console.log("提交失败:", error);
this.$message.error("提交失败,请稍后重试!");
}
},
//
async handlesaveCommit() {
// ------ ------ // ------ ------
// //
await this.saveAnswer(this.form["SCWJ-DW"], "SCWJ-DW"); await this.saveAnswer(this.form["SCWJ-DW"], "SCWJ-DW");
@ -922,21 +944,7 @@ export default {
await this.saveAnswer(this.form["SCWJ-SXSJ"], "SCWJ-SXSJ"); await this.saveAnswer(this.form["SCWJ-SXSJ"], "SCWJ-SXSJ");
await this.saveAnswer(this.form["SCWJ-QCSJ"], "SCWJ-QCSJ"); await this.saveAnswer(this.form["SCWJ-QCSJ"], "SCWJ-QCSJ");
await this.saveAnswer(this.form["SCWJ-SMXL"], "SCWJ-SMXL"); await this.saveAnswer(this.form["SCWJ-SMXL"], "SCWJ-SMXL");
//
// await this.saveAnswer(
// this.form["SCWJ-XBS"].toString(),
// "SCWJ-XBS"
// );
// await this.saveAnswer(this.form["SCWJ-XBS-QT"], "SCWJ-XBS-QT");
await this.saveAnswer(this.tips, "SCREEN-JL"); await this.saveAnswer(this.tips, "SCREEN-JL");
//
// await this.saveAnswer(score, "SCWJ-RESULT");
// await this.saveAnswer(
// this.form["SCWJ-ZLFS"].toString(),
// "SCWJ-ZLFS"
// ); //
// await this.saveAnswer(this.form["SCWJ-ZLZQ"], "SCWJ-ZLZQ"); //
// ------ ------ // ------ ------
const submitParams = { param: { detailId: this.detailId } }; const submitParams = { param: { detailId: this.detailId } };
await screenSubmit(submitParams).then((response) => { await screenSubmit(submitParams).then((response) => {
@ -952,15 +960,6 @@ export default {
data: JSON.stringify(this.form), data: JSON.stringify(this.form),
}, },
}); });
});
}
});
} catch (error) {
this.loading = false;
this.disabled = false;
console.log("提交失败:", error);
this.$message.error("提交失败,请稍后重试!");
}
}, },
// //
async saveAnswer(value, str) { async saveAnswer(value, str) {

Loading…
Cancel
Save