WXL
2024-11-26 007d3884ad259883d7a5db6714876e46525ae717
src/views/outsideChainnew.vue
@@ -30,20 +30,20 @@
            <div class="dev-xx">
              <el-radio-group
                class="custom-radio"
                v-model="item.scriptResult"
                v-model="item.questionResult"
                @change="handleOptionChange($event, index, item)"
              >
                <el-radio
                  border
                  v-for="(items, index) in item.svyLibTemplateTargetoptions"
                  v-for="(items, index) in item.ivrLibaScriptTargetoptionList"
                  :class="
                    items.isabnormal && item.scriptResult == items.optioncontent
                    items.isabnormal && item.questionResult == items.targetvalue
                      ? 'red-star'
                      : ''
                  "
                  :key="index"
                  :label="items.optioncontent"
                  >{{ items.optioncontent }}</el-radio
                  :label="items.targetvalue"
                  >{{ items.targetvalue }}</el-radio
                >
              </el-radio-group>
            </div>
@@ -62,27 +62,27 @@
            <div class="dev-xx">
              <el-checkbox-group
                class="custom-radio"
                v-model="item.scriptResult"
                v-model="item.questionResult"
                @change="updateScore($event, index, item)"
              >
                <el-checkbox
                  border
                  @change="$forceUpdate()"
                  v-for="(items, indexs) in item.svyLibTemplateTargetoptions"
                  v-for="(items, indexs) in item.ivrLibaScriptTargetoptionList"
                  :key="indexs"
                  :label="items.optioncontent"
                  :label="items.targetvalue"
                >
                  {{ items.optioncontent }}
                  {{ items.targetvalue }}
                </el-checkbox>
              </el-checkbox-group>
            </div>
            <!-- :class="items.isabnormal ? 'red-star' : ''" -->
            <div v-show="item.prompt && item.scriptResult[0]">
            <div v-show="item.prompt && item.questionResult[0]">
              <el-alert :title="item.prompt" type="warning"> </el-alert>
            </div>
          </div>
          <!-- 填空 -->
          <div class="scriptTopic-dev" :key="index" v-if="item.scriptType == 4">
          <div class="scriptTopic-dev" :key="index" v-if="item.scriptType == 4||item.scriptType == 3">
            <div class="dev-text">
              {{ index + 1 }}、<span style="line-height: 1.5"
                >{{ item.scriptContent
@@ -94,7 +94,7 @@
                type="textarea"
                :rows="3"
                placeholder="请输入答案"
                v-model="item.scriptResult"
                v-model="item.questionResult"
                clearable
              >
              </el-input>
@@ -153,6 +153,7 @@
  Submitaquestionnaire,
  geturlinfo,
} from "@/api/AiCentre/index";
import { type } from "jquery";
import JSEncrypt from "jsencrypt";
export default {
  data() {
@@ -161,91 +162,92 @@
      patid: 265823,
      kcb: "",
      excep: "",
      taskname: "",
      questionList: [
        // {
        //   scriptType: 1,
        //   scriptContent: "您的年龄范围是?",
        //   scriptResult: null,
        //   svyLibTemplateTargetoptions: [
        //     { optioncontent: "18-25", value: "18-25", isabnormal: true },
        //     { optioncontent: "26-35", value: "26-35" },
        //     { optioncontent: "36-45", value: "36-45" },
        //     { optioncontent: "46-55", value: "46-55" },
        //     { optioncontent: "56+", value: "56+" },
        //   questionResult: null,
        //   ivrLibaScriptTargetoptionList: [
        //     { targetvalue: "18-25", value: "18-25", isabnormal: true },
        //     { targetvalue: "26-35", value: "26-35" },
        //     { targetvalue: "36-45", value: "36-45" },
        //     { targetvalue: "46-55", value: "46-55" },
        //     { targetvalue: "56+", value: "56+" },
        //   ],
        //   required: true,
        // },
        // {
        //   scriptType: 1,
        //   scriptContent: "您的职业是什么?",
        //   scriptResult: null,
        //   svyLibTemplateTargetoptions: [
        //     { optioncontent: "学生", value: "student" },
        //     { optioncontent: "教师", value: "teacher" },
        //     { optioncontent: "工程师", value: "engineer" },
        //     { optioncontent: "医生", value: "doctor" },
        //     { optioncontent: "其他", value: "other" },
        //   questionResult: null,
        //   ivrLibaScriptTargetoptionList: [
        //     { targetvalue: "学生", value: "student" },
        //     { targetvalue: "教师", value: "teacher" },
        //     { targetvalue: "工程师", value: "engineer" },
        //     { targetvalue: "医生", value: "doctor" },
        //     { targetvalue: "其他", value: "other" },
        //   ],
        //   required: false,
        // },
        // {
        //   scriptType: 2,
        //   scriptContent: "您感兴趣的活动有哪些?",
        //   scriptResult: [],
        //   svyLibTemplateTargetoptions: [
        //     { optioncontent: "旅游", value: "travel", isabnormal: true },
        //     { optioncontent: "阅读", value: "reading", isabnormal: true },
        //     { optioncontent: "运动", value: "sports", isabnormal: true },
        //     { optioncontent: "音乐", value: "music" },
        //     { optioncontent: "电影", value: "movies" },
        //   questionResult: [],
        //   ivrLibaScriptTargetoptionList: [
        //     { targetvalue: "旅游", value: "travel", isabnormal: true },
        //     { targetvalue: "阅读", value: "reading", isabnormal: true },
        //     { targetvalue: "运动", value: "sports", isabnormal: true },
        //     { targetvalue: "音乐", value: "music" },
        //     { targetvalue: "电影", value: "movies" },
        //   ],
        //   required: false,
        // },
        // {
        //   scriptType: 1,
        //   scriptContent: "您的职业是什么?",
        //   scriptResult: null,
        //   svyLibTemplateTargetoptions: [
        //     { optioncontent: "学生", value: "student" },
        //     { optioncontent: "教师", value: "teacher" },
        //     { optioncontent: "工程师", value: "engineer" },
        //     { optioncontent: "医生", value: "doctor" },
        //     { optioncontent: "其他", value: "other" },
        //   questionResult: null,
        //   ivrLibaScriptTargetoptionList: [
        //     { targetvalue: "学生", value: "student" },
        //     { targetvalue: "教师", value: "teacher" },
        //     { targetvalue: "工程师", value: "engineer" },
        //     { targetvalue: "医生", value: "doctor" },
        //     { targetvalue: "其他", value: "other" },
        //   ],
        //   required: false,
        // },
        // {
        //   scriptType: 1,
        //   scriptContent: "您的职业是什么?",
        //   scriptResult: null,
        //   svyLibTemplateTargetoptions: [
        //     { optioncontent: "学生", value: "student" },
        //     { optioncontent: "教师", value: "teacher" },
        //     { optioncontent: "工程师", value: "engineer", isabnormal: true },
        //     { optioncontent: "医生", value: "doctor" },
        //     { optioncontent: "其他", value: "other" },
        //   questionResult: null,
        //   ivrLibaScriptTargetoptionList: [
        //     { targetvalue: "学生", value: "student" },
        //     { targetvalue: "教师", value: "teacher" },
        //     { targetvalue: "工程师", value: "engineer", isabnormal: true },
        //     { targetvalue: "医生", value: "doctor" },
        //     { targetvalue: "其他", value: "other" },
        //   ],
        //   required: false,
        // },
        // {
        //   scriptType: 1,
        //   scriptContent: "您的职业是什么?",
        //   scriptResult: null,
        //   svyLibTemplateTargetoptions: [
        //     { optioncontent: "学生", value: "student" },
        //     { optioncontent: "教师", value: "teacher" },
        //     { optioncontent: "工程师", value: "engineer" },
        //     { optioncontent: "医生", value: "doctor" },
        //     { optioncontent: "其他", value: "other" },
        //   questionResult: null,
        //   ivrLibaScriptTargetoptionList: [
        //     { targetvalue: "学生", value: "student" },
        //     { targetvalue: "教师", value: "teacher" },
        //     { targetvalue: "工程师", value: "engineer" },
        //     { targetvalue: "医生", value: "doctor" },
        //     { targetvalue: "其他", value: "other" },
        //   ],
        //   required: false,
        // },
        // {
        //   scriptType: 4,
        //   scriptContent: "您的姓名是什么?",
        //   scriptResult: "name",
        //   questionResult: "name",
        //   required: true,
        //   scriptResult: null,
        //   questionResult: null,
        // },
      ],
      jsy: null,
@@ -282,28 +284,33 @@
      // 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 = param3;
      // this.taskname = param3;
      // let taskid =
      //   "OFp7tn/B6x7IzKJetvGWHdSWBj7msRlnlj6am9dyuHTH6sEt4uBbVCUXs5kcF/e4O2W6vqHf2Bz9K3/evbYDmw==";
      // let patid =
@@ -320,10 +327,10 @@
            this.accomplish = res.data.submit;
            if (this.questionList[0]) {
              this.questionList.forEach((item) => {
                if (item.scriptResult && item.scriptType != 2) {
                  item.scriptResult = JSON.parse(item.scriptResult);
                } else if (item.scriptResult && item.scriptType == 2) {
                  item.scriptResult = item.scriptResult.split("&");
                if (item.questionResult && item.scriptType != 2) {
                  item.questionResult = JSON.parse(item.questionResult);
                } else if (item.questionResult && item.scriptType == 2) {
                  item.questionResult = item.questionResult.split("&");
                }
              });
              return;
@@ -344,11 +351,14 @@
            this.questionList = res.data.script;
            this.jsy = res.data.jsy;
            this.kcb = res.data.kcb;
            this.taskname = res.data.taskName;
            this.type = res.data.type;
            // 处理题目收集结果格式
            this.questionList.forEach((item) => {
              item.nextScriptno = Number(item.nextScriptno);
              if (item.scriptType == 2) {
                item.scriptResult = [];
                item.questionResult = [];
              }
            });
          }
@@ -374,13 +384,14 @@
        param1: this.taskid,
        param2: this.patid,
        excep: this.excep,
        type: this.type,
        serviceSubtaskDetailList: [],
      };
      const arr = structuredClone(this.questionList);
      // arr.forEach((item) => {
      //   item.asrtext = JSON.stringify(item.scriptResult);
      //   if (item.scriptType == 2 && item.scriptResult[0]) {
      //     item.scriptResult = item.scriptResult.join("&");
      //   item.asrtext = JSON.stringify(item.questionResult);
      //   if (item.scriptType == 2 && item.questionResult[0]) {
      //     item.questionResult = item.questionResult.join("&");
      //   }
      // });
      form.serviceSubtaskDetailList = arr;
@@ -400,14 +411,18 @@
      let form = {
        param1: this.taskid,
        param2: this.patid,
        svyLibTemplateScriptVOS: [],
        type: this.type,
        ivrLibaTemplateScriptVOList: [],
      };
      const arr = structuredClone(this.questionList);
      console.log(arr, "srr");
      arr.forEach((item, index) => {
        var obj = item.svyLibTemplateTargetoptions.find(
          (items) => items.optioncontent == item.scriptResult
        if (item.scriptType == 3||item.scriptType == 4) return;
        var obj = item.ivrLibaScriptTargetoptionList.find(
          (items) => items.targetvalue == item.questionResult
        );
        console.log(obj, "isabnormal");
        if (obj.isabnormal) {
          console.log(obj.isabnormal);
          form.excep = 1;
@@ -416,13 +431,13 @@
      });
      arr.forEach((item) => {
        if (item.scriptType == 2 && item.scriptResult[0]) {
          item.scriptResult = item.scriptResult.join("&");
        } else if (item.scriptType != 2 && item.scriptResult) {
          item.scriptResult = JSON.stringify(item.scriptResult);
        if (item.scriptType == 2 && item.questionResult[0]) {
          item.questionResult = item.questionResult.join("&");
        } else if (item.scriptType != 2 && item.questionResult) {
          item.questionResult = JSON.stringify(item.questionResult);
        }
      });
      form.svyLibTemplateScriptVOS = arr;
      form.ivrLibaTemplateScriptVOList = arr;
      Cachequestionnaire(form).then((res) => {
        if (res.code == 200) {
          if (subm) {
@@ -434,8 +449,8 @@
    // 处理单选选项
    handleOptionChange(selectedvalue, index, arr) {
      // 查找选中的选项对象
      const selectedOption = arr.svyLibTemplateTargetoptions.find(
        (option) => option.optioncontent == selectedvalue
      const selectedOption = arr.ivrLibaScriptTargetoptionList.find(
        (option) => option.targetvalue == selectedvalue
      );
      if (selectedOption) {
        // 将选中的选项对象的 id 赋值给 obj.sonId
@@ -449,8 +464,8 @@
      // ��加分数
      let score = 0;
      selectedvalues.forEach((value) => {
        const selectedOption = arr.svyLibTemplateTargetoptions.find(
          (option) => option.optioncontent == value
        const selectedOption = arr.ivrLibaScriptTargetoptionList.find(
          (option) => option.targetvalue == value
        );
        if (selectedOption) {
          score += Number(selectedOption.score);