WXL
2024-01-04 f93cb40b76468c6f1063081a3be16027d69b4832
src/views/knowledge/education/compilequer/index.vue
@@ -13,9 +13,7 @@
    <div class="leftvlue">
      <!-- 基本信息 -->
      <div v-if="Editprogress == 1">
        <div class="leftvlue-jbxx">
          基本信息<span>当前版本:{{ currentVersion }}</span>
        </div>
        <div class="leftvlue-jbxx">基本信息</div>
        <el-form
          :model="ruleForm"
          :rules="rules"
@@ -25,25 +23,29 @@
        >
          <el-form-item label="宣教分类" prop="region">
            <el-select
              v-model="ruleForm.classify"
              v-model="ruleForm.groupID"
              size="medium"
              multiple
              filterable
              placeholder="请选择分类"
            >
              <el-option
                class="ruleFormaa"
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                v-for="item in sortlist"
                :key="item.id"
                :label="item.assortname"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="宣教标题" prop="name">
          <el-form-item label="宣教标题" prop="extName">
            <div style="width: 30%">
              <el-input v-model="ruleForm.name"></el-input>
              <el-input v-model="ruleForm.extName"></el-input>
            </div>
          </el-form-item>
          <el-form-item label="宣教描述" prop="extName">
            <div style="width: 30%">
              <el-input v-model="ruleForm.note"></el-input>
            </div>
          </el-form-item>
          <el-form-item label="通知变量" prop="name">
@@ -89,27 +91,30 @@
          <el-form-item label="标签" prop="desc">
            <div class="xinz-inf">
              <el-tag
                :key="tag"
                :key="tag.tagname"
                type="success"
                v-for="tag in dynamicTags"
                closable
                :disable-transitions="false"
                @close="handleClose(tag)"
                @close="handleClosetag(tag)"
              >
                {{ tag }}
                {{ tag.tagname }}
              </el-tag>
              <el-select
                v-model="inputValue"
                v-if="inputVisible"
                @change="handleInputConfirm"
                filterable
                  allow-create
                remote
                reserve-keyword
                  default-first-option
                :remote-method="remoteMethodtag"
                :loading="loading"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in optionstag"
                  :key="item.tagname"
                  :key="item.tagid"
                    :label="item.tagname"
                    :value="item.tagname"
                >
@@ -127,12 +132,12 @@
          <el-row :gutter="20">
            <el-col :span="6">
              <el-form-item label="版本号" prop="name">
                <el-input v-model="currentVersion"></el-input> </el-form-item
                <el-input v-model="ruleForm.version"></el-input> </el-form-item
            ></el-col>
            <el-col :span="9">
              <el-form-item label="可用状态" prop="region">
                <el-select
                  v-model="ruleForm.classify"
                  v-model="ruleForm.isEnable"
                  size="medium"
                  multiple
                  filterable
@@ -140,7 +145,7 @@
                >
                  <el-option
                    class="ruleFormaa"
                    v-for="item in options"
                    v-for="item in usable"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
@@ -168,24 +173,47 @@
            </el-select>
          </el-form-item>
          <el-form-item label="适用疾病" prop="region">
            <div class="xinz-infs">
              <el-tag
                :key="item.icd10name"
                type="warning"
                v-for="item in illnesslist"
                closable
                :disable-transitions="false"
                @close="handleCloseillness(item)"
              >
                {{ item.icd10name }}
              </el-tag>
            <el-select
              v-model="ruleForm.illness"
              size="medium"
              multiple
                v-model="inputValue"
                v-if="illnessVisible"
                @change="illnessConfirm"
                :remote-method="remoteMethod"
              filterable
              placeholder="请选择分类"
                remote
                allow-create
                default-first-option
                placeholder="请选择/查询"
                :loading="loading"
            >
              <el-option
                class="ruleFormaa"
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                  v-for="item in optionsillness"
                  :key="item.icdid"
                  :label="item.icdname"
                  :value="item.icdid"
              >
              </el-option>
            </el-select>
              <el-button
                v-else
                class="button-new-tag"
                size="small"
                @click="illnessshowInput"
                >+ 新增疾病</el-button
              >
            </div>
          </el-form-item>
          <el-form-item label="使用院区" prop="region">
          <el-form-item label="适用院区" prop="region">
            <el-select
              v-model="ruleForm.courtyard"
              size="medium"
@@ -194,7 +222,7 @@
            >
              <el-option
                class="ruleFormaa"
                v-for="item in options"
                v-for="item in courtyardlist"
                :key="item.value"
                :label="item.label"
                :value="item.value"
@@ -225,9 +253,7 @@
              >下一步</el-button
            >
            <el-button @click="resetForm('ruleForm')">重置</el-button>
            <el-button type="info" @click="closeFm('ruleForm')"
                >关闭</el-button
              >
            <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
          </el-form-item>
        </el-form>
      </div>
@@ -303,10 +329,23 @@
<script>
import { quillEditor } from "vue-quill-editor";
import {
  getheLibraryAssort,
  delheLibraryAssort,
  addheLibraryAssort,
  addtargetillness,
  getlibrarylist,
  dellibraryinfo,
  compilelibrary,
  getlibraryinfo,
  getillnesslist,
  illnesslistget,
  getillness,
} from "@/api/AiCentre/index";
// import * as Quill from "quill";
import Quill from "quill";
import { listtag } from "@/api/system/label";
import store from "@/store";
// 这里引入修改过的video模块并注册
import Video from "./video";
@@ -354,8 +393,9 @@
        },
      ],
      content: "", //最终保存的内容
      dynamicTags: ["标签一", "标签二", "标签三"],
      dynamicTags: [],
      inputVisible: false,
      illnessVisible: false,
      inputValue: "",
      // 富文本
      editorOption: {
@@ -405,88 +445,31 @@
      radioas: "", //填空题答案
      // 总条数
      total: 1,
      ruleForm: {
        name: "",
        shape: "",
        classify: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
        templatevalue: "",
        data2: "",
      },
      ruleForm: {},
      rules: {},
      rulesa: {
        name: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
        ],
        region: [
          { required: true, message: "请选择活动区域", trigger: "change" },
        ],
        date1: [
          {
            type: "date",
            required: true,
            message: "请选择日期",
            trigger: "change",
          },
        ],
        date2: [
          {
            type: "date",
            required: true,
            message: "请选择时间",
            trigger: "change",
          },
        ],
        type: [
          {
            type: "array",
            required: true,
            message: "请至少选择一个活动性质",
            trigger: "change",
          },
        ],
        resource: [
          { required: true, message: "请选择活动资源", trigger: "change" },
        ],
        desc: [{ required: true, message: "请填写活动形式", trigger: "blur" }],
      },
      options: [
        {
          value: "选项1",
          label: "疾病宣教",
        },
        {
          value: "选项2",
          label: "入院宣教",
        },
        {
          value: "选项3",
          label: "手术宣教",
        },
        {
          value: "选项4",
          label: "护理宣教",
        },
      ],
      rulesa: {},
      mode: [],
      editableTabs: [],
      sortlist: [],
      usable: [],
      courtyardlist: [],
      precedencetype: [],
      optionsillness: [],
      illnesslistapi: [],
      illnesslist: [],
      options: [],
      optionstag:[],
      xjxsoptions: [
        {
          value: "选项1",
          value: "1",
          label: "图文",
        },
        {
          value: "选项2",
          value: "2",
          label: "视频",
        },
        {
          value: "选项3",
          value: "3",
          label: "音频",
        },
      ],
@@ -498,25 +481,7 @@
        },
      ],
      addvalue: "添加题目",
      // 题目表格数据
      userList: [
        {
          userid: "1",
          userName: "一号宣教",
        },
        {
          userid: "2",
          userName: "二号宣教",
        },
        {
          userid: "3",
          userName: "三号宣教",
        },
        {
          userid: "4",
          userName: "四号宣教",
        },
      ],
      variablelist: [
        {
          variable: "paitent",
@@ -527,17 +492,19 @@
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userName: undefined,
        phonenumber: undefined,
        status: undefined,
        deptId: undefined,
        IDnumber: undefined,
      },
    };
  },
  created() {
    this.gettabList();
    this.getList();
    this.illnessUpdate();
    this.mode = store.getters.mode;
    this.editableTabs = store.getters.editableTabs;
    this.usable = store.getters.usable;
    this.precedencetype = store.getters.precedencetype;
    this.courtyardlist = store.getters.courtyardlist;
  },
  watch: {
    content(newVal, oldVal) {
@@ -548,6 +515,28 @@
  },
  methods: {
    getList() {
      this.loading = true;
      getlibraryinfo({ id: this.$route.query.id }).then((res) => {
        this.ruleForm = res.data;
      });
      getheLibraryAssort({}).then((res) => {
        this.sortlist = res.rows;
        console.log(res);
      });
    },
    /** 查询标签列表 */
    gettabList() {
      const tagqueryParams = {
        pageNum: 1,
        pageSize: 1000,
        tagcategoryid: "0",
      };
      listtag(tagqueryParams).then((response) => {
        console.log(response);
        this.optionstag = response.rows;
      });
    },
    // 完成
    submitForm(formName) {
      this.rules = this.rulesa;
@@ -573,47 +562,25 @@
    },
    // 关闭
    closeFm(){
      this.$confirm('退出不会保留页面内容更改, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$router.go(-1)
        }).catch(() => {
      this.$confirm("退出不会保留页面内容更改, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$router.go(-1);
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
            type: "info",
            message: "已取消",
          });          
        });
    },
    // 保存题目信息
    Saveproblem(){},
    /** 查询题目列表 */
    getList() {
      //   this.loading = true;
      listUser().then((response) => {
        console.log(response);
        // this.userList = response.data;
        // this.total = response.total;
        // this.loading = false;
        console.log(this.userList);
      });
      //   const { rows } = await listUser();
      //   console.log(rows);
      //   this.list = rows;
    },
    /** 查询标签列表 */
    gettabList() {
      const tagqueryParams = {
        pageNum: 1,
        pageSize: 1000,
        tagcategoryid: "0",
      };
      listtag(tagqueryParams).then((response) => {
        console.log(response);
        this.optionstag = response.rows;
      });
    },
    // 新增变量
    addvariable() {
      this.variablelist.push({
@@ -635,23 +602,135 @@
      this.fileList = fileList.slice(-3);
    },
    // 标签-----------------
    handleClose(tag) {
    gettabList() {
      const tagqueryParams = {
        pageNum: 1,
        pageSize: 1000,
        tagcategoryid: "0",
      };
      listtag(tagqueryParams).then((response) => {
        console.log(response);
        this.optionstag = response.rows;
      });
    },
    handleClosetag(tag) {
      console.log(tag);
      console.log(this.dynamicTags.indexOf(tag));
      const lindex = this.dynamicTags.indexOf(tag);
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
      this.ruleForm.ivrLibaTemplateTargetList[lindex].isoperation = 3;
    },
    handleInputConfirm() {
      let inputValue = this.inputValue;
      if (inputValue) {
        this.dynamicTags.push(inputValue);
      let tagvalue = {};
      let tagname = this.inputValue;
      if (tagname) {
        listtag({
          pageNum: 1,
          pageSize: 1000,
          tagcategoryid: "0",
          tagname: tagname,
        }).then((res) => {
          if (res.rows[0]) {
            tagvalue = res.rows[0];
            tagvalue.isoperation = 1;
          } else {
            tagvalue = {
              tagname: tagname,
              isoperation: 1,
            };
          }
          this.ruleForm.ivrLibaTemplateTargetList.push(tagvalue);
          this.dynamicTags.push(tagvalue);
        });
      }
      this.inputVisible = false;
      this.inputValue = "";
    },
    remoteMethodtag(query) {
      if (query !== "") {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          listtag({ tagname: query, tagcategoryid: "0" }).then((res) => {
            this.optionstag = res.rows;
          });
        }, 200);
      } else {
        this.optionstag = [];
      }
    },
    showInput() {
      this.inputVisible = true;
      // 自动获取焦点
      // this.$nextTick((_) => {
      //   this.$refs.saveTagInput.$refs.input.focus();
      // });
    },
    // 疾病-----------------------
    illnessUpdate() {
      this.illnesslistapi = [];
      const illnessqueryParams = {
        pageNum: 1,
        pageSize: 100,
      };
      getillnesslist(illnessqueryParams).then((response) => {
        console.log(response);
        this.optionsillness = response.rows;
      });
      getillness({ outid: this.$route.query.id, type: 6 }).then((res) => {
        this.illnesslist = res.rows;
        console.log(res);
      });
    },
    handleCloseillness(tag) {
      this.illnesslist.splice(this.illnesslist.indexOf(tag), 1);
      if (tag.id) {
        this.illnesslistapi.push(tag.id);
      }
    },
    remoteMethod(value) {
      console.log(value);
      const illnessqueryParams = {
        pageNum: 1,
        pageSize: 100,
        icdname: value,
      };
      this.loading = true;
      setTimeout(() => {
        this.loading = false;
        getillnesslist(illnessqueryParams).then((response) => {
          this.optionsillness = response.rows;
        });
      }, 200);
    },
    illnessConfirm(item) {
      let opeavalue = {};
      let tagname = this.inputValue;
      illnesslistget(item).then((res) => {
        opeavalue = res.data;
        opeavalue.outid = this.indexid;
        opeavalue.type = 6;
        opeavalue.icd10id = opeavalue.icdid;
        opeavalue.icd10name = opeavalue.icdname;
        opeavalue.icd10code = opeavalue.icdcode;
        if (tagname) {
          this.illnesslist.push(opeavalue);
        }
      });
      console.log(this.illnesslist);
      this.inputVisible = false;
      this.inputValue = "";
    },
    confirmillness() {
      this.illnesslist.forEach((item, index) => {
        if (!item.id) {
          addtargetillness(item).then((res) => {});
        }
      });
      if (this.illnesslistapi.length) {
        deltargetillness(this.illnesslistapi.join(",")).then((res) => {});
      }
      this.illnessVisible = false;
      this.$modal.msgSuccess("编辑成功");
    },
    illnessshowInput() {
      this.illnessVisible = true;
    },
    // --------------------------