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,22 +176,12 @@ 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)}
expressionScope={{
controllerBtns
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
......@@ -192,8 +192,6 @@ const Repositories: React.FC<{}> = () => {
}}
schema={repositSchema}
/>
</Col>
</Row>
}
/>
</Card>
......
......@@ -11,6 +11,20 @@ export const repositSchema: ISchema = {
type: 'object',
"x-component": 'mega-layout',
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: {
type: 'string',
"x-component": 'Search',
......@@ -19,11 +33,27 @@ export const repositSchema: ISchema = {
"x-component-props": {
placeholder: '请输入仓位名称'
}
}
}
},
[FORM_FILTER_PATH]: {
type: 'object',
"x-component": "mega-layout",
visible: false,
"x-component": "flex-layout",
"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": {
inline: true
},
......@@ -54,8 +84,13 @@ export const repositSchema: ISchema = {
},
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