Commit d65216e0 by zhaochengxiang

资源目录

parent 7f796881
......@@ -264,4 +264,8 @@ export function* resourceTestSyncStrategy(payload) {
export function* getDirectoryWithSyncStrategy(payload) {
return yield call(service.getDirectoryWithSyncStrategy, payload)
}
export function* resourceSyncSchema(payload) {
return yield call(service.resourceSyncSchema, payload)
}
\ No newline at end of file
......@@ -254,4 +254,8 @@ export function getPreviewRangeByDirId(payload) {
export function getDirectoryWithSyncStrategy(payload) {
return GetJSON("/dataassetmanager/resourceApi/getDirectoryWithSyncStrategy", payload)
}
export function resourceSyncSchema(payload) {
return Post("/dataassetmanager/resourceApi/syncSchema", payload);
}
\ No newline at end of file
......@@ -4,7 +4,7 @@ import { PlusOutlined, ReloadOutlined, ImportOutlined, ExportOutlined, SettingOu
import produce from 'immer'
import { dispatch } from '../../../model'
import { showMessage, highlightSearchContentByTerms } from '../../../util'
import { showMessage, highlightSearchContentByTerms, showNotifaction } from '../../../util'
import Tree from '../../../util/Component/Tree'
import PermissionButton from '../../../util/Component/PermissionButton'
import UpdateNode from './update-node'
......@@ -143,6 +143,7 @@ const FC = (props) => {
{ id: 'up', title: '上移栏目' },
{ id: 'down', title: '下移栏目' },
{ id: 'delete', title: '删除栏目' },
{ id: 'sync', title: '同步Schema' },
]
} else if (rightSelectedNode.resourceType === 'custom' || rightSelectedNode.type === 'custom') {
return [
......@@ -156,6 +157,7 @@ const FC = (props) => {
{ id: 'up', title: '上移目录' },
{ id: 'down', title: '下移目录' },
{ id: 'delete', title: '删除目录' },
{ id: 'sync', title: '同步Schema' },
]
}
}
......@@ -300,6 +302,26 @@ const FC = (props) => {
getTreeData(false)
}
const onSyncNodeClick = () => {
modal.confirm({
title: '提示',
content: '确定同步schema吗?',
onOk: () => {
dispatch({
type: 'assetmanage.resourceSyncSchema',
payload: {
params: {
dirId: rightSelectedNode?.nodeId
}
},
callback: (data) => {
showNotifaction('同步提示', data, 5)
}
})
}
})
}
const onTreeExpand = (expandedKeys) => {
setExpandedKeys(expandedKeys)
setAutoExpandParent(false)
......@@ -352,6 +374,7 @@ const FC = (props) => {
}
const onMenuItemClick = (key, node) => {
console.log('key', key)
if (key === 'delete') {
onDeleteNodeClick(node)
} else if (key === 'edit') {
......@@ -364,6 +387,8 @@ const FC = (props) => {
onMoveNodeClick(1)
} else if (key === 'down') {
onMoveNodeClick(-1)
} else if (key === 'sync') {
onSyncNodeClick()
}
}
......
......@@ -17,6 +17,7 @@ const FC = (props) => {
const [loading, setLoading] = React.useState(false)
const [waiting, setWaiting] = React.useState(false)
const [node, setNode] = React.useState()
const [isCustomType, setIsCustomType] = React.useState(false)
const basicRef = React.useRef()
const syncBasicRef = React.useRef()
......@@ -35,6 +36,9 @@ const FC = (props) => {
},
callback: data => {
setNode(data)
if (action !== 'add') {
setIsCustomType(data?.directory?.resourceType==='custom'||data?.directory?.type==='custom')
}
}
})
}
......@@ -110,8 +114,17 @@ const FC = (props) => {
onCancel={() => { close() }}
>
<Spin spinning={loading||waiting} >
<Basic ref={basicRef} node={node?.directory} action={action} />
<SyncBasic ref={syncBasicRef} node={node?.resourceDirectorySyncStrategy} action={action} />
<Basic
ref={basicRef}
node={node?.directory}
action={action}
onResourceTypeChange={(val) => {
setIsCustomType(val === 'custom')
}}
/>
{
!isCustomType && <SyncBasic ref={syncBasicRef} node={node?.resourceDirectorySyncStrategy} action={action} />
}
</Spin>
</Modal>
)
......@@ -119,7 +132,7 @@ const FC = (props) => {
export default FC
export const Basic = React.forwardRef(function ({ node, action }, ref) {
export const Basic = React.forwardRef(function ({ node, action, onResourceTypeChange }, ref) {
const [type, setType] = React.useState('root')
const [currentResourceType, setCurrentResourceType] = React.useState()
......@@ -146,7 +159,9 @@ export const Basic = React.forwardRef(function ({ node, action }, ref) {
}, [action, node])
const onValuesChange = (changedValues, allValues) => {
if (changedValues.hasOwnProperty('resourceType')) {
onResourceTypeChange(changedValues.resourceType)
}
}
return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment