zsw007 3 年 前
コミット
14053b9652
21 ファイル変更15061 行追加143 行削除
  1. 789 0
      .history/src/components/common/LtModal_20211025110249.vue
  2. 792 0
      .history/src/components/common/LtModal_20211025150630.vue
  3. 697 0
      .history/src/components/icss/drug/DrugManage_20211025110249.vue
  4. 779 0
      .history/src/components/icss/drug/DrugManage_20211025115027.vue
  5. 780 0
      .history/src/components/icss/drug/DrugManage_20211025132654.vue
  6. 779 0
      .history/src/components/icss/drug/DrugManage_20211025132737.vue
  7. 781 0
      .history/src/components/icss/drug/DrugManage_20211025133628.vue
  8. 782 0
      .history/src/components/icss/drug/DrugManage_20211025133828.vue
  9. 783 0
      .history/src/components/icss/drug/DrugManage_20211025135948.vue
  10. 783 0
      .history/src/components/icss/drug/DrugManage_20211025140712.vue
  11. 784 0
      .history/src/components/icss/drug/DrugManage_20211025141022.vue
  12. 783 0
      .history/src/components/icss/drug/DrugManage_20211025141110.vue
  13. 784 0
      .history/src/components/icss/drug/DrugManage_20211025144240.vue
  14. 786 0
      .history/src/components/icss/drug/DrugManage_20211025144253.vue
  15. 787 0
      .history/src/components/icss/drug/DrugManage_20211025145347.vue
  16. 787 0
      .history/src/components/icss/drug/DrugManage_20211025145419.vue
  17. 789 0
      .history/src/components/icss/drug/DrugManage_20211025145741.vue
  18. 789 0
      .history/src/components/icss/drug/DrugManage_20211025145954.vue
  19. 789 0
      .history/src/components/icss/drug/DrugManage_20211025151926.vue
  20. 3 0
      src/components/common/LtModal.vue
  21. 235 143
      src/components/icss/drug/DrugManage.vue

+ 789 - 0
.history/src/components/common/LtModal_20211025110249.vue

@@ -0,0 +1,789 @@
+<template>
+  <div class="modal-container">
+    <div class="cover"></div>
+    <div class="modal-box">
+      <div class="modal-title">
+        <span class="title-l">{{title}}{{tip}}</span>
+        <a class="close" @click="closeModal()">×</a>
+      </div>
+      <div class="modal-body">
+        <el-form
+          :model="form"
+          :rules="rules"
+          label-position="right"
+          label-width="145px"
+          ref="relationForm"
+        >
+          <div class="AddChemicalAndCommonMappingBox clearfix">
+            <div class="titleBox clearfix">
+              <p class="title">医院术语</p>
+              <p class="title">标准术语</p>
+            </div>
+            <div class="leftBox clearfix">
+              <el-row>
+                <el-col :span="16">
+                  <el-form-item :label="meal+':'" prop="hisName">
+                    <el-input
+                      v-model.trim="form.hisName"
+                      clearable
+                      style="minWidth: 240px"
+                      @input="onchange"
+                      @blur="onblur"
+                    ></el-input>
+                  </el-form-item>
+                  <el-form-item :label="meal+'预览:'">
+                    <span class="previewInfo" style="minWidth: 240px">{{form.hisName}}</span>
+                  </el-form-item>
+                  <el-form-item label="科室编码:" prop="hisCode" v-if="type==7">
+                    <el-input v-model.trim="form.hisCode" clearable style="minWidth: 240px"></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="16" v-if="type == 2 || type == 1">
+                  <el-form-item :label="detail+':'" prop="hisDetailName">
+                    <el-input
+                      v-model.trim="form.hisDetailName"
+                      clearable
+                      style="minWidth: 240px"
+                      @input="onchange"
+                      @blur="onblur"
+                      @clear="clear"
+                    ></el-input>
+                  </el-form-item>
+                  <el-form-item :label="detail+'预览:'">
+                    <span class="previewInfo" style="minWidth: 240px">{{form.hisDetailName}}</span>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+            </div>
+            <div class="midBox">
+              <img class="midLogo" src="../../images/relation.png" alt />
+              <p class="midTitle">相互关联</p>
+            </div>
+            <div class="rightBox">
+              <el-row>
+                <el-col :span="16">
+                  <el-form-item :label="standard+':'" prop="searchText">
+                    <el-select
+                      style="width:100%;minWidth: 240px"
+                      v-model="form.searchText"
+                      filterable
+                      remote
+                      clearable
+                      :loading="showDrop"
+                      loading-text="加载中..."
+                      @change="changeWord"
+                      @focus="handleFocus"
+                      @visible-change="handleVisible"
+                      placeholder="搜索"
+                      :remote-method="searchTerms"
+                      reserve-keyword
+                    >
+                      <el-option
+                        v-for="item in uniqueNameList"
+                        :key="item.icd10Code"
+                        :label="searchType == 2 ? `${item.uniqueName}(${item.name})` : item.name"
+                        :value="searchType == 2 ? `${item.uniqueName}` : item"
+                        :title="searchType == 2 ? `${item.uniqueName}(${item.name})` : item.name"
+                        @click.native="handleChoose(searchType == 2 ? `${item.uniqueName}` : item.name,item.id)"
+                      ></el-option>
+                    </el-select>
+                  </el-form-item>
+                  <el-form-item v-if="tableData.length >0">
+                    <el-table
+                      :header-row-style="{height:'40px'}"
+                      :header-cell-style="{height:'40px',padding:'0'}"
+                      :row-class-name="tableRowClassName"
+                      :row-style="selectedstyle"
+                      :data="tableData"
+                      @row-click="btn"
+                      size="mini"
+                      :class="{tabs:uniqueNameList}"
+                      class="tab"
+                    >
+                      <el-table-column prop="name" :show-overflow-tooltip="true" label="词名"></el-table-column>
+                      <el-table-column prop="address" :show-overflow-tooltip="true" label="来源">
+                        <template slot-scope="scope">
+                          <span>{{scope.row.source == 1?'标准词匹配':scope.row.source == 2?'同义词匹配':scope.row.source == 5?'相似词匹配':''}}</span>
+                        </template>
+                      </el-table-column>
+                    </el-table>
+                  </el-form-item>
+
+                  <el-form-item :label="standard+'预览:'">
+                    <!-- <span class="previewInfo">{{!isEdit ? form.searchText.name : form.searchText}}</span> -->
+                    <span class="previewInfo" style="minWidth: 240px">{{form.searchText}}</span>
+                  </el-form-item>
+                  <el-form-item label="ICD编码:" v-if="type == 4">
+                    <span class="previewInfo" style="minWidth: 240px">{{form.icdCode}}</span>
+                  </el-form-item>
+                  <el-form-item :label="detail+':'" v-if="type == 12 || type == 13 || type == 6">
+                    <span class="previewInfo" style="minWidth: 240px">{{form.icdCode}}</span>
+                  </el-form-item>
+                  <el-form-item label="药品剂型:" v-if="type == 5">
+                    <el-select
+                      style="width:100%;minWidth: 240px"
+                      v-model="form.form"
+                      filterable
+                      remote
+                      clearable
+                      :loading="showDrop"
+                      loading-text="加载中..."
+                      @change="drugchangeWord"
+                      @focus="handleFocus"
+                      @visible-change="handleVisible"
+                      placeholder="搜索"
+                      :remote-method="searchDrug"
+                      reserve-keyword
+                    >
+                      <el-option
+                        v-for="item in drugList"
+                        :key="item.icd10Code"
+                        :label="item.name"
+                        :value="item"
+                        :title="item.name"
+                      ></el-option>
+                    </el-select>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+            </div>
+          </div>
+        </el-form>
+      </div>
+      <div class="mapList">
+        已关联标准术语:
+        <span v-for="item in mapList" :key="item.id">
+          <span v-if="item.uniqueName">{{item.uniqueName}}&nbsp;&nbsp;{{item.form}}{{item.hisCode}};</span>
+        </span>
+      </div>
+      <div class="modal-footer">
+        <button class="confirm btns" :disabled="saveDisable" @click="submitForm">确定</button>
+        <button class="cancel btns" @click="closeModal">取消</button>
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+import api from '@api/icss.js';
+import config from '@api/config.js';
+import utils from '@api/utils.js';
+export default {
+  name: 'lt-modal',
+  props: ['modalVisiable', 'meal', 'detail', 'standard', 'type', 'data', 'tip'],
+  data() {
+    return {
+      form: {
+        searchText: '', //搜索字段
+        hisName: '',
+        icdCode: '',
+        hisDetailName: '',
+        formConceptId: '',
+        conceptId: '',
+        form: '',
+        hisCode: '',
+        source: ''
+      },
+      showDrop: false, //下拉框显示文字
+      saveDisable: false, //保存按钮禁止点击
+      uniqueNameList: [],
+      rules: {
+        hisName: [
+          { required: true, message: '请输入' + this.meal, trigger: 'change' },
+          { max: 80, message: this.meal + '最多80字', trigger: 'change' }
+        ],
+        searchText: [
+          { required: true, message: '请选择' + this.meal, trigger: 'change' }
+        ]
+      },
+      isEdit: false,
+      editId: '',
+      drugList: [],
+      tableData: [],
+      mapList: [],
+      getIndex: 6,
+      ty: this.type,
+      searchType: '',
+      title: '添加'
+    };
+  },
+  created() {
+    if (this.type == 1) {
+      this.ty = 2; // 1-化验大项、2-化验小项
+    }
+    //修改
+    if (JSON.stringify(this.data) != '{}') {
+      this.title = '修改';
+      this.isEdit = true;
+      this.editId = this.data.id;
+      this.form.hisName = this.data.hisName;
+      this.form.hisDetailName = this.data.hisDetailName;
+      this.form.searchText = this.data.uniqueName;
+      this.form.icdCode = this.data.code;
+      this.form.conceptId = this.data.conceptId;
+      this.form.formConceptId = this.data.formConceptId;
+      this.form.form = this.data.form;
+      this.form.source = this.data.source;
+      this.form.hisCode = this.data.hisCode;
+      let name;
+      if (
+        this.data.hisName !== '' &&
+        this.data.hisDetailName === '' &&
+        this.type == 1
+      ) {
+        this.ty = 1; // 1-化验大项、2-化验小项
+        this.searchType = 1;
+        name = this.data.hisName;
+      } else if (
+        this.data.hisName !== '' &&
+        this.data.hisDetailName !== '' &&
+        this.type == 1
+      ) {
+        this.ty = 2;
+        this.searchType = 2;
+        name = this.data.hisDetailName;
+      }
+      this.getTermMatching(this.ty, name);
+      this.getRelatedMapping();
+    }
+  },
+  methods: {
+    selectedstyle({ row, rowIndex }) {
+      if (this.getIndex === rowIndex) {
+        return {
+          'background-color': '#EBEEF5',
+          color: '#48C5D7'
+        };
+      }
+    },
+    tableRowClassName({ row, rowIndex }) {
+      row.index = rowIndex;
+    },
+    btn(row) {
+      const { hisName, hisDetailName } = this.form;
+      if (hisName !== '' && hisDetailName === '' && this.type == 1) {
+        this.ty = 1;
+      } else if (hisName !== '' && hisDetailName !== '' && this.type == 1) {
+        this.ty = 2;
+      }
+      console.log(this.ty)
+      this.searchType = this.ty;
+      if (this.getIndex == row.index) {
+        this.getIndex = 6;
+        this.form.searchText = '';
+        this.form.conceptId = '';
+        this.form.icdCode = '';
+        this.form.source = '';
+      } else {
+        this.getIndex = row.index;
+        this.form.searchText = row.name;
+        this.form.conceptId = row.id;
+        this.form.icdCode = row.code;
+        this.form.source = row.source;
+      }
+    },
+    handleChoose(val, id) {
+      this.form.conceptId = id;
+      this.form.searchTextPre = val;
+      this.form.searchText = val;
+    },
+    // 搜索列表
+    searchTerms(query) {
+      if (!query) {
+        this.uniqueNameList = [];
+        return;
+      }
+      const { hisName, hisDetailName } = this.form;
+      if (hisName !== '' && hisDetailName === '' && this.type == 1) {
+        this.ty = 1;
+      } else if (hisName !== '' && hisDetailName !== '' && this.type == 1) {
+        this.ty = 2;
+      }
+      this.searchType = this.ty;
+      this.showDrop = true;
+      let params = {
+        type: this.ty ? this.ty : this.type,
+        inputStr: query,
+        sex: 3,
+        age: 0
+      };
+      api.retrievalSearch(params).then(res => {
+        this.showDrop = false;
+        if (res.data.code === '0') {
+          if (this.ty == 2) {
+            this.uniqueNameList = res.data.data.lisDetailNames;
+          } else {
+            this.uniqueNameList = res.data.data.nameList;
+          }
+        }
+      });
+    },
+    searchDrug(query) {
+      if (!query) {
+        this.drugList = [];
+        return;
+      }
+      this.showDrop = true;
+      let params = {
+        type: 15,
+        inputStr: query,
+        sex: 3,
+        age: 0
+      };
+      api.retrievalSearch(params).then(res => {
+        this.showDrop = false;
+        if (res.data.code === '0') {
+          this.drugList = res.data.data.nameList;
+        }
+      });
+    },
+    onchange() {
+      this.getRelatedMapping();
+    },
+    getRelatedMapping() {
+      const { hisName, hisDetailName } = this.form;
+      let params = {
+        type: this.type,
+        hisDetailName: hisDetailName,
+        hisName: hisName
+      };
+      api.getRelatedMapping(params).then(res => {
+        this.showDrop = false;
+        if (res.data.code === '0') {
+          this.mapList = res.data.data;
+        }
+      });
+    },
+    changeWord(newValue) {
+      this.form.searchText = newValue.name;
+      this.form.icdCode = newValue.code;
+      this.form.conceptId = newValue.id;
+      this.getIndex = 6;
+    },
+    drugchangeWord(newValue) {
+      this.form.formConceptId = newValue.id;
+      this.form.form = newValue.name;
+    },
+    handleVisible(flag) {
+      if (!flag) {
+        this.uniqueNameList = [];
+      }
+    },
+    // 获取焦点
+    handleFocus() {},
+    onblur() {
+      let type, name;
+      if (this.type == 1) {
+        const { hisName, hisDetailName } = this.form;
+        type = 1; // 1-化验大项、2-化验小项
+        name = hisName;
+        if (hisName !== '' && hisDetailName !== '') {
+          type = 2;
+          name = hisDetailName;
+        }
+      }
+      this.getTermMatching(type, name);
+    },
+    clear(){
+      const { hisName, hisDetailName } = this.form;
+      this.getTermMatching(1, hisName);
+    },
+    getTermMatching(type, name) {
+      let params = {
+        type: type ? type : this.type,
+        inputStr: name ? name : this.form.hisName
+      };
+      api.getTermMatching(params).then(res => {
+        this.showDrop = false;
+        if (res.data.code === '0') {
+          this.tableData = res.data.data;
+          this.getIndex = 6;
+        }
+      });
+    },
+    // 建立关联-参数处理
+    submitForm() {
+      this.$refs.relationForm.validate(valid => {
+        if (valid) {
+          const {
+            searchText,
+            hisName,
+            hisDetailName,
+            icdCode,
+            conceptId,
+            formConceptId,
+            source,
+            hisCode
+          } = this.form;
+          // 当标准术语是套餐时,细项必须为空
+          if (this.searchType === 1 && hisDetailName !== '') {
+            this.warning('医院术语与标准术语类型不匹配,请修改');
+            return;
+          }
+
+          // 当标准术语是细项时,医院术语套餐和细项均不能为空
+          if (this.searchType === 2) {
+            if (hisName === '') {
+              this.warning('医院术语与标准术语类型不匹配,请修改');
+              return;
+            } else if (hisDetailName === '') {
+              this.warning('医院术语与标准术语类型不匹配,请修改');
+              return;
+            }
+          }
+          let params = {
+            hisName: hisName,
+            uniqueName: searchText,
+            hisDetailName: hisDetailName,
+            type: this.type,
+            conceptId: conceptId,
+            formConceptId: formConceptId,
+            hisCode: hisCode,
+            source: source ? source : 1
+          };
+          this.showSaveDialog(params);
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    // 建立关联-映射关系是否已存在
+    showSaveDialog(params) {
+      this.saveDisable = true; //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
+      api
+        .diseaseIsExistRecord(params)
+        .then(res => {
+          if (!res.data.data) {
+            // 不存在,创建新的关联
+            // 如果是编辑时,需要携带id
+            if (this.isEdit) {
+              params = { ...params, id: this.editId };
+            }
+            this.saveLisMapping(params, '保存成功', 'success');
+          } else {
+            // 已存在,提示修改
+            this.warning('该条关联已存在,无法添加');
+            this.saveDisable = false;
+          }
+        })
+        .catch(err => {
+          if (err.code === '900010001') {
+            return false;
+          }
+          this.warning(err);
+        });
+    },
+    // 初始化表单数据
+    initForm() {
+      this.form.hisName = '';
+      this.form.searchText = '';
+      this.form.icdCode = '';
+      this.form.hisDetailName = '';
+      this.form.form = '';
+      this.form.conceptId = '';
+      this.form.source = '';
+    },
+    // 映射关系不存在-建立关联
+    saveLisMapping(params, msg, type) {
+      api.saveOrUpdateDiseaseRecord(params).then(res => {
+        if (res.data.code === '0') {
+          this.warning(res.data.msg || msg, type);
+          this.initForm();
+          this.$emit('func', 'updata');
+        } else {
+          this.warning(res.data.msg);
+        }
+        this.saveDisable = false;
+      });
+    },
+    // 关联已存在模态框
+    showConfirmDialog(msg, resolve) {
+      this.$alert(msg, '提示', {
+        // customClass: 'confirmRealation',
+        confirmButtonText: '是',
+        // cancelButtonText: '否',
+        // cancelButtonClass: 'cancelButton',
+        type: 'warning'
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {
+          this.saveDisable = false;
+          this.warning('建立失败', 'error');
+        });
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || 'warning',
+        duration: '1000'
+      });
+    },
+    closeModal() {
+      this.$emit('func', 'close');
+    }
+  }
+};
+</script>
+<style lang="less" scoped>
+.modal-container {
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  z-index: 21;
+  .cover {
+    background: #000;
+    opacity: 0.2;
+    width: 100%;
+    height: 100%;
+  }
+  .modal-box {
+    width: 950px;
+    background: #fff;
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    .modal-title {
+      height: 40px;
+      background: #e3eaf4;
+      .close {
+        float: right;
+        margin: 3px 13px 0 0;
+        font-size: 22px;
+        color: #979797;
+        cursor: pointer;
+      }
+    }
+    .btns {
+      display: inline-block;
+      width: 70px;
+      height: 34px;
+      line-height: 34px;
+      background: #48c5d7;
+      border-radius: 4px;
+      color: #fff;
+      text-align: center;
+      cursor: pointer;
+      outline: none;
+      border: none;
+    }
+    .cancel {
+      background: #fff;
+      color: #48c5d7;
+      border: 1px #48c5d7 solid;
+      margin-left: 40px;
+    }
+    .modal-body {
+      padding: 34px 22px;
+    }
+    .modal-footer {
+      margin-bottom: 60px;
+      width: 100%;
+      text-align: center;
+    }
+  }
+}
+.tab {
+  max-width: 240px;
+  min-width: 240px;
+  //   position: absolute;
+  //   top: 0;
+  z-index: 999;
+  margin-bottom: 15px;
+  margin-top: -18px;
+}
+// .tabs {
+//   max-width: 240px;
+//   min-width: 240px;
+//   position: absolute;
+//   top: 0;
+//   left: 250px;
+// }
+.mapList {
+  padding: 0 20px 20px;
+  font-size: 14px;
+  line-height: 24px;
+  & span {
+    padding: 0 3px;
+  }
+}
+.el-select-dropdown__list,
+.el-select-dropdown__item {
+  width: 219px;
+  cursor: pointer;
+}
+.el-dropdown-menu__item:focus,
+.el-checkbox__input.is-checked + .el-checkbox__label,
+.el-dropdown-menu__item:not(.is-disabled):hover,
+.el-button--text,
+.el-date-table td.today span,
+.el-radio__input.is-checked + .el-radio__label,
+.el-pagination.is-background .el-pager li:not(.disabled):hover,
+.el-select-dropdown__item.selected {
+  font-size: 14px;
+  padding: 0 20px;
+  position: relative;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  color: #606266;
+  height: 34px;
+  line-height: 34px;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+  width: 219px;
+  cursor: pointer;
+}
+/deep/ .el-form-item__error {
+  width: 150px;
+}
+/*********新增编辑***********/
+.topBack {
+  top: 0;
+}
+.titleBox {
+  padding: 0 0 10px 0px;
+}
+/deep/.el-table th {
+  background: #f7f7f7;
+}
+/deep/ .el-table td,
+.el-table th.is-leaf {
+  border-bottom: none;
+}
+.title-l {
+  font-size: 14px;
+  line-height: 40px;
+  margin-left: 10px;
+}
+.title {
+  width: 50%;
+  float: left;
+  font-size: 14px;
+}
+.leftBox,
+.midBox,
+.rightBox {
+  width: 380px;
+  float: left;
+  height: 248px;
+  font-size: 14px;
+}
+.midBox {
+  width: 6%;
+  padding: 50px 0 0 0;
+  text-align: center;
+}
+.midTitle {
+  width: 40px;
+  margin: 0 auto;
+}
+.midLogo {
+  margin: 0 auto;
+}
+.leftBox,
+.rightBox {
+  border: 1px solid #dcdfe6;
+  padding: 20px 10px;
+}
+.rightBox {
+  padding-right: 33px;
+  height: 248px;
+  overflow-y: auto;
+}
+.itemLabel {
+  width: 100%;
+  min-height: 50px;
+  line-height: 50px;
+  position: relative;
+}
+.itemLabelName,
+.searchInput,
+.searchName {
+  float: left;
+  color: #606266;
+}
+.itemLabelName {
+  width: 150px;
+}
+.isRequired::before {
+  content: '*';
+  color: red;
+}
+.searchInput,
+.mealNameItem {
+  padding: 0 5px;
+}
+.searchInput,
+.searchName {
+  display: inline-block;
+  height: 32px;
+  line-height: 32px;
+  border: 1px solid #a9a9a9;
+  margin: 8px 0 0 0;
+}
+
+.searchName {
+  text-align: center;
+  border-left: none;
+  cursor: pointer;
+  padding: 0 12px;
+  font-size: 16px;
+}
+.itemList {
+  position: absolute;
+  background: #fff;
+  width: 162px;
+  max-height: 150px;
+  border: 1px solid #a9a9a9;
+  left: 150px;
+  top: 42px;
+  z-index: 2;
+  overflow-y: auto;
+}
+.itemList {
+  width: calc(100% - 131px);
+}
+.mealNameItem {
+  height: 30px;
+  line-height: 30px;
+  font-size: 14px;
+  cursor: pointer;
+}
+.mealNameItem:hover {
+  background: #f5f7fa;
+}
+.previewInfo {
+  padding-left: 4px;
+  display: inline-block;
+  margin-top: 8px;
+  // width: calc(100% - 160px);s
+  line-height: 24px;
+  overflow: hidden;
+  word-wrap: break-word;
+  word-break: break-all;
+}
+.sumbit {
+  position: absolute;
+  display: inline-block;
+  width: 80px;
+  height: 30px;
+  line-height: 30px;
+  border: 1px solid #a9a9a9;
+  text-align: center;
+  right: 100px;
+}
+.confirmRealation {
+  .cancelButton {
+    border: 1px solid #a9a9a9;
+    span {
+      color: #606266;
+    }
+  }
+}
+</style>

+ 792 - 0
.history/src/components/common/LtModal_20211025150630.vue

@@ -0,0 +1,792 @@
+<template>
+  <div class="modal-container">
+    <div class="cover"></div>
+    <div class="modal-box">
+      <div class="modal-title">
+        <span class="title-l">{{title}}{{tip}}</span>
+        <a class="close" @click="closeModal()">×</a>
+      </div>
+      <div class="modal-body">
+        <el-form
+          :model="form"
+          :rules="rules"
+          label-position="right"
+          label-width="145px"
+          ref="relationForm"
+        >
+          <div class="AddChemicalAndCommonMappingBox clearfix">
+            <div class="titleBox clearfix">
+              <p class="title">医院术语</p>
+              <p class="title">标准术语</p>
+            </div>
+            <!-- 左边框中的内容 -->
+            <div class="leftBox clearfix">
+              <el-row>
+                <el-col :span="16">
+                  <el-form-item :label="meal+':'" prop="hisName">
+                    <el-input
+                      v-model.trim="form.hisName"
+                      clearable
+                      style="minWidth: 240px"
+                      @input="onchange"
+                      @blur="onblur"
+                    ></el-input>
+                  </el-form-item>
+                  <el-form-item :label="meal+'预览:'">
+                    <span class="previewInfo" style="minWidth: 240px">{{form.hisName}}</span>
+                  </el-form-item>
+                  <el-form-item label="科室编码:" prop="hisCode" v-if="type==7">
+                    <el-input v-model.trim="form.hisCode" clearable style="minWidth: 240px"></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="16" v-if="type == 2 || type == 1">
+                  <el-form-item :label="detail+':'" prop="hisDetailName">
+                    <el-input
+                      v-model.trim="form.hisDetailName"
+                      clearable
+                      style="minWidth: 240px"
+                      @input="onchange"
+                      @blur="onblur"
+                      @clear="clear"
+                    ></el-input>
+                  </el-form-item>
+                  <el-form-item :label="detail+'预览:'">
+                    <span class="previewInfo" style="minWidth: 240px">{{form.hisDetailName}}</span>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+            </div>
+            <!-- 相互关联图标 -->
+            <div class="midBox">
+              <img class="midLogo" src="../../images/relation.png" alt />
+              <p class="midTitle">相互关联</p>
+            </div>
+            <!-- 右边框中的内容 -->
+            <div class="rightBox">
+              <el-row>
+                <el-col :span="16">
+                  <el-form-item :label="standard+':'" prop="searchText">
+                    <el-select
+                      style="width:100%;minWidth: 240px"
+                      v-model="form.searchText"
+                      filterable
+                      remote
+                      clearable
+                      :loading="showDrop"
+                      loading-text="加载中..."
+                      @change="changeWord"
+                      @focus="handleFocus"
+                      @visible-change="handleVisible"
+                      placeholder="搜索"
+                      :remote-method="searchTerms"
+                      reserve-keyword
+                    >
+                      <el-option
+                        v-for="item in uniqueNameList"
+                        :key="item.icd10Code"
+                        :label="searchType == 2 ? `${item.uniqueName}(${item.name})` : item.name"
+                        :value="searchType == 2 ? `${item.uniqueName}` : item"
+                        :title="searchType == 2 ? `${item.uniqueName}(${item.name})` : item.name"
+                        @click.native="handleChoose(searchType == 2 ? `${item.uniqueName}` : item.name,item.id)"
+                      ></el-option>
+                    </el-select>
+                  </el-form-item>
+                  <el-form-item v-if="tableData.length >0">
+                    <el-table
+                      :header-row-style="{height:'40px'}"
+                      :header-cell-style="{height:'40px',padding:'0'}"
+                      :row-class-name="tableRowClassName"
+                      :row-style="selectedstyle"
+                      :data="tableData"
+                      @row-click="btn"
+                      size="mini"
+                      :class="{tabs:uniqueNameList}"
+                      class="tab"
+                    >
+                      <el-table-column prop="name" :show-overflow-tooltip="true" label="词名"></el-table-column>
+                      <el-table-column prop="address" :show-overflow-tooltip="true" label="来源">
+                        <template slot-scope="scope">
+                          <span>{{scope.row.source == 1?'标准词匹配':scope.row.source == 2?'同义词匹配':scope.row.source == 5?'相似词匹配':''}}</span>
+                        </template>
+                      </el-table-column>
+                    </el-table>
+                  </el-form-item>
+
+                  <el-form-item :label="standard+'预览:'">
+                    <!-- <span class="previewInfo">{{!isEdit ? form.searchText.name : form.searchText}}</span> -->
+                    <span class="previewInfo" style="minWidth: 240px">{{form.searchText}}</span>
+                  </el-form-item>
+                  <el-form-item label="ICD编码:" v-if="type == 4">
+                    <span class="previewInfo" style="minWidth: 240px">{{form.icdCode}}</span>
+                  </el-form-item>
+                  <el-form-item :label="detail+':'" v-if="type == 12 || type == 13 || type == 6">
+                    <span class="previewInfo" style="minWidth: 240px">{{form.icdCode}}</span>
+                  </el-form-item>
+                  <el-form-item label="药品剂型:" v-if="type == 5">
+                    <el-select
+                      style="width:100%;minWidth: 240px"
+                      v-model="form.form"
+                      filterable
+                      remote
+                      clearable
+                      :loading="showDrop"
+                      loading-text="加载中..."
+                      @change="drugchangeWord"
+                      @focus="handleFocus"
+                      @visible-change="handleVisible"
+                      placeholder="搜索"
+                      :remote-method="searchDrug"
+                      reserve-keyword
+                    >
+                      <el-option
+                        v-for="item in drugList"
+                        :key="item.icd10Code"
+                        :label="item.name"
+                        :value="item"
+                        :title="item.name"
+                      ></el-option>
+                    </el-select>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+            </div>
+          </div>
+        </el-form>
+      </div>
+      <div class="mapList">
+        已关联标准术语:
+        <span v-for="item in mapList" :key="item.id">
+          <span v-if="item.uniqueName">{{item.uniqueName}}&nbsp;&nbsp;{{item.form}}{{item.hisCode}};</span>
+        </span>
+      </div>
+      <div class="modal-footer">
+        <button class="confirm btns" :disabled="saveDisable" @click="submitForm">确定</button>
+        <button class="cancel btns" @click="closeModal">取消</button>
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+import api from '@api/icss.js';
+import config from '@api/config.js';
+import utils from '@api/utils.js';
+export default {
+  name: 'lt-modal',
+  props: ['modalVisiable', 'meal', 'detail', 'standard', 'type', 'data', 'tip'],
+  data() {
+    return {
+      form: {
+        searchText: '', //搜索字段
+        hisName: '',
+        icdCode: '',
+        hisDetailName: '',
+        formConceptId: '',
+        conceptId: '',
+        form: '',
+        hisCode: '',
+        source: ''
+      },
+      showDrop: false, //下拉框显示文字
+      saveDisable: false, //保存按钮禁止点击
+      uniqueNameList: [],
+      rules: {
+        hisName: [
+          { required: true, message: '请输入' + this.meal, trigger: 'change' },
+          { max: 80, message: this.meal + '最多80字', trigger: 'change' }
+        ],
+        searchText: [
+          { required: true, message: '请选择' + this.meal, trigger: 'change' }
+        ]
+      },
+      isEdit: false,
+      editId: '',
+      drugList: [],
+      tableData: [],
+      mapList: [],
+      getIndex: 6,
+      ty: this.type,
+      searchType: '',
+      title: '添加'
+    };
+  },
+  created() {
+    if (this.type == 1) {
+      this.ty = 2; // 1-化验大项、2-化验小项
+    }
+    //修改
+    if (JSON.stringify(this.data) != '{}') {
+      this.title = '修改';
+      this.isEdit = true;
+      this.editId = this.data.id;
+      this.form.hisName = this.data.hisName;
+      this.form.hisDetailName = this.data.hisDetailName;
+      this.form.searchText = this.data.uniqueName;
+      this.form.icdCode = this.data.code;
+      this.form.conceptId = this.data.conceptId;
+      this.form.formConceptId = this.data.formConceptId;
+      this.form.form = this.data.form;
+      this.form.source = this.data.source;
+      this.form.hisCode = this.data.hisCode;
+      let name;
+      if (
+        this.data.hisName !== '' &&
+        this.data.hisDetailName === '' &&
+        this.type == 1
+      ) {
+        this.ty = 1; // 1-化验大项、2-化验小项
+        this.searchType = 1;
+        name = this.data.hisName;
+      } else if (
+        this.data.hisName !== '' &&
+        this.data.hisDetailName !== '' &&
+        this.type == 1
+      ) {
+        this.ty = 2;
+        this.searchType = 2;
+        name = this.data.hisDetailName;
+      }
+      this.getTermMatching(this.ty, name);
+      this.getRelatedMapping();
+    }
+  },
+  methods: {
+    selectedstyle({ row, rowIndex }) {
+      if (this.getIndex === rowIndex) {
+        return {
+          'background-color': '#EBEEF5',
+          color: '#48C5D7'
+        };
+      }
+    },
+    tableRowClassName({ row, rowIndex }) {
+      row.index = rowIndex;
+    },
+    btn(row) {
+      const { hisName, hisDetailName } = this.form;
+      if (hisName !== '' && hisDetailName === '' && this.type == 1) {
+        this.ty = 1;
+      } else if (hisName !== '' && hisDetailName !== '' && this.type == 1) {
+        this.ty = 2;
+      }
+      console.log(this.ty)
+      this.searchType = this.ty;
+      if (this.getIndex == row.index) {
+        this.getIndex = 6;
+        this.form.searchText = '';
+        this.form.conceptId = '';
+        this.form.icdCode = '';
+        this.form.source = '';
+      } else {
+        this.getIndex = row.index;
+        this.form.searchText = row.name;
+        this.form.conceptId = row.id;
+        this.form.icdCode = row.code;
+        this.form.source = row.source;
+      }
+    },
+    handleChoose(val, id) {
+      this.form.conceptId = id;
+      this.form.searchTextPre = val;
+      this.form.searchText = val;
+    },
+    // 搜索列表
+    searchTerms(query) {
+      if (!query) {
+        this.uniqueNameList = [];
+        return;
+      }
+      const { hisName, hisDetailName } = this.form;
+      if (hisName !== '' && hisDetailName === '' && this.type == 1) {
+        this.ty = 1;
+      } else if (hisName !== '' && hisDetailName !== '' && this.type == 1) {
+        this.ty = 2;
+      }
+      this.searchType = this.ty;
+      this.showDrop = true;
+      let params = {
+        type: this.ty ? this.ty : this.type,
+        inputStr: query,
+        sex: 3,
+        age: 0
+      };
+      api.retrievalSearch(params).then(res => {
+        this.showDrop = false;
+        if (res.data.code === '0') {
+          if (this.ty == 2) {
+            this.uniqueNameList = res.data.data.lisDetailNames;
+          } else {
+            this.uniqueNameList = res.data.data.nameList;
+          }
+        }
+      });
+    },
+    searchDrug(query) {
+      if (!query) {
+        this.drugList = [];
+        return;
+      }
+      this.showDrop = true;
+      let params = {
+        type: 15,
+        inputStr: query,
+        sex: 3,
+        age: 0
+      };
+      api.retrievalSearch(params).then(res => {
+        this.showDrop = false;
+        if (res.data.code === '0') {
+          this.drugList = res.data.data.nameList;
+        }
+      });
+    },
+    onchange() {
+      this.getRelatedMapping();
+    },
+    getRelatedMapping() {
+      const { hisName, hisDetailName } = this.form;
+      let params = {
+        type: this.type,
+        hisDetailName: hisDetailName,
+        hisName: hisName
+      };
+      api.getRelatedMapping(params).then(res => {
+        this.showDrop = false;
+        if (res.data.code === '0') {
+          this.mapList = res.data.data;
+        }
+      });
+    },
+    changeWord(newValue) {
+      this.form.searchText = newValue.name;
+      this.form.icdCode = newValue.code;
+      this.form.conceptId = newValue.id;
+      this.getIndex = 6;
+    },
+    drugchangeWord(newValue) {
+      this.form.formConceptId = newValue.id;
+      this.form.form = newValue.name;
+    },
+    handleVisible(flag) {
+      if (!flag) {
+        this.uniqueNameList = [];
+      }
+    },
+    // 获取焦点
+    handleFocus() {},
+    onblur() {
+      let type, name;
+      if (this.type == 1) {
+        const { hisName, hisDetailName } = this.form;
+        type = 1; // 1-化验大项、2-化验小项
+        name = hisName;
+        if (hisName !== '' && hisDetailName !== '') {
+          type = 2;
+          name = hisDetailName;
+        }
+      }
+      this.getTermMatching(type, name);
+    },
+    clear(){
+      const { hisName, hisDetailName } = this.form;
+      this.getTermMatching(1, hisName);
+    },
+    getTermMatching(type, name) {
+      let params = {
+        type: type ? type : this.type,
+        inputStr: name ? name : this.form.hisName
+      };
+      api.getTermMatching(params).then(res => {
+        this.showDrop = false;
+        if (res.data.code === '0') {
+          this.tableData = res.data.data;
+          this.getIndex = 6;
+        }
+      });
+    },
+    // 建立关联-参数处理
+    submitForm() {
+      this.$refs.relationForm.validate(valid => {
+        if (valid) {
+          const {
+            searchText,
+            hisName,
+            hisDetailName,
+            icdCode,
+            conceptId,
+            formConceptId,
+            source,
+            hisCode
+          } = this.form;
+          // 当标准术语是套餐时,细项必须为空
+          if (this.searchType === 1 && hisDetailName !== '') {
+            this.warning('医院术语与标准术语类型不匹配,请修改');
+            return;
+          }
+
+          // 当标准术语是细项时,医院术语套餐和细项均不能为空
+          if (this.searchType === 2) {
+            if (hisName === '') {
+              this.warning('医院术语与标准术语类型不匹配,请修改');
+              return;
+            } else if (hisDetailName === '') {
+              this.warning('医院术语与标准术语类型不匹配,请修改');
+              return;
+            }
+          }
+          let params = {
+            hisName: hisName,
+            uniqueName: searchText,
+            hisDetailName: hisDetailName,
+            type: this.type,
+            conceptId: conceptId,
+            formConceptId: formConceptId,
+            hisCode: hisCode,
+            source: source ? source : 1
+          };
+          this.showSaveDialog(params);
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    // 建立关联-映射关系是否已存在
+    showSaveDialog(params) {
+      this.saveDisable = true; //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
+      api
+        .diseaseIsExistRecord(params)
+        .then(res => {
+          if (!res.data.data) {
+            // 不存在,创建新的关联
+            // 如果是编辑时,需要携带id
+            if (this.isEdit) {
+              params = { ...params, id: this.editId };
+            }
+            this.saveLisMapping(params, '保存成功', 'success');
+          } else {
+            // 已存在,提示修改
+            this.warning('该条关联已存在,无法添加');
+            this.saveDisable = false;
+          }
+        })
+        .catch(err => {
+          if (err.code === '900010001') {
+            return false;
+          }
+          this.warning(err);
+        });
+    },
+    // 初始化表单数据
+    initForm() {
+      this.form.hisName = '';
+      this.form.searchText = '';
+      this.form.icdCode = '';
+      this.form.hisDetailName = '';
+      this.form.form = '';
+      this.form.conceptId = '';
+      this.form.source = '';
+    },
+    // 映射关系不存在-建立关联
+    saveLisMapping(params, msg, type) {
+      api.saveOrUpdateDiseaseRecord(params).then(res => {
+        if (res.data.code === '0') {
+          this.warning(res.data.msg || msg, type);
+          this.initForm();
+          this.$emit('func', 'updata');
+        } else {
+          this.warning(res.data.msg);
+        }
+        this.saveDisable = false;
+      });
+    },
+    // 关联已存在模态框
+    showConfirmDialog(msg, resolve) {
+      this.$alert(msg, '提示', {
+        // customClass: 'confirmRealation',
+        confirmButtonText: '是',
+        // cancelButtonText: '否',
+        // cancelButtonClass: 'cancelButton',
+        type: 'warning'
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {
+          this.saveDisable = false;
+          this.warning('建立失败', 'error');
+        });
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || 'warning',
+        duration: '1000'
+      });
+    },
+    closeModal() {
+      this.$emit('func', 'close');
+    }
+  }
+};
+</script>
+<style lang="less" scoped>
+.modal-container {
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  z-index: 21;
+  .cover {
+    background: #000;
+    opacity: 0.2;
+    width: 100%;
+    height: 100%;
+  }
+  .modal-box {
+    width: 950px;
+    background: #fff;
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    .modal-title {
+      height: 40px;
+      background: #e3eaf4;
+      .close {
+        float: right;
+        margin: 3px 13px 0 0;
+        font-size: 22px;
+        color: #979797;
+        cursor: pointer;
+      }
+    }
+    .btns {
+      display: inline-block;
+      width: 70px;
+      height: 34px;
+      line-height: 34px;
+      background: #48c5d7;
+      border-radius: 4px;
+      color: #fff;
+      text-align: center;
+      cursor: pointer;
+      outline: none;
+      border: none;
+    }
+    .cancel {
+      background: #fff;
+      color: #48c5d7;
+      border: 1px #48c5d7 solid;
+      margin-left: 40px;
+    }
+    .modal-body {
+      padding: 34px 22px;
+    }
+    .modal-footer {
+      margin-bottom: 60px;
+      width: 100%;
+      text-align: center;
+    }
+  }
+}
+.tab {
+  max-width: 240px;
+  min-width: 240px;
+  //   position: absolute;
+  //   top: 0;
+  z-index: 999;
+  margin-bottom: 15px;
+  margin-top: -18px;
+}
+// .tabs {
+//   max-width: 240px;
+//   min-width: 240px;
+//   position: absolute;
+//   top: 0;
+//   left: 250px;
+// }
+.mapList {
+  padding: 0 20px 20px;
+  font-size: 14px;
+  line-height: 24px;
+  & span {
+    padding: 0 3px;
+  }
+}
+.el-select-dropdown__list,
+.el-select-dropdown__item {
+  width: 219px;
+  cursor: pointer;
+}
+.el-dropdown-menu__item:focus,
+.el-checkbox__input.is-checked + .el-checkbox__label,
+.el-dropdown-menu__item:not(.is-disabled):hover,
+.el-button--text,
+.el-date-table td.today span,
+.el-radio__input.is-checked + .el-radio__label,
+.el-pagination.is-background .el-pager li:not(.disabled):hover,
+.el-select-dropdown__item.selected {
+  font-size: 14px;
+  padding: 0 20px;
+  position: relative;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  color: #606266;
+  height: 34px;
+  line-height: 34px;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+  width: 219px;
+  cursor: pointer;
+}
+/deep/ .el-form-item__error {
+  width: 150px;
+}
+/*********新增编辑***********/
+.topBack {
+  top: 0;
+}
+.titleBox {
+  padding: 0 0 10px 0px;
+}
+/deep/.el-table th {
+  background: #f7f7f7;
+}
+/deep/ .el-table td,
+.el-table th.is-leaf {
+  border-bottom: none;
+}
+.title-l {
+  font-size: 14px;
+  line-height: 40px;
+  margin-left: 10px;
+}
+.title {
+  width: 50%;
+  float: left;
+  font-size: 14px;
+}
+.leftBox,
+.midBox,
+.rightBox {
+  width: 380px;
+  float: left;
+  height: 248px;
+  font-size: 14px;
+}
+.midBox {
+  width: 6%;
+  padding: 50px 0 0 0;
+  text-align: center;
+}
+.midTitle {
+  width: 40px;
+  margin: 0 auto;
+}
+.midLogo {
+  margin: 0 auto;
+}
+.leftBox,
+.rightBox {
+  border: 1px solid #dcdfe6;
+  padding: 20px 10px;
+}
+.rightBox {
+  padding-right: 33px;
+  height: 248px;
+  overflow-y: auto;
+}
+.itemLabel {
+  width: 100%;
+  min-height: 50px;
+  line-height: 50px;
+  position: relative;
+}
+.itemLabelName,
+.searchInput,
+.searchName {
+  float: left;
+  color: #606266;
+}
+.itemLabelName {
+  width: 150px;
+}
+.isRequired::before {
+  content: '*';
+  color: red;
+}
+.searchInput,
+.mealNameItem {
+  padding: 0 5px;
+}
+.searchInput,
+.searchName {
+  display: inline-block;
+  height: 32px;
+  line-height: 32px;
+  border: 1px solid #a9a9a9;
+  margin: 8px 0 0 0;
+}
+
+.searchName {
+  text-align: center;
+  border-left: none;
+  cursor: pointer;
+  padding: 0 12px;
+  font-size: 16px;
+}
+.itemList {
+  position: absolute;
+  background: #fff;
+  width: 162px;
+  max-height: 150px;
+  border: 1px solid #a9a9a9;
+  left: 150px;
+  top: 42px;
+  z-index: 2;
+  overflow-y: auto;
+}
+.itemList {
+  width: calc(100% - 131px);
+}
+.mealNameItem {
+  height: 30px;
+  line-height: 30px;
+  font-size: 14px;
+  cursor: pointer;
+}
+.mealNameItem:hover {
+  background: #f5f7fa;
+}
+.previewInfo {
+  padding-left: 4px;
+  display: inline-block;
+  margin-top: 8px;
+  // width: calc(100% - 160px);s
+  line-height: 24px;
+  overflow: hidden;
+  word-wrap: break-word;
+  word-break: break-all;
+}
+.sumbit {
+  position: absolute;
+  display: inline-block;
+  width: 80px;
+  height: 30px;
+  line-height: 30px;
+  border: 1px solid #a9a9a9;
+  text-align: center;
+  right: 100px;
+}
+.confirmRealation {
+  .cancelButton {
+    border: 1px solid #a9a9a9;
+    span {
+      color: #606266;
+    }
+  }
+}
+</style>

+ 697 - 0
.history/src/components/icss/drug/DrugManage_20211025110249.vue

@@ -0,0 +1,697 @@
+<template>
+  <div>
+    <crumbs title="药品关联维护" style="min-width: 980px" class="knowledgeTitle">
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select size="mini" v-model="filter.status" placeholder="请选择" clearable>
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select size="mini" v-model="filter.formStatus" placeholder="请选择" clearable>
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select size="mini" v-model="filter.match" placeholder="请选择" clearable>
+            <el-option v-for="item in matchList" :label="item.name" :value="item.id" :key="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input size="mini" v-model="filter.hisName" placeholder="请输入" clearable></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule">导入模板下载</el-button>
+          <input type="file" name="uploadfile " id="upFile" @change="uploadFile($event)" />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin:0 10px">{{uploadInfo}}</el-button>
+          <input type="file" name="uploadfile " id="upFileMatch" @change="uploadFileMatch($event)" />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="80"></el-table-column>
+        <el-table-column :resizable="false" prop="gmtModified" label="操作时间" width="180"></el-table-column>
+        <el-table-column :resizable="false" prop="hisName" label="医院药品名称" show-overflow-tooltip></el-table-column>
+        <el-table-column :resizable="false" prop="uniqueName" label="标准药品名称" show-overflow-tooltip></el-table-column>
+        <el-table-column :resizable="false" prop="form" label="药品剂型" show-overflow-tooltip></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span
+              v-if="scope.row.uniqueName && scope.row.uniqueName!=''"
+            >{{scope.row.status == 0?'禁用':'启用'}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span
+              v-if="scope.row.form && scope.row.form!=''"
+            >{{scope.row.formStatus == 0?'禁用':'启用'}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
+            <span style="margin:0 3px;">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+            >删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from '@api/icss.js';
+import config from '@api/config.js';
+import utils from '@api/utils.js';
+import LtModal from '@components/common/LtModal';
+export default {
+  name: 'DrugManage', //化验大小项和公表维护
+  data: function() {
+    return {
+      list: [],
+      matchList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '已匹配' },
+        { id: 0, name: '未匹配' },
+        { id: 2, name: '多项匹配' }
+      ],
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
+      formstatusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
+      searched: false,
+      filter: {
+        hisName: '', // 医院诊断名称
+        uniqueName: '', //标准诊断名称
+        match: '',
+        status: '',
+        formStatus: ''
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: '导入',
+      modalVisiable: false,
+      data: {}
+    };
+  },
+  components: {
+    LtModal
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function() {
+        this.searched = false;
+      },
+      deep: true
+    }
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById('upFileMatch');
+      inp.click();
+    },
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
+      if (extend != 'xls' && extend != 'xlsx') {
+        this.$message({ message: '请根据模板进行导入', type: 'error' });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append('file', fileInfo);
+      formData.append('type', 5);
+      const header = {
+        headers: {
+          'Content-Type': 'multipart/form-data'
+        }
+      };
+      const loading = this.$loading({
+        lock: true,
+        text: '预匹配中...',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      api.dataDiseaseVerify(formData, header).then(res => {
+        if (res.data.code === '00020007' || res.data.code === '00020004') {
+          loading.close();
+          this.$alert(`${res.data.msg}`, '提示', {
+            confirmButtonText: '确定',
+            type: 'warning'
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then(res => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                '药品关联数据(预匹配).xls'
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById('upFileMatch');
+      inp.value = '';
+    },
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      api.getDrugPage(params).then(res => {
+        loading.close();
+        if (res.data.code === '0') {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: '',
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: '',
+        uniqueName: ''
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || 'warning'
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, '提示', {
+        confirmButtonText: '删除',
+        cancelButtonText: '取消',
+        cancelButtonClass: 'cancelBtn',
+        confirmButtonClass: 'confirmC',
+        type: 'warning'
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog('是否删除该关联?', () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then(res => {
+            if (res.data.code == '0') {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || '操作成功', 'success');
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch(error => {
+            if (error.code === '900010001') {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm('确定要导出全部药品关联数据吗?', '', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        cancelButtonClass: 'leftbtn',
+        customClass: 'exportBox6',
+        title: '提示',
+        type: 'warning'
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then(res => {
+              if (res.status === 200) {
+                this.$message({ message: '导出成功', type: 'success' });
+                utils.downloadExportedData(res.data, '药品关联数据.xls');
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then(res => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, '药品导入模板.xls');
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById('upFile');
+      inp.click();
+    },
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
+      if (extend != 'xls' && extend != 'xlsx') {
+        this.$message({ message: '请根据模板进行导入', type: 'error' });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append('file', fileInfo);
+      formData.append('type', 5);
+      formData.append('uesrId', localStorage.getItem('uesrId'));
+      formData.append(
+        'hospitalId',
+        JSON.parse(localStorage.getItem('hospitalLoginDTO')).id
+      );
+      const header = {
+        headers: {
+          'Content-Type': 'multipart/form-data'
+        }
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById('upFile');
+      inp.value = '';
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then(res => {
+        if (res.headers['content-disposition']) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function() {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === '00020004' || code.code === '00020007') {
+                that
+                  .$alert(`${code.msg}`, '提示', {
+                    confirmButtonText: '确定',
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: 'warning'
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, '提示', {
+                confirmButtonText: '确定',
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: 'success'
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers['content-disposition'];
+      var fileName = decodeURI(
+        disposition.split('filename=')[1].split(';filename*=')[0]
+      );
+      let blob = new Blob([res.data], { type: 'application/.xls' }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement('a');
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == 'close') {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    }
+  }
+};
+</script>
+
+
+<style lang="less" scoped>
+@import '../../../less/admin.less';
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 779 - 0
.history/src/components/icss/drug/DrugManage_20211025115027.vue

@@ -0,0 +1,779 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 780 - 0
.history/src/components/icss/drug/DrugManage_20211025132654.vue

@@ -0,0 +1,780 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+          console.log('药品关联维护数据: ', this.list);
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 779 - 0
.history/src/components/icss/drug/DrugManage_20211025132737.vue

@@ -0,0 +1,779 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 781 - 0
.history/src/components/icss/drug/DrugManage_20211025133628.vue

@@ -0,0 +1,781 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+    
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 782 - 0
.history/src/components/icss/drug/DrugManage_20211025133828.vue

@@ -0,0 +1,782 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+    
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 783 - 0
.history/src/components/icss/drug/DrugManage_20211025135948.vue

@@ -0,0 +1,783 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+    
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 783 - 0
.history/src/components/icss/drug/DrugManage_20211025140712.vue

@@ -0,0 +1,783 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault(); // 阻止默认行为
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 784 - 0
.history/src/components/icss/drug/DrugManage_20211025141022.vue

@@ -0,0 +1,784 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFile(e) {
+      console.log('导入数据 ', e);
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault(); // 阻止默认行为
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 783 - 0
.history/src/components/icss/drug/DrugManage_20211025141110.vue

@@ -0,0 +1,783 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault(); // 阻止默认行为
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 784 - 0
.history/src/components/icss/drug/DrugManage_20211025144240.vue

@@ -0,0 +1,784 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault(); // 阻止默认行为
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 786 - 0
.history/src/components/icss/drug/DrugManage_20211025144253.vue

@@ -0,0 +1,786 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+
+      // 导入数据接口
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault(); // 阻止默认行为
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 787 - 0
.history/src/components/icss/drug/DrugManage_20211025145347.vue

@@ -0,0 +1,787 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true, // 为true时  表示深度监听 这时候就能监听到filter中的值
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+
+      // 导入数据接口
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault(); // 阻止默认行为
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 787 - 0
.history/src/components/icss/drug/DrugManage_20211025145419.vue

@@ -0,0 +1,787 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true, // watch中的高级用法 为true时  表示深度监听 这时候就能监听到filter中的值
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+
+      // 导入数据接口
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault(); // 阻止默认行为
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 789 - 0
.history/src/components/icss/drug/DrugManage_20211025145741.vue

@@ -0,0 +1,789 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true, // watch中的高级用法 为true时  表示深度监听 这时候就能监听到filter中的值
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+
+      // 导入数据接口
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+
+    // 点击添加关联
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal();
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault(); // 阻止默认行为
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 789 - 0
.history/src/components/icss/drug/DrugManage_20211025145954.vue

@@ -0,0 +1,789 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true, // watch中的高级用法 为true时  表示深度监听 这时候就能监听到filter中的值
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+
+      // 导入数据接口
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+
+    // 点击添加关联
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal(); // 控制弹出框的显示隐藏
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault(); // 阻止默认行为
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 789 - 0
.history/src/components/icss/drug/DrugManage_20211025151926.vue

@@ -0,0 +1,789 @@
+<template>
+  <div>
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item class="selectMedicine" label="标准术语状态:">
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in statusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="剂型术语状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in formstatusList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="匹配状态:" class="selectMedicine">
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="医院药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <el-form class="secLine" :inline="true">
+        <el-form-item>
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
+          <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
+          <el-button size="mini" @click="handleMatchData">预匹配</el-button>
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
+          <el-button size="mini" @click="exportData">导出</el-button>
+        </el-form-item>
+        <el-form-item label="标准药品名称:">
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">检索</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="标准术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="匹配状态">
+          <template slot-scope="scope">
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column :resizable="false" prop="operate" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
+            <el-button
+              @click="showDelDialog(scope.row.id)"
+              class="delete"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination pagepage">
+        <el-pagination
+          :current-page.sync="currentPage"
+          @current-change="currentChange"
+          background
+          :page-size="pageSize"
+          :page-sizes="pageSizeArr"
+          @size-change="handleSizeChange"
+          :layout="pageLayout"
+          :total="total"
+        ></el-pagination>
+      </div>
+    </div>
+    <LtModal
+      v-if="modalVisiable"
+      @func="getMsgFormSon"
+      :meal="'药品名称'"
+      :standard="'药品名称'"
+      :tip="'药品关联'"
+      :type="5"
+      :data="data"
+    ></LtModal>
+  </div>
+</template>
+
+<script>
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
+export default {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
+    return {
+      list: [],
+      matchList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
+      ],
+      statusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      formstatusList: [
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
+      ],
+      searched: false,
+      filter: {
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
+      },
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      uploadInfo: "导入",
+      modalVisiable: false,
+      data: {},
+    };
+  },
+  components: {
+    LtModal,
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+    }
+    if (param.filter) {
+      this.filter = param.filter;
+    }
+    //返回时避免参数未赋值就获取列表
+    setTimeout(() => {
+      this.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function () {
+        this.searched = false;
+      },
+      deep: true, // watch中的高级用法 为true时  表示深度监听 这时候就能监听到filter中的值
+    },
+  },
+  methods: {
+    // 预匹配
+    handleMatchData() {
+      let inp = document.getElementById("upFileMatch");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFileMatch(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault();
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+
+      // 导入数据接口
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
+          loading.close();
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
+          })
+            .then(() => {})
+            .catch(() => {});
+        } else {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
+            setTimeout(() => {
+              loading.close();
+            }, 800);
+            if (res.status === 200) {
+              utils.downloadExportedData(
+                res.data,
+                "药品关联数据(预匹配).xls"
+              );
+            }
+          });
+        }
+      });
+
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+
+    // 获取列表数据
+    getDataList(isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      // 加载动画效果
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      api.getDrugPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === "0") {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
+    },
+
+    // 处理列表请求数据参数
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        hisName: this.filter.hisName.trim(),
+        uniqueName: this.filter.uniqueName.trim(),
+        uniqueCode: "",
+        type: 5,
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus,
+      };
+      return param;
+    },
+
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList();
+    },
+
+    // 点击添加关联
+    addRelation() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+
+      this.data = {};
+      this.showModal(); // 控制弹出框的显示隐藏
+      // this.$router.push({ name: 'AddDrug', params: pam });
+    },
+    // 修改诊断关联-跳转至编辑页面
+    modifyRelation(row) {
+      const item = Object.assign({}, row);
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter,
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      // this.$router.push({
+      //   name: 'AddDrug',
+      //   params: Object.assign(pam, { isEdit: true, data: item })
+      // });
+      this.data = item;
+      this.showModal();
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      this.getDataList(true);
+      // if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+      //     this.list = this.cacheData[next];
+      // } else {
+      //     this.getDataList();
+      // }
+    },
+
+    // 清空搜索参数
+    clearFilter() {
+      this.filter = {
+        hisName: "",
+        uniqueName: "",
+      };
+    },
+
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    getTagType(val) {
+      return val;
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning",
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    // 删除关联
+    showDelDialog(id) {
+      this.showConfirmDialog("是否删除该关联?", () => {
+        api
+          .deleteDrugRecord({ id: id })
+          .then((res) => {
+            if (res.data.code == "0") {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (this.list.length == 1) {
+                //当前在最后一页且只有一条数据时,删除后跳到前一页
+                this.currentPage =
+                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+              }
+              this.getDataList();
+              this.warning(res.data.msg || "操作成功", "success");
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch((error) => {
+            if (error.code === "900010001") {
+              return false;
+            }
+            this.warning(error);
+          });
+      });
+    },
+
+    // 导出数据
+    exportData() {
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
+        // beforeClose: (action, instance, done) => {
+        //   if (action === 'confirm') {
+        //     // instance.confirmButtonLoading = true;
+        //     instance.confirmButtonText = '导出中...';
+        //     api.exportDrugRecord().then(res => {
+        //       if (res.status === 200) {
+        //         setTimeout(() => {
+        //           utils.downloadExportedData(res.data, '药品关联数据.xls');
+        //           done();
+        //         }, 1500);
+        //       }
+        //     });
+        //   } else {
+        //     done();
+        //   }
+        // }
+      })
+        .then(() => {
+          api
+            .exportDrugRecord({ type: 5, isMatch: this.filter.match })
+            .then((res) => {
+              if (res.status === 200) {
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
+              }
+            });
+        })
+        .catch(() => {
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+
+    // 导入模板
+    exportModule() {
+      api.exportDrugModule({ type: 5 }).then((res) => {
+        if (res.status === 200) {
+          setTimeout(() => {
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
+          }, 1500);
+        }
+      });
+    },
+
+    // 点击导入
+    importPage() {
+      let inp = document.getElementById("upFile");
+      inp.click();
+    },
+
+    // 导入数据
+    uploadFile(e) {
+      let fileInfo = e.target.files[0];
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
+        return;
+      }
+      e.preventDefault(); // 阻止默认行为
+      let formData = new FormData();
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
+      formData.append(
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
+      );
+      const header = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+        },
+      };
+      this.importDrugRecord(formData, header);
+      // this.uploadInfo = '导入中...';
+      // api.importExcelDataVerify(formData, header).then(res => {
+      //   if (res.data.code === '00020001') {
+      //     this.$confirm(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {
+      //         this.importDrugRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDrugRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
+
+      //解决上传相同文件不触发change
+      let inp = document.getElementById("upFile");
+      inp.value = "";
+    },
+    importDrugRecord(formData, header) {
+      let that = this;
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
+          this.downloadUrl(res);
+          this.getDataList();
+        } else {
+          let r = new FileReader();
+          r.onload = function () {
+            if (this.result) {
+              const code = JSON.parse(this.result);
+              if (code.code === "00020004" || code.code === "00020007") {
+                that
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
+                    // cancelButtonText: '取消',
+                    // cancelButtonClass: 'cancelSure',
+                    // confirmButtonClass: 'sure',
+                    // customClass: 'exportConfirm',
+                    type: "warning",
+                  })
+                  .then(() => {})
+                  .catch(() => {});
+              }
+            } else {
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
+                // cancelButtonText: '取消',
+                // cancelButtonClass: 'cancelSure',
+                // confirmButtonClass: 'sure',
+                // customClass: 'exportConfirm',
+                type: "success",
+              });
+              that.getDataList();
+            }
+          };
+          r.readAsText(res.data);
+        }
+        // if (res.data.code === '00000001') {
+        //   this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else if (res.data.data === true && res.status === 200) {
+        //   this.$confirm(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$confirm(`${res.data.msg}`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     cancelButtonClass: 'cancelSure',
+        //     confirmButtonClass: 'sure',
+        //     customClass: 'exportConfirm',
+        //     type: 'warning'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // }
+      });
+    },
+    downloadUrl(res) {
+      var disposition = res.headers["content-disposition"];
+      var fileName = decodeURI(
+        disposition.split("filename=")[1].split(";filename*=")[0]
+      );
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(blob);
+      link.download = fileName;
+      link.click();
+      link.remove();
+    },
+    /********新增编辑弹窗**********/
+    showModal() {
+      this.modalVisiable = true;
+    },
+    getMsgFormSon(data) {
+      if (data == "close") {
+        this.modalVisiable = false;
+      } else {
+        this.modalVisiable = false;
+        this.getDataList();
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scoped>
+@import "../../../less/admin.less";
+/deep/ .container.knowledgeTitle {
+  height: 80px;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 104px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -5px;
+}
+.delete {
+  color: red;
+}
+.delete:hover {
+  color: red;
+}
+.pagination {
+  min-width: 1010px;
+}
+.downTemplate {
+  margin-right: 8px;
+  span {
+    color: #02a7f0;
+  }
+}
+#upFile {
+  display: none !important;
+}
+.el-message-box {
+  /deep/.cancelBtn {
+    background-color: #d7d7d7;
+    border-color: transparent;
+  }
+  /deep/.confirmC {
+    background-color: #ff545b !important;
+    border-color: transparent !important;
+  }
+}
+.exportBox6 {
+  /deep/ .el-message-box__btns {
+    margin-top: 20px;
+  }
+  /deep/ .el-message-box__message {
+    // text-align: center;
+  }
+  /deep/.leftbtn {
+    background-color: #d7d7d7;
+    border-color: transparent !important;
+  }
+  /deep/ .el-message-box__header {
+    border-bottom: 1px solid #dcdfe6;
+  }
+}
+#upFileMatch {
+  display: none;
+}
+</style>

+ 3 - 0
src/components/common/LtModal.vue

@@ -19,6 +19,7 @@
               <p class="title">医院术语</p>
               <p class="title">标准术语</p>
             </div>
+            <!-- 左边框中的内容 -->
             <div class="leftBox clearfix">
               <el-row>
                 <el-col :span="16">
@@ -55,10 +56,12 @@
                 </el-col>
               </el-row>
             </div>
+            <!-- 相互关联图标 -->
             <div class="midBox">
               <img class="midLogo" src="../../images/relation.png" alt />
               <p class="midTitle">相互关联</p>
             </div>
+            <!-- 右边框中的内容 -->
             <div class="rightBox">
               <el-row>
                 <el-col :span="16">

+ 235 - 143
src/components/icss/drug/DrugManage.vue

@@ -1,9 +1,18 @@
 <template>
   <div>
-    <crumbs title="药品关联维护" style="min-width: 980px" class="knowledgeTitle">
+    <crumbs
+      title="药品关联维护"
+      style="min-width: 980px"
+      class="knowledgeTitle"
+    >
       <el-form :inline="true" class="demo-form-inline">
         <el-form-item class="selectMedicine" label="标准术语状态:">
-          <el-select size="mini" v-model="filter.status" placeholder="请选择" clearable>
+          <el-select
+            size="mini"
+            v-model="filter.status"
+            placeholder="请选择"
+            clearable
+          >
             <el-option
               v-for="item in statusList"
               :label="item.name"
@@ -13,7 +22,12 @@
           </el-select>
         </el-form-item>
         <el-form-item label="剂型术语状态:" class="selectMedicine">
-          <el-select size="mini" v-model="filter.formStatus" placeholder="请选择" clearable>
+          <el-select
+            size="mini"
+            v-model="filter.formStatus"
+            placeholder="请选择"
+            clearable
+          >
             <el-option
               v-for="item in formstatusList"
               :label="item.name"
@@ -23,69 +37,137 @@
           </el-select>
         </el-form-item>
         <el-form-item label="匹配状态:" class="selectMedicine">
-          <el-select size="mini" v-model="filter.match" placeholder="请选择" clearable>
-            <el-option v-for="item in matchList" :label="item.name" :value="item.id" :key="item.id"></el-option>
+          <el-select
+            size="mini"
+            v-model="filter.match"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in matchList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="医院药品名称:">
-          <el-input size="mini" v-model="filter.hisName" placeholder="请输入" clearable></el-input>
+          <el-input
+            size="mini"
+            v-model="filter.hisName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
         </el-form-item>
       </el-form>
       <el-form class="secLine" :inline="true">
         <el-form-item>
-          <el-button type="text" class="downTemplate" @click="exportModule">导入模板下载</el-button>
-          <input type="file" name="uploadfile " id="upFile" @change="uploadFile($event)" />
+          <el-button type="text" class="downTemplate" @click="exportModule"
+            >导入模板下载</el-button
+          >
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFile"
+            @change="uploadFile($event)"
+          />
           <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
           <el-button size="mini" @click="handleMatchData">预匹配</el-button>
-          <el-button size="mini" @click="importPage" style="margin:0 10px">{{uploadInfo}}</el-button>
-          <input type="file" name="uploadfile " id="upFileMatch" @change="uploadFileMatch($event)" />
+          <el-button size="mini" @click="importPage" style="margin: 0 10px">{{
+            uploadInfo
+          }}</el-button>
+          <input
+            type="file"
+            name="uploadfile "
+            id="upFileMatch"
+            @change="uploadFileMatch($event)"
+          />
           <el-button size="mini" @click="exportData">导出</el-button>
         </el-form-item>
         <el-form-item label="标准药品名称:">
-          <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
+          <el-input
+            size="mini"
+            v-model="filter.uniqueName"
+            placeholder="请输入"
+            clearable
+          ></el-input>
         </el-form-item>
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
-          <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
+          <el-button size="mini" type="warning" @click="addRelation"
+            >添加关联</el-button
+          >
         </el-form-item>
       </el-form>
     </crumbs>
     <div class="contents knowledgeContents">
       <el-table :data="list" border style="width: 100%">
-        <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="80"></el-table-column>
-        <el-table-column :resizable="false" prop="gmtModified" label="操作时间" width="180"></el-table-column>
-        <el-table-column :resizable="false" prop="hisName" label="医院药品名称" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="标准药品名称" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="form" label="药品剂型" show-overflow-tooltip></el-table-column>
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="操作时间"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="hisName"
+          label="医院药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="标准药品名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="form"
+          label="药品剂型"
+          show-overflow-tooltip
+        ></el-table-column>
         <el-table-column :resizable="false" prop="operate" label="标准术语状态">
           <template slot-scope="scope">
-            <span
-              v-if="scope.row.uniqueName && scope.row.uniqueName!=''"
-            >{{scope.row.status == 0?'禁用':'启用'}}</span>
+            <span v-if="scope.row.uniqueName && scope.row.uniqueName != ''">{{
+              scope.row.status == 0 ? "禁用" : "启用"
+            }}</span>
           </template>
         </el-table-column>
         <el-table-column :resizable="false" prop="operate" label="剂型术语状态">
           <template slot-scope="scope">
-            <span
-              v-if="scope.row.form && scope.row.form!=''"
-            >{{scope.row.formStatus == 0?'禁用':'启用'}}</span>
+            <span v-if="scope.row.form && scope.row.form != ''">{{
+              scope.row.formStatus == 0 ? "禁用" : "启用"
+            }}</span>
           </template>
         </el-table-column>
         <el-table-column :resizable="false" prop="operate" label="匹配状态">
           <template slot-scope="scope">
-            <span>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
+            <span>{{ scope.row.isMatch == 0 ? "未匹配" : "已匹配" }}</span>
           </template>
         </el-table-column>
         <el-table-column :resizable="false" prop="operate" label="操作">
           <template slot-scope="scope">
-            <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
-            <span style="margin:0 3px;">|</span>
+            <el-button
+              @click="modifyRelation(scope.row)"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <span style="margin: 0 3px">|</span>
             <el-button
               @click="showDelDialog(scope.row.id)"
               class="delete"
               type="text"
               size="small"
-            >删除</el-button>
+              >删除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -115,51 +197,51 @@
 </template>
 
 <script>
-import api from '@api/icss.js';
-import config from '@api/config.js';
-import utils from '@api/utils.js';
-import LtModal from '@components/common/LtModal';
+import api from "@api/icss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
+import LtModal from "@components/common/LtModal";
 export default {
-  name: 'DrugManage', //化验大小项和公表维护
-  data: function() {
+  name: "DrugManage", //化验大小项和公表维护
+  data: function () {
     return {
       list: [],
       matchList: [
-        { id: '', name: '全部' },
-        { id: 1, name: '已匹配' },
-        { id: 0, name: '未匹配' },
-        { id: 2, name: '多项匹配' }
+        { id: "", name: "全部" },
+        { id: 1, name: "已匹配" },
+        { id: 0, name: "未匹配" },
+        { id: 2, name: "多项匹配" },
       ],
       statusList: [
-        { id: '', name: '全部' },
-        { id: 1, name: '启用' },
-        { id: 0, name: '禁用' }
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
       ],
       formstatusList: [
-        { id: '', name: '全部' },
-        { id: 1, name: '启用' },
-        { id: 0, name: '禁用' }
+        { id: "", name: "全部" },
+        { id: 1, name: "启用" },
+        { id: 0, name: "禁用" },
       ],
       searched: false,
       filter: {
-        hisName: '', // 医院诊断名称
-        uniqueName: '', //标准诊断名称
-        match: '',
-        status: '',
-        formStatus: ''
+        hisName: "", // 医院诊断名称
+        uniqueName: "", //标准诊断名称
+        match: "",
+        status: "",
+        formStatus: "",
       },
       currentPage: 1,
       pageSize: config.pageSize,
       pageSizeArr: config.pageSizeArr,
       pageLayout: config.pageLayout,
       total: 0,
-      uploadInfo: '导入',
+      uploadInfo: "导入",
       modalVisiable: false,
-      data: {}
+      data: {},
     };
   },
   components: {
-    LtModal
+    LtModal,
   },
   created() {
     const param = this.$route.params;
@@ -176,68 +258,73 @@ export default {
   },
   watch: {
     filter: {
-      handler: function() {
+      handler: function () {
         this.searched = false;
       },
-      deep: true
-    }
+      deep: true, // watch中的高级用法 为true时  表示深度监听 这时候就能监听到filter中的值
+    },
   },
   methods: {
     // 预匹配
     handleMatchData() {
-      let inp = document.getElementById('upFileMatch');
+      let inp = document.getElementById("upFileMatch");
       inp.click();
     },
+
     // 导入数据
     uploadFileMatch(e) {
       let fileInfo = e.target.files[0];
-      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
-      if (extend != 'xls' && extend != 'xlsx') {
-        this.$message({ message: '请根据模板进行导入', type: 'error' });
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
         return;
       }
       e.preventDefault();
       let formData = new FormData();
-      formData.append('file', fileInfo);
-      formData.append('type', 5);
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
       const header = {
         headers: {
-          'Content-Type': 'multipart/form-data'
-        }
+          "Content-Type": "multipart/form-data",
+        },
       };
+      // 加载动画效果
       const loading = this.$loading({
         lock: true,
-        text: '预匹配中...',
-        spinner: 'el-icon-loading',
-        background: 'rgba(0, 0, 0, 0.7)'
+        text: "预匹配中...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
       });
-      api.dataDiseaseVerify(formData, header).then(res => {
-        if (res.data.code === '00020007' || res.data.code === '00020004') {
+
+      // 导入数据接口
+      api.dataDiseaseVerify(formData, header).then((res) => {
+        if (res.data.code === "00020007" || res.data.code === "00020004") {
           loading.close();
-          this.$alert(`${res.data.msg}`, '提示', {
-            confirmButtonText: '确定',
-            type: 'warning'
+          this.$alert(`${res.data.msg}`, "提示", {
+            confirmButtonText: "确定",
+            type: "warning",
           })
             .then(() => {})
             .catch(() => {});
         } else {
-          api.precDiseaseDataMatch(formData, header).then(res => {
+          api.precDiseaseDataMatch(formData, header).then((res) => {
             setTimeout(() => {
               loading.close();
             }, 800);
             if (res.status === 200) {
               utils.downloadExportedData(
                 res.data,
-                '药品关联数据(预匹配).xls'
+                "药品关联数据(预匹配).xls"
               );
             }
           });
         }
       });
 
-      let inp = document.getElementById('upFileMatch');
-      inp.value = '';
+      let inp = document.getElementById("upFileMatch");
+      inp.value = "";
     },
+
     handleSizeChange(val) {
       this.pageSize = val;
       this.currentPage = utils.getCurrentPage(
@@ -252,15 +339,16 @@ export default {
     getDataList(isTurnPage) {
       const params = this.getFilterItems(isTurnPage);
       this.searched = true;
+      // 加载动画效果
       const loading = this.$loading({
         lock: true,
-        text: 'Loading',
-        spinner: 'el-icon-loading',
-        background: 'rgba(0, 0, 0, 0.7)'
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
       });
-      api.getDrugPage(params).then(res => {
+      api.getDrugPage(params).then((res) => {
         loading.close();
-        if (res.data.code === '0') {
+        if (res.data.code === "0") {
           this.list = res.data.data && res.data.data.records;
         }
         this.total = res.data.data && res.data.data.total;
@@ -282,11 +370,11 @@ export default {
         size: this.pageSize,
         hisName: this.filter.hisName.trim(),
         uniqueName: this.filter.uniqueName.trim(),
-        uniqueCode: '',
+        uniqueCode: "",
         type: 5,
         isMatch: this.filter.match,
         status: this.filter.status,
-        formStatus: this.filter.formStatus
+        formStatus: this.filter.formStatus,
       };
       return param;
     },
@@ -295,17 +383,19 @@ export default {
       this.currentPage = 1;
       this.getDataList();
     },
+
+    // 点击添加关联
     addRelation() {
       const pam = this.searched
         ? {
             currentPage: this.currentPage,
             pageSize: this.pageSize,
-            filter: this.filter
+            filter: this.filter,
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
 
       this.data = {};
-      this.showModal();
+      this.showModal(); // 控制弹出框的显示隐藏
       // this.$router.push({ name: 'AddDrug', params: pam });
     },
     // 修改诊断关联-跳转至编辑页面
@@ -315,7 +405,7 @@ export default {
         ? {
             currentPage: this.currentPage,
             pageSize: this.pageSize,
-            filter: this.filter
+            filter: this.filter,
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
       // this.$router.push({
@@ -334,11 +424,12 @@ export default {
       //     this.getDataList();
       // }
     },
+
     // 清空搜索参数
     clearFilter() {
       this.filter = {
-        hisName: '',
-        uniqueName: ''
+        hisName: "",
+        uniqueName: "",
       };
     },
 
@@ -352,16 +443,16 @@ export default {
       this.$message({
         showClose: true,
         message: msg,
-        type: type || 'warning'
+        type: type || "warning",
       });
     },
     showConfirmDialog(msg, resolve) {
-      this.$confirm(msg, '提示', {
-        confirmButtonText: '删除',
-        cancelButtonText: '取消',
-        cancelButtonClass: 'cancelBtn',
-        confirmButtonClass: 'confirmC',
-        type: 'warning'
+      this.$confirm(msg, "提示", {
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+        cancelButtonClass: "cancelBtn",
+        confirmButtonClass: "confirmC",
+        type: "warning",
       })
         .then(() => {
           resolve();
@@ -370,11 +461,11 @@ export default {
     },
     // 删除关联
     showDelDialog(id) {
-      this.showConfirmDialog('是否删除该关联?', () => {
+      this.showConfirmDialog("是否删除该关联?", () => {
         api
           .deleteDrugRecord({ id: id })
-          .then(res => {
-            if (res.data.code == '0') {
+          .then((res) => {
+            if (res.data.code == "0") {
               if (!this.searched) {
                 //未点确认时清空搜索条件
                 this.clearFilter();
@@ -385,13 +476,13 @@ export default {
                   this.currentPage === 1 ? 1 : this.currentPage - 1;
               }
               this.getDataList();
-              this.warning(res.data.msg || '操作成功', 'success');
+              this.warning(res.data.msg || "操作成功", "success");
             } else {
               this.warning(res.data.msg);
             }
           })
-          .catch(error => {
-            if (error.code === '900010001') {
+          .catch((error) => {
+            if (error.code === "900010001") {
               return false;
             }
             this.warning(error);
@@ -401,13 +492,13 @@ export default {
 
     // 导出数据
     exportData() {
-      this.$confirm('确定要导出全部药品关联数据吗?', '', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        cancelButtonClass: 'leftbtn',
-        customClass: 'exportBox6',
-        title: '提示',
-        type: 'warning'
+      this.$confirm("确定要导出全部药品关联数据吗?", "", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        cancelButtonClass: "leftbtn",
+        customClass: "exportBox6",
+        title: "提示",
+        type: "warning",
         // beforeClose: (action, instance, done) => {
         //   if (action === 'confirm') {
         //     // instance.confirmButtonLoading = true;
@@ -428,10 +519,10 @@ export default {
         .then(() => {
           api
             .exportDrugRecord({ type: 5, isMatch: this.filter.match })
-            .then(res => {
+            .then((res) => {
               if (res.status === 200) {
-                this.$message({ message: '导出成功', type: 'success' });
-                utils.downloadExportedData(res.data, '药品关联数据.xls');
+                this.$message({ message: "导出成功", type: "success" });
+                utils.downloadExportedData(res.data, "药品关联数据.xls");
               }
             });
         })
@@ -442,10 +533,10 @@ export default {
 
     // 导入模板
     exportModule() {
-      api.exportDrugModule({ type: 5 }).then(res => {
+      api.exportDrugModule({ type: 5 }).then((res) => {
         if (res.status === 200) {
           setTimeout(() => {
-            utils.downloadExportedData(res.data, '药品导入模板.xls');
+            utils.downloadExportedData(res.data, "药品导入模板.xls");
           }, 1500);
         }
       });
@@ -453,30 +544,31 @@ export default {
 
     // 点击导入
     importPage() {
-      let inp = document.getElementById('upFile');
+      let inp = document.getElementById("upFile");
       inp.click();
     },
+
     // 导入数据
     uploadFile(e) {
       let fileInfo = e.target.files[0];
-      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
-      if (extend != 'xls' && extend != 'xlsx') {
-        this.$message({ message: '请根据模板进行导入', type: 'error' });
+      let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf(".") + 1);
+      if (extend != "xls" && extend != "xlsx") {
+        this.$message({ message: "请根据模板进行导入", type: "error" });
         return;
       }
-      e.preventDefault();
+      e.preventDefault(); // 阻止默认行为
       let formData = new FormData();
-      formData.append('file', fileInfo);
-      formData.append('type', 5);
-      formData.append('uesrId', localStorage.getItem('uesrId'));
+      formData.append("file", fileInfo);
+      formData.append("type", 5);
+      formData.append("uesrId", localStorage.getItem("uesrId"));
       formData.append(
-        'hospitalId',
-        JSON.parse(localStorage.getItem('hospitalLoginDTO')).id
+        "hospitalId",
+        JSON.parse(localStorage.getItem("hospitalLoginDTO")).id
       );
       const header = {
         headers: {
-          'Content-Type': 'multipart/form-data'
-        }
+          "Content-Type": "multipart/form-data",
+        },
       };
       this.importDrugRecord(formData, header);
       // this.uploadInfo = '导入中...';
@@ -516,41 +608,41 @@ export default {
       // });
 
       //解决上传相同文件不触发change
-      let inp = document.getElementById('upFile');
-      inp.value = '';
+      let inp = document.getElementById("upFile");
+      inp.value = "";
     },
     importDrugRecord(formData, header) {
       let that = this;
-      api.importDrugRecord(formData, header).then(res => {
-        if (res.headers['content-disposition']) {
+      api.importDrugRecord(formData, header).then((res) => {
+        if (res.headers["content-disposition"]) {
           this.downloadUrl(res);
           this.getDataList();
         } else {
           let r = new FileReader();
-          r.onload = function() {
+          r.onload = function () {
             if (this.result) {
               const code = JSON.parse(this.result);
-              if (code.code === '00020004' || code.code === '00020007') {
+              if (code.code === "00020004" || code.code === "00020007") {
                 that
-                  .$alert(`${code.msg}`, '提示', {
-                    confirmButtonText: '确定',
+                  .$alert(`${code.msg}`, "提示", {
+                    confirmButtonText: "确定",
                     // cancelButtonText: '取消',
                     // cancelButtonClass: 'cancelSure',
                     // confirmButtonClass: 'sure',
                     // customClass: 'exportConfirm',
-                    type: 'warning'
+                    type: "warning",
                   })
                   .then(() => {})
                   .catch(() => {});
               }
             } else {
-              that.$alert(`导入成功`, '提示', {
-                confirmButtonText: '确定',
+              that.$alert(`导入成功`, "提示", {
+                confirmButtonText: "确定",
                 // cancelButtonText: '取消',
                 // cancelButtonClass: 'cancelSure',
                 // confirmButtonClass: 'sure',
                 // customClass: 'exportConfirm',
-                type: 'success'
+                type: "success",
               });
               that.getDataList();
             }
@@ -606,12 +698,12 @@ export default {
       });
     },
     downloadUrl(res) {
-      var disposition = res.headers['content-disposition'];
+      var disposition = res.headers["content-disposition"];
       var fileName = decodeURI(
-        disposition.split('filename=')[1].split(';filename*=')[0]
+        disposition.split("filename=")[1].split(";filename*=")[0]
       );
-      let blob = new Blob([res.data], { type: 'application/.xls' }); //.xls是我和后台约定好的文件格式
-      let link = document.createElement('a');
+      let blob = new Blob([res.data], { type: "application/.xls" }); //.xls是我和后台约定好的文件格式
+      let link = document.createElement("a");
       link.href = window.URL.createObjectURL(blob);
       link.download = fileName;
       link.click();
@@ -622,20 +714,20 @@ export default {
       this.modalVisiable = true;
     },
     getMsgFormSon(data) {
-      if (data == 'close') {
+      if (data == "close") {
         this.modalVisiable = false;
       } else {
         this.modalVisiable = false;
         this.getDataList();
       }
-    }
-  }
+    },
+  },
 };
 </script>
 
 
 <style lang="less" scoped>
-@import '../../../less/admin.less';
+@import "../../../less/admin.less";
 /deep/ .container.knowledgeTitle {
   height: 80px;
 }