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"
@@ -40,6 +46,24 @@
            <el-divider></el-divider>
            <div style="margin-left: 8%">
              <el-form-item label="问题内容" prop="scriptContent">
                <el-input
                  style="width: 40vw"
                  type="textarea"
                  id="scriptContent"
                  v-model="topicobj.scriptContent"
                  @focus="handleInput('scriptContent')"
                  placeholder="请输入问题内容"
                ></el-input>
              </el-form-item>
              <el-form-item label="问题说明" prop="targetname">
                <el-input
                  style="width: 40vw"
                  type="textarea"
                  v-model="topicobj.scriptDesc"
                  placeholder="请输入说明"
                ></el-input>
              </el-form-item>
              <el-row :gutter="10">
                <el-col :span="8">
                  <el-form-item label="问题分类" prop="categoryid">
@@ -47,6 +71,7 @@
                      v-model="topicobj.categoryid"
                      size="medium"
                      filterable
                      @change="categoryidChange"
                      placeholder="请选择分类"
                    >
                      <el-option-group
@@ -69,7 +94,7 @@
                  <el-form-item label="评价类型" prop="scoretype">
                    <el-select
                      v-model="topicobj.scoretype"
                      placeholder="请选择分类"
                      placeholder="请选择类型"
                    >
                      <el-option
                        v-for="group in appraiselist"
@@ -82,7 +107,7 @@
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="topicobj.scoretype == 1">
                  <el-form-item label="题目得分" prop="score">
                  <el-form-item label="问题得分" prop="score">
                    <el-input
                      v-model="topicobj.score"
                      placeholder="请输入分数"
@@ -93,7 +118,7 @@
              <el-row :gutter="10">
                <el-col :span="8"
                  ><el-form-item label="题目标题" prop="scriptTopic">
                  ><el-form-item label="问题标题" prop="scriptTopic">
                    <el-input
                      v-model="topicobj.scriptTopic"
                      placeholder="请输入标题"
@@ -103,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
@@ -125,33 +150,14 @@
                </el-col> -->
              </el-row>
              <el-row :gutter="10">
                <el-col :span="8">
                  <el-form-item label="语言" prop="language">
                    <el-select
                      v-model="topicobj.language"
                      size="medium"
                      filterable
                      placeholder="请选择分类"
                    >
                      <el-option
                        class="topicobjaa"
                        v-for="item in languagelist"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="8"
                  ><el-form-item label="题目类型" prop="scriptType">
                  ><el-form-item label="问题类型" prop="scriptType">
                    <el-select
                      v-model="topicobj.scriptType"
                      @change="changefn"
                      size="medium"
                      filterable
                      placeholder="请选择分类"
                      placeholder="请选择类型"
                    >
                      <el-option
                        class="topicobjaa"
@@ -179,17 +185,27 @@
                      >
                      </el-option> </el-select></el-form-item
                ></el-col>
                <el-col :span="8">
                  <el-form-item label="语言" prop="language">
                    <el-select
                      v-model="topicobj.language"
                      size="medium"
                      filterable
                      placeholder="请选择"
                    >
                      <el-option
                        class="topicobjaa"
                        v-for="item in languagelist"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-form-item label="题目内容" prop="scriptContent">
                <el-input
                  style="width: 40vw"
                  type="textarea"
                  id="scriptContent"
                  v-model="topicobj.scriptContent"
                  @focus="handleInput('scriptContent')"
                  placeholder="请输入题目内容"
                ></el-input>
              </el-form-item>
              <!-- <el-form-item
              label=""
              prop="scriptContent"
@@ -235,14 +251,6 @@
                </el-form-item>
              </el-col>
            </el-row> -->
              <el-form-item label="题目说明" prop="targetname">
                <el-input
                  style="width: 40vw"
                  type="textarea"
                  v-model="topicobj.scriptDesc"
                  placeholder="请输入说明"
                ></el-input>
              </el-form-item>
              <!-- <el-form-item label="选中指标:">
                <span style="margin-left: 30px"
@@ -325,7 +333,9 @@
                    <el-image
                      style="width: 100px; height: 100px"
                      :src="topicobj.picturePath"
                      :preview-src-list="[...topicobj.picturePath]"
                      :preview-src-list="
                        topicobj.picturePath ? [topicobj.picturePath] : []
                      "
                    >
                    </el-image>
                  </div>
@@ -337,7 +347,12 @@
      </div>
      <div v-if="Editprogress == 2">
        <el-card class="box-card">
          <el-form :inline="true" :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"
@@ -383,7 +398,7 @@
              <el-row>
                <el-col :span="10">
                  <el-form-item label="值类型">
                  <el-form-item label="结果类型">
                    <el-radio-group
                      :disabled="true"
                      v-model="topicobj.valueType"
@@ -395,7 +410,7 @@
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="题目类型">
                  <el-form-item label="问题题型">
                    <el-radio-group
                      :disabled="true"
                      v-model="topicobj.scriptType"
@@ -449,9 +464,9 @@
                        label="ABC等级"
                      >
                        <el-radio-group v-model="item.score">
                          <el-radio label="A">A</el-radio>
                          <el-radio label="B">B</el-radio>
                          <el-radio label="C">C</el-radio>
                          <el-radio :label="1">A</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
@@ -479,7 +494,7 @@
                    </el-col>
                  </el-row>
                  <el-row :gutter="10">
                    <el-form-item label="预警提醒">
                    <el-form-item label="异常提醒">
                      <el-radio-group v-model="item.isabnormal">
                        <el-radio :label="1">是</el-radio>
                        <el-radio :label="0">否</el-radio>
@@ -515,7 +530,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>
@@ -666,7 +683,7 @@
        />
      </div>
    </el-drawer>
    <el-dialog title="题目预览" :visible.sync="topicVisible" width="50%">
    <el-dialog title="问题预览" :visible.sync="topicVisible" width="50%">
      <div class="preview-left">
        <div class="dev-text">
          <span>{{ topicobj.scriptContent }}</span>
@@ -724,8 +741,8 @@
        svyLibScriptOptions: [],
        svyLibScriptTagList: [],
        suitway: "1",
        scoretype:'4',
        language:'普通话',
        scoretype: "4",
        language: "普通话",
      },
      headers: {
        Authorization: "Bearer " + getToken(),
@@ -808,19 +825,19 @@
          { required: true, message: "可用状态不能为空", trigger: "blur" },
        ],
        scriptTopic: [
          { required: true, message: "题目标题不能为空", trigger: "blur" },
          { required: true, message: "问题标题不能为空", trigger: "blur" },
        ],
        ismandatory: [
          { required: true, message: "是否必填不能为空", trigger: "blur" },
        ],
        scriptType: [
          { required: true, message: "题目类型不能为空", trigger: "blur" },
          { required: true, message: "问题类型不能为空", trigger: "blur" },
        ],
        suitway: [
          { required: true, message: "适用方式不能为空", trigger: "blur" },
        ],
        scriptContent: [
          { required: true, message: "题目内容不能为空", trigger: "blur" },
          { required: true, message: "问题内容不能为空", trigger: "blur" },
        ],
      },
    };
@@ -865,13 +882,13 @@
    // 获取数据
    getissueinfo() {
      this.id = this.$route.query.id;
      if (this.$route.query.categoryid) {
        this.topicobj.categoryid = Number(this.$route.query.categoryid);
      }
      // 分类
      getissueclassify({}).then((res) => {
        this.classifylist = res.rows;
        if (this.$route.query.categoryid) {
          this.topicobj.categoryid = Number(this.$route.query.categoryid);
        }
      });
      if (!this.id) {
        return;
@@ -911,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) {
          if (score.score || score.score == 0) {
            if (
              Number(score.score) < 0 ||
              Number(score.score) > Number(this.topicobj.score)
@@ -1084,10 +1120,10 @@
        )
        .then(() => {
          console.log(row);
          this.topicobj.scriptTopic = row.targetname;
          // this.topicobj.scriptTopic = row.targetname;
          this.topicobj.valueType = row.valueType;
          this.topicobj.scriptType = row.scriptType;
          this.topicobj.scriptContent = row.targetdesc;
          // this.topicobj.scriptContent = row.targetdesc;
          this.topicobj.targetid = row.id;
          this.topicobj.targetname = row.targetname;
          this.topicobj.svyLibScriptOptions = [];