Commit d467376d authored by tjy's avatar tjy

调整新增单据页面

parent 0387a36c
import React from 'react';
import { Row, Col, Input } from 'antd';
import styled from 'styled-components';
const Relevance = props => {
return (
<Row>
<Col>123</Col>
<Col>456</Col>
</Row>
);
};
Relevance.defaultProps = {};
Relevance.isFieldComponent = true;
export default Relevance;
...@@ -11,6 +11,7 @@ export interface SearchProps { ...@@ -11,6 +11,7 @@ export interface SearchProps {
} }
const Search = props => { const Search = props => {
// console.log(props);
const [state, setState] = useFieldState({ const [state, setState] = useFieldState({
filterSearch: false, filterSearch: false,
}); });
...@@ -41,7 +42,13 @@ const Search = props => { ...@@ -41,7 +42,13 @@ const Search = props => {
高级筛选 高级筛选
{state.filterSearch ? <CaretUpOutlined /> : <CaretDownOutlined />} {state.filterSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}
</Button> </Button>
<Button onClick={() => props.form.reset()}>重置</Button> <Button
onClick={() => {
props.form.reset();
}}
>
重置
</Button>
</Space> </Space>
); );
}; };
......
...@@ -16,6 +16,7 @@ import Text from './components/Text'; ...@@ -16,6 +16,7 @@ import Text from './components/Text';
import CardCheckBox from './components/CardCheckBox'; import CardCheckBox from './components/CardCheckBox';
import MultTable from './components/MultTable'; import MultTable from './components/MultTable';
import CustomRegistryPhone from './components/CustomRegistryPhone'; import CustomRegistryPhone from './components/CustomRegistryPhone';
import CustomRelevance from './components/CustomRelevance';
export interface NiceFormProps extends IAntdSchemaFormProps {} export interface NiceFormProps extends IAntdSchemaFormProps {}
...@@ -32,6 +33,7 @@ const NiceForm: React.FC<NiceFormProps> = props => { ...@@ -32,6 +33,7 @@ const NiceForm: React.FC<NiceFormProps> = props => {
CardCheckBox, CardCheckBox,
MultTable, MultTable,
CustomRegistryPhone, CustomRegistryPhone,
CustomRelevance,
}; };
const defineComponents = Object.assign(customComponents, components); const defineComponents = Object.assign(customComponents, components);
......
import React, { ReactNode, useRef, useState } from 'react' import React, { ReactNode, useRef, useState } from 'react';
import { history } from 'umi' import { history } from 'umi';
import { Button, Popconfirm, Card, Row, Col, Dropdown, Input, Select, Space } from 'antd' import {
import { PageHeaderWrapper } from '@ant-design/pro-layout' Button,
Popconfirm,
Card,
Row,
Col,
Dropdown,
Input,
Select,
Space,
} from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { import {
PlusOutlined, PlusOutlined,
PlayCircleOutlined, PlayCircleOutlined,
...@@ -9,29 +19,32 @@ import { ...@@ -9,29 +19,32 @@ import {
DownOutlined, DownOutlined,
CaretUpOutlined, CaretUpOutlined,
CaretDownOutlined, CaretDownOutlined,
} from '@ant-design/icons' } from '@ant-design/icons';
import { StandardTable } from 'god' import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface' import { ColumnType } from 'antd/lib/table/interface';
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController' import {
import EyePreview from '@/components/EyePreview' IFormFilter,
import StatusSwitch from '@/components/StatusSwitch' IButtonFilter,
import NiceForm from '@/components/NiceForm' } from 'god/dist/src/standard-table/TableController';
import { createFormActions, FormEffectHooks } from '@formily/antd' import EyePreview from '@/components/EyePreview';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch' import StatusSwitch from '@/components/StatusSwitch';
import { FORM_FILTER_PATH } from '@/formSchema/const' import NiceForm from '@/components/NiceForm';
import { repositSchema } from './schema' import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PublicApi } from '@/services/api' import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { repositSchema } from './schema';
import { PublicApi } from '@/services/api';
const formActions = createFormActions() const formActions = createFormActions();
// 模拟请求 // 模拟请求
const fetchData = async (params:any) => { const fetchData = async (params: any) => {
const res = await PublicApi.getWarehouseFreightSpaceList(params) const res = await PublicApi.getWarehouseFreightSpaceList(params);
return res.data return res.data;
} };
const Repositories: React.FC<{}> = () => { const Repositories: React.FC<{}> = () => {
const ref = useRef<any>({}) const ref = useRef<any>({});
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
...@@ -45,7 +58,13 @@ const Repositories: React.FC<{}> = () => { ...@@ -45,7 +58,13 @@ const Repositories: React.FC<{}> = () => {
dataIndex: 'reposName', dataIndex: 'reposName',
align: 'center', align: 'center',
key: 'reposName', key: 'reposName',
render: (text:any, record:any) => <EyePreview url={`/repositories/viewRepository?id=${record.key}&preview=1`}>{text}</EyePreview> render: (text: any, record: any) => (
<EyePreview
url={`/repositories/viewRepository?id=${record.key}&preview=1`}
>
{text}
</EyePreview>
),
}, },
{ {
title: '商品名称', title: '商品名称',
...@@ -82,59 +101,76 @@ const Repositories: React.FC<{}> = () => { ...@@ -82,59 +101,76 @@ const Repositories: React.FC<{}> = () => {
align: 'center', align: 'center',
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
render: (text: any, record:any) => <StatusSwitch handleConfirm={()=>handleModify(record)} record={record}/> render: (text: any, record: any) => (
<StatusSwitch
handleConfirm={() => handleModify(record)}
record={record}
/>
),
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'option', dataIndex: 'option',
align: 'center', align: 'center',
render: (text:any, record:any) => { render: (text: any, record: any) => {
return ( return (
<> <>
{ {record.state === 1 ? (
record.state === 1 ? <Button type='link' onClick={()=>handleAdjust(record)}>库存调拨</Button> : '' <Button type="link" onClick={() => handleAdjust(record)}>
} 库存调拨
</Button>
) : (
''
)}
</> </>
) );
} },
} },
]; ];
const handleSee = (record:any) => { const handleSee = (record: any) => {
console.log('see') console.log('see');
history.push(`/repositories/viewRepository?id=${record.key}`) history.push(`/repositories/viewRepository?id=${record.key}`);
} };
const confirm = () => { const confirm = () => {
console.log('confirm') console.log('confirm');
} };
const handleModify = (record: object) => { const handleModify = (record: object) => {
// 通过传入的params字符串判断是修改那种类型的数据 // 通过传入的params字符串判断是修改那种类型的数据
console.log('执行状态修改', record) console.log('执行状态修改', record);
} };
const handleAdjust = (record: any) => { const handleAdjust = (record: any) => {
history.push(`/memberCenter/commodityAbility/repositories/adjustRepository?id=${record.key}`) history.push(
} `/memberCenter/commodityAbility/repositories/adjustRepository?id=${record.key}`,
);
};
const handleToAdd = () => { const handleToAdd = () => {
history.push(`/memberCenter/commodityAbility/repositories/addRepository`) history.push(`/memberCenter/commodityAbility/repositories/addRepository`);
} };
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
<StandardTable <StandardTable
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
tableProps={{rowKey: "key"}} tableProps={{ rowKey: 'key' }}
fetchTableData={(params: any) => fetchData(params)} fetchTableData={(params: any) => fetchData(params)}
controlRender={ controlRender={
<Row justify='space-between'> <Row justify="space-between">
<Col> <Col>
<Space> <Space>
<Button type='primary' onClick={handleToAdd} icon={<PlusOutlined />}>新建</Button> <Button
type="primary"
onClick={handleToAdd}
icon={<PlusOutlined />}
>
新建
</Button>
</Space> </Space>
</Col> </Col>
<Col> <Col>
...@@ -142,7 +178,12 @@ const Repositories: React.FC<{}> = () => { ...@@ -142,7 +178,12 @@ const Repositories: React.FC<{}> = () => {
actions={formActions} actions={formActions}
onSubmit={values => ref.current.reload(values)} onSubmit={values => ref.current.reload(values)}
effects={($, actions) => { effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'search', FORM_FILTER_PATH) useStateFilterSearchLinkageEffect(
$,
actions,
'search',
FORM_FILTER_PATH,
);
}} }}
schema={repositSchema} schema={repositSchema}
/> />
...@@ -152,7 +193,7 @@ const Repositories: React.FC<{}> = () => { ...@@ -152,7 +193,7 @@ const Repositories: React.FC<{}> = () => {
/> />
</Card> </Card>
</PageHeaderWrapper> </PageHeaderWrapper>
) );
} };
export default Repositories export default Repositories;
...@@ -6,18 +6,28 @@ import { SaveOutlined } from '@ant-design/icons'; ...@@ -6,18 +6,28 @@ import { SaveOutlined } from '@ant-design/icons';
import { createFormActions } from '@formily/antd'; import { createFormActions } from '@formily/antd';
import { Button, Card } from 'antd'; import { Button, Card } from 'antd';
import ReutrnEle from '@/components/ReturnEle'; import ReutrnEle from '@/components/ReturnEle';
import { import NiceForm from '@/components/NiceForm';
SchemaForm, import { getBillsDetailSchema } from './schema';
SchemaMarkupField as Field,
FormMegaLayout,
} from '@formily/antd';
import { Input, Select } from '@formily/antd-components';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
const addSchemaAction = createFormActions(); const addSchemaAction = createFormActions();
const AddBills: React.FC<{}> = (props: any) => { const AddBills: React.FC<{}> = (props: any) => {
const ref = useRef({}); const ref = useRef({});
const [warehouseList, setWarehouseList] = useState<any>([]);
useEffect(() => {
PublicApi.getWarehouseWarehouseList({
current: '1',
pageSize: '10000',
}).then((res: any) => {
let list = [];
for (let item of res.data) {
list.push({ label: item.name, value: item.id });
}
setWarehouseList(list);
});
}, []);
const handleSubmit = value => { const handleSubmit = value => {
if (usePageStatus().pageStatus === 0) if (usePageStatus().pageStatus === 0)
...@@ -63,42 +73,11 @@ const AddBills: React.FC<{}> = (props: any) => { ...@@ -63,42 +73,11 @@ const AddBills: React.FC<{}> = (props: any) => {
} }
> >
<Card> <Card>
<SchemaForm <NiceForm
editable={usePageStatus().preview != '1'} onSubmit={handleSubmit}
actions={addSchemaAction} actions={addSchemaAction}
components={{ Input, Select }} schema={getBillsDetailSchema(warehouseList)}
onSubmit={value => handleSubmit(value)} />
>
<FormMegaLayout labelCol={4} labelAlign="left" wrapperCol={12}>
<Field
name="invoicesNo"
title="单据编号"
x-component="Input"
x-component-props={{
placeholder: '最长10个字符',
maxLength: 10,
}}
required
/>
<Field
name="name1"
title="单据名称"
x-component="Input"
x-component-props={{
placeholder: '最长20个字符,10个汉字',
maxLength: 10,
}}
required
/>
<Field
name="countryCode"
title="仓库负责人"
enum={['1', '2', '3', '4']}
x-component="Select"
x-component-props={{ placeholder: '请选择' }}
/>
</FormMegaLayout>
</SchemaForm>
</Card> </Card>
</PageHeaderWrapper> </PageHeaderWrapper>
); );
......
...@@ -10,7 +10,7 @@ import NiceForm from '@/components/NiceForm'; ...@@ -10,7 +10,7 @@ import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd'; import { createFormActions, FormEffectHooks } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'; import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { repositSchema } from './schema'; import { billsSchema } from './schema';
import UploadModal from '@/components/UploadModal'; import UploadModal from '@/components/UploadModal';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import style from './index.less'; import style from './index.less';
...@@ -218,7 +218,7 @@ const Bills: React.FC<{}> = () => { ...@@ -218,7 +218,7 @@ const Bills: React.FC<{}> = () => {
FORM_FILTER_PATH, FORM_FILTER_PATH,
); );
}} }}
schema={repositSchema} schema={billsSchema}
/> />
</Col> </Col>
</Row> </Row>
......
import React from 'react';
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import EyePreview from '@/components/EyePreview';
import { Button } from 'antd';
export const inventorySchema: ISchema = { export const inventorySchema: ISchema = {
type: 'object', type: 'object',
...@@ -62,162 +59,3 @@ export const inventorySchema: ISchema = { ...@@ -62,162 +59,3 @@ export const inventorySchema: ISchema = {
}, },
}, },
}; };
export const repositDetailSchema: ISchema = {
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card',
},
properties: {
'tab-1': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 8,
labelAlign: 'left',
},
properties: {
name: {
type: 'string',
required: true,
title: '仓位名称',
'x-component-props': {
placeholder: '建议名称:商品名称+商城名称+渠道描述',
},
},
productName: {
type: 'string',
title: '商品名称',
required: true,
},
warehouseId: {
type: 'string',
title: '仓库名称',
enum: [],
},
itemNo: {
type: 'string',
'x-component': 'Text',
title: '对应货品',
default: '暂无',
},
inventory: {
type: 'number',
'x-component': 'CustomSlider',
required: true,
'x-component-props': {
min: 0,
max: 200,
},
title: '分配仓位库存',
},
inventoryDeductWay: {
type: 'radio',
title: '库存扣减方式',
required: true,
enum: [
{
label: '按仓位随机扣减',
value: 1,
},
{
label: '按仓库位置远近扣除',
value: 2,
},
],
default: 1,
},
},
},
},
},
'tab-2': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '适用商城',
},
properties: {
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
shopIds: {
type: 'array:number',
'x-component': 'CardCheckBox',
'x-component-props': {
dataSource: [
{ logo: '', title: '会员', id: 1 },
{ logo: '', title: '小程序', id: 2 },
{ logo: '', title: 'H5', id: 3 },
{ logo: '', title: '渠道', id: 4 },
],
},
title: '适用商城',
required: true,
},
},
},
},
},
'tab-3': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '适用会员',
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
isAllMemberShare: {
type: 'radio',
enum: [
{ label: '所有会员共享(默认)', value: 1 },
{ label: '指定会员', value: 0 },
],
title: '选择渠道会员',
default: 1,
required: true,
},
applyMember: {
type: 'array:number',
'x-component': 'MultTable',
'x-component-props': {
columns: '{{tableColumns}}',
},
default: [
{ id: 1, name: '名称', type: '类型' },
{ id: 2, name: '名称1', type: '类型1' },
],
},
},
},
},
},
},
},
},
};
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