mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 19:06:45 +08:00
fix:增加附件上传完成后再次上传下一附件判断
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
<div>
|
||||
<Upload v-model:value="files" ref="uploadRef" :file-type="fileType">
|
||||
<div class="accessory" style="cursor: pointer">
|
||||
<button class="xkbtn" type="button">上传附件</button>
|
||||
<button v-if="againUpload" class="xkbtn" type="button">上传附件</button>
|
||||
<button v-else class="xkbtn" type="button" @click="notClick">附件上传中</button>
|
||||
</div>
|
||||
</Upload>
|
||||
<div class ="tips" style="color: rgb(153, 155, 163);">支持.pdf,.ppt,.pptx,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif,.zip</div>
|
||||
@@ -50,6 +51,7 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import {defineEmits, defineProps, ref, watch, onMounted} from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
import Upload from "./BaseUpload.vue";
|
||||
|
||||
const emit = defineEmits(["changevalue"])
|
||||
@@ -57,6 +59,7 @@ const props = defineProps({
|
||||
value: String,
|
||||
})
|
||||
const files = ref([])
|
||||
const againUpload = ref(true)
|
||||
const uploadRef = ref()
|
||||
|
||||
const fileType = ref([
|
||||
@@ -79,6 +82,20 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
watch(files, () => {
|
||||
console.log('lalalalala', files,files.value.length,files.value)
|
||||
if(files.value.length!==0){
|
||||
if(files.value[files.value.length-1].status){
|
||||
if(files.value[files.value.length-1].status=='done'){
|
||||
againUpload.value = true;
|
||||
}else{
|
||||
againUpload.value = false;
|
||||
}
|
||||
}else{
|
||||
againUpload.value = true;
|
||||
}
|
||||
}else{
|
||||
againUpload.value = true;
|
||||
}
|
||||
files.value && files.value.length && emit('update:value', files.value.filter(e => e.url).map(e => e.url).join(','))
|
||||
console.log(files.value.filter(e => e.url).map(e => e.url).join(','));
|
||||
})
|
||||
@@ -94,6 +111,15 @@ function init() {
|
||||
function del(i) {
|
||||
uploadRef.value.remove(i)
|
||||
emit('changevalue', i)
|
||||
againUpload.value = true;
|
||||
}
|
||||
|
||||
function notClick(event) {
|
||||
message.destroy();
|
||||
message.error("附件上传中,请稍后操作!");
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user