Commit ef4eb1e3 authored by 前端-彭佳文's avatar 前端-彭佳文

Merge branch 'v2-220418-order' into 'v2-220418'

fix: 完善送货计划管理 See merge request linkseeks-design/pro-platform!186
parents b1ac4d80 aca9b2a7
import { Button, Col, Drawer, Form, Input, Pagination, Radio, Row, Table } from "antd";
import { useCallback, useEffect, useState } from "react";
import { TableMemberColumn } from "./columns";
import { Button, Col, Drawer, Form, Input, Pagination, Radio, Row, Table } from "antd"
import { useCallback, useEffect, useState } from "react"
import { TableMemberColumn } from "./columns"
import { LinkOutlined } from "@ant-design/icons"
import styled from 'styled-components'
import {
///member/manage/lower/consumer/member/page
getMemberManageLowerProviderMerchantPage,
getMemberManageUpperProviderMerchantPage,
getMemberManageLowerConsumerMemberPage,
getMemberManageUpperConsumerMerchantPage
} from '@/services/MemberV2Api';
} from '@/services/MemberV2Api'
const RowStyleLayout = styled(props => <div {...props} />)`
.ant-input-group-compact {
display: flex;
}
.ant-input {
height: 32px;
}
.ant-btn {
height: 32px;
}
`
interface RoleSelectProps {
request?: (payload: any) => Promise<any>
params?: object
......@@ -61,14 +70,20 @@ function RoleSelect(props: RoleSelectProps) {
return (
<>
<Row gutter={4}>
{/* <Row gutter={4}>
<Col span={18}>
<Input value={value?.name} disabled={disabled} />
</Col>
<Col span={6}>
<Button disabled={disabled} onClick={showDrawer}>选择采购会员</Button>
</Col>
</Row>
</Row> */}
<RowStyleLayout>
<Input.Group compact>
<Input value={value?.name} disabled />
<Button type='primary' icon={<LinkOutlined />} disabled={disabled} onClick={showDrawer}>选择</Button>
</Input.Group>
</RowStyleLayout>
<Drawer
visible={visible}
......
......@@ -3,31 +3,31 @@
* @author: Gavin
* @description: 与SRM内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import React, { useEffect, useRef, useState } from 'react'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { history } from 'umi'
import { Circulation, ConfirmDeliveryPlan, Purchaser, SubmitDeliveryPlan, BaseInfo as base_Info, Supplier, PlanningCycle, SupplyMembersLabel, PlanSummary, Remarks, PlannedDelivery, DeliveryPlanText, DeliveryPlanRemark, CreateDeliveryPlanTitleB2B } from '../../constants'
import { Button, DatePicker, Form, Input, InputNumber, message, Space, 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, 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'
import { getOrderDeliveryPlanOrderProductPage, postOrderDeliveryPlanB2bCreate } from '@/services/OrderNewV2Api'
import React, { useEffect, useRef, useState } from 'react'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { history } from 'umi'
import { Circulation, ConfirmDeliveryPlan, Purchaser, SubmitDeliveryPlan, BaseInfo as base_Info, Supplier, PlanningCycle, SupplyMembersLabel, PlanSummary, Remarks, PlannedDelivery, DeliveryPlanText, DeliveryPlanRemark, CreateDeliveryPlanTitleB2B } 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, 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'
import { getOrderDeliveryPlanOrderProductPage, postOrderDeliveryPlanB2bCreate } from '@/services/OrderNewV2Api'
const formItemLayout = {
const formItemLayout = {
labelCol: { span: 3 },
wrapperCol: { span: 18 }
}
}
// 1:查询供应商角色,2:查询采购商角色
const ROLE_TYPE = '1'
// 1:b2b,2:srm
const ORDER_TYPE = '1'
// 1:查询供应商角色,2:查询采购商角色
const ROLE_TYPE = '1'
// 1:b2b,2:srm
const ORDER_TYPE = '1'
const initGoodsTableColumn = [
const initGoodsTableColumn = [
{ ...CommodityNoColumn, dataIndex: 'skuId', width: 80, },
{ ...TradeNameColumn, dataIndex: 'productName', width: 192, },
{ ...ClassColumn, dataIndex: 'category', width: 96, },
......@@ -49,11 +49,13 @@ const initExpandIconColumn = [
{ ...DeliveredNumColumn, dataIndex: 'leftCount', width: 86, },
{ ...PlannedDeliveryNumColumn, dataIndex: 'planCount', width: 96, },
]
const DeliveryPlanAwaitB2BCreate: React.FC = () => {
const DeliveryPlanAwaitB2BCreate: React.FC = () => {
const [form] = Form.useForm()
const datesRef = useRef<any>(null)
const goodsTableDataRef = useRef(null)
const [spinning, setSpinning] = useState<boolean>(false)
// 锚点标题
const [iAnchors, setIAnchors] = useState<AnchorsItem[]>([
Circulation,
......@@ -86,6 +88,7 @@ const initExpandIconColumn = [
message.warning('没有找到可执行计划送货')
return
}
setSpinning(true)
const productList = goodsTableDataRef.current.map((item: any) => {
return {
...item,
......@@ -108,7 +111,12 @@ const initExpandIconColumn = [
remark: values.remark,
productList
}).then((res: any) => {
console.log('保存 :>> ', res)
setSpinning(false)
if (res.code === 1000) {
history.goBack()
}
}).catch(err => {
setSpinning(false)
})
})
}
......@@ -141,8 +149,8 @@ const initExpandIconColumn = [
align: 'center',
render: (text: any, record: any) => (<InputNumber style={{ width: '100%' }} bordered value={text?.planCount} onChange={(val) => inputChange(val, text, record)} />)
}))
setGoodsTableColumn([...goodsTableColumn, ...datesColumn])
setExpandIconColumn([...expandIconColumn, ...datesExpandIconColumn])
setGoodsTableColumn([...initGoodsTableColumn, ...datesColumn])
setExpandIconColumn([...initExpandIconColumn, ...datesExpandIconColumn])
} else {
// 清空
datesRef.current = null
......@@ -175,8 +183,8 @@ const initExpandIconColumn = [
const assemble = res.data.data.map((item => {
return {
...item,
...convertArrtoObj(datesRef.current),
orders: item.orders.map(o => ({ ...o, ...convertArrtoObj(datesRef.current), }))
...convertArrToObj(datesRef.current),
orders: item.orders.map(o => ({ ...o, ...convertArrToObj(datesRef.current), }))
}
}))
goodsTableDataRef.current = assemble
......@@ -199,6 +207,7 @@ const initExpandIconColumn = [
}, [selectedDate, selectedMember])
return (<>
<Spin spinning={spinning}>
<AnchorPage
title={CreateDeliveryPlanTitleB2B}
onBack={() => history.goBack()}
......@@ -244,6 +253,9 @@ const initExpandIconColumn = [
{...formItemLayout}
label={PlanSummary}
name='planSummaryText'
rules={[
{ required: true, message: '请选择' }
]}
>
<Input />
</Form.Item>
......@@ -262,13 +274,17 @@ const initExpandIconColumn = [
<BaseInfo className='mt-16' title={Remarks.name} id={Remarks.key} cols={1}>
<Form.Item
name='remark'
rules={[
{ required: true, message: '请输入' }
]}
>
<Input.TextArea rows={4} maxLength={300} placeholder={DeliveryPlanRemark} />
</Form.Item>
</BaseInfo>
</Form>
</AnchorPage>
</Spin>
</>)
}
}
export default DeliveryPlanAwaitB2BCreate
\ No newline at end of file
export default DeliveryPlanAwaitB2BCreate
\ No newline at end of file
......@@ -6,8 +6,8 @@
import React, { useRef } from 'react'
import { history } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Button, Card, Space, Tag } from 'antd'
import { PlusOutlined } from '@ant-design/icons'
import { Button, Card, Modal, Space, Tag } from 'antd'
import { ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons'
import StandardTable from '@/components/StandardTable'
import { ColumnType } from 'antd/lib/table'
import TableOperation from '@/components/TableOperation'
......@@ -20,7 +20,7 @@ import { deliveryPlanManagementAwaitB2BSchema } from './schema'
import { godBtoa, TagStatus } from '../../utils'
import { ExternalStateColumn, OperationColumn, PlannedEndDateColumn, PlannedStartDateColumn, PlanNumberColumn, PlanSummaryColumn, SupplyMemberColumn } from '../../constants/table-column'
import moment from 'moment'
import { getOrderDeliveryPlanBuyerPage } from '@/services/OrderNewV2Api'
import { getOrderDeliveryPlanBuyerPage, postOrderDeliveryPlanDelete, postOrderDeliveryPlanSubmit } from '@/services/OrderNewV2Api'
// 外部状态1-待提交 2-已确认
const STATUS = 2
......@@ -32,6 +32,36 @@ const DeliveryPlanManagementAwaitB2B: React.FC = () => {
const ref = useRef<any>({})
const formActions = createFormActions()
const handleDelete = (id: number) => {
Modal.confirm({
icon: <ExclamationCircleOutlined />,
content: <span>确认删除?</span>,
okText: '确认',
cancelText: '取消',
onOk() {
postOrderDeliveryPlanDelete({ id }).then((res: any) => {
if (res.code === 1000) ref.current.reload()
})
},
onCancel() { },
})
}
const handleSubmit = (id: number) => {
Modal.confirm({
icon: <ExclamationCircleOutlined />,
content: <span>确认提交?</span>,
okText: '确认',
cancelText: '取消',
onOk() {
postOrderDeliveryPlanSubmit({ id }).then((res: any) => {
if (res.code === 1000) ref.current.reload()
})
},
onCancel() { },
})
}
const controllerBtns = (
<Space>
<Button type='primary' icon={<PlusOutlined />} onClick={() => history.push(`/memberCenter/order/deliveryPlanManagement/awaitB2B/create`)}>新增</Button>
......@@ -51,9 +81,9 @@ const DeliveryPlanManagementAwaitB2B: React.FC = () => {
'查看': true,
}
const operationHandler = {
'提交': () => { console.log('提交 :>> ',) },
'提交': () => handleSubmit(record.id),
'修改': () => history.push(`/memberCenter/order/deliveryPlanManagement/awaitB2B/update?i=${godBtoa(record.id)}`),
'删除': () => { console.log('删除 :>> ',) },
'删除': () => handleDelete(record.id),
'查看': () => history.push(`/memberCenter/order/deliveryPlanManagement/awaitB2B/details?i=${godBtoa(record.id)}`),
}
return (
......@@ -70,7 +100,7 @@ const DeliveryPlanManagementAwaitB2B: React.FC = () => {
dataIndex: 'planNo',
key: 'planNo',
// width: 160,
render: (text: unknown, record: unknown) => <EyePreview url='/memberCenter/order/deliveryPlanManagement/awaitB2B/details'>{text}</EyePreview>
render: (text: unknown, record: any) => <EyePreview url={`/memberCenter/order/deliveryPlanManagement/awaitB2B/details?i=${godBtoa(record.id)}`}>{text}</EyePreview>
},
{ ...PlanSummaryColumn, dataIndex: 'digest', key: 'digest' },
{ ...PlannedStartDateColumn, dataIndex: 'planStartTime', key: 'planStartTime', render: (text: string, record: any) => (moment(text).format('YYYY-MM-DD')) },
......
......@@ -6,16 +6,14 @@
import React, { useEffect, useRef, useState } from 'react'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { history, useHistory } from 'umi'
import { Circulation, ConfirmDeliveryPlan, Purchaser, SubmitDeliveryPlan, BaseInfo as base_Info, Supplier, PlanningCycle, SupplyMembersLabel, PlanSummary, Remarks, PlannedDelivery, DeliveryPlanText, DeliveryPlanRemark, CreateDeliveryPlanTitleB2B, ExternalRoamRecord } from '../../constants'
import { Button, DatePicker, Form, Input, InputNumber, message, Space, Steps, Table } from 'antd'
import { Circulation, ConfirmDeliveryPlan, Purchaser, SubmitDeliveryPlan, BaseInfo as base_Info, Supplier, PlanningCycle, SupplyMembersLabel, PlanSummary, Remarks, PlannedDelivery, DeliveryPlanText, DeliveryPlanRemark, CreateDeliveryPlanTitleB2B, ExternalRoamRecord, ExternalState } from '../../constants'
import { Button, Form, Input, InputNumber, message, Space, Spin, Steps, Table, Tag } from 'antd'
import { SaveOutlined } from '@ant-design/icons'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import _ from 'lodash'
import { convertArrtoObj, getDayAll, godAtob, integrationArrtoObj, integrationOjb } from '../../utils'
import { getDayAll, godAtob, integrationArrToObj, integrationOjb, TagStatus } 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'
import { getOrderDeliveryPlanDeliveryHistory, getOrderDeliveryPlanDetail, getOrderDeliveryPlanDetailProductPage, getOrderDeliveryPlanOrderProductPage, postOrderDeliveryPlanB2bCreate, postOrderDeliveryPlanUpdate } from '@/services/OrderNewV2Api'
import { getOrderDeliveryPlanDeliveryHistory, getOrderDeliveryPlanDetail, getOrderDeliveryPlanDetailProductPage, postOrderDeliveryPlanUpdate } from '@/services/OrderNewV2Api'
import moment from 'moment'
import { ExternalRoamRecordTableColumn } from '../../constants/page-table-column'
......@@ -24,11 +22,8 @@ const formItemLayout = {
wrapperCol: { span: 16 }
}
// 1:查询供应商角色,2:查询采购商角色
const ROLE_TYPE = '1'
// 1:b2b,2:srm
const OEDER_TYPE = '1'
const tagStatus = new TagStatus()
const statusTxt = new Map([[1, '待提交'], [2, '待确认'], [3, '待修订'], [4, '已确认'], [5, '已删除']])
const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
const { location: { query: { i } } } = useHistory()
const id = godAtob(i)
......@@ -37,12 +32,15 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
const datesRef = useRef<any>(null)
const goodsTableDataRef = useRef(null)
const [spinning, setSpinning] = useState<boolean>(false)
// 锚点标题
const [iAnchors, setiAnchors] = useState<AnchorsItem[]>([
const [iAnchors, setIAnchors] = useState<AnchorsItem[]>([
Circulation,
base_Info,
PlannedDelivery,
Remarks,
ExternalRoamRecord,
])
// 动态 TableColumn
......@@ -84,11 +82,12 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
// 保存
const save = () => {
form.validateFields().then(values => {
// console.log('values :>> ', values)
console.log('values :>> ', values)
if (_.isEmpty(goodsTableDataRef.current)) {
message.warning('没有找到可执行计划送货')
return
}
setSpinning(true)
const orders = goodsTableDataRef.current.flatMap((item: any) => item.orders).flatMap((o: any) => ({
...o,
planDays: Object.keys(o).filter((f: any) => f.startsWith('$')).map((p: any) => o[p])
......@@ -99,7 +98,12 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
remark: values.remark,
orders
}).then((res: any) => {
console.log('保存 :>> ', res)
setSpinning(false)
if (res.code === 1000) {
history.goBack()
}
}).catch(err => {
setSpinning(false)
})
})
}
......@@ -144,7 +148,7 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
return {
...item,
...integrationOjb(item.dayNumbers),
orders: item.orders.map(o => ({ ...o, ...integrationArrtoObj(o.planDays) }))
orders: item.orders.map(o => ({ ...o, ...integrationArrToObj(o.planDays) }))
}
})
goodsTableDataRef.current = assemble
......@@ -162,7 +166,6 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
setDetails(res.data)
form.setFieldsValue({
planSummaryText: res.data.digest,
remark: '',
})
getPlannedDelivery()
handleDateAssembleColumn(res.data.planStartTime, res.data.planEndTime)
......@@ -186,8 +189,9 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
}, [])
return (<>
<Spin spinning={spinning}>
<AnchorPage
title={CreateDeliveryPlanTitleB2B}
title={details?.planNo}
onBack={() => history.goBack()}
anchors={iAnchors}
extra={
......@@ -222,6 +226,12 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
>
<Input />
</Form.Item>
<BaseInfo.BaseInfoItem label={ExternalState}>
<Tag color={tagStatus.getTagStyle(details?.status).bgColor}>
<span style={{ color: tagStatus.getTagStyle(details?.status).fontColor }}>{statusTxt.get(details?.status)}</span>
</Tag>
</BaseInfo.BaseInfoItem>
</BaseInfo>
<BaseInfo className='mt-16' title={PlannedDelivery.name} id={PlannedDelivery.key} cols={1}>
<Table
......@@ -237,6 +247,9 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
<BaseInfo className='mt-16' title={Remarks.name} id={Remarks.key} cols={1}>
<Form.Item
name='remark'
rules={[
{ required: true, message: '请输入' }
]}
>
<Input.TextArea rows={4} maxLength={300} placeholder={DeliveryPlanRemark} />
</Form.Item>
......@@ -251,6 +264,7 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
</BaseInfo>
</Form>
</AnchorPage>
</Spin>
</>)
}
......
......@@ -11,7 +11,7 @@
import { SaveOutlined } from '@ant-design/icons'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import _ from 'lodash'
import { convertArrtoObj, getDayAll } from '../../utils'
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'
......@@ -151,8 +151,8 @@ const initExpandIconColumn = [
align: 'center',
render: (text: any, record: any) => (<InputNumber style={{ width: '100%' }} bordered value={text?.planCount} onChange={(val) => inputChange(val, text, record)} />)
}))
setMaterialTableColumn([...materialTableColumn, ...datesColumn])
setExpandIconColumn([...expandIconColumn, ...datesExpandIconColumn])
setMaterialTableColumn([...initMaterialTableColumn, ...datesColumn])
setExpandIconColumn([...initExpandIconColumn, ...datesExpandIconColumn])
} else {
// 清空
datesRef.current = null
......@@ -185,8 +185,8 @@ const initExpandIconColumn = [
const assemble = res.data.data.map((item => {
return {
...item,
...convertArrtoObj(datesRef.current),
orders: item.orders.map(o => ({ ...o, ...convertArrtoObj(datesRef.current), }))
...convertArrToObj(datesRef.current),
orders: item.orders.map(o => ({ ...o, ...convertArrToObj(datesRef.current), }))
}
}))
materialTableDataRef.current = assemble
......
......@@ -6,12 +6,12 @@
import React, { useEffect, useRef, useState } from 'react'
import { history, useHistory } from 'umi'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { BaseInfo as base_Info, PlanningCycle, SupplyMembersLabel, PlanSummary, ExternalRoamRecord, Circulation, Purchaser, SubmitDeliveryPlan, Supplier, ConfirmDeliveryPlan, PlannedDelivery, ExternalState } from '../../constants'
import { BaseInfo as base_Info, PlanningCycle, SupplyMembersLabel, PlanSummary, ExternalRoamRecord, Circulation, Purchaser, SubmitDeliveryPlan, Supplier, ConfirmDeliveryPlan, PlannedDelivery, ExternalState, PlanNumber } from '../../constants'
import { Steps, Table, Tag } from 'antd'
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, 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, getOrderDeliveryPlanOrderProductPage } from '@/services/OrderNewV2Api'
import moment from 'moment'
......@@ -22,10 +22,7 @@ const DeliveryPlanAwaitSRMDetails: React.FC = () => {
const { location: { query: { i } } } = useHistory()
const id = godAtob(i)
const datesRef = useRef(null)
const materialTableDataRef = useRef(null)
const [iAnchors, setiAnchors] = useState<AnchorsItem[]>([
const [iAnchors, setIAnchors] = useState<AnchorsItem[]>([
Circulation,
base_Info,
PlannedDelivery,
......@@ -70,10 +67,9 @@ const DeliveryPlanAwaitSRMDetails: React.FC = () => {
// 外部流转单据记录
const [externalRoamRecordData, setExternalRoamRecordData] = useState<any>(null)
// 计划周期 选择日期
// 计划周期 渲染日期
const handleDateAssembleColumn = (startDate: string, endDate: string) => {
const dates = getDayAll(moment(startDate).format('YYYY-MM-DD'), moment(endDate).format('YYYY-MM-DD'))
datesRef.current = dates
const datesColumn = dates.map((item, i) => ({ title: item.substr(1), dataIndex: item, key: item, width: 120, align: 'center', }))
const datesExpandIconColumn = dates.map((item, i) => ({
title: item.substr(1),
......@@ -99,10 +95,9 @@ const DeliveryPlanAwaitSRMDetails: React.FC = () => {
return {
...item,
...integrationOjb(item.dayNumbers),
orders: item.orders.map(o => ({ ...o, ...integrationArrtoObj(o.planDays) }))
orders: item.orders.map(o => ({ ...o, ...integrationArrToObj(o.planDays) }))
}
})
materialTableDataRef.current = assemble
setMaterialTableData(assemble)
}
})
......@@ -148,10 +143,12 @@ const DeliveryPlanAwaitSRMDetails: React.FC = () => {
</Steps>
</BaseInfo>
<BaseInfo className='mt-16' title={base_Info.name} id={base_Info.key}>
<BaseInfo.BaseInfoItem label={PlanningCycle}> {moment(details?.planStartTime).format('YYYY-MM-DD')} ~ {moment(details?.planEndTime).format('YYYY-MM-DD')} </BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={PlanNumber}> {details?.planNo} </BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={SupplyMembersLabel}> {details?.vendorMemberName} </BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={PlanningCycle}> {moment(details?.planStartTime).format('YYYY-MM-DD')} ~ {moment(details?.planEndTime).format('YYYY-MM-DD')} </BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={PlanSummary}> {details?.digest} </BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={ExternalState}>
......
......@@ -6,8 +6,8 @@
import React, { useRef } from 'react'
import { history } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Button, Card, Space, Tag } from 'antd'
import { PlusOutlined } from '@ant-design/icons'
import { Button, Card, Modal, Space, Tag } from 'antd'
import { ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons'
import StandardTable from '@/components/StandardTable'
import { ColumnType } from 'antd/lib/table'
import TableOperation from '@/components/TableOperation'
......@@ -19,22 +19,52 @@ import { FORM_FILTER_PATH } from '@/formSchema/const'
import { deliveryPlanManagementAwaitSRMSchema } from './schema'
import { godBtoa, TagStatus } from '../../utils'
import { ExternalStateColumn, OperationColumn, PlannedEndDateColumn, PlannedStartDateColumn, PlanNumberColumn, PlanSummaryColumn, SupplyMemberColumn } from '../../constants/table-column'
import { getOrderDeliveryPlanBuyerPage } from '@/services/OrderNewV2Api'
import { getOrderDeliveryPlanBuyerPage, postOrderDeliveryPlanDelete, postOrderDeliveryPlanSubmit } from '@/services/OrderNewV2Api'
import moment from 'moment'
// 外部状态1-待提交 2-已确认
const STATUS = 2
// 订单类型1-B2B 2-SRM
const OEDER_TYPE = 2
const ORDER_TYPE = 2
const tagStatus = new TagStatus()
const statusTxt = new Map([[1, '待提交'], [2, '待确认'], [3, '待修订'],[4,'已确认'],[5,'已删除']])
const DeliveryPlanManagementAwaitSRM: React.FC = () => {
const statusTxt = new Map([[1, '待提交'], [2, '待确认'], [3, '待修订'], [4, '已确认'], [5, '已删除']])
const DeliveryPlanManagementAwaitSRM: React.FC = () => {
const ref = useRef<any>({})
const formActions = createFormActions()
const handleDelete = (id: number) => {
Modal.confirm({
icon: <ExclamationCircleOutlined />,
content: <span>确认删除?</span>,
okText: '确认',
cancelText: '取消',
onOk() {
postOrderDeliveryPlanDelete({ id }).then((res: any) => {
if (res.code === 1000) ref.current.reload()
})
},
onCancel() { },
})
}
const handleSubmit = (id: number) => {
Modal.confirm({
icon: <ExclamationCircleOutlined />,
content: <span>确认提交?</span>,
okText: '确认',
cancelText: '取消',
onOk() {
postOrderDeliveryPlanSubmit({ id }).then((res: any) => {
if (res.code === 1000) ref.current.reload()
})
},
onCancel() { },
})
}
const controllerBtns = (
<Space>
<Button type='primary' icon={<PlusOutlined/>} onClick={() => history.push(`/memberCenter/order/deliveryPlanManagement/awaitSRM/create`)}>新增</Button>
<Button type='primary' icon={<PlusOutlined />} onClick={() => history.push(`/memberCenter/order/deliveryPlanManagement/awaitSRM/create`)}>新增</Button>
</Space>
)
const renderOptionButton = (record: any) => {
......@@ -51,9 +81,9 @@ const statusTxt = new Map([[1, '待提交'], [2, '待确认'], [3, '待修订'],
'查看': true,
}
const operationHandler = {
'提交': () => { console.log('提交 :>> ',) },
'提交': () => handleSubmit(record.id),
'修改': () => history.push(`/memberCenter/order/deliveryPlanManagement/awaitSRM/update?i=${godBtoa(record.id)}`),
'删除': () => { console.log('删除 :>> ',) },
'删除': () => handleDelete(record.id),
'查看': () => history.push(`/memberCenter/order/deliveryPlanManagement/awaitSRM/details?i=${godBtoa(record.id)}`),
}
......@@ -103,7 +133,7 @@ const statusTxt = new Map([[1, '待提交'], [2, '待确认'], [3, '待修订'],
getOrderDeliveryPlanBuyerPage({
...params,
status: STATUS,
orderType: OEDER_TYPE,
orderType: ORDER_TYPE,
}).then((res) => {
resolve(res.data);
})
......@@ -141,6 +171,6 @@ const statusTxt = new Map([[1, '待提交'], [2, '待确认'], [3, '待修订'],
</Card>
</PageHeaderWrapper>
)
}
}
export default DeliveryPlanManagementAwaitSRM
\ No newline at end of file
export default DeliveryPlanManagementAwaitSRM
\ 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, 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'
......@@ -148,7 +148,7 @@ const DeliveryPlanAwaitSRMUpdate: React.FC = () => {
return {
...item,
...integrationOjb(item.dayNumbers),
orders: item.orders.map(o => ({ ...o, ...integrationArrtoObj(o.planDays) }))
orders: item.orders.map(o => ({ ...o, ...integrationArrToObj(o.planDays) }))
}
})
materialTableDataRef.current = assemble
......
......@@ -14,7 +14,7 @@ import { createFormActions } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { deliveryPlanManagementQuerySchema } from './schema'
import { TagStatus } from '../../utils'
import { godBtoa, TagStatus } from '../../utils'
import dayjs from 'dayjs'
import { ExternalStateColumn, OperationColumn, PlannedEndDateColumn, PlannedStartDateColumn, PlanNumberColumn, PlanSummaryColumn, SupplyMemberColumn } from '../../constants/table-column'
import { getOrderDeliveryPlanBuyerPage } from '@/services/OrderNewV2Api';
......@@ -38,7 +38,7 @@ const DeliveryPlanManagementQuery: React.FC = () => {
}
const buttonGroup = {
'查看': true,
'变更': record.id === 1
'变更': record.status === 4
}
const operationHandler = {
'查看': () => { console.log('查看 :>> ',) },
......@@ -57,8 +57,8 @@ const DeliveryPlanManagementQuery: React.FC = () => {
...PlanNumberColumn,
dataIndex: 'planNo',
key: 'planNo',
width: 160,
render: (text: string, record: any) => <EyePreview url='/memberCenter/order/deliveryPlanManagement/query/details'>{text}</EyePreview>
// width: 160,
render: (text: string, record: any) => <EyePreview url={`/memberCenter/order/deliveryPlanManagement/query/details?ty=${godBtoa(record.orderType)}&i=${godBtoa(record.id)}`}>{text}</EyePreview>
},
{ ...PlanSummaryColumn, dataIndex: 'digest', key: 'digest' },
{ ...PlannedStartDateColumn, dataIndex: 'planStartTime', key: 'planStartTime', render: (text: string, record: any) => (dayjs(text).format('YYYY-MM-DD')) },
......
......@@ -7,7 +7,7 @@
* @param arr
* @returns
*/
const convertArrtoObj = (arr) => {
const convertArrToObj = (arr) => {
return arr.reduce((obj, currVal) => {
return {
...obj,
......@@ -39,7 +39,7 @@ const integrationOjb = (obj) => {
* @param arr
* @returns
*/
const integrationArrtoObj = (arr) => {
const integrationArrToObj = (arr) => {
return arr.reduce((obj, currVal, idx) => {
return {
...obj,
......@@ -68,9 +68,9 @@ const godAtob = (str: string) => {
}
export {
convertArrtoObj,
convertArrToObj,
integrationOjb,
integrationArrtoObj,
integrationArrToObj,
godBtoa,
godAtob,
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ interface StatusStyleItem {
/**
* 状态描述
* - default: 默认
* - toSbumit: 待提交
* - toSubmit: 待提交
* - toBeConfirmed: 待确认
* - toBeModified: 待修改
* - confirmed: 已确认
......@@ -18,23 +18,23 @@ interface StatusStyleItem {
* - voided: 已确认
*/
enum StatusEnum {
Default = 1,
ToSbumit = 2,
ToBeConfirmed = 3,
ToBeModified = 4,
Confirmed = 5,
Generated = 6,
Voided = 7,
Default = undefined,
ToSubmit = 1,
ToBeConfirmed = 2,
ToBeModified = 3,
Confirmed = 4,
Generated = 5,
Voided = 6,
}
class TagStatus {
/**
* 默认的Sytle集合 具体情况,看StatusEnum
* 默认的Style集合 具体情况,看StatusEnum
*/
#tagStatusColor: StatusStyleItem = {
[StatusEnum.Default]: this.defaultStatusStyle(),
[StatusEnum.ToSbumit]: this.toSbumitStatusStyle(),
[StatusEnum.ToSubmit]: this.toSubmitStatusStyle(),
[StatusEnum.ToBeConfirmed]: this.toBeConfirmedStyle(),
[StatusEnum.ToBeModified]: this.toBeConfirmedStyle(),
[StatusEnum.Confirmed]: this.confirmedStyle(),
......@@ -46,7 +46,7 @@ class TagStatus {
return { bgColor: '#f2f4f5', fontColor: '#000', txt: '默认' }
}
toSbumitStatusStyle() {
toSubmitStatusStyle() {
return { bgColor: '#f4f5f7', fontColor: '#5c626a', txt: '待提交' };
}
......
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