Commit 5622debe authored by GuanHua's avatar GuanHua
parents 58cf7e14 84956d1c
...@@ -23,7 +23,7 @@ const config: any = { ...@@ -23,7 +23,7 @@ const config: any = {
}, },
routes, routes,
extraBabelPlugins: [ extraBabelPlugins: [
// ['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }, 'antd'], ['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }, 'antd'],
['import', { libraryName: 'god', libraryDirectory: 'es', style: true }, 'god'], ['import', { libraryName: 'god', libraryDirectory: 'es', style: true }, 'god'],
['import', { libraryName: '@umijs/hooks', libraryDirectory: 'lib', camel2DashComponentName: false }, '@umijs/hooks'],// 将下划线转化关闭 ['import', { libraryName: '@umijs/hooks', libraryDirectory: 'lib', camel2DashComponentName: false }, '@umijs/hooks'],// 将下划线转化关闭
], ],
......
/**
* @description 自定义路由类型
* @author xjm
* @date 2020-10-09
* @export
* @interface RouterChild
*/
export interface RouterChild {
path: string
/**
* @description 国际化对应的key
* @type {string}
* @memberof RouterChild
*/
name: string
icon?: string
routes?: RouterChild[]
component?: string
/**
* @description 是否在右侧菜单隐藏
* @type {boolean}
* @memberof RouterChild
*/
hideInMenu?: boolean
/**
* @description 是否禁用content内页中的margin, true为禁用
* @type {boolean}
* @memberof RouterChild
*/
noMargin?: boolean
}
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
"test": "umi-test", "test": "umi-test",
"test:coverage": "umi-test --coverage", "test:coverage": "umi-test --coverage",
"start:cross": "cross-env SITE_ID=352 yarn start" "start:cross": "cross-env SITE_ID=352 yarn start",
"start:url": "cross-env SITE_ID=1 BACK_GATEWAY=http://lingxi-all.wg.shushangyun.com yarn start"
}, },
"lint-staged": { "lint-staged": {
"*.{js,jsx,less,md,json}": [ "*.{js,jsx,less,md,json}": [
......
...@@ -44,8 +44,8 @@ export enum LAYOUT_TYPE { ...@@ -44,8 +44,8 @@ export enum LAYOUT_TYPE {
} }
// 本地环境跳过权限校验 // 本地环境跳过权限校验
export const isDev = process.env.NODE_ENV === "development" // export const isDev = process.env.NODE_ENV === "development"
// export const isDev = false export const isDev = false
export const Environment_Status = { export const Environment_Status = {
0: "所有", 0: "所有",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-22 09:54:50 * @Date: 2020-07-22 09:54:50
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-30 19:28:23 * @LastEditTime: 2020-10-09 10:54:23
*/ */
/** /**
* 正则表达式集合 * 正则表达式集合
...@@ -13,6 +13,7 @@ export const PATTERN_MAPS = { ...@@ -13,6 +13,7 @@ export const PATTERN_MAPS = {
password: /^(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{8,20}$/, password: /^(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{8,20}$/,
email: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/, email: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/,
phone: /^1[3|4|5|6|7|8|9][0-9]{9}$/, phone: /^1[3|4|5|6|7|8|9][0-9]{9}$/,
tel: /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/,//座机
smsCode: /^\d{6}$/, smsCode: /^\d{6}$/,
money:/^\d*(?:\.\d{0,2})?$/, money:/^\d*(?:\.\d{0,2})?$/,
weight:/^\d*(?:\.\d{0,3})?$/, weight:/^\d*(?:\.\d{0,3})?$/,
......
...@@ -17,10 +17,6 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format ...@@ -17,10 +17,6 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format
}) })
linkage.loading(name) linkage.loading(name)
service().then(res => { service().then(res => {
setFieldState(name, state => {
state.originAsyncData = res
})
linkage.loaded(name)
if (format) { if (format) {
const [labelString, valueString] = format const [labelString, valueString] = format
res = res.map(v => ({ res = res.map(v => ({
...@@ -28,6 +24,11 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format ...@@ -28,6 +24,11 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format
value: v[valueString] value: v[valueString]
})) }))
} }
setFieldState(name, state => {
state.originAsyncData = res
})
linkage.loaded(name)
linkage.enum(name, res) linkage.enum(name, res)
//请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动 //请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动
dispatch('requestAsyncSelect', { dispatch('requestAsyncSelect', {
......
...@@ -43,6 +43,20 @@ ...@@ -43,6 +43,20 @@
left: 175px; left: 175px;
top: 45px; top: 45px;
} }
.status {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #fff;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
color: red;
}
} }
...@@ -95,7 +109,7 @@ ...@@ -95,7 +109,7 @@
bottom: 0; bottom: 0;
border-top-left-radius: 45px; border-top-left-radius: 45px;
border-bottom-left-radius: 45px ; border-bottom-left-radius: 45px ;
background-color: #91d5ff; // background-color: #91d5ff;
} }
} }
......
...@@ -96,8 +96,11 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => { ...@@ -96,8 +96,11 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
const onError = () => { const onError = () => {
console.log("error") console.log("error")
// setOffset({x: 0, y: 0}) setStatus(ERROR);
setTimeout(() => {
reRender() reRender()
}, 500)
// setOffset({x: 0, y: 0})
} }
const onReset = () => { const onReset = () => {
...@@ -106,12 +109,8 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => { ...@@ -106,12 +109,8 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
const reRender = () => { const reRender = () => {
setLoading(true); setLoading(true);
setStatus(READY);
setOffset({x: 0, y: 0})
const objImage = new Image() const objImage = new Image()
console.log(imageUrl)
objImage.addEventListener("load", () => { objImage.addEventListener("load", () => {
console.log(objImage.width);
// 先获取两个ctx // 先获取两个ctx
const ctxShadow = shadowCanvas.current.getContext("2d") const ctxShadow = shadowCanvas.current.getContext("2d")
const ctxFragment = fragmentCanvas.current.getContext("2d") const ctxFragment = fragmentCanvas.current.getContext("2d")
...@@ -147,6 +146,9 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => { ...@@ -147,6 +146,9 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
// 修改状态 // 修改状态
setLoading(false); setLoading(false);
setStatus(READY);
setOffset({x: 0, y: 0})
}) })
objImage.src = imageUrl objImage.src = imageUrl
} }
...@@ -161,11 +163,11 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => { ...@@ -161,11 +163,11 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
? null ? null
: ( : (
<div> <div>
{ {/* {
loading loading
? <div className={styles.loading}><Spin /></div> ? <div className={styles.loading}><Spin /></div>
: null : null
} } */}
<div className={styles.sliderContainer} style={{visibility: !loading ? 'visible' : 'hidden'}}> <div className={styles.sliderContainer} style={{visibility: !loading ? 'visible' : 'hidden'}}>
<div className={styles.container}> <div className={styles.container}>
...@@ -184,6 +186,12 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => { ...@@ -184,6 +186,12 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
ref={fragmentCanvas} ref={fragmentCanvas}
style={{ left: offset.x + "px", top: clipImagePosition.y + "px" }} style={{ left: offset.x + "px", top: clipImagePosition.y + "px" }}
></canvas> ></canvas>
{
status === ERROR
? <div className={styles.status}>验证失败</div>
: null
}
</div> </div>
<div className={styles.slider} onMouseMove={mouseMove} onMouseLeave={mouseUp}> <div className={styles.slider} onMouseMove={mouseMove} onMouseLeave={mouseUp}>
<div className={styles.sliderHandle} onMouseDown={mouseDown} onMouseUp={mouseUp} style={sliderHandleStyle} ><DoubleRightOutlined /></div> <div className={styles.sliderHandle} onMouseDown={mouseDown} onMouseUp={mouseUp} style={sliderHandleStyle} ><DoubleRightOutlined /></div>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55 * @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-09-17 17:41:05 * @LastEditTime: 2020-10-09 14:41:19
*/ */
import React, { Component, useState, useEffect } from 'react'; import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
...@@ -335,10 +335,13 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -335,10 +335,13 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component-props={{ x-component-props={{
placeholder: '请输入发货人' placeholder: '请输入发货人'
}} }}
x-rules= {{ x-rules= {[{
max: 20, max: 20,
message:'输入发货人字数不能大于20' message:'输入发货人字数不能大于20'
}} },{
required: true,
message:'请输入发货人'
}]}
/> />
: :
<Field <Field
...@@ -349,10 +352,13 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -349,10 +352,13 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component-props={{ x-component-props={{
placeholder: '请输入收货人' placeholder: '请输入收货人'
}} }}
x-rules= {{ x-rules= {[{
max: 20, max: 20,
message:'输入收货人字数不能大于20' message:'输入收货人字数不能大于20'
}} },{
required: true,
message:'请输入收货人'
}]}
/> />
} }
...@@ -366,6 +372,10 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -366,6 +372,10 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component-props={{ x-component-props={{
placeholder: '-省份/直辖市-' placeholder: '-省份/直辖市-'
}} }}
x-rules= {[{
required: true,
message:'请选择省份/直辖市'
}]}
/> />
<Field <Field
x-mega-props={{ span: 1 }} x-mega-props={{ span: 1 }}
...@@ -376,16 +386,25 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -376,16 +386,25 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component-props={{ x-component-props={{
placeholder: '-市-' placeholder: '-市-'
}} }}
x-rules= {[{
required: true,
message:'请选择城市'
}]}
/> />
<Field <Field
x-mega-props={{ span: 1 }} x-mega-props={{ span: 1 }}
x-component="Select" x-component="Select"
enum={selectList} enum={selectList}
required required
name="districtCode" name="districtCode"
x-component-props={{ x-component-props={{
placeholder: '-区-' placeholder: '-区-'
}} }}
x-rules= {[{
required: true,
message:'请选择县市'
}]}
/> />
</FormMegaLayout> </FormMegaLayout>
<Field <Field
...@@ -397,10 +416,13 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -397,10 +416,13 @@ const diaLogForm: React.FC<ListProps> = (props) => {
placeholder: '请输入详细地址', placeholder: '请输入详细地址',
autocomplete: 'off' autocomplete: 'off'
}} }}
x-rules= {{ x-rules= {[{
max: 30, max: 30,
message:'输入详细地址字数不能大于30' message:'输入详细地址字数不能大于30'
}} },{
required: true,
message:'请输入详细地址'
}]}
/> />
<Field <Field
title="邮编" title="邮编"
...@@ -421,18 +443,25 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -421,18 +443,25 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component-props={{ x-component-props={{
placeholder: '+86' placeholder: '+86'
}} }}
x-rules= {[{
required: true,
message:'请选择区号'
}]}
/> />
<Field <Field
x-mega-props={{ span: 5 }} x-mega-props={{ span: 5 }}
name="phone" name="phone"
required required
x-component="Input" x-component="Input"
x-rules={{ x-rules={[{
pattern: PATTERN_MAPS.phone, pattern: PATTERN_MAPS.phone,
message:'请输入正确手机号', message:'请输入正确手机号',
// maximum={11}数值的意思 // maximum={11}数值的意思
}} },{
required: true,
message:'请输入手机号'
}]}
x-component-props={{ x-component-props={{
placeholder: '输入你的手机号码', placeholder: '输入你的手机号码',
...@@ -440,20 +469,16 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -440,20 +469,16 @@ const diaLogForm: React.FC<ListProps> = (props) => {
/> />
</FormMegaLayout> </FormMegaLayout>
<FormMegaLayout label='电话号码' grid full> <FormMegaLayout label='电话号码' grid full>
{/* <Field
x-mega-props={{ span: 1 }}
name="phoneHead"
x-component="Input"
x-component-props={{
placeholder: '区号'
}}
/> */}
<Field <Field
x-mega-props={{ span: 5 }} x-mega-props={{ span: 5 }}
name="tel" name="tel"
x-component="Input" x-component="Input"
x-component-props={{ x-component-props={{
placeholder: '' placeholder: '输入你的电话号码'
}}
x-rules = {{
message: '输入正确电话号码',
pattern: PATTERN_MAPS.tel
}} }}
/> />
</FormMegaLayout> </FormMegaLayout>
......
...@@ -6,7 +6,7 @@ EyePreview/* ...@@ -6,7 +6,7 @@ EyePreview/*
*/ */
import React, { Component, ReactNode, useRef, useState } from 'react' import React, { Component, ReactNode, useRef, useState } from 'react'
import { history } from 'umi' import { history } from 'umi'
import { Modal, Card, Button, Form, InputNumber, Radio, Popconfirm, Switch, Input } from 'antd'; import { Modal, Card, Row, Col, Button, Form, InputNumber, Radio, Popconfirm, Switch, Input } from 'antd';
import { import {
PlayCircleOutlined, PlayCircleOutlined,
PauseCircleOutlined, PauseCircleOutlined,
...@@ -20,7 +20,7 @@ import { ColumnType } from 'antd/lib/table/interface' ...@@ -20,7 +20,7 @@ import { ColumnType } from 'antd/lib/table/interface'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController' import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController'
import StatusSwitch from '@/components/StatusSwitch' import StatusSwitch from '@/components/StatusSwitch'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import { PublicApi} from '@/services/api' import { PublicApi } from '@/services/api'
const data = [ const data = [
{ {
...@@ -47,7 +47,7 @@ const data = [ ...@@ -47,7 +47,7 @@ const data = [
// 模拟请求 // 模拟请求
const fetchData = (params: any) => { const fetchData = (params: any) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
PublicApi.getLogisticsFreightTemplatePage({...params}).then(res=> { PublicApi.getLogisticsFreightTemplatePage({ ...params }).then(res => {
resolve(res.data) resolve(res.data)
}) })
}) })
...@@ -114,6 +114,9 @@ const EditableCell: React.FC<EditableCellProps> = ({ ...@@ -114,6 +114,9 @@ const EditableCell: React.FC<EditableCellProps> = ({
const Template: React.FC<ListProps> = (props) => { const Template: React.FC<ListProps> = (props) => {
console.log(props) console.log(props)
const ref = useRef<any>({}) const ref = useRef<any>({})
const [searchForm, setSearchForm] = useState({
name: ''
})
const [form] = Form.useForm(); const [form] = Form.useForm();
const [table, setTable] = useState([]) const [table, setTable] = useState([])
const [editingKey, setEditingKey] = useState(''); const [editingKey, setEditingKey] = useState('');
...@@ -128,7 +131,7 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -128,7 +131,7 @@ const Template: React.FC<ListProps> = (props) => {
dataIndex: 'name', dataIndex: 'name',
align: 'left', align: 'left',
key: 'name', key: 'name',
render: (text:any,record:any) => ( render: (text: any, record: any) => (
<EyePreview url={`/memberCenter/logisticsAbility/logistics/templateForm?id=${record.id}&isSee=${true}`}>{text}</EyePreview> <EyePreview url={`/memberCenter/logisticsAbility/logistics/templateForm?id=${record.id}&isSee=${true}`}>{text}</EyePreview>
) )
}, },
...@@ -137,9 +140,9 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -137,9 +140,9 @@ const Template: React.FC<ListProps> = (props) => {
align: 'center', align: 'center',
dataIndex: 'pricingMode', dataIndex: 'pricingMode',
key: 'pricingMode', key: 'pricingMode',
render: (_:any,record:any) => { render: (_: any, record: any) => {
return ( return (
<>{record.transportMode === 1?'按重量':''}</> <>{record.transportMode === 1 ? '按重量' : ''}</>
) )
} }
}, },
...@@ -148,9 +151,9 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -148,9 +151,9 @@ const Template: React.FC<ListProps> = (props) => {
dataIndex: 'transportMode', dataIndex: 'transportMode',
align: 'center', align: 'center',
key: 'transportMode', key: 'transportMode',
render: (_:any,record:any) => { render: (_: any, record: any) => {
return ( return (
<>{record.transportMode === 1?'快递':''}</> <>{record.transportMode === 1 ? '快递' : ''}</>
) )
} }
}, },
...@@ -166,7 +169,7 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -166,7 +169,7 @@ const Template: React.FC<ListProps> = (props) => {
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<StatusSwitch fieldNames="status" handleConfirm={() => handleChangeStatus(record.id,record.status)} record={record}/> <StatusSwitch fieldNames="status" handleConfirm={() => handleChangeStatus(record.id, record.status)} record={record} />
) )
}, },
{ {
...@@ -180,7 +183,7 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -180,7 +183,7 @@ const Template: React.FC<ListProps> = (props) => {
record.status === 0 ? record.status === 0 ?
<> <>
<Button type='link' onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/templateForm?id=${record.id}`)}>编辑</Button> <Button type='link' onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/templateForm?id=${record.id}`)}>编辑</Button>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() =>handleDelete(record.id)}> <Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete(record.id)}>
<Button type='link'> <Button type='link'>
删除 删除
</Button> </Button>
...@@ -206,18 +209,18 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -206,18 +209,18 @@ const Template: React.FC<ListProps> = (props) => {
columns.forEach((v, index) => { columns.forEach((v, index) => {
}) })
} }
const handleChangeStatus = (id:any,status:any) => { const handleChangeStatus = (id: any, status: any) => {
let _status = status == 0 ? 1: 0 let _status = status == 0 ? 1 : 0
PublicApi.postLogisticsFreightTemplateEnable({id:id,status:_status}).then(res => { PublicApi.postLogisticsFreightTemplateEnable({ id: id, status: _status }).then(res => {
if(res.code === 1000){ if (res.code === 1000) {
console.log(ref) console.log(ref)
ref.current.reload() ref.current.reload()
} }
}) })
} }
const handleDelete = (id:number) => { const handleDelete = (id: number) => {
PublicApi.postLogisticsFreightTemplateDelete({id:id}).then(res => { PublicApi.postLogisticsFreightTemplateDelete({ id: id }).then(res => {
if(res.code === 1000){ if (res.code === 1000) {
ref.current.reload() ref.current.reload()
} }
}) })
...@@ -247,6 +250,16 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -247,6 +250,16 @@ const Template: React.FC<ListProps> = (props) => {
console.log('执行状态修改', record) console.log('执行状态修改', record)
} }
const handleChange = (key: any, val: any) => {
let obj: any = {}
switch (key) {
case 'name':
obj = { ...searchForm, name: val }
break;
}
setSearchForm(obj)
ref.current.reload(obj)
}
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
...@@ -255,15 +268,22 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -255,15 +268,22 @@ const Template: React.FC<ListProps> = (props) => {
currentRef={ref} currentRef={ref}
fetchTableData={(params: any) => fetchData(params)} fetchTableData={(params: any) => fetchData(params)}
rowClassName="editable-row" rowClassName="editable-row"
formilyChilds={{ controlRender={
children: ( <Row style={{ marginBottom: '32px' }}>
<> <Col span={6}>
<Button type="primary" icon={<PlusOutlined />} onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/templateForm?id=0`)}> <Button type="primary" icon={<PlusOutlined />} onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/templateForm?id=0`)}>新建</Button>
新建 </Col>
</Button> <Col span={10} offset={8} style={{ textAlign: 'right' }}>
</> <Input.Search
) style={{ width: '232px' }}
}} value={searchForm.name}
placeholder='输入模板名称进行搜索'
onChange={(e) => setSearchForm({ ...searchForm, name: e.target.value })}
onSearch={(val) => handleChange('name', val)}
/>
</Col>
</Row>
}
/> />
</Card> </Card>
</PageHeaderWrapper> </PageHeaderWrapper>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34 * @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-09-22 14:26:16 * @LastEditTime: 2020-10-09 11:29:36
*/ */
import React, { Component, ReactNode, useRef, useState, useEffect } from 'react' import React, { Component, ReactNode, useRef, useState, useEffect } from 'react'
import { history } from 'umi' import { history } from 'umi'
...@@ -408,17 +408,6 @@ const OrderList: React.FC<ListProps> = (props) => { ...@@ -408,17 +408,6 @@ const OrderList: React.FC<ListProps> = (props) => {
}) })
} }
</Select> </Select>
<Select
className={style.select}
value={searchForm.status}
onChange={(val) => setSearchForm({ ...searchForm, status: val })}
>
{
outSideStatusList.map((item, index) => {
return <Option key={index} value={item.value}>{item.label}</Option>
})
}
</Select>
</Space> </Space>
</Col> </Col>
} }
......
...@@ -12,18 +12,24 @@ import { PublicApi } from '@/services/api' ...@@ -12,18 +12,24 @@ import { PublicApi } from '@/services/api'
const { TabPane } = Tabs; const { TabPane } = Tabs;
const AddQuotes: React.FC<{}> = () => { const AddQuotes: React.FC<{}> = () => {
const [memberList, setmemberList] = useState([]); const [memberList, setmemberList] = useState([]); //存放用户信息
const [goodsList, setgoodsList] = useState([]); //存放商品
const basicInfoRef = useRef<any>({}); const basicInfoRef = useRef<any>({});
const tradingConditionsRef = useRef<any>({}); const tradingConditionsRef = useRef<any>({});
/************* 页面的一些操作start *************/ /************* 页面的一些操作start *************/
const onSumbit = async (params: any) => { const onSumbit = async (params: any) => {
const basicInfo = await basicInfoRef.current.validateFields(); const basicInfo = await basicInfoRef.current.validateFields();
const tradingConditions = await tradingConditionsRef.current.validateFields(); const tradingConditions = await tradingConditionsRef.current.validateFields();
console.log(tradingConditions, basicInfo) console.log(tradingConditions, basicInfo, goodsList, memberList)
} }
// 获取到会员信息
const getMemberList = (list: any) => { const getMemberList = (list: any) => {
setmemberList(list); setmemberList(list);
} }
// 获取添加的商品列表
const getGoodsList = (list:any) => {
setgoodsList(list)
}
/************* 页面的一些操作end *************/ /************* 页面的一些操作end *************/
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
...@@ -45,6 +51,7 @@ const AddQuotes: React.FC<{}> = () => { ...@@ -45,6 +51,7 @@ const AddQuotes: React.FC<{}> = () => {
<TabPane tab="询价商品" key="2"> <TabPane tab="询价商品" key="2">
<EnquiryGoods <EnquiryGoods
memberList={memberList} memberList={memberList}
getGoodsList={getGoodsList}
/> />
</TabPane> </TabPane>
<TabPane tab="交易条件" key="3"> <TabPane tab="交易条件" key="3">
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';
import { Button, message, Input,Table } from 'antd'; import { Button, message, Input, Table, Form } from 'antd';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'; import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
...@@ -15,86 +15,34 @@ import Submit from '@/components/NiceForm/components/Submit' ...@@ -15,86 +15,34 @@ import Submit from '@/components/NiceForm/components/Submit'
interface queryProps extends ModalTableProps { interface queryProps extends ModalTableProps {
memberList?: any, memberList?: any,
schemaAction?: ISchemaFormActions | ISchemaFormAsyncActions schemaAction?: ISchemaFormActions | ISchemaFormAsyncActions,
getGoodsList: Function
} }
// 只能输入数字的输入框
const NumericInput = (props) => {
const onChange = (e) => {
const { value } = e.target;
const reg = /^-?\d*(\.\d*)?$/;
if ((!isNaN(value) && reg.test(value)) || value === "" || value === "-") {
props.onChange(value);
}
};
const onBlur = () => {
const { value, onBlur, onChange } = props;
let valueTemp = value;
if (value.charAt(value.length - 1) === "." || value === "-") {
valueTemp = value.slice(0, -1);
}
onChange(valueTemp.replace(/0*(\d+)/, "$1"));
if (onBlur) {
onBlur();
}
};
return (
<Input
{...props}
onChange={onChange}
onBlur={onBlur}
maxLength={25}
/>
);
};
const EnquiryGoods: React.FC<queryProps> = (props) => { const EnquiryGoods: React.FC<queryProps> = (props) => {
const { memberList, schemaAction, ...restProps } = props const { memberList, schemaAction, getGoodsList, ...restProps } = props
const [value, setValue] = useState<any>('') const [value, setValue] = useState<any>('')
const productFormActions = createAsyncFormActions() const productFormActions = createAsyncFormActions()
const onChange = (value) => { const onChange = (value) => {
setValue(value); setValue(value);
}; };
const columns: ColumnType<any>[] = [{
title: '序号',
dataIndex: 'productId',
}, {
title: '商品名称',
dataIndex: 'productName',
}, {
title: '品类',
dataIndex: 'inquiryListNo',
}, {
title: '品牌',
dataIndex: 'brand',
}, {
title: '单位',
dataIndex: 'nuit',
}, {
title: '采购数量',
dataIndex: 'purchaseQuantity',
render:(text:any, record: any) => (
<NumericInput value={value} onChange={onChange} />
)
}, {
title: '操作',
dataIndex: 'operation',
render:(text:any, record: any) => <Button type='link' onClick={() => handleDelete(record)}>删除</Button>
}]
// 会员添加弹窗控制 // 会员添加弹窗控制
const [visibleChannelMember, setVisibleChannelMember] = useState(false); const [visibleChannelMember, setVisibleChannelMember] = useState(false);
const [goodsList, setgoodsList] = useState([]); const [goodsList, setgoodsList] = useState([]);
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'commodityId' }); const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'commodityId' });
const handleOkAddMember = () => { const handleOkAddMember = () => {
setVisibleChannelMember(false); setVisibleChannelMember(false);
const arr : any[] = [] const arr: any[] = []
memberRowCtl.selectRow.forEach((v, i) => { memberRowCtl.selectRow.forEach((v, i) => {
arr.push({ arr.push({
productId: v.commodityId, productId: v.commodityId,
productName: v.name, productName: v.name,
inquiryListNo: v.customerCategoryName, inquiryListNo: v.customerCategoryName,
brand: v.brandName, brand: v.brandName,
nuit: v.unitName nuit: v.unitName,
purchaseQuantity: 0
}) })
setgoodsList(arr) setgoodsList(arr)
}) })
...@@ -175,6 +123,50 @@ const EnquiryGoods: React.FC<queryProps> = (props) => { ...@@ -175,6 +123,50 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
} }
} }
} }
/**输入框输入 */
const inputOnchange = (id, e) => {
const {value} = e.target
goodsList.forEach(v => {
if(v.productId === id) {
v.purchaseQuantity = value
}
})
getGoodsList(goodsList) // 返回给父级
setgoodsList(goodsList)
}
const columns: ColumnType<any>[] = [{
title: '序号',
dataIndex: 'productId',
}, {
title: '商品名称',
dataIndex: 'productName',
}, {
title: '品类',
dataIndex: 'inquiryListNo',
}, {
title: '品牌',
dataIndex: 'brand',
}, {
title: '单位',
dataIndex: 'nuit',
}, {
title: '采购数量',
dataIndex: 'purchaseQuantity',
render: (text: any, record: any) => (
<Form.Item name={record.productId} noStyle initialValue={record.purchaseQuantity}>
<Input
onBlur={(e) => inputOnchange(record.productId, e)}
type='number'
maxLength={25}
/>
</Form.Item>
)
}, {
title: '操作',
dataIndex: 'operation',
render: (text: any, record: any) => <Button type='link' onClick={() => handleDelete(record)}>删除</Button>
}]
// 模拟数据 // 模拟数据
const data = [{ const data = [{
...@@ -184,26 +176,26 @@ const EnquiryGoods: React.FC<queryProps> = (props) => { ...@@ -184,26 +176,26 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
brandName: 'PELLE', brandName: 'PELLE',
unitName: '个', unitName: '个',
},{ }, {
commodityId: 2, commodityId: 2,
name: '进口头层黄牛皮荔枝纹/红色/XXL', name: '进口头层黄牛皮荔枝纹/红色/XXL',
customerCategoryName: '牛皮', customerCategoryName: '牛皮',
brandName: 'PELLE', brandName: 'PELLE',
unitName: '个', unitName: '个',
},{ }, {
commodityId: 3, commodityId: 3,
name: '进口头层黄牛皮荔枝纹/红色/XXL', name: '进口头层黄牛皮荔枝纹/红色/XXL',
customerCategoryName: '牛皮', customerCategoryName: '牛皮',
brandName: 'PELLE', brandName: 'PELLE',
unitName: '个', unitName: '个',
},{ }, {
commodityId: 4, commodityId: 4,
name: '进口头层黄牛皮荔枝纹/红色/XXL', name: '进口头层黄牛皮荔枝纹/红色/XXL',
customerCategoryName: '牛皮', customerCategoryName: '牛皮',
brandName: 'PELLE', brandName: 'PELLE',
unitName: '个', unitName: '个',
},{ }, {
commodityId: 5, commodityId: 5,
name: '进口头层黄牛皮荔枝纹/红色/XXL', name: '进口头层黄牛皮荔枝纹/红色/XXL',
customerCategoryName: '牛皮', customerCategoryName: '牛皮',
...@@ -233,7 +225,7 @@ const EnquiryGoods: React.FC<queryProps> = (props) => { ...@@ -233,7 +225,7 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
}, [memberList]) }, [memberList])
// 添加商品 // 添加商品
const addGoods = () => { const addGoods = () => {
if(memberList.length > 0 && memberList[0].memberId) { if (memberList.length > 0 && memberList[0].memberId) {
setVisibleChannelMember(true); setVisibleChannelMember(true);
} else { } else {
message.error('请选择被询价会员') message.error('请选择被询价会员')
...@@ -254,14 +246,17 @@ const EnquiryGoods: React.FC<queryProps> = (props) => { ...@@ -254,14 +246,17 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
return ( return (
<div className={styles.revise_style}> <div className={styles.revise_style}>
<Button block type='dashed' onClick={addGoods}><PlusOutlined />添加商品</Button> <Button block type='dashed' onClick={addGoods}><PlusOutlined />添加商品</Button>
<Table rowKey={'productId'} style={{marginTop: '16px'}} columns={columns} dataSource={goodsList} pagination={false} /> <Form>
<Table rowKey={'productId'} style={{ marginTop: '16px' }} columns={columns} dataSource={goodsList} pagination={false} />
</Form>
{/* 选择商品弹框 */} {/* 选择商品弹框 */}
<ModalTable <ModalTable
modalTitle='选择商品' modalTitle='选择商品'
confirm={handleOkAddMember} confirm={handleOkAddMember}
cancel={handleCancelAddMember} cancel={handleCancelAddMember}
visible={visibleChannelMember} visible={visibleChannelMember}
resetModal={{destroyOnClose: true, forceRender: true}} resetModal={{ destroyOnClose: true, forceRender: true }}
columns={columnsSetMember} columns={columnsSetMember}
rowSelection={memberRowSelection} rowSelection={memberRowSelection}
fetchTableData={params => fetchGoodsList(params)} fetchTableData={params => fetchGoodsList(params)}
...@@ -287,6 +282,7 @@ const EnquiryGoods: React.FC<queryProps> = (props) => { ...@@ -287,6 +282,7 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
}} }}
{...restProps} {...restProps}
/> />
</div> </div>
) )
} }
......
import React, { useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';
import moment from 'moment'; import moment from 'moment';
import { Form, Input, Select, Row, Col, DatePicker } from 'antd'; import { Form, Input, Select, Row, Col, DatePicker } from 'antd';
import { PublicApi } from '@/services/api';
interface queryProps { interface queryProps {
currentRef?: any currentRef?: any
...@@ -16,6 +17,7 @@ const layout: any = { ...@@ -16,6 +17,7 @@ const layout: any = {
const TradingConditions: React.FC<queryProps> = (props) => { const TradingConditions: React.FC<queryProps> = (props) => {
const { currentRef } = props; const { currentRef } = props;
const [TradingConditionsForm] = Form.useForm(); const [TradingConditionsForm] = Form.useForm();
const [address, setAddress] = useState<any>([]);
const hadnleValidateFields = () => { const hadnleValidateFields = () => {
return new Promise((resolve) => { return new Promise((resolve) => {
TradingConditionsForm.validateFields().then(values => { TradingConditionsForm.validateFields().then(values => {
...@@ -49,6 +51,13 @@ const TradingConditions: React.FC<queryProps> = (props) => { ...@@ -49,6 +51,13 @@ const TradingConditions: React.FC<queryProps> = (props) => {
currentRef.current = userAction; currentRef.current = userAction;
} }
} }
// 获取交付地址
PublicApi.getLogisticsSelectListReceiverAddress().then(res => {
setAddress(res.data)
console.log(res.data)
})
}, []) }, [])
return ( return (
<Form <Form
...@@ -61,9 +70,11 @@ const TradingConditions: React.FC<queryProps> = (props) => { ...@@ -61,9 +70,11 @@ const TradingConditions: React.FC<queryProps> = (props) => {
<Form.Item label='交付日期' name='deliveryTime' rules={[{ required: true, message: '请选择交付日期' }]}> <Form.Item label='交付日期' name='deliveryTime' rules={[{ required: true, message: '请选择交付日期' }]}>
<DatePicker format="YYYY-MM-DD HH:mm:ss" /> <DatePicker format="YYYY-MM-DD HH:mm:ss" />
</Form.Item> </Form.Item>
<Form.Item label='交付地址' name='' rules={[{ required: true, message: '请选择交付地址' }]}> <Form.Item label='交付地址' name='fullAddress' rules={[{ required: true, message: '请选择交付地址' }]}>
<Select> <Select>
<Select.Option value="demo">Demo</Select.Option> {address.lengtn > 0 && address.map(v => (
<Select.Option key={v.id} value={v.id}>{v.fullAddress}</Select.Option>
))}
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item label='报价截止时间' name='quotationAsTime' rules={[{ required: true, message: '请选择报价截止时间' }]}> <Form.Item label='报价截止时间' name='quotationAsTime' rules={[{ required: true, message: '请选择报价截止时间' }]}>
......
...@@ -167,7 +167,7 @@ const OrderElectronModal:React.FC<OrderElectronModalProps> = (props) => { ...@@ -167,7 +167,7 @@ const OrderElectronModal:React.FC<OrderElectronModalProps> = (props) => {
expressionScope={{ expressionScope={{
electronBtn electronBtn
}} }}
effects={($) => { effects={($, actions) => {
useAsyncSelect('contractTemplateId', async () => (await PublicApi.getOrderSelectListContractTemplate()).data, ['name', 'id']) useAsyncSelect('contractTemplateId', async () => (await PublicApi.getOrderSelectListContractTemplate()).data, ['name', 'id'])
}} }}
/> />
......
...@@ -282,9 +282,10 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -282,9 +282,10 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const hasPriceList = orderProductRequests.filter(v => !v.memberPrice) const hasPriceList = orderProductRequests.filter(v => !v.memberPrice)
if (hasPriceList.length > 0) { if (hasPriceList.length > 0) {
asyncGetMemberPrice(hasPriceList).then((asyncData) => { asyncGetMemberPrice(hasPriceList).then((asyncData) => {
if (asyncData.length > 0) {
const newData = orderProductRequests.map((v, i) => { const newData = orderProductRequests.map((v, i) => {
if (!v.memberPrice) { if (!v.memberPrice) {
v.memberPrice = asyncData.find(j => j.id === v.id)?.value || '' v.memberPrice = asyncData.find(j => j.id === v.id)?.value || 0
} }
return v return v
}) })
...@@ -293,6 +294,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -293,6 +294,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
...data, ...data,
orderProductRequests: newData orderProductRequests: newData
}) })
}
}) })
} }
}, [orderProductRequests]) }, [orderProductRequests])
......
...@@ -228,6 +228,8 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => { ...@@ -228,6 +228,8 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
titleLabel: '订单号: ', titleLabel: '订单号: ',
titleValue: formData.orderNo titleValue: formData.orderNo
} : null } : null
console.log('123')
return formData ? ( return formData ? (
<div> <div>
<OrderDetailContext.Provider value={formContext}> <OrderDetailContext.Provider value={formContext}>
......
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