Commit 0b10b72b authored by 刘洪铨's avatar 刘洪铨

用户导入

parent 8e91088d
......@@ -157,7 +157,7 @@ export function importExcel(data) {
// 下载错误文件
export function uploadFalseFile(params) {
console.log(params)
params = Qs.stringify(params)
return request({
url: '/system/user/downFalseFile',
method: 'post',
......
......@@ -7,14 +7,14 @@ import SM4 from './gmUtil'
import errorCode from '@/utils/errorCode'
import { refreshToken } from '@/api/login.js'
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
// 超时
timeout: 100000,
headers: { 'clientType': 'fy_authority' }
timeout: 100000
// headers: { 'clientType': 'fy_authority' }
})
// let loadingInstance = ''
// request拦截器
......
......@@ -293,8 +293,6 @@
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
......@@ -302,6 +300,11 @@
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
:on-change="employeeUpload"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-preview="handlePreview"
:file-list="fileList"
drag
>
<i class="el-icon-upload" />
......@@ -422,6 +425,8 @@ export default {
pwdType: 'password',
// 遮罩层
loading: true,
// 导入列表
fileList: [],
// 选中数组
ids: [],
// 非单个禁用
......@@ -874,11 +879,11 @@ export default {
this.fileList = []
// 导入成功后关闭弹出框
this.importLoading = false
this.upload.open = true
this.upload.open = false
// 导入成功后刷新页面
this.getList()
} else {
uploadFalseFile({ filename: res.data.filename }).then(res => {
uploadFalseFile({ fileName: res.data.filename }).then(res => {
const blob = new Blob([res])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) // 创建下载的链接
......@@ -900,6 +905,24 @@ export default {
this.importLoading = false
})
}
},
employeeUpload(file, fileList) {
if (fileList.length > 1) {
fileList.splice(0, 1)
}
this.fileList = fileList[0].raw
},
handleRemove(file, fileList) {
this.fileList = []
console.log(file, fileList)
},
beforeRemove(file, fileList) {
this.fileList = []
console.log(file, fileList)
},
/* 上传文件所需求 */
handlePreview(file) {
console.log(file)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment