@@ -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}