|
@@ -37,14 +37,15 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
|
|
|
visible: false,
|
|
|
auditType: ''
|
|
|
})
|
|
|
- // 是否是审批组的最后一个审核人
|
|
|
+ // 当前审批人是否是审批组的最后一个审核人
|
|
|
const isLastAuditor = useMemo(() => {
|
|
|
+ if (curAuditor.progress !== '0') return false
|
|
|
const len = auditors.filter(item => item.progress === '0').length
|
|
|
if (len && auditors.filter(item => item.progress === '0')[len - 1].audit_id === userStore.userInfo.id) {
|
|
|
return true
|
|
|
}
|
|
|
return false
|
|
|
- }, [ auditors, type ])
|
|
|
+ }, [ auditors, type, curAuditor ])
|
|
|
const [ groups, setGroups ] = useState<Array<iAccountGroupItem>>([])
|
|
|
const [ user, setUser ] = useState<iUserInfo>({
|
|
|
account: '',
|
|
@@ -87,6 +88,13 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
|
|
|
form.setFieldsValue({ opinion: '已按要求整改完成。' })
|
|
|
}
|
|
|
|
|
|
+ if (isLastAuditor && auditors.findIndex(item => item.progress === '1') !== -1) {
|
|
|
+
|
|
|
+ const auditor = auditors.find(item => item.progress === '1')
|
|
|
+ console.log('auditor', auditor)
|
|
|
+
|
|
|
+ auditor && (setUser({ ...user, id: auditor.audit_id, company: auditor.company, name: auditor.name, position: auditor.position }))
|
|
|
+ }
|
|
|
isLastAuditor && initGroupList()
|
|
|
}
|
|
|
if (visible && type === 'back') {
|
|
@@ -137,12 +145,13 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
|
|
|
const newAuditors = auditors
|
|
|
.filter(item => item.progress === '' && item.audit_order < curAuditor.auditOrder)
|
|
|
.map(item => {
|
|
|
+
|
|
|
return mapUser(item.name, item.id, item.position, item.company, item.mobile)
|
|
|
})
|
|
|
- newGroup.push({ value: '检查人', children: newAuditors })
|
|
|
- }
|
|
|
- if (index === 1) {
|
|
|
- const newAuditors = auditors
|
|
|
+ newGroup.push({ value: '检查人', children: newAuditors })
|
|
|
+ }
|
|
|
+ if (index === 1) {
|
|
|
+ const newAuditors = auditors
|
|
|
.filter(item => item.progress === '0' && item.audit_order < curAuditor.auditOrder)
|
|
|
.map(item => {
|
|
|
return mapUser(item.name, item.id, item.position, item.company, item.mobile)
|
|
@@ -227,9 +236,6 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
|
|
|
|
|
|
const itemSelectHandler = (item: iUserInfo, type: string = '') => {
|
|
|
setUser({ ...user, ...item })
|
|
|
-
|
|
|
- console.log(item)
|
|
|
-
|
|
|
setModal({ ...modal, visible: false, auditType: type })
|
|
|
}
|
|
|
|
|
@@ -279,7 +285,7 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
|
|
|
</Popover>
|
|
|
) : null}
|
|
|
|
|
|
- {user.name ? (
|
|
|
+ {user.id ? (
|
|
|
<>
|
|
|
<div className="pi-bordered pi-warning">
|
|
|
<span>已选择退回流程: </span>
|
|
@@ -346,7 +352,7 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
|
|
|
</Popover>
|
|
|
) : null}
|
|
|
|
|
|
- {user.id ? (
|
|
|
+ {user.id && isLastAuditor ? (
|
|
|
<p className="pi-bordered pi-pd-8 pi-mg-top-5">
|
|
|
<span>已指派整改人: </span>
|
|
|
<span>
|