Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/test'

zhouna 3 gadi atpakaļ
vecāks
revīzija
23f36201ec

+ 2 - 0
src/api/config.js

@@ -149,6 +149,8 @@ export default {
     'zskSearchConcept': '/klDisease/searchConceptRuleClass',//知识库搜索术语
     'zskUpdateAll':'/cache/clearRuleAll',//更新数据
     'zskgetDict':'/kl/dictionary/getDictionarys',//禁止修改基础规则类型
+
+    'importExcelDataVerify': '/tran/mappingConfig/importExcelDataVerify',//数据导入校验
   },
 	menuIconList: { //菜单对应图标
 		'YH-KZT': 'el-icon-menu',

+ 38 - 11
src/api/icss.js

@@ -72,7 +72,9 @@ export default {
     });
   },
   importDiseaseRecord(param) {
-    return axios.post(urls.importDiseaseRecord, param);
+    return axios.post(urls.importDiseaseRecord, param, {
+      responseType: 'blob',
+    });
   },
   getLisPage(param) {
     //检验列表-列表
@@ -93,7 +95,9 @@ export default {
     });
   },
   importLisRecord(param) {
-    return axios.post(urls.importLisRecord, param);
+    return axios.post(urls.importLisRecord, param, {
+      responseType: 'blob',
+    });
   },
   getpacsPage(param) {
     //检查列表-列表
@@ -114,7 +118,9 @@ export default {
     });
   },
   importPacsRecord(param) {
-    return axios.post(urls.importPacsRecord, param);
+    return axios.post(urls.importPacsRecord, param, {
+      responseType: 'blob',
+    });
   },
   getDrugPage(param) {
     //药品列表-列表
@@ -135,7 +141,9 @@ export default {
     });
   },
   importDrugRecord(param) {
-    return axios.post(urls.importDrugRecord, param);
+    return axios.post(urls.importDrugRecord, param, {
+      responseType: 'blob',
+    });
   },
 
 
@@ -158,7 +166,9 @@ export default {
     });
   },
   importScaleRecord(param) {
-    return axios.post(urls.importScaleRecordCDSS, param);
+    return axios.post(urls.importScaleRecordCDSS, param, {
+      responseType: 'blob',
+    });
   },
   exportScaleModule(param) {
     return axios.post(urls.exportScaleModuleCDSS, param, {
@@ -185,7 +195,9 @@ export default {
     });
   },
   importOperationRecord(param) {
-    return axios.post(urls.importOperationRecord, param);
+    return axios.post(urls.importOperationRecord, param, {
+      responseType: 'blob',
+    });
   },
   getFusionPage(param) {
     //输血列表-列表
@@ -206,7 +218,9 @@ export default {
     });
   },
   importFusionRecord(param) {
-    return axios.post(urls.importFusionRecord, param);
+    return axios.post(urls.importFusionRecord, param, {
+      responseType: 'blob',
+    });
   },
   getDeptPage(param) {
     //科室列表-列表
@@ -227,7 +241,9 @@ export default {
     });
   },
   importDeptRecord(param) {
-    return axios.post(urls.importDeptRecord, param);
+    return axios.post(urls.importDeptRecord, param, {
+      responseType: 'blob',
+    });
   },
   exportDeptModule(param) {
     return axios.post(urls.exportDeptModule, param, {
@@ -292,7 +308,9 @@ export default {
   },
   importNurseRecord(param) {
     //护理-数据导入
-    return axios.post(urls.importNurseRecord, param);
+    return axios.post(urls.importNurseRecord, param, {
+      responseType: 'blob',
+    });
   },
   exportNurseModule(param) {
     //护理-数据导入模板导出
@@ -325,7 +343,9 @@ export default {
   },
   importTcmRecord(param) {
     //中医疾病-数据导入
-    return axios.post(urls.importTcmRecord, param);
+    return axios.post(urls.importTcmRecord, param, {
+      responseType: 'blob',
+    });
   },
   exportTcmModule(param) {
     //中医疾病-数据导入模板导出
@@ -360,7 +380,9 @@ export default {
   },
   importTcmdromeRecord(param) {
     //中医疾病-数据导入
-    return axios.post(urls.importTcmdromeRecord, param);
+    return axios.post(urls.importTcmdromeRecord, param, {
+      responseType: 'blob',
+    });
   },
   exportTcmdromeModule(param) {
     //中医疾病-数据导入模板导出
@@ -442,4 +464,9 @@ export default {
       responseType: 'blob',
     });
   },
+
+  importExcelDataVerify(param) {
+    //数据导入校验
+    return axios.post(urls.importExcelDataVerify, param);
+  },
 };

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

@@ -152,10 +152,9 @@
       </div>
       <div class="mapList">
         已关联标准术语:
-        <span
-          v-for="item in mapList"
-          :key="item.id"
-        >{{item.uniqueName}}&nbsp;&nbsp;{{item.form}}{{item.hisCode}};</span>
+        <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>

+ 204 - 86
src/components/icss/dept/DeptManage.vue

@@ -2,21 +2,17 @@
   <div>
     <crumbs title="科室关联维护" style="min-width: 980px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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-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>
@@ -27,10 +23,21 @@
         <el-form-item label="标准科室名称:">
           <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
         </el-form-item>
-      </el-form>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
+        </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>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
         </el-form-item>
       </el-form>
@@ -42,7 +49,14 @@
         <el-table-column :resizable="false" prop="hisCode" label="医院科室编码" show-overflow-tooltip></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="operate" label="状态">
+        <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>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
           </template>
@@ -102,11 +116,17 @@ export default {
         { id: 0, name: '未匹配' },
         { id: 2, name: '多项匹配' }
       ],
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
       searched: false,
       filter: {
         hisName: '', // 医院诊断名称
         uniqueName: '', //标准诊断名称
-        match:''
+        match: '',
+        status: ''
       },
       currentPage: 1,
       pageSize: config.pageSize,
@@ -121,19 +141,19 @@ export default {
       data: {}
     };
   },
-  components:{
+  components: {
     LtModal
   },
   created() {
     const param = this.$route.params;
-    if(param.currentPage){
-      this.inCurrentPage = param.currentPage
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
     }
-    if(param.filter){
-      this.filter = param.filter
+    if (param.filter) {
+      this.filter = param.filter;
     }
     //返回时避免参数未赋值就获取列表
-    setTimeout(()=> {
+    setTimeout(() => {
       this.getDataList();
     });
     // 非首页 编辑页返回 设置 this.currentPage
@@ -157,6 +177,11 @@ export default {
     // 导入数据
     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);
@@ -245,7 +270,8 @@ export default {
         uniqueName: this.filter.uniqueName.trim(),
         uniqueCode: '',
         type: 7,
-        isMatch: this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status
       };
       return param;
     },
@@ -263,8 +289,8 @@ export default {
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
       // this.$router.push({ name: 'AddDept', params: pam });
-      this.data = {}
-      this.showModal()
+      this.data = {};
+      this.showModal();
     },
     // 修改诊断关联-跳转至编辑页面
     modifyRelation(row) {
@@ -280,8 +306,8 @@ export default {
       //   name: 'AddDept',
       //   params: Object.assign(pam, { isEdit: true, data: item })
       // });
-      this.data = item
-      this.showModal()
+      this.data = item;
+      this.showModal();
     },
     currentChange(next) {
       this.currentPage = next;
@@ -385,19 +411,21 @@ export default {
         // }
       })
         .then(() => {
-          api.exportDeptRecord({type:7,isMatch:this.filter.match}).then(res => {
-            if (res.status === 200) {
-              this.$message({ message: '导出成功', type: 'success' });
-              utils.downloadExportedData(res.data, '科室关联数据.xls');
-            }
-          });
+          api
+            .exportDeptRecord({ type: 7, isMatch: this.filter.match })
+            .then(res => {
+              if (res.status === 200) {
+                this.$message({ message: '导出成功', type: 'success' });
+                utils.downloadExportedData(res.data, '科室关联数据.xls');
+              }
+            });
         })
         .catch(() => {});
     },
 
     // 导入模板
     exportModule() {
-      api.exportDeptModule({type:7}).then(res => {
+      api.exportDeptModule({ type: 7 }).then(res => {
         if (res.status === 200) {
           setTimeout(() => {
             utils.downloadExportedData(res.data, '科室导入模板.xls');
@@ -414,6 +442,11 @@ export default {
     // 导入数据
     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;
+      }
       // this.fileName = e.target.files[0].name; // 表单同步显示
       e.preventDefault();
       let formData = new FormData();
@@ -429,60 +462,145 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importDeptRecord(formData, header).then(res => {
-        // console.log('导入文件结果', '===================', res);
-        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(() => {});
+      this.importDeptRecord(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.importDeptRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDeptRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
 
-          setTimeout(() => {
-            this.uploadInfo = '导入';
-          }, 300);
-        }
-      });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
       inp.value = '';
     },
+    importDeptRecord(formData, header) {
+      let that = this;
+      api.importDeptRecord(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;
@@ -565,7 +683,7 @@ export default {
     display: none;
   }
 }
-#upFileMatch{
+#upFileMatch {
   display: none;
 }
 </style>

+ 191 - 68
src/components/icss/disease/ChemicalAndCommonMapping.vue

@@ -2,15 +2,17 @@
   <div>
     <crumbs title="诊断关联维护" style="min-width: 980px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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 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-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>
@@ -21,10 +23,20 @@
         <el-form-item label="标准诊断名称:">
           <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
         </el-form-item>
-      </el-form>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
+        </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 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>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
         </el-form-item>
       </el-form>
@@ -36,7 +48,14 @@
         <el-table-column :resizable="false" prop="hisName" label="医院诊断名称" show-overflow-tooltip></el-table-column>
         <el-table-column :resizable="false" prop="code" label="ICD-10编码" 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="operate" label="状态">
+        <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>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
           </template>
@@ -96,11 +115,17 @@ export default {
         { id: 0, name: '未匹配' },
         { id: 2, name: '多项匹配' }
       ],
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
       searched: false,
       filter: {
         hisName: '', // 医院诊断名称
         uniqueName: '', //标准诊断名称
-        match: ''
+        match: '',
+        status: ''
       },
       currentPage: 1,
       pageSize: config.pageSize,
@@ -153,6 +178,11 @@ export default {
     // 导入数据
     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);
@@ -241,7 +271,8 @@ export default {
         uniqueName: this.filter.uniqueName.trim(),
         icdCode: '',
         type: 4,
-        isMatch: this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status
       };
       return param;
     },
@@ -380,12 +411,14 @@ export default {
         // }
       })
         .then(() => {
-          api.exportDiseaseRecord({type:4,isMatch:this.filter.match}).then(res => {
-            if (res.status === 200) {
-              this.$message({ message: '导出成功', type: 'success' });
-              utils.downloadExportedData(res.data, '诊断关联数据.xls');
-            }
-          });
+          api
+            .exportDiseaseRecord({ type: 4, 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' });
@@ -394,7 +427,7 @@ export default {
 
     // 导入模板
     exportModule() {
-      api.exportDiseaseModule({type:4}).then(res => {
+      api.exportDiseaseModule({ type: 4 }).then(res => {
         if (res.status === 200) {
           setTimeout(() => {
             utils.downloadExportedData(res.data, '诊断导入模板.xls');
@@ -411,6 +444,11 @@ export default {
     // 导入数据
     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);
@@ -425,59 +463,144 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importDiseaseRecord(formData, header).then(res => {
-        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(() => {});
+      this.importDiseaseRecord(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.importDiseaseRecord(formData, header)
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importDiseaseRecord(formData, header)
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
 
-          setTimeout(() => {
-            this.uploadInfo = '导入';
-          }, 300);
-        }
-      });
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
       inp.value = '';
     },
+    importDiseaseRecord(formData, header) {
+      let that = this;
+      api.importDiseaseRecord(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.$alert(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+        //   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.$alert(`导入成功`, '提示', {
+        //     confirmButtonText: '确定',
+        //     // cancelButtonText: '取消',
+        //     // cancelButtonClass: 'cancelSure',
+        //     // confirmButtonClass: 'sure',
+        //     // customClass: 'exportConfirm',
+        //     type: 'success'
+        //   })
+        //     .then(() => {})
+        //     .catch(() => {});
+        //   this.getDataList(); // 重新获取列表
+        //   setTimeout(() => {
+        //     this.uploadInfo = '导入';
+        //   }, 300);
+        // } else {
+        //   this.$alert(`${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;

+ 226 - 85
src/components/icss/drug/DrugManage.vue

@@ -2,20 +2,27 @@
   <div>
     <crumbs title="药品关联维护" style="min-width: 980px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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 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-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>
@@ -23,11 +30,20 @@
         <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>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
@@ -41,7 +57,21 @@
         <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="状态">
+        <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>
@@ -100,11 +130,23 @@ export default {
         { 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:''
+        match: '',
+        status: '',
+        formStatus: ''
       },
       currentPage: 1,
       pageSize: config.pageSize,
@@ -116,19 +158,19 @@ export default {
       data: {}
     };
   },
-  components:{
+  components: {
     LtModal
   },
   created() {
     const param = this.$route.params;
-    if(param.currentPage){
-      this.inCurrentPage = param.currentPage
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
     }
-    if(param.filter){
-      this.filter = param.filter
+    if (param.filter) {
+      this.filter = param.filter;
     }
     //返回时避免参数未赋值就获取列表
-    setTimeout(()=> {
+    setTimeout(() => {
       this.getDataList();
     });
   },
@@ -149,6 +191,11 @@ export default {
     // 导入数据
     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);
@@ -237,7 +284,9 @@ export default {
         uniqueName: this.filter.uniqueName.trim(),
         uniqueCode: '',
         type: 5,
-        isMatch:this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status,
+        formStatus: this.filter.formStatus
       };
       return param;
     },
@@ -255,8 +304,8 @@ export default {
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
 
-        this.data = {};
-        this.showModal()
+      this.data = {};
+      this.showModal();
       // this.$router.push({ name: 'AddDrug', params: pam });
     },
     // 修改诊断关联-跳转至编辑页面
@@ -273,8 +322,8 @@ export default {
       //   name: 'AddDrug',
       //   params: Object.assign(pam, { isEdit: true, data: item })
       // });
-      this.data = item
-      this.showModal()
+      this.data = item;
+      this.showModal();
     },
     currentChange(next) {
       this.currentPage = next;
@@ -377,12 +426,14 @@ export default {
         // }
       })
         .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');
-            }
-          });
+          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' });
@@ -391,7 +442,7 @@ 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');
@@ -408,6 +459,11 @@ export default {
     // 导入数据
     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);
@@ -422,60 +478,145 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importDrugRecord(formData, header).then(res => {
-        // console.log(res, '======================res导入结果');
-        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(() => {});
+      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);
+      //   }
+      // });
 
-          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;
@@ -550,7 +691,7 @@ export default {
     border-bottom: 1px solid #dcdfe6;
   }
 }
-#upFileMatch{
+#upFileMatch {
   display: none;
 }
 </style>

+ 204 - 84
src/components/icss/fusion/Fusion.vue

@@ -2,20 +2,17 @@
   <div>
     <crumbs title="输血关联维护" style="min-width: 980px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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 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-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>
@@ -26,10 +23,21 @@
         <el-form-item label="标准输血术语:">
           <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
         </el-form-item>
-      </el-form>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
+        </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>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
         </el-form-item>
       </el-form>
@@ -40,7 +48,14 @@
         <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="operate" label="状态">
+        <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>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
           </template>
@@ -99,11 +114,17 @@ export default {
         { id: 0, name: '未匹配' },
         { id: 2, name: '多项匹配' }
       ],
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
       searched: false,
       filter: {
         hisName: '', // 医院诊断名称
         uniqueName: '', //标准诊断名称
-        match:''
+        match: '',
+        status: ''
       },
       currentPage: 1,
       pageSize: config.pageSize,
@@ -115,19 +136,19 @@ export default {
       data: {}
     };
   },
-  components:{
+  components: {
     LtModal
   },
   created() {
     const param = this.$route.params;
-    if(param.currentPage){
-      this.inCurrentPage = param.currentPage
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
     }
-    if(param.filter){
-      this.filter = param.filter
+    if (param.filter) {
+      this.filter = param.filter;
     }
     //返回时避免参数未赋值就获取列表
-    setTimeout(()=> {
+    setTimeout(() => {
       this.getDataList();
     });
   },
@@ -149,6 +170,11 @@ export default {
     // 导入数据
     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);
@@ -237,7 +263,8 @@ export default {
         uniqueName: this.filter.uniqueName.trim(),
         uniqueCode: '',
         type: 8,
-        isMatch: this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status
       };
       return param;
     },
@@ -255,8 +282,8 @@ export default {
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
       // this.$router.push({ name: 'AddFusion', params: pam });
-      this.data = {}
-      this.showModal()
+      this.data = {};
+      this.showModal();
     },
     // 修改诊断关联-跳转至编辑页面
     modifyRelation(row) {
@@ -272,8 +299,8 @@ export default {
       //   name: 'AddFusion',
       //   params: Object.assign(pam, { isEdit: true, data: item })
       // });
-      this.data = item
-      this.showModal()
+      this.data = item;
+      this.showModal();
     },
     currentChange(next) {
       this.currentPage = next;
@@ -376,12 +403,14 @@ export default {
         // }
       })
         .then(() => {
-          api.exportFusionRecord({type:8,isMatch:this.filter.match}).then(res => {
-            if (res.status === 200) {
-              this.$message({ message: '导出成功', type: 'success' });
-              utils.downloadExportedData(res.data, '输血关联数据.xls');
-            }
-          });
+          api
+            .exportFusionRecord({ type: 8, 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' });
@@ -389,7 +418,7 @@ export default {
     },
     // 导入模板
     exportModule() {
-      api.exportFusionModule({type:8}).then(res => {
+      api.exportFusionModule({ type: 8 }).then(res => {
         if (res.status === 200) {
           setTimeout(() => {
             utils.downloadExportedData(res.data, '输血导入模板.xls');
@@ -406,6 +435,11 @@ export default {
     // 导入数据
     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);
@@ -420,59 +454,145 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importFusionRecord(formData, header).then(res => {
-        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(() => {});
+      this.importFusionRecord(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.importFusionRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importFusionRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
 
-          setTimeout(() => {
-            this.uploadInfo = '导入';
-          }, 300);
-        }
-      });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
       inp.value = '';
     },
+    importFusionRecord(formData, header) {
+      let that = this;
+      api.importFusionRecord(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;
@@ -547,7 +667,7 @@ export default {
     border-bottom: 1px solid #dcdfe6;
   }
 }
-#upFileMatch{
+#upFileMatch {
   display: none;
 }
 </style>

+ 194 - 63
src/components/icss/lis/Lis.vue

@@ -2,15 +2,17 @@
   <div>
     <crumbs title="检验关联维护" style="min-width: 1060px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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 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-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>
@@ -24,10 +26,21 @@
         <el-form-item label="标准检验项:">
           <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
         </el-form-item>
-      </el-form>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
+        </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>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
         </el-form-item>
       </el-form>
@@ -39,7 +52,14 @@
         <el-table-column :resizable="false" prop="hisName" label="检验套餐" show-overflow-tooltip></el-table-column>
         <el-table-column :resizable="false" prop="hisDetailName" 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="operate" label="状态">
+        <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>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
           </template>
@@ -100,12 +120,18 @@ export default {
         { id: 0, name: '未匹配' },
         { id: 2, name: '多项匹配' }
       ],
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
       searched: false,
       filter: {
         hisName: '', // 检验套餐
         hisDetailName: '', //检验细项
         uniqueName: '', //标准检验项
-        match: ''
+        match: '',
+        status: ''
       },
       currentPage: 1,
       pageSize: config.pageSize,
@@ -151,6 +177,11 @@ export default {
     // 导入数据
     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);
@@ -240,7 +271,8 @@ export default {
         uniqueCode: '',
         hisDetailName: this.filter.hisDetailName.trim(),
         type: 1,
-        isMatch: this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status
       };
       return param;
     },
@@ -382,7 +414,8 @@ export default {
         .then(() => {
           api
             .exportLisRecord({
-              type: 1,isMatch:this.filter.match
+              type: 1,
+              isMatch: this.filter.match
             })
             .then(res => {
               if (res.status === 200) {
@@ -397,7 +430,7 @@ export default {
     },
     // 导入模板
     exportModule() {
-      api.exportLisModule({type:1}).then(res => {
+      api.exportLisModule({ type: 1 }).then(res => {
         if (res.status === 200) {
           setTimeout(() => {
             utils.downloadExportedData(res.data, '检验导入模板.xls');
@@ -414,6 +447,11 @@ export default {
     // 导入数据
     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);
@@ -428,59 +466,152 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importLisRecord(formData, header).then(res => {
-        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(() => {});
+      this.importLisRecord(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.importLisRecord(formData, header)
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importLisRecord(formData, header)
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
 
-          setTimeout(() => {
-            this.uploadInfo = '导入';
-          }, 300);
-        }
-      });
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
       inp.value = '';
     },
+    importLisRecord(formData, header) {
+      let that = this;
+      api
+        .importLisRecord(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.$alert(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
+          //     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.$alert(`导入成功`, '提示', {
+          //     confirmButtonText: '确定',
+          //     // cancelButtonText: '取消',
+          //     // cancelButtonClass: 'cancelSure',
+          //     // confirmButtonClass: 'sure',
+          //     // customClass: 'exportConfirm',
+          //     type: 'success'
+          //   })
+          //     .then(() => {})
+          //     .catch(() => {});
+          //   this.getDataList(); // 重新获取列表
+          //   setTimeout(() => {
+          //     this.uploadInfo = '导入';
+          //   }, 300);
+          // } else {
+          //   this.$alert(`${res.data.msg}`, '提示', {
+          //     confirmButtonText: '确定',
+          //     // cancelButtonText: '取消',
+          //     // cancelButtonClass: 'cancelSure',
+          //     // confirmButtonClass: 'sure',
+          //     // customClass: 'exportConfirm',
+          //     type: 'warning'
+          //   })
+          //     .then(() => {})
+          //     .catch(() => {});
+
+          //   setTimeout(() => {
+          //     this.uploadInfo = '导入';
+          //   }, 300);
+          // }
+        })
+        .catch(error => {
+          console.log(error);
+
+          // this.$message({ message: '导出失败', type: 'waring' });
+        });
+    },
+    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;

+ 204 - 86
src/components/icss/nursing/nursing.vue

@@ -2,21 +2,17 @@
   <div>
     <crumbs title="护理关联维护" style="min-width: 980px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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-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>
@@ -27,10 +23,21 @@
         <el-form-item label="标准护理名称:">
           <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
         </el-form-item>
-      </el-form>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
+        </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>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
         </el-form-item>
       </el-form>
@@ -41,7 +48,14 @@
         <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="operate" label="状态">
+        <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>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
           </template>
@@ -102,10 +116,16 @@ export default {
         { id: 0, name: '未匹配' },
         { id: 2, name: '多项匹配' }
       ],
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
       filter: {
         hisName: '', // 医院诊断名称
         uniqueName: '', //标准诊断名称
-        match:''
+        match: '',
+        status: ''
       },
       currentPage: 1,
       pageSize: config.pageSize,
@@ -120,19 +140,19 @@ export default {
       data: {}
     };
   },
-  components:{
+  components: {
     LtModal
   },
   created() {
     const param = this.$route.params;
-    if(param.currentPage){
-      this.inCurrentPage = param.currentPage
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
     }
-    if(param.filter){
-      this.filter = param.filter
+    if (param.filter) {
+      this.filter = param.filter;
     }
     //返回时避免参数未赋值就获取列表
-    setTimeout(()=> {
+    setTimeout(() => {
       this.getDataList();
     });
     // 非首页 编辑页返回 设置 this.currentPage
@@ -157,6 +177,11 @@ export default {
     // 导入数据
     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);
@@ -245,7 +270,8 @@ export default {
         uniqueName: this.filter.uniqueName.trim(),
         uniqueCode: '',
         type: 11,
-        isMatch:this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status
       };
       return param;
     },
@@ -263,8 +289,8 @@ export default {
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
       // this.$router.push({ name: 'AddNursing', params: pam });
-      this.data={}
-      this.showModal()
+      this.data = {};
+      this.showModal();
     },
     // 修改诊断关联-跳转至编辑页面
     modifyRelation(row) {
@@ -280,8 +306,8 @@ export default {
       //   name: 'AddNursing',
       //   params: Object.assign(pam, { isEdit: true, data: item })
       // });
-      this.data=item
-      this.showModal()
+      this.data = item;
+      this.showModal();
     },
     currentChange(next) {
       this.currentPage = next;
@@ -385,19 +411,21 @@ export default {
         // }
       })
         .then(() => {
-          api.exportNurseRecord({type:11,isMatch:this.filter.match}).then(res => {
-            if (res.status === 200) {
-              this.$message({ message: '导出成功', type: 'success' });
-              utils.downloadExportedData(res.data, '护理关联数据.xls');
-            }
-          });
+          api
+            .exportNurseRecord({ type: 11, isMatch: this.filter.match })
+            .then(res => {
+              if (res.status === 200) {
+                this.$message({ message: '导出成功', type: 'success' });
+                utils.downloadExportedData(res.data, '护理关联数据.xls');
+              }
+            });
         })
         .catch(() => {});
     },
 
     // 导入模板
     exportModule() {
-      api.exportNurseModule({type:11}).then(res => {
+      api.exportNurseModule({ type: 11 }).then(res => {
         if (res.status === 200) {
           setTimeout(() => {
             utils.downloadExportedData(res.data, '护理导入模板.xls');
@@ -414,6 +442,11 @@ export default {
     // 导入数据
     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;
+      }
       // this.fileName = e.target.files[0].name; // 表单同步显示
       e.preventDefault();
       let formData = new FormData();
@@ -429,60 +462,145 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importNurseRecord(formData, header).then(res => {
-        // console.log('导入文件结果', '===================', res);
-        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(() => {});
+      this.importNurseRecord(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.importNurseRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importNurseRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
 
-          setTimeout(() => {
-            this.uploadInfo = '导入';
-          }, 300);
-        }
-      });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
       inp.value = '';
     },
+    importNurseRecord(formData, header) {
+      let that = this;
+      api.importNurseRecord(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;
@@ -565,7 +683,7 @@ export default {
     display: none;
   }
 }
-#upFileMatch{
+#upFileMatch {
   display: none;
 }
 </style>

+ 185 - 61
src/components/icss/operation/Operation.vue

@@ -2,15 +2,17 @@
   <div>
     <crumbs title="手术/操作关联维护" style="min-width: 980px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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 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-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>
@@ -21,10 +23,21 @@
         <el-form-item label="标准手术/操作名称:">
           <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
         </el-form-item>
-      </el-form>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
+        </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>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
         </el-form-item>
       </el-form>
@@ -41,7 +54,14 @@
           label="标准手术/操作名称"
           show-overflow-tooltip
         ></el-table-column>
-        <el-table-column :resizable="false" prop="operate" label="状态">
+        <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>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
           </template>
@@ -102,11 +122,17 @@ export default {
         { id: 0, name: '未匹配' },
         { id: 2, name: '多项匹配' }
       ],
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
       searched: false,
       filter: {
         hisName: '', // 医院诊断名称
         uniqueName: '', //标准诊断名称
-        match: ''
+        match: '',
+        status: ''
       },
       currentPage: 1,
       pageSize: config.pageSize,
@@ -152,6 +178,11 @@ export default {
     // 导入数据
     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);
@@ -240,7 +271,8 @@ export default {
         uniqueName: this.filter.uniqueName.trim(),
         uniqueCode: '',
         type: 6,
-        isMatch: this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status
       };
       return param;
     },
@@ -412,6 +444,11 @@ export default {
     // 导入数据
     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);
@@ -426,59 +463,146 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importOperationRecord(formData, header).then(res => {
-        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(() => {});
+      this.importOperationRecord(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.importOperationRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importOperationRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
 
-          setTimeout(() => {
-            this.uploadInfo = '导入';
-          }, 300);
-        }
-      });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
       inp.value = '';
     },
+    importOperationRecord(formData, header) {
+      let that = this;
+      api.importOperationRecord(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;

+ 199 - 80
src/components/icss/pacs/Pacs.vue

@@ -2,20 +2,17 @@
   <div>
     <crumbs title="检查关联维护" style="min-width: 980px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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 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-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>
@@ -26,10 +23,21 @@
         <el-form-item label="标准检查项目:">
           <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
         </el-form-item>
-      </el-form>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
+        </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>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
         </el-form-item>
       </el-form>
@@ -40,7 +48,14 @@
         <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="operate" label="状态">
+        <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>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
           </template>
@@ -100,11 +115,17 @@ export default {
         { id: 0, name: '未匹配' },
         { id: 2, name: '多项匹配' }
       ],
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
       searched: false,
       filter: {
         hisName: '', // 医院诊断名称
         uniqueName: '', //标准诊断名称
-        match:''
+        match: '',
+        status: ''
       },
       currentPage: 1,
       pageSize: config.pageSize,
@@ -116,7 +137,7 @@ export default {
       data: {}
     };
   },
-  components:{
+  components: {
     LtModal
   },
   created() {
@@ -155,6 +176,11 @@ export default {
     // 导入数据
     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);
@@ -243,7 +269,8 @@ export default {
         uniqueName: this.filter.uniqueName.trim(),
         uniqueCode: '',
         type: 3,
-        isMatch:this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status
       };
       return param;
     },
@@ -260,8 +287,8 @@ export default {
             filter: this.filter
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
-        this.data = {}
-        this.showModal()
+      this.data = {};
+      this.showModal();
       // this.$router.push({ name: 'AddPacs', params: pam });
     },
     // 修改诊断关联-跳转至编辑页面
@@ -274,8 +301,8 @@ export default {
             filter: this.filter
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
-        this.data = item
-        this.showModal()
+      this.data = item;
+      this.showModal();
       // this.$router.push({
       //   name: 'AddPacs',
       //   params: Object.assign(pam, { isEdit: true, data: item })
@@ -382,12 +409,14 @@ export default {
         // }
       })
         .then(() => {
-          api.exportPacsRecord({type:3,isMatch:this.filter.match}).then(res => {
-            if (res.status === 200) {
-              this.$message({ message: '导出成功', type: 'success' });
-              utils.downloadExportedData(res.data, '检查关联数据.xls');
-            }
-          });
+          api
+            .exportPacsRecord({ type: 3, 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' });
@@ -395,7 +424,7 @@ export default {
     },
     // 导入模板
     exportModule() {
-      api.exportPacsModule({type:3}).then(res => {
+      api.exportPacsModule({ type: 3 }).then(res => {
         if (res.status === 200) {
           setTimeout(() => {
             utils.downloadExportedData(res.data, '检查导入模板.xls');
@@ -412,6 +441,11 @@ export default {
     // 导入数据
     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);
@@ -426,60 +460,145 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importPacsRecord(formData, header).then(res => {
-        // code === '00000001'  导入失败统一提示 数据存在异常,导入失败,请修改后再试
-        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(() => {});
+      this.importPacsRecord(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.importPacsRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importPacsRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
 
-          setTimeout(() => {
-            this.uploadInfo = '导入';
-          }, 300);
-        }
-      });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
       inp.value = '';
     },
+    importPacsRecord(formData, header) {
+      let that = this;
+      api.importPacsRecord(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;
@@ -554,7 +673,7 @@ export default {
     border-bottom: 1px solid #dcdfe6;
   }
 }
-#upFileMatch{
+#upFileMatch {
   display: none;
 }
 </style>

+ 194 - 70
src/components/icss/scale/ScaleManage.vue

@@ -2,15 +2,17 @@
   <div>
     <crumbs title="量表关联维护" style="min-width: 980px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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 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-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>
@@ -21,10 +23,21 @@
         <el-form-item label="标准量表名称:">
           <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
         </el-form-item>
-      </el-form>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
+        </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>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
         </el-form-item>
       </el-form>
@@ -35,7 +48,14 @@
         <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="operate" label="状态">
+        <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>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
           </template>
@@ -93,7 +113,8 @@ export default {
       filter: {
         hisName: '', // 医院诊断名称
         uniqueName: '', //标准诊断名称
-        match:''
+        match: '',
+        status: ''
       },
       matchList: [
         { id: '', name: '全部' },
@@ -101,6 +122,11 @@ export default {
         { id: 0, name: '未匹配' },
         { id: 2, name: '多项匹配' }
       ],
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
       currentPage: 1,
       pageSize: config.pageSize,
       pageSizeArr: config.pageSizeArr,
@@ -150,6 +176,11 @@ export default {
     // 导入数据
     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);
@@ -238,7 +269,8 @@ export default {
         uniqueName: this.filter.uniqueName.trim(),
         uniqueCode: '',
         type: 10,
-        isMatch: this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status
       };
       return param;
     },
@@ -377,12 +409,14 @@ export default {
         // }
       })
         .then(() => {
-          api.exportScaleRecord({type:10,isMatch:this.filter.match}).then(res => {
-            if (res.status === 200) {
-              this.$message({ message: '导出成功', type: 'success' });
-              utils.downloadExportedData(res.data, '量表关联数据.xls');
-            }
-          });
+          api
+            .exportScaleRecord({ type: 10, 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' });
@@ -391,7 +425,7 @@ export default {
 
     // 导入模板
     exportModule() {
-      api.exportScaleModule({type:10}).then(res => {
+      api.exportScaleModule({ type: 10 }).then(res => {
         if (res.status === 200) {
           setTimeout(() => {
             utils.downloadExportedData(res.data, '量表导入模板.xls');
@@ -408,6 +442,11 @@ export default {
     // 导入数据
     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);
@@ -422,60 +461,145 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importScaleRecord(formData, header).then(res => {
-        // console.log(res, '======================res导入结果');
-        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(() => {});
+      this.importScaleRecord(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.importScaleRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importScaleRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
 
-          setTimeout(() => {
-            this.uploadInfo = '导入';
-          }, 300);
-        }
-      });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
       inp.value = '';
     },
+    importScaleRecord(formData, header) {
+      let that = this;
+      api.importScaleRecord(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;
@@ -550,7 +674,7 @@ export default {
     border-bottom: 1px solid #dcdfe6;
   }
 }
-#upFileMatch{
+#upFileMatch {
   display: none;
 }
 </style>

+ 209 - 86
src/components/icss/tcmdisease/tcmdisease.vue

@@ -2,21 +2,17 @@
   <div>
     <crumbs title="中医疾病关联维护" style="min-width: 980px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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-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>
@@ -27,10 +23,21 @@
         <el-form-item label="标准中医疾病名称:">
           <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
         </el-form-item>
-      </el-form>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
+        </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>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
         </el-form-item>
       </el-form>
@@ -41,8 +48,20 @@
         <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="code" 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="operate" label="状态">
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          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>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
           </template>
@@ -101,8 +120,14 @@ export default {
       filter: {
         hisName: '', // 医院诊断名称
         uniqueName: '', //标准诊断名称
-        match:''
+        match: '',
+        status: ''
       },
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
       matchList: [
         { id: '', name: '全部' },
         { id: 1, name: '已匹配' },
@@ -127,14 +152,14 @@ export default {
   },
   created() {
     const param = this.$route.params;
-    if(param.currentPage){
-      this.inCurrentPage = param.currentPage
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
     }
-    if(param.filter){
-      this.filter = param.filter
+    if (param.filter) {
+      this.filter = param.filter;
     }
     //返回时避免参数未赋值就获取列表
-    setTimeout(()=> {
+    setTimeout(() => {
       this.getDataList();
     });
     // 非首页 编辑页返回 设置 this.currentPage
@@ -159,6 +184,11 @@ export default {
     // 导入数据
     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);
@@ -247,7 +277,8 @@ export default {
         uniqueName: this.filter.uniqueName.trim(),
         uniqueCode: '',
         type: 12,
-        isMatch: this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status
       };
       return param;
     },
@@ -265,8 +296,8 @@ export default {
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
       // this.$router.push({ name: 'AddTcmdisease', params: pam });
-      this.data = {}
-      this.showModal()
+      this.data = {};
+      this.showModal();
     },
     // 修改诊断关联-跳转至编辑页面
     modifyRelation(row) {
@@ -282,8 +313,8 @@ export default {
       //   name: 'AddTcmdisease',
       //   params: Object.assign(pam, { isEdit: true, data: item })
       // });
-      this.data = item
-      this.showModal()
+      this.data = item;
+      this.showModal();
     },
     currentChange(next) {
       this.currentPage = next;
@@ -387,19 +418,21 @@ export default {
         // }
       })
         .then(() => {
-          api.exportTcmRecord({type:12,isMatch:this.filter.match}).then(res => {
-            if (res.status === 200) {
-              this.$message({ message: '导出成功', type: 'success' });
-              utils.downloadExportedData(res.data, '中医疾病关联数据.xls');
-            }
-          });
+          api
+            .exportTcmRecord({ type: 12, isMatch: this.filter.match })
+            .then(res => {
+              if (res.status === 200) {
+                this.$message({ message: '导出成功', type: 'success' });
+                utils.downloadExportedData(res.data, '中医疾病关联数据.xls');
+              }
+            });
         })
         .catch(() => {});
     },
 
     // 导入模板
     exportModule() {
-      api.exportTcmModule({type:12}).then(res => {
+      api.exportTcmModule({ type: 12 }).then(res => {
         if (res.status === 200) {
           setTimeout(() => {
             utils.downloadExportedData(res.data, '中医疾病导入模板.xls');
@@ -416,6 +449,11 @@ export default {
     // 导入数据
     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;
+      }
       // this.fileName = e.target.files[0].name; // 表单同步显示
       e.preventDefault();
       let formData = new FormData();
@@ -431,60 +469,145 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importTcmRecord(formData, header).then(res => {
-        // console.log('导入文件结果', '===================', res);
-        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(() => {});
+      this.importTcmRecord(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.importTcmRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importTcmRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
 
-          setTimeout(() => {
-            this.uploadInfo = '导入';
-          }, 300);
-        }
-      });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
       inp.value = '';
     },
+    importTcmRecord(formData, header) {
+      let that = this;
+      api.importTcmRecord(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;
@@ -567,7 +690,7 @@ export default {
     display: none;
   }
 }
-#upFileMatch{
+#upFileMatch {
   display: none;
 }
 </style>

+ 209 - 86
src/components/icss/tcmdrome/tcmdrome.vue

@@ -2,21 +2,17 @@
   <div>
     <crumbs title="中医证候关联维护" style="min-width: 980px" class="knowledgeTitle">
       <el-form :inline="true" class="demo-form-inline">
-        <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 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-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>
@@ -27,10 +23,21 @@
         <el-form-item label="标准中医证候名称:">
           <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
         </el-form-item>
-      </el-form>
-      <el-form class="secLine">
         <el-form-item>
           <el-button size="mini" @click="filterDatas">检索</el-button>
+        </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>
           <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
         </el-form-item>
       </el-form>
@@ -41,8 +48,20 @@
         <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="code" 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="operate" label="状态">
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          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>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
           </template>
@@ -101,8 +120,14 @@ export default {
       filter: {
         hisName: '', // 医院诊断名称
         uniqueName: '', //标准诊断名称
-        match: ''
+        match: '',
+        status: ''
       },
+      statusList: [
+        { id: '', name: '全部' },
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
       matchList: [
         { id: '', name: '全部' },
         { id: 1, name: '已匹配' },
@@ -127,14 +152,14 @@ export default {
   },
   created() {
     const param = this.$route.params;
-    if(param.currentPage){
-      this.inCurrentPage = param.currentPage
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
     }
-    if(param.filter){
-      this.filter = param.filter
+    if (param.filter) {
+      this.filter = param.filter;
     }
     //返回时避免参数未赋值就获取列表
-    setTimeout(()=> {
+    setTimeout(() => {
       this.getDataList();
     });
     // 非首页 编辑页返回 设置 this.currentPage
@@ -159,6 +184,11 @@ export default {
     // 导入数据
     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);
@@ -247,7 +277,8 @@ export default {
         uniqueName: this.filter.uniqueName.trim(),
         uniqueCode: '',
         type: 13,
-        isMatch: this.filter.match
+        isMatch: this.filter.match,
+        status: this.filter.status
       };
       return param;
     },
@@ -264,8 +295,8 @@ export default {
             filter: this.filter
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
-        this.data = {}
-        this.showModal()
+      this.data = {};
+      this.showModal();
       // this.$router.push({ name: 'AddTcmdrome', params: pam });
     },
     // 修改诊断关联-跳转至编辑页面
@@ -278,8 +309,8 @@ export default {
             filter: this.filter
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
-        this.data = item
-        this.showModal()
+      this.data = item;
+      this.showModal();
       // this.$router.push({
       //   name: 'AddTcmdrome',
       //   params: Object.assign(pam, { isEdit: true, data: item })
@@ -387,19 +418,21 @@ export default {
         // }
       })
         .then(() => {
-          api.exportTcmdromeRecord({type:13,isMatch:this.filter.match}).then(res => {
-            if (res.status === 200) {
-              this.$message({ message: '导出成功', type: 'success' });
-              utils.downloadExportedData(res.data, '中医证候关联数据.xls');
-            }
-          });
+          api
+            .exportTcmdromeRecord({ type: 13, isMatch: this.filter.match })
+            .then(res => {
+              if (res.status === 200) {
+                this.$message({ message: '导出成功', type: 'success' });
+                utils.downloadExportedData(res.data, '中医证候关联数据.xls');
+              }
+            });
         })
         .catch(() => {});
     },
 
     // 导入模板
     exportModule() {
-      api.exportTcmdromeModule({type:13}).then(res => {
+      api.exportTcmdromeModule({ type: 13 }).then(res => {
         if (res.status === 200) {
           setTimeout(() => {
             utils.downloadExportedData(res.data, '中医证候导入模板.xls');
@@ -416,6 +449,11 @@ export default {
     // 导入数据
     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;
+      }
       // this.fileName = e.target.files[0].name; // 表单同步显示
       e.preventDefault();
       let formData = new FormData();
@@ -431,60 +469,145 @@ export default {
           'Content-Type': 'multipart/form-data'
         }
       };
-      this.uploadInfo = '导入中...';
-      api.importTcmdromeRecord(formData, header).then(res => {
-        // console.log('导入文件结果', '===================', res);
-        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(() => {});
+      this.importTcmdromeRecord(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.importTcmdromeRecord(formData, header);
+      //       })
+      //       .catch(() => {
+      //         setTimeout(() => {
+      //           this.uploadInfo = '导入';
+      //         }, 300);
+      //       });
+      //   } else if (res.data.data === true) {
+      //     this.importTcmdromeRecord(formData, header);
+      //   }else {
+      //     this.$alert(`${res.data.msg}`, '提示', {
+      //       confirmButtonText: '确定',
+      //       // cancelButtonText: '取消',
+      //       // cancelButtonClass: 'cancelSure',
+      //       // confirmButtonClass: 'sure',
+      //       // customClass: 'exportConfirm',
+      //       type: 'warning'
+      //     })
+      //       .then(() => {})
+      //       .catch(() => {});
+
+      //     setTimeout(() => {
+      //       this.uploadInfo = '导入';
+      //     }, 300);
+      //   }
+      // });
 
-          setTimeout(() => {
-            this.uploadInfo = '导入';
-          }, 300);
-        }
-      });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
       inp.value = '';
     },
+    importTcmdromeRecord(formData, header) {
+      let that = this;
+      api.importTcmdromeRecord(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;
@@ -567,7 +690,7 @@ export default {
     display: none;
   }
 }
-#upFileMatch{
+#upFileMatch {
   display: none;
 }
 </style>

+ 1 - 1
src/less/admin.less

@@ -117,7 +117,7 @@
 .cell .el-button:focus, .cell .el-button:hover{
   border-color: transparent;
 }
-.el-message-box__btns .el-button--default{
+.el-message-box__btns .el-button--primary {
   color: #fff;
 
 }