Browse Source

上传状态

shibei_master
13176889840 4 years ago
parent
commit
7ff2b8c9c0
  1. 42
      src/views/modules/base/resi.vue

42
src/views/modules/base/resi.vue

@ -24,7 +24,7 @@
:before-upload="beforeExcelUpload" :before-upload="beforeExcelUpload"
:http-request="uploadHttpRequest" :http-request="uploadHttpRequest"
> >
<el-button type="danger" size="small">导入人口数据</el-button> <el-button type="danger" size="small" :loading="importLoading">{{importBtnTitle}}</el-button>
</el-upload> </el-upload>
</div> </div>
@ -233,6 +233,8 @@ export default {
}, },
data() { data() {
return { return {
importBtnTitle: '导入人员数据',
importLoading: false,
rowVisible: false, rowVisible: false,
tableLoading: false, tableLoading: false,
btnLoading: false, btnLoading: false,
@ -392,23 +394,27 @@ export default {
return fileType && isLt1M return fileType && isLt1M
}, },
uploadHttpRequest(file) { uploadHttpRequest(file) {
const formData = new FormData() //FormDataappend('key', value) this.importLoading = true
formData.append('file', file.file) // this.importBtnTitle = '正在上传中...'
this.$http const formData = new FormData() //FormDataappend('key', value)
.post('/epmetuser/icresiuser/importExcel', formData) formData.append('file', file.file) //
.then(({ data: res }) => { this.$http
// if(res.code === 0) { .post('/epmetuser/icresiuser/importExcel', formData)
// // this.$refs.upload.submit() .then(({ data: res }) => {
// file.onSuccess() // if(res.code === 0) {
// console.log('res-ooooo---', res) // // this.$refs.upload.submit()
// } // file.onSuccess()
console.log('res-ooooo---', res) // console.log('res-ooooo---', res)
this.download(res, 'info.xlsx') // }
}) this.importLoading = false
.catch( err => { this.importBtnTitle = '导入人员数据'
console.log('失败', err) console.log('res-ooooo---', res)
param.onError() // this.download(res, 'info.xlsx')
}) })
.catch( err => {
console.log('失败', err)
param.onError() //
})
}, },
handleClick(tab, event) { handleClick(tab, event) {
console.log(tab, event) console.log(tab, event)

Loading…
Cancel
Save