公共导入、工器具
This commit is contained in:
parent
5e3a8b358f
commit
afcece44ea
|
|
@ -5,7 +5,7 @@
|
|||
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="headers"
|
||||
:action="uploadUrl + '?updateSupport=' + updateSupport" :disabled="isUploading"
|
||||
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :on-error="handleFileError"
|
||||
:before-upload="beforeUpload" :auto-upload="false" drag class="custom-upload">
|
||||
:before-upload="beforeUpload" :on-change="handleFileChange" :auto-upload="false" drag :data="params" class="custom-upload">
|
||||
<div class="upload-content">
|
||||
<i class="el-icon-upload upload-icon"></i>
|
||||
<div class="upload-text">
|
||||
|
|
@ -56,6 +56,10 @@ export default {
|
|||
type: String,
|
||||
default: '20MB',
|
||||
},
|
||||
params:{
|
||||
type:Object,
|
||||
default:()=>{}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -64,7 +68,8 @@ export default {
|
|||
updateSupport: 0,
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + getToken()
|
||||
}
|
||||
},
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -105,6 +110,10 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
// 添加文件变化监听
|
||||
handleFileChange(file, fileList) {
|
||||
this.fileList = fileList
|
||||
},
|
||||
// 文件上传前的验证
|
||||
beforeUpload(file) {
|
||||
// 验证文件大小
|
||||
|
|
@ -170,11 +179,11 @@ export default {
|
|||
},
|
||||
// 提交上传
|
||||
handleSubmit() {
|
||||
if (!this.$refs.upload.fileList || this.$refs.upload.fileList.length === 0) {
|
||||
if (this.fileList.length > 0) {
|
||||
this.$refs.upload.submit()
|
||||
} else {
|
||||
this.$message.warning('请先选择要上传的文件')
|
||||
return
|
||||
}
|
||||
this.$refs.upload.submit()
|
||||
},
|
||||
// 关闭对话框
|
||||
handleClose() {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<template slot="tableActions">
|
||||
<el-button @click="handleModelExport" v-hasPermi="['enterpriseLibrary:tool:add']"
|
||||
class="add-btn">导入模板下载</el-button>
|
||||
<el-button @click="handleBathchImport" v-hasPermi="['enterpriseLibrary:tool:add']"
|
||||
<el-button @click="handleBathchImport" v-hasPermi="['enterpriseLibrary:tool:import']"
|
||||
class="add-btn">批量导入</el-button>
|
||||
<el-button @click="handleAdd" v-hasPermi="['enterpriseLibrary:tool:add']" class="add-btn"><i
|
||||
class="el-icon-plus"></i> 新增工器具</el-button>
|
||||
|
|
@ -37,6 +37,7 @@
|
|||
style="color: #DB3E29;" @click="handleDelete(data)">
|
||||
删除
|
||||
</el-button>
|
||||
|
||||
</template>
|
||||
</TableModel>
|
||||
</div>
|
||||
|
|
@ -53,6 +54,7 @@
|
|||
@upload-success="handleImportSuccess"
|
||||
@close="handleImportClose"
|
||||
:maxFileTips="maxFileTips"
|
||||
:params = "params"
|
||||
/>
|
||||
</el-card>
|
||||
</template>
|
||||
|
|
@ -65,6 +67,7 @@ import { listAPI, delDataAPI } from '@/api/enterpriseLibrary/tool/tool'
|
|||
import { encryptWithSM4, decryptWithSM4 } from '@/utils/sm'
|
||||
import { downloadFileWithLoading } from '@/utils/download'
|
||||
import ImportExcelDialog from '@/views/common/ImportExcelDialog'
|
||||
const IMPORT_URL = '/smartBid/mainDatabase/tool/importData';
|
||||
export default {
|
||||
name: 'Tool',
|
||||
components: {
|
||||
|
|
@ -82,10 +85,13 @@ export default {
|
|||
isflag: false,
|
||||
isAdd: '',
|
||||
row: {},
|
||||
maxFileTips:'200MB',
|
||||
maxFileTips:'20MB',
|
||||
importExcelDialogVisible: false,
|
||||
// 批量导入上传地址(需要根据实际API接口修改)
|
||||
importExcelDialogUploadUrl: process.env.VUE_APP_BASE_API + '/smartBid/mainDatabase/tool/importData',
|
||||
importExcelDialogUploadUrl: process.env.VUE_APP_BASE_API + IMPORT_URL,
|
||||
params:{
|
||||
enterpriseId: decryptWithSM4(this.$route.query.enterpriseId) || '0',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue