Browse Source
feat: ImportExcel组件增加直接获取文件功能,方便后端处理大Excel文件。 (#2045)
* style: 优化系统管理中账号、角色和部门表单样式
* feat: ImportExcel组件增加直接获取文件功能,方便后端处理大Excel文件。
Co-authored-by: 发光的卤蛋 <zdxndy@qq.com>
pull/2053/head
fuling
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
0 deletions
-
src/components/Excel/src/ImportExcel.vue
|
|
@ -31,6 +31,11 @@ |
|
|
type: Number, |
|
|
type: Number, |
|
|
default: 8, |
|
|
default: 8, |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 是否直接返回选中文件 |
|
|
|
|
|
isReturnFile: { |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: false, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
emits: ['success', 'error'], |
|
|
emits: ['success', 'error'], |
|
|
setup(props, { emit }) { |
|
|
setup(props, { emit }) { |
|
|
@ -140,6 +145,10 @@ |
|
|
const files = e && (e.target as HTMLInputElement).files; |
|
|
const files = e && (e.target as HTMLInputElement).files; |
|
|
const rawFile = files && files[0]; // only setting files[0] |
|
|
const rawFile = files && files[0]; // only setting files[0] |
|
|
if (!rawFile) return; |
|
|
if (!rawFile) return; |
|
|
|
|
|
if (props.isReturnFile) { |
|
|
|
|
|
emit('success', rawFile); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
upload(rawFile); |
|
|
upload(rawFile); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|