WXL (wul)
18 小时以前 55f9876e876c7ddfcc2a7a2b870dfc224c9467a6
src/views/knowledge/questionbank/particulars/index.vue
@@ -23,7 +23,13 @@
      </div>
      <div v-if="Editprogress == 1">
        <el-card class="box-card">
          <el-form :inline="true" ref="topicobj" :model="topicobj" :rules="rules" class="demo-form-inline">
          <el-form
            :inline="true"
            ref="topicobj"
            :model="topicobj"
            :rules="rules"
            class="demo-form-inline"
          >
            <div class="headline">
              基础信息配置
              <span style="margin-left: 30px"
@@ -65,6 +71,7 @@
                      v-model="topicobj.categoryid"
                      size="medium"
                      filterable
                      @change="categoryidChange"
                      placeholder="请选择分类"
                    >
                      <el-option-group
@@ -87,7 +94,7 @@
                  <el-form-item label="评价类型" prop="scoretype">
                    <el-select
                      v-model="topicobj.scoretype"
                      placeholder="请选择分类"
                      placeholder="请选择类型"
                    >
                      <el-option
                        v-for="group in appraiselist"
@@ -121,7 +128,7 @@
                  ><el-form-item label="是否可用" prop="isavailable">
                    <el-radio-group v-model="topicobj.isavailable">
                      <el-radio
                      @change="$forceUpdate()"
                        @change="$forceUpdate()"
                        v-for="(item, index) in usable"
                        :label="item.value"
                        >{{ item.label }}</el-radio
@@ -143,7 +150,6 @@
                </el-col> -->
              </el-row>
              <el-row :gutter="10">
                <el-col :span="8"
                  ><el-form-item label="问题类型" prop="scriptType">
                    <el-select
@@ -151,7 +157,7 @@
                      @change="changefn"
                      size="medium"
                      filterable
                      placeholder="请选择分类"
                      placeholder="请选择类型"
                    >
                      <el-option
                        class="topicobjaa"
@@ -185,7 +191,7 @@
                      v-model="topicobj.language"
                      size="medium"
                      filterable
                      placeholder="请选择分类"
                      placeholder="请选择"
                    >
                      <el-option
                        class="topicobjaa"
@@ -245,7 +251,6 @@
                </el-form-item>
              </el-col>
            </el-row> -->
              <!-- <el-form-item label="选中指标:">
                <span style="margin-left: 30px"
@@ -329,8 +334,8 @@
                      style="width: 100px; height: 100px"
                      :src="topicobj.picturePath"
                      :preview-src-list="
                                topicobj.picturePath ? [topicobj.picturePath] : []
                              "
                        topicobj.picturePath ? [topicobj.picturePath] : []
                      "
                    >
                    </el-image>
                  </div>
@@ -342,7 +347,12 @@
      </div>
      <div v-if="Editprogress == 2">
        <el-card class="box-card">
          <el-form :inline="true" ref="topicobj" :model="topicobj" class="demo-form-inline">
          <el-form
            :inline="true"
            ref="topicobj"
            :model="topicobj"
            class="demo-form-inline"
          >
            <div class="headline">
              指标设置详情
              <span v-if="topicobj.targetname" style="margin-left: 30px"
@@ -521,8 +531,8 @@
                          style="width: 100px; height: 100px"
                          :src="item.picturePath"
                          :preview-src-list="
                                item.picturePath ? [item.picturePath] : []
                              "
                            item.picturePath ? [item.picturePath] : []
                          "
                        >
                        </el-image>
                      </div>
@@ -731,8 +741,8 @@
        svyLibScriptOptions: [],
        svyLibScriptTagList: [],
        suitway: "1",
        scoretype:'4',
        language:'普通话',
        scoretype: "4",
        language: "普通话",
      },
      headers: {
        Authorization: "Bearer " + getToken(),
@@ -873,13 +883,12 @@
    getissueinfo() {
      this.id = this.$route.query.id;
      // 分类
      getissueclassify({}).then((res) => {
        this.classifylist = res.rows;
        if (this.$route.query.categoryid) {
        this.topicobj.categoryid = Number(this.$route.query.categoryid);
      }
          this.topicobj.categoryid = Number(this.$route.query.categoryid);
        }
      });
      if (!this.id) {
        return;
@@ -919,75 +928,94 @@
        this.drawer = true;
      });
    },
    //     categoryidChange(id) {
    //   // 遍历所有分组,在每个分组的 svyLibScriptCategoryList 中查找
    //   let targetOption = null;
    //   for (const group of this.classifylist) {
    //     targetOption = group.svyLibScriptCategoryList.find(item => item.id == id);
    //     if (targetOption) break;
    //   }
    //   if (targetOption) {
    //     console.log('选中的选项:', targetOption);
    //     // 注意:这里 targetOption.name 是选项名,如“住院满意度调查”
    //     if (targetOption.name.includes('住院')) {
    //       this.topicobj.type = "zymyd";
    //     } else if (targetOption.name.includes('门诊')) {
    //       this.topicobj.type = "mzmyd";
    //     } else if (targetOption.name.includes('出院')) {
    //       this.topicobj.type = "cymyd";
    //     } else if (targetOption.name.includes('常用')) {
    //       this.topicobj.type = "cymyd"; // 注意:这里和“出院”重复了,确认是否需区分
    //     }
    //   }
    // },
    // 新增或修改详情
    compileissue() {
      this.$refs["topicobj"].validate((valid) => {
        if (valid) {
          this.topicobj.svyLibScriptOptions = this.topicobj.svyLibScriptOptions.map(
        (item) => {
          if (item.isoperation != 1 && item.isoperation != 3) {
            item.isoperation = 2;
          }
          return item;
        }
      );
      this.topicobj.targetoptions = this.topicobj.svyLibScriptOptions
        .filter((item) => item.isoperation != 3)
        .map((item) => item.optioncontent)
        .join(", ");
      this.topicobj.otherdata = JSON.stringify(this.variablelist);
      if (this.id) {
        this.topicobj.isoperation = 2;
        compileissue(this.topicobj).then((res) => {
          if (res.code == 200) {
            this.$message({
              message: "修改成功",
              type: "success",
          this.topicobj.svyLibScriptOptions =
            this.topicobj.svyLibScriptOptions.map((item) => {
              if (item.isoperation != 1 && item.isoperation != 3) {
                item.isoperation = 2;
              }
              return item;
            });
            this.$router.go(-1);
          this.topicobj.targetoptions = this.topicobj.svyLibScriptOptions
            .filter((item) => item.isoperation != 3)
            .map((item) => item.optioncontent)
            .join(", ");
          this.topicobj.otherdata = JSON.stringify(this.variablelist);
          if (this.id) {
            this.topicobj.isoperation = 2;
            compileissue(this.topicobj).then((res) => {
              if (res.code == 200) {
                this.$message({
                  message: "修改成功",
                  type: "success",
                });
                this.$router.go(-1);
              } else {
                this.$message({
                  message: "修改失败",
                  type: "error",
                });
              }
            });
          } else {
            this.$message({
              message: "修改失败",
              type: "error",
            this.topicobj.isoperation = 1;
            compileissue(this.topicobj).then((res) => {
              if (res.code == 200) {
                this.$message({
                  message: "新增成功",
                  type: "success",
                });
                this.$router.go(-1);
              } else {
                this.$message({
                  message: "新增失败",
                  type: "error",
                });
              }
            });
          }
        });
      } else {
        this.topicobj.isoperation = 1;
        compileissue(this.topicobj).then((res) => {
          if (res.code == 200) {
            this.$message({
              message: "新增成功",
              type: "success",
            });
            this.$router.go(-1);
          } else {
            this.$message({
              message: "新增失败",
              type: "error",
            });
          this.illnesslist.forEach((item, index) => {
            if (!item.id) {
              addtargetillness(item).then((res) => {});
            }
          });
          if (this.illnesslistapi.length) {
            deltargetillness(this.illnesslistapi.join(",")).then((res) => {});
          }
        });
      }
      this.illnesslist.forEach((item, index) => {
        if (!item.id) {
          addtargetillness(item).then((res) => {});
        }
      });
      if (this.illnesslistapi.length) {
        deltargetillness(this.illnesslistapi.join(",")).then((res) => {});
      }
        }
      })
    },
    // 判断分值
    Scorejudgment() {
      let scorearr = this.topicobj.svyLibScriptOptions;
      let isValid = scorearr.every((score, index) => {
        if (this.topicobj.scriptType == 1) {
          if (score.score||score.score==0) {
          if (score.score || score.score == 0) {
            if (
              Number(score.score) < 0 ||
              Number(score.score) > Number(this.topicobj.score)