Newer
Older
xc-business-system / src / views / resource / customer / reviewNotice / detail.vue
<!-- 授权代理委托书详情 -->
<script name="ReviewNoticeDetail" lang="ts" setup>
import { ElLoading, ElMessage, ElMessageBox, dayjs } from 'element-plus'
import type { ICustomerNoticeInfo, ISampleEquipment } from './customer-notice'
import ApprovalDialog from '@/views/resource/common/approvalDialog.vue'
import ApprovalRecordTable from '@/components/ApprovalRecord/ApprovalRecordTable.vue'
import useUserStore from '@/store/modules/user'
import { deleteReviewNotice, deleteReviewNoticeRevoked, detailSampleEqptList, failUpdateNotice, getStream, refuseApproval, revokeApproval, saveReviewNotice, sendTo, sumbitNotice, updateDraftNotice } from '@/api/resource/reviewNotice'
import type { TableColumn } from '@/components/NormalTable/table_interface'
import type { IDictType } from '@/commonInterface/resource-interface'
import { SCHEDULE } from '@/utils/scheduleDict'
import { getDictByCode } from '@/api/system/dict'
import { findDictNameByCode } from '@/commonMethods/useDictCheck'
import FilePreviewDialog from '@/components/filePreview/filePreviewDialog.vue'
import FilterCustomer from '@/views/resource/common/filterCustomer.vue'
import FilterSample from '@/views/resource/common/filterSample.vue'
import FilterCustomerStaff from '@/views/resource/common/filterCustomerStaff.vue'
import { exportFile } from '@/utils/exportUtils'
import { printPdf } from '@/utils/printUtils'
import { getBase64 } from '@/utils/download'
// 从路由中传过来的参数
const type = ref<string>('')
const id = ref<string>('')
const status = ref<string>('')

// 关键字段是否可以编辑
const keyFieldsDisable = ref<boolean>(true)

const userInfo = useUserStore()
const route = useRoute()
const router = useRouter()
const title = ref('')

const radioItems = ref([
  { name: '基本信息', value: 'notice-basic' },
  { name: '审批详情', value: 'notice-approval' },
])

const current = ref('')
const currentLabel = ref('')

const flowFormId = SCHEDULE.REVIEW_NOTICE_APPROVAL // 资源管理 - 要求、委托书及合同评审表

// 弹窗子组件
const apprDial = ref()
const noticeFormRef = ref()
const refCustomerStaffFilter = ref()
const refFilterCustomer = ref()
const refFilterSample = ref()

const noticeInfo = ref<ICustomerNoticeInfo>({
  id: '',
  customerId: '',
  customerName: '',
  deptId: '',
  labCode: '', // 实验室
  labCodeName: '', // 实验室名称
  groupCode: '', // 部门
  groupCodeName: '', // 部门名称
  noticeUserId: '',
  noticeUserName: '',
  noticeNo: '',
  noticeName: '检测结果复查通知单',
  submitDate: '',
  deviceName: '',
  deviceModel: '',
  deviceNo: '',
  returnDate: '',
  noticeDate: '',
  sampleIdList: [],
  sendStatus: '',
  approvalStatus: '',
  approvalStatusName: '',
  appealUserId: '',
  appealUserName: '',
  processId: '',
  taskId: '',
  createUserId: '',
  createUserName: '',
  createTime: '',
})

const noticeFormRules = ref({
  labCode: [{ required: true, message: '实验室不能为空', trigger: ['change', 'blur'] }],
  groupCode: [{ required: true, message: '部门不能为空', trigger: ['change', 'blur'] }],
  deptId: [{ required: true, message: '委托单位不能为空', trigger: ['change', 'blur'] }],
  returnDate: [{ required: true, message: '寄回日期不能为空', trigger: 'blur' }],
}) // 表单验证规则

// 是否显示相关按钮
const saveButtVisable = ref<boolean>(false) // 是否显示 保存 按钮
const submitButtVisable = ref<boolean>(false) // 是否显示 提交 按钮
const flowButtsVisable = ref<boolean>(false) // 是否显示 同意和拒绝 按钮
const cancelButtVisable = ref<boolean>(false) // 是否显示 取消 按钮
const deleteButtVisable = ref<boolean>(false) // 是否显示 删除 按钮
const editButtVisable = ref<boolean>(false) // 是否显示 编辑 按钮

// 字典值
const labCodeDict = ref<IDictType[]>([]) // 实验室
const groupCodeDict = ref<IDictType[]>([]) // 部门
const eqptMeterIdentifyDict = ref<IDictType[]>([])

const sampleList = ref<ISampleEquipment[]>([])
const samplesColumns = ref<TableColumn[]>([
  { text: '设备统一编号', value: 'equipmentNo', align: 'center', width: '160' },
  { text: '设备名称', value: 'equipmentName', align: 'center' },
  { text: '规格型号', value: 'model', align: 'center' },
  { text: '出厂编号', value: 'manufactureNo', align: 'center' },
  { text: '生产厂家', value: 'manufacturer', align: 'center' },
  { text: '所在单位', value: 'companyName', align: 'center', width: '160' },
  { text: '负责人', value: 'directorName', align: 'center', width: '160' },
  { text: '最近送检时间', value: 'checkDateStr', align: 'center', width: '120' },
  { text: '计量标识', value: 'meterIdentifyName', align: 'center', width: '100' },
  { text: '证书有效日期', value: 'certificateValidStr', align: 'center', width: '120' },
  { text: '检验员', value: 'measurePersonName', align: 'center', width: '120' },
])

const sampleSelectedList = ref<ISampleEquipment[]>([])

// 逻辑
// 详情页的各个tab切换操作
const radioChangeHandler = (newVal: string | number | boolean) => {
  const radioTarget = radioItems.value.filter(item => item.name === newVal)
  if (radioTarget.length > 0) {
    currentLabel.value = radioTarget[0].name
    current.value = radioTarget[0].value
  }
  else {
    currentLabel.value = radioItems.value[0].name
    current.value = radioItems.value[0].value
  }
}

// 将所有流程操作的按钮隐藏
const hideAllOpterationButtons = () => {
  saveButtVisable.value = false
  submitButtVisable.value = false
  flowButtsVisable.value = false
  cancelButtVisable.value = false
  deleteButtVisable.value = false
  editButtVisable.value = false
}

// 根据审批状态显示对应的流程操作按钮
const showOperationButtonByStatus = () => {
  switch (status.value) {
    case '1':
      // 草稿箱:保存、提交按钮可见
      saveButtVisable.value = true
      submitButtVisable.value = true
      break

    case '2':
      // 待审批:同意、拒绝按钮可见
      flowButtsVisable.value = true
      break

    case '3':
      // 审批中:取消按钮可见
      cancelButtVisable.value = true
      break

    case '5':
      // 未通过:编辑 按钮可见
      editButtVisable.value = true
      break

    case '6':
      // 已取消:编辑 删除按钮可见
      editButtVisable.value = true
      deleteButtVisable.value = true
      break

    default:
      // 默认不显示所有的操作按钮
      hideAllOpterationButtons()
      break
  }
}

// 关闭
const resetForm = () => {
  sessionStorage.removeItem('reviewNoticeInfo') // 返回列表时 将缓存中的数据删除
  router.go(-1)
}

// 查询复查设备清单详情
const getSampleEqptList = (noticeId: string) => {
  if (noticeId === '' || noticeId === undefined) {
    return
  }

  detailSampleEqptList({ id: noticeId, limit: 1000, offset: 1 }).then((res) => {
    if (res.code === 200) {
      sampleList.value = res.data.rows.map((item: ISampleEquipment) => {
        return {
          ...item,
          checkDateStr: dayjs(item.checkDate).format('YYYY-MM-DD') === 'Invalid Date' ? '' : dayjs(item.checkDate).format('YYYY-MM-DD'),
          certificateValidStr: dayjs(item.certificateValid).format('YYYY-MM-DD') === 'Invalid Date' ? '' : dayjs(item.certificateValid).format('YYYY-MM-DD'),
          meterIdentifyName: findDictNameByCode(item.meterIdentify, eqptMeterIdentifyDict.value),
        }
      })
    }
  })
}

// 保存至草稿箱
const saveNoticeInfo = () => {
  noticeInfo.value.createTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss') // 创建时间改为提交时间
  saveReviewNotice(noticeInfo.value).then((res) => {
    if (res.code === 200) {
      // 提示保存成功
      ElMessage.success('保存成功')
      // 设置返回的委托方id和委托方编号
      noticeInfo.value.noticeNo = res.data.noticeNo
      noticeInfo.value.id = res.data.id
      id.value = res.data.id

      // type.value = 'update'
      status.value = '1' // 保存成功后进入草稿箱 为了不显示审批详情
    }
    else {
      // 提示失败信息
      ElMessage.error(`保存失败:${res.message}`)
    }
  })
}

// 编辑草稿箱(不走流程审批)
const updateNoticeInfo = () => {
  updateDraftNotice(noticeInfo.value).then((res) => {
    if (res.code === 200) {
      // 提示保存成功
      ElMessage.success('保存成功')
    }
    else {
      // 提示失败信息
      ElMessage.error(`保存失败:${res.message}`)
    }
  })
}

// 编辑按钮点击事件处理函数
const editClickedHandler = () => {
  type.value = 'update'
  title.value = '检测结果复查通知单(编辑)'

  // 隐藏编辑按钮 显示提交按钮
  editButtVisable.value = false
  submitButtVisable.value = true
}

// 新建时保存后的处理 获取返回的id
const saveButtonHandler = async () => {
  if (!sampleList.value.length) {
    ElMessage.warning('复查设备清单不能为空')
    return
  }

  noticeInfo.value.sampleIdList = sampleList.value.map((item) => {
    return item.id
  })

  // 对表单进行校验
  await noticeFormRef.value.validate((valid: boolean, fields: any) => {
    if (valid === true) {
      ElMessageBox.confirm(
        '确认保存吗?',
        '提示',
        {
          confirmButtonText: '确认',
          cancelButtonText: '取消',
          type: 'warning',
        },
      ).then(() => {
        if (type.value === 'create') {
          saveNoticeInfo()
        }
        else if (type.value === 'update') {
          updateNoticeInfo()
        }
      })
    }
  })
}

// 提交按钮
const submitButtonHandler = async () => {
  if (noticeInfo.value === null || noticeInfo.value.processId === undefined || noticeInfo.value.processId === '') {
    // 流程id为空 表示还未进入流程中 直接提交
    ElMessageBox.confirm(`是否提交通知单 ${noticeInfo.value.noticeNo}`, '提示', {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning',
    }).then(() => {
      sumbitNotice({
        formId: flowFormId,
        id: noticeInfo.value.id,
      }).then((res) => {
        if (res.code === 200) {
          ElMessage.success(`通知单 ${noticeInfo.value.noticeNo} 提交成功`)

          type.value = 'detail'
          hideAllOpterationButtons()
        }
        else {
          ElMessage.error(`通知单 ${noticeInfo.value.noticeNo} 提交失败:${res.message}`)
        }
      })
    })
  }
  else {
    // 之前已经在流程中的表单 保存提交
    if (sampleList.value.length === 0) {
      ElMessage.warning('复检设备不能为空,请重新选择')
      return
    }

    noticeInfo.value.sampleIdList = sampleList.value.map((item) => {
      return item.id
    })

    await noticeFormRef.value.validate((valid: boolean) => {
      if (valid === true) {
        failUpdateNotice(noticeInfo.value).then((res) => {
          if (res.code === 200) {
          // 提示保存成功
            ElMessage.success(`通知单 ${noticeInfo.value.noticeNo} 提交成功`)

            type.value = 'detail'
            hideAllOpterationButtons()
          }
          else {
          // 提示失败信息
            ElMessage.error(`通知单 ${noticeInfo.value.noticeNo} 提交失败:${res.message}`)
          }
        })
      }
    })
  }
}

// 流程审批-同意
const approvalAgreeHandler = () => {
  apprDial.value.initDialog('agree', noticeInfo.value.id, noticeInfo.value.taskId || route.query.taskId, '')
}

// 流程审批-拒绝
const approvalRefuseHandler = () => {
  apprDial.value.initDialog('refuse', noticeInfo.value.id, noticeInfo.value.taskId || route.query.taskId, '')
}

// 取消(撤回审批单)
const revokeClickedHandler = () => {
  apprDial.value.initDialog('revoke', noticeInfo.value.id, noticeInfo.value.taskId || route.query.taskId, noticeInfo.value.processId)
}

// 删除(只有已取消的可以在详情中删除)
const deleteClickedHandler = () => {
  ElMessageBox.confirm(
    `确认删除通知单 ${noticeInfo.value.noticeNo} 吗?`,
    '提示',
    {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning',
    },
  ).then(() => {
    if (status.value === '0') {
      // 草稿箱删除
      deleteReviewNotice({ id: noticeInfo.value.id }).then((res) => {
        if (res.code === 200) {
          ElMessage.success(`通知单 ${noticeInfo.value.noticeNo} 删除成功`)
          resetForm()
        }
        else {
          ElMessage.error(`通知单 ${noticeInfo.value.noticeNo} 删除失败:${res.message}`)
        }
      })
    }
    else if (status.value === '6') {
      // 已取消删除
      deleteReviewNoticeRevoked({ id: noticeInfo.value.id, taskId: noticeInfo.value.taskId || route.query.taskId }).then((res) => {
        if (res.code === 200) {
          ElMessage.success(`通知单 ${noticeInfo.value.noticeNo} 删除成功`)
          resetForm()
        }
        else {
          ElMessage.error(`通知单 ${noticeInfo.value.noticeNo} 删除失败:${res.message}`)
        }
      })
    }
  })
}

const sampleMultiSelect = (e: any) => {
  sampleSelectedList.value = e
}

// 弹窗选择复检设备
const addEditableRow = () => {
  noticeFormRef.value.validateField('deptId', (valid: boolean, fields: any) => {
    if (valid === true) {
      refFilterSample.value.showOrHideFilterDialog(true, noticeInfo.value.deptId, noticeInfo.value.customerName)
    }
    else {
      ElMessage.warning('请先选择委托方')
    }
  })
}

// 删除所选复检设备
const delSelectRows = () => {
  if (sampleList.value.length === 0 && sampleList.value.length === 0) {
    ElMessage.warning('请至少选择一行')
    return
  }
  // 前端界面删除
  sampleList.value = sampleList.value.filter(item => sampleSelectedList.value.includes(item) === false)
}

// 点击 发送 按钮
const sendToCustomer = () => {
  refCustomerStaffFilter.value.showOrHideFilterDialog(true, noticeInfo.value.customerName)
}

const sysUserSelectedHandler = (row: any) => {
  refCustomerStaffFilter.value.showOrHideFilterDialog(false)

  if (row.id !== '') {
    sendTo({ id: noticeInfo.value.id, noticeUserId: row.id }).then((res) => {
      if (res.code === 200) {
        // 提示保存成功
        ElMessage.success(`发送到送检单位 ${noticeInfo.value.customerName} 的 ${row.name} 成功`)
      }
      else {
        // 提示失败信息
        ElMessage.error(`通知单发送至送检单位失败:${res.message}`)
      }
    })
  }
  else {
    ElMessage.error('发送至人员不能为空,请重新选择')
  }
}

const showCustomerFilter = () => {
  refFilterCustomer.value.showOrHideFilterDialog(true)
}

const customerSelectedHandler = (row: any) => {
  refFilterCustomer.value.showOrHideFilterDialog(false)

  if (row.id !== '') {
    noticeInfo.value.customerId = row.id
    noticeInfo.value.deptId = row.deptId
    noticeInfo.value.customerName = row.customerName
  }
  else {
    ElMessage.error('委托单位不能为空,请重新选择')
  }
}

// 弹窗选择复检设备后处理
const sampleSelectedHandler = (rows: Array<ISampleEquipment>) => {
  rows.forEach((row) => {
    const target = sampleList.value.filter(item => item.id === row.id)
    if (target.length === 0) {
      sampleList.value.push(row)
    }
  })
}

// 流程操作之后刷新
const approvalSuccessHandler = (type: string) => {
  if (type === 'agree' || type === 'refuse') {
    flowButtsVisable.value = false
  }
  else if (type === 'revoke') {
    cancelButtVisable.value = false
  }
}

// 取消
const noticeRevokeHandler = (param: any) => {
  revokeApproval(param).then((res) => {
    if (res.code === 200) {
      ElMessage.success('流程取消成功')
    }
    else {
      ElMessage.error(`流程取消失败:${res.message}`)
    }
    // 关闭弹窗
    apprDial.value.handleClose()

    cancelButtVisable.value = false
  })
}

// 拒绝
const noticeRefuseHandler = (param: any) => {
  refuseApproval(param).then((res) => {
    if (res.code === 200) {
      ElMessage.success('拒绝审批完成')
    }
    else {
      ElMessage.error(`拒绝审批失败:${res.message}`)
    }
    // 关闭弹窗
    apprDial.value.handleClose()

    flowButtsVisable.value = false
  })
}

// ==================================================字典==========================================
const getLabCodeDict = async () => { // 实验室
  // 先从缓存中获取
  if (sessionStorage.getItem('bizLabCode') === null || sessionStorage.getItem('bizLabCode') === undefined) {
    // 缓存中没有则调用接口查询
    await getDictByCode('bizLabCode').then((res) => {
      if (res.code === 200) {
        labCodeDict.value = res.data
        sessionStorage.setItem('bizLabCode', JSON.stringify(labCodeDict.value)) // 放到缓存中
      }
    })
  }
  else {
    labCodeDict.value = JSON.parse(sessionStorage.getItem('bizLabCode')!)
  }
}
// 部门
const getGroupCodeDict = () => {
  getDictByCode('bizGroupCode').then((response) => {
    groupCodeDict.value = response.data
  })
}
// ========================================================================================================

const getEqptMeterIdentifyDict = async () => {
  // 先从缓存中获取
  if (sessionStorage.getItem('eqptMeterIdentify') === null || sessionStorage.getItem('eqptMeterIdentify') === undefined) {
    // 缓存中没有则调用接口查询
    await getDictByCode('eqptMeterIdentify').then((res) => {
      if (res.code === 200) {
        eqptMeterIdentifyDict.value = res.data
        sessionStorage.setItem('eqptMeterIdentify', JSON.stringify(eqptMeterIdentifyDict.value)) // 放到缓存中
      }
    })
  }
  else {
    eqptMeterIdentifyDict.value = JSON.parse(sessionStorage.getItem('eqptMeterIdentify')!)
  }
}

const initDialog = (params: any) => {
  // 从路由中获取参数
  type.value = params.type
  id.value = params.id !== undefined ? params.id : ''
  status.value = params.status

  // 默认显示第一个tab内容
  current.value = radioItems.value[0].value
  currentLabel.value = radioItems.value[0].name

  getSampleEqptList(id.value)

  switch (params.type) {
    case 'create' :
      title.value = '检测结果复查通知单(新增)'
      saveButtVisable.value = true
      submitButtVisable.value = true

      sessionStorage.removeItem('reviewNoticeInfo')

      noticeInfo.value.createUserId = userInfo.id
      noticeInfo.value.createUserName = userInfo.name
      noticeInfo.value.createTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
      noticeInfo.value.noticeDate = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')

      // 新建时部门和实验室代码可以编辑
      keyFieldsDisable.value = false
      break
    case 'update':
      title.value = '检测结果复查通知单(编辑)'

      noticeInfo.value = JSON.parse(sessionStorage.getItem('reviewNoticeInfo')!)

      // 判断显示哪些流程操作按钮
      showOperationButtonByStatus()
      keyFieldsDisable.value = true
      break
    case 'detail':
      title.value = '检测结果复查通知单(详情)'
      id.value = params.id

      noticeInfo.value = JSON.parse(sessionStorage.getItem('reviewNoticeInfo')!)

      // 查看详情时所有的操作按钮都隐藏
      showOperationButtonByStatus()
      keyFieldsDisable.value = true
      break
    default:
      title.value = ''
      keyFieldsDisable.value = true
      break
  }
}

const refFilePreviewDlg = ref() // 预览组件ref
// 点击预览
const preview = () => {
  const loading = ElLoading.service({
    lock: true,
    text: '加载中...',
    background: 'rgba(255, 255, 255, 0.6)',
  })
  getStream({ id: id.value, pdf: true }).then((res) => {
    refFilePreviewDlg.value.initDialogContent(res.data)
    loading.close()
  })
}

const initDict = () => {
  getLabCodeDict() // 获取实验室
  getGroupCodeDict() // 获取部门
  getEqptMeterIdentifyDict()
}

// 监听 显示中文
watch(() => noticeInfo.value.labCode, (newVal) => {
  labCodeDict.value = JSON.parse(sessionStorage.getItem('bizLabCode')!)

  if (labCodeDict.value.length > 0) {
    const targetList = labCodeDict.value.filter(item => item.value === newVal)
    if (targetList.length > 0) {
      noticeInfo.value.labCodeName = targetList[0].name
    }
    else {
      noticeInfo.value.labCodeName = ''
    }
  }
})

watch(() => status.value, (val) => {
  if (val === '1' || type.value === 'create') { // 草稿箱、新建把审批详情删了
    if (radioItems.value[radioItems.value.length - 1].value === 'notice-approval') {
      radioItems.value.pop()
    }
    console.log(radioItems.value)
  }
  else { // 非全部和草稿箱把审批详情加上
    if (radioItems.value[radioItems.value.length - 1].value !== 'notice-approval') {
      radioItems.value.push({ name: '审批详情', value: 'notice-approval' })
    }
  }
})

onMounted(() => {
  initDict()
  initDialog(route.query)
})
</script>

<template>
  <app-container>
    <el-form ref="noticeFormRef" :model="noticeInfo" :rules="noticeFormRules" label-position="right" label-width="110px" border stripe>
      <detail-page :title="`${title}`">
        <template #btns>
          <template v-if="type === 'detail' && status === '4'">
            <el-button type="primary" @click="sendToCustomer">
              发送给受检单位
            </el-button>
          </template>

          <el-button v-if="editButtVisable" type="primary" @click="editClickedHandler()">
            编辑
          </el-button>

          <template v-if="flowButtsVisable">
            <el-button type="primary" @click="approvalAgreeHandler">
              同意
            </el-button>
            <el-button type="danger" @click="approvalRefuseHandler">
              拒绝
            </el-button>
          </template>

          <el-button v-if="submitButtVisable" :disabled="id === ''" type="primary" @click="submitButtonHandler">
            提交
          </el-button>
          <el-button v-if="saveButtVisable" type="primary" :disabled="type === 'create' && id !== ''" @click="saveButtonHandler">
            保存
          </el-button>

          <el-button v-if="deleteButtVisable" type="danger" @click="deleteClickedHandler">
            删除
          </el-button>
          <el-button v-if="cancelButtVisable" type="info" @click="revokeClickedHandler">
            取消
          </el-button>
          <el-button :disabled="id === ''" type="primary" @click="preview">
            预览
          </el-button>
          <el-button type="info" @click="resetForm()">
            关闭
          </el-button>
        </template>

        <el-radio-group v-model="currentLabel" @change="radioChangeHandler">
          <el-radio-button v-for="item in radioItems" :key="item.value" :label="item.name" :disabled="id === ''" />
        </el-radio-group>
      </detail-page>
      <detail-block v-if="current === 'notice-basic'" title="">
        <el-row :gutter="24">
          <!-- 第一行 第一列 -->
          <el-col :span="6">
            <el-form-item label="实验室" prop="labCode">
              <el-select v-model="noticeInfo.labCode" placeholder="请选择实验室" :disabled="keyFieldsDisable" style="width: 100%;">
                <el-option v-for="dict in labCodeDict" :key="dict.id" :label="dict.name" :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="部门" prop="groupCode">
              <el-select v-model="noticeInfo.groupCode" placeholder="请选择部门" :disabled="keyFieldsDisable" style="width: 100%;">
                <el-option v-for="dict in groupCodeDict" :key="dict.id" :label="dict.name" :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="文件编号">
              <el-input v-model="noticeInfo.noticeNo" placeholder="文件编号,保存后自动生成" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="文件名称">
              <el-input v-model="noticeInfo.noticeName" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="6">
            <el-form-item label="委托方" prop="deptId">
              <el-input v-model="noticeInfo.customerId" type="hidden" />
              <el-input v-model="noticeInfo.deptId" type="hidden" />
              <el-input v-model="noticeInfo.customerName" placeholder="请选择委托单位" :disabled="true">
                <template #append>
                  <el-button size="small" :disabled="type === 'detail'" @click="showCustomerFilter">
                    选择
                  </el-button>
                </template>
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="要求寄回时间" prop="returnDate">
              <el-date-picker
                v-model="noticeInfo.returnDate" type="date"
                format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss"
                placeholder="请选择寄回时间" :clearable="true" :disabled="type === 'detail'"
                style="width: 100%;"
              />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="创建人">
              <el-input v-model="noticeInfo.noticeName" type="hidden" />
              <el-input v-model="noticeInfo.createUserId" type="hidden" />
              <el-input v-model="noticeInfo.createUserName" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="创建时间">
              <el-input v-model="noticeInfo.createTime" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
      </detail-block>
      <detail-block v-if="current === 'notice-basic'" title="">
        <table-container title="复查设备清单">
          <template v-if="type !== 'detail'" #btns-right>
            <el-button type="primary" @click="addEditableRow()">
              批量增加
            </el-button>
            <el-button type="info" @click="delSelectRows()">
              删除行
            </el-button>
          </template>

          <el-table :data="sampleList" border style="width: 100%;" @selection-change="sampleMultiSelect">
            <el-table-column v-if="type !== 'detail'" type="selection" align="center" width="38" />
            <el-table-column align="center" label="序号" width="60" type="index" />
            <el-table-column
              v-for="item in samplesColumns"
              :key="item.value"
              :prop="item.value"
              :label="item.text"
              :width="item.width"
              align="center"
            >
              <template #default="scope">
                <span v-if="!scope.row.editable">{{ scope.row[item.value] }}</span>
                <el-input v-else v-model="scope.row[item.value]" :autofocus="true" :placeholder="`${item.text}`" class="input" />
              </template>
            </el-table-column>
          </el-table>
        </table-container>
      </detail-block>
    </el-form>

    <approval-dialog
      ref="apprDial"
      @on-success="approvalSuccessHandler"
      @on-refuse="noticeRefuseHandler"
      @on-revoke="noticeRevokeHandler"
    />

    <template v-if="current === 'notice-approval' && status !== '1'">
      <approval-record-table :process-id="noticeInfo.processId" />
    </template>

    <filter-customer-staff ref="refCustomerStaffFilter" title="请选择送检单位的接收人" @record-selected="sysUserSelectedHandler" />

    <filter-customer ref="refFilterCustomer" @record-selected="customerSelectedHandler" />
    <!-- 文件预览组件 -->
    <file-preview-dialog ref="refFilePreviewDlg" />
    <filter-sample ref="refFilterSample" @records-selected="sampleSelectedHandler" />
  </app-container>
</template>