|
@@ -16,29 +16,16 @@ import {
|
|
} from '@ant-design/icons'
|
|
} from '@ant-design/icons'
|
|
import LeftMenu from '../RuleCode/components/LeftMenu'
|
|
import LeftMenu from '../RuleCode/components/LeftMenu'
|
|
import ProTable from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
-import { useState } from 'react'
|
|
|
|
|
|
+import { useEffect, useState } from 'react'
|
|
import styles from './index.less'
|
|
import styles from './index.less'
|
|
|
|
|
|
export enum TemplateMode {
|
|
export enum TemplateMode {
|
|
PAPER = 'paper',
|
|
PAPER = 'paper',
|
|
UPLOAD = 'upload'
|
|
UPLOAD = 'upload'
|
|
}
|
|
}
|
|
-
|
|
|
|
-interface IState {
|
|
|
|
- subjectParams: {
|
|
|
|
- gatherID?: Nullable<string>
|
|
|
|
- businessType?: Nullable<string>
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
const Inventory = () => {
|
|
const Inventory = () => {
|
|
const [modal, ModalDOM] = useModal()
|
|
const [modal, ModalDOM] = useModal()
|
|
- const [state, setState] = useState<IState>({
|
|
|
|
- subjectParams: {
|
|
|
|
- gatherID: '',
|
|
|
|
- businessType: ''
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ const [activeKey, setActivekey] = useState<Nullable<string>>(null)
|
|
const {
|
|
const {
|
|
query,
|
|
query,
|
|
loading,
|
|
loading,
|
|
@@ -51,7 +38,13 @@ const Inventory = () => {
|
|
editFolder,
|
|
editFolder,
|
|
deleteFolderOrFile,
|
|
deleteFolderOrFile,
|
|
moveWithOperation
|
|
moveWithOperation
|
|
- } = useRowScript(modal)
|
|
|
|
|
|
+ } = useRowScript(modal, activeKey)
|
|
|
|
+
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ if (activeKey) {
|
|
|
|
+ query()
|
|
|
|
+ }
|
|
|
|
+ }, [activeKey])
|
|
|
|
|
|
const columns: ColumnsType<API.ProfileTemplateItem> = [
|
|
const columns: ColumnsType<API.ProfileTemplateItem> = [
|
|
{
|
|
{
|
|
@@ -111,9 +104,7 @@ const Inventory = () => {
|
|
]
|
|
]
|
|
|
|
|
|
const handleMenuOnChange = (key: string) => {
|
|
const handleMenuOnChange = (key: string) => {
|
|
- const [gatherID, businessType] = key.split('_')
|
|
|
|
- query({ gatherID, businessType })
|
|
|
|
- setState({ ...state, subjectParams: { ...state.subjectParams, gatherID, businessType } })
|
|
|
|
|
|
+ setActivekey(key)
|
|
}
|
|
}
|
|
return (
|
|
return (
|
|
<PageContainer title={false}>
|
|
<PageContainer title={false}>
|
|
@@ -132,7 +123,7 @@ const Inventory = () => {
|
|
size="small"
|
|
size="small"
|
|
type="primary"
|
|
type="primary"
|
|
ghost
|
|
ghost
|
|
- onClick={() => addFolder(state.subjectParams)}>
|
|
|
|
|
|
+ onClick={() => addFolder()}>
|
|
新建目录
|
|
新建目录
|
|
</Button>
|
|
</Button>
|
|
<Button
|
|
<Button
|
|
@@ -140,7 +131,7 @@ const Inventory = () => {
|
|
size="small"
|
|
size="small"
|
|
type="primary"
|
|
type="primary"
|
|
ghost
|
|
ghost
|
|
- onClick={() => addFile('add', state.subjectParams)}>
|
|
|
|
|
|
+ onClick={() => addFile('add')}>
|
|
新建文件
|
|
新建文件
|
|
</Button>
|
|
</Button>
|
|
<Button
|
|
<Button
|
|
@@ -150,7 +141,7 @@ const Inventory = () => {
|
|
ghost
|
|
ghost
|
|
onClick={() => {
|
|
onClick={() => {
|
|
record?.folder && editFolder()
|
|
record?.folder && editFolder()
|
|
- !record?.folder && addFile('update', state.subjectParams)
|
|
|
|
|
|
+ !record?.folder && addFile('update')
|
|
}}
|
|
}}
|
|
disabled={!record}>
|
|
disabled={!record}>
|
|
编辑
|
|
编辑
|