吉安感知网项目-前端
张含笑
2026-01-20 5fb7c18beead1966147fb639c422b7f373170164
feat:更新
4 files modified
134 ■■■■■ changed files
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue 95 ●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/auditRecord.vue 9 ●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/index.vue 24 ●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/reasonForRejectionDialog.vue 6 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
@@ -9,9 +9,9 @@
            <div class="detail-right">
                <!--                拒绝申请-->
                <div class="reject-reason-container" v-if="detailDemandStatus === '3'">
                    <div class="label">拒绝原因 </div>
                    <div class="label">拒绝原因</div>
                    <div class="reject-reason">
                        这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因
                        {{reasonForRejection}}
                    </div>
                </div>
                <div>
@@ -81,9 +81,9 @@
                        </div>
                    </div>
                </div>
<!--                申请中-->
                <!--                申请中-->
                <div v-if="detailDemandStatus === '1'">
                    <div class="label">数据上传 </div>
                    <div class="label">数据上传</div>
                    <div class="upload-container">
                        <el-upload
                            ref="uploadRef"
@@ -119,22 +119,30 @@
                    </div>
                </div>
                <div v-if="detailDemandStatus === '2'">
                    <div class="label">数据详情 </div>
                    <div class="label">数据详情</div>
                    <el-table :data="tableData" border style="width: 100%">
                        <el-table-column prop="name" label="文件名称"  />
                        <el-table-column prop="fileSize" label="文件大小"  />
                        <el-table-column prop="fileOriginalName" label="文件名称" />
                        <el-table-column prop="fileSize" label="文件大小" />
                        <el-table-column fixed="right" label="操作" min-width="100">
                    <template #default="scope">
                        <el-button link type="text" @click="downloadFileFromTable(scope.row)">下载</el-button>
                    </template>
                </el-table-column>
                            <template #default="scope">
                                <el-button link type="text" @click="downloadFileFromTable(scope.row)">下载</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </div>
            </div>
        </div>
        <template #footer>
            <el-button class="save-btn" color="#4C34FF" @click="rejectTheApplication">拒绝申请</el-button>
            <el-button color="#F2F3F5" @click="approvedByTheReview">审核通过</el-button>
            <template v-if="detailDemandStatus === '1'">
                <el-button class="save-btn" color="#4C34FF" @click="rejectTheApplication">拒绝申请</el-button>
                <el-button color="#F2F3F5" @click="approvedByTheReview">审核通过</el-button>
            </template>
            <template v-if="detailDemandStatus === '2'">
                <el-button class="save-btn" color="#4C34FF" @click="downloadAllFiles">全部下载</el-button>
            </template>
            <template v-if="detailDemandStatus === '3'">
                <el-button class="save-btn" color="#4C34FF" @click="visible =false">关闭</el-button>
            </template>
        </template>
    </el-dialog>
@@ -153,7 +161,7 @@
    putFileAttachApi,
    gdSupplyDemandAuditPassApi,
    gdSupplyDemandAuditRejectApi,
    gdSupplyDemandAuditAttachmentListApi
    gdSupplyDemandAuditAttachmentListApi,
} from '@/views/orderView/orderDataManage/supplyAdd/supplyAddApi'
import { ElMessage } from 'element-plus'
import reasonForRejectionDialog from '@/views/orderView/orderDataManage/supplyAdd/reasonForRejectionDialog.vue'
@@ -163,6 +171,7 @@
const dictObj = inject('dictObj')
const deptTree = inject('deptTree')
const detailDemandStatus = inject('detailDemandStatus')
const reasonForRejection = inject('reasonForRejection')
const demandId = ref('')
const visible = defineModel() // 弹框显隐
const formData = ref({}) // 表单数据
@@ -301,6 +310,37 @@
    }
}
// 下载所有文件
const downloadAllFiles = () => {
    if (!tableData.value || tableData.value.length === 0) {
        ElMessage.warning('没有可下载的文件')
        return
    }
    // 统计有效文件数量
    const validFiles = tableData.value.filter(file => file.fileUrl)
    if (validFiles.length === 0) {
        ElMessage.warning('所有文件链接均无效')
        return
    }
    ElMessage.success(`开始下载${validFiles.length}个文件`)
    // 依次下载每个文件(添加延迟以避免浏览器限制)
    validFiles.forEach((file, index) => {
        setTimeout(() => {
            if (file.fileUrl) {
                const a = document.createElement('a')
                a.href = file.fileUrl
                a.download = file.name || `attachment_${index + 1}`
                document.body.appendChild(a)
                a.click()
                document.body.removeChild(a)
            }
        }, index * 300) // 300ms delay between downloads
    })
}
// 根据部门ID获取部门名称
function getDeptNameById(deptId, deptList) {
    // 处理类型转换,确保比较的是相同类型
@@ -345,7 +385,7 @@
        data.responsibleDeptName = getDeptNameById(data.responsibleDeptId, deptTree.value)
    }
    formData.value = data
    // 加载附件数据
    await loadAttachments(id)
}
@@ -353,15 +393,15 @@
// 加载附件数据
async function loadAttachments(demandId) {
    try {
        const res = await gdSupplyDemandAuditAttachmentListApi({ demandId:demandId })
        const res = await gdSupplyDemandAuditAttachmentListApi({ demandId: demandId })
        const attachments = res?.data?.data ?? []
        // 格式化附件数据以匹配表格结构
        tableData.value = attachments.map(attachment => ({
            name: attachment.attachId ? `附件ID: ${attachment.attachId}` : '未知附件',
            fileSize: attachment.fileSize ? `${attachment.fileSize}M` : '未知大小',
            fileOriginalName: attachment.fileOriginalName ,
            fileSize: attachment.fileSize ? `${attachment.fileSize}M` : '',
            fileUrl: attachment.fileUrl,
            id: attachment.id
            id: attachment.id,
        }))
    } catch (error) {
        console.error('加载附件数据失败:', error)
@@ -430,12 +470,13 @@
    width: 75%;
    .reject-reason {
        margin-bottom: 20px;
        background: #F2F3F5;
        background: #f2f3f5;
        border-radius: 2px 2px 2px 2px;
        padding: 15px;
        height: 100px;
    }
    .requirementsDetailsBox {
        background: #F2F3F5;
        background: #f2f3f5;
        border-radius: 2px 2px 2px 2px;
    }
@@ -481,20 +522,20 @@
/* 上传容器样式 */
.upload-container {
    padding: 15px;
    background: #F2F3F5;
    background: #f2f3f5;
    border-radius: 2px 2px 2px 2px;
}
.uploaded-files {
    margin-top: 15px;
    h4 {
        margin-bottom: 10px;
        font-size: 14px;
        color: #333333;
        font-weight: 500;
    }
    .file-item {
        display: flex;
        align-items: center;
@@ -502,7 +543,7 @@
        background: white;
        border-radius: 4px;
        margin-bottom: 5px;
        span {
            flex: 1;
            color: #333;
@@ -527,4 +568,4 @@
:deep(.el-upload-list) {
    margin-top: 10px;
}
</style>
</style>
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/auditRecord.vue
@@ -23,6 +23,7 @@
  }
})
const detailDemandStatus = inject('detailDemandStatus')
const reasonForRejection = inject('reasonForRejection')
// 步骤条数据
const steps = ref([
  { title: '需求申请', person: '', time: '' },
@@ -44,6 +45,11 @@
  try {
    const res = await gdSupplyDemandAuditListApi({ demandId })
    const auditRecords = res?.data?.data ?? []
    // 查找拒绝原因(auditStatus为2的记录的auditOpinion)
    const rejectedRecord = auditRecords.find(record => record.auditStatus === '2')
    reasonForRejection.value = rejectedRecord?.auditOpinion || ''
    console.log('reasonForRejection', reasonForRejection.value)
    
    // 处理审核记录为步骤格式
    processAuditRecords(auditRecords)
@@ -51,6 +57,7 @@
    console.error('加载审核记录失败:', error)
    // 保持默认步骤
    activeStep.value = 0
    reasonForRejection.value = ''
  }
}
@@ -94,7 +101,7 @@
    
    // 添加审核意见(如果有)
    if (latestRecord.auditOpinion) {
      steps.value[1].title += ` - ${latestRecord.auditOpinion}`
      steps.value[1].title
    }
    
    // 更新审核步骤的信息
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/index.vue
@@ -37,13 +37,16 @@
        <div class="gd-table-toolbar">
            <el-button :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">供需填报新增</el-button>
<!--            <el-button :icon="Delete" color="#4C34FF" :disabled="!selectedIds.length" @click="handleDelete()">删除</el-button>-->
        </div>
        <div class="gd-table-container" v-loading="loading">
            <div class="gd-table-content gd-table-content-bg">
                <el-table class="gd-table" :data="list" @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="46" />
                <el-table class="gd-table" :data="list">
                    <el-table-column label="序号" width="60" align="center">
                <template #default="scope">
                    {{ ((searchParams.current - 1) * searchParams.size + scope.$index + 1).toString().padStart(2, '0') }}
                </template>
            </el-table-column>
                    <el-table-column prop="demandName" show-overflow-tooltip label="需求名称" />
                    <el-table-column prop="demandType" show-overflow-tooltip label="需求类型">
                        <template v-slot="{ row }">
@@ -125,7 +128,6 @@
const total = ref(0) // 总条数
const loading = ref(true) // 列表加载中
const list = ref([]) // 列表数据
const selectedIds = ref([]) // 勾选的ID列表
const queryParamsRef = ref(null) // 查询表单实例
const dialogRef = ref(null) // 弹框实例
const dialogVisible = ref(false)
@@ -147,6 +149,8 @@
provide('treeProps', treeProps)
const detailDemandStatus = ref('')
provide('detailDemandStatus', detailDemandStatus)
const reasonForRejection = ref('') //拒绝原因
provide('reasonForRejection', reasonForRejection)
// 根据部门ID获取部门名称
function getDeptNameById(deptId, deptList) {
    if (!deptId || !Array.isArray(deptList)) return ''
@@ -220,24 +224,18 @@
// 删除
async function handleDelete(row) {
    const tips = row ? '该条' : '选中的项'
    await ElMessageBox.confirm(`确认删除${tips}吗?`, '提示', {
    await ElMessageBox.confirm('确认删除该条记录吗?', '提示', {
        type: 'warning',
        customClass: 'gd-confirm-custom',
        confirmButtonClass: 'gd-confirm-button',
        cancelButtonClass: 'gd-confirm-cancel-button',
    })
    const ids = row ? row.id : selectedIds.value.join(',')
    await gdSupplyDemandRemoveApi({ ids })
    await gdSupplyDemandRemoveApi({ ids: row.id })
    ElMessage.success('删除成功')
    selectedIds.value = []
    getList()
}
// 勾选值设置
function handleSelectionChange(rows) {
    selectedIds.value = rows.map(item => item.id)
}
// 获取字典
function getDictList() {
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/reasonForRejectionDialog.vue
@@ -15,7 +15,6 @@
            </div>
        </div>
        <template #footer>
            <!-- <el-button @click="handleCancel">取消</el-button> -->
            <el-button class="save-btn" color="#4C34FF" @click="handleConfirm">确认</el-button>
        </template>
    </el-dialog>
@@ -53,11 +52,6 @@
    }
)
// 取消按钮点击事件
const handleCancel = () => {
    visible.value = false
    reasonForRejection.value = ''
}
// 确认按钮点击事件
const handleConfirm = () => {