From 0ea8066f6bdea4e85b44189f8bf3f85c1ab57d19 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Wed, 28 Jan 2026 15:35:44 +0800
Subject: [PATCH] feat:添加按钮限制
---
applications/task-work-order/src/views/orderView/orderDataManage/dataObjection/FormDiaLog.vue | 32 +++++++++-------
applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue | 3 +
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue | 42 +++++++--------------
3 files changed, 34 insertions(+), 43 deletions(-)
diff --git a/applications/task-work-order/src/views/orderView/orderDataManage/dataObjection/FormDiaLog.vue b/applications/task-work-order/src/views/orderView/orderDataManage/dataObjection/FormDiaLog.vue
index c4e9fa1..af63222 100644
--- a/applications/task-work-order/src/views/orderView/orderDataManage/dataObjection/FormDiaLog.vue
+++ b/applications/task-work-order/src/views/orderView/orderDataManage/dataObjection/FormDiaLog.vue
@@ -178,16 +178,16 @@
<template #footer>
<template v-if="!dialogReadonly">
<el-button
- color="#F2F3F5"
+ color="#F2F3F5"
- v-if="!dialogReadonly"
- :loading="submitting"
- :disabled="submitting"
- @click="handleSubmit"
- >
- 保存
- </el-button>
- <el-button class="" color="#4C34FF" :loading="submitting" :disabled="submitting" @click="handleApply">申请</el-button>
+ v-if="!dialogReadonly"
+ :loading="submitting || uploading"
+ :disabled="submitting || uploading"
+ @click="handleSubmit"
+ >
+ 保存
+ </el-button>
+ <el-button class="" color="#4C34FF" :loading="submitting || uploading" :disabled="submitting || uploading" @click="handleApply">申请</el-button>
</template>
<template v-if="dialogReadonly && detailObjectionStatus === '1' && !requesterProvider">
<el-button color="#F2F3F5" :loading="submitting" :disabled="submitting" @click="visible = false">取消</el-button>
@@ -282,6 +282,7 @@
const fileList = ref([]) // 上传文件列表
const uploadedFiles = ref([]) // 已上传文件列表
const attachmentDetailsList = ref([])
+const uploading = ref(false) // 文件上传中状态
// 表单校验规则
const rules = {
@@ -302,6 +303,7 @@
// 自定义上传请求
const handleHttpRequest = async options => {
+ uploading.value = true
try {
const formDataObj = new FormData()
formDataObj.append('file', options.file)
@@ -314,6 +316,8 @@
} catch (error) {
options.onError(error)
console.error('文件上传失败:', error)
+ } finally {
+ uploading.value = false
}
}
@@ -330,11 +334,11 @@
ElMessage.error('只能上传压缩文件格式:.zip/.rar/.7z/.tar/.gz')
return false
}
- const maxSize = 100 * 1024 * 1024 // 100MB
- if (file.size > maxSize) {
- ElMessage.error('文件大小不能超过100MB')
- return false
- }
+ // const maxSize = 100 * 1024 * 1024 // 100MB
+ // if (file.size > maxSize) {
+ // ElMessage.error('文件大小不能超过100MB')
+ // return false
+ // }
return true
}
diff --git a/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue b/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
index 40cedcf..84e26d3 100644
--- a/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
+++ b/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
@@ -107,8 +107,8 @@
</div>
<template #footer>
<template v-if="detailDemandStatus === '1' && !requesterProvider">
- <el-button color="#F2F3F5" :loading="submitting" :disabled="submitting" @click="rejectTheApplication">拒绝申请</el-button>
- <el-button class="" color="#4C34FF" :loading="submitting" :disabled="submitting" @click="approvedByTheReview">审核通过</el-button>
+ <el-button color="#F2F3F5" :loading="submitting || uploading" :disabled="submitting || uploading" @click="rejectTheApplication">拒绝申请</el-button>
+ <el-button class="" color="#4C34FF" :loading="submitting || uploading" :disabled="submitting || uploading" @click="approvedByTheReview">审核通过</el-button>
</template>
<template v-if="detailDemandStatus === '2'">
<el-button class="" color="#4C34FF" @click="downloadAllFiles">全部下载</el-button>
@@ -155,8 +155,10 @@
const uploadedFiles = ref([]) // 已上传文件列表
const responseData = ref(null)
const submitting = ref(false) // 提交中状态
+const uploading = ref(false) // 文件上传中状态
// 自定义上传请求函数
const handleHttpRequest = async (options) => {
+ uploading.value = true
try {
// 创建FormData对象
const formData = new FormData()
@@ -164,7 +166,6 @@
// 调用导入的API函数
const response = await putFileAttachApi(formData)
- console.log('response',response)
if (response.data && response.data.success) {
// 调用上传成功的回调
options.onSuccess(response)
@@ -176,6 +177,8 @@
// 调用上传失败的回调
options.onError(error)
console.error('文件上传失败:', error)
+ } finally {
+ uploading.value = false
}
}
// 拒绝申请弹框控制
@@ -201,11 +204,11 @@
}
// 文件大小限制,这里限制为100MB
- const maxSize = 100 * 1024 * 1024 // 100MB
- if (file.size > maxSize) {
- ElMessage.error('文件大小不能超过100MB')
- return false
- }
+ // const maxSize = 100 * 1024 * 1024 // 100MB
+ // if (file.size > maxSize) {
+ // ElMessage.error('文件大小不能超过100MB')
+ // return false
+ // }
return true
}
@@ -215,7 +218,6 @@
// 添加更严格的检查,确保response不是undefined
if (response && response?.data && response?.data?.success) {
const fileData = response.data.data
- console.log('成功数据', fileData)
responseData.value = fileData
// 添加到已上传文件列表
uploadedFiles.value.push({
@@ -243,28 +245,13 @@
}
}
-// 下载文件
-const downloadFile = file => {
- if (file.link) {
- // 创建一个隐藏的a标签来触发下载
- const a = document.createElement('a')
- a.href = file.link
- a.download = file.originalName || file.name
- document.body.appendChild(a)
- a.click()
- document.body.removeChild(a)
- } else {
- ElMessage.warning('文件链接无效')
- }
-}
-
// 从表格下载文件
const downloadFileFromTable = file => {
if (file.fileUrl) {
// 创建一个隐藏的a标签来触发下载
const a = document.createElement('a')
a.href = file.fileUrl
- a.download = file.name || 'attachment'
+ a.download = file.fileOriginalName || '下载附件'
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
@@ -295,7 +282,7 @@
if (file.fileUrl) {
const a = document.createElement('a')
a.href = file.fileUrl
- a.download = file.name || `attachment_${index + 1}`
+ a.download = file.fileOriginalName || `下载附件_${index + 1}`
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
@@ -489,6 +476,5 @@
:deep(.el-upload-list) {
margin-top: 10px;
}
-.el-upload-list__item.is-success:focus .el-upload-list__item-status-label, .el-upload-list__item.is-success:hover .el-upload-list__item-status-label{
-display: none !important;}
+
</style>
diff --git a/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue b/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue
index 185bb5f..5621c62 100644
--- a/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue
+++ b/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue
@@ -357,7 +357,8 @@
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
- a.download = `机构列表${new Date().getTime()}.xlsx`
+ // `机构列表${new Date().getTime()}.xlsx`
+ a.download = `机构列表.xlsx`
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
--
Gitblit v1.9.3