Browse Source

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

new-ays
1747191978@qq.com 2 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,
loading: false,
disabled: true,
detailList: {},
detailList: {}, //
detailId: null, // id
tenantId: "",
tenantName: "",
stepNum: 1, //
@ -649,7 +650,9 @@ export default {
//
handleContinue() {
this.form = { ...this.form, ...this.detailList };
setTimeout(() => {
this.open = false;
}, 200);
},
//
handleResult() {
@ -673,6 +676,7 @@ export default {
this.detailList = {};
if (res.data.list.length) {
let data = res.data.list[0];
this.detailId = data.id;
data.detailList.forEach((item) => {
this.detailList[item.questionCode] = item.answer;
});
@ -901,10 +905,28 @@ export default {
centerId: this.tenantId,
},
};
// detailId
if (this.detailId) {
this.loading = true;
this.handlesaveCommit();
} else {
create(params).then(async (res) => {
this.loading = true;
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");
@ -922,21 +944,7 @@ export default {
await this.saveAnswer(this.form["SCWJ-SXSJ"], "SCWJ-SXSJ");
await this.saveAnswer(this.form["SCWJ-QCSJ"], "SCWJ-QCSJ");
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(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 } };
await screenSubmit(submitParams).then((response) => {
@ -952,15 +960,6 @@ export default {
data: JSON.stringify(this.form),
},
});
});
}
});
} catch (error) {
this.loading = false;
this.disabled = false;
console.log("提交失败:", error);
this.$message.error("提交失败,请稍后重试!");
}
},
//
async saveAnswer(value, str) {

Loading…
Cancel
Save