Commit c8d6033e authored by 前端-许佳敏's avatar 前端-许佳敏

补充仓位schema能力

parent b9d80389
...@@ -2,7 +2,8 @@ import React from 'react'; ...@@ -2,7 +2,8 @@ import React from 'react';
import SchemaForm, { import SchemaForm, {
IAntdSchemaFormProps, createVirtualBox, registerVirtualBox, IAntdSchemaFormProps, createVirtualBox, registerVirtualBox,
} from '@formily/antd'; } from '@formily/antd';
import { Button, Space } from 'antd'; import { Button, Space, Row, Col } from 'antd';
import styled from 'styled-components'
import CustomUpload from './components/CustomUpload'; import CustomUpload from './components/CustomUpload';
import CustomStatus from './components/CustomStatus'; import CustomStatus from './components/CustomStatus';
import CustomAddArray from './components/CustomAddArray'; import CustomAddArray from './components/CustomAddArray';
...@@ -18,6 +19,27 @@ import Children from './components/Children'; ...@@ -18,6 +19,27 @@ import Children from './components/Children';
export interface NiceFormProps extends IAntdSchemaFormProps {} export interface NiceFormProps extends IAntdSchemaFormProps {}
const RowLayout = styled(props => <Row justify='end' {...props}/>)`
.mega-layout-item {
margin-bottom: 20px !important;
}
.mega-layout-container {
margin-bottom: 0;
}
`
registerVirtualBox('flex-layout', (_props) => {
const { children, props } = _props
const rowStyle = props['x-component-props'] ? props['x-component-props'].rowStyle : {}
const colStyle = props['x-component-props'] ? props['x-component-props'].colStyle : {}
return (
<RowLayout style={rowStyle}>
{
children.map((v, i) => <Col style={colStyle} key={i}>{v}</Col>)
}
</RowLayout>
)
})
const NiceForm: React.FC<NiceFormProps> = props => { const NiceForm: React.FC<NiceFormProps> = props => {
const { children, components, ...reset } = props; const { children, components, ...reset } = props;
const customComponents = { const customComponents = {
......
...@@ -366,7 +366,7 @@ const AdjustRepository:React.FC<{}> = (props) => { ...@@ -366,7 +366,7 @@ const AdjustRepository:React.FC<{}> = (props) => {
return (<PageHeaderWrapper return (<PageHeaderWrapper
onBack={() => history.goBack()} onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>} backIcon={<ReutrnEle description="返回"/>}
title="新建仓位" title="仓位库存调拨"
extra={[ extra={[
<Button key="1" type="primary" icon={<SaveOutlined />}> <Button key="1" type="primary" icon={<SaveOutlined />}>
保存 保存
......
...@@ -157,6 +157,16 @@ const Repositories: React.FC<{}> = () => { ...@@ -157,6 +157,16 @@ const Repositories: React.FC<{}> = () => {
history.push(`/memberCenter/commodityAbility/repositories/addRepository`); history.push(`/memberCenter/commodityAbility/repositories/addRepository`);
}; };
const controllerBtns = <Space>
<Button
type="primary"
onClick={handleToAdd}
icon={<PlusOutlined />}
>
新建
</Button>
</Space>
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
...@@ -166,22 +176,12 @@ const Repositories: React.FC<{}> = () => { ...@@ -166,22 +176,12 @@ const Repositories: React.FC<{}> = () => {
tableProps={{ rowKey: 'id' }} tableProps={{ rowKey: 'id' }}
fetchTableData={(params: any) => fetchData(params)} fetchTableData={(params: any) => fetchData(params)}
controlRender={ controlRender={
<Row justify="space-between">
<Col>
<Space>
<Button
type="primary"
onClick={handleToAdd}
icon={<PlusOutlined />}
>
新建
</Button>
</Space>
</Col>
<Col>
<NiceForm <NiceForm
actions={formActions} actions={formActions}
onSubmit={values => ref.current.reload(values)} onSubmit={values => ref.current.reload(values)}
expressionScope={{
controllerBtns
}}
effects={($, actions) => { effects={($, actions) => {
useStateFilterSearchLinkageEffect( useStateFilterSearchLinkageEffect(
$, $,
...@@ -192,8 +192,6 @@ const Repositories: React.FC<{}> = () => { ...@@ -192,8 +192,6 @@ const Repositories: React.FC<{}> = () => {
}} }}
schema={repositSchema} schema={repositSchema}
/> />
</Col>
</Row>
} }
/> />
</Card> </Card>
......
...@@ -11,6 +11,20 @@ export const repositSchema: ISchema = { ...@@ -11,6 +11,20 @@ export const repositSchema: ISchema = {
type: 'object', type: 'object',
"x-component": 'mega-layout', "x-component": 'mega-layout',
properties: { properties: {
topLayout: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
grid: true
},
properties: {
ctl: {
type: 'object',
"x-component": 'Children',
"x-component-props": {
children: "{{controllerBtns}}"
}
},
search: { search: {
type: 'string', type: 'string',
"x-component": 'Search', "x-component": 'Search',
...@@ -19,11 +33,27 @@ export const repositSchema: ISchema = { ...@@ -19,11 +33,27 @@ export const repositSchema: ISchema = {
"x-component-props": { "x-component-props": {
placeholder: '请输入仓位名称' placeholder: '请输入仓位名称'
} }
}
}
}, },
[FORM_FILTER_PATH]: { [FORM_FILTER_PATH]: {
type: 'object', type: 'object',
"x-component": "mega-layout", "x-component": "flex-layout",
visible: false, "x-component-props": {
rowStyle: {
flexWrap: 'nowrap'
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: 'object',
"x-component": 'mega-layout',
"x-mega-props": {
span: 5
},
"x-component-props": { "x-component-props": {
inline: true inline: true
}, },
...@@ -54,8 +84,13 @@ export const repositSchema: ISchema = { ...@@ -54,8 +84,13 @@ export const repositSchema: ISchema = {
}, },
enum: [] enum: []
}, },
}
},
submit: { submit: {
"x-component": 'Submit', "x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": { "x-component-props": {
children: '查询' children: '查询'
} }
......
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