|
|
@@ -1,9 +1,9 @@
|
|
|
-import React, { useMemo, useState, useEffect } from 'react'
|
|
|
+import React, { useMemo, useState, useEffect, useCallback } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
import { selectObj } from '@/utils/dataChange'
|
|
|
import history from '@/utils/history'
|
|
|
import { MessageFu } from '@/utils/message'
|
|
|
-import { authorityFu } from '@/utils/authority'
|
|
|
+import { authorityFu, tableListAuditBtnFu } from '@/utils/authority'
|
|
|
import TableList from '@/pages/Zother/TableList'
|
|
|
import { useSelector } from 'react-redux'
|
|
|
import { RootState } from '@/store'
|
|
|
@@ -205,42 +205,36 @@ function A3flow() {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ const btnFu = useCallback((pageKey: '3' | '4', obj: any, id: number) => {
|
|
|
+ if (obj) {
|
|
|
+ authorityFu(obj.id, obj.label, () => history.push(`${obj.path}_edit/${pageKey}/${id}`))
|
|
|
+ } else MessageFu.warning('申请类型错误')
|
|
|
+ }, [])
|
|
|
+
|
|
|
// 故事管理/藏品总账定制右侧操作按钮
|
|
|
const storyTableLastBtn = useMemo(() => {
|
|
|
return [
|
|
|
{
|
|
|
title: '操作',
|
|
|
- render: (item: any) => (
|
|
|
- <>
|
|
|
- <Button
|
|
|
- size='small'
|
|
|
- type='text'
|
|
|
- onClick={() => {
|
|
|
- console.log(item)
|
|
|
- const obj = list.find(v => v.value === item.type)
|
|
|
- if (obj) {
|
|
|
- authorityFu(obj.id, obj.label, () =>
|
|
|
- history.push(`${obj.path}_edit/4/${item.id}`)
|
|
|
- )
|
|
|
- } else MessageFu.warning('申请类型错误')
|
|
|
- }}
|
|
|
- >
|
|
|
- 查看
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- size='small'
|
|
|
- type='text'
|
|
|
- onClick={() => {
|
|
|
- alert('审批')
|
|
|
- }}
|
|
|
- >
|
|
|
- 审批
|
|
|
- </Button>
|
|
|
- </>
|
|
|
- )
|
|
|
+ render: (item: any) => {
|
|
|
+ const obj = list.find(v => v.value === item.type)
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <Button size='small' type='text' onClick={() => btnFu('4', obj, item.id)}>
|
|
|
+ 查看
|
|
|
+ </Button>
|
|
|
+
|
|
|
+ {tableListAuditBtnFu(item) ? (
|
|
|
+ <Button size='small' type='text' onClick={() => btnFu('3', obj, item.id)}>
|
|
|
+ 审批
|
|
|
+ </Button>
|
|
|
+ ) : null}
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
]
|
|
|
- }, [list])
|
|
|
+ }, [btnFu, list])
|
|
|
|
|
|
return (
|
|
|
<div className={styles.A3flow}>
|