diff --git a/ant-design-vue-jeecg/src/views/system/monitor/ApkInfoList.vue b/ant-design-vue-jeecg/src/views/system/monitor/ApkInfoList.vue index 98b07f5..7428e40 100644 --- a/ant-design-vue-jeecg/src/views/system/monitor/ApkInfoList.vue +++ b/ant-design-vue-jeecg/src/views/system/monitor/ApkInfoList.vue @@ -38,7 +38,20 @@ <!-- 操作按钮区域 --> <div class="table-operator"> - <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> + <a-upload + name="file" + :multiple="false" + :action="uploadAction" + :headers="tokenHeader" + :showUploadList="false" + :beforeUpload="beforeUpload" + @change="handleChange"> + <a-button> + <a-icon type="upload"/> + 上传APK + </a-button> + </a-upload> + <!--<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>--> <a-button type="primary" icon="download" @click="handleExportXls('apk_info')">导出</a-button> <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> <a-button type="primary" icon="import">导入</a-button> @@ -188,7 +201,8 @@ deleteBatch: "/monitor/apkinfo/deleteBatch", exportXlsUrl: "/monitor/apkinfo/exportXls", importExcelUrl: "monitor/apkinfo/importExcel", - + upload: "/sys/common/upload", + }, dictOptions:{}, superFieldList:[], @@ -198,11 +212,41 @@ this.getSuperFieldList(); }, computed: { + uploadAction() { + return window._CONFIG['domianURL'] + this.url.upload; + }, importExcelUrl: function(){ return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; }, }, methods: { + beforeUpload(file) { + var fileType = file.type; + if (fileType === 'image') { + if (fileType.indexOf('image') < 0) { + this.$message.warning('请上传图片'); + return false; + } + } else if (fileType === 'file') { + if (fileType.indexOf('image') >= 0) { + this.$message.warning('请上传文件'); + return false; + } + } + return true + }, + handleChange(info) { + if (info.file.status === 'done') { + if (info.file.response.success) { + this.loadData() + this.$message.success(`${info.file.name} 上传成功!`); + } else { + this.$message.error(`${info.file.response.message}`); + } + } else if (info.file.status === 'error') { + this.$message.error(`${info.file.response.message}`); + } + }, initDictConfig(){ }, getSuperFieldList(){