吉安感知网项目-前端
张含笑
2026-01-30 60bd4c5ed55221a3b29ef72445af3dd134529d01
applications/task-work-order/src/views/orderView/orderDataManage/dataObjection/FormDiaLog.vue
@@ -218,6 +218,42 @@
<!--            <el-button color="#F2F3F5" :loading="submitting" :disabled="submitting" @click="visible = false">关闭</el-button>-->
         </template>
      </template>
      <!-- 申请弹框 -->
      <el-dialog
         class="gd-dialog"
         v-model="showApplyDialog"
         title="申请"
         @closed="handleApplyDialogClosed"
         width="500px"
         destroy-on-close
         :close-on-click-modal="false"
      >
         <el-form class="gd-dialog-form" ref="applyFormRef" :model="applyFormData" :rules="applyRules">
            <el-row>
               <el-col :span="24">
                  <el-form-item label="申请对象部门" prop="applyTargetDeptId">
                     <el-tree-select
                        class="gd-select"
                        popper-class="gd-tree-select-popper"
                        v-model="applyFormData.applyTargetDeptId"
                        node-key="id"
                        :data="deptTree"
                        :props="treeProps"
                        check-strictly
                        clearable
                     />
                  </el-form-item>
               </el-col>
            </el-row>
         </el-form>
         <template #footer>
            <el-button color="#F2F3F5" @click="showApplyDialog = false">取消</el-button>
            <el-button class="" color="#4C34FF" :loading="applying" :disabled="applying" @click="handleApplySubmit">
               确认
            </el-button>
         </template>
      </el-dialog>
   </el-dialog>
</template>
@@ -283,6 +319,14 @@
const attachmentDetailsList = ref([])
const uploading = ref(false) // 文件上传中状态
// 申请弹框相关
const showApplyDialog = ref(false)
const applyFormRef = ref(null)
const applying = ref(false)
const applyFormData = ref({
   applyTargetDeptId: ''
})
// 表单校验规则
const rules = {
   title: fieldRules(true),
@@ -300,6 +344,11 @@
const feedbackRules = {
   otherObjectionDetail: fieldRules(true),
   reviewOpinion: fieldRules(true),
}
// 申请弹框校验规则
const applyRules = {
   applyTargetDeptId: fieldRules(true),
}
// 自定义上传请求
@@ -430,9 +479,66 @@
   await submitForm('0')
}
// 申请提交
// 申请弹框关闭处理
function handleApplyDialogClosed() {
   applyFormData.value.applyTargetDeptId = ''
}
// 申请
async function handleApply() {
   await submitForm('1')
     formData.value.attachId = uploadedFiles.value.length > 0 ? uploadedFiles.value.length : ''
    // 先验证主表单
    const mainFormValid = await formRef.value?.validate().catch(() => false)
    if (!mainFormValid) return
    showApplyDialog.value = true
}
// 申请提交
async function handleApplySubmit() {
   const isValid = await applyFormRef.value?.validate().catch(() => false)
   if (!isValid) return
   applying.value = true
   try {
      // 构建申请数据
      const applyData = {
         ...formData.value,
         objectionStatus: '1',
         applyTargetDeptId: applyFormData.value.applyTargetDeptId
      }
      // 构建符合接口要求的提交数据
      const submitData = {
         // 编辑模式下传递id
         ...(applyData.id && { id: applyData.id }),
         title: applyData.title,
         objectionType: applyData.objectionType,
         submitter: applyData.submitter,
         submitterContact: applyData.submitterContact,
         catalogResourceName: applyData.catalogResourceName,
         objectionDesc: applyData.objectionDesc,
         objectionBasis: applyData.objectionBasis,
         areaCode: applyData.areaCode || '',
         handleUnit: applyData.handleUnit || '',
         // 构建附件列表 - 使用当前已上传的文件(包括回显的)
         ...(uploadedFiles.value.length > 0 && {
            attachmentList: uploadedFiles.value.map(file => ({
               attachId: file.attachId,
               attachName: file.originalName,
            })),
         }),
         objectionStatus: applyData.objectionStatus,
         applyTargetDeptId: applyData.applyTargetDeptId
      }
      await gdDataObjectionSubmitApi(submitData)
      ElMessage.success('申请成功')
      showApplyDialog.value = false
      visible.value = false
      emit('success')
   } finally {
      applying.value = false
   }
}
// 处理异议反馈提交
@@ -581,6 +687,8 @@
  formData.value = dialogMode.value === 'add' ? initForm() : row
  // 重置反馈表单数据
  feedbackFormData.value = initFeedbackForm()
  // 重置申请弹框数据
  applyFormData.value.applyTargetDeptId = ''
  
  if (dialogMode.value !== 'add') {
    // 如果是编辑,设置ID并加载详情