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 | 31 | type: Number, |
32 | 32 | default: 8, |
33 | 33 | }, |
34 | + // 是否直接返回选中文件 | |
35 | + isReturnFile: { | |
36 | + type: Boolean, | |
37 | + default: false, | |
38 | + }, | |
34 | 39 | }, |
35 | 40 | emits: ['success', 'error'], |
36 | 41 | setup(props, { emit }) { |
... | ... | @@ -140,6 +145,10 @@ |
140 | 145 | const files = e && (e.target as HTMLInputElement).files; |
141 | 146 | const rawFile = files && files[0]; // only setting files[0] |
142 | 147 | if (!rawFile) return; |
148 | + if (props.isReturnFile) { | |
149 | + emit('success', rawFile); | |
150 | + return; | |
151 | + } | |
143 | 152 | upload(rawFile); |
144 | 153 | } |
145 | 154 | ... | ... |