WXL
2024-07-31 8ec6407cf76c1f8d7e08e5456018aaafc93f0556
src/views/knowledge/questionbank/index.vue
@@ -29,7 +29,7 @@
        >
          <span class="custom-tree-node" slot-scope="{ node, data }">
            <span>{{ node.label }}</span>
            <span>
            <span v-if="data.id > 0">
              <el-button
                type="text"
                icon="el-icon-delete"
@@ -37,6 +37,17 @@
                size="mini"
                @click="() => remove(node, data)"
              >
              </el-button>
            </span>
            <span v-if="data.id > 0">
              <el-button
                type="text"
                circle
                size="mini"
                @click="() => altertag(node, data)"
                ><span class="button-textxg"
                  ><i class="el-icon-edit-outline"></i
                ></span>
              </el-button>
            </span>
          </span>
@@ -57,39 +68,38 @@
              v-show="showSearch"
              label-width="98px"
            >
              <el-form-item label="可用院区" prop="status">
                <el-select v-model="queryParams.courtyard" placeholder="请选择">
                  <el-option
                    v-for="item in languagelist"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="问题主题" prop="userName">
              <el-form-item label="问题标题" prop="userName">
                <el-input
                  v-model="queryParams.userName"
                  v-model="queryParams.scriptTopic"
                  placeholder="请输入"
                  clearable
                  style="width: 200px"
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="文字" prop="status">
                <el-select v-model="queryParams.status" placeholder="请选择">
                  <el-option
                    v-for="item in languagelist"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              <el-form-item label="问题内容" prop="userName">
                <el-input
                  v-model="queryParams.scriptContent"
                  placeholder="请输入"
                  clearable
                  style="width: 200px"
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="是否可用" prop="status">
                <el-select v-model="queryParams.status" placeholder="请选择">
              <el-form-item label="指标名称" prop="targetname">
                <el-input
                  v-model="queryParams.targetname"
                  placeholder="请输入"
                  clearable
                  style="width: 200px"
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="是否可用" prop="isavailable">
                <el-select
                  v-model="queryParams.isavailable"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in qyoptions"
                    :key="item.value"
@@ -149,39 +159,73 @@
              :border="true"
              @selection-change="handleSelectionChange"
            >
              <el-table-column type="selection" width="50" align="center" />
              <el-table-column
                label="序号"
                type="selection"
                fixed
                width="50"
                align="center"
                key="topicid"
                prop="topicid"
              />
              <!-- <el-table-column
                label="序号"
                fixed
                align="center"
                key="id"
                prop="id"
              /> -->
              <el-table-column
                label="题目标题"
                fixed
                align="center"
                key="topic"
                prop="topic"
                key="scriptTopic"
                prop="scriptTopic"
                width="200"
                :show-overflow-tooltip="true"
              />
              <el-table-column
                label="题目内容(缺)"
                label="题型"
                align="center"
                key="nickName"
                prop="nickName"
                key="scriptType"
                prop="scriptType"
                width="120"
              >
                <template slot-scope="scope">
                  <dict-tag
                    :options="askvaluetype"
                    :value="scope.row.scriptType"
                  />
                </template>
              </el-table-column>
              <el-table-column
                label="指标名称"
                fixed
                align="center"
                key="targetname"
                prop="targetname"
                width="200"
                :show-overflow-tooltip="true"
              />
              <el-table-column
                label="题目内容"
                align="center"
                key="scriptContent"
                prop="scriptContent"
                width="200"
                :show-overflow-tooltip="true"
              />
              /><el-table-column
                label="适用方式(缺)"
                label="适用方式"
                align="center"
                key="application"
                prop="application"
                key="suitway"
                prop="suitway"
                width="120"
              />
              >
                <template slot-scope="scope">
                  <dict-tag :options="mode" :value="scope.row.suitway" />
                </template>
              </el-table-column>
              /><el-table-column
                label="适用疾病(缺)"
                label="适用疾病"
                align="center"
                key="Applicable"
                prop="Applicable"
@@ -200,7 +244,7 @@
                </template>
              </el-table-column>
              <el-table-column
                label="标签(缺)"
                label="标签"
                align="center"
                key="tagList"
                prop="tagList"
@@ -208,17 +252,26 @@
                :show-overflow-tooltip="true"
              >
                <template slot-scope="scope">
                  <span v-for="item in scope.row.tagList">{{ item }} </span>
                  <span v-for="item in scope.row.svyLibScriptTagList"
                    >{{ item.tagname }}、
                  </span>
                </template>
              </el-table-column>
              <el-table-column
                label="可用(缺)"
                label="可用"
                align="center"
                key="usable"
                prop="usable"
                key="isavailable"
                prop="isavailable"
                width="120"
              />
              >
                <template slot-scope="scope">
                  <dict-tag
                    :options="qyoptions"
                    :value="scope.row.isavailable"
                  />
                </template>
              </el-table-column>
              <el-table-column
                label="最近修改"
                align="center"
@@ -229,6 +282,7 @@
              <el-table-column
                label="操作"
                fixed="right"
                align="center"
                width="250"
                class-name="small-padding fixed-width"
@@ -240,7 +294,7 @@
                    @click="compileUpdate(scope.row)"
                    v-hasPermi="['system:user:edit']"
                    ><span class="button-bji"
                      ><i class="el-icon-edit"></i>编辑问题</span
                      ><i class="el-icon-edit"></i>编辑</span
                    ></el-button
                  >
                  <el-button
@@ -255,7 +309,7 @@
                  <el-button
                    size="medium"
                    type="text"
                    @click="handleDelete(scope.row)"
                    @click="topicpreview(scope.row)"
                    v-hasPermi="['system:user:remove']"
                    ><span class="button-text"
                      ><i class="el-icon-view"></i>预览</span
@@ -291,21 +345,18 @@
            <el-option
              v-for="item in deptOptions"
              :key="item.id"
              :label="item.indexAssortName"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="请输入类别名称">
          <el-input
            v-model="classifyform.indexAssortName"
            autocomplete="off"
          ></el-input>
          <el-input v-model="classifyform.name" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button @click="getDeptTree()">取 消</el-button>
        <el-button type="primary" @click="submitsidecolumn">确 定</el-button>
      </div>
    </el-dialog>
@@ -357,6 +408,35 @@
        <el-button type="primary" @click="confirmillness">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="题目预览" :visible.sync="topicVisible" width="50%">
      <div class="preview-left">
        <div class="dev-text">
          <span>{{ topicform.scriptContent }}</span>
        </div>
        <div
          class="dev-xx"
          v-if="topicform.scriptType != 3 && topicform.scriptType != 4"
        >
          <el-radio-group v-model="topicform.asrtext">
            <el-radio
              v-for="(topicforms, index) in topicform.svyLibScriptOptions"
              :key="topicforms.optioncontent"
              :label="topicforms.optioncontent"
              >{{ topicforms.optioncontent }}</el-radio
            >
          </el-radio-group>
        </div>
        <div v-else>
          <el-input
            type="textarea"
            placeholder="请输入内容"
            v-model.sync="topicform.asrtext"
            :rows="2"
          />
        </div>
      </div>
    </el-dialog>
  </div>
</template>
@@ -366,6 +446,7 @@
  getissueclassify,
  delissueclassify,
  addissueclassify,
  editissueclassify,
  getissuelist,
  issueinfo,
  compileissue,
@@ -400,17 +481,23 @@
      total: 0,
      namequestionnaire: "",
      haoquestionnaire: "",
      askvaluetype: "",
      idds: "",
      topicform: {
        scriptContent: "",
      },
      amendtag: false, //是否修改类别
      dialogFormVisible: false, //修改添加类别弹框
      deleteVisible: false, //分类删除弹框
      topicVisible: false, //预览弹框
      deletefenl: "高血压", //删除项
      classifyform: {
        categoryname: "",
        name: "",
      }, //类别表单
      // 表格数据
      userList: [],
      // 弹出层标题
      tag: "",
      title: "",
      // 是否显示弹出层
      open: false,
@@ -439,8 +526,8 @@
      illnesslistapi: [],
      illnesslist: [],
      defaultProps: {
        children: "svyLibTopicCategoryList",
        label: "indexAssortName",
        children: "svyLibScriptCategoryList",
        label: "name",
      },
      mode: [],
      languagelist: [],
@@ -449,6 +536,7 @@
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        isavailable: "",
      },
      // 表单校验
      rules: {},
@@ -457,9 +545,11 @@
  watch: {},
  created() {
    this.getList();
    this.getDeptTree();
    this.mode = store.getters.mode;
    this.languagelist = store.getters.languagelist;
    this.qyoptions = store.getters.usable;
    this.askvaluetype = store.getters.askvaluetype;
  },
  methods: {
@@ -477,13 +567,13 @@
    compileUpdate(row) {
      this.$router.push({
        path: "/knowledge/questionbank/particulars/",
        query: { id: row.topicid },
        query: { id: row.id },
      });
    },
    // 疾病-----------------------
    illnessUpdate(row) {
      this.illnessVisible = true;
      this.indexid = row.topicid;
      this.indexid = row.id;
      this.illnesslistapi = [];
      const illnessqueryParams = {
        pageNum: 1,
@@ -493,7 +583,7 @@
        console.log(response);
        this.optionsillness = response.rows;
      });
      getillness({ outid: row.topicid, type: 4 }).then((res) => {
      getillness({ outid: row.id, type: 4 }).then((res) => {
        this.illnesslist = res.rows;
        console.log(res);
      });
@@ -564,38 +654,50 @@
    getDeptTree() {
      getissueclassify({}).then((res) => {
        this.deptOptions = res.rows;
        console.log(res);
        this.dialogFormVisible = false;
      });
    },
    // 添加类别树
    submitsidecolumn() {
      if (this.classifyform.id) {
        editissueclassify(this.classifyform).then((res) => {
          this.getDeptTree();
          this.$modal.msgSuccess("修改成功");
          this.classifyform = {};
          this.dialogFormVisible = false;
        });
        return;
      }
      let calssvalue = {};
      if (
        this.classifyform.pid &&
        this.classifyform.indexAssortName &&
        this.classifyform.name &&
        this.radio == "子分类"
      ) {
        const index = this.deptOptions.findIndex(
          (obj) => obj.id == this.classifyform.pid
        );
        calssvalue = this.deptOptions[index];
        calssvalue.ivrLibaTemplateAssortList.push(this.classifyform);
      } else if (this.radio == "主分类" && this.classifyform.indexAssortName) {
        console.log(calssvalue, "calssvalue");
        calssvalue.svyLibScriptCategoryList.push(this.classifyform);
      } else if (this.radio == "主分类" && this.classifyform.name) {
        this.classifyform.pid = null;
        this.classifyform.ivrLibaTemplateAssortList = [];
        this.classifyform.svyLibScriptCategoryList = [];
      } else {
        return this.$modal.msgError("请填写完整信息");
      }
      addissueclassify(this.classifyform).then((res) => {
        this.getDeptTree();
        this.$modal.msgSuccess("新增成功");
        this.classifyform = {};
        this.dialogFormVisible = false;
      });
    },
    remove(a, b) {
      if (b.pid) {
        this.$modal
          .confirm('是否确认删除分类项为"' + b.indexAssortName + '"的数据项?')
          .confirm('是否确认删除分类项为"' + b.name + '"的数据项?')
          .then(function () {
            return delissueclassify(b.id);
          })
@@ -607,9 +709,7 @@
      } else {
        this.$modal
          .confirm(
            '是否确认删除一级分类"' +
              b.indexAssortName +
              '"?删除后其下分类将归类‘未分类’'
            '是否确认删除一级分类"' + b.name + '"?删除后其下分类将归类‘未分类’'
          )
          .then(() => {
            return delissueclassify(b.id);
@@ -621,21 +721,31 @@
          .catch(() => {});
      }
    },
    altertag(a, b) {
      this.dialogFormVisible = true;
      if (!b.pid) {
        this.radio = "主分类";
      } else {
        this.radio = "子分类";
      }
      this.classifyform = b;
      this.dialogFormVisible = true;
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
      return data.indexAssortName.indexOf(value) !== -1;
      return data.name.indexOf(value) !== -1;
    },
    handleNodeClick(data) {
      this.queryParams.assortid = data.id;
      this.queryParams.categoryid = data.id;
      this.getList();
    },
    // 表单重置
    reset() {
      this.form = {
        topicid: undefined,
        id: undefined,
        deptId: undefined,
        userName: undefined,
        nickName: undefined,
@@ -665,7 +775,7 @@
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.topicid);
      this.ids = selection.map((item) => item.id);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
@@ -685,7 +795,8 @@
    /** 删除按钮操作 */
    handleDelete(row) {
      const topicids = row.topicid || this.ids;
      console.log(this.ids);
      const topicids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除用户编号为"' + topicids + '"的数据项?')
        .then(function () {
@@ -696,6 +807,10 @@
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    topicpreview(row) {
      this.topicform = row;
      this.topicVisible = true;
    },
  },
};
@@ -713,7 +828,7 @@
  margin-top: 20px;
  margin: 20px;
  padding: 30px;
  background: #edf1f7;
  background: #fff;
  border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
@@ -832,6 +947,21 @@
    vertical-align: bottom;
  }
}
.preview-left {
  margin: 20px;
  //   margin: 20px;
  padding: 30px;
  // background: #ffff;
  border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
  .dev-text {
    margin-bottom: 10px;
    text-align: left;
    font-size: 22px;
  }
}
::v-deep .el-tree-node__content {
  display: -webkit-box;
@@ -844,6 +974,24 @@
  font-size: 20px;
  cursor: pointer;
}
::v-deep .el-tree {
  position: relative;
  cursor: default;
  border-radius: 5px;
  background: #eff8fe;
  color: #606266;
  border: 1px solid #bbe1fa;
  // border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
}
::v-deep
  .el-tree--highlight-current
  .el-tree-node.is-current
  > .el-tree-node__content {
  background-color: #7799fb;
  color: #fff;
}
::v-deep .el-button--mini.is-circle {
  padding: 7px;
  margin: 0;