WXL (wul)
2025-09-24 d0ec9165edd35e56fbed20eccee9143e835163f3
src/views/knowledge/education/compilequer/index.vue
@@ -206,9 +206,20 @@
            </el-select>
          </el-form-item>
          <el-form-item label="适用疾病" prop="region">
            <el-button type="warning" @click="$refs.child.handleAddpatient()"
              >添加疾病</el-button
            <div style="margin-bottom: 10px">
              <el-button type="warning" @click="$refs.child.handleAddpatient()"
                >添加疾病诊断</el-button
              >
            </div>
            <el-tag
              v-for="tag in displayedTags"
              :key="tag.icdid"
              type="warning"
              :disable-transitions="false"
            >
              {{ tag.icdname }}
            </el-tag>
            <el-tag v-if="hasMore" type="info">+{{ remaining }} more</el-tag>
          </el-form-item>
          <el-form-item label="适用院区" prop="region">
            <el-select
@@ -253,7 +264,7 @@
          </el-form-item>
        </el-form>
      </div>
    <!-- 宣教内容 -->
      <!-- 宣教内容 -->
      <div v-if="Editprogress == 2">
        <el-row :gutter="20">
          <el-col :span="4">
@@ -292,8 +303,12 @@
        <div>
          <el-button @click="laststep('ruleForm')">上一步</el-button>
          <el-button type="success" @click="Departmenttreatment('ruleForm')">保存</el-button>
          <el-button type="warning" @click="Departmenttreatment('ruleForm')">另存新版本</el-button>
          <el-button type="success" @click="Departmenttreatment('ruleForm')"
            >保存</el-button
          >
          <el-button type="warning" @click="Departmenttreatment('ruleForm')"
            >另存新版本</el-button
          >
          <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
        </div>
      </div>
@@ -311,7 +326,7 @@
<script>
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
import '@wangeditor/editor/dist/css/style.css';
import "@wangeditor/editor/dist/css/style.css";
import axios from "axios";
import { getToken } from "@/utils/auth";
@@ -322,6 +337,7 @@
  addrichText,
  getlibraryinfo,
  getillnesslist,
  getillness,
} from "@/api/AiCentre/index";
import OptionalForm from "@/components/OptionalForm";
import { listDept } from "@/api/system/dept";
@@ -333,7 +349,7 @@
  components: { OptionalForm, Editor, Toolbar },
  data() {
    return {
 // 编辑器实例
      // 编辑器实例
      editorRef: null,
      // 编辑器内容
@@ -341,7 +357,7 @@
      // 编辑器模式
      mode: "default",
fileList:[],
      // 工具栏配置
      toolbarConfig: {
        excludeKeys: [
@@ -350,7 +366,7 @@
          "uploadVideo",
          "emotion",
          "codeBlock",
        ]
        ],
      },
      // 编辑器配置
@@ -364,7 +380,7 @@
            maxNumberOfFiles: 1,
            allowedFileTypes: ["image/*"],
            headers: {
              Authorization: "Bearer " + getToken()
              Authorization: "Bearer " + getToken(),
            },
            customUpload: async (file, insertFn) => {
              try {
@@ -376,9 +392,9 @@
                  formData,
                  {
                    headers: {
                      "Content-Type": "multipart/form-data",
                      Authorization: "Bearer " + getToken()
                    }
                      // "Content-Type": "multipart/form-data",
                      Authorization: "Bearer " + getToken(),
                    },
                  }
                );
@@ -394,13 +410,13 @@
                console.error("图片上传失败", error);
                this.$message.error("图片上传失败");
              }
            }
          }
        }
            },
          },
        },
      },
      // 上传配置
      headers: {
        Authorization: "Bearer " + getToken()
        Authorization: "Bearer " + getToken(),
      },
      uploadImgUrlword: process.env.VUE_APP_BASE_API + "/common/uploadShow",
@@ -417,7 +433,7 @@
        preachname: "",
        preachcontent: "",
        isAvailable: "",
        suitway: []
        suitway: [],
      },
      // 其他数据
@@ -430,13 +446,13 @@
      variablelist: [
        { variatename: "姓名", variate: "${name}", default: 1 },
        { variatename: "电话", variate: "${phone}", default: 1 },
        { variatename: "病情", variate: "${illness}", default: 1 }
        { variatename: "病情", variate: "${illness}", default: 1 },
      ],
      props: {
        multiple: true,
        value: "deptId",
        label: "deptName"
        label: "deptName",
      },
      fileName: "", //文件名
      inputVisible: false,
@@ -493,7 +509,6 @@
      ],
      addvalue: "添加题目",
      // 查询参数
      queryParams: {
        pageNum: 1,
@@ -527,25 +542,39 @@
    // },
    content(newVal) {
      // 内容变化时触发,可以在这里处理自动保存等逻辑
      this.$emit('content-change', newVal)
    }
      this.$emit("content-change", newVal);
    },
  },
  beforeDestroy() {
    const editor = this.editor;
    if (editor == null) return;
    editor.destroy(); // 组件销毁时,及时销毁编辑器
  },
  computed: {
    displayedTags() {
      // 返回前10个tag
      return this.illnesslist.slice(0, 10);
    },
    hasMore() {
      // 判断是否有更多的tag
      return this.illnesslist.length > 10;
    },
    remaining() {
      // 计算剩余的tag数量
      return this.illnesslist.length - 10;
    },
  },
  methods: {
    onCreated(editor) {
      this.editor = Object.seal(editor); // 一定要用 Object.seal(),否则会报错
    },
    // 编辑器创建回调
   handleEditorCreated(editor) {
    handleEditorCreated(editor) {
      this.editorRef = editor;
      console.log("编辑器已创建", editor);
    },
   // 销毁编辑器
    // 销毁编辑器
    destroyEditor() {
      if (this.editorRef) {
        this.editorRef.destroy();
@@ -1011,7 +1040,8 @@
    // },
    // 获取远程内容
    Getmissioncontent(url) {
      axios.get(url)
      axios
        .get(url)
        .then((response) => {
          this.content = response.data;
        })
@@ -1023,7 +1053,7 @@
  },
  // 生命周期钩子
  beforeUnmount() {
    this.destroyEditor()
    this.destroyEditor();
  },
};
</script>