公共导入、工器具

This commit is contained in:
cwchen 2025-11-03 11:16:26 +08:00
parent 5e3a8b358f
commit afcece44ea
2 changed files with 23 additions and 8 deletions

View File

@ -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() {

View File

@ -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',
},
}
},