|
@@ -1,14 +1,67 @@
|
|
|
-import { ZhSubmitButton, ZhUploadButton } from '@/components/Button'
|
|
|
+import { ZhCloseButton, ZhSubmitButton, ZhUploadButton } from '@/components/Button'
|
|
|
import DatePicker from '@/components/DatePicker'
|
|
|
import Header from '@/components/Header'
|
|
|
import Slot from '@/components/Header/slot'
|
|
|
+import OssUploadModal from '@/components/OssUpload'
|
|
|
import SvgIcon from '@/components/SvgIcon'
|
|
|
+import consts from '@/utils/consts'
|
|
|
import { dayjsFomrat } from '@/utils/util'
|
|
|
import { Button, Input, Tooltip } from 'antd'
|
|
|
import locale from 'antd/es/date-picker/locale/zh_CN'
|
|
|
-import React from 'react'
|
|
|
+import dayjs from 'dayjs'
|
|
|
+import React, { useEffect, useState } from 'react'
|
|
|
+import { useActivate } from 'react-activation'
|
|
|
+import { RouteComponentProps } from 'react-router'
|
|
|
+import { apiGetSafeDetail } from './api'
|
|
|
import styles from './index.module.scss'
|
|
|
-const Detail:React.FC<{}> = () => {
|
|
|
+const { TextArea } = Input
|
|
|
+interface iDetailState {
|
|
|
+ auditName: string
|
|
|
+ auditors: any[]
|
|
|
+ bidsectionId: string
|
|
|
+ code: string
|
|
|
+ createTime: string | undefined
|
|
|
+ demand: string
|
|
|
+ files: any[]
|
|
|
+ id: string
|
|
|
+ inspection: string
|
|
|
+ inspectionDetail: string
|
|
|
+ position: string
|
|
|
+ status: number
|
|
|
+}
|
|
|
+const Detail:React.FC<RouteComponentProps> = (props) => {
|
|
|
+ const [ visible, setVisible ] = useState<boolean>(false)
|
|
|
+ const [ detail, setDetail ] = useState<iDetailState>({
|
|
|
+ auditName: "",
|
|
|
+ auditors: [],
|
|
|
+ bidsectionId: "",
|
|
|
+ code: "",
|
|
|
+ createTime: "",
|
|
|
+ demand: "",
|
|
|
+ files: [],
|
|
|
+ id: "",
|
|
|
+ inspection: "",
|
|
|
+ inspectionDetail: "",
|
|
|
+ position: "",
|
|
|
+ status: 0
|
|
|
+ })
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ initData()
|
|
|
+ }, [])
|
|
|
+ useActivate(() => initData())
|
|
|
+ const initData = async() => {
|
|
|
+ const { saveId = "" } = props.location.state as any
|
|
|
+ const { code = -1, data = {} } = await apiGetSafeDetail(saveId)
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ setDetail({ ...detail, ...data })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // const onCreate = () => {
|
|
|
+ // setDetail({
|
|
|
+
|
|
|
+ // })
|
|
|
+ // }
|
|
|
return (
|
|
|
<div className="wrap-contaniner">
|
|
|
<Header title="安全巡检">
|
|
@@ -20,7 +73,7 @@ const Detail:React.FC<{}> = () => {
|
|
|
</Header>
|
|
|
<div className={styles.detailContainer}>
|
|
|
<div className={styles.content}>
|
|
|
- <h4 className={styles.header}>WC-202008-0001</h4>
|
|
|
+ <h4 className={styles.header}>{detail.code}</h4>
|
|
|
<table className="pi-table pi-bordered">
|
|
|
<thead>
|
|
|
<tr>
|
|
@@ -28,11 +81,14 @@ const Detail:React.FC<{}> = () => {
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
- <tr><th style={{ width: "150px" }}>检查项目</th><td><Input.TextArea></Input.TextArea></td></tr>
|
|
|
- <tr><th style={{ width: "150px" }}>现场检查情况</th><td><Input.TextArea></Input.TextArea></td></tr>
|
|
|
- <tr><th style={{ width: "150px" }}>处理要求及措施</th><td><Input.TextArea></Input.TextArea></td></tr>
|
|
|
- <tr><th style={{ width: "150px" }}>检查日期</th><td><DatePicker size="small" locale={locale} allowClear></DatePicker></td></tr>
|
|
|
- <tr><th style={{ width: "150px" }}>质检员</th><td>布尔</td></tr>
|
|
|
+ <tr><th style={{ width: "150px" }}>检查项目</th><td><TextArea value={detail.inspection}></TextArea></td></tr>
|
|
|
+ <tr><th style={{ width: "150px" }}>现场检查情况</th><td><TextArea value={detail.inspectionDetail}></TextArea></td></tr>
|
|
|
+ <tr><th style={{ width: "150px" }}>处理要求及措施</th><td><TextArea value={detail.demand}></TextArea></td></tr>
|
|
|
+ <tr>
|
|
|
+ <th style={{ width: "150px" }}>检查日期</th>
|
|
|
+ <td><DatePicker size="small" locale={locale} allowClear={false} value={dayjs(detail.createTime)} onChange={(value) => setDetail({ ...detail, createTime: value?.format() })}></DatePicker></td>
|
|
|
+ </tr>
|
|
|
+ <tr><th style={{ width: "150px" }}>质检员</th><td>{detail.auditName}</td></tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
<table className="pi-table pi-bordered mt-3">
|
|
@@ -46,7 +102,7 @@ const Detail:React.FC<{}> = () => {
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
- <tr><td colSpan={5}><ZhUploadButton size="small" icon={<SvgIcon type="xxh-cloud-upload"/>}>上传附件</ZhUploadButton></td></tr>
|
|
|
+ <tr><td colSpan={5}><ZhUploadButton size="small" icon={<SvgIcon type="xxh-cloud-upload"/>} onClick={() => setVisible(true)}>上传附件</ZhUploadButton></td></tr>
|
|
|
<tr>
|
|
|
<td style={{ width: 70 }}>1</td>
|
|
|
<td><span className="pi-link-blue">安全检查附件.pdf</span></td>
|
|
@@ -61,6 +117,17 @@ const Detail:React.FC<{}> = () => {
|
|
|
</table>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <OssUploadModal
|
|
|
+ visible={visible}
|
|
|
+ onCancel={() => setVisible(false)}
|
|
|
+ // onOk={}
|
|
|
+ footer={
|
|
|
+ <div className="pi-flex-row pi-justify-end">
|
|
|
+ <ZhCloseButton onClick={() => setVisible(false)} size="small" className="pi-mg-right-5">关闭</ZhCloseButton>
|
|
|
+ <Button type="primary" size="small">确认</Button>
|
|
|
+ </div>}
|
|
|
+ >
|
|
|
+ </OssUploadModal>
|
|
|
</div>
|
|
|
)
|
|
|
}
|