WXL (wul)
3 天以前 93bc6ed9fbed8472be7b393334855743d09940f8
src/views/knowledge/questionnaire/compilequer/index.vue
@@ -262,7 +262,7 @@
                  <el-option
                    class="ruleFormaa"
                    v-for="item in flatArray"
                    :key="item.deptCode"
                    :key="item.id"
                    :label="item.label"
                    :value="item.deptCode"
                  >
@@ -285,7 +285,7 @@
                  <el-option
                    class="ruleFormaa"
                    v-for="item in flatArray"
                    :key="item.deptCode"
                    :key="item.id"
                    :label="item.label"
                    :value="item.deptCode"
                  >
@@ -310,7 +310,7 @@
              >下一步</el-button
            >
            <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
            <el-button @click="Departmenttreatment('ruleForm')"
            <el-button @click="toExamine('ruleForm')"
              >保存问卷基础信息</el-button
            >
          </el-form-item>
@@ -566,10 +566,10 @@
                    </el-form-item></el-col
                  >
                  <el-col :span="12"
                    ><el-form-item label="是否可用">
                      <el-radio-group v-model="topicobj.isenable">
                    ><el-form-item label="是否隐藏">
                      <el-radio-group v-model="topicobj.ishide">
                        <el-radio
                          v-for="(item, index) in usable"
                          v-for="(item, index) in hides"
                          :label="item.value"
                          >{{ item.label }}</el-radio
                        >
@@ -582,8 +582,8 @@
                  v-if="topicobj.scriptType == 1"
                >
                  <el-radio-group v-model="topicobj.branchFlag">
                    <el-radio :label="1">是</el-radio>
                    <el-radio :label="0">否</el-radio>
                    <el-radio label="1">是</el-radio>
                    <el-radio label="0">否</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="选中提示" v-if="topicobj.scriptType != 1">
@@ -635,8 +635,8 @@
                        >
                          <el-radio-group v-model="item.score">
                            <el-radio :label="1">A</el-radio>
                          <el-radio :label="2">B</el-radio>
                          <el-radio :label="3">C</el-radio>
                            <el-radio :label="2">B</el-radio>
                            <el-radio :label="3">C</el-radio>
                          </el-radio-group>
                        </el-form-item>
                        <el-form-item
@@ -656,6 +656,12 @@
                        <el-radio-group v-model="item.isabnormal">
                          <el-radio :label="1">是</el-radio>
                          <el-radio :label="0">否</el-radio>
                        </el-radio-group>
                      </el-form-item>
                      <el-form-item label="是否选中收集附加信息">
                        <el-radio-group v-model="item.appendflag">
                          <el-radio label="1">是</el-radio>
                          <el-radio label="0">否</el-radio>
                        </el-radio-group>
                      </el-form-item>
                    </el-row>
@@ -691,7 +697,9 @@
                            <el-image
                              style="width: 100px; height: 100px"
                              :src="item.picturePath"
                              :preview-src-list="[...item.picturePath]"
                              :preview-src-list="
                                item.picturePath ? [item.picturePath] : []
                              "
                            >
                            </el-image>
                          </div>
@@ -747,9 +755,7 @@
        >
        <el-button type="primary" @click="laststep()">上一步</el-button>
        <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
        <el-button @click="Departmenttreatment('ruleForm')"
          >保存问题数据</el-button
        >
        <el-button @click="toExamine('ruleForm')">保存问题数据</el-button>
      </div>
      <!-- 问卷预览 -->
      <div v-if="Editprogress == 3">
@@ -1147,8 +1153,8 @@
                        >
                          <el-radio-group v-model="item.score">
                            <el-radio :label="1">A</el-radio>
                          <el-radio :label="2">B</el-radio>
                          <el-radio :label="3">C</el-radio>
                            <el-radio :label="2">B</el-radio>
                            <el-radio :label="3">C</el-radio>
                          </el-radio-group>
                        </el-form-item>
                        <el-form-item
@@ -1212,7 +1218,9 @@
                          <el-image
                            style="width: 100px; height: 100px"
                            :src="item.picturePath"
                            :preview-src-list="[...item.picturePath]"
                            :preview-src-list="
                              item.picturePath ? [item.picturePath] : []
                            "
                          >
                          </el-image>
                        </div>
@@ -1295,6 +1303,7 @@
        svyTemplateLibScripts: [],
        tempDetpRelevances: [],
        svyLibTemplateTagList: [],
        suitway: [],
        scoreType: "4",
        isenable: "0",
        longTemp: "0",
@@ -1400,6 +1409,10 @@
      usable: [
        { value: "0", label: "可用" },
        { value: "1", label: "停用" },
      ],
      hides: [
        { value: 0, label: "正常" },
        { value: 1, label: "隐藏" },
      ],
      longtype: [
        { value: "0", label: "普通任务" },
@@ -1618,8 +1631,8 @@
          this.confirmillness();
          this.putbelongDepts();
          this.$modal.closeLoading();
          // this.$router.go(-1);
          window.location.reload();
          this.$router.go(-1);
          // window.location.reload();
        });
      } else {
        this.ruleForm.isoperation = 1;
@@ -1636,6 +1649,44 @@
        });
      }
    },
    // 题目校验
    toExamine() {
      // 遍历题目集合
      for (let i = 0; i < this.ruleForm.svyTemplateLibScripts.length; i++) {
        const question = this.ruleForm.svyTemplateLibScripts[i];
        // 如果 scriptType 为 4,则跳过当前题目
        if (question.scriptType === 4) {
          continue;
        }
        // 获取当前题目的选项集合
        const options = question.svyLibTemplateTargetoptions;
        // 创建一个 Set 来存储选项名称,用于检测重复
        const optionNames = new Set();
        // 遍历选项集合
        for (let j = 0; j < options.length; j++) {
          const option = options[j];
          const optionContent = option.optioncontent;
          // 如果选项名称已经存在于 Set 中,说明重复
          if (optionNames.has(optionContent)) {
            this.$message.error(
              `题目 ${question.id} 的选项名称 "${optionContent}" 重复`
            );
            return false; // 返回 false 表示校验失败
          }
          // 将选项名称添加到 Set 中
          optionNames.add(optionContent);
        }
      }
      // 如果所有题目都校验通过,返回 true
      console.log("所有题目校验通过,选项名称无重复");
      this.Departmenttreatment();
    },
    // 科室/院区处理
    Departmenttreatment() {
      this.tempDetpRelevanceslist.forEach((item) => {
@@ -2346,7 +2397,10 @@
  display: flex;
  .presentation-left {
    width: 45%;
    // height: 500px;
    max-height: 80vh;
    padding: 0 20px;
    font-size: 18px;
    overflow: auto;
    .button-textxg {
      color: #024df0;
    }
@@ -2366,7 +2420,7 @@
  }
  .presentation-right {
    width: 55%;
    max-height: 688px;
    max-height: 80vh;
    padding: 0 20px;
    font-size: 18px;
    overflow: auto;