Commit 19ac5d51 authored by tjy's avatar tjy

完善交易能力模块

parent e820bf40
This diff is collapsed.
...@@ -17,18 +17,39 @@ const TranactionRoute = { ...@@ -17,18 +17,39 @@ const TranactionRoute = {
component: '@/pages/transaction/stockSellStorage/warehouse/index', component: '@/pages/transaction/stockSellStorage/warehouse/index',
}, },
{ {
path: '/memberCenter/tranactionAbility/stockSellStorage/addWarehouse',
name: 'addWarehouse',
key: 'addWarehouse',
hideInMenu: true,
component: '@/pages/transaction/stockSellStorage/warehouse/addWarehouse',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/billsType', path: '/memberCenter/tranactionAbility/stockSellStorage/billsType',
name: 'billsType', name: 'billsType',
key: 'billsType', key: 'billsType',
component: '@/pages/transaction/stockSellStorage/billsType/index', component: '@/pages/transaction/stockSellStorage/billsType/index',
}, },
{ {
path: '/memberCenter/tranactionAbility/stockSellStorage/addBillsType',
name: 'addBillsType',
key: 'addBillsType',
hideInMenu: true,
component: '@/pages/transaction/stockSellStorage/billsType/addBillsType',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/bills', path: '/memberCenter/tranactionAbility/stockSellStorage/bills',
name: 'bills', name: 'bills',
key: 'bills', key: 'bills',
component: '@/pages/transaction/stockSellStorage/bills/index', component: '@/pages/transaction/stockSellStorage/bills/index',
}, },
{ {
path: '/memberCenter/tranactionAbility/stockSellStorage/addBills',
name: 'addBills',
key: 'addBills',
hideInMenu: true,
component: '@/pages/transaction/stockSellStorage/bills/addBills',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/inventory', path: '/memberCenter/tranactionAbility/stockSellStorage/inventory',
name: 'inventory', name: 'inventory',
key: 'inventory', key: 'inventory',
......
import React from 'react';
import { Row, Col, Select, Input } from 'antd';
import styled from 'styled-components';
import { findItemAndDelete } from '@/utils';
import cx from 'classnames';
const { Option } = Select;
const RowStyleLayout = styled(props => <div {...props} />)``;
const registryPhone = (props: any) => {
const { dataSource = [], selectPh, inputPh } = props.props[
'x-component-props'
];
const defaultValue: any = props.props.default || {};
const value: any = props.value || {};
const handleChange = (type, e) => {
if (type === 'select') {
props.mutators.change({ ...value, phone: e });
} else {
e.persist();
props.mutators.change({ ...value, countryCode: e.target.value });
}
};
return (
<Row>
<Col span={8}>
<Select
value={defaultValue.countryCode}
onChange={val => handleChange('select', val)}
placeholder={selectPh}
>
{dataSource.map((v, i) => {
return (
<Option key={v.text} value={v.id}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<img
style={{
width: '24px',
height: '17px',
marginRight: '8px',
}}
src={v.url}
/>
{v.text}
</div>
</Option>
);
})}
</Select>
</Col>
<Col span={15} offset={1}>
<Input
defaultValue={defaultValue.phone}
placeholder={inputPh}
maxLength={11}
onChange={e => handleChange('input', e)}
/>
</Col>
</Row>
);
};
registryPhone.defaultProps = {};
registryPhone.isFieldComponent = true;
export default registryPhone;
import React from 'react' import React from 'react';
import SchemaForm, { IAntdSchemaFormProps, createFormActions, FormPath, SchemaField } from '@formily/antd' import SchemaForm, {
IAntdSchemaFormProps,
createFormActions,
FormPath,
SchemaField,
} from '@formily/antd';
import { Button, Space } from 'antd'; import { Button, Space } from 'antd';
import CustomUpload from './components/CustomUpload'; import CustomUpload from './components/CustomUpload';
import CustomStatus from './components/CustomStatus'; import CustomStatus from './components/CustomStatus';
...@@ -10,12 +15,12 @@ import Submit from './components/Submit'; ...@@ -10,12 +15,12 @@ import Submit from './components/Submit';
import Text from './components/Text'; 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';
export interface NiceFormProps extends IAntdSchemaFormProps { export interface NiceFormProps extends IAntdSchemaFormProps {}
}
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 = {
CustomUpload, CustomUpload,
CustomStatus, CustomStatus,
...@@ -25,23 +30,19 @@ const NiceForm:React.FC<NiceFormProps> = (props) => { ...@@ -25,23 +30,19 @@ const NiceForm:React.FC<NiceFormProps> = (props) => {
Submit, Submit,
Text, Text,
CardCheckBox, CardCheckBox,
MultTable MultTable,
} CustomRegistryPhone,
};
const defineComponents = Object.assign(customComponents, components) const defineComponents = Object.assign(customComponents, components);
return ( return (
<SchemaForm <SchemaForm colon={false} components={defineComponents} {...reset}>
colon={false}
components={defineComponents}
{...reset}
>
{children} {children}
</SchemaForm> </SchemaForm>
) );
} };
NiceForm.defaultProps = {};
NiceForm.defaultProps = {} export default NiceForm;
export default NiceForm
\ No newline at end of file
...@@ -69,8 +69,11 @@ export default { ...@@ -69,8 +69,11 @@ export default {
'menu.tranactionAbility': '交易', 'menu.tranactionAbility': '交易',
'menu.tranactionAbility.stockSellStorage': '进销存', 'menu.tranactionAbility.stockSellStorage': '进销存',
'menu.tranactionAbility.stockSellStorage.warehouse': '仓库', 'menu.tranactionAbility.stockSellStorage.warehouse': '仓库',
'menu.tranactionAbility.stockSellStorage.addWarehouse': '新增仓库',
'menu.tranactionAbility.stockSellStorage.billsType': '单据类型', 'menu.tranactionAbility.stockSellStorage.billsType': '单据类型',
'menu.tranactionAbility.stockSellStorage.addBillsType': '新增单据类型',
'menu.tranactionAbility.stockSellStorage.bills': '单据', 'menu.tranactionAbility.stockSellStorage.bills': '单据',
'menu.tranactionAbility.stockSellStorage.addBills': '新增单据',
'menu.tranactionAbility.stockSellStorage.inventory': '库存', 'menu.tranactionAbility.stockSellStorage.inventory': '库存',
//物流能力 //物流能力
......
This diff is collapsed.
import React, { useState, useEffect, useRef, ReactNode } from 'react'; import React, { useState, useEffect, useRef, ReactNode } from 'react';
import { history } from 'umi'; import { history } from 'umi';
import { Tabs, Badge, Button, Card, Row, Col, message } from 'antd'; import { Tabs, Badge, Button, Card, Row, Col, message, Upload } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { ContainerOutlined } from '@ant-design/icons'; import {
import { Form, FormItem, createFormActions } from '@formily/antd'; ContainerOutlined,
import { Select, Input, Upload } from '@formily/antd-components'; PlusOutlined,
SaveOutlined,
} from '@ant-design/icons';
import { createFormActions } from '@formily/antd';
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 ReutrnEle from '@/components/ReturnEle';
import styles from './index.less';
import NiceForm from '@/components/NiceForm';
import { initDetailSchema } from './schema';
import style from './index.less'; import style from './index.less';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const actions = createFormActions(); const addSchemaAction = createFormActions();
const addMember: React.FC<any> = props => { const addMember: React.FC<any> = props => {
const ref = useRef({}); const ref = useRef({});
const [actived, setActived] = useState('-1');
const [editable, setEditable] = useState(
props.location.query.type != 'check',
);
const selectList: any = [ const selectList: any = [
{ {
label: '', label: '',
...@@ -30,15 +38,10 @@ const addMember: React.FC<any> = props => { ...@@ -30,15 +38,10 @@ const addMember: React.FC<any> = props => {
// ) // )
value: '1', value: '1',
}, },
{ label: '', value: '2' },
{ label: '', value: '3' },
{ label: '', value: '4' },
{ label: '', value: '5' },
]; ];
/* 会员类型、会员角色、会员等级、注册手机号选项 */ /* 会员类型、会员角色、会员等级、注册手机号选项 */
const [memberItems, setMemberItems] = useState<any>({}); const [memberItems, setMemberItems] = useState<any>({});
const [loading, setLoading] = useState(false);
const data = [ const data = [
{ {
...@@ -146,181 +149,34 @@ const addMember: React.FC<any> = props => { ...@@ -146,181 +149,34 @@ const addMember: React.FC<any> = props => {
return isJpgOrPng && isLt2M; return isJpgOrPng && isLt2M;
}; };
const handleChange = (items: any, file: any) => {
for (let elem of file) {
elem.url = elem.data;
}
};
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
onBack={() => history.goBack()} onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={ title={
<> props.location.query.type === 'add'
<div className={style.headerTop}>
<span>返回</span>
<span>
{props.location.query.type === 'add'
? '新建会员' ? '新建会员'
: props.location.query.type === 'change' : props.location.query.type === 'change'
? '编辑会员' ? '编辑会员'
: '查看会员'} : '查看会员'
</span>
</div>
</>
} }
extra={ extra={[
<>
<Button <Button
className={style.saveBtn} key="1"
icon={<ContainerOutlined />} type="primary"
onClick={() => actions.submit()} icon={<SaveOutlined />}
onClick={() => addSchemaAction.submit()}
> >
保存 保存
</Button> </Button>,
</> ]}
}
> >
<Card> <Card>
<Form <NiceForm
editable={editable} onSubmit={handleSubmit}
labelCol={3} actions={addSchemaAction}
wrapperCol={10} schema={initDetailSchema(memberItems)}
labelAlign="left"
actions={actions}
>
<Tabs
tabBarGutter={30}
activeKey={actived}
onChange={activeKey => setActived(activeKey)}
>
<TabPane
tab={
// <Badge count={tabCount['1']} offset={[10, 0]}>
'基本信息'
// </Badge>
}
key="-1"
>
<FormItem
label="会员类型"
name="memberTypes"
dataSource={memberItems.memberTypes}
rules={[{ required: true, message: '请选择会员类型!' }]}
component={Select}
/>
<FormItem
label="会员角色"
name="memberRoles"
dataSource={memberItems.memberRoles}
rules={[{ required: true, message: '请选择会员角色!' }]}
component={Select}
/>
<FormItem
label="会员等级"
name="memberLevels"
dataSource={memberItems.memberLevels}
rules={[{ required: true, message: '请选择会员等级!' }]}
component={Select}
/>
<FormItem
label={
<>
<span className={style.required}>*</span>
注册手机号
</>
}
name="registry"
>
<Row gutter={10}>
<Col span={6}>
<FormItem
itemStyle={{ marginBottom: 0 }}
name="country"
dataSource={memberItems.countryCodes}
rules={[{ required: true, message: '请选择会员角色!' }]}
component={Select}
/>
</Col>
<Col span={18}>
<FormItem
name="phoneMobile"
itemStyle={{ marginBottom: 0 }}
rules={[{ required: true, message: '请选择会员角色!' }]}
component={Input}
/>
</Col>
</Row>
</FormItem>
<FormItem
label="注册邮箱"
name="memberEmail"
itemStyle={{ marginBottom: 0 }}
component={Input}
/>
</TabPane>
{memberItems.groups &&
memberItems.groups.map((item: any, index: number) => {
return (
<TabPane
tab={
// <Badge count={tabCount['1']} offset={[10, 0]}>
item.groupName
// </Badge>
}
key={index}
>
{item.elements.map((items: any, indexs: number) => {
return (
<div key={indexs}>
{items.fieldType === 'String' ? (
<FormItem
itemStyle={
item.elements.length - 1 === indexs
? { marginBottom: 0 }
: {}
}
label={items.fieldCNName}
name={items.fieldName}
required={items.fieldEmpty === 0}
// rules={items.checkRules}
component={Input}
key={indexs}
/> />
) : (
<FormItem
itemStyle={
item.elements.length - 1 === indexs
? { marginBottom: 0 }
: {}
}
label={items.fieldCNName}
name={items.fieldName}
action="/api/file/file/upload"
listType="picture-card"
required={items.fieldEmpty === 0}
// rules={items.checkRules}
data={{ fileType: 2 }}
beforeUpload={beforeUpload}
onChange={(file: any) =>
handleChange(items, file)
}
showUploadList={{
showRemoveIcon:
items.value && items.value.length > 0,
}}
key={indexs}
component={Upload}
/>
)}
</div>
);
})}
</TabPane>
);
})}
</Tabs>
</Form>
</Card> </Card>
</PageHeaderWrapper> </PageHeaderWrapper>
); );
......
import React from 'react'; 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 repositSchema: ISchema = { export const maintianSchema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
megaLayout: { megaLayout: {
...@@ -16,23 +14,83 @@ export const repositSchema: ISchema = { ...@@ -16,23 +14,83 @@ export const repositSchema: ISchema = {
'x-component': 'Search', 'x-component': 'Search',
'x-mega-props': {}, 'x-mega-props': {},
'x-component-props': { 'x-component-props': {
placeholder: '搜索', placeholder: '请输入仓位名称',
}, },
}, },
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
visible: false,
'x-component-props': {
inline: true,
}, },
properties: {
productName: {
type: 'string',
'x-component-props': {
placeholder: '商品名称',
}, },
}, },
}; productId: {
type: 'string',
export const repositDetailSchema: ISchema = { 'x-component-props': {
type: 'object', placeholder: '商品ID',
properties: { },
REPOSIT_TABS: { },
type: 'object', category: {
'x-component': 'tab', type: 'string',
'x-component-props': {
placeholder: '请选择品类',
},
enum: [],
},
brand: {
type: 'string',
'x-component-props': {
placeholder: '请选择品牌',
},
enum: [],
},
submit: {
'x-component': 'Submit',
'x-component-props': { 'x-component-props': {
type: 'card', children: '查询',
},
},
},
},
},
}, },
},
};
const registryPhone = <></>;
const getCompnentValue = (elements: any) => {
let components = {};
for (let item of elements) {
let xComponentProps =
item.fieldType === 'string'
? {
placeholder: item.fieldRemark,
}
: {
listType: 'card',
action: '/api/file/file/upload',
data: { fileType: 2 },
};
components[item.fieldName] = {
type: item.fieldType,
required: item.fieldEmpty === 0,
title: item.fieldCNName,
'x-component-props': xComponentProps,
};
}
return components;
};
export const initDetailSchema = (props: any) => {
let tabSchema = {
properties: { properties: {
'tab-1': { 'tab-1': {
type: 'object', type: 'object',
...@@ -50,135 +108,103 @@ export const repositDetailSchema: ISchema = { ...@@ -50,135 +108,103 @@ export const repositDetailSchema: ISchema = {
labelAlign: 'left', labelAlign: 'left',
}, },
properties: { properties: {
name: { memberTypes: {
type: 'string', type: 'string',
required: true, required: true,
title: '仓位名称', title: '会员类型',
enum: props.memberTypes,
'x-component-props': { 'x-component-props': {
placeholder: '建议名称:商品名称+商城名称+渠道描述', placeholder: '请选择',
}, },
}, },
productName: { memberRoles: {
type: 'string', type: 'string',
title: '商品名称',
required: true, required: true,
title: '会员角色',
enum: props.memberRoles,
'x-component-props': {
placeholder: '请选择',
}, },
warehouseId: {
type: 'string',
title: '仓库名称',
enum: [],
}, },
itemNo: { memberLevels: {
type: 'string', type: 'string',
'x-component': 'Text',
title: '对应货品',
default: '暂无',
},
inventory: {
type: 'number',
'x-component': 'CustomSlider',
required: true, required: true,
title: '会员等级',
enum: [{ label: '1', value: 1 }],
// enum: props.memberLevels,
'x-component-props': { 'x-component-props': {
min: 0, placeholder: '请选择',
max: 200,
}, },
title: '分配仓位库存',
}, },
inventoryDeductWay: { memberPhone: {
type: 'radio', type: 'object',
title: '库存扣减方式',
required: true, required: true,
enum: [ title: '注册手机',
'x-component': 'CustomRegistryPhone',
'x-component-props': {
dataSource: [
{ {
label: '按仓位随机扣减', text: '+86',
value: 1, id: 1,
url: require('../../../../../public/static/imgs/level1@2x.png'),
}, },
{ {
label: '按仓库位置远近扣除', text: '+126',
value: 2, id: 2,
url: require('../../../../../public/static/imgs/level2@2x.png'),
}, },
], ],
default: 1, selectPh: '请选择',
}, inputPh: '请输入你的手机号码',
},
},
},
},
'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: { memberEmail: {
shopIds: { type: 'string',
type: 'array:number', title: '邮箱',
'x-component': 'CardCheckBox', 'x-component-props': {},
'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': { };
if (Object.keys(props).length > 0) {
for (let [index, item] of props.groups.entries()) {
tabSchema.properties[`tab-${index + 2}`] = {
type: 'object', type: 'object',
'x-component': 'tabpane', 'x-component': 'tabpane',
'x-component-props': { 'x-component-props': {
tab: '适用会员', tab: item.groupName,
}, },
properties: { properties: {
MEGA_LAYOUT3: { [`MEGA_LAYOUT${index + 2}`]: {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'mega-layout',
'x-component-props': { 'x-component-props': {
labelCol: 4, labelCol: 4,
wrapperCol: 8,
labelAlign: 'left', labelAlign: 'left',
}, },
properties: { properties: getCompnentValue(item.elements),
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' },
],
},
},
},
},
}, },
}, },
};
}
}
let detailSchema = {
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {},
...tabSchema,
}, },
}, },
};
const maintianDetailSchema: ISchema = detailSchema;
return maintianDetailSchema;
}; };
import React, { useState, useEffect, useRef } from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
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 { PublicApi } from '@/services/api';
const addSchemaAction = createFormActions();
const AddBills: React.FC<{}> = (props: any) => {
const ref = useRef({});
const handleSubmit = value => {
console.log(value);
};
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={
usePageStatus().pageStatus === 0
? '新建单据'
: usePageStatus().pageStatus === 1
? '编辑单据'
: '查看单据'
}
extra={
usePageStatus().preview != '1'
? [
<Button
key="1"
type="primary"
icon={<SaveOutlined />}
onClick={() => addSchemaAction.submit()}
>
保存
</Button>,
]
: []
}
>
<Card>
<SchemaForm
editable={usePageStatus().preview != '1'}
actions={addSchemaAction}
components={{ Input, Select }}
onSubmit={value => handleSubmit(value)}
>
<FormMegaLayout labelCol={4} labelAlign="left" wrapperCol={12}>
<Field
name="name"
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>
</PageHeaderWrapper>
);
};
export default AddBills;
...@@ -81,7 +81,14 @@ const Bills: React.FC<{}> = () => { ...@@ -81,7 +81,14 @@ const Bills: React.FC<{}> = () => {
const handleBatchDel = (e: any) => {}; const handleBatchDel = (e: any) => {};
const handleMoreMenu = (e: any) => {}; const handleMoreMenu = (e: any) => {
if (e.key === '1') {
history.push(
`/memberCenter/tranactionAbility/stockSellStorage/addBills?id=${''}`,
);
}
// console.log(e);
};
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
...@@ -91,7 +98,7 @@ const Bills: React.FC<{}> = () => { ...@@ -91,7 +98,7 @@ const Bills: React.FC<{}> = () => {
key: 'no', key: 'no',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<EyePreview <EyePreview
url={`/repositories/viewRepository?id=${record.key}&preview=1`} url={`/memberCenter/tranactionAbility/stockSellStorage/addBills?id=${record.key}&preview=1`}
> >
{text} {text}
</EyePreview> </EyePreview>
...@@ -192,8 +199,12 @@ const Bills: React.FC<{}> = () => { ...@@ -192,8 +199,12 @@ const Bills: React.FC<{}> = () => {
<Space> <Space>
<Button <Button
type="primary" type="primary"
onClick={handleAdd}
icon={<PlusOutlined />} icon={<PlusOutlined />}
onClick={() =>
history.push(
'/memberCenter/tranactionAbility/stockSellStorage/addBills',
)
}
> >
新建 新建
</Button> </Button>
......
import React, { useState, useEffect, useRef } from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
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 { PublicApi } from '@/services/api';
const addSchemaAction = createFormActions();
const AddWarehouse: React.FC<{}> = (props: any) => {
const ref = useRef({});
const handleSubmit = value => {
console.log(value);
};
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={
usePageStatus().pageStatus === 0
? '新建单据类型'
: usePageStatus().pageStatus === 1
? '编辑单据类型'
: '查看单据类型'
}
extra={
usePageStatus().preview != '1'
? [
<Button
key="1"
type="primary"
icon={<SaveOutlined />}
onClick={() => addSchemaAction.submit()}
>
保存
</Button>,
]
: []
}
>
<Card>
<SchemaForm
editable={usePageStatus().preview != '1'}
actions={addSchemaAction}
components={{ Input, Select }}
onSubmit={value => handleSubmit(value)}
>
<FormMegaLayout labelCol={4} labelAlign="left" wrapperCol={12}>
<Field
name="name"
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>
</PageHeaderWrapper>
);
};
export default AddWarehouse;
...@@ -13,10 +13,11 @@ import { ...@@ -13,10 +13,11 @@ import {
} from 'antd'; } from 'antd';
import { import {
PlusOutlined, PlusOutlined,
EyeOutlined,
PlayCircleOutlined, PlayCircleOutlined,
PauseCircleOutlined, PauseCircleOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import { StandardTable } from 'god'; import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import style from './index.less'; import style from './index.less';
...@@ -28,7 +29,7 @@ const data = [ ...@@ -28,7 +29,7 @@ const data = [
no: 'DJ001', no: 'DJ001',
name: '进货入库单', name: '进货入库单',
direction: 1, direction: 1,
status: 1, state: 1,
}, },
{ {
key: '2', key: '2',
...@@ -36,7 +37,7 @@ const data = [ ...@@ -36,7 +37,7 @@ const data = [
no: 'DJ002', no: 'DJ002',
name: '退货入库单', name: '退货入库单',
direction: 2, direction: 2,
status: 2, state: 2,
}, },
]; ];
...@@ -64,10 +65,11 @@ const billsType: React.FC<{}> = () => { ...@@ -64,10 +65,11 @@ const billsType: React.FC<{}> = () => {
key: 'name', key: 'name',
render: (text: any, record: any) => { render: (text: any, record: any) => {
return ( return (
<span className="commonPickColor" onClick={() => history.push('')}> <EyePreview
{text}&nbsp; url={`/memberCenter/tranactionAbility/stockSellStorage/addBillsType?id=${record.id}&preview=1`}
<EyeOutlined /> >
</span> {text}
</EyePreview>
); );
}, },
}, },
...@@ -93,31 +95,10 @@ const billsType: React.FC<{}> = () => { ...@@ -93,31 +95,10 @@ const billsType: React.FC<{}> = () => {
sorter: true, sorter: true,
render: (text: any, record: any) => { render: (text: any, record: any) => {
return ( return (
<Popconfirm <StatusSwitch
title="确定要执行这个操作?" handleConfirm={() => handleModify(record)}
onConfirm={() => console.log('...')} record={record}
onCancel={() => console.log('...')} />
okText="是"
cancelText="否"
>
<Button
type="link"
onClick={() => console.log('???')}
style={
record.status === 1 ? { color: '#00B37A' } : { color: 'red' }
}
>
{record.status === 1 ? (
<>
有效 <PlayCircleOutlined />
</>
) : (
<>
无效 <PauseCircleOutlined />
</>
)}
</Button>
</Popconfirm>
); );
}, },
}, },
...@@ -125,9 +106,16 @@ const billsType: React.FC<{}> = () => { ...@@ -125,9 +106,16 @@ const billsType: React.FC<{}> = () => {
title: '操作', title: '操作',
dataIndex: 'option', dataIndex: 'option',
align: 'center', align: 'center',
render: (record: any) => ( render: (text: any, record: any) => (
<> <>
<Button type="link" onClick={record => history.push('')}> <Button
type="link"
onClick={() =>
history.push(
`/memberCenter/tranactionAbility/stockSellStorage/addBillsType?id=${record.id}`,
)
}
>
编辑 编辑
</Button> </Button>
<Popconfirm <Popconfirm
...@@ -160,6 +148,11 @@ const billsType: React.FC<{}> = () => { ...@@ -160,6 +148,11 @@ const billsType: React.FC<{}> = () => {
const handleReset = () => {}; const handleReset = () => {};
const handleModify = (record: object) => {
// 通过传入的params字符串判断是修改那种类型的数据
console.log('执行状态修改', record);
};
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
...@@ -176,7 +169,7 @@ const billsType: React.FC<{}> = () => { ...@@ -176,7 +169,7 @@ const billsType: React.FC<{}> = () => {
type="primary" type="primary"
onClick={() => onClick={() =>
history.push( history.push(
'/memberCenter/memberAbility/manage/addMember?type=add', '/memberCenter/tranactionAbility/stockSellStorage/addBillsType',
) )
} }
> >
......
import React, { useState, useEffect, useRef } from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
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 { PublicApi } from '@/services/api';
const addSchemaAction = createFormActions();
const AddWarehouse: React.FC<{}> = (props: any) => {
const ref = useRef({});
const handleSubmit = value => {
console.log(value);
};
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={
usePageStatus().pageStatus === 0
? '新建仓库'
: usePageStatus().pageStatus === 1
? '编辑仓库'
: '查看仓库'
}
extra={
usePageStatus().preview != '1'
? [
<Button
key="1"
type="primary"
icon={<SaveOutlined />}
onClick={() => addSchemaAction.submit()}
>
保存
</Button>,
]
: []
}
>
<Card>
<SchemaForm
editable={usePageStatus().preview != '1'}
actions={addSchemaAction}
components={{ Input, Select, Textarea: Input.TextArea }}
onSubmit={value => handleSubmit(value)}
>
<FormMegaLayout labelCol={4} labelAlign="left" wrapperCol={12}>
<Field name="name" title="仓库名称" x-component="Input" required />
<FormMegaLayout label="仓库地址" wrapperCol={24} required>
<FormMegaLayout grid full autoRow columns={3}>
<Field
name="province"
enum={['1', '2', '3', '4']}
x-component="Select"
x-component-props={{
placeholder: '- 省 -',
}}
required
/>
<Field
name="city"
enum={['1', '2', '3', '4']}
x-component="Select"
x-component-props={{
placeholder: '- 市 -',
}}
required
/>
<Field
name="county"
enum={['1', '2', '3', '4']}
x-component="Select"
x-component-props={{
placeholder: '- 县/区 -',
}}
required
/>
</FormMegaLayout>
<Field
name="address"
x-component="Textarea"
x-component-props={{
placeholder: '请输入详细地址(最长50个字符,25个汉字)',
rules: [{ message: '请输入详细地址' }],
}}
required
/>
</FormMegaLayout>
<Field name="person" title="仓库负责人" x-component="Input" />
<FormMegaLayout label="联系电话" grid full wrapperCol={24}>
<Field
name="countryCode"
enum={['1', '2', '3', '4']}
x-component="Select"
x-component-props={{ placeholder: '请选择' }}
/>
<Field
x-mega-props={{ span: 3 }}
name="phoneMobile"
x-component="Input"
x-component-props={{ placeholder: '请输入你的手机号码' }}
/>
</FormMegaLayout>
</FormMegaLayout>
</SchemaForm>
</Card>
</PageHeaderWrapper>
);
};
export default AddWarehouse;
...@@ -11,12 +11,9 @@ import { ...@@ -11,12 +11,9 @@ import {
Space, Space,
Popconfirm, Popconfirm,
} from 'antd'; } from 'antd';
import { import { PlusOutlined } from '@ant-design/icons';
PlusOutlined, import EyePreview from '@/components/EyePreview';
EyeOutlined, import StatusSwitch from '@/components/StatusSwitch';
PlayCircleOutlined,
PauseCircleOutlined,
} 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 style from './index.less'; import style from './index.less';
...@@ -29,7 +26,7 @@ const data = [ ...@@ -29,7 +26,7 @@ const data = [
address: '广东省广州市海珠区新港东路1068号中洲中心北塔6楼', address: '广东省广州市海珠区新港东路1068号中洲中心北塔6楼',
person: '蒯美政', person: '蒯美政',
phoneMobile: '185 2929 5432', phoneMobile: '185 2929 5432',
status: 1, state: 1,
}, },
{ {
key: '2', key: '2',
...@@ -38,7 +35,7 @@ const data = [ ...@@ -38,7 +35,7 @@ const data = [
address: '广东省广州市海珠区新港东路1068号中洲中心北塔6楼', address: '广东省广州市海珠区新港东路1068号中洲中心北塔6楼',
person: '蒯美政', person: '蒯美政',
phoneMobile: '185 2929 5432', phoneMobile: '185 2929 5432',
status: 2, state: 2,
}, },
]; ];
...@@ -74,10 +71,11 @@ const WareHouse: React.FC<{}> = () => { ...@@ -74,10 +71,11 @@ const WareHouse: React.FC<{}> = () => {
key: 'name', key: 'name',
render: (text: any, record: any) => { render: (text: any, record: any) => {
return ( return (
<span className="commonPickColor" onClick={() => history.push('')}> <EyePreview
{text}&nbsp; url={`/memberCenter/tranactionAbility/stockSellStorage/addWarehouse?id=${record.id}&preview=1`}
<EyeOutlined /> >
</span> {text}
</EyePreview>
); );
}, },
}, },
...@@ -107,31 +105,10 @@ const WareHouse: React.FC<{}> = () => { ...@@ -107,31 +105,10 @@ const WareHouse: React.FC<{}> = () => {
sorter: true, sorter: true,
render: (text: any, record: any) => { render: (text: any, record: any) => {
return ( return (
<Popconfirm <StatusSwitch
title="确定要执行这个操作?" handleConfirm={() => handleModify(record)}
onConfirm={() => console.log('...')} record={record}
onCancel={() => console.log('...')} />
okText="是"
cancelText="否"
>
<Button
type="link"
onClick={() => console.log('???')}
style={
record.status === 1 ? { color: '#00B37A' } : { color: 'red' }
}
>
{record.status === 1 ? (
<>
有效 <PlayCircleOutlined />
</>
) : (
<>
无效 <PauseCircleOutlined />
</>
)}
</Button>
</Popconfirm>
); );
}, },
}, },
...@@ -139,9 +116,16 @@ const WareHouse: React.FC<{}> = () => { ...@@ -139,9 +116,16 @@ const WareHouse: React.FC<{}> = () => {
title: '操作', title: '操作',
dataIndex: 'option', dataIndex: 'option',
align: 'center', align: 'center',
render: (record: any) => ( render: (text: any, record: any) => (
<> <>
<Button type="link" onClick={record => history.push('')}> <Button
type="link"
onClick={() =>
history.push(
`/memberCenter/tranactionAbility/stockSellStorage/addWarehouse?id=${record.id}`,
)
}
>
编辑 编辑
</Button> </Button>
<Popconfirm <Popconfirm
...@@ -160,6 +144,11 @@ const WareHouse: React.FC<{}> = () => { ...@@ -160,6 +144,11 @@ const WareHouse: React.FC<{}> = () => {
const handleReset = () => {}; const handleReset = () => {};
const handleModify = (record: object) => {
// 通过传入的params字符串判断是修改那种类型的数据
console.log('执行状态修改', record);
};
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
...@@ -175,9 +164,13 @@ const WareHouse: React.FC<{}> = () => { ...@@ -175,9 +164,13 @@ const WareHouse: React.FC<{}> = () => {
<Button <Button
type="primary" type="primary"
onClick={() => onClick={() =>
history.push( history.push({
'/memberCenter/memberAbility/manage/addMember?type=add', pathname:
) '/memberCenter/tranactionAbility/stockSellStorage/addWarehouse',
query: {
type: 'add',
},
})
} }
> >
<PlusOutlined /> <PlusOutlined />
......
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