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,34 +176,22 @@ const Repositories: React.FC<{}> = () => { ...@@ -166,34 +176,22 @@ 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"> <NiceForm
<Col> actions={formActions}
<Space> onSubmit={values => ref.current.reload(values)}
<Button expressionScope={{
type="primary" controllerBtns
onClick={handleToAdd} }}
icon={<PlusOutlined />} effects={($, actions) => {
> useStateFilterSearchLinkageEffect(
新建 $,
</Button> actions,
</Space> 'search',
</Col> FORM_FILTER_PATH,
<Col> );
<NiceForm }}
actions={formActions} schema={repositSchema}
onSubmit={values => ref.current.reload(values)} />
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'search',
FORM_FILTER_PATH,
);
}}
schema={repositSchema}
/>
</Col>
</Row>
} }
/> />
</Card> </Card>
......
...@@ -11,51 +11,86 @@ export const repositSchema: ISchema = { ...@@ -11,51 +11,86 @@ export const repositSchema: ISchema = {
type: 'object', type: 'object',
"x-component": 'mega-layout', "x-component": 'mega-layout',
properties: { properties: {
search: { topLayout: {
type: 'string',
"x-component": 'Search',
"x-mega-props": {
},
"x-component-props": {
placeholder: '请输入仓位名称'
}
},
[FORM_FILTER_PATH]: {
type: 'object', type: 'object',
"x-component": "mega-layout", "x-component": 'mega-layout',
visible: false,
"x-component-props": { "x-component-props": {
inline: true grid: true
}, },
properties: { properties: {
productName: { ctl: {
type: 'string', type: 'object',
"x-component": 'Children',
"x-component-props": { "x-component-props": {
placeholder: '商品名称' children: "{{controllerBtns}}"
} }
}, },
productId: { search: {
type: 'string', type: 'string',
"x-component": 'Search',
"x-mega-props": {
},
"x-component-props": { "x-component-props": {
placeholder: '商品ID' placeholder: '请输入仓位名称'
} }
}
}
},
[FORM_FILTER_PATH]: {
type: 'object',
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: 'nowrap'
}, },
category: { colStyle: {
type: 'string', marginLeft: 20
"x-component-props": { }
placeholder: '请选择品类' },
properties: {
PRO_LAYOUT: {
type: 'object',
"x-component": 'mega-layout',
"x-mega-props": {
span: 5
}, },
enum: []
},
brand: {
type: 'string',
"x-component-props": { "x-component-props": {
placeholder: '请选择品牌' inline: true
}, },
enum: [] properties: {
productName: {
type: 'string',
"x-component-props": {
placeholder: '商品名称'
}
},
productId: {
type: 'string',
"x-component-props": {
placeholder: '商品ID'
}
},
category: {
type: 'string',
"x-component-props": {
placeholder: '请选择品类'
},
enum: []
},
brand: {
type: 'string',
"x-component-props": {
placeholder: '请选择品牌'
},
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