吉安感知网项目-前端
张含笑
2026-01-20 a67c63741fe925b05db2505e3f5bd297b6a5032d
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
@@ -1,11 +1,5 @@
<template>
   <el-dialog
      class="gd-dialog"
      v-model="visible"
      :title="'查看申请'"
      @closed="visible = false"
      destroy-on-close
   >
   <el-dialog class="gd-dialog" v-model="visible" :title="'查看申请'" @closed="visible = false" destroy-on-close>
   <div class="detail-container">
      <!-- 左侧步骤条 -->
      <div class="detail-left">
@@ -105,17 +99,10 @@
                 <el-button type="primary">选择文件</el-button>
               </template>
               <template #tip>
                 <div class="el-upload__tip">
                  请上传压缩文件 (.zip/.rar/.7z/.tar/.gz)
                 </div>
                        <div class="el-upload__tip">请上传压缩文件 (.zip/.rar/.7z/.tar/.gz)</div>
               </template>
              </el-upload>
              <el-button
               type="success"
               :disabled="!selectedFile"
               @click="handleUpload"
               style="margin-top: 10px;"
              >
                  <el-button type="success" :disabled="!selectedFile" @click="handleUpload" style="margin-top: 10px">
               上传文件
              </el-button>
              
@@ -124,28 +111,17 @@
               <h4>已上传文件:</h4>
               <div v-for="(file, index) in uploadedFiles" :key="index" class="file-item">
                 <span>{{ file.originalName }}</span>
                 <el-button type="text" @click="viewFile(file)" style="margin-left: 10px;">查看</el-button>
                 <el-button type="text" @click="downloadFile(file)" style="margin-left: 5px;">下载</el-button>
                        <el-button type="text" @click="viewFile(file)" style="margin-left: 10px">查看</el-button>
                        <el-button type="text" @click="downloadFile(file)" style="margin-left: 5px">下载</el-button>
               </div>
              </div>
            </div>
         </div>
      </div>
   </div>
      <template #footer>
         <el-button
            class="save-btn"
            color="#4C34FF"
            @click="rejectTheApplication"
         >
            拒绝申请
         </el-button>
         <el-button class="save-btn" color="#4C34FF" @click="rejectTheApplication">拒绝申请</el-button>
         <el-button color="#F2F3F5"  @click="approvedByTheReview">审核通过</el-button>
      </template>
   </el-dialog>
@@ -160,10 +136,15 @@
<script setup>
import { ref, inject } from 'vue'
import { getDictLabel } from '@ztzf/utils'
import { gdSupplyDemandDetailApi, putFileAttachApi,gdSupplyDemandAuditPassApi,gdSupplyDemandAuditRejectApi } from '@/views/orderView/orderDataManage/supplyAdd/supplyAddApi'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
   gdSupplyDemandDetailApi,
   putFileAttachApi,
   gdSupplyDemandAuditPassApi,
   gdSupplyDemandAuditRejectApi,
} from '@/views/orderView/orderDataManage/supplyAdd/supplyAddApi'
import { ElMessage } from 'element-plus'
import reasonForRejectionDialog from './reasonForRejectionDialog.vue'
const emit = defineEmits(['success'])
const dictObj = inject('dictObj')
const deptTree = inject('deptTree')
const demandId = ref('')
@@ -200,7 +181,7 @@
}
// 上传前验证
const beforeFileUpload = (file) => {
const beforeFileUpload = file => {
  const allowedExtensions = ['.zip', '.rar', '.7z', '.tar', '.gz']
  const fileExtension = '.' + file.name.split('.').pop().toLowerCase()
  
@@ -243,14 +224,14 @@
    
    if (response.data && response.data.success) {
      const fileData = response.data.data
      console.log('成功数据',fileData);
         console.log('成功数据', fileData)
     responseData.value = fileData
      // 添加到已上传文件列表
      uploadedFiles.value.push({
        name: fileData.name,
        originalName: fileData.originalName,
        link: fileData.link,
        attachId: fileData.attachId
            attachId: fileData.attachId,
      })
      
      ElMessage.success('文件上传成功!')
@@ -261,7 +242,6 @@
      
      // 这里可以将附件ID保存到表单数据中,供后续提交使用
      // formData.value.attachmentId = fileData.attachId
    } else {
      ElMessage.error(response.data?.msg || '文件上传失败')
    }
@@ -274,7 +254,7 @@
}
// 查看文件
const viewFile = (file) => {
const viewFile = file => {
  if (file.link) {
    window.open(file.link, '_blank')
  } else {
@@ -283,7 +263,7 @@
}
// 下载文件
const downloadFile = (file) => {
const downloadFile = file => {
  if (file.link) {
    // 创建一个隐藏的a标签来触发下载
    const a = document.createElement('a')
@@ -328,8 +308,7 @@
   if (row?.id) {
      await loadDetail(row.id)
      demandId.value = row.id
      console.log('row.id',demandId.value);
      console.log('row.id', demandId.value)
   }
   visible.value = true
}
@@ -345,18 +324,6 @@
   formData.value = data
}
// 如果需要加载已上传的文件列表
const loadUploadedFiles = async (id) => {
  try {
    // 这里根据实际情况调用接口获取已上传的文件列表
    // const response = await getFileListApi({ id })
    // if (response.data?.success) {
    //   uploadedFiles.value = response.data.data || []
    // }
  } catch (error) {
    console.error('加载已上传文件失败:', error)
  }
}
// 拒绝申请
const rejectTheApplication = () => {
   if(responseData.value.length === 0){
@@ -367,16 +334,20 @@
}
// 处理拒绝申请确认
const handleRejectionConfirm = (reason) => {
const handleRejectionConfirm = reason => {
   const id = [responseData.value.attachId]
   console.log('demandId.value',demandId.value);
   console.log('demandId.value', demandId.value)
   
   gdSupplyDemandAuditRejectApi({ attachIds: id, auditOpinion: reason ,demandId:'2013137230848598018'}).then(() => {
   gdSupplyDemandAuditRejectApi({ attachIds: id, auditOpinion: reason, demandId: demandId.value })
      .then(() => {
      ElMessage.success('拒绝申请成功')
      visible.value = false
   }).catch(error => {
         emit('success')
      })
      .catch(error => {
      console.error('拒绝申请失败:', error)
      ElMessage.error('拒绝申请失败,请重试')
         emit('success')
   })
}
// 审核通过
@@ -385,9 +356,10 @@
      return ElMessage.warning('请上传数据')
   }
   const id = [responseData.value.attachId]
   gdSupplyDemandAuditPassApi({ id }).then(() => {
   gdSupplyDemandAuditPassApi({ attachIds: id, demandId: demandId.value }).then(() => {
      ElMessage.success('审核通过成功')
      visible.value = false
      emit('success')
   })
}