Commit 3420e3bb authored by GuanHua's avatar GuanHua
parents d616494c 234831be
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-17 18:04:19
* @LastEditTime: 2020-07-17 20:27:43
*/
import React, { Component, useState,useEffect } from 'react';
import ReactDOM from 'react-dom'
......@@ -22,17 +22,12 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { MegaLayout, Input, Switch, Select, FormMegaLayout } from '@formily/antd-components'
import ReutrnEle from '@/components/ReturnEle'
import 'antd/dist/antd.css'
let selectList: any = [
{ label: '+86', value: '1' },
{ label: 'Two', value: '2' },
{ label: 'Three', value: '3' },
{ label: 'Four', value: '4' }
];
import ChinaImg from '../../../../../mockStatic/china.png'
import gou from '../../../../../mockStatic/gou.png'
import japenImg from '../../../../../mockStatic/japen.png'
import korenImg from '../../../../../mockStatic/koren.png'
import us from '../../../../../mockStatic/us.png'
import { Effects } from 'bizcharts';
const _width:number = 24
const _height:number = 17
......@@ -76,6 +71,7 @@ const dropdownRender = () => {
// registerFormFields({ prefixSelect: connect()(CustomSelect) })
const diaLogForm: React.FC<ListProps> = (props) => {
const type:string = history.location.query.addType
const [Options,setOptions] = useState([])
const [state, setState] = useState({ editable: true })
const [headerTitle,setHeaderTitle] = useState('')
const [select, setSelect] = useState<countryItem>({
......@@ -99,12 +95,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
const handleChangeSelect = () => {
}
useEffect(() => {
history.location.query.addType == '1'? setHeaderTitle('新建发货地址') : setHeaderTitle('新建收货地址')
return () => {
}
}, [])
const List:any = [ChinaImg,gou,japenImg,korenImg,us]
const selectList: any = [
{ label: <><img src={ChinaImg} key='1' style={{width: _width, height: 17}}/> +86</>, value: '1' },
......@@ -113,11 +104,19 @@ const diaLogForm: React.FC<ListProps> = (props) => {
{ label: <><img src={korenImg} key='4' style={{width: _width, height: 17}}/> +86</>, value: '4' },
{ label: <><img src={us} key='5' style={{width: _width, height: 17}}/> +86</>, value: '5' }
]
// List.map((item:any,key:number) => {
// let li = <><img src={item} key={key} style={{width: _width, height: 17}}/> +86</>
// })
let _Options:any = []
List.forEach((item:any,index:number) => {
let tem = <><img src={item} key={'item' + index} style={{width: _width, height: _height}}/> +86</>
_Options.push({label:tem,value:index+1})
})
useEffect(() => {
history.location.query.addType == '1'? setHeaderTitle('新建发货地址') : setHeaderTitle('新建收货地址')
setOptions(_Options)
return () => {
}
},[])
return (
<PageHeaderWrapper
......@@ -131,7 +130,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
<SchemaForm editable={state.editable}
initialValues={{
provic: '广东省',
phoneHead: '1'
phoneHead: 1
}}
components={{
......@@ -206,7 +205,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
name="phoneHead"
required
x-component="Select"
enum={selectList}
enum={Options}
x-component-props={{
placeholder: '+86'
}}
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-17 17:57:40
* @LastEditTime: 2020-07-18 11:21:19
*/
import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom'
......@@ -115,7 +115,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
// useFormEffects(($,setFieldState ) => {
// })
const List: any = [ChinaImg, gou, japenImg, korenImg, us]
const List: string[] = [ChinaImg, gou, japenImg, korenImg, us]
const selectList: any = [
{ label: <><img src={ChinaImg} key='1' style={{ width: _width, height: 17 }} /> +86</>, value: '1' },
{ label: <><img src={gou} key='2' style={{ width: _width, height: 17 }} /> +86</>, value: '2' },
......@@ -145,7 +145,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
}
>
<Card>
<Row>
<Row >
<Col span={24}>
<SchemaForm editable={state.editable}
actions={actions}//要传递
......@@ -163,10 +163,9 @@ const diaLogForm: React.FC<ListProps> = (props) => {
RadioGroup: Radio.Group, ArrayTable, ArrayCards, Transfer
}}
>
<FormTab name="tabs" defaultActiveKey={'tab-2'}>
<FormTab name="tabs" defaultActiveKey={'tab-1'}>
<FormTab.TabPane name="tab-1" tab="基本信息">
<FormMegaLayout layoutProps={{ wrapperCol: 12 }} labelCol={4} labelAlign="left">
<FormMegaLayout wrapperWidth={570} labelCol={2} labelAlign="left">
<Field
required
title="模板名称"
......@@ -195,55 +194,86 @@ const diaLogForm: React.FC<ListProps> = (props) => {
{ label: '快递', value: '1' }
]}
/>
<FormMegaLayout label='默认运费' grid full required>
<FormMegaLayout>
<FormMegaLayout addonAfter="">
<Field
name="weight"
required
x-component="Input"
x-component-props={{
placeholder: '',
addonAfter: "KG"
}}
/>
</FormMegaLayout>
<FormMegaLayout addonBefore="每增加" addonAfter="增加运费">
<Field
name="incrementWeight"
required
x-component="Input"
x-component-props={{
placeholder: '',
addonAfter: "KG"
}}
/>
</FormMegaLayout>
</FormMegaLayout>
<FormMegaLayout >
<Field
name="price"
required
x-component="Input"
x-component-props={{
placeholder: '',
addonAfter: "元"
}}
/>
<FormMegaLayout>
<Field
name="incrementPrice"
required
x-component="Input"
x-component-props={{
placeholder: '',
addonAfter: "元"
</FormMegaLayout>
<FormMegaLayout label="默认运费" required labelCol={2} wrapperWidth={570} labelAlign="left">
<FormMegaLayout inline>
<Field
name="weight"
required
x-props={{
style:{
width: 160,
marginLeft:51
}
}}
x-component="Input"
x-component-props={{
}}
/>
</FormMegaLayout>
</FormMegaLayout>
placeholder: '',
addonAfter: "KG"
}}
x-mega-props={{
addonBefore: ' ',
addonAfter: '内,'
}}
/>
<Field
name="price"
required
x-props={{
style:{
width: 160,
marginLeft: 40
}
}}
x-component="Input"
x-component-props={{
placeholder: '',
addonAfter: "元"
}}
/>
</FormMegaLayout>
<FormMegaLayout inline>
<Field
name="incrementWeight"
required
x-props={{
style:{
width: 160,
marginLeft: 10
}
}}
x-component="Input"
x-component-props={{
placeholder: '',
addonAfter: "KG"
}}
x-mega-props={{
addonBefore: '每增加',
addonAfter: '增加运费'
}}
/>
<Field
name="incrementPrice"
required
x-props={{
style:{
width: 160
}
}}
x-component="Input"
x-component-props={{
placeholder: '',
addonAfter: "元"
}}
/>
</FormMegaLayout>
</FormMegaLayout>
<FormMegaLayout wrapperWidth={570} labelCol={2} labelAlign="left">
<Field
title="运费说明"
name="explain"
......@@ -263,7 +293,6 @@ const diaLogForm: React.FC<ListProps> = (props) => {
type="array"
x-component="ArrayTable"
x-component-props={{
// align:'center',
operationsWidth: 200,
operations: {
title: '操作'
......@@ -306,12 +335,22 @@ const diaLogForm: React.FC<ListProps> = (props) => {
}}
/>
<Field name="weight"
x-component="Input" type="number" title="首件(件/KG)"
x-component="Input" type="number" title="首件(件/KG)"
// rules={
// {
// whitespace: true,
// min: 5,
// max: 10,
// validator:(value:any) => {
// return value.indexOf('asd') > -1 ? '文本里不能包含asd' : ''
// }
// }
// }
x-component-props={{
onChange: (e: any) => {
console.log(e.target.value)
}
},
// rules:(value:any) => {
// return new Promise(resolve => {
// setTimeout(() => {
......@@ -319,8 +358,8 @@ const diaLogForm: React.FC<ListProps> = (props) => {
// }, 1000)
// })
// }
// rules: [{
// required: true,
// message: '请输入内容!',
......
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