diff --git a/src/views/basic/product/drug/drugMaintain.vue b/src/views/basic/product/drug/drugMaintain.vue index b792dc7..a6d15f2 100644 --- a/src/views/basic/product/drug/drugMaintain.vue +++ b/src/views/basic/product/drug/drugMaintain.vue @@ -79,14 +79,31 @@ -
+
显示/隐藏搜索栏 重置 查询 添加院内药品 - + + 药品标识上传 +
@@ -216,6 +233,7 @@ import { import drugAdd from '@/views/basic/product/drug/drugAdd' import chooseDrug from '@/views/basic/product/drug/chooseDrug' import chooseHouseDrug from '@/views/basic/product/drug/chooseHouseDrug' +import {getAdminId, getToken} from '@/utils/auth'; export default { components: {drugAdd, chooseDrug,chooseHouseDrug}, @@ -271,8 +289,15 @@ export default { allowNoSerial: null, pId: null, }, - total: 0 - + total: 0, + headers:{ + ADMINID: getAdminId(), + ADMINTOKEN: getToken() + }, + extraData:{"uuid": "upload-txt"}, + uploadLoading: false, + action: process.env.VUE_APP_BASE_API + "/udiwms/aliDrug/txtUpload", + fileList: [] } }, methods: { @@ -313,6 +338,51 @@ export default { this.thisData = val; this.chooseHouseDrugVisible = true }, + handleRemove(file, fileList) { + console.log(file, fileList); + }, + handlePreview(file) { + console.log(file); + }, + handleExceed(files, fileList) { + this.$message.warning(`当前限制选择 5 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); + }, + beforeRemove(file, fileList) { + return this.$confirm(`确定移除 ${ file.name }?`); + }, + handleSuccess(res, file, fileList) { + fileList = fileList.filter(item => item.response.code === 20000); + this.fileList = fileList; + if (res.code === 20000) { + this.$message.success(res.message); + } else { + this.$message.error(res.message); + } + this.uploadLoading.close(); + }, + beforeUpload(file) { + const isXML = file.name.endsWith('.txt'); + const isLt5M = file.size / 1024 / 1024 < 10; + if (!isXML) { + this.$message.error('上传文件只能是 TXT 格式!'); + } + if (!isLt5M) { + this.$message.error('上传文件大小不能超过 10MB!'); + } + return isXML && isLt5M; + }, + handleProgress() { + this.uploadLoading = this.$loading({ + lock: true, + text: '文件上传中…', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.5)' + }); + }, + handleError() { + this.uploadLoading.close(); + this.$message.error('文件上传失败,请检查文件大小或文件格式'); + }, getList() { getUdiInfos(this.filterQuery) .then((response) => { @@ -395,5 +465,17 @@ export default {