Browse Source

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

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

103
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 };
this.open = false;
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,58 +905,17 @@ export default {
centerId: this.tenantId,
},
};
create(params).then(async (res) => {
// detailId
if (this.detailId) {
this.loading = true;
this.detailId = res.data.detailId;
this.id = res.data.id;
// ------ ------
//
await this.saveAnswer(this.form["SCWJ-DW"], "SCWJ-DW");
await this.saveAnswer(this.form["SCWJ-NAME"], "SCWJ-NAME");
await this.saveAnswer(this.form["SCWJ-SEX"], "SCWJ-SEX");
await this.saveAnswer(this.form["SCWJ-BIRTH"], "SCWJ-BIRTH");
await this.saveAnswer(this.form["SCWJ-AGE"], "SCWJ-AGE");
await this.saveAnswer(this.form["SCWJ-PHONE"], "SCWJ-PHONE");
await this.saveAnswer(this.form["SCWJ-HEIGHT"], "SCWJ-HEIGHT");
await this.saveAnswer(this.form["SCWJ-WEIGHT"], "SCWJ-WEIGHT");
await this.saveAnswer(this.form["SCWJ-BMI"], "SCWJ-BMI");
await this.saveAnswer(this.form["SCWJ-JL"], "SCWJ-JL");
await this.saveAnswer(this.form["SCWJ-SCSJ"], "SCWJ-SCSJ");
await this.saveAnswer(this.form["SCWJ-RSSJ"], "SCWJ-RSSJ");
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) => {
this.loading = false;
this.disabled = false;
this.$modal.msgSuccess("提交成功");
this.handlesaveCommit();
} else {
create(params).then(async (res) => {
this.loading = true;
this.detailId = res.data.detailId;
this.handlesaveCommit();
});
//
this.$router.replace({
path: "/screening/h5Result",
query: {
tenantName: this.tenantName,
data: JSON.stringify(this.form),
},
});
});
}
}
});
} catch (error) {
@ -962,6 +925,42 @@ export default {
this.$message.error("提交失败,请稍后重试!");
}
},
//
async handlesaveCommit() {
// ------ ------
//
await this.saveAnswer(this.form["SCWJ-DW"], "SCWJ-DW");
await this.saveAnswer(this.form["SCWJ-NAME"], "SCWJ-NAME");
await this.saveAnswer(this.form["SCWJ-SEX"], "SCWJ-SEX");
await this.saveAnswer(this.form["SCWJ-BIRTH"], "SCWJ-BIRTH");
await this.saveAnswer(this.form["SCWJ-AGE"], "SCWJ-AGE");
await this.saveAnswer(this.form["SCWJ-PHONE"], "SCWJ-PHONE");
await this.saveAnswer(this.form["SCWJ-HEIGHT"], "SCWJ-HEIGHT");
await this.saveAnswer(this.form["SCWJ-WEIGHT"], "SCWJ-WEIGHT");
await this.saveAnswer(this.form["SCWJ-BMI"], "SCWJ-BMI");
await this.saveAnswer(this.form["SCWJ-JL"], "SCWJ-JL");
await this.saveAnswer(this.form["SCWJ-SCSJ"], "SCWJ-SCSJ");
await this.saveAnswer(this.form["SCWJ-RSSJ"], "SCWJ-RSSJ");
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.tips, "SCREEN-JL");
// ------ ------
const submitParams = { param: { detailId: this.detailId } };
await screenSubmit(submitParams).then((response) => {
this.loading = false;
this.disabled = false;
this.$modal.msgSuccess("提交成功");
});
//
this.$router.replace({
path: "/screening/h5Result",
query: {
tenantName: this.tenantName,
data: JSON.stringify(this.form),
},
});
},
//
async saveAnswer(value, str) {
try {

Loading…
Cancel
Save