Commit d47fd741 authored by zhengke's avatar zhengke

修复导入 成员 bug

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