Commit b15422e3 authored by LeeJiancong's avatar LeeJiancong

€对接好时间选项

parent 9c677677
......@@ -22,4 +22,5 @@
# mockStatic
/.idea
src/services/index.ts
config/base.config.json
......@@ -7,10 +7,13 @@ import {
} from '@formily/antd'
import { Input, Radio, FormMegaLayout } from '@formily/antd-components'
import { values } from 'mobx';
import {PublicApi} from '@/services/api'
export interface Params {
dialogVisible: boolean,
onCancel: Function,
dontReceive?: boolean //默认展示
id: number | string;
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
dontReceive?: boolean; //默认展示
}
const actions = createFormActions()
const {onFieldChange$} = FormEffectHooks
......@@ -19,9 +22,15 @@ const comfirmDialog: React.FC<Params> = (props) => {
const handleCancel = () => {
}
const handletOk = (values:any) => {
let value = {...values}
value.id = props.id
console.log(values)
actions.submit()
props.onCancel()
PublicApi.postLogisticsOrderWaitConfirmConfirm(value).then(res => {
if(res.code === 1000){
props.onOK()
}
})
}
useEffect(() => {
return () => {
......@@ -29,9 +38,9 @@ const comfirmDialog: React.FC<Params> = (props) => {
}, [])
const useFormEffects = () => {
const { setFieldState } = createFormActions()
onFieldChange$('radio').subscribe(({value}) => {
onFieldChange$('status').subscribe(({value}) => {
setFieldState('remarkOption',state => {
if(value == 1){
if(value == 3){
state.visible = false
}else{
state.visible = true
......@@ -46,7 +55,7 @@ const comfirmDialog: React.FC<Params> = (props) => {
title='单据确认'
width={800}
visible={props.dialogVisible}
onOk={handletOk}
onOk={() => actions.submit()}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => actions.reset()}
......@@ -58,21 +67,22 @@ const comfirmDialog: React.FC<Params> = (props) => {
}}
actions={actions}
effects={() => useFormEffects()}
onSubmit={(values) => handletOk(values)
}
onSubmit={(values) => handletOk(values) }
initialValues={{
status: 3
}}
>
<Field
enum={
[
{ label: '接受物流单', value:1 },
{ label: '不接受物流单', value:2 }
{ label: '接受物流单', value:3},
{ label: '不接受物流单', value:4 }
]}
name='radio'
name='status'
required
x-component="Radio"
/>
{props.dontReceive &&
<FormMegaLayout name='remarkOption' label='不接受原因' full required labelCol={2} labelAlign="top">
<Field
......@@ -80,6 +90,7 @@ const comfirmDialog: React.FC<Params> = (props) => {
x-component="TextArea"
required
x-component-props={{
placeholder: '在此输入你的内容,最多60个汉字'
}}
x-rules={value => {
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-18 15:55:51
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-30 19:14:40
* @LastEditTime: 2020-07-31 19:23:51
*/
import React, { useState, useEffect, useRef, ReactNode } from 'react';
import { Card, Button, Row, Col, Tooltip, Input, Select, Tag, Space } from 'antd'
......@@ -16,6 +16,7 @@ import { hidden } from 'chalk';
import { PublicApi } from '@/services/api';
import {timeRange} from '@/utils/index'
import statuStyle from '../colorTag'
import moment from 'moment'
let { Option } = Select
export interface listProps {
title?: ReactNode,
......@@ -47,7 +48,7 @@ interface paramsType {
const orderSearchList: React.FC<listProps> = (props) => {
console.log(props)
const ref = useRef({})
const ref = useRef<any>({})
const [selectRow, setSelectRow] = useState<Item[]>([])
const TimeList = [
{
......@@ -155,12 +156,6 @@ const orderSearchList: React.FC<listProps> = (props) => {
* @return:
*/
useEffect(() => {
let timeRanges = timeRange(TimeRange);
setSearchForm({
...searchForm,
invoicesTimeStart: timeRanges.st,
invoicesTimeEnd: timeRanges.et
});
console.log(searchForm)
if(props.type === '1'){
PublicApi.getLogisticsSelectListCompany().then(res => {
......@@ -186,7 +181,14 @@ const orderSearchList: React.FC<listProps> = (props) => {
return () => {
}
}, [])
useEffect(() => {
ref.current.reload()
return () => {
}
}, [TimeRange])
const handleSee = (id: number) => {
if (props.type === '1') {
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitDeatil?id=${id}`)
......@@ -248,7 +250,8 @@ const orderSearchList: React.FC<listProps> = (props) => {
title: '单据时间',
align: 'left',
dataIndex: 'invoicesTime',
key: 'invoicesTime'
key: 'invoicesTime',
render: (text:any) => <>{moment(text).format('YYYY-MM-DD HH:mm:ss')}</>
},
{
title: '外部状态',
......@@ -318,19 +321,36 @@ const orderSearchList: React.FC<listProps> = (props) => {
ref.current.reload(obj)
}
const handleChangeTime = (val:number) =>{
console.log('选择箱时间',val)
setTimeRange(val)
let timeRanges = timeRange(TimeRange)
console.log('时间范围',timeRanges)
setSearchForm({
...searchForm,
invoicesTimeStart: timeRanges.st,
invoicesTimeEnd: timeRanges.et
});
const changeTimeRange = (val:any) => {
console.log(val)
setTimeRange(val)
let timeRanges = timeRange(val)
console.log('更新',val)
console.log('选项:',val,'时间:',timeRanges)
// setSearchForm({
// ...searchForm,
// invoicesTimeStart: timeRanges.st,
// invoicesTimeEnd: timeRanges.et
// });
searchForm.invoicesTimeStart = timeRanges.st
searchForm.invoicesTimeEnd = timeRanges.et
ref.current.reload();
}
// const handleChangeTime = (val:number) =>{
// console.log('选择箱时间',val)
// setTimeRange(val)
// let timeRanges = timeRange(TimeRange)
// console.log('时间范围',timeRanges)
// setSearchForm({
// ...searchForm,
// invoicesTimeStart: timeRanges.st,
// invoicesTimeEnd: timeRanges.et
// });
// ref.current.reload();
// }
const handleReset = () => {
for (let key in searchForm) {
searchForm[key] = ''
......@@ -346,7 +366,7 @@ const orderSearchList: React.FC<listProps> = (props) => {
columns={columns}
currentRef={ref}
formAlign='left'
rowSelection={rowSelection}
// rowSelection={rowSelection}
fetchTableData={(params: any) => fetchData(params)}
rowClassName="editable-row"
controlRender={
......@@ -427,7 +447,17 @@ const orderSearchList: React.FC<listProps> = (props) => {
<Select
className={style.select}
value={TimeRange}
onChange={(val) => handleChangeTime(val)}
onChange={(val) =>{
setTimeRange(val),
setSearchForm({
...searchForm,
invoicesTimeStart: timeRange(val).st,
invoicesTimeEnd: timeRange(val).et
})
}
}
>
{
TimeList.map((item,index) => {
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-30 20:17:59
* @LastEditTime: 2020-07-31 19:27:46
*/
import React, { Component, ReactNode, useRef, useState, useEffect } from 'react'
import { history } from 'umi'
......@@ -25,6 +25,8 @@ import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController'
import { PublicApi } from '@/services/api'
import { timeRange} from '@/utils/index'
import moment from 'moment'
import statuStyle from '../colorTag'
import style from '../components/index.less'
const { Option } = Select
......@@ -67,6 +69,15 @@ export interface ListType {
checked: boolean //可选
}
interface paramsType {
logisticsOrderNo?: string;
invoicesTimeStart?: any;
invoicesTimeEnd?: any;
status?: number | string;
shipperId?: any;
}
interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
editing: boolean;
dataIndex: string;
......@@ -117,22 +128,24 @@ const EditableCell: React.FC<EditableCellProps> = ({
const OrderList: React.FC<ListProps> = (props) => {
console.log(props)
const ref = useRef({})
const ref = useRef<any>({})
const [form] = Form.useForm();
const [table, setTable] = useState([])
const [editingKey, setEditingKey] = useState('');
const [orderid, setOrderid] = useState(null)
let [visible, setvisible] = useState<boolean>(false)
let [isSearch, setIsSearch] = useState<boolean>(false)
const [searchForm, setSearchForm] = useState({
searName: '',
buyer: '',//收货商
dateSelect: '',
outSideStatus: '',
TimeRange: ''
const [TimeRange, setTimeRange] = useState<number>(0)
const [searchForm, setSearchForm] = useState<paramsType>({
logisticsOrderNo: '',
shipperId: '',//收货商
status: '',
invoicesTimeStart: '',
invoicesTimeEnd: ''
})
const TimeList = [
{
label: '单据时间(全部)', value: ''
label: '单据时间(全部)', value: 0
},
{
label: '今天', value: 1
......@@ -222,7 +235,8 @@ const OrderList: React.FC<ListProps> = (props) => {
title: '单据时间',
align: 'center',
dataIndex: 'invoicesTime',
key: 'invoicesTime'
key: 'invoicesTime',
render: (text:any) => <>{moment(text).format('YYYY-MM-DD HH:mm:ss')}</>
},
{
title: '外部状态',
......@@ -271,14 +285,13 @@ const OrderList: React.FC<ListProps> = (props) => {
}
//生命周期
useEffect(() => {
ref.current.reload()
return () => {
}
}, [])
}, [TimeRange])
const handleDialog = (id: any) => {
setOrderid(id)
setvisible(true)
}
const onDefaultChange = (id: any, checked: boolean) => {
......@@ -316,6 +329,11 @@ const OrderList: React.FC<ListProps> = (props) => {
setSearchForm({ ...searchForm })
}
const handleModalOK = () => {
setvisible(false)
ref.current.reload()
}
const onCancel = () => {
setvisible(false)
......@@ -344,9 +362,9 @@ const OrderList: React.FC<ListProps> = (props) => {
title={props.type === '1' ? '输入物流单号、订单号进行搜索' : '输入物流单号、发货方进行搜索'}>
<Input.Search
style={{ width: '232px' }}
value={searchForm.searName}
value={searchForm.logisticsOrderNo}
placeholder='搜索'
onChange={(e) => setSearchForm({ ...searchForm, searName: e.target.value })}
onChange={(e) => setSearchForm({ ...searchForm, logisticsOrderNo: e.target.value })}
onSearch={() => handleSearch}
/>
</Tooltip>
......@@ -363,8 +381,16 @@ const OrderList: React.FC<ListProps> = (props) => {
<Space size={16}>
<Select
className={style.select}
value={searchForm.TimeRange}
onChange={(val) => setSearchForm({ ...searchForm, TimeRange: val })}
value={TimeRange}
onChange={(val) => {
setTimeRange(val),
setSearchForm({
...searchForm,
invoicesTimeStart: timeRange(val).st,
invoicesTimeEnd: timeRange(val).et
})
}
}
>
{
TimeList.map((item,index) => {
......@@ -374,8 +400,8 @@ const OrderList: React.FC<ListProps> = (props) => {
</Select>
<Select
className={style.select}
value={searchForm.outSideStatus}
onChange={(val) => setSearchForm({ ...searchForm, outSideStatus: val })}
value={searchForm.status}
onChange={(val) => setSearchForm({ ...searchForm, status: val })}
>
{
outSideStatusList.map((item,index) => {
......@@ -392,8 +418,10 @@ const OrderList: React.FC<ListProps> = (props) => {
}
/>
<ConfirmModal
id={orderid}
dialogVisible={visible}
onCancel={() => setvisible(false)}
onOK={() => handleModalOK()}
/>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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