WXL (wul)
6 天以前 a5cba9ab040f6f97558046885dce3017f9bab7e9
src/views/outsideChainwtnew.vue
@@ -23,7 +23,9 @@
                  : "亲爱的患者-家属,我们是医院的医护人员,为了更好地了解您的康复情况,请您抽一点宝贵时间,完成这份随访问卷。"
              }}
            </div>
            <div v-if="orgname" class="questionnaire-signature">———{{ orgname }}</div>
            <div v-if="orgname" class="questionnaire-signature">
              ———{{ orgname }}
            </div>
          </div>
          <el-divider class="custom-divider"></el-divider>
@@ -327,6 +329,7 @@
        <div class="completion-content">
          <div class="completion-icon">✓</div>
          <h2 class="completion-title">感谢您的配合!</h2>
          <h2 class="completion-title">祝您健康快乐!</h2>
          <p class="completion-message">
            {{
              jsy
@@ -357,11 +360,13 @@
      taskid: 355,
      patid: 265823,
      kcb: "",
      subtaskid: null,
      excep: 0,
      isabnormal: 0,
      taskname: "",
      orgname: "",
      questionList: [],
      permanentlyHidden: [], // 存储被永久隐藏的题目索引
      param6: null,
      jsy: null,
      dialogVisible: false,
@@ -497,6 +502,7 @@
      console.log(url, "url");
      // let url = 'http://218.108.11.22:8093/sf/003';
      // let urlid = this.extractLastSegmentFromUrl(url);
      console.log("棒棒2");
      geturlinfo(url).then((res) => {
        if (res.code == 200) {
@@ -504,9 +510,18 @@
            res.data.param1,
            res.data.param2,
            res.data.param3,
            res.data.param5
            res.data.param5,
            res.data.param6
          );
          this.orgname = res.data.orgname;
          if (
            res.data.orgname == "省立同德翠苑院区" ||
            res.data.orgname == "省立同德之江院区" ||
            res.data.orgname == "省立同德闲林院区"
          ) {
            this.orgname = "浙江省立同德医院";
          } else {
            this.orgname = res.data.orgname;
          }
          this.param6 = res.data.param6;
        }
@@ -541,10 +556,11 @@
    // },
    // 获取数据
    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 =
@@ -556,7 +572,11 @@
      // 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;
@@ -583,12 +603,18 @@
    },
    // 获取数据
    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);
@@ -727,9 +753,10 @@
    // 新增的切换选中/取消选中方法
    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;
@@ -743,20 +770,15 @@
          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
      );
@@ -766,90 +788,93 @@
        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 };
          }
          // 其他题目保持不变
          return item;
        });
      }
      this.$forceUpdate();
      // 在处理完题目显示/隐藏后,强制更新视图以确保序号正确
      this.$forceUpdate();
      this.$nextTick(() => {
        this.$forceUpdate();
      });
@@ -886,32 +911,46 @@
}
.questionnaire-title {
  color: #175997;
  color: #0d3b6b; // 基础深蓝色
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 15px;
  line-height: 1.3;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.4);
  // 针对夜间模式的优化
  @media (prefers-color-scheme: dark) {
    color: #4a90d9; // 夜间模式使用更亮的蓝色
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  }
}
.questionnaire-description {
  font-size: 16px;
  color: #5a6c84;
  color: #303a47;
  line-height: 1.8;
  max-width: 720px;
  margin: 0;
  padding: 0 16px;
  text-align: justify; /* 两端对齐,更美观 */
  text-indent: 2em; /* 首行缩进 */
  text-align: justify;
  /* 两端对齐,更美观 */
  text-indent: 2em;
  /* 首行缩进 */
}
.questionnaire-signature {
  font-size: 15px;
  color: #8a9bb5; /* 比正文颜色稍浅,体现附属感 */
  text-align: right; /* 右对齐 */
  font-size: 16px;
  color: #303a47;
  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;
@@ -972,11 +1011,24 @@
.question-stem {
  display: grid;
  grid-template-columns: auto 1fr auto; /* 题号自适应,文本占满剩余空间,题型标签自适应 */
  grid-template-columns: auto 1fr auto;
  gap: 3px;
  align-items: center;
  align-items: start;
  /* 改为 start 避免居中导致的视觉问题 */
  margin-bottom: 20px;
  font-size: 18px;
}
.question-text {
  line-height: 1.5;
  color: #2c3e50;
  font-weight: 500;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  /* 确保允许换行 */
  min-width: 0;
  /* 防止 grid 项溢出 */
}
.question-number {
@@ -985,14 +1037,14 @@
  min-width: 16px;
}
.question-text {
  line-height: 1.5;
  color: #2c3e50;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
// .question-text {
//   line-height: 1.5;
//   color: #2c3e50;
//   font-weight: 500;
//   overflow: hidden;
//   text-overflow: ellipsis;
//   white-space: nowrap;
// }
.question-type-tag {
  color: #3ba2f7;
@@ -1002,38 +1054,77 @@
}
.question-options {
  margin: 15px 0;
  margin: 12px 0;
  padding: 0 4px;
}
.options-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
::v-deep .el-radio-group.options-group,
::v-deep .el-checkbox-group.options-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
}
// 同样处理多选的情况
::v-deep .el-checkbox-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  @media (max-width: 420px) {
    grid-template-columns: 1fr;
  }
}
// 修改选项的样式
.option-radio,
.option-checkbox {
  margin: 0;
  padding: 12px 15px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  &:hover {
    border-color: #c0c4cc;
    background-color: #f8fafc;
  }
  // 确保内部内容自适应
  :deep(.el-radio__label),
  :deep(.el-checkbox__label) {
    display: inline;
    font-size: 15px;
    line-height: 1.4;
    word-break: break-all; // 允许在任意字符处换行
    white-space: normal; // 允许自动换行
    padding-left: 6px;
  }
  // 确保 radio/checkbox 图标不压缩
  :deep(.el-radio__input),
  :deep(.el-checkbox__input) {
    flex-shrink: 0;
  }
}
:deep(.option-radio .el-radio__label),
:deep(.option-checkbox .el-checkbox__label) {
  display: flex;
  align-items: center;
  font-size: 16px;
}
// :deep(.option-radio .el-radio__label),
// :deep(.option-checkbox .el-checkbox__label) {
//   display: flex;
//   align-items: center;
//   font-size: 16px;
// }
.option-text {
  margin-right: 5px;
  word-break: break-all;
  white-space: normal;
  line-height: 1.4;
}
.abnormal-indicator {
@@ -1065,6 +1156,7 @@
.question-warning {
  margin-top: 15px;
}
.append-input-container {
  margin-top: 15px;
  padding: 10px;
@@ -1072,6 +1164,7 @@
  border-radius: 4px;
  border: 1px solid #dcdfe6;
}
.warning-alert {
  :deep(.el-alert__title) {
    font-size: 15px;
@@ -1162,11 +1255,11 @@
    font-size: 16px;
  }
  .question-stem {
    font-size: 16px;
    flex-direction: column;
    align-items: flex-start;
  }
  // .question-stem {
  //   font-size: 16px;
  //   flex-direction: column;
  //   align-items: flex-start;
  // }
  .question-type-tag {
    margin-left: 0;
@@ -1215,6 +1308,7 @@
    font-size: 16px;
  }
}
.loading-container {
  display: flex;
  justify-content: center;
@@ -1246,6 +1340,7 @@
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }