Commit f1e8e241b1f1b981ea6fecb3a83cf8b8a64ca600
Committed by
GitHub
1 parent
5833043d
feat: ImportExcel组件增加直接获取文件功能,方便后端处理大Excel文件。 (#2045)
* style: 优化系统管理中账号、角色和部门表单样式 * feat: ImportExcel组件增加直接获取文件功能,方便后端处理大Excel文件。 Co-authored-by: 发光的卤蛋 <zdxndy@qq.com>
Showing
1 changed file
with
9 additions
and
0 deletions
src/components/Excel/src/ImportExcel.vue
@@ -31,6 +31,11 @@ | @@ -31,6 +31,11 @@ | ||
31 | type: Number, | 31 | type: Number, |
32 | default: 8, | 32 | default: 8, |
33 | }, | 33 | }, |
34 | + // 是否直接返回选中文件 | ||
35 | + isReturnFile: { | ||
36 | + type: Boolean, | ||
37 | + default: false, | ||
38 | + }, | ||
34 | }, | 39 | }, |
35 | emits: ['success', 'error'], | 40 | emits: ['success', 'error'], |
36 | setup(props, { emit }) { | 41 | setup(props, { emit }) { |
@@ -140,6 +145,10 @@ | @@ -140,6 +145,10 @@ | ||
140 | const files = e && (e.target as HTMLInputElement).files; | 145 | const files = e && (e.target as HTMLInputElement).files; |
141 | const rawFile = files && files[0]; // only setting files[0] | 146 | const rawFile = files && files[0]; // only setting files[0] |
142 | if (!rawFile) return; | 147 | if (!rawFile) return; |
148 | + if (props.isReturnFile) { | ||
149 | + emit('success', rawFile); | ||
150 | + return; | ||
151 | + } | ||
143 | upload(rawFile); | 152 | upload(rawFile); |
144 | } | 153 | } |
145 | 154 |