|
11 | 11 | @close="reset" |
12 | 12 | > |
13 | 13 | <a-form ref="formRef" :model="form" size="large" auto-label-width> |
14 | | - <a-alert v-if="!form.disabled" :show-icon="false" style="margin-bottom: 15px"> |
15 | | - 数据导入请严格按照模板填写,格式要求和新增一致! |
| 14 | + <a-alert v-if="!form.disabled" style="margin-bottom: 15px"> |
| 15 | + 请按照模板要求填写数据,填写完毕后,请先上传并进行解析。 |
16 | 16 | <template #action> |
17 | | - <a-button size="small" type="primary" @click="downloadTemplate">下载模板</a-button> |
| 17 | + <a-link @click="downloadTemplate"> |
| 18 | + <template #icon><GiSvgIcon name="file-excel" :size="16" /></template> |
| 19 | + <template #default>下载模板</template> |
| 20 | + </a-link> |
18 | 21 | </template> |
19 | 22 | </a-alert> |
20 | 23 | <fieldset> |
21 | | - <legend>1.上传解析文件</legend> |
| 24 | + <legend>1.解析数据</legend> |
22 | 25 | <div class="file-box"> |
23 | 26 | <a-upload |
24 | 27 | draggable |
|
85 | 88 | <script setup lang="ts"> |
86 | 89 | import { type FormInstance, Message, type RequestOption } from '@arco-design/web-vue' |
87 | 90 | import { useWindowSize } from '@vueuse/core' |
88 | | -import { type UserImportResp, downloadImportUserTemplate, importUser, parseImportUser } from '@/apis/system' |
| 91 | +import { |
| 92 | + type UserImportResp, |
| 93 | + downloadUserImportTemplate, |
| 94 | + importUser, |
| 95 | + parseImportUser, |
| 96 | +} from '@/apis/system/user' |
89 | 97 | import { useDownload, useForm } from '@/hooks' |
90 | 98 |
|
91 | 99 | const emit = defineEmits<{ |
@@ -129,7 +137,7 @@ const onImport = () => { |
129 | 137 |
|
130 | 138 | // 下载模板 |
131 | 139 | const downloadTemplate = () => { |
132 | | - useDownload(() => downloadImportUserTemplate()) |
| 140 | + useDownload(() => downloadUserImportTemplate()) |
133 | 141 | } |
134 | 142 |
|
135 | 143 | // 上传解析导入数据 |
@@ -160,11 +168,12 @@ const handleUpload = (options: RequestOption) => { |
160 | 168 | const save = async () => { |
161 | 169 | try { |
162 | 170 | if (!dataResult.value.importKey) { |
| 171 | + Message.warning('请先上传文件,解析导入数据') |
163 | 172 | return false |
164 | 173 | } |
165 | 174 | form.importKey = dataResult.value.importKey |
166 | 175 | const res = await importUser(form) |
167 | | - Message.success(`导入成功,新增${res.data.insertRows},修改${res.data.updateRows}`) |
| 176 | + Message.success(`导入成功! 新增${res.data.insertRows}, 修改${res.data.updateRows}`) |
168 | 177 | emit('save-success') |
169 | 178 | return true |
170 | 179 | } catch (error) { |
|
0 commit comments