WXL
2024-07-31 8ec6407cf76c1f8d7e08e5456018aaafc93f0556
src/views/knowledge/questionbank/particulars/index.vue
@@ -91,7 +91,7 @@
                  </el-select> </el-form-item
              ></el-col>
              <el-col :span="8"
                ><el-form-item label="语言(缺)">
                ><el-form-item label="语言">
                  <el-select
                    v-model="topicobj.language"
                    size="medium"
@@ -149,11 +149,9 @@
              <el-col :span="8"
                ><el-form-item label="适用方式">
                  <el-select
                    v-model="suitwaylist"
                    size="medium"
                    filterable
                    multiple
                    placeholder="请选择分类"
                    v-model="topicobj.suitway"
                    disabled
                    placeholder="请选择"
                  >
                    <el-option
                      class="topicobjaa"
@@ -190,11 +188,15 @@
                  class="upload-demo"
                  :action="uploadImgUrl"
                  :headers="headers"
                  :accept="'image/*,video/*'"
                  accept=".jpg,.png,image/*"
                  :on-success="handleChangetg"
                >
                  <el-button size="small" type="primary">点击上传</el-button>
                  <div slot="tip" class="el-upload__tip">
                    只能上传jpg/png类型文件
                  </div>
                </el-upload>
                <div style="margin: 20px">
                  <el-image
                    style="width: 100px; height: 100px"
@@ -294,6 +296,18 @@
              </el-form-item>
            </el-row>
          </div>
          <div>
            <span style="margin-left: 30px"
                >选中指标:<el-tag type="success" effect="dark">{{
                  topicobj.targetname ? topicobj.targetname : "未选择"
                }}</el-tag></span
              >
              <span style="margin-left: 30px"
                ><el-button type="success" round @click="gettargetInfo"
                  >+选择指标</el-button
                ></span
              >
          </div>
          <div v-if="topicobj.scriptType != 3 && topicobj.scriptType != 4">
            <div class="headline">
              选项设置<span style="margin-left: 30px"
@@ -301,14 +315,7 @@
                  >+新增</el-button
                ></span
              >
              <span style="margin-left: 30px"
                >选中指标:{{ topicobj.scriptTopic }}</span
              >
              <span style="margin-left: 30px"
                ><el-button type="success" round @click="gettargetInfo"
                  >+选择指标</el-button
                ></span
              >
            </div>
            <div
              class="topicxq"
@@ -385,7 +392,7 @@
                    class="upload-demo"
                    :action="uploadImgUrl"
                    :headers="headers"
                    :accept="'image/*,video/*'"
                    accept=".jpg,.png,image/*"
                    :on-success="handleChange.bind(this, item)"
                  >
                    <el-button size="small" type="primary">点击上传</el-button>
@@ -419,9 +426,27 @@
          :inline="true"
          label-width="98px"
        >
          <el-form-item label="标题" prop="userName">
          <el-form-item label="指标名称" prop="userName">
            <el-input
              v-model="queryParams.targetname"
              placeholder="请输入"
              clearable
              style="width: 200px"
              @keyup.enter.native="gettargetInfo"
            />
          </el-form-item>
          <el-form-item label="指标说明" prop="userName">
            <el-input
              v-model="queryParams.targetdesc"
              placeholder="请输入"
              clearable
              style="width: 200px"
              @keyup.enter.native="gettargetInfo"
            />
          </el-form-item>
          <el-form-item label="指标标签" prop="userName">
            <el-input
              v-model="queryParams.tagName"
              placeholder="请输入"
              clearable
              style="width: 200px"
@@ -444,17 +469,53 @@
        </el-form>
        <el-table v-loading="loading" :data="targetList">
          <el-table-column
            label="标题"
            label="指标名称"
            align="center"
            key="targetname"
            prop="targetname"
            width="100"
          />
          <el-table-column
            label="问题内容"
            label="指标说明"
            align="center"
            key="targetdesc"
            prop="targetdesc"
            width="200"
            :show-overflow-tooltip="true"
          />
          <el-table-column
            label="语言"
            align="center"
            key="language"
            prop="language"
            width="200"
            :show-overflow-tooltip="true"
          />
          <el-table-column
            label="是否可用"
            align="center"
            key="isAvailable"
            prop="isAvailable"
          >
            <template slot-scope="scope">
              <dict-tag :options="usable" :value="scope.row.isAvailable" />
            </template>
          </el-table-column>
          <el-table-column
            label="问题类型"
            align="center"
            key="scriptType"
            prop="scriptType"
          >
            <template slot-scope="scope">
              <dict-tag :options="valuetype" :value="scope.row.scriptType" />
            </template>
          </el-table-column>
          <el-table-column
            label="选项说明"
            align="center"
            key="optionDesc"
            prop="optionDesc"
            width="200"
            :show-overflow-tooltip="true"
          />
@@ -513,6 +574,7 @@
      topicobj: {
        svyLibScriptOptions: [],
        svyLibScriptTagList: [],
        suitway: "1",
      },
      headers: {
        Authorization: "Bearer " + getToken(),
@@ -627,7 +689,6 @@
        this.dynamicTags = this.topicobj.svyLibScriptTagList.map(
          this.processElement
        );
        this.suitwaylist = this.topicobj.suitway.split(",");
        this.variablelist = JSON.parse(this.topicobj.otherdata)
          ? JSON.parse(this.topicobj.otherdata)
          : this.variablelist;
@@ -643,6 +704,13 @@
      });
    },
    gettargetInfo() {
      if (!this.topicobj.scriptType) {
        this.$message({
          message: "请先选择题目类型",
          type: "error",
        });
        return;
      }
      this.queryParams.scriptType = this.topicobj.scriptType;
      gettargetInfo(this.queryParams).then((res) => {
        this.targetList = res.rows;
@@ -660,8 +728,11 @@
          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);
      this.topicobj.suitway = this.suitwaylist.join(",");
      if (this.id) {
        this.topicobj.isoperation = 2;
        compileissue(this.topicobj).then((res) => {
@@ -711,12 +782,12 @@
        if (score.score) {
          console.log(Number(score.score), this.topicobj.score, "分值");
          if (
            Number(score.score) <= 0 ||
            Number(score.score) < 0 ||
            Number(score.score) > Number(this.topicobj.score)
          ) {
            console.log(score, "错误分值");
            this.$message({
              message: "选项分值必须大于0小于等于" + this.topicobj.score + "分",
              message: "选项分值必须在0到" + this.topicobj.score + "分之间",
              type: "warning",
            });
            return false;
@@ -740,13 +811,12 @@
    },
    Saveproblem() {
      if (this.topicobj.scoretype == 1) {
        console.log(321);
        this.Scorejudgment();
      } else {
        this.compileissue();
      }
    },
    // 删除选项
    deletexuanx(row) {
      const index = this.getIndexInArray(
@@ -771,14 +841,15 @@
    selectlabel(row) {
      this.$modal
        .confirm(
          '是否选择标题为"' + row.targetname + '"的指标并替换填充问题信息?'
          '是否选择标题为"' + row.targetname + '"的指标并替换填充问题及选项信息?'
        )
        .then(() => {
          console.log(row);
          console.log(this.topicobj);
          this.topicobj.scriptTopic = row.targetname;
          this.topicobj.valueType = row.valueType;
          this.topicobj.scriptContent = row.targetdesc;
          this.topicobj.targetid = row.id;
          this.topicobj.targetname = row.targetname;
          this.topicobj.isavailable = "0";
          this.topicobj.language = "普通话";
          this.topicobj.svyLibScriptOptions = [];
@@ -910,7 +981,13 @@
    //   this.illnessVisible = false;
    //   this.$modal.msgSuccess("编辑成功");
    // },
    resetQuery() {},
    resetQuery() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
      };
      this.gettargetInfo();
    },
    // 便捷标签
    tsgnameto(row) {
      let inputValueArr = "";
@@ -1021,10 +1098,14 @@
    handleChange(item, response, file, fileList) {
      console.log(response);
      if (response.code == 200) {
        console.log(item);
        let index = this.topicobj.svyLibScriptOptions.findIndex(
          (obj) => obj.id == item.id && obj.name == item.name
          (obj) => obj.optioncontent == item.optioncontent
        );
        console.log(index);
        this.topicobj.svyLibScriptOptions[index].picturePath = response.url;
        console.log(this.topicobj.svyLibScriptOptions[index]);
        this.$forceUpdate();
      } else {
        this.$message.error("图片插入失败");
      }