Skip to content

Commit

Permalink
新增my-import 导入组件点击开始导入提示请选择文件
Browse files Browse the repository at this point in the history
  • Loading branch information
zhontai committed Dec 30, 2024
1 parent fec0f1f commit e3c07a8
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions ui/zhontai.ui.admin.vue3/src/components/my-import/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
:close-on-press-escape="false"
width="520px"
v-bind="$attrs"
@close="onClose"
>
<el-steps :active="state.step" simple>
<el-step title="上传文件" icon="ele-Upload" />
Expand Down Expand Up @@ -54,17 +55,18 @@
:on-success="onSuccess"
:on-error="onError"
:before-upload="onBeforeUpload"
v-model:file-list="state.fileList"
>
<template #trigger>
<el-button icon="ele-Paperclip" text bg>选择文件</el-button>
</template>
</el-upload>
<!-- <div class="mt10">请选择文件编码</div>
<div class="mt10">
<el-select v-model="state.data.fileEncoding" style="width: 220px" :size="'mini'">
<el-option v-for="status in state.fileEncodingList" :key="status.name" :label="status.name" :value="status.value" />
</el-select>
</div> -->
<div class="mt10">
<el-select v-model="state.data.fileEncoding" style="width: 220px" :size="'mini'">
<el-option v-for="status in state.fileEncodingList" :key="status.name" :label="status.name" :value="status.value" />
</el-select>
</div> -->
</div>
</div>
</div>
Expand Down Expand Up @@ -110,6 +112,7 @@ const storesUserInfo = useUserInfo()
const initState = {
token: storesUserInfo.getToken(),
showDialog: false,
fileList: [] as UploadFile[],
data: {
fileId: '',
duplicateAction: model.value.duplicateAction,
Expand Down Expand Up @@ -335,13 +338,23 @@ const open = async (row: any = {}) => {
state.showDialog = true
}
const onClose = () => {
state.fileList = []
}
// 取消
const onCancel = () => {
state.showDialog = false
}
// 开始导入
const onUpload = () => {
if (!(state.fileList?.length > 0)) {
ElMessage({
message: '请选择文件',
type: 'warning',
})
}
fileUploadRef.value!.submit()
}
Expand Down

0 comments on commit e3c07a8

Please sign in to comment.