|
@@ -10,13 +10,13 @@ import { iFile } from '@/types/file'
|
|
|
import { iAuditHistoryState, iAuditor, iLatestAuditorState, iRectifiedState } from '@/types/safe'
|
|
|
import { iUserInfo } from '@/types/setting'
|
|
|
import { apiDelFile, apiGetFileList, apiSaveFileInfo } from '@/utils/common/api'
|
|
|
-import { auditProgress } from '@/utils/common/constStatus'
|
|
|
+import { auditConsts, auditProgress } from '@/utils/common/constStatus'
|
|
|
import consts from '@/utils/consts'
|
|
|
-import { dayjsFormat } from '@/utils/util'
|
|
|
+import { dayjsFormat, formatDate } from '@/utils/util'
|
|
|
import { Button, Input, message, Pagination, Tooltip } from 'antd'
|
|
|
import locale from 'antd/es/date-picker/locale/zh_CN'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import React, { useEffect, useState } from 'react'
|
|
|
+import React, { useEffect, useState, useMemo } from 'react'
|
|
|
import { RouteComponentProps } from 'react-router'
|
|
|
import { apiGetSafeDetail, apiResfulSafeAudit } from './api'
|
|
|
import AuditModal from './components/Modal'
|
|
@@ -27,6 +27,7 @@ interface iDetailState {
|
|
|
auditName: string
|
|
|
auditors: iAuditor[]
|
|
|
bidsectionId: string
|
|
|
+ uid: string
|
|
|
code: string
|
|
|
createTime: string | undefined
|
|
|
demand: string
|
|
@@ -44,7 +45,7 @@ interface iDetailState {
|
|
|
|
|
|
interface iModifiedOrder {
|
|
|
name: string
|
|
|
- end_time: string | undefined
|
|
|
+ create_time: string | undefined
|
|
|
opinion: string
|
|
|
status: number
|
|
|
}
|
|
@@ -67,6 +68,7 @@ const Detail: React.FC<RouteComponentProps> = props => {
|
|
|
})
|
|
|
const [ detail, setDetail ] = useState<iDetailState>({
|
|
|
auditName: '',
|
|
|
+ uid: '',
|
|
|
auditors: [],
|
|
|
bidsectionId: '',
|
|
|
code: '',
|
|
@@ -82,7 +84,7 @@ const Detail: React.FC<RouteComponentProps> = props => {
|
|
|
name: '',
|
|
|
status: 0,
|
|
|
opinion: '',
|
|
|
- end_time: ''
|
|
|
+ create_time: new Date().toDateString()
|
|
|
},
|
|
|
auditHistory: [],
|
|
|
rectifiedInfo: [],
|
|
@@ -99,6 +101,9 @@ const Detail: React.FC<RouteComponentProps> = props => {
|
|
|
},
|
|
|
times: 0
|
|
|
})
|
|
|
+ const isEdited = useMemo(() => {
|
|
|
+ return !!detail.status
|
|
|
+ }, [ detail.status ])
|
|
|
useEffect(() => {
|
|
|
initData()
|
|
|
}, [ saveId ])
|
|
@@ -184,9 +189,15 @@ const Detail: React.FC<RouteComponentProps> = props => {
|
|
|
payload = { id: detail.id }
|
|
|
}
|
|
|
|
|
|
- if (visible.auditType === 'pass') {
|
|
|
+ if (visible.auditType === 'pass' || visible.auditType === 'back') {
|
|
|
payload.id = detail.latestAuditor.id
|
|
|
- detail.latestAuditor.progress === '1' && (payload.rectifiedInfo = detail.checkOrder.opinion)
|
|
|
+ if (detail.latestAuditor.progress === '1') {
|
|
|
+ if (!detail.checkOrder.opinion) {
|
|
|
+ return message.error("请填写整改单!")
|
|
|
+ } else {
|
|
|
+ payload.rectifiedInfo = detail.checkOrder.opinion
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (visible.auditType === 'close') {
|
|
@@ -206,6 +217,8 @@ const Detail: React.FC<RouteComponentProps> = props => {
|
|
|
}
|
|
|
}
|
|
|
const renderHeaderBtn = (status: number) => {
|
|
|
+
|
|
|
+ if (!detail.latestAuditor.audit_id && userStore.userInfo.id !== detail.uid) return null
|
|
|
if (detail.latestAuditor.audit_id && userStore.userInfo.id !== detail.latestAuditor.audit_id) return null
|
|
|
if (!status) {
|
|
|
return (
|
|
@@ -254,30 +267,40 @@ const Detail: React.FC<RouteComponentProps> = props => {
|
|
|
<tr>
|
|
|
<th style={{ width: '150px' }}>检查项目</th>
|
|
|
<td>
|
|
|
- <TextArea value={detail.inspection}></TextArea>
|
|
|
+ {
|
|
|
+ isEdited ? <span>{detail.inspection}</span> : <TextArea value={detail.inspection} ></TextArea>
|
|
|
+ }
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th style={{ width: '150px' }}>现场检查情况</th>
|
|
|
<td>
|
|
|
- <TextArea value={detail.inspectionDetail}></TextArea>
|
|
|
+ {
|
|
|
+ isEdited ? <span>{detail.inspectionDetail}</span> : <TextArea value={detail.inspectionDetail} ></TextArea>
|
|
|
+ }
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th style={{ width: '150px' }}>处理要求及措施</th>
|
|
|
<td>
|
|
|
- <TextArea value={detail.demand}></TextArea>
|
|
|
+ {
|
|
|
+ isEdited ? <span>{detail.demand}</span> : <TextArea value={detail.demand}></TextArea>
|
|
|
+ }
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th style={{ width: '150px' }}>检查日期</th>
|
|
|
<td>
|
|
|
- <DatePicker
|
|
|
+ {
|
|
|
+ isEdited ? <span>{detail.createTime && dayjsFormat(detail.createTime, 'YYYY-MM-DD')}</span> :
|
|
|
+ <DatePicker
|
|
|
size="small"
|
|
|
locale={locale}
|
|
|
allowClear={false}
|
|
|
value={dayjs(detail.createTime)}
|
|
|
onChange={value => setDetail({ ...detail, createTime: value?.format() })}></DatePicker>
|
|
|
+ }
|
|
|
+
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
@@ -287,7 +310,7 @@ const Detail: React.FC<RouteComponentProps> = props => {
|
|
|
</tbody>
|
|
|
</table>
|
|
|
{
|
|
|
- detail.latestAuditor.progress === '1' && detail.rectifiedInfo.length ?
|
|
|
+ detail.status === auditProgress.checked && detail.latestAuditor.progress === '1'?
|
|
|
<table className="pi-table pi-bordered">
|
|
|
<thead>
|
|
|
<tr>
|
|
@@ -310,17 +333,42 @@ const Detail: React.FC<RouteComponentProps> = props => {
|
|
|
size="small"
|
|
|
locale={locale}
|
|
|
allowClear={false}
|
|
|
- value={dayjs(detail.checkOrder.end_time)}
|
|
|
- onChange={value => setDetail({ ...detail, checkOrder: { ...detail.checkOrder, end_time: value?.format() } })}></DatePicker>
|
|
|
+ value={dayjs(detail.checkOrder.create_time)}
|
|
|
+ onChange={value => setDetail({ ...detail, checkOrder: { ...detail.checkOrder, create_time: value?.format() } })}></DatePicker>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th style={{ width: '150px' }}>整改人</th>
|
|
|
- <td>王五</td>
|
|
|
+ <td>{detail.auditors.find(item => item.progress === '1')?.name}</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ : detail.rectifiedInfo.map(item => (
|
|
|
+ <table className="pi-table pi-bordered" key={item.create_time}>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th colSpan={2} className="pi-text-center">
|
|
|
+ 整改单
|
|
|
+ </th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <th style={{ width: '150px' }}>整改情况</th>
|
|
|
+ <td>{item.opinion}</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th style={{ width: '150px' }}>整改日期</th>
|
|
|
+ <td>{dayjsFormat(item.create_time, 'YYYY-MM-DD')}</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th style={{ width: '150px' }}>整改人</th>
|
|
|
+ <td>{item.name}</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
- : null
|
|
|
+ ))
|
|
|
+
|
|
|
}
|
|
|
<table className="pi-table pi-bordered mt-3">
|
|
|
<thead>
|