验证中...
Languages: JavaScript
Categories: JavaScript 工具
Latest update 2019-07-15 10:44
1.将MESReadExcel.ashx放入通讯服务器中并发布
Raw Copy
路径: C:\通讯服务器V3.1\MES_Manage\submit
2.在前台准备一个上传组件
Raw Copy
<template>
<div>
<el-upload
class="upload-demo"
drag
:action="action"
:on-success="uploadSuccess"
:show-file-list="showFileList"
:file-list="fileList"
multiple>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
</el-upload>
</div>
</template>
<script>
import axios from 'axios'
export default {
data(){
return{
fileList: [],
showFileList: true,
action: '',
}
},
created(){
this.action = `http://localhost:8411/submit/MESReadExcel.ashx?SheetIndex=0&HeadRowsCount=1&BodyStartRowsCount=2&IsEnd=1&BodyEndRowCount=3`
},
methods:{
uploadSuccess(res, file, fileList) {
console.log(res, file, fileList)
}
}
},
uploadFailure(a, file, fileList) {
fileList.map(file => {
this.$message.error(`${file.name}文件上传失败,请检查上传文件是否正确!`)
})
}
</script>
3.参数说明
Raw Copy
请求地址 http://localhost:8411/submit/MESReadExcel.ashx // MESReadExcel.ashx的发布地址
参数1:SheetIndex 第几张sheet表 第一张是 0
参数2:HeadRowsCount 表头开始行(只能有一行表头)
参数3:BodyStartRowsCount 表体的开始行
参数4:IsEnd 是否设置结束行 设置为1,不设置为0
参数5:BodyEndRowCount 表体结束行,若IsEnd设置为0则填随意数字,若IsEnd为1则BodyEndRowCount为表体的结束行

Comment list( 0 )

You need to Sign in for post a comment

Help Search

183227_9af5e6a8_1826025 111910_4d91f001_1826025