| | |
| | | taskid: 355, |
| | | patid: 265823, |
| | | kcb: "", |
| | | subtaskid: null, |
| | | excep: 0, |
| | | isabnormal: 0, |
| | | taskname: "", |
| | | orgname: "", |
| | | questionList: [], |
| | | permanentlyHidden: [], // 存储被永久隐藏的题目索引 |
| | | param6: null, |
| | | jsy: null, |
| | | dialogVisible: false, |
| | |
| | | res.data.param1, |
| | | res.data.param2, |
| | | res.data.param3, |
| | | res.data.param5 |
| | | res.data.param5, |
| | | res.data.param6 |
| | | ); |
| | | if ( |
| | | res.data.orgname == "省立同德翠苑院区" || |
| | |
| | | // }, |
| | | |
| | | // 获取数据 |
| | | getQuestionnaire(param1, param2, param3) { |
| | | getQuestionnaire(param1, param2, param3, param5, param6) { |
| | | this.taskid = decodeURIComponent(param1); |
| | | this.patid = decodeURIComponent(param2); |
| | | this.taskname = decodeURIComponent(param3); |
| | | this.subtaskid = decodeURIComponent(param6); |
| | | this.loading = true; |
| | | |
| | | // let taskid = |
| | |
| | | // let taskids = this.encrypt(this.taskid); |
| | | // let patids = this.encrypt(this.patid); |
| | | // 先取缓存 |
| | | getCachequestionnaire({ param1: this.taskid, param2: this.patid }) |
| | | getCachequestionnaire({ |
| | | param1: this.taskid, |
| | | param2: this.patid, |
| | | param6: param6, |
| | | }) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | this.questionList = res.data.result; |
| | |
| | | }, |
| | | // 获取数据 |
| | | getExternalfollowup() { |
| | | getExternalfollowup({ param1: this.taskid, param2: this.patid }) |
| | | getExternalfollowup({ |
| | | param1: this.taskid, |
| | | param2: this.patid, |
| | | param6: this.subtaskid, |
| | | }) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | this.questionList = res.data.script; |
| | | this.jsy = res.data.jsy; |
| | | this.kcb = res.data.kcb; |
| | | if (res.data.taskName) this.taskname = res.data.taskName; |
| | | |
| | | // 处理题目收集结果格式 |
| | | this.questionList.forEach((item) => { |
| | | item.nextScriptno = Number(item.nextScriptno); |
| | |
| | | // 新增的切换选中/取消选中方法 |
| | | handleRadioToggle(questionItem, globalIndex, options, optionValue) { |
| | | // 保存当前状态以便后续比较 |
| | | const previousState = JSON.parse(JSON.stringify(this.questionList)); |
| | | this.permanentlyHidden = this.permanentlyHidden.filter( |
| | | (idx) => idx <= globalIndex |
| | | ); |
| | | |
| | | // 原有的处理逻辑 |
| | | if (questionItem.scriptResult == optionValue) { |
| | | questionItem.scriptResult = ""; |
| | | questionItem.isabnormal = 0; |
| | |
| | | questionItem |
| | | ); |
| | | } |
| | | |
| | | // 处理完成后,确保重新计算可见题目的序号 |
| | | this.$forceUpdate(); |
| | | }, |
| | | |
| | | // 在methods部分,修改handleOptionChange方法: |
| | | handleOptionChange(selectedOption, questionIndex, options, a) { |
| | | console.log(selectedOption, questionIndex, options, a, "888"); |
| | | |
| | | if (document.activeElement) { |
| | | document.activeElement.blur(); |
| | | } |
| | | |
| | | // 找到被选中的选项对象 |
| | | const selectedOptionObj = options.find( |
| | | (item) => item.optioncontent == selectedOption |
| | | ); |
| | |
| | | this.questionList[questionIndex].score = selectedOptionObj.score; |
| | | this.questionList[questionIndex].prompt = selectedOptionObj.prompt; |
| | | } |
| | | // 处理异常状态高亮 |
| | | console.log( |
| | | this.questionList[questionIndex].nextScriptno, |
| | | "this.questionList[questionIndex].nextScriptno" |
| | | ); |
| | | console.log(questionIndex, "questionIndex"); |
| | | |
| | | this.questionList[questionIndex].isabnormal = |
| | | selectedOptionObj.isabnormal; |
| | | // 处理附加输入框显示 |
| | | |
| | | this.questionList[questionIndex].showAppendInput = |
| | | selectedOptionObj.appendflag == 1; |
| | | console.log(this.questionList); |
| | | console.log(selectedOptionObj.appendflag); |
| | | |
| | | // if (!this.questionList[questionIndex].showAppendInput) { |
| | | // this.questionList[questionIndex].answerps = ""; // 清除附加信息 |
| | | // } |
| | | // 保存当前题目之前已经隐藏的题目状态 |
| | | // 记录当前题之前已隐藏的题目索引(不改变) |
| | | const previouslyHiddenBeforeCurrent = this.questionList |
| | | .slice(0, questionIndex) |
| | | .map((item, index) => (item.ishide ? index : -1)) |
| | | .filter((index) => index !== -1); |
| | | .filter((idx) => idx !== -1); |
| | | |
| | | // 保存之前因nextQuestion=0而隐藏的题目范围 |
| | | const previouslyHiddenByEnd = this.questionList |
| | | .map((item, index) => (item.hiddenByEnd ? index : -1)) |
| | | .filter((index) => index !== -1); |
| | | |
| | | // 如果branchFlag为1,处理题目跳转 |
| | | if (a.branchFlag == 1) { |
| | | if (selectedOptionObj.nextQuestion == 0) { |
| | | // 结束问答 - 隐藏后面所有题目并标记 |
| | | // 【结束问答】隐藏所有后续题目,并记录永久隐藏 |
| | | this.questionList = this.questionList.map((item, index) => ({ |
| | | ...item, |
| | | ishide: index > questionIndex, |
| | | hiddenByEnd: index > questionIndex, // 标记这些题目是被结束问答隐藏的 |
| | | hiddenByEnd: index > questionIndex, |
| | | })); |
| | | // 将后续隐藏的题目加入永久隐藏 |
| | | this.questionList.forEach((item, idx) => { |
| | | if (idx > questionIndex && !this.permanentlyHidden.includes(idx)) { |
| | | this.permanentlyHidden.push(idx); |
| | | } |
| | | }); |
| | | } else { |
| | | // 正常跳转逻辑 |
| | | // 【正常跳转】 |
| | | const nextQuestionIndex = selectedOptionObj.nextQuestion - 1; |
| | | console.log(nextQuestionIndex, 4); |
| | | console.log(selectedOptionObj); |
| | | |
| | | this.questionList = this.questionList.map((item, index) => { |
| | | // 保留当前题目之前的隐藏状态 |
| | | if (index < questionIndex) { |
| | | return { |
| | | ...item, |
| | | ishide: previouslyHiddenBeforeCurrent.includes(index), |
| | | hiddenByEnd: false, // 清除结束标记 |
| | | hiddenByEnd: false, |
| | | }; |
| | | } |
| | | |
| | | // 当前题目总是可见 |
| | | if (index == questionIndex) { |
| | | return { ...item, ishide: 0, hiddenByEnd: false }; |
| | | } |
| | | |
| | | // 显示目标下一题 |
| | | // 目标题:若在永久隐藏列表中,强制隐藏 |
| | | if (index == nextQuestionIndex) { |
| | | return { ...item, ishide: 0, hiddenByEnd: false }; |
| | | const shouldShow = !this.permanentlyHidden.includes(index); |
| | | return { |
| | | ...item, |
| | | ishide: shouldShow ? 0 : 1, |
| | | hiddenByEnd: false, |
| | | }; |
| | | } |
| | | |
| | | // 如果是之前被结束问答隐藏的题目,现在应该恢复显示 |
| | | // 之前因结束问答隐藏的题:恢复显示但检查永久隐藏 |
| | | if (item.hiddenByEnd) { |
| | | return { ...item, ishide: 0, hiddenByEnd: false }; |
| | | const shouldShow = !this.permanentlyHidden.includes(index); |
| | | return { |
| | | ...item, |
| | | ishide: shouldShow ? 0 : 1, |
| | | hiddenByEnd: false, |
| | | }; |
| | | } |
| | | |
| | | // 隐藏当前题和目标题之间的题目 |
| | | // 隐藏当前题和目标题之间的题目,并记录永久隐藏 |
| | | if (index > questionIndex && index < nextQuestionIndex) { |
| | | if (!this.permanentlyHidden.includes(index)) { |
| | | this.permanentlyHidden.push(index); |
| | | } |
| | | return { ...item, ishide: 1, hiddenByEnd: false }; |
| | | } |
| | | |
| | | // 其他情况保持原状 |
| | | return item; |
| | | }); |
| | | } |
| | | } else { |
| | | // 如果没有跳转,只需确保下一题可见 |
| | | this.questionList = this.questionList.map((item, index) => ({ |
| | | ...item, |
| | | ishide: index == questionIndex + 1 ? 0 : item.ishide, |
| | | hiddenByEnd: index == questionIndex + 1 ? false : item.hiddenByEnd, |
| | | })); |
| | | // 【无跳转】仅显示下一题,但需检查永久隐藏 |
| | | // 如果没有跳转,只需确保下一题可见,但需检查永久隐藏 |
| | | this.questionList = this.questionList.map((item, index) => { |
| | | if (index == questionIndex + 1) { |
| | | const shouldShow = !this.permanentlyHidden.includes(index); |
| | | return { ...item, ishide: shouldShow ? 0 : 1, hiddenByEnd: false }; |
| | | } |
| | | this.$forceUpdate(); |
| | | // 其他题目保持不变 |
| | | return item; |
| | | }); |
| | | } |
| | | |
| | | // 在处理完题目显示/隐藏后,强制更新视图以确保序号正确 |
| | | this.$forceUpdate(); |
| | | this.$nextTick(() => { |
| | | this.$forceUpdate(); |
| | | }); |
| | |
| | | max-width: 720px; |
| | | margin: 0; |
| | | padding: 0 16px; |
| | | text-align: justify; /* 两端对齐,更美观 */ |
| | | text-indent: 2em; /* 首行缩进 */ |
| | | text-align: justify; |
| | | /* 两端对齐,更美观 */ |
| | | text-indent: 2em; |
| | | /* 首行缩进 */ |
| | | } |
| | | |
| | | .questionnaire-signature { |
| | | font-size: 16px; |
| | | color: #303a47; |
| | | text-align: right; /* 右对齐 */ |
| | | text-align: right; |
| | | /* 右对齐 */ |
| | | max-width: 720px; |
| | | margin: 8px 0 0 auto; /* 上边距8px,右边靠齐 */ |
| | | margin: 8px 0 0 auto; |
| | | /* 上边距8px,右边靠齐 */ |
| | | padding: 0 16px; |
| | | letter-spacing: 1px; /* 字间距稍宽,更有落款感 */ |
| | | letter-spacing: 1px; |
| | | /* 字间距稍宽,更有落款感 */ |
| | | } |
| | | |
| | | .custom-divider { |
| | | margin: 25px 0; |
| | | background-color: #eaeef2; |
| | |
| | | display: grid; |
| | | grid-template-columns: auto 1fr auto; |
| | | gap: 3px; |
| | | align-items: start; /* 改为 start 避免居中导致的视觉问题 */ |
| | | align-items: start; |
| | | /* 改为 start 避免居中导致的视觉问题 */ |
| | | margin-bottom: 20px; |
| | | font-size: 18px; |
| | | } |
| | |
| | | font-weight: 500; |
| | | word-wrap: break-word; |
| | | overflow-wrap: break-word; |
| | | white-space: normal; /* 确保允许换行 */ |
| | | min-width: 0; /* 防止 grid 项溢出 */ |
| | | white-space: normal; |
| | | /* 确保允许换行 */ |
| | | min-width: 0; |
| | | /* 防止 grid 项溢出 */ |
| | | } |
| | | |
| | | .question-number { |
| | |
| | | margin: 12px 0; |
| | | padding: 0 4px; |
| | | } |
| | | |
| | | ::v-deep .el-radio-group.options-group, |
| | | ::v-deep .el-checkbox-group.options-group { |
| | | display: grid; |
| | |
| | | grid-template-columns: 1fr; |
| | | } |
| | | } |
| | | |
| | | // 修改选项的样式 |
| | | .option-radio, |
| | | .option-checkbox { |
| | |
| | | .question-warning { |
| | | margin-top: 15px; |
| | | } |
| | | |
| | | .append-input-container { |
| | | margin-top: 15px; |
| | | padding: 10px; |
| | |
| | | border-radius: 4px; |
| | | border: 1px solid #dcdfe6; |
| | | } |
| | | |
| | | .warning-alert { |
| | | :deep(.el-alert__title) { |
| | | font-size: 15px; |
| | |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | |
| | | .loading-container { |
| | | display: flex; |
| | | justify-content: center; |
| | |
| | | from { |
| | | transform: rotate(0deg); |
| | | } |
| | | |
| | | to { |
| | | transform: rotate(360deg); |
| | | } |