|
@@ -1,5 +1,6 @@
|
|
|
import { iAuditHistoryState, iAuditor, iLatestAuditorState } from '@/types/safe'
|
|
|
import { iAccountGroupItem, iUserInfo } from '@/types/setting'
|
|
|
+import { auditConsts } from '@/utils/common/constStatus'
|
|
|
import { getUserGroup } from '@/utils/common/user'
|
|
|
import { formatDate } from '@/utils/util'
|
|
|
import { Input, Popover } from 'antd'
|
|
@@ -12,7 +13,7 @@ import './index.scss'
|
|
|
interface iGroupItem extends iAccountGroupItem {
|
|
|
onSelect: (item: iUserInfo) => void
|
|
|
}
|
|
|
-const GroupItem: React.FC<iGroupItem> = props => {
|
|
|
+export const GroupItem: React.FC<iGroupItem> = props => {
|
|
|
const { onSelect } = props
|
|
|
const [ visible, setVisible ] = useState<boolean>(true)
|
|
|
|
|
@@ -53,10 +54,11 @@ interface iAuditContentProps {
|
|
|
auditors: iAuditor[]
|
|
|
auditHistory: iAuditHistoryState[][]
|
|
|
status: number
|
|
|
+ uName: string
|
|
|
}
|
|
|
|
|
|
const Index: React.FC<iAuditContentProps> = props => {
|
|
|
- const { onSelect, auditors, onDelete, status, auditHistory } = props
|
|
|
+ const { onSelect, auditors, onDelete, status, auditHistory, uName } = props
|
|
|
const [ visible, setVisible ] = useState({
|
|
|
check: false,
|
|
|
reCheck: false
|
|
@@ -116,7 +118,7 @@ const Index: React.FC<iAuditContentProps> = props => {
|
|
|
</p>
|
|
|
<small className="text-muted">{item.company}</small>
|
|
|
</div>
|
|
|
- <span className="pi-red pi-pointer" onClick={() => onDelete(item.audit_id, "0")}>
|
|
|
+ <span className="pi-red pi-pointer" onClick={() => onDelete(item.audit_id, '0')}>
|
|
|
移除
|
|
|
</span>
|
|
|
</li>
|
|
@@ -134,7 +136,7 @@ const Index: React.FC<iAuditContentProps> = props => {
|
|
|
</p>
|
|
|
<small className="text-muted">{item.company}</small>
|
|
|
</div>
|
|
|
- <span className="pi-red pi-pointer" onClick={() => onDelete(item.audit_id, "2")}>
|
|
|
+ <span className="pi-red pi-pointer" onClick={() => onDelete(item.audit_id, '2')}>
|
|
|
移除
|
|
|
</span>
|
|
|
</li>
|
|
@@ -180,7 +182,7 @@ const Index: React.FC<iAuditContentProps> = props => {
|
|
|
|
|
|
const renderStatusEle = (status: number, progress: string) => {
|
|
|
let text = ''
|
|
|
- let textClass = 'pi-color-green'
|
|
|
+ let textClass = 'pi-green'
|
|
|
if (progress === '0') {
|
|
|
switch (status) {
|
|
|
case 1:
|
|
@@ -239,6 +241,164 @@ const Index: React.FC<iAuditContentProps> = props => {
|
|
|
}
|
|
|
return { text, textClass }
|
|
|
}
|
|
|
+
|
|
|
+ const renderLeftAuditors = (status: number) => {
|
|
|
+ // 整改人所需信息
|
|
|
+ const len = auditors.filter(item => item.progress === '0').length
|
|
|
+
|
|
|
+ return (
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td className="pi-text-center">检查人</td>
|
|
|
+ <td>
|
|
|
+ <SvgIcon type="xxh-play-circle"></SvgIcon>
|
|
|
+ <span className="pi-mg-left-3">{auditors[0]?.name}</span>
|
|
|
+ <small className="text-muted pi-mg-left-3">{auditors[0]?.position}</small>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ {auditors
|
|
|
+ .filter(item => item.progress === '0')
|
|
|
+ .map((item, idx) => {
|
|
|
+ return idx === 0 ? (
|
|
|
+ <tr key={item.audit_id}>
|
|
|
+ <td rowSpan={auditors.filter(item => item.progress === '0').length} className="pi-text-center">
|
|
|
+ 审批
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
+ <span className="pi-mg-left-3">{item.name}</span>
|
|
|
+ <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ ) : (
|
|
|
+ <tr key={item.audit_id}>
|
|
|
+ <td>
|
|
|
+ <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
+ <span className="pi-mg-left-3">{item.name}</span>
|
|
|
+ <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ <tr>
|
|
|
+ <td className="pi-text-center">整改人</td>
|
|
|
+ <td>
|
|
|
+ <SvgIcon type={status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
+ {status ? (
|
|
|
+ auditors.find(item => item.progress === '1') ? (
|
|
|
+ <>
|
|
|
+ <span className="pi-mg-left-3">{auditors.find(item => item.progress === '1')?.name}</span>
|
|
|
+ <small className="text-muted pi-mg-left-3">{auditors.find(item => item.progress === '1')?.position}</small>
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <span className="pi-mg-left-3">由 {auditors.filter(item => item.progress === '0')[len - 1]?.name} 指派</span>
|
|
|
+ )
|
|
|
+ ) : (
|
|
|
+ <span className="pi-mg-left-3">由<span className="pi-mg-3">{auditors.filter(item => item.progress === '0').length ? auditors.filter(item => item.progress === '0')[len - 1]?.name : '最后一个审批人'}</span>指派</span>
|
|
|
+ )}
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ {auditors
|
|
|
+ .filter(item => item.progress === '2')
|
|
|
+ .map((item, idx) => {
|
|
|
+ return idx === 0 ? (
|
|
|
+ <tr key={item.audit_id}>
|
|
|
+ <td rowSpan={auditors.filter(item => item.progress === '2').length} className="pi-text-center">
|
|
|
+ 复查
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
+ <span className="pi-mg-left-3">{item.name}</span>
|
|
|
+ <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ ) : (
|
|
|
+ <tr key={item.audit_id}>
|
|
|
+ <td>
|
|
|
+ <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
+ <span className="pi-mg-left-3">{item.name}</span>
|
|
|
+ <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </tbody>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ const renderHistory = () => {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ {auditHistory?.map((item, index) => {
|
|
|
+ return (
|
|
|
+ <ul className="timeline-list" key={index}>
|
|
|
+ {item?.map((auditor, idx) => (
|
|
|
+ <div key={idx}>
|
|
|
+ {index === 0 && idx === 0 ? (
|
|
|
+ <li className="timeline-list-item">
|
|
|
+ <div className="timeline-item-date pi-flex-column" dangerouslySetInnerHTML={{ __html: formatDate(auditor.create_time) }}></div>
|
|
|
+ <div className={item.length - 1 === idx ? '' : 'timeline-item-tail'}></div>
|
|
|
+ {renderStatusIcon(auditor.status, true)}
|
|
|
+ <div className="timeline-item-content">
|
|
|
+ <div className="card-container">
|
|
|
+ <div className="card-content">
|
|
|
+ <div className="pi-justify-between label">
|
|
|
+ <span>{uName}</span>
|
|
|
+ <span className="pi-green">上报审批</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ ) : null}
|
|
|
+ <li className="timeline-list-item" >
|
|
|
+ {auditor.status ? (
|
|
|
+ <div
|
|
|
+ className="timeline-item-date pi-flex-column"
|
|
|
+ dangerouslySetInnerHTML={{ __html: formatDate(auditor.status === auditConsts.checked || auditor.status === auditConsts.close? auditor.end_time : auditor.create_time) }}></div>
|
|
|
+ ) : null}
|
|
|
+ <div className={item.length - 1 === idx ? '' : 'timeline-item-tail'}></div>
|
|
|
+ {renderStatusIcon(auditor.status, false)}
|
|
|
+ <div className="timeline-item-content">
|
|
|
+ <div className="card-container">
|
|
|
+ <div className="card-content">
|
|
|
+ <div className="pi-justify-between label">
|
|
|
+ <span>{auditor.name}</span>
|
|
|
+ <span className={renderStatusEle(auditor.status, auditor.progress).textClass}>{renderStatusEle(auditor.status, auditor.progress).text}</span>
|
|
|
+ </div>
|
|
|
+ <div className="text-muted">{auditor.position}</div>
|
|
|
+ </div>
|
|
|
+ {auditor.opinion ? (
|
|
|
+ <div className="textarea">
|
|
|
+ <span>{auditor.opinion}</span>
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {idx === item.filter(item => item.progress === '0').length - 1 && !auditors.find(item => item.progress === '1')? (
|
|
|
+ <li className="timeline-list-item" >
|
|
|
+ <div className="timeline-item-tail"></div>
|
|
|
+ {renderStatusIcon(0, false)}
|
|
|
+ <div className="timeline-item-content">
|
|
|
+ <div className="card-container">
|
|
|
+ <div className="card-content">
|
|
|
+ <div className="pi-justify-between label">
|
|
|
+ <span>待指派</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </ul>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ }
|
|
|
return (
|
|
|
<table className="pi-table pi-bordered mt-3">
|
|
|
<thead>
|
|
@@ -253,66 +413,7 @@ const Index: React.FC<iAuditContentProps> = props => {
|
|
|
{!status ? (
|
|
|
<>
|
|
|
<td width="30%">
|
|
|
- <table className="table table-bordered">
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <td className="pi-text-center">检查人</td>
|
|
|
- <td>
|
|
|
- <SvgIcon type="xxh-play-circle"></SvgIcon>
|
|
|
- <span className="pi-mg-left-3">{auditors[0]?.name}</span>
|
|
|
- <small className="text-muted pi-mg-left-3">{auditors[0]?.position}</small>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- {auditors
|
|
|
- .filter(item => item.progress === '0')
|
|
|
- .map((item, idx) => {
|
|
|
- return idx === 0 ? (
|
|
|
- <tr key={item.audit_id}>
|
|
|
- <td rowSpan={auditors.filter(item => item.progress === '0').length} className="pi-text-center">
|
|
|
- 审批
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
- <span className="pi-mg-left-3">{item.name}</span>
|
|
|
- <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- ) : (
|
|
|
- <tr key={item.audit_id}>
|
|
|
- <td>
|
|
|
- <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
- <span className="pi-mg-left-3">{item.name}</span>
|
|
|
- <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- )
|
|
|
- })}
|
|
|
- {auditors
|
|
|
- .filter(item => item.progress === '2')
|
|
|
- .map((item, idx) => {
|
|
|
- return idx === 0 ? (
|
|
|
- <tr key={item.audit_id}>
|
|
|
- <td rowSpan={auditors.filter(item => item.progress === '2').length} className="pi-text-center">
|
|
|
- 复查
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
- <span className="pi-mg-left-3">{item.name}</span>
|
|
|
- <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- ) : (
|
|
|
- <tr key={item.audit_id}>
|
|
|
- <td>
|
|
|
- <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
- <span className="pi-mg-left-3">{item.name}</span>
|
|
|
- <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- )
|
|
|
- })}
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ <table className="table table-bordered">{renderLeftAuditors(status)}</table>
|
|
|
</td>
|
|
|
<td width="70%">
|
|
|
<div className="pi-justify-end">
|
|
@@ -333,7 +434,7 @@ const Index: React.FC<iAuditContentProps> = props => {
|
|
|
</div>
|
|
|
<div className="audit-card">
|
|
|
<div className="card-header">审批流程</div>
|
|
|
- {renderAuditorSelectItem()}
|
|
|
+ {renderAuditorSelectItem('check')}
|
|
|
</div>
|
|
|
<div className="audit-card">
|
|
|
<div className="card-header">整改流程</div>
|
|
@@ -369,108 +470,10 @@ const Index: React.FC<iAuditContentProps> = props => {
|
|
|
<td>
|
|
|
<div className="pi-flex-row">
|
|
|
<div className="pi-flex-sub pi-mg-right-15 pi-mg-top-5 pi-mg-left-5">
|
|
|
- <table className="table table-bordered pi-width-100P">
|
|
|
- <tbody>
|
|
|
- {auditors?.map((item, idx) => {
|
|
|
- if (!item.progress) {
|
|
|
- return (
|
|
|
- <tr key={item.audit_id}>
|
|
|
- <td className="pi-text-center">检查人</td>
|
|
|
- <td>
|
|
|
- <SvgIcon type="xxh-play-circle"></SvgIcon>
|
|
|
- <span className="pi-mg-left-3">{item.name}</span>
|
|
|
- <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- )
|
|
|
- } else if (item.progress === '0') {
|
|
|
- return auditors[idx - 1].progress === '0' ? (
|
|
|
- <tr key={item.audit_id}>
|
|
|
- <td>
|
|
|
- <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
- <span className="pi-mg-left-3">{item.name}</span>
|
|
|
- <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- ) : (
|
|
|
- <tr key={item.audit_id}>
|
|
|
- <td rowSpan={2} className="pi-text-center">
|
|
|
- 审批
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
- <span className="pi-mg-left-3">{item.name}</span>
|
|
|
- <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- )
|
|
|
- } else if (item.progress === '1' || !auditors.find(item => item.progress === '1')) {
|
|
|
- return !auditors.find(item => item.progress === '1') ? (
|
|
|
- <tr key={item.audit_id}>
|
|
|
- <td className="pi-text-center">整改</td>
|
|
|
- <td>
|
|
|
- <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
- <span>由 {auditors[idx - 1].name} 指派</span>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- ) : (
|
|
|
- <tr key={item.audit_id}>
|
|
|
- <td className="pi-text-center">整改</td>
|
|
|
- <td>
|
|
|
- <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'}></SvgIcon>
|
|
|
- <span className="pi-mg-left-3">{item.name}</span>
|
|
|
- <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- )
|
|
|
- } else {
|
|
|
- return (
|
|
|
- <tr key={item.audit_id}>
|
|
|
- <td className="pi-text-center">复查</td>
|
|
|
- <td>
|
|
|
- <SvgIcon type="xxh-stop-circle"></SvgIcon>
|
|
|
- <span className="pi-mg-left-3">{item.name}</span>
|
|
|
- <small className="text-muted pi-mg-left-3">{item.position}</small>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- )
|
|
|
- }
|
|
|
- })}
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ <table className="table table-bordered pi-width-100P">{renderLeftAuditors(status)}</table>
|
|
|
</div>
|
|
|
<div className="pi-flex-treble pi-mg-left-15">
|
|
|
- {auditHistory?.map((item, idx) => {
|
|
|
- return (
|
|
|
- <ul className="timeline-list" key={idx}>
|
|
|
- {item?.map((auditor, idx) => (
|
|
|
- <li className="timeline-list-item" key={auditor.id}>
|
|
|
- <div className="timeline-item-date pi-flex-column" dangerouslySetInnerHTML={{ __html: formatDate(auditor.create_time) }}></div>
|
|
|
- <div className={item.length - 1 === idx ? '' : 'timeline-item-tail'}></div>
|
|
|
- {renderStatusIcon(auditor.status, idx === 0 ? true : false)}
|
|
|
- <div className="timeline-item-content">
|
|
|
- <div className="card-container">
|
|
|
- <div className="card-content">
|
|
|
- <div className="pi-justify-between label">
|
|
|
- <span>{auditor.name}</span>
|
|
|
- <span className={renderStatusEle(auditor.status, auditor.progress).textClass}>
|
|
|
- {idx === 0 ? '上报审批' : renderStatusEle(auditor.status, auditor.progress).text}
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <div className="text-muted">{auditor.position}</div>
|
|
|
- </div>
|
|
|
- {auditor.opinion ? (
|
|
|
- <div className="textarea">
|
|
|
- <span>{auditor.opinion}</span>
|
|
|
- </div>
|
|
|
- ) : null}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- ))}
|
|
|
- </ul>
|
|
|
- )
|
|
|
- })}
|
|
|
+ {renderHistory()}
|
|
|
</div>
|
|
|
</div>
|
|
|
</td>
|