设备列表上传
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :visible.sync="show" class="ems-dialog" title="点位上传" width="400px" append-to-body :close-on-click-modal="false" :close-on-press-escape="false">
|
<el-dialog :visible.sync="show" class="ems-dialog" title="点位上传" width="400px" append-to-body :close-on-click-modal="false" :close-on-press-escape="false">
|
||||||
<!-- <file-upload :fileType='["xls", "xlsx"]' value="String" :limit="1" :drag="false" @input="updateFile"/>-->
|
<!-- <file-upload :fileType='["xls", "xlsx"]' value="String" :limit="1" :drag="false" @input="updateFile"/>-->
|
||||||
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url" :data="upload.data" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||||
<i class="el-icon-upload"></i>
|
<i class="el-icon-upload"></i>
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
<div class="el-upload__tip text-center" slot="tip">
|
<div class="el-upload__tip text-center" slot="tip">
|
||||||
@ -27,22 +27,25 @@ export default {
|
|||||||
show:false,
|
show:false,
|
||||||
// 用户导入参数
|
// 用户导入参数
|
||||||
upload: {
|
upload: {
|
||||||
|
data:{},
|
||||||
// 是否禁用上传
|
// 是否禁用上传
|
||||||
isUploading: false,
|
isUploading: false,
|
||||||
// 设置上传的请求头部
|
// 设置上传的请求头部
|
||||||
headers: { Authorization: "Bearer " + getToken() },
|
headers: { Authorization: "Bearer " + getToken() },
|
||||||
// 上传的地址
|
// 上传的地址
|
||||||
url: process.env.VUE_APP_BASE_API + "/ems/pointMatch/importData"
|
url: process.env.VUE_APP_BASE_API + "/ems/pointMatch/importDataByDevice"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
showDialog(){
|
showDialog({siteId,deviceId,deviceCategory}){
|
||||||
|
this.upload.data={siteId,deviceId,deviceCategory}
|
||||||
this.show = true;
|
this.show = true;
|
||||||
},
|
},
|
||||||
//关闭弹窗 重置数据
|
//关闭弹窗 重置数据
|
||||||
handleClosed(){
|
handleClosed(){
|
||||||
this.$refs.upload.clearFiles()//写在before-closed无效
|
this.$refs.upload.clearFiles()//写在before-closed无效
|
||||||
|
this.upload.data={}
|
||||||
this.show=false
|
this.show=false
|
||||||
},
|
},
|
||||||
// updateFile(data){
|
// updateFile(data){
|
||||||
@ -51,12 +54,12 @@ export default {
|
|||||||
// saveDialog(){
|
// saveDialog(){
|
||||||
// this.show=true
|
// this.show=true
|
||||||
// },
|
// },
|
||||||
// 文件上传中处理
|
// 文件上传中处理 返回参数event, file, fileList
|
||||||
handleFileUploadProgress(event, file, fileList) {
|
handleFileUploadProgress() {
|
||||||
this.upload.isUploading = true
|
this.upload.isUploading = true
|
||||||
},
|
},
|
||||||
// 文件上传成功处理
|
// 文件上传成功处理 返回参数response, file, fileList
|
||||||
handleFileSuccess(response, file, fileList) {
|
handleFileSuccess(response) {
|
||||||
console.log('上传文件结果',response)
|
console.log('上传文件结果',response)
|
||||||
this.upload.isUploading = false
|
this.upload.isUploading = false
|
||||||
if(response.code === 500 && !response.msg) response.msg = '上传失败'
|
if(response.code === 500 && !response.msg) response.msg = '上传失败'
|
||||||
|
|||||||
@ -184,8 +184,8 @@ export default {
|
|||||||
}, `点位清单_${deviceName}_${new Date().getTime()}.xlsx`)
|
}, `点位清单_${deviceName}_${new Date().getTime()}.xlsx`)
|
||||||
},
|
},
|
||||||
// 上传点位清单
|
// 上传点位清单
|
||||||
uploadPointDetail(){
|
uploadPointDetail(row){
|
||||||
this.$refs.pointUpload.showDialog()
|
this.$refs.pointUpload.showDialog(row)
|
||||||
},
|
},
|
||||||
clearEditDeviceData(){
|
clearEditDeviceData(){
|
||||||
this.mode = '';
|
this.mode = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user