|
@@ -15,6 +15,7 @@
|
|
|
/>
|
|
|
<el-button icon="Search" type="primary" @click="queryInfo">查询</el-button>
|
|
|
<el-button type="success" @click="addInfo">添加</el-button>
|
|
|
+ <el-button type="primary" @click="centerDialogVisible=true">批量导入</el-button>
|
|
|
</header>
|
|
|
<div class="layout_main layout_el-table">
|
|
|
<el-table :data="asideTableData"
|
|
@@ -84,6 +85,41 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <el-dialog
|
|
|
+ v-model="centerDialogVisible"
|
|
|
+ title="批量导入"
|
|
|
+ width="500"
|
|
|
+ align-center
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ ref="upload"
|
|
|
+ accept=".xlsx,.xls"
|
|
|
+ :action="apiUrl + '/opLevelManagement/uploadOpLevelManagement'"
|
|
|
+ :headers="header"
|
|
|
+ :file-list="fileList"
|
|
|
+ :limit="1"
|
|
|
+ :on-exceed="fileSizeOutLimit"
|
|
|
+ :on-success="uploadSuccess"
|
|
|
+ :on-error="uploadError"
|
|
|
+ :auto-upload="false"
|
|
|
+ >
|
|
|
+ <template #trigger>
|
|
|
+ <el-button type="primary" icon="Picture">选取文件</el-button>
|
|
|
+ </template>
|
|
|
+ <el-button style="margin-left: 10px" type="success" icon="Upload" @click="submitUpload">上传</el-button>
|
|
|
+ <template #tip>
|
|
|
+ <div class="el-upload__tip">只能上传 xls/xlsx 文件</div>
|
|
|
+ </template>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="centerDialogVisible = false">关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="OprtDoctorLevel">
|
|
@@ -99,6 +135,38 @@ import {
|
|
|
} from '@/api/dictionary/oprt-lecel'
|
|
|
import {ElMessage} from 'element-plus'
|
|
|
import PageLayer from "@/layout/PageLayer";
|
|
|
+import {ref} from "vue";
|
|
|
+import {useUserStore} from "@/pinia/user-store";
|
|
|
+import {formatYear} from "@/utils/date";
|
|
|
+
|
|
|
+const centerDialogVisible = ref(false)
|
|
|
+
|
|
|
+const fileList = ref([])
|
|
|
+const apiUrl = import.meta.env.VITE_BASE_URL
|
|
|
+const upload = ref(null)
|
|
|
+const header = {
|
|
|
+ token: useUserStore().getToken,
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+const fileSizeOutLimit = () => {
|
|
|
+ ElMessage.error('已经选取excel,如须更换请先移除已选取的excel!')
|
|
|
+}
|
|
|
+const uploadSuccess = (response) => {
|
|
|
+ console.log('response',response)
|
|
|
+ if(response.code ==200){
|
|
|
+ ElMessage.success('上传成功!')
|
|
|
+ }else {
|
|
|
+ ElMessage.error('上传失败,错误信息:'+response.message)
|
|
|
+ }
|
|
|
+}
|
|
|
+const uploadError = (error,file,fileList) => {
|
|
|
+ ElMessage.error('上传失败!')
|
|
|
+}
|
|
|
+const submitUpload = () => {
|
|
|
+ upload.value.submit()
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
const innerHeight = window.innerHeight
|
|
|
const asideQueryParam = ref({
|