Commit fa1aba15 authored by Gavin Peng's avatar Gavin Peng

fix: 修复送货计划输入框限制

parent ea457f00
......@@ -193,7 +193,7 @@ const DeliveryPlanCollaborationDetails: React.FC = () => {
let noticePath = {}
const time = new Date().getTime()
// 判断跳转
const url = deliveryPlanType === '1' ? '/memberCenter/order/deliveryNoticeManagement/awaitSRM/add' : '/memberCenter/order/deliveryNoticeManagement/awaitB2B/add'
const url = deliveryPlanType === '1' ? '/memberCenter/order/deliveryNoticeManagement/awaitB2B/add' : '/memberCenter/order/deliveryNoticeManagement/awaitSRM/add'
noticePath[time] = res.data
localStorage.setItem('NOTICE_PATH', JSON.stringify(noticePath))
setTimeout(() => {
......@@ -216,7 +216,6 @@ const DeliveryPlanCollaborationDetails: React.FC = () => {
planOrderIds: _ids.join(),
time: date
}).then((res: any) => {
console.log('res :>> ', res)
if (res.code === 1000) {
let noticePath = {}
const time = new Date().getTime()
......
......@@ -11,7 +11,7 @@ import { Button, DatePicker, Form, Input, InputNumber, message, Space, Spin, Ste
import { SaveOutlined } from '@ant-design/icons'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import _ from 'lodash'
import { convertArrToObj, getDayAll } from '../../utils'
import { convertArrToObj, disabledDate, getDayAll, limitDecimalsF, limitDecimalsP } from '../../utils'
import { BrandColumn, ClassColumn, CommodityNoColumn, ConsigneeNumColumn, DeliveredNumColumn, OrderCreatedAtColumn, OrderNoColumn, OrderSummaryColumn, OrderNumColumn, PlannedDeliveryNumColumn, TradeNameColumn, TransitNumColumn, UntilColumn } from '../../constants/table-column'
import { RoleSelect } from '@/components/RoleSelect'
import { getMemberManageSupplyMember } from '@/services/MemberV2Api'
......@@ -70,7 +70,7 @@ const DeliveryPlanAwaitB2BCreate: React.FC = () => {
const [expandIconColumn, setExpandIconColumn] = useState<any>(initExpandIconColumn)
const expandedRowRender = (record, index) => {
return <Table rowKey={'orderProductId'} columns={expandIconColumn} dataSource={record.orders} pagination={false} tableLayout="fixed"/>
return <Table rowKey={'orderProductId'} columns={expandIconColumn} dataSource={record.orders} pagination={false} tableLayout="fixed" />
}
// 选中 开始时间,结束时间
......@@ -147,7 +147,16 @@ const DeliveryPlanAwaitB2BCreate: React.FC = () => {
key: item,
width: 80,
align: 'center',
render: (text: any, record: any) => (<InputNumber style={{ width: '100%' }} bordered value={text?.planCount} onChange={(val) => inputChange(val, text, record)} />)
render: (text: any, record: any) => (
<InputNumber
style={{ width: '100%' }}
bordered
parser={limitDecimalsP}
formatter={limitDecimalsF}
value={text?.planCount}
onChange={(val) => inputChange(val, text, record)}
/>
)
}))
setGoodsTableColumn([...initGoodsTableColumn, ...datesColumn])
setExpandIconColumn([...initExpandIconColumn, ...datesExpandIconColumn])
......@@ -235,7 +244,7 @@ const DeliveryPlanAwaitB2BCreate: React.FC = () => {
label={PlanningCycle}
name='dates'
>
<DatePicker.RangePicker style={{ width: '100%' }} onChange={(dates) => handleDateAssembleColumn(dates)} />
<DatePicker.RangePicker disabledDate={disabledDate} style={{ width: '100%' }} onChange={(dates) => handleDateAssembleColumn(dates)} />
</Form.Item>
<Form.Item
......
......@@ -11,7 +11,7 @@ import { Button, Form, Input, InputNumber, message, Space, Spin, Steps, Table, T
import { SaveOutlined } from '@ant-design/icons'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import _ from 'lodash'
import { getDayAll, godAtob, integrationArrToObj, integrationOjb, TagStatus } from '../../utils'
import { getDayAll, godAtob, integrationArrToObj, integrationOjb, limitDecimalsF, limitDecimalsP, TagStatus } from '../../utils'
import { BrandColumn, ClassColumn, CommodityNoColumn, ConsigneeNumColumn, DeliveredNumColumn, OrderCreatedAtColumn, OrderNoColumn, OrderSummaryColumn, OrderNumColumn, PlannedDeliveryNumColumn, TradeNameColumn, TransitNumColumn, UntilColumn } from '../../constants/table-column'
import { getOrderDeliveryPlanDeliveryHistory, getOrderDeliveryPlanDetail, getOrderDeliveryPlanDetailProductPage, postOrderDeliveryPlanUpdate } from '@/services/OrderNewV2Api'
import moment from 'moment'
......@@ -130,7 +130,17 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
key: item,
width: 80,
align: 'center',
render: (text: any, record: any) => (<InputNumber style={{ width: '100%' }} bordered value={text?.planCount} onChange={(val) => inputChange(val, text, record)} />)
render: (text: any, record: any) => (
<InputNumber
style={{ width: '100%' }}
// disabled={}
bordered
parser={limitDecimalsP}
formatter={limitDecimalsF}
value={text?.planCount}
onChange={(val) => inputChange(val, text, record)}
/>
)
}))
setGoodsTableColumn([...goodsTableColumn, ...datesColumn])
setExpandIconColumn([...expandIconColumn, ...datesExpandIconColumn])
......
......@@ -3,31 +3,31 @@
* @author: Gavin
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import React, { useEffect, useRef, useState } from 'react'
import { history } from 'umi'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { BaseInfo as base_Info, Remarks, PlanningCycle, SupplyMembersLabel, PlanSummary, ExternalState, Circulation, Purchaser, SubmitDeliveryPlan, Supplier, ConfirmDeliveryPlan, PlannedDelivery, DeliveryPlanText, DeliveryPlanRemark, CreateDeliveryPlanTitleSRM } from '../../constants'
import { Button, DatePicker, Form, Input, InputNumber, message, Space, Spin, Steps, Table } from 'antd'
import { SaveOutlined } from '@ant-design/icons'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import _ from 'lodash'
import { convertArrToObj, getDayAll } from '../../utils'
import { BrandColumn, ClassColumn, ConsigneeNumColumn, DeliveredNumColumn, MaterialModelColumn, MaterialNameColumn, MaterialNoColumn, OrderCreatedAtColumn, OrderNoColumn, OrderSummaryColumn, OrderNumColumn, PlannedDeliveryNumColumn, TransitNumColumn, UntilColumn } from '../../constants/table-column'
import { RoleSelect } from '@/components/RoleSelect'
import { getOrderDeliveryPlanOrderProductPage, postOrderDeliveryPlanSrmCreate } from '@/services/OrderNewV2Api'
import { getMemberManageLowerMerchantProviderPage } from '@/services/MemberV2Api'
import React, { useEffect, useRef, useState } from 'react'
import { history } from 'umi'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { BaseInfo as base_Info, Remarks, PlanningCycle, SupplyMembersLabel, PlanSummary, ExternalState, Circulation, Purchaser, SubmitDeliveryPlan, Supplier, ConfirmDeliveryPlan, PlannedDelivery, DeliveryPlanText, DeliveryPlanRemark, CreateDeliveryPlanTitleSRM } from '../../constants'
import { Button, DatePicker, Form, Input, InputNumber, message, Space, Spin, Steps, Table } from 'antd'
import { SaveOutlined } from '@ant-design/icons'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import _ from 'lodash'
import { convertArrToObj, disabledDate, getDayAll, limitDecimalsF, limitDecimalsP } from '../../utils'
import { BrandColumn, ClassColumn, ConsigneeNumColumn, DeliveredNumColumn, MaterialModelColumn, MaterialNameColumn, MaterialNoColumn, OrderCreatedAtColumn, OrderNoColumn, OrderSummaryColumn, OrderNumColumn, PlannedDeliveryNumColumn, TransitNumColumn, UntilColumn } from '../../constants/table-column'
import { RoleSelect } from '@/components/RoleSelect'
import { getOrderDeliveryPlanOrderProductPage, postOrderDeliveryPlanSrmCreate } from '@/services/OrderNewV2Api'
import { getMemberManageLowerMerchantProviderPage } from '@/services/MemberV2Api'
const formItemLayout = {
const formItemLayout = {
labelCol: { span: 3 },
wrapperCol: { span: 18 }
}
}
// 1:查询供应商角色,2:查询采购商角色
const ROLE_TYPE = '1'
// 1:b2b,2:srm
const ORDER_TYPE = '2'
// 1:查询供应商角色,2:查询采购商角色
const ROLE_TYPE = '1'
// 1:b2b,2:srm
const ORDER_TYPE = '2'
const initMaterialTableColumn = [
const initMaterialTableColumn = [
{ ...MaterialNoColumn, dataIndex: 'skuId', width: 80, },
{ ...MaterialNameColumn, dataIndex: 'productName', width: 192, },
{ ...MaterialModelColumn, dataIndex: 'productName', width: 128, },
......@@ -50,7 +50,7 @@ const initExpandIconColumn = [
{ ...DeliveredNumColumn, dataIndex: 'leftCount', width: 86, },
{ ...PlannedDeliveryNumColumn, dataIndex: 'planCount', width: 96, },
]
const DeliveryPlanAwaitSRMCreate: React.FC = () => {
const DeliveryPlanAwaitSRMCreate: React.FC = () => {
const [form] = Form.useForm()
const datesRef = useRef<any>(null)
const materialTableDataRef = useRef(null)
......@@ -149,7 +149,16 @@ const initExpandIconColumn = [
key: item,
width: 80,
align: 'center',
render: (text: any, record: any) => (<InputNumber style={{ width: '100%' }} bordered value={text?.planCount} onChange={(val) => inputChange(val, text, record)} />)
render: (text: any, record: any) => (
<InputNumber
style={{ width: '100%' }}
bordered
parser={limitDecimalsP}
formatter={limitDecimalsF}
value={text?.planCount}
onChange={(val) => inputChange(val, text, record)}
/>
)
}))
setMaterialTableColumn([...initMaterialTableColumn, ...datesColumn])
setExpandIconColumn([...initExpandIconColumn, ...datesExpandIconColumn])
......@@ -240,7 +249,7 @@ const initExpandIconColumn = [
{ required: true, message: '请选择' }
]}
>
<DatePicker.RangePicker style={{ width: '100%' }} onChange={(dates) => handleDateAssembleColumn(dates)} />
<DatePicker.RangePicker disabledDate={disabledDate} style={{ width: '100%' }} onChange={(dates) => handleDateAssembleColumn(dates)} />
</Form.Item>
<Form.Item
......@@ -294,6 +303,6 @@ const initExpandIconColumn = [
</AnchorPage>
</Spin>
)
}
}
export default DeliveryPlanAwaitSRMCreate
\ No newline at end of file
export default DeliveryPlanAwaitSRMCreate
\ No newline at end of file
......@@ -12,7 +12,7 @@ import { SaveOutlined } from '@ant-design/icons'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import { ExternalRoamRecordTableColumn } from '../../constants/page-table-column'
import _ from 'lodash'
import { getDayAll, godAtob, integrationArrToObj, integrationOjb, TagStatus } from '../../utils'
import { getDayAll, godAtob, integrationArrToObj, integrationOjb, limitDecimalsF, limitDecimalsP, TagStatus } from '../../utils'
import { BrandColumn, ClassColumn, ConsigneeNumColumn, DeliveredNumColumn, MaterialModelColumn, MaterialNameColumn, MaterialNoColumn, OrderCreatedAtColumn, OrderNoColumn, OrderSummaryColumn, OrderNumColumn, PlannedDeliveryNumColumn, TransitNumColumn, UntilColumn } from '../../constants/table-column'
import { getOrderDeliveryPlanDeliveryHistory, getOrderDeliveryPlanDetail, getOrderDeliveryPlanDetailProductPage, postOrderDeliveryPlanUpdate } from '@/services/OrderNewV2Api'
import moment from 'moment'
......@@ -130,7 +130,16 @@ const DeliveryPlanAwaitSRMUpdate: React.FC = () => {
key: item,
width: 80,
align: 'center',
render: (text: any, record: any) => (<InputNumber style={{ width: '100%' }} bordered value={text?.planCount} onChange={(val) => inputChange(val, text, record)} />)
render: (text: any, record: any) => (
<InputNumber
style={{ width: '100%' }}
bordered
parser={limitDecimalsP}
formatter={limitDecimalsF}
value={text?.planCount}
onChange={(val) => inputChange(val, text, record)}
/>
)
}))
setMaterialTableColumn([...materialTableColumn, ...datesColumn])
setExpandIconColumn([...expandIconColumn, ...datesExpandIconColumn])
......
......@@ -12,7 +12,7 @@ import { Button, Form, Input, InputNumber, message, Space, Spin, Steps, Table, T
import { SaveOutlined } from '@ant-design/icons'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import { ExternalRoamRecordTableColumn } from '../../constants/page-table-column'
import { getDayAll, godAtob, integrationArrToObj, integrationOjb, TagStatus } from '../../utils'
import { getDayAll, godAtob, integrationArrToObj, integrationOjb, limitDecimalsF, limitDecimalsP, TagStatus } from '../../utils'
import { BrandColumn, ClassColumn, ConsigneeNumColumn, DeliveredNumColumn, MaterialModelColumn, MaterialNameColumn, MaterialNoColumn, OrderCreatedAtColumn, OrderNoColumn, OrderSummaryColumn, OrderNumColumn, PlannedDeliveryNumColumn, TransitNumColumn, UntilColumn, CommodityNoColumn, TradeNameColumn } from '../../constants/table-column'
import { getOrderDeliveryPlanDeliveryHistory, getOrderDeliveryPlanDetail, getOrderDeliveryPlanDetailProductPage, postOrderDeliveryPlanUpdate } from '@/services/OrderNewV2Api'
......@@ -144,7 +144,16 @@ const DeliveryPlanManagementUpdate: React.FC = () => {
key: item,
width: 80,
align: 'center',
render: (text: any, record: any) => (<InputNumber style={{ width: '100%' }} bordered value={text?.planCount} onChange={(val) => inputChange(val, text, record)} />)
render: (text: any, record: any) => (
<InputNumber
style={{ width: '100%' }}
bordered
parser={limitDecimalsP}
formatter={limitDecimalsF}
value={text?.planCount}
onChange={(val) => inputChange(val, text, record)}
/>
)
}))
const table_column = deliveryPlanType === '1' ? columnB2B : deliveryPlanType === '2' ? columnSRM : []
setTableColumn([...table_column, ...datesColumn])
......
// 公共组装类工具
import moment from "moment"
/**
* 数组转对象 默认赋值 0
* - 原数组: ['$04-01','$04-02']
......@@ -29,7 +31,7 @@ const integrationOjb = (obj) => {
...prev,
[`$${currVal}`]: obj[currVal]
}
},{})
}, {})
}
/**
......@@ -76,12 +78,53 @@ const godAtob = (str: string) => {
*/
const newMapValues = (newMapArr: Map<any, any>, isFlat?: boolean, depth?: number) => {
let values = []
for (const [key,value] of newMapArr) {
for (const [key, value] of newMapArr) {
values.push(value)
}
return isFlat ? values.flat(depth ?? 1) : values
}
/**
* InputNumber 属性 parser
* @param value
* @returns
*/
const limitDecimalsP = (value: any) => {
let reg = /^(\d+)\.(\d{4}).*$/
return value.replace(/\s?|(,*)/g, '').replace(reg, '$1$2.$3')
}
/**
* InputNumber 属性 formatter
* @param value
* @returns
*/
const limitDecimalsF = (value: moment.Moment) => {
let reg = /^(\d+)\.(\d{4}).*$/
return `${value}`.replace(reg, '$1$2.$3$4')
// return `${value}`.replace(/\B(?=(\d{6})+(?!\d))/g, ',').replace(reg, '$1$2.$3') // 三位一个逗号 有bug
}
/**
* 不能选择今天之前的日期和今天
* @param current
* @returns
*/
const disabledDate = (current: moment.Moment) => {
return current && current < moment().endOf('day')
}
const NEWDATE = new Date()
const YEAR = NEWDATE.getFullYear()
const TODAY = NEWDATE.getTime()
/**
* 判断是否在今天之后
* @param day
*/
const afterToday = (day: string) => {
}
export {
convertArrToObj,
integrationOjb,
......@@ -89,4 +132,7 @@ export {
godBtoa,
godAtob,
newMapValues,
limitDecimalsP,
limitDecimalsF,
disabledDate,
}
\ No newline at end of file
......@@ -32,40 +32,8 @@ const getDayAll = (starDay: string, endDay: string) => {
// dates.pop()
return dates
}
// deliveryPlanManagement - deliveryPlanAwaitB2B - details copy.ts 测试使用,上线前需要删除
const getDayAll2 = (starDay: string, endDay: string) => {
let arr = []
let dates = []
// 设置两个日期UTC时间
let db = new Date(starDay)
let de = new Date(endDay)
// 获取两个日期GTM时间
let s = db.getTime() - 24 * 60 * 60 * 1000
let d = de.getTime() - 24 * 60 * 60 * 1000
// 获取到两个日期之间的每一天的毫秒数
for (let i = s; i <= d; ) {
i = i + 24 * 60 * 60 * 1000
arr.push(parseInt(String(i)))
}
// 获取每一天的时间 YY-MM-DD
for (let j in arr) {
let time = new Date(arr[j])
let year = time.getFullYear()
let mouth = time.getMonth() + 1 >= 10 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1)
let day = time.getDate() >= 10 ? time.getDate() : '0' + time.getDate()
// year + '-' +
let YYMMDD = year + '-' + mouth + '-' + day
dates.push(YYMMDD)
}
dates.pop()
return dates
}
export {
getDayAll,
getDayAll2,
}
\ No newline at end of file
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