fix : 修复项目归档五个附件上传功能、提示框、文件多选上传、详情驳回/同意路由跳转问题
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
:headers="headers"
|
||||
:limit="maxSize"
|
||||
with-credentials
|
||||
:multiple="maxSize > 0"
|
||||
:multiple="multiple"
|
||||
:data="uploadParams"
|
||||
:show-file-list="showFileList"
|
||||
:auto-upload="true"
|
||||
@@ -19,8 +19,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ElMessage,ElMessageBox} from "element-plus";
|
||||
import { ElMessageBox, ElNotification} from "element-plus";
|
||||
import {getToken} from '@/utils/auth'
|
||||
|
||||
const baseURL = import.meta.env.VITE_BASE_URL
|
||||
const uploadFileUrl = ref(baseURL + "/workflow/process/file/upload")
|
||||
const headers = reactive({
|
||||
@@ -43,13 +44,16 @@ const props = defineProps({
|
||||
showFileList: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},disabled: {
|
||||
}, disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}, multiple: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(["input", "getFile","delete"])
|
||||
const emit = defineEmits(["input", "getFile", "delete"])
|
||||
const fileList = ref([])
|
||||
const _value = computed({
|
||||
get() {
|
||||
@@ -59,7 +63,7 @@ const _value = computed({
|
||||
emit("input", val);
|
||||
}
|
||||
})
|
||||
const beforeRemove = (file, fileList) => {
|
||||
const beforeRemove = (file) => {
|
||||
return ElMessageBox.confirm(`确认删除名称为${file.name}的文件吗?`, '系统提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
@@ -67,38 +71,32 @@ const beforeRemove = (file, fileList) => {
|
||||
}).then(() => true)
|
||||
}
|
||||
|
||||
const handleRemove = (file, fileList) => {
|
||||
emit("delete",file.response.data.id)
|
||||
const handleRemove = (file) => {
|
||||
emit("delete", file.response.data.id)
|
||||
}
|
||||
const beforeUpload = (file) => {
|
||||
// const FileExt = file.name.replace(/.+\./, "");
|
||||
// if (['zip', 'rar', 'pdf', 'doc', 'docx', 'xlsx'].indexOf(FileExt.toLowerCase()) === -1) {
|
||||
// ElMessage.warning('请上传后缀名为pdf、doc、docx、xlsx、zip或rar的文件!');
|
||||
// return false;
|
||||
// } else
|
||||
// if (props.maxSize > 0 && file.size / 1024 / 1024 > props.maxSize) {
|
||||
// ElMessage.warning(`每个文件最大不超过 ${props.maxSize}MB`)
|
||||
// } else {
|
||||
const beforeUpload = () => {
|
||||
loading.value = true
|
||||
return true
|
||||
// }
|
||||
}
|
||||
const handleUploadSuccess = (res, file) => {
|
||||
if (res.code !== 1000) {
|
||||
loading.value = false
|
||||
ElMessage.error("上传失败")
|
||||
} else {
|
||||
loading.value = false
|
||||
ElMessage.success("上传成功")
|
||||
}
|
||||
const handleUploadSuccess = (res) => {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.code === 1000 ? '上传成功' : '上传失败',
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
loading.value = false
|
||||
showTable.value = true
|
||||
let data = res.data
|
||||
fileList.value.push(data)
|
||||
emit("getFile", res.data)
|
||||
}
|
||||
const uploadError=(err)=>{
|
||||
const uploadError = () => {
|
||||
loading.value = false
|
||||
ElMessage.error("上传失败,请稍后再试!")
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: "上传失败,请稍后再试!",
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -108,6 +106,7 @@ a {
|
||||
font-size: 14px;
|
||||
color: #2a99ff;
|
||||
}
|
||||
|
||||
:deep(.el-upload-list) {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user