|
@@ -1,5 +1,10 @@
|
|
<template>
|
|
<template>
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
|
+ <div class="btn-box">
|
|
|
|
+ <el-button type="primary" icon="el-icon-upload" @click="onExcelDownload">导入</el-button>
|
|
|
|
+ <el-button type="primary" icon="el-icon-download" @click="onExport">导出</el-button>
|
|
|
|
+ <el-button type="primary" plain icon="el-icon-download" @click="onTemplateExport">模板导出</el-button>
|
|
|
|
+ </div>
|
|
<el-table
|
|
<el-table
|
|
v-loading="loading"
|
|
v-loading="loading"
|
|
:data="data"
|
|
:data="data"
|
|
@@ -105,6 +110,20 @@
|
|
width="200"
|
|
width="200"
|
|
show-overflow-tooltip
|
|
show-overflow-tooltip
|
|
/>
|
|
/>
|
|
|
|
+ <el-table-column
|
|
|
|
+ v-if="codes.includes('SSMC')"
|
|
|
|
+ prop="SSMC"
|
|
|
|
+ label="手术名称"
|
|
|
|
+ width="200"
|
|
|
|
+ show-overflow-tooltip
|
|
|
|
+ />
|
|
|
|
+ <el-table-column
|
|
|
|
+ v-if="codes.includes('SSBM')"
|
|
|
|
+ prop="SSBM"
|
|
|
|
+ label="手术编码"
|
|
|
|
+ width="200"
|
|
|
|
+ show-overflow-tooltip
|
|
|
|
+ />
|
|
<el-table-column
|
|
<el-table-column
|
|
v-if="codes.includes('created_at')"
|
|
v-if="codes.includes('created_at')"
|
|
prop="created_at"
|
|
prop="created_at"
|
|
@@ -134,6 +153,7 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { illnessDelete } from '@/api/knowledge'
|
|
import { illnessDelete } from '@/api/knowledge'
|
|
|
|
+import { illnessTemplateExport, illnessExport } from '@/api/excel'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
props: {
|
|
props: {
|
|
@@ -177,10 +197,54 @@ export default {
|
|
// 编辑
|
|
// 编辑
|
|
onEdit(row) {
|
|
onEdit(row) {
|
|
this.$emit('edit', row)
|
|
this.$emit('edit', row)
|
|
|
|
+ },
|
|
|
|
+ // 模板导出
|
|
|
|
+ onTemplateExport() {
|
|
|
|
+ illnessTemplateExport().then(res => {
|
|
|
|
+ const content = res.data // 后台返回二进制数据
|
|
|
|
+ const blob = new Blob([content])
|
|
|
|
+ const fileName = `疾病库模板.csv`
|
|
|
|
+ if ('download' in document.createElement('a')) { // 非IE下载
|
|
|
|
+ const elink = document.createElement('a')
|
|
|
|
+ elink.download = fileName
|
|
|
|
+ elink.style.display = 'none'
|
|
|
|
+ elink.href = URL.createObjectURL(blob)
|
|
|
|
+ document.body.appendChild(elink)
|
|
|
|
+ elink.click()
|
|
|
|
+ URL.revokeObjectURL(elink.href) // 释放URL 对象
|
|
|
|
+ document.body.removeChild(elink)
|
|
|
|
+ } else { // IE10+下载
|
|
|
|
+ navigator.msSaveBlob(blob, fileName)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 模板导出
|
|
|
|
+ onExport() {
|
|
|
|
+ illnessExport().then(res => {
|
|
|
|
+ const content = res.data // 后台返回二进制数据
|
|
|
|
+ const blob = new Blob([content])
|
|
|
|
+ const fileName = `疾病库.csv`
|
|
|
|
+ if ('download' in document.createElement('a')) { // 非IE下载
|
|
|
|
+ const elink = document.createElement('a')
|
|
|
|
+ elink.download = fileName
|
|
|
|
+ elink.style.display = 'none'
|
|
|
|
+ elink.href = URL.createObjectURL(blob)
|
|
|
|
+ document.body.appendChild(elink)
|
|
|
|
+ elink.click()
|
|
|
|
+ URL.revokeObjectURL(elink.href) // 释放URL 对象
|
|
|
|
+ document.body.removeChild(elink)
|
|
|
|
+ } else { // IE10+下载
|
|
|
|
+ navigator.msSaveBlob(blob, fileName)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
+.btn-box {
|
|
|
|
+ text-align: right;
|
|
|
|
+ margin-bottom: 15px;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|