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