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

补充仓位schema能力

parent b9d80389
......@@ -2,7 +2,8 @@ import React from 'react';
import SchemaForm, {
IAntdSchemaFormProps, createVirtualBox, registerVirtualBox,
} 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 CustomStatus from './components/CustomStatus';
import CustomAddArray from './components/CustomAddArray';
......@@ -18,6 +19,27 @@ import Children from './components/Children';
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 { children, components, ...reset } = props;
const customComponents = {
......
......@@ -366,7 +366,7 @@ const AdjustRepository:React.FC<{}> = (props) => {
return (<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title="新建仓位"
title="仓位库存调拨"
extra={[
<Button key="1" type="primary" icon={<SaveOutlined />}>
保存
......
......@@ -157,6 +157,16 @@ const Repositories: React.FC<{}> = () => {
history.push(`/memberCenter/commodityAbility/repositories/addRepository`);
};
const controllerBtns = <Space>
<Button
type="primary"
onClick={handleToAdd}
icon={<PlusOutlined />}
>
新建
</Button>
</Space>
return (
<PageHeaderWrapper>
<Card>
......@@ -166,34 +176,22 @@ const Repositories: React.FC<{}> = () => {
tableProps={{ rowKey: 'id' }}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<Row justify="space-between">
<Col>
<Space>
<Button
type="primary"
onClick={handleToAdd}
icon={<PlusOutlined />}
>
新建
</Button>
</Space>
</Col>
<Col>
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'search',
FORM_FILTER_PATH,
);
}}
schema={repositSchema}
/>
</Col>
</Row>
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
expressionScope={{
controllerBtns
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'search',
FORM_FILTER_PATH,
);
}}
schema={repositSchema}
/>
}
/>
</Card>
......
......@@ -11,51 +11,86 @@ export const repositSchema: ISchema = {
type: 'object',
"x-component": 'mega-layout',
properties: {
search: {
type: 'string',
"x-component": 'Search',
"x-mega-props": {
},
"x-component-props": {
placeholder: '请输入仓位名称'
}
},
[FORM_FILTER_PATH]: {
topLayout: {
type: 'object',
"x-component": "mega-layout",
visible: false,
"x-component": 'mega-layout',
"x-component-props": {
inline: true
grid: true
},
properties: {
productName: {
type: 'string',
ctl: {
type: 'object',
"x-component": 'Children',
"x-component-props": {
placeholder: '商品名称'
children: "{{controllerBtns}}"
}
},
productId: {
search: {
type: 'string',
"x-component": 'Search',
"x-mega-props": {
},
"x-component-props": {
placeholder: '商品ID'
placeholder: '请输入仓位名称'
}
}
}
},
[FORM_FILTER_PATH]: {
type: 'object',
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: 'nowrap'
},
category: {
type: 'string',
"x-component-props": {
placeholder: '请选择品类'
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: 'object',
"x-component": 'mega-layout',
"x-mega-props": {
span: 5
},
enum: []
},
brand: {
type: 'string',
"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: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
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