diff --git a/service-web/client/src/pages/Test.tsx b/service-web/client/src/pages/Test.tsx index 36334a0..6eee028 100644 --- a/service-web/client/src/pages/Test.tsx +++ b/service-web/client/src/pages/Test.tsx @@ -1,4 +1,4 @@ -import {DeleteFilled, EditFilled, FolderFilled, PlusCircleFilled, SaveFilled} from '@ant-design/icons' +import {DeleteFilled, EditFilled, PlusCircleFilled, SaveFilled} from '@ant-design/icons' import { addEdge, applyEdgeChanges, @@ -34,6 +34,14 @@ const FlowableDiv = styled.div` z-index: 999; position: absolute; } + + .node-card { + cursor: grab; + + .card-container { + cursor: default; + } + } ` type AmisNodeType = 'normal' | 'start' | 'end' @@ -46,15 +54,17 @@ const AmisNode = ( columnSchema?: Schema[], ) => { const {id, data} = props - const {removeNode, editNode} = data + const {getDataById, removeNode, editNode} = data return (
@@ -258,7 +268,7 @@ const useFlowStore = create<{ addNode: node => set({nodes: get().nodes.concat(node)}), removeNode: id => { set({ - nodes: filter(get().nodes, node => !isEqual(node.id, id)) + nodes: filter(get().nodes, node => !isEqual(node.id, id)), }) }, setNodes: nodes => set({nodes}), @@ -302,7 +312,6 @@ function Test() { }, ]) const [open, setOpen] = useState(false) - const onClose = () => setOpen(false) const {getData, getDataById, setDataById} = useStore() const { @@ -323,28 +332,70 @@ function Test() { setCurrentNodeForm( amisRender( { - debug: commonInfo.debug, - title: name, - type: 'form', - wrapWithPanel: false, - onEvent: { - change: { - actions: [ + type: 'wrapper', + size: 'none', + body: [ + { + type: 'tpl', + className: 'text-secondary', + tpl: description, + }, + { + debug: commonInfo.debug, + title: name, + type: 'form', + wrapWithPanel: false, + onEvent: { + submitSucc: { + actions: [ + { + actionType: 'custom', + // @ts-ignore + script: (context, action, event) => { + setDataById(id, context.props.data) + setOpen(false) + }, + }, + ], + }, + }, + body: [ + ...(columnSchema ?? []), { - actionType: 'custom', - // @ts-ignore - script: (context, action, event) => { - console.log(id, context.props.data) - setDataById(id, context.props.data) - }, - } - ] - } - }, - body: columnSchema, + type: 'wrapper', + size: 'none', + className: 'space-x-1 float-right', + body: [ + { + type: 'action', + label: '取消', + onEvent: { + click: { + actions: [ + { + actionType: 'custom', + // @ts-ignore + script: (context, action, event) => { + setOpen(false) + }, + }, + ], + }, + }, + }, + { + type: 'submit', + label: '保存', + level: 'primary', + }, + ], + }, + ], + }, + ] }, getDataById(id), - ) + ), ) setOpen(true) } @@ -407,7 +458,8 @@ function Test() { {currentNodeForm}