Newer
Older
xc-business-system / src / views / resource / file / noveltySearch / detail.vue
<!-- 委托方意见登记表详情 -->
<script name="FileNoveltySearchDetail" lang="ts" setup>
import { ElMessage, ElMessageBox, dayjs } from 'element-plus'
import { Close } from '@element-plus/icons-vue'
import { getDictTextByValue } from '../../person/register/common-register'
import type { IMethodNoveltySearch, INoveltyLog } from './novelty-interface'
import FileSelectDialog from './fileSelectDialog.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 ApprovalDialog from '@/views/resource/common/approvalDialog.vue'
import ApprovalRecordTable from '@/components/ApprovalRecord/ApprovalRecordTable.vue'
import useUserStore from '@/store/modules/user'
import { getDictByCode } from '@/api/system/dict'
import { getFileMethodList } from '@/api/resource/fileTechnology'
import { detailMethodNovelty, failUpdateNovelty, refuseApproval, revokeApproval, revokeDelete, saveNovelty, setProsessShowBench, submitNovelty, updateDraftNovelty } from '@/api/resource/fileNovelty'
const $route = useRoute()

// 从路由中传过来的参数
const type = ref<string>('')
const id = ref<string>('')
const status = ref<string>('')
// 关键字段是否可以编辑
const keyFieldsDisable = ref<boolean>(true)

const flowFormId = 'zyglcsjzjdffcxjlb' // 资源管理 - 测试校准检定方法查新记录表

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

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

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

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

const noveltyRules = ref({
  labCode: [{ required: true, message: '实验室代码不能为空,请选择', trigger: ['change', 'blur'] }],
  groupCode: [{ required: true, message: '组别代码不能为空,请选择', trigger: ['change', 'blur'] }],
  noveltyDate: [{ required: true, message: '查新日期不能为空, 请选择', trigger: 'blur' }],
  noveltyWay: [{ 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 novelty = ref<IMethodNoveltySearch>({
  id: '',
  formNo: '',
  formName: '测试校准检定方法查新记录表',
  labCode: '',
  labCodeName: '',
  groupCode: '',
  groupCodeName: '',
  noveltyDate: '',
  noveltyResult: '',
  noveltyWay: '',
  processId: '',
  taskId: '',
  createTime: '',
  createUserId: '',
  createUserName: '',
  logList: [],
  logListCopy: null as any,
})
const fileColumns = ref<Array<TableColumn>>([
  { text: '实验室', value: 'labCodeName', align: 'center' },
  { text: '部门', value: 'groupCodeName', align: 'center' },
  { text: '文件编号', value: 'fileNo', align: 'center' },
  { text: '文件名称', value: 'fileName', align: 'center' },
]) // 表头

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

const fileRecordSelected = ref<INoveltyLog[]>([])

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

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

const delFileRecords = () => {
  if (fileRecordSelected.value.length === 0) {
    ElMessage.warning('请至少选择一行')
    return
  }

  novelty.value.logList = novelty.value.logList.filter(item => fileRecordSelected.value.includes(item) === false)
}

const fileMultiSelect = (e: any) => {
  fileRecordSelected.value = e
}

// 根据id查询详情
const detailById = async (id: string) => {
  await detailMethodNovelty({ id }).then((res) => {
    if (res.code === 200) {
      novelty.value = res.data
      novelty.value.logList = novelty.value.logList.map((item) => {
        return {
          ...item,
        }
      })
      if ($route.query.status === '0' && $route.query.type === 'detail') {
        novelty.value.logListCopy = JSON.parse(JSON.stringify(novelty.value.logList))
      }
      if (novelty.value.taskId === '') {
        novelty.value.taskId = sessionStorage.getItem('noveltySearchTaskId')!
      }
    }
  })
}

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

      keyFieldsDisable.value = true

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

// 编辑草稿箱(不走流程审批)
const updateMethodNoveltySearch = () => {
  updateDraftNovelty(novelty.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 (!noveltyRef) { return }

  if (novelty.value.logList.length === 0) {
    ElMessage.error('文件列表不能为空,请选择文件')
    return
  }

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

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

          type.value = 'detail'
          hideAllOpterationButtons()
        }
        else {
          ElMessage.error(`查新记录表 ${novelty.value.formNo} 提交失败:${res.message}`)
        }
      })
    })
  }
  else {
    // 之前已经在流程中的表单 保存提交
    await noveltyRef.value.validate((valid: boolean) => {
      if (valid === true) {
        failUpdateNovelty(novelty.value).then((res) => {
          if (res.code === 200) {
            // 提示保存成功
            ElMessage.success(`查新记录表 ${novelty.value.formNo} 提交成功`)

            type.value = 'detail'
            hideAllOpterationButtons()
          }
          else {
            // 提示失败信息
            ElMessage.error(`查新记录表 ${novelty.value.formNo} 提交失败:${res.message}`)
          }
        })
      }
    })
  }
}

// 选定文件返回
const appendFileToList = (row: IMethodFileInfo, result: string) => {
  const existList = novelty.value.logList.filter(file => file.fileId === row.id)
  if (existList.length === 0) {
    novelty.value.logList.push({
      id: '',
      fileId: row.id,
      fileNo: row.fileNo,
      fileName: row.fileName,
      noveltyResult: result,
      noveltyResultName: getDictTextByValue(noveltyResultDict.value, result),
    })
  }
}

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

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

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

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

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

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

    cancelButtVisable.value = false
  })
}

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

    flowButtsVisable.value = false
  })
}

const disabledAfterToday = (time: Date) => {
  return time.getTime() > Date.now()
}

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
        labCodePartDict.value = labCodeDict.value.filter((item: any) => !item.name.includes('全'))
      }
    })
  }
  else {
    labCodeDict.value = JSON.parse(sessionStorage.getItem('bizLabCode')!)
    labCodePartDict.value = labCodeDict.value.filter((item: any) => !item.name.includes('全'))
  }
}

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 getNoveltyResultDict = async () => {
  // 先从缓存中获取
  if (sessionStorage.getItem('bizNoveltyResult') === null || sessionStorage.getItem('bizNoveltyResult') === undefined) {
    // 缓存中没有则调用接口查询
    await getDictByCode('bizNoveltyResult').then((res) => {
      if (res.code === 200) {
        noveltyResultDict.value = res.data
      }
    })
  }
  else {
    noveltyResultDict.value = JSON.parse(sessionStorage.getItem('bizNoveltyResult')!)
  }
}
// 详情 - 仅查看有更新
const onlyUpdate = ref()
watch(() => onlyUpdate.value, (newVal) => {
  if (newVal) {
    novelty.value.logList = novelty.value.logListCopy.filter((item: any) => item.noveltyResult === '1')
  }
  else {
    novelty.value.logList = novelty.value.logListCopy
  }
})

// 当前查新节点
const currentProcess = computed(() => {
  return (row: any) => {
    if (row.noveltyStatusName === '无更新') {
      return '/'
    }
    // 查新节点数据
    // 节点顺序
    const processOrderIndex = ['noveltySearchComplete', 'allSearchComplete', 'methodConfirmComplete', 'measureMethodComplete', 'standardComplete', 'environmentComplete', 'itemCategoryComplete', 'grantNoticeComplete', 'trainComplete', 'examineComplete', 'systemFileComplete']
    // 节点中文汉字
    const processOrder = {
      noveltySearchComplete: '《测试校准检定方法查新记录表》有查新',
      allSearchComplete: '西昌及海口实验室是否全部查新完成',
      methodConfirmComplete: '《方法确认登记表》更新',
      measureMethodComplete: '《测试、校准或检定方法》更新',
      standardComplete: '《标准装置台账》更新',
      environmentComplete: '《工作间环境一览表》更新',
      itemCategoryComplete: '《检定项分类更新》更新',
      grantNoticeComplete: '《文件发放通知单》更新',
      trainComplete: '《文件学习(培训签到表)》更新',
      examineComplete: '《要求、委托书及合同评审表》更新',
      systemFileComplete: '《体系文件》更新',
    } as { [key: string]: string }
    // 节点数据
    const currentIndex = [] as number[]
    processOrderIndex.forEach((item: string) => {
      currentIndex.push(Number(row[item]))
    })
    if (currentIndex.lastIndexOf(1) === -1) {
      return ''
    }
    else {
      return processOrder[processOrderIndex[currentIndex.lastIndexOf(1)]]
    }
  }
})
const initDict = async () => {
  await getLabCodeDict()
  await getGroupCodeDict()
  await getNoveltyResultDict()
  if ($route.query.type === 'create') {
    // 填充实验室部门
    novelty.value.labCode = userInfo.bizLabCode
    novelty.value.groupCode = userInfo.groupNo
    userInfo.groupNo
    // 填充查新纪录
    getFileMethodList({
      offset: 1,
      limit: 9999,
    }).then((res) => {
      const data = res.data.rows.filter((item: any) => item.groupCode === userInfo.groupNo && (item.labCode === 'A' || item.labCode === userInfo.bizLabCode))
      data.forEach((element: any) => {
        novelty.value.logList.push({
          id: '',
          fileId: element.id,
          fileNo: element.fileNo,
          fileName: element.fileName,
          noveltyResult: '',
          groupCode: element.groupCode,
          groupCodeName: element.groupCodeName,
          labCodeName: element.labCodeName,
          labCode: element.labCode,
        })
      })
    })
  }
}

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

  // 默认显示第一个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

      novelty.value.createUserId = userInfo.id
      novelty.value.createUserName = userInfo.name

      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)

      if (status.value === '0') {
        // 全部状态下的详情 可以编辑
      }
      else {
        // 查看详情时所有的操作按钮都隐藏
        showOperationButtonByStatus()
      }

      keyFieldsDisable.value = true

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

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

// ------------------------------------------------查新进度相关逻辑----------------------------------------------------------------------
// 是否展示查新进度
const isShowProcess = ref(false)
// 是否展示在工作台
const isShowBench = ref(false)
// 当前展示的查新记录
const currentRecord = ref<{ [key: string]: string }>({})
// 页面初次加载
const isFirst = ref(true)
watch(() => isShowBench.value, (newVal) => {
  if (isFirst.value) { return }
  // 调用接口
  setProsessShowBench({
    displayedWorkbench: newVal ? 1 : 0,
    examineComplete: currentRecord.value.examineComplete,
    examineCompleteDate: currentRecord.value.examineCompleteDate,
    systemFileComplete: currentRecord.value.systemFileComplete,
    systemFileCompleteDate: currentRecord.value.systemFileCompleteDate,
    logId: currentRecord.value.id,
  }).then((res) => {
    if (res.code === 200) {
      ElMessage.success('操作成功')
      currentRecord.value.displayedWorkbench = newVal ? '1' : '0'
    }
  })
})

// 节点数据
const processData = ref<any[]>([])
// 生成节点数据
const handlerProcessData = () => {
  processData.value = []
  const processOrderIndex = ['noveltySearchComplete', 'allSearchComplete', 'methodConfirmComplete', 'measureMethodComplete', 'standardComplete', 'environmentComplete', 'itemCategoryComplete', 'grantNoticeComplete', 'trainComplete', 'examineComplete', 'systemFileComplete']
  const processOrderChinese = ['《测试校准检定方法查新记录表》有查新', '西昌及海口实验室是否全部查新完成', '《方法确认登记表》更新', '《测试、校准或检定方法》更新', '《标准装置台账》更新', '《工作间环境一览表》更新', '《检定项分类更新》更新', '《文件发放通知单》更新', '《文件学习(培训签到表)》更新', '《要求、委托书及合同评审表》更新', '《体系文件》更新']
  processOrderIndex.forEach((item: string, index: number) => {
    processData.value.push({
      text: processOrderChinese[index],
      value: item,
      time: currentRecord.value[`${item}Date`],
    })
  })
}

// 当前节点
const currentIndex = computed(() => {
  // 节点顺序
  const processOrderIndex = ['noveltySearchComplete', 'allSearchComplete', 'methodConfirmComplete', 'measureMethodComplete', 'standardComplete', 'environmentComplete', 'itemCategoryComplete', 'grantNoticeComplete', 'trainComplete', 'examineComplete', 'systemFileComplete']
  // 节点数据
  const currentIndex = [] as number[]
  processOrderIndex.forEach((item: string) => {
    currentIndex.push(Number(currentRecord.value[item]))
  })
  return currentIndex.filter(item => item).length || 1
})
// 查新进度按钮(展示查新进度)
const searchProcess = (row: any) => {
  // 赋值是否展示在工作台
  if (String(row.displayedWorkbench) === '1') {
    isShowBench.value = true
  }
  else {
    isShowBench.value = false
  }
  // 赋值当前行数据
  currentRecord.value = row
  // 生成节点数据
  handlerProcessData()
  // 展示查新进度
  isShowProcess.value = true
  isFirst.value = false
}
// 关闭查新进度
const closeProcess = () => {
  isShowProcess.value = false
  isFirst.value = true
}

// 方法确认登记表节点事件
const methodConfirmComplete = () => {
  router.push({

  })
}
// 文件发放通知单节点事件
const grantNoticeComplete = () => {
  ElMessage.warning('敬请期待')
}

// 文件学习(培训签到表) 节点事件
const trainComplete = () => {
  ElMessage.warning('敬请期待')
}

// 最后两个节点 节点事件
const editCompleteTime = (process: string) => {
  console.log(process)
  ElMessage.warning('敬请期待')
}
</script>

<template>
  <app-container>
    <el-form
      ref="noveltyRef" :model="novelty" :rules="noveltyRules" label-position="right" label-width="110px" 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 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="type === 'detail'" 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 === 'novelty-basic' && !isShowProcess">
          <el-row :gutter="24">
            <!-- 第一行 第一列 -->
            <el-col :span="6">
              <el-form-item label="实验室代码" prop="labCode">
                <el-select
                  v-model="novelty.labCode" placeholder="请选择实验室代码" :disabled="keyFieldsDisable"
                  style="width: 100%;"
                >
                  <el-option v-for="dict in labCodePartDict" :key="dict.id" :label="dict.name" :value="dict.value" />
                </el-select>
              </el-form-item>
              <el-form-item label="查新人" prop="createUserName">
                <el-input v-model="novelty.createUserName" :disabled="true" />
                <el-input v-model="novelty.createUserId" type="hidden" />
              </el-form-item>
            </el-col>

            <el-col :span="6">
              <el-form-item label="组别代码" prop="groupCode">
                <el-select
                  v-model="novelty.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="查新日期" prop="noveltyDate">
                <el-date-picker
                  v-model="novelty.noveltyDate" placeholder="请选择查新日期" :disabled="type === 'detail'"
                  format="YYYY-MM-DD" value-format="YYYY-MM-DD" :disabled-date="disabledAfterToday"
                  style="width: 100%;"
                />
              </el-form-item>
            </el-col>

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

            <el-col :span="6">
              <el-form-item label="记录表名称">
                <el-input v-model="novelty.formName" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>
        </template>
      </detail-page>
      <detail-page v-if="current === 'novelty-basic' && !isShowProcess" title="">
        <el-row :gutter="24">
          <el-col :span="24">
            <el-form-item label="查新途径" prop="noveltyWay">
              <el-input
                v-model="novelty.noveltyWay" placeholder="请填写查新途径" type="textarea" rows="1" :clearable="true"
                :disabled="type === 'detail'"
              />
            </el-form-item>
          </el-col>

          <el-col :span="24">
            <el-form-item label="备注">
              <el-input
                v-model="novelty.remark" placeholder="请填写备注信息" type="textarea" rows="3" :clearable="true"
                :disabled="type === 'detail'"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </detail-page>

      <template v-if="current === 'novelty-basic' && !isShowProcess">
        <table-container title="查新记录">
          <template v-if="$route.query.type === 'detail' && $route.query.status === '0'" #btns-right>
            <el-checkbox v-model="onlyUpdate" label="仅查看有更新" />
          </template>

          <!-- 表格区域 -->
          <normal-table
            :data="novelty.logList" :columns="fileColumns" :pagination="false" :is-multi="true"
            :is-showmulti-select="false"
          >
            <template #preColumns>
              <el-table-column label="序号" width="55" align="center">
                <template #default="scope">
                  {{ scope.$index + 1 }}
                </template>
              </el-table-column>
            </template>
            <template #columns>
              <el-table-column label="查新结果" align="center">
                <template #default="scope">
                  <el-radio-group v-model="scope.row.noveltyResult">
                    <el-radio
                      v-for="item in noveltyResultDict" :key="item.value" :value="item.value"
                      :label="item.value" :disabled="type === 'detail'"
                    >
                      {{ item.name }}
                    </el-radio>
                  </el-radio-group>
                </template>
              </el-table-column>
              <template v-if="$route.query.type === 'detail' && $route.query.status === '0'">
                <el-table-column label="查新状态" align="center">
                  <template #default="scope">
                    {{ scope.row.noveltyStatusName }}
                  </template>
                </el-table-column>
                <el-table-column label="当前查新节点" align="center">
                  <template #default="scope">
                    {{ currentProcess(scope.row) }}
                  </template>
                </el-table-column>
                <el-table-column label="操作" align="center" width="90">
                  <template #default="scope">
                    <el-button
                      v-if="scope.row.noveltyResult !== '0'" size="small" type="primary" link
                      @click="searchProcess(scope.row)"
                    >
                      查新进度
                    </el-button>
                  </template>
                </el-table-column>
              </template>
            </template>
          </normal-table>
        </table-container>
      </template>
      <!-- 查新进度 -->
      <detail-page v-if="current === 'novelty-basic' && isShowProcess" title="">
        <table-container title="" :title-show="false">
          <template #btns-right>
            <el-button :icon="Close" circle @click="closeProcess" />
          </template>
          <template #btns-left>
            <div style="display: flex;align-items: center;">
              <span>查新进度</span>
              <el-checkbox v-model="isShowBench" style="margin-left: 15px;" label="展示在工作台" />
            </div>
          </template>
          <el-steps :active="currentIndex" align-center>
            <el-step v-for="item in processData" :key="item.text" :title="item.text" :description="item.time">
              <template #description>
                <div style="display: flex;flex-direction: column;justify-content: center;">
                  <!-- 展示时间 -->
                  <div v-if="item.time">
                    {{ item.time }}
                  </div>
                  <!-- 占位 -->
                  <div v-else style="color: transparent;">
                    1
                  </div>
                  <!-- 按钮区域 -->
                  <div style="margin-top: 10px;">
                    <el-button v-if="currentIndex === 3 && !item.time" type="primary" @click="methodConfirmComplete">
                      创建方法确认登记表
                    </el-button>
                    <el-button v-if="currentIndex === 8 && !item.time" type="primary" @click="grantNoticeComplete">
                      创建文件发放通知单
                    </el-button>
                    <el-button v-if="currentIndex === 9 && !item.time" type="primary" @click="trainComplete">
                      创建培训签到表
                    </el-button>
                    <el-button v-if="currentIndex > 9" type="primary" @click="editCompleteTime(item.text)">
                      编辑完成
                    </el-button>
                  </div>
                </div>
              </template>
            </el-step>
          </el-steps>
        </table-container>
      </detail-page>
    </el-form>

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

    <file-select-dialog ref="refFileSelect" @records-selected="appendFileToList" />

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