| | |
| | | <div class="scriptTopic-dev" :key="index" v-else> |
| | | <div class="dev-text"> |
| | | {{ index + 1 }}、[问答]<span>{{ |
| | | item.scriptContent |
| | | item.questiontext |
| | | }}</span> |
| | | <span v-if="item.valueType == 3">(只能输入数字)</span> |
| | | </div> |
| | |
| | | methods: { |
| | | // 获取主题样式类 |
| | | getTopicClass(item) { |
| | | console.log(item.isabnormal, "getTopicClass"); |
| | | |
| | | // 根据状态值返回对应的样式类 |
| | | if (item.isabnormal == 1) { |
| | | return "scriptTopic-isabnormal"; // 异常 - 红色 |
| | |
| | | this.tableDatatop = res.data.scriptResult; |
| | | |
| | | this.tableDatatop.forEach((item) => { |
| | | if (item.scriptType == 2) item.scriptResult = []; |
| | | if (item.scriptResultId && item.scriptType != 2) { |
| | | item.isoption = 3; |
| | | item.scriptResult = item.scriptResult; |
| | | } else if (item.scriptResultId && item.scriptType == 2) { |
| | | console.log(item.scriptResult, "item.scriptResult"); |
| | | item.scriptResult = item.scriptResult.split("&"); |
| | | item.isoption = 3; |
| | | } else if (!item.scriptResultId && item.scriptType == 2) { |
| | | item.scriptResult = []; |
| | | } |
| | | }); |
| | | this.taskname = res.data.taskName; |
| | |
| | | if (item.targetvalue) { |
| | | item.scriptResult = item.targetvalue.split("&"); |
| | | } else { |
| | | item.scriptResult = []; |
| | | item.scriptResult = item.asrtext; |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | if (item.targetvalue) { |
| | | item.scriptResult = item.targetvalue.split("&"); |
| | | } else { |
| | | item.scriptResult = []; |
| | | } |
| | | }); |
| | | } |
| | |
| | | // 医护人员存储数据 |
| | | getdetail() { |
| | | console.log(1); |
| | | |
| | | let excep = ""; |
| | | const promises = []; |
| | | |
| | | // 先处理 tableDatatop 中的数据 |
| | | this.tableDatatop.forEach((item) => { |
| | | if (item.valueType == 3 && item.scriptResult) { |
| | | // 验证是否为有效数字 |
| | | if (!/^\d+$/.test(item.scriptResult)) { |
| | | this.$message.error(`问题 "${item.scriptContent}" 必须输入数字`); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | var objs = item.svyTaskTemplateTargetoptions.find( |
| | | (items) => items.optioncontent == item.scriptResult |
| | | ); |
| | |
| | | this.selectedTag = objs.isabnormal; |
| | | } |
| | | } |
| | | console.log(excep, "excep"); |
| | | |
| | | let obj = { |
| | | asrtext: null, |
| | | patid: this.patid, |
| | | subId: this.id, |
| | | taskid: this.taskid, |
| | | scriptid: item.id, |
| | | excep: excep, |
| | | questiontext: item.scriptContent, |
| | | categoryid: item.categoryid, |
| | | answerps: item.answerps || null, // 添加附加信息 |
| | | }; |
| | | if (item.scriptType == 2 && item.scriptResult[0]) { |
| | | obj.asrtext = item.scriptResult.join("&"); |
| | | obj.ivrtext = item.scriptResult.join("&"); |
| | | // 处理 scriptResult,直接修改原始数据 |
| | | if (item.scriptType == 2 && item.scriptResult) { |
| | | // 处理数组类型的 scriptResult |
| | | if ( |
| | | Array.isArray(item.scriptResult) && |
| | | item.scriptResult.length > 0 |
| | | ) { |
| | | item.originalScriptResult = item.scriptResult; // 保存原始数组(可选) |
| | | item.scriptResult = item.scriptResult.join("&"); // 转换为字符串 |
| | | } |
| | | } else if (item.scriptType != 2 && item.scriptResult) { |
| | | obj.asrtext = item.scriptResult; |
| | | obj.ivrtext = item.scriptResult; |
| | | // 确保非数组类型已经是字符串 |
| | | if (Array.isArray(item.scriptResult)) { |
| | | item.originalScriptResult = item.scriptResult; // 保存原始数组(可选) |
| | | item.scriptResult = |
| | | item.scriptResult.length > 0 ? item.scriptResult[0] : ""; |
| | | } |
| | | } |
| | | |
| | | // if (item.isoption == 3) { |
| | | // promises.push(serviceSubtaskDetailedit(obj)); |
| | | // } else { |
| | | // promises.push(serviceSubtaskDetailadd(obj)); |
| | | // } |
| | | }); |
| | | console.log(2); |
| | | console.log(this.tableDatatop); |
| | | |
| | | // 创建副本用于保存,避免影响显示 |
| | | const saveData = this.tableDatatop.map((item) => ({ |
| | | ...item, |
| | | // 如果需要,可以在这里做最后的数据清理 |
| | | scriptResult: item.scriptResult || "", // 确保不为 undefined |
| | | })); |
| | | |
| | | let obj = { |
| | | svyTaskTemplateScriptVOS: this.tableDatatop, // 提交处理后的副本 |
| | | svyTaskTemplateScriptVOS: saveData, // 使用处理后的数据 |
| | | param1: this.taskid, |
| | | param2: this.patid, |
| | | param6: this.id, |
| | |
| | | }); |
| | | } |
| | | }); |
| | | // 使用 Promise.all 等待所有异步操作完成 |
| | | // Promise.all(promises) |
| | | // .then((results) => { |
| | | // // 所有异步操作成功完成后的逻辑 |
| | | // results.forEach((res) => { |
| | | // if (res.code !== 200) { |
| | | // this.$modal.error("修改失败"); |
| | | // } |
| | | // }); |
| | | // this.Editsingletasksonyic(6); |
| | | // const orgName = localStorage.getItem("orgname"); |
| | | // console.log(orgName, "orgName"); |
| | | |
| | | // if (this.form.isVisitAgain != 1 || orgName == "丽水市中医院") { |
| | | // this.Torouter(); |
| | | // return; |
| | | // } |
| | | // this.$modal |
| | | // .confirm( |
| | | // '任务保存成功是否针对患者:"' + |
| | | // this.userform.name + |
| | | // '"再次随访?', |
| | | // "确认", |
| | | // { |
| | | // confirmButtonText: "确定", |
| | | // cancelButtonText: "取消", |
| | | // showCancelButton: true, |
| | | // dangerouslyUseHTMLString: true, |
| | | // confirmButtonClass: "custom-confirm-button", // 自定义确认按钮的类名 |
| | | // cancelButtonClass: "custom-cancel-button", // 自定义取消按钮的类名 |
| | | // } |
| | | // ) |
| | | // .then(() => { |
| | | // document.querySelector("#app").scrollTo(0, 0); |
| | | // this.formtidy(); |
| | | // this.dialogFormVisible = true; |
| | | // }) |
| | | // .catch(() => { |
| | | // this.Torouter(); |
| | | // }); |
| | | // }) |
| | | // .catch((error) => { |
| | | // // 如果有任何一个异步操作失败,会进入这里 |
| | | // console.error("发生错误:", error); |
| | | // }); |
| | | }, |
| | | Torouter() { |
| | | if (this.form.serviceType == 13) { |
| | |
| | | }, 3000); |
| | | }, |
| | | yuyingetdetail() { |
| | | console.log("c", 1); |
| | | |
| | | const dataToSubmit = JSON.parse(JSON.stringify(this.tableDatatop)); |
| | | console.log(dataToSubmit, 2); |
| | | |
| | | dataToSubmit.forEach((item, index) => { |
| | | |
| | | // 对拷贝的数据进行操作,不影响原始的 scriptResult 数组 |
| | | if (item.targetvalue) { |
| | | item.scriptResult = item.scriptResult.join("&"); |