WXL (wul)
5 天以前 ec47fecd41a22861c3fc65ca86311225dd28d7ee
src/views/outsideChainwtnew.vue
@@ -8,7 +8,9 @@
            {{
              kcb
                ? kcb
                : "亲爱的患者-家属,您好!我们是景宁人民医院的医护人员,为了更好地了解您的康复情况,请您抽一点宝贵时间,完成这份随访问卷。"
                : "亲爱的患者-家属,我们是" +
                  localStorage.getItem("orgname") +
                  "的医护人员,为了更好地了解您的康复情况,请您抽一点宝贵时间,完成这份随访问卷。"
            }}
            <!-- 亲爱的患者/家属您好,为了更好的了解您出院后的康复情况,给您适当及时的健康指导,请您抽一点宝贵时间,完成这份出院随访问卷调查。 -->
          </div>
@@ -19,6 +21,7 @@
          class="topic-dev"
          v-for="(item, index) in questionList"
          :key="item.aaa"
          v-if="!item.ishide"
        >
          <div class="scriptTopic-dev" :key="index" v-if="item.scriptType == 1">
            <div class="dev-text">
@@ -35,7 +38,7 @@
              >
                <el-radio
                  border
                  v-for="(items, index) in item.svyLibTemplateTargetoptions"
                  v-for="(items, index) in item.svyTaskTemplateTargetoptions"
                  :class="
                    items.isabnormal && item.scriptResult == items.optioncontent
                      ? 'red-star'
@@ -63,12 +66,11 @@
              <el-checkbox-group
                class="custom-radio"
                v-model="item.scriptResult"
                @change="updateScore($event, index, item)"
              >
                <el-checkbox
                  border
                  @change="$forceUpdate()"
                  v-for="(items, indexs) in item.svyLibTemplateTargetoptions"
                  v-for="(items, indexs) in item.svyTaskTemplateTargetoptions"
                  :key="indexs"
                  :label="items.optioncontent"
                >
@@ -166,7 +168,7 @@
        //   scriptType: 1,
        //   scriptContent: "您的年龄范围是?",
        //   scriptResult: null,
        //   svyLibTemplateTargetoptions: [
        //   svyTaskTemplateTargetoptions: [
        //     { optioncontent: "18-25", value: "18-25", isabnormal: true },
        //     { optioncontent: "26-35", value: "26-35" },
        //     { optioncontent: "36-45", value: "36-45" },
@@ -179,7 +181,7 @@
        //   scriptType: 1,
        //   scriptContent: "您的职业是什么?",
        //   scriptResult: null,
        //   svyLibTemplateTargetoptions: [
        //   svyTaskTemplateTargetoptions: [
        //     { optioncontent: "学生", value: "student" },
        //     { optioncontent: "教师", value: "teacher" },
        //     { optioncontent: "工程师", value: "engineer" },
@@ -192,7 +194,7 @@
        //   scriptType: 2,
        //   scriptContent: "您感兴趣的活动有哪些?",
        //   scriptResult: [],
        //   svyLibTemplateTargetoptions: [
        //   svyTaskTemplateTargetoptions: [
        //     { optioncontent: "旅游", value: "travel", isabnormal: true },
        //     { optioncontent: "阅读", value: "reading", isabnormal: true },
        //     { optioncontent: "运动", value: "sports", isabnormal: true },
@@ -205,7 +207,7 @@
        //   scriptType: 1,
        //   scriptContent: "您的职业是什么?",
        //   scriptResult: null,
        //   svyLibTemplateTargetoptions: [
        //   svyTaskTemplateTargetoptions: [
        //     { optioncontent: "学生", value: "student" },
        //     { optioncontent: "教师", value: "teacher" },
        //     { optioncontent: "工程师", value: "engineer" },
@@ -218,7 +220,7 @@
        //   scriptType: 1,
        //   scriptContent: "您的职业是什么?",
        //   scriptResult: null,
        //   svyLibTemplateTargetoptions: [
        //   svyTaskTemplateTargetoptions: [
        //     { optioncontent: "学生", value: "student" },
        //     { optioncontent: "教师", value: "teacher" },
        //     { optioncontent: "工程师", value: "engineer", isabnormal: true },
@@ -231,7 +233,7 @@
        //   scriptType: 1,
        //   scriptContent: "您的职业是什么?",
        //   scriptResult: null,
        //   svyLibTemplateTargetoptions: [
        //   svyTaskTemplateTargetoptions: [
        //     { optioncontent: "学生", value: "student" },
        //     { optioncontent: "教师", value: "teacher" },
        //     { optioncontent: "工程师", value: "engineer" },
@@ -277,31 +279,36 @@
  methods: {
    // 解析urlid
    geturlinfo() {
       // let url = window.location.href;
       let url = this.$route.query.p;
       console.log(url,"url");
      // let url = window.location.href;
      let url = this.$route.query.p;
      console.log(url, "url");
      // let url = 'http://218.108.11.22:8093/sf/003';
      // let urlid = this.extractLastSegmentFromUrl(url);
      geturlinfo( url ).then((res) => {
       if (res.code==200) {
         this.getQuestionnaire(res.data.param1,res.data.param2,res.data.param3,res.data.param5,)
       }
      geturlinfo(url).then((res) => {
        if (res.code == 200) {
          this.getQuestionnaire(
            res.data.param1,
            res.data.param2,
            res.data.param3,
            res.data.param5
          );
        }
      });
    },
//     extractLastSegmentFromUrl(url) {
//     // 找到最后一个'/'的位置
//     const lastSlashIndex = url.lastIndexOf('/');
//     // 如果找到了'/',截取其后的所有字符
//     if (lastSlashIndex !== -1) {
//         return url.substring(lastSlashIndex + 1);
//     }
//     // 如果没有找到'/',返回空字符串
//     return '';
// },
    //     extractLastSegmentFromUrl(url) {
    //     // 找到最后一个'/'的位置
    //     const lastSlashIndex = url.lastIndexOf('/');
    //     // 如果找到了'/',截取其后的所有字符
    //     if (lastSlashIndex !== -1) {
    //         return url.substring(lastSlashIndex + 1);
    //     }
    //     // 如果没有找到'/',返回空字符串
    //     return '';
    // },
    // 获取数据
    getQuestionnaire(param1,param2,param3) {
    getQuestionnaire(param1, param2, param3) {
      this.taskid = decodeURIComponent(param1);
      this.patid = decodeURIComponent(param2);
      this.taskname = decodeURIComponent(param3);
@@ -401,18 +408,22 @@
      let form = {
        param1: this.taskid,
        param2: this.patid,
        svyLibTemplateScriptVOS: [],
        svyTaskTemplateScriptVOS: [],
      };
      const arr = structuredClone(this.questionList);
      console.log(arr, "srr");
      arr.forEach((item, index) => {
        var obj = item.svyLibTemplateTargetoptions.find(
        var obj = item.svyTaskTemplateTargetoptions.find(
          (items) => items.optioncontent == item.scriptResult
        );
        if (obj.isabnormal) {
          console.log(obj.isabnormal);
          form.excep = 1;
          this.excep = 1;
        console.log(obj, "obj");
        if (obj) {
          if (obj.isabnormal) {
            console.log(obj.isabnormal);
            form.excep = 1;
            this.excep = 1;
          }
        }
      });
@@ -423,7 +434,8 @@
          item.scriptResult = JSON.stringify(item.scriptResult);
        }
      });
      form.svyLibTemplateScriptVOS = arr;
      form.svyTaskTemplateScriptVOS = arr;
      form.type = 2;
      Cachequestionnaire(form).then((res) => {
        if (res.code == 200) {
          if (subm) {
@@ -435,7 +447,7 @@
    // 处理单选选项
    handleOptionChange(selectedvalue, index, arr) {
      // 查找选中的选项对象
      const selectedOption = arr.svyLibTemplateTargetoptions.find(
      const selectedOption = arr.svyTaskTemplateTargetoptions.find(
        (option) => option.optioncontent == selectedvalue
      );
      if (selectedOption) {
@@ -446,19 +458,19 @@
      }
    },
    // 处理多选选项
    updateScore(selectedvalues, index, arr) {
      // ��加分数
      let score = 0;
      selectedvalues.forEach((value) => {
        const selectedOption = arr.svyLibTemplateTargetoptions.find(
          (option) => option.optioncontent == value
        );
        if (selectedOption) {
          score += Number(selectedOption.score);
        }
      });
      this.questionList[index].score = score;
    },
    // updateScore(selectedvalues, index, arr) {
    //   // ��加分数
    //   let score = 0;
    //   selectedvalues.forEach((value) => {
    //     const selectedOption = arr.svyTaskTemplateTargetoptions.find(
    //       (option) => option.optioncontent == value
    //     );
    //     if (selectedOption) {
    //       score += Number(selectedOption.score);
    //     }
    //   });
    //   this.questionList[index].score = score;
    // },
  },
};
</script>