Newer
Older
xc-business-system / src / views / resource / file / methodConfirm / detail.vue
<!-- 委托方意见登记表详情 -->
<script name="FileMethodConfirmDetail" lang="ts" setup>
import { ElLoading, ElMessage, ElMessageBox, dayjs } from 'element-plus'
import { method } from 'lodash-es'
import type { IFileMethodConfirm } from './confirm-interface'
import FileSelectDialog from './selectMethodDialog.vue'
import type { IDictType } from '@/commonInterface/resource-interface'
import type { TableColumn } from '@/components/NormalTable/table_interface'
import type { IFileInfo as IMethodFileInfo } from '@/views/resource/technology/method/method-interface'
import { getFileMethodList } from '@/api/resource/fileTechnology'
import ApprovalDialog from '@/components/Approval/ApprovalDialogCustom.vue'
import selectApproverDialog from '@/components/ApprovalCustom/selectApproverDialog.vue'
import customApproval from '/public/config/customApproval.json'
import ApprovalRecordTable from '@/components/ApprovalRecord/ApprovalRecordTable.vue'
import useUserStore from '@/store/modules/user'
import { getDictByCode } from '@/api/system/dict'
import { UploadFile } from '@/api/file'
import { detailMethodConfig, failUpdateMethodConfirm, refuseApproval, rejectApproval, revokeApproval, revokeDelete, saveMethodConfirm, submitMethodConfirm, updateDraftMethodConfirm } from '@/api/resource/fileConfirm'
const $route = useRoute()

// 从路由中传过来的参数
const type = ref<string>('')
const id = ref<string>('')
const status = ref<string>('')
const decisionItem = ref('')

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

const flowFormId = 'zyglffqrdjb' // 资源管理 - 方法确认登记表

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

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

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

// 弹窗子组件
const apprDial = ref()
const methodConfirmRef = ref()
const refFileSelect = ref()

const methodConfirmRules = ref({
  labCode: [{ required: true, message: '实验室代码不能为空,请选择', trigger: ['change', 'blur'] }],
  groupCode: [{ required: true, message: '部门不能为空,请选择', trigger: ['change', 'blur'] }],
  fileDistributeNo: [{ required: true, message: '文件发放号不能为空', trigger: ['change', 'blur'] }],
  fileNo: [{ required: true, message: '检测或校准方法不能为空,请选择', trigger: 'blur' }],
  measureItem: [{ required: true, message: '检测或校准项目不能为空', trigger: 'blur' }],
  methodIllustration: [{ required: true, message: '方法及说明不能为空', trigger: 'blur' }],
  reviewTeam: [{ required: true, message: '评审组成员不能为空', trigger: 'blur' }],
  minioFileName: [{ required: true, message: '附件不能为空', trigger: 'blur' }],
  fileName: [{ required: true, message: '文件名称不能为空', trigger: 'blur' }],
  enableTime: [{ required: true, message: '启用时间不能为空', trigger: 'blur' }],
  params: [{ required: true, message: '开展量传参数不能为空', trigger: 'blur' }],
  environmentRequire: [{ required: true, message: '环境条件要求不能为空', trigger: 'blur' }],
  temperatureHighLimit: [{ required: true, message: '温度要求上限不能为空', trigger: 'blur' }],
  temperatureLowLimit: [{ required: true, message: '温度要求下限不能为空', trigger: 'blur' }],
  humidityLowLimit: [{ required: true, message: '湿度要求下限不能为空', trigger: 'blur' }],
  humidityHighLimit: [{ required: true, message: '湿度要求上限不能为空', trigger: 'blur' }],
  deptName: [{ 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 methodConfirm = ref<IFileMethodConfirm>({
  id: '',
  formNo: '',
  formName: '方法确认登记表',
  fileId: '',
  fileNo: '',
  fileName: '',
  measureItem: '',
  methodIllustration: '',
  minioFileName: '',
  reviewTeam: '',
  labCode: '',
  labCodeName: '',
  groupCode: '',
  groupCodeName: '',
  processId: '',
  taskId: '',
  createTime: '',
  createUserId: '',
  createUserName: '',
  fileDistributeNo: '',
  enableTime: '',
  params: '',
  environmentRequire: '',
  temperatureHighLimit: '',
  temperatureLowLimit: '',
  humidityHighLimit: '',
  humidityLowLimit: '',
  remark: '',
  noveltyId: '',
  deptName: '',
})
const fileColumns = ref<Array<TableColumn>>([
  { text: '文件类型', value: 'categoryName', align: 'center', width: '300' },
  { text: '文件编号', value: 'fileNo', align: 'center', width: '200' },
  { text: '文件名称', value: 'fileName', align: 'center' },
]) // 表头

// 字典值
const labCodeDict = ref<IDictType[]>([])
const groupCodeDict = ref<IDictType[]>([])

// 逻辑
// 详情页的各个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 = () => {
  router.go(-1)
}

// 新增
const addEditableRow = () => {
  refFileSelect.value.showRecordDialog(true, '新增')
}

// 根据id查询详情
const detailById = async (id: string) => {
  await detailMethodConfig({ id }).then((res) => {
    if (res.code === 200) {
      methodConfirm.value = res.data
      if (methodConfirm.value.taskId === '') {
        methodConfirm.value.taskId = sessionStorage.getItem('methodConfirmTaskId')!
      }
    }
  })
}

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

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

// 编辑草稿箱(不走流程审批)
const updateFileMethodConfirm = () => {
  updateDraftMethodConfirm(methodConfirm.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 (!methodConfirmRef) { return }

  await methodConfirmRef.value.validate((valid: boolean, fields: any) => {
    if (valid === true) {
      ElMessageBox.confirm(
        '确认保存吗?',
        '提示',
        {
          confirmButtonText: '确认',
          cancelButtonText: '取消',
          type: 'warning',
        },
      ).then(() => {
        if (type.value === 'create') {
          saveFileMethodConfirm()
        }
        else if (type.value === 'update') {
          updateFileMethodConfirm()
        }
      })
    }
  })
}

// -----------------------------------提交-------------------------------------------------------
const selectApproverRef = ref() // 审批人自选组件ref
// 选好审批人
const confirmSelectApprover = async (approverList: string[] = []) => {
  if (!approverList.length) {
    ElMessage.warning('无审批人,无法提交!')
    return false
  }
  if (methodConfirm.value === null || methodConfirm.value.processId === undefined || methodConfirm.value.processId === '') {
    // 流程id为空 表示还未进入流程中 直接提交
    ElMessageBox.confirm(`是否提交方法确认登记表 ${methodConfirm.value.formNo}`, '提示', {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning',
    }).then(() => {
      submitMethodConfirm({
        formId: flowFormId,
        id: methodConfirm.value.id,
        processId: methodConfirm.value.processId,
        assignees: approverList,
      }).then((res) => {
        if (res.code === 200) {
          ElMessage.success(`方法确认登记表 ${methodConfirm.value.formNo} 提交成功`)

          type.value = 'detail'
          hideAllOpterationButtons()
        }
        else {
          ElMessage.error(`方法确认登记表 ${methodConfirm.value.formNo} 提交失败:${res.message}`)
        }
      })
    })
  }
  else {
    // 之前已经在流程中的表单 保存提交
    await methodConfirmRef.value.validate((valid: boolean) => {
      if (valid === true) {
        const param = {
          ...methodConfirm.value,
          processId: methodConfirm.value.processId,
          assignees: approverList,
        }
        failUpdateMethodConfirm(param).then((res) => {
          if (res.code === 200) {
            // 提示保存成功
            ElMessage.success(`方法确认登记表 ${methodConfirm.value.formNo} 提交成功`)

            type.value = 'detail'
            hideAllOpterationButtons()
          }
          else {
            // 提示失败信息
            ElMessage.error(`方法确认登记表 ${methodConfirm.value.formNo} 提交失败:${res.message}`)
          }
        })
      }
    })
  }
}
// 提交按钮
const submitButtonHandler = () => {
  selectApproverRef.value.initDialog()
}
// -----------------------------------提交-------------------------------------------------------

// 显示筛选委托方名录的弹窗
const showFilterMethod = () => {
  refFileSelect.value.initDialog()
}

// 选定文件返回
const methodFileSelected = (row1: any, row2: any) => {
  // row1 测试校准检定方法查新记录表 row2 测试校准检定方法
  // console.log(row1, 'row1')
  // console.log(row2, 'row2')
  getFileMethodList({ offset: 1, limit: 99999 }).then((res) => {
    const data = res.data.rows.filter((item: any) => item.id === row2[0].fileId)
    if (data.length) {
      methodConfirm.value.fileId = data[0].id
      methodConfirm.value.fileNo = data[0].fileNo
      methodConfirm.value.fileName = data[0].fileName
      methodConfirm.value.fileDistributeNo = data[0].fileDistributeNo
      methodConfirm.value.enableTime = data[0].activeDate
      methodConfirm.value.params = data[0].transmissionParams
      methodConfirm.value.environmentRequire = data[0].environmentRequire
      methodConfirm.value.temperatureHighLimit = data[0].temperatureHighLimit
      methodConfirm.value.temperatureLowLimit = data[0].temperatureLowLimit
      methodConfirm.value.humidityHighLimit = data[0].humidityHighLimit
      methodConfirm.value.humidityLowLimit = data[0].humidityLowLimit
      methodConfirm.value.remark = data[0].remark
      methodConfirm.value.minioFileName = data[0].file
      methodConfirm.value.deptName = data[0].groupCodeName
      console.log(data[0], '111')
    }
    else {
      ElMessage.warning('找不到对应的现行测试校准检定方法')
    }
  })
  // methodConfirm.value.fileId = row2[0].id
  // methodConfirm.value.fileNo = row2[0].fileNo
  // methodConfirm.value.fileName = row2[0].fileName
}
// 控制选择人员弹窗显示/隐藏
const visible = ref(false)
// 选择评审组成员
const selectPerson = () => {
  visible.value = true
}
const closePerson = () => {
  visible.value = false
}
// 确定评审组成员
const confirmPerson = (user: any[]) => {
  console.log(user, 'user')
  visible.value = false
  console.log(methodConfirm.value.reviewTeam, '123321')
  const perPerson = methodConfirm.value.reviewTeam ? methodConfirm.value.reviewTeam.split(',') : []
  user.forEach((item: any) => {
    if (!perPerson.includes(item.name)) {
      perPerson.push(item.name)
    }
  })
  methodConfirm.value.reviewTeam = perPerson.join(',')
  console.log(methodConfirm.value.reviewTeam, 'methodConfirm.value.reviewTeam')
}
// 流程审批-同意
const approvalAgreeHandler = () => {
  apprDial.value.initDialog('agree', methodConfirm.value.taskId || route.query.taskId, methodConfirm.value.id, methodConfirm.value.processId || route.query.processId)
}

// 流程审批-驳回
const approvalRejectHandler = () => {
  apprDial.value.initDialog('reject', methodConfirm.value.taskId || route.query.taskId, methodConfirm.value.id)
}

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

// 取消(撤回审批单)
const revokeClickedHandler = () => {
  const param = {
    processInstanceId: methodConfirm.value.processId || route.query.processId!,
    comments: '',
    id: id.value,
  }
  revokeApproval(param).then((res) => {
    if (res.code === 200) {
      ElMessage.success('流程取消成功')
    }
    else {
      ElMessage.error(`流程取消失败:${res.message}`)
    }
    cancelButtVisable.value = false
  })
}

// 删除(只有已取消的可以在详情中删除)
const deleteClickedHandler = () => {
  ElMessageBox.confirm(
    `确认删除方法确认登记表 ${methodConfirm.value.formNo} 吗?`,
    '提示',
    {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning',
    },
  ).then(() => {
    revokeDelete({ id: methodConfirm.value.id, taskId: methodConfirm.value.taskId }).then((res) => {
      if (res.code === 200) {
        ElMessage.success(`方法确认登记表 ${methodConfirm.value.formNo} 删除成功`)
        resetForm()
      }
      else {
        ElMessage.error(`方法确认登记表 ${methodConfirm.value.formNo} 删除失败:${res.message}`)
      }
    })
  })
}

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

// 拒绝
const refuseHandler = (comments: string, taskId: string, id: string) => {
  const param = {
    id,
    taskId, // 任务id
    comments, // 拒绝原因
  }
  refuseApproval(param).then((res) => {
    if (res.code === 200) {
      ElMessage.success('拒绝审批完成')
    }
    else {
      ElMessage.error(`拒绝审批失败:${res.message}`)
    }
    flowButtsVisable.value = false
  })
}

// 驳回
const reject = (comments: string, taskId: string, id: string) => {
  const params = {
    id,
    taskId, // 任务id
    comments, // 拒绝原因
  }
  rejectApproval(params).then((res) => {
    ElMessage({
      type: 'success',
      message: '已驳回',
    })
    flowButtsVisable.value = false
  })
}

// 上传请求
const uploadMethodConfirmFile: any = (file: any) => {
  const fd = new FormData()
  fd.append('multipartFile', file.file)
  const loading = ElLoading.service({
    lock: true,
    background: 'rgba(255, 255, 255, 0.8)',
  })
  UploadFile(fd).then((res) => {
    if (res.code === 200) {
      ElMessage.success('上传成功')
      methodConfirm.value.minioFileName = res.data[0]
      loading.close()

      methodConfirmRef.value.validateField('minioFileName', () => { })
    }
  }).catch(() => {
    loading.close()
    ElMessage.error('上传失败')
  })
}

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
      }
    })
  }
  else {
    labCodeDict.value = JSON.parse(sessionStorage.getItem('bizLabCode')!)
  }
}

const getGroupCodeDict = async () => {
  // 先从缓存中获取
  if (sessionStorage.getItem('bizGroupCode') === null || sessionStorage.getItem('bizLabbizGroupCodeCode') === undefined) {
    // 缓存中没有则调用接口查询
    await getDictByCode('bizGroupCode').then((res) => {
      if (res.code === 200) {
        groupCodeDict.value = res.data
      }
    })
  }
  else {
    groupCodeDict.value = JSON.parse(sessionStorage.getItem('bizGroupCode')!)
  }
}

const initDict = async () => {
  await getLabCodeDict()
  await getGroupCodeDict()
}

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

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

  switch (params.type) {
    case 'create':
      title.value = '方法确认登记表(新增)'
      saveButtVisable.value = true
      submitButtVisable.value = true

      methodConfirm.value.createUserId = userInfo.id
      methodConfirm.value.createUserName = userInfo.name
      methodConfirm.value.createTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
      if ($route.query.noveltyId) {
        methodConfirm.value.noveltyId = $route.query.noveltyId as string
      }
      keyFieldsDisable.value = false

      break
    case 'update':
      title.value = '方法确认登记表(编辑)'

      detailById(id.value)

      // 判断显示哪些流程操作按钮
      showOperationButtonByStatus()
      keyFieldsDisable.value = true

      break
    case 'detail':
      title.value = '方法确认登记表'
      id.value = params.id

      detailById(id.value)

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

      break
    default:
      title.value = ''
      keyFieldsDisable.value = true
      break
  }
}

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

<template>
  <app-container>
    <!-- 选择成员弹窗 -->
    <select-employees-dialog :visible="visible" @change="confirmPerson" @close="closePerson" />
    <el-form
      ref="methodConfirmRef" :model="methodConfirm" :rules="methodConfirmRules" label-position="right"
      label-width="125px" border stripe
    >
      <detail-page :title="`${title}`">
        <template #btns>
          <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 v-if="`${decisionItem}` === '1' || `${decisionItem}` === '2'" type="warning" @click="approvalRejectHandler">
              驳回
            </el-button>
            <el-button v-if="`${decisionItem}` === '1' || `${decisionItem}` === '3'" 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" @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 type="info" @click="resetForm()">
            关闭
          </el-button>
        </template>

        <el-radio-group
          v-if="id !== ''" v-model="currentLabel" style="margin-bottom: 20px;"
          @change="radioChangeHandler"
        >
          <el-radio-button v-for="item in radioItems" :key="item.value" :label="item.name" :disabled="id === ''" />
        </el-radio-group>

        <template v-if="current === 'confirm-basic'">
          <el-row :gutter="24">
            <!-- 第一行 第一列 -->
            <el-col :span="6">
              <el-form-item label="实验室" prop="labCode">
                <el-select
                  v-model="methodConfirm.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-form-item label="编制人" prop="createUserName">
                <el-input v-model="methodConfirm.createUserName" :disabled="true" />
                <el-input v-model="methodConfirm.createUserId" type="hidden" />
              </el-form-item>
            </el-col>

            <el-col :span="6">
              <el-form-item label="部门" prop="groupCode">
                <el-select
                  v-model="methodConfirm.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-form-item label="创建时间">
                <el-input v-model="methodConfirm.createTime" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="6">
              <el-form-item label="登记表编号">
                <el-input v-model="methodConfirm.formNo" placeholder="登记表编号,保存后自动生成" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="6">
              <el-form-item label="登记表名称">
                <el-input v-model="methodConfirm.formName" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>
        </template>
      </detail-page>

      <template v-if="current === 'confirm-basic'">
        <detail-block title="">
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item label="方法编号" prop="fileNo">
                <el-input v-model="methodConfirm.fileNo" :disabled="true">
                  <template #append>
                    <el-button size="small" :disabled="type === 'detail'" @click="showFilterMethod">
                      选择
                    </el-button>
                  </template>
                </el-input>
                <el-input v-model="methodConfirm.fileId" type="hidden" :disabled="type === 'detail'" />
              </el-form-item>
            </el-col>

            <el-col :span="6">
              <!-- <el-form-item label="方法名称">
                <el-input v-model="methodConfirm.fileName" :disabled="true" />
              </el-form-item> -->
              <el-form-item label="文件发放号" prop="fileDistributeNo">
                <el-input v-model="methodConfirm.fileDistributeNo" :disabled="type === 'detail'" />
              </el-form-item>
            </el-col>

            <el-col :span="6">
              <!-- <el-form-item label="检测或校准项目" prop="measureItem">
                <el-input v-model="methodConfirm.measureItem" placeholder="请填写检测或校准项目" :clearable="true" :disabled="type === 'detail'" />
              </el-form-item> -->
              <el-form-item label="文件名称" prop="fileName">
                <el-input v-model="methodConfirm.fileName" :disabled="type === 'detail'" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="部门" prop="deptName">
                <el-select
                  v-model="methodConfirm.deptName" placeholder="请选择部门" style="width: 100%;"
                  :disabled="type === 'detail'"
                >
                  <el-option v-for="dict in groupCodeDict" :key="dict.id" :label="dict.name" :value="dict.name" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="启用时间" prop="enableTime">
                <el-date-picker
                  v-model="methodConfirm.enableTime" style="width: 100%;" type="date" placeholder="启用时间"
                  format="YYYY-MM-DD" value-format="YYYY-MM-DD" :disabled="type === 'detail'"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="开展量传参数" prop="params">
                <el-input v-model="methodConfirm.params" placeholder="开展量传参数" :disabled="type === 'detail'" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="环境条件要求" prop="environmentRequire">
                <el-input
                  v-model="methodConfirm.environmentRequire" placeholder="环境条件要求"
                  :disabled="type === 'detail'"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="温度要求" class="redRequired">
                <div style="display: flex;">
                  <el-form-item label-width="0px" prop="temperatureLowLimit">
                    <el-input
                      v-model="methodConfirm.temperatureLowLimit" placeholder="温度要求下限"
                      :disabled="type === 'detail'"
                    >
                      <template #append>
                        <span>
                          ℃
                        </span>
                      </template>
                    </el-input>
                  </el-form-item>
                  ~
                  <el-form-item label-width="0px" prop="temperatureHighLimit">
                    <el-input
                      v-model="methodConfirm.temperatureHighLimit" placeholder="温度要求上限"
                      :disabled="type === 'detail'"
                    >
                      <template #append>
                        <span>
                          ℃
                        </span>
                      </template>
                    </el-input>
                  </el-form-item>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="湿度要求" class="redRequired">
                <div style="display: flex;">
                  <el-form-item label-width="0px" prop="humidityLowLimit">
                    <el-input
                      v-model="methodConfirm.humidityLowLimit" placeholder="湿度要求下限"
                      :disabled="type === 'detail'"
                    >
                      <template #append>
                        <span>
                          %
                        </span>
                      </template>
                    </el-input>
                  </el-form-item>
                  ~
                  <el-form-item label-width="0px" prop="humidityHighLimit">
                    <el-input
                      v-model="methodConfirm.humidityHighLimit" placeholder="湿度要求上限"
                      :disabled="type === 'detail'"
                    >
                      <template #append>
                        <span>
                          %
                        </span>
                      </template>
                    </el-input>
                  </el-form-item>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="备注">
                <el-input v-model="methodConfirm.remark" placeholder="备注" :disabled="type === 'detail'" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="方法确认报告" prop="minioFileName">
                <el-input v-model="methodConfirm.minioFileName" type="hidden" />
                <!-- <el-link :href="minioFileUrl" :underline="false" target="_blank"
                  @click="previewFileSystem(minioFileUrl)"> -->
                <!-- {{ methodConfirm.minioFileName }} -->
                <!-- </el-link> -->
                <show-photo :minio-file-name="methodConfirm.minioFileName" />

                <el-upload
                  :show-file-list="false" :http-request="uploadMethodConfirmFile"
                  style="width: 50%; margin-left: 20px;" accept="pdf/*"
                >
                  <el-button v-if="type !== 'detail'" type="primary">
                    <template v-if="methodConfirm.minioFileName !== ''">
                      替换
                    </template>
                    <template v-else>
                      上传
                    </template>
                  </el-button>
                </el-upload>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="测试或校准项目" prop="measureItem">
                <el-input v-model="methodConfirm.measureItem" placeholder="测试或校准项目" :disabled="type === 'detail'" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item
                label="方法及说明(包括对要求的说明、方法性能的确认、方法对计量测试站的适用性、对使用该方法能否满足要求的核实及有关确认结果的说明等)"
                prop="methodIllustration"
              >
                <el-input
                  v-model="methodConfirm.methodIllustration" placeholder="请填写方法及说明" type="textarea" rows="15"
                  :clearable="true" :disabled="type === 'detail'"
                />
              </el-form-item>
            </el-col>
          </el-row>

          <!-- <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item label="评审组成员" prop="reviewTeam">
                <el-input v-model="methodConfirm.reviewTeam" placeholder="请选择评审组成员" :clearable="true" disabled>
                  <template #append>
                    <el-button :disabled="type === 'detail'" @click="selectPerson">
                      选择
                    </el-button>
                  </template>
                </el-input>
              </el-form-item>
            </el-col>
          </el-row> -->

          <!-- <el-row :gutter="24">
            <el-col :span="24">

            </el-col>
          </el-row> -->
        </detail-block>
      </template>
    </el-form>

    <!-- <approval-dialog
      ref="apprDial" @on-success="approvalSuccessHandler" @on-refuse="refuseHandler"
      @on-revoke="revokeHandler"
    /> -->

    <!-- 审批弹窗 -->
    <approval-dialog ref="apprDial" :last-name="customApproval.approvalLastName.methodConfirm" @on-success="approvalSuccessHandler" @refuse="refuseHandler" @reject="reject" />
    <!-- 选择审批人弹窗 -->
    <select-approver-dialog ref="selectApproverRef" @confirm="confirmSelectApprover" />

    <file-select-dialog ref="refFileSelect" @confirm="methodFileSelected" />

    <template v-if="current === 'confirm-approval' && status !== '1'">
      <approval-record-table :process-id="methodConfirm.processId" />
    </template>
  </app-container>
</template>

<style lang="scss" scoped>
.redRequired {
  ::v-deep(.el-form-item__label) {
    &::before {
      content: "*";
      color: #f56c6c;
      margin-right: 4px;
    }
  }
}
</style>