Commit d47fd741 authored by zhengke's avatar zhengke

修复导入 成员 bug

parent 93b8a7c8
......@@ -57,12 +57,15 @@
<div class="col text-dark" style="font-size: 16px">上传文件</div>
</div>
<div class="q-mt-lg">
<el-upload class="full-height full-width text-primary" drag accept=".xls,.xlsx"
<el-upload class=" text-primary" drag accept=".xls,.xlsx"
:action="getUploadActionUrl()"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
:file-list="fileList"
:limit="1"
ref="upload"
:on-exceed="handleExceed"
>
<template #trigger>
<IconUpload size="54" class=""></IconUpload>
<div class="el-upload__text">
<div style="font-size: 16px;" class="q-my-lg">成员名单仅支持 .xls .xlsx</div>
......@@ -70,11 +73,14 @@
<el-button class="ppt-button" type="primary" size="target">导入成员名单</el-button>
</div>
</div>
<template #tip></template>
</template>
<template #tip>
<div></div>
</template>
</el-upload>
</div>
<template v-if="dialogVisible">
<div class="q-mt-lg text-primary" style="font-weight: bold;">提示</div>
<div class="text-primary" style="font-weight: bold;">提示</div>
<div class="q-mt-xs row flex-between items-center" style="position: relative;">
<div>
<el-alert show-icon title="人员总数" type="info" :closable="false">
......@@ -162,7 +168,7 @@ import { ElMessage } from "element-plus"
import { storeToRefs } from "pinia"
import { ref, unref } from "vue"
import { domainManager } from '@/utils/domainManager'
import { ElAlert,UploadUserFile } from 'element-plus';
import type { ElAlert,UploadUserFile,UploadInstance, UploadProps, UploadRawFile } from 'element-plus';
const props = defineProps({
showType: {
......@@ -195,6 +201,14 @@ const closeUploadRes = () => {
const closed = () => {
emit('close')
}
const upload = ref<UploadInstance>()
const handleExceed: UploadProps['onExceed'] = (files) => {
upload.value!.clearFiles()
const file = files[0] as UploadRawFile
upload.value!.handleStart(file)
upload.value.submit()
}
const goDownload = (type:any) =>{
if(type==1) window.location.href = UploadResults.value.DownloadUrl
......@@ -209,22 +223,23 @@ const getUploadActionUrl=()=>{
}
const handleAvatarSuccess= (res:any)=>{
console.log("handleAvatarSuccess_res",res);
if(res.data){
UploadResults.value = res.data
if(res.data.successNum>0) emit('imported')
if(res.data.failUrl) UploadResults.value.DownloadUrl = domainManager().DownloadUrl.replace("common","file")+`${res.data.failUrl}`
}
console.log("handleAvatarSuccess_res",res);
}
const beforeAvatarUpload=async (res:any)=>{
console.log("beforeAvatarUpload_res",res);
const beforeAvatarUpload= (res:any)=>{
closeUploadRes()
fileList.value.push({
name: res.name,
url: ''
})
dialogVisible.value = true
console.log("beforeAvatarUpload_res",res);
// fileList.value.unshift({
// name: res.name+new Date().getTime(),
// url: ''
// })
}
const copyInviteUrlHandler = async (e: MouseEvent) => {
......@@ -255,6 +270,13 @@ const setIsAdminHandler = (isa: number) => {
</script>
<style scoped>
.InviteMember::v-deep(.el-upload-dragger) {
padding: 15px 0;
}
.InviteMember::v-deep(.el-upload-list) {
height: 20px;
overflow: hidden;
}
.InviteMember .content-item{
display: flex;
flex-direction: row;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment