WXL
2024-08-30 c73a2c380aca7ac4ef16e76388b1a52356df8634
src/views/knowledge/education/index.vue
@@ -39,6 +39,17 @@
              >
              </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>
        </el-tree>
      </div>
@@ -57,72 +68,52 @@
              v-show="showSearch"
              label-width="98px"
            >
              <el-form-item label="宣教标题" prop="userName">
              <el-form-item label="通知标题" prop="preachname">
                <el-input
                  v-model="queryParams.userName"
                  v-model="queryParams.preachname"
                  placeholder="请输入"
                  clearable
                  style="width: 200px"
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="适用科室" prop="region">
                <el-cascader
                  v-model="queryParams.administrative"
                  :options="deptList"
                  :props="props"
                  :show-all-levels="false"
                  clearable
                >
                  <template slot-scope="{ node, data }">
                    <span>{{ data.deptName }}</span>
                    <span v-if="!node.isLeaf">
                      ({{ data.children.length }})
                    </span>
                  </template>
                </el-cascader>
              </el-form-item>
              <el-form-item label="通知内容" prop="userName">
                <el-input
                  v-model="queryParams.userNamevalue"
                  placeholder="请输入"
                  clearable
                  style="width: 200px"
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="适用方式" prop="shape">
                <el-cascader
                  v-model="queryParams.shapevalue"
                  :options="optionss"
                  :props="propss"
                  clearable
                ></el-cascader>
              </el-form-item>
              <el-form-item label="内容形式" prop="classify">
              <el-form-item label="适用院区" prop="region">
                <el-select
                  v-model="queryParams.classifyvalue"
                  placeholder="请选择"
                  v-model="campus"
                  size="medium"
                  multiple
                  filterable
                  placeholder="请选择分类"
                >
                  <el-option
                    v-for="(item, index) in editabshape"
                    v-for="item in courtyardlist"
                    :key="item.label"
                    :label="item.label"
                    :value="item.value"
                    :value="item.label"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="通知内容" prop="userName">
                <el-input
                  v-model="queryParams.preachcontent"
                  placeholder="请输入"
                  clearable
                  style="width: 200px"
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="可用状态" prop="classify">
                <el-select
                  v-model="queryParams.classifyvalue"
                  v-model="queryParams.isavailable"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in usable"
                    v-for="(item, index) in qyoptions"
                    :key="item.value"
                    :label="item.value"
                    :value="item.label"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
@@ -192,6 +183,7 @@
                label="标题"
                fixed
                align="center"
                width="150"
                key="preachname"
                prop="preachname"
                :show-overflow-tooltip="true"
@@ -206,6 +198,7 @@
              <el-table-column
                label="主要内容"
                align="center"
                width="260"
                key="preachcontent"
                prop="preachcontent"
                :show-overflow-tooltip="true"
@@ -309,7 +302,7 @@
                class-name="small-padding fixed-width"
              >
                <template slot-scope="scope">
                  <el-button
                  <!-- <el-button
                    size="medium"
                    type="text"
                    @click="goQRCode(scope.row)"
@@ -318,14 +311,14 @@
                    <span class="button-text"
                      ><i class="el-icon-edit"></i>二维码</span
                    ></el-button
                  >
                  > -->
                  <el-button
                    size="medium"
                    type="text"
                    @click="Vieweducation(scope.row)"
                    v-hasPermi="['system:user:edit']"
                    ><span class="button-textck"
                      ><i class="el-icon-edit"></i>查看</span
                      ><i class="el-icon-edit"></i>预览</span
                    ></el-button
                  >
                  <el-button
@@ -390,7 +383,7 @@
        </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>
@@ -451,6 +444,16 @@
        <div class="qrcode-img"></div>
      </div>
    </el-dialog>
    <el-dialog title="模版预览" :visible.sync="previewtf" width="60%">
      <div class="preview-left">
        <!-- 单选 -->
        <div v-html="richText"></div>
      </div>
      <!-- <span slot="footer" class="dialog-footer">
        <el-button @click="previewGo">前往模版详情修改</el-button>
        <el-button type="primary" @click="previewFn">确认使用</el-button>
      </span> -->
    </el-dialog>
  </div>
</template>
@@ -459,6 +462,7 @@
  getheLibraryAssort,
  delheLibraryAssort,
  addheLibraryAssort,
  editheLibraryAssort,
  addtargetillness,
  getlibrarylist,
  dellibraryinfo,
@@ -471,7 +475,7 @@
import { listDept } from "@/api/system/dept";
import { getToken } from "@/utils/auth";
import store from "@/store";
import axios from "axios";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
@@ -497,13 +501,17 @@
      haoeducation: "",
      indexid: null,
      inputValue: "",
      richText: "",
      radio: "主分类",
      inputVisible: false,
      previewtf: false,
      illnessVisible: false, //指标疾病弹框
      deptOptions: [],
      courtyardlist: [],
      optionsillness: [],
      illnesslistapi: [],
      illnesslist: [],
      campus: [],
      defaultProps: {
        children: "heLibraryAssortList",
        label: "assortname",
@@ -547,6 +555,7 @@
      }, //类别表单
      optionss: [],
      mode: [],
      qyoptions: [],
      languagelist: [],
      editabshape: [],
      usable: [],
@@ -574,6 +583,8 @@
    this.usable = store.getters.usable;
    this.precedencetype = store.getters.precedencetype;
    this.editabshape = store.getters.editabshape;
    this.qyoptions = store.getters.usable;
    this.courtyardlist = store.getters.courtyardlist;
  },
  methods: {
@@ -609,6 +620,7 @@
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.queryParams.campus = this.campus.join(",");
      this.getList();
    },
    /** 重置按钮操作 */
@@ -621,38 +633,53 @@
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.userId);
      this.ids = selection.map((item) => item.id);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.$router.push({
        path: "/knowledge/education/compilequer/",
        path: "/knowledge/educationinfo/",
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.$router.push({
        path: "/knowledge/education/compilequer/",
        query: { id: "1" },
        path: "/knowledge/educationinfo/",
        query: { id: row.id },
      });
    },
    // 查看宣教
    Vieweducation() {
      this.$router.push({
        path: "/knowledge/education/examine/",
        query: { id: "1" },
      });
    Vieweducation(row) {
      this.richText = null;
      this.previewtf = true;
      axios
        .get(row.richText)
        .then((response) => {
          console.log(response.data, "数据"); // 输出获取到的文件内容
          this.richText = response.data;
          this.richText = this.addStyleToImages(this.richText);
        })
        .catch((error) => {
          this.$modal.msgError("获取富文本失败");
          console.error("Failed to fetch file:", error);
        });
    },
    addStyleToImages(html) {
      return html.replace(
        /<img([^>]*)style=(['"])(?:(?!\2).)*\2([^>]*)>/g,
        '<img$1style="width:100%;height:auto;"$3>'
      );
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const userIds = row.userId || this.ids;
      const userIds = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除用户编号为"' + userIds + '"的数据项?')
        .then(function () {
          return delFollowupinfo(userIds);
          return dellibraryinfo(userIds);
        })
        .then(() => {
          this.getList();
@@ -672,12 +699,21 @@
    getDeptTree() {
      getheLibraryAssort({}).then((res) => {
        this.deptOptions = res.rows;
        console.log(res);
        this.dialogFormVisible = false;
      });
    },
    // 添加类别树
    submitsidecolumn() {
      if (this.classifyform.id) {
        editheLibraryAssort(this.classifyform).then((res) => {
          this.getDeptTree();
          this.$modal.msgSuccess("修改成功");
          this.classifyform = {};
          this.dialogFormVisible = false;
        });
        return;
      }
      let calssvalue = {};
      if (
        this.classifyform.pid &&
@@ -695,6 +731,7 @@
      } else {
        return this.$modal.msgError("请填写完整信息");
      }
      this.classifyform.hetype = 1;
      addheLibraryAssort(this.classifyform).then((res) => {
        this.getDeptTree();
        this.$modal.msgSuccess("新增成功");
@@ -730,6 +767,16 @@
          })
          .catch(() => {});
      }
    },
    altertag(a, b) {
      this.dialogFormVisible = true;
      if (!b.pid) {
        this.radio = "主分类";
      } else {
        this.radio = "子分类";
      }
      this.classifyform = b;
      this.dialogFormVisible = true;
    },
    // 筛选节点
@@ -829,7 +876,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);
@@ -944,6 +991,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;