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 {
}
const Search = props => {
// console.log(props);
const [state, setState] = useFieldState({
filterSearch: false,
});
......@@ -41,7 +42,13 @@ const Search = props => {
高级筛选
{state.filterSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}
</Button>
<Button onClick={() => props.form.reset()}>重置</Button>
<Button
onClick={() => {
props.form.reset();
}}
>
重置
</Button>
</Space>
);
};
......
......@@ -16,6 +16,7 @@ import Text from './components/Text';
import CardCheckBox from './components/CardCheckBox';
import MultTable from './components/MultTable';
import CustomRegistryPhone from './components/CustomRegistryPhone';
import CustomRelevance from './components/CustomRelevance';
export interface NiceFormProps extends IAntdSchemaFormProps {}
......@@ -32,6 +33,7 @@ const NiceForm: React.FC<NiceFormProps> = props => {
CardCheckBox,
MultTable,
CustomRegistryPhone,
CustomRelevance,
};
const defineComponents = Object.assign(customComponents, components);
......
import React, { ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
import { Button, Popconfirm, Card, Row, Col, Dropdown, Input, Select, Space } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import React, { ReactNode, useRef, useState } from 'react';
import { history } from 'umi';
import {
Button,
Popconfirm,
Card,
Row,
Col,
Dropdown,
Input,
Select,
Space,
} from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import {
PlusOutlined,
PlayCircleOutlined,
......@@ -9,29 +19,32 @@ import {
DownOutlined,
CaretUpOutlined,
CaretDownOutlined,
} from '@ant-design/icons'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController'
import EyePreview from '@/components/EyePreview'
import StatusSwitch from '@/components/StatusSwitch'
import NiceForm from '@/components/NiceForm'
import { createFormActions, FormEffectHooks } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { repositSchema } from './schema'
import { PublicApi } from '@/services/api'
} from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import {
IFormFilter,
IButtonFilter,
} from 'god/dist/src/standard-table/TableController';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
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 res = await PublicApi.getWarehouseFreightSpaceList(params)
return res.data
}
const fetchData = async (params: any) => {
const res = await PublicApi.getWarehouseFreightSpaceList(params);
return res.data;
};
const Repositories: React.FC<{}> = () => {
const ref = useRef<any>({})
const ref = useRef<any>({});
const columns: ColumnType<any>[] = [
{
......@@ -45,7 +58,13 @@ const Repositories: React.FC<{}> = () => {
dataIndex: 'reposName',
align: 'center',
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: '商品名称',
......@@ -82,45 +101,56 @@ const Repositories: React.FC<{}> = () => {
align: 'center',
dataIndex: '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: '操作',
dataIndex: 'option',
align: 'center',
render: (text:any, record:any) => {
render: (text: any, record: any) => {
return (
<>
{
record.state === 1 ? <Button type='link' onClick={()=>handleAdjust(record)}>库存调拨</Button> : ''
}
{record.state === 1 ? (
<Button type="link" onClick={() => handleAdjust(record)}>
库存调拨
</Button>
) : (
''
)}
</>
)
}
}
);
},
},
];
const handleSee = (record:any) => {
console.log('see')
history.push(`/repositories/viewRepository?id=${record.key}`)
}
const handleSee = (record: any) => {
console.log('see');
history.push(`/repositories/viewRepository?id=${record.key}`);
};
const confirm = () => {
console.log('confirm')
}
console.log('confirm');
};
const handleModify = (record: object) => {
// 通过传入的params字符串判断是修改那种类型的数据
console.log('执行状态修改', record)
}
console.log('执行状态修改', record);
};
const handleAdjust = (record: any) => {
history.push(`/memberCenter/commodityAbility/repositories/adjustRepository?id=${record.key}`)
}
history.push(
`/memberCenter/commodityAbility/repositories/adjustRepository?id=${record.key}`,
);
};
const handleToAdd = () => {
history.push(`/memberCenter/commodityAbility/repositories/addRepository`)
}
history.push(`/memberCenter/commodityAbility/repositories/addRepository`);
};
return (
<PageHeaderWrapper>
......@@ -128,13 +158,19 @@ const Repositories: React.FC<{}> = () => {
<StandardTable
columns={columns}
currentRef={ref}
tableProps={{rowKey: "key"}}
tableProps={{ rowKey: 'key' }}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<Row justify='space-between'>
<Row justify="space-between">
<Col>
<Space>
<Button type='primary' onClick={handleToAdd} icon={<PlusOutlined />}>新建</Button>
<Button
type="primary"
onClick={handleToAdd}
icon={<PlusOutlined />}
>
新建
</Button>
</Space>
</Col>
<Col>
......@@ -142,7 +178,12 @@ const Repositories: React.FC<{}> = () => {
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'search', FORM_FILTER_PATH)
useStateFilterSearchLinkageEffect(
$,
actions,
'search',
FORM_FILTER_PATH,
);
}}
schema={repositSchema}
/>
......@@ -152,7 +193,7 @@ const Repositories: React.FC<{}> = () => {
/>
</Card>
</PageHeaderWrapper>
)
}
);
};
export default Repositories
export default Repositories;
......@@ -6,18 +6,28 @@ import { SaveOutlined } from '@ant-design/icons';
import { createFormActions } from '@formily/antd';
import { Button, Card } from 'antd';
import ReutrnEle from '@/components/ReturnEle';
import {
SchemaForm,
SchemaMarkupField as Field,
FormMegaLayout,
} from '@formily/antd';
import { Input, Select } from '@formily/antd-components';
import NiceForm from '@/components/NiceForm';
import { getBillsDetailSchema } from './schema';
import { PublicApi } from '@/services/api';
const addSchemaAction = createFormActions();
const AddBills: React.FC<{}> = (props: any) => {
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 => {
if (usePageStatus().pageStatus === 0)
......@@ -63,42 +73,11 @@ const AddBills: React.FC<{}> = (props: any) => {
}
>
<Card>
<SchemaForm
editable={usePageStatus().preview != '1'}
<NiceForm
onSubmit={handleSubmit}
actions={addSchemaAction}
components={{ Input, Select }}
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: '请选择' }}
schema={getBillsDetailSchema(warehouseList)}
/>
</FormMegaLayout>
</SchemaForm>
</Card>
</PageHeaderWrapper>
);
......
......@@ -10,7 +10,7 @@ import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { repositSchema } from './schema';
import { billsSchema } from './schema';
import UploadModal from '@/components/UploadModal';
import { PublicApi } from '@/services/api';
import style from './index.less';
......@@ -218,7 +218,7 @@ const Bills: React.FC<{}> = () => {
FORM_FILTER_PATH,
);
}}
schema={repositSchema}
schema={billsSchema}
/>
</Col>
</Row>
......
import React from 'react';
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import EyePreview from '@/components/EyePreview';
import { Button } from 'antd';
export const inventorySchema: ISchema = {
type: 'object',
......@@ -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