Commit 0b242de3 authored by GuanHua's avatar GuanHua

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

parents d8422d79 5ce1c294
...@@ -29,13 +29,29 @@ const DeliveryNoticeManagement = [ ...@@ -29,13 +29,29 @@ const DeliveryNoticeManagement = [
component: '@/pages/order/deliveryNoticeManagement/deliveryNoticeAwaitSRM' component: '@/pages/order/deliveryNoticeManagement/deliveryNoticeAwaitSRM'
}, },
{ {
/** 增修查送货通知单SRM详情*/ /** 查看送货通知单SRM详情*/
path: '/memberCenter/order/deliveryNoticeManagement/awaitSRM/details', path: '/memberCenter/order/deliveryNoticeManagement/awaitSRM/details',
name: '增修查送货通知单SRM详情', name: '增修查送货通知单SRM详情',
component: '@/pages/order/deliveryNoticeManagement/deliveryNoticeAwaitSRM/details', component: '@/pages/order/deliveryNoticeManagement/deliveryNoticeAwaitSRM/details',
hideInMenu: true, hideInMenu: true,
noMargin: true, noMargin: true,
}, },
{
/** 新增送货通知单SRM*/
path: '/memberCenter/order/deliveryNoticeManagement/awaitSRM/add',
name: '新增送货通知单SRM',
component: '@/pages/order/deliveryNoticeManagement/deliveryNoticeAwaitSRM/add',
hideInMenu: true,
noMargin: true,
},
{
/** 修改送货通知单SRM*/
path: '/memberCenter/order/deliveryNoticeManagement/awaitSRM/edit',
name: '修改送货通知单SRM',
component: '@/pages/order/deliveryNoticeManagement/deliveryNoticeAwaitSRM/edit',
hideInMenu: true,
noMargin: true,
},
{ {
/** 待提交送货通知单B2B*/ /** 待提交送货通知单B2B*/
...@@ -55,4 +71,4 @@ const DeliveryNoticeManagement = [ ...@@ -55,4 +71,4 @@ const DeliveryNoticeManagement = [
} }
] ]
export default DeliveryNoticeManagement export default DeliveryNoticeManagement
\ No newline at end of file
...@@ -25,12 +25,12 @@ interface AddressDrawerProps { ...@@ -25,12 +25,12 @@ interface AddressDrawerProps {
addressListRequest?: (values?: any) => Promise<any> addressListRequest?: (values?: any) => Promise<any>
value?: any value?: any
disabled?: boolean disabled?: boolean
rows?: number
} }
function AddressDrawer(props: AddressDrawerProps) { function AddressDrawer(props: AddressDrawerProps) {
const { onChange, formInstance, renderForm, sumbitRequest, addressListRequest, value: addr, disabled = false } = props; const { onChange, formInstance, renderForm, sumbitRequest, addressListRequest, value: addr, disabled = false, rows = 2 } = props;
const [visible, setVisible] = useState<boolean>(false); const [visible, setVisible] = useState<boolean>(false);
const [showForm, setShowForm] = useState<boolean>(false); const [showForm, setShowForm] = useState<boolean>(false);
...@@ -40,7 +40,7 @@ function AddressDrawer(props: AddressDrawerProps) { ...@@ -40,7 +40,7 @@ function AddressDrawer(props: AddressDrawerProps) {
useEffect(() => { useEffect(() => {
renderAddressList(); renderAddressList();
// props 更新 内部状态更新 用于FormItem 的操作 // props 更新 内部状态更新 用于FormItem 的操作
addr && setValue(addr); addr && setValue(addr);
}, [addr]) }, [addr])
...@@ -90,7 +90,7 @@ function AddressDrawer(props: AddressDrawerProps) { ...@@ -90,7 +90,7 @@ function AddressDrawer(props: AddressDrawerProps) {
<AddressRaioContextProvider value={addrList}> <AddressRaioContextProvider value={addrList}>
<Row gutter={10}> <Row gutter={10}>
<Col span={20}> <Col span={20}>
<Input.TextArea disabled={disabled} value={`${value?.fullAddress??''} ${value?.shipperName ? value?.shipperName : value?.receiverName ?? ''} ${value?.phone??''}`} /> <Input.TextArea rows={rows} disabled={disabled} value={`${value?.fullAddress??''} ${value?.shipperName ? value?.shipperName : value?.receiverName ?? ''} ${value?.phone??''}`} />
</Col> </Col>
<Col span={4}> <Col span={4}>
...@@ -135,4 +135,4 @@ function AddressDrawer(props: AddressDrawerProps) { ...@@ -135,4 +135,4 @@ function AddressDrawer(props: AddressDrawerProps) {
} }
export default AddressDrawer export default AddressDrawer
\ No newline at end of file
...@@ -79,7 +79,7 @@ function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) { ...@@ -79,7 +79,7 @@ function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) {
return ( return (
<> <>
<div className='mt-16'> <div className='mt-16'>
<Button onClick={handleVisible}>选择物</Button> <Button onClick={handleVisible}>选择物</Button>
</div> </div>
<Drawer <Drawer
...@@ -116,4 +116,4 @@ function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) { ...@@ -116,4 +116,4 @@ function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) {
); );
} }
export default DeliveryGoodTableModal; export default DeliveryGoodTableModal;
\ No newline at end of file
...@@ -88,16 +88,16 @@ export const ExternalRoamRecordTableColumn: any = [ ...@@ -88,16 +88,16 @@ export const ExternalRoamRecordTableColumn: any = [
// 送货物料 // 送货物料
export const DeliveryMaterialsTableColumn: any = [ export const DeliveryMaterialsTableColumn: any = [
{ dataIndex: 'name1', ...MaterialNoColumn, }, { ...MaterialNoColumn, dataIndex: 'skuId' },
{ dataIndex: 'name2', ...MaterialNameColumn, }, { ...MaterialNameColumn, dataIndex: 'productName' },
{ dataIndex: 'name3', ...MaterialModelColumn, }, { ...MaterialModelColumn, dataIndex: 'type' },
{ dataIndex: 'name4', ...ClassColumn, }, { ...ClassColumn, dataIndex: 'category' },
{ dataIndex: 'name5', ...BrandColumn, }, { ...BrandColumn, dataIndex: 'brand' },
{ dataIndex: 'name6', ...UntilColumn, }, { ...UntilColumn, dataIndex: 'unit' },
{ dataIndex: 'name7', ...OrderNoColumn, }, { ...OrderNoColumn, dataIndex: 'orderNo' },
{ dataIndex: 'name8', ...OrderCreatedAtColumn, }, { ...OrderCreatedAtColumn, dataIndex: 'createTime' },
{ dataIndex: 'name9', ...OredrNumColumn, }, { ...OredrNumColumn, dataIndex: 'purchaseCount' },
{ dataIndex: 'name10', ...PlannedDeliveryNumColumn, }, { ...PlannedDeliveryNumColumn, dataIndex: 'planCount' },
] ]
// 送货商品 // 送货商品
...@@ -111,4 +111,4 @@ export const DeliveryGoodsTableColumn: any = [ ...@@ -111,4 +111,4 @@ export const DeliveryGoodsTableColumn: any = [
{ dataIndex: 'name7', ...OrderCreatedAtColumn, }, { dataIndex: 'name7', ...OrderCreatedAtColumn, },
{ dataIndex: 'name8', ...OredrNumColumn, }, { dataIndex: 'name8', ...OredrNumColumn, },
{ dataIndex: 'name9', ...PlannedDeliveryNumColumn, }, { dataIndex: 'name9', ...PlannedDeliveryNumColumn, },
] ]
\ No newline at end of file
import { getIntl } from 'umi';
const intl = getIntl();
/**
* 通知单订单类型
*/
export enum ORDER_TYPE {
B2B = 1,
SRM = 2,
}
/**
* WAIT_CONFIRM 待确认
*
* WAIT_REVISE 待修订
*
* HAD_CONFIRM 已确认
*
* HAD_GENERATE 已生产送货单
*
* HAD_TO_VOID 已作废
*/
export enum STATUS {
WAIT_CONFIRM = 1,
WAIT_REVISE = 2,
HAD_CONFIRM = 3,
HAD_GENERATE = 4,
HAD_TO_VOID = 5,
}
/**
* 状态相关颜色码
*/
export const STATUS_NAME = {
// 待确认
[STATUS.WAIT_CONFIRM]: '待确认',
// 待修订
[STATUS.WAIT_REVISE]: '待修订',
// 已确认
[STATUS.HAD_CONFIRM]: '已确认',
// 已生产送货单
[STATUS.HAD_GENERATE]: '已生产送货单',
// 已作废
[STATUS.HAD_TO_VOID]: '已作废',
}
/**
* 状态相关颜色码
*/
export const TAG_STATUS_COLOR = {
// 待确认
[STATUS.WAIT_CONFIRM]: { color: '#ecf2fe', fontColor: '#4787f0' },
// 待修订
[STATUS.WAIT_REVISE]: { color: '#eae6ff', fontColor: '#9963d8' },
// 已确认
[STATUS.HAD_CONFIRM]: { color: '#ebf9f6', fontColor: '#00a98f' },
// 已生产送货单
[STATUS.HAD_GENERATE]: { color: '#f0f5ff', fontColor: '#f0f5ff' },
// 已作废
[STATUS.HAD_TO_VOID]: { color: '#fff2f0', fontColor: '#ff4d4f' },
}
/**
* 外部状态
*/
export enum OUTER_STATUS {
WAIT_SUBMIT = 1,
HAD_CONFIRM = 2,
}
/**
* 订单能力 - 送货通知单管理 - 新增待提交送货通知单B2B
* @author: Gavin
*/
import React, { useRef } from 'react'
import AddEditContent from './components/AddEditContent'
const DeliveryNoticeManagementAwaitB2BAdd: React.FC = () => {
return (
<AddEditContent type='add' />
)
}
export default DeliveryNoticeManagementAwaitB2BAdd
/**
* 订单能力 - 待提交送货通知单SRM - 增修送货通知单B2B详情
* @author: Gavin
*/
import React, { useState } from 'react'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { history } from 'umi'
import {
BaseInfo as base_info,
DeliveryList,
Remarks,
ExternalRoamRecord,
Circulation,
Purchaser,
SubmitDeliveryNotice,
Supplier,
ConfirmDeliveryNotice,
NoticeSummary,
BuyerLabel,
DeliveryDate,
ReceivingAddress,
ShippingInfo,
} from '../../../../constants'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import { Button, DatePicker, Form, Input, Steps, Table, TimePicker } from 'antd'
import { PlusOutlined } from '@ant-design/icons'
import { AddressDrawer } from '@/components/AddressDrawer'
import {
BrandColumn,
ClassColumn,
FlowOptionsColumn,
MaterialModelColumn,
MaterialNameColumn,
MaterialNoColumn,
OrderCreatedAtColumn,
OrderNoColumn,
OredrNumColumn,
PlannedDeliveryNumColumn,
UntilColumn
} from '../../../../constants/table-column'
import { ExternalRoamRecordTableColumn } from '../../../../constants/page-table-column'
import { getLogisticsSelectListReceiverAddress, postLogisticsReceiverAddressAdd, postLogisticsReceiverAddressUpdate } from '@/services/LogisticsV2Api'
type PropsType = {
type: 'add' | 'edit';
id?: string;
}
enum PAGE_TYPE {
ADD = 'add',
EDIT = 'edit'
}
const PAGE_TYPE_LABEL = {
[PAGE_TYPE.ADD]: '新增',
[PAGE_TYPE.EDIT]: '编辑',
}
const formItemLayout = {
labelCol: { span: 3 },
wrapperCol: { span: 18 }
}
const aa = [
{ id: '1', 'name1': '1', 'name2': '2', 'name3': '3', 'name4': '4', 'name5': '5', 'name6': '6', 'name7': '7', 'name8': '8', 'name9': '6', },
]
const DeliveryNoticeManagementAwaitB2BDetails: React.FC<PropsType> = ({ type, id }) => {
const [iAnchors, setiAnchors] = useState<AnchorsItem[]>([
Circulation,
base_info,
ShippingInfo,
DeliveryList,
Remarks,
])
const [details, setDetails] = useState<any>({})
return (
<AnchorPage
title={`${PAGE_TYPE_LABEL[type]}送货通知单(SRM)`}
onBack={() => history.goBack()}
anchors={iAnchors}
>
<Form labelAlign='left'>
<BaseInfo className='mt-0' title={Circulation.name} id={Circulation.key} cols={1}>
<Steps progressDot current={0}>
<Steps.Step title={Purchaser} description={SubmitDeliveryNotice} />
<Steps.Step title={Supplier} description={ConfirmDeliveryNotice} />
</Steps>
</BaseInfo>
<BaseInfo className='mt-16' title={base_info.name} id={base_info.key}>
<Form.Item
{...formItemLayout}
label={NoticeSummary}
>
<Input />
</Form.Item>
<Form.Item
{...formItemLayout}
label={BuyerLabel}
>
<Input />
</Form.Item>
</BaseInfo>
<BaseInfo className='mt-16' title={ShippingInfo.name} id={ShippingInfo.key}>
<Form.Item
{...formItemLayout}
label={DeliveryDate}
>
<DatePicker style={{ width: '100%' }} />
</Form.Item>
<Form.Item
{...formItemLayout}
label={ReceivingAddress}
name='test'
>
<AddressDrawer
addressListRequest={(val) => {
return getLogisticsSelectListReceiverAddress(val)
}}
sumbitRequest={{
update: (val) => {
return postLogisticsReceiverAddressUpdate(val)
},
add: (val) => {
return postLogisticsReceiverAddressAdd(val)
}
}}
/>
</Form.Item>
<Form.Item
{...formItemLayout}
label={DeliveryDate}
>
<TimePicker.RangePicker format={'HH:mm'} style={{ width: '100%' }} />
</Form.Item>
</BaseInfo>
<BaseInfo className='mt-16' title={DeliveryList.name} id={DeliveryList.key} cols={1}>
<Button icon={<PlusOutlined />}>选择</Button>
{/* SRM 物料列表*/}
<Table
rowKey={'id'}
dataSource={aa}
columns={[
{ dataIndex: 'name1', ...MaterialNoColumn, },
{ dataIndex: 'name2', ...MaterialNameColumn, },
{ dataIndex: 'name3', ...MaterialModelColumn, },
{ dataIndex: 'name4', ...ClassColumn, },
{ dataIndex: 'name5', ...BrandColumn, },
{ dataIndex: 'name6', ...UntilColumn, },
{ dataIndex: 'name7', ...OrderNoColumn, },
{ dataIndex: 'name8', ...OrderCreatedAtColumn, },
{ dataIndex: 'name9', ...OredrNumColumn, },
{
dataIndex: 'name10',
...PlannedDeliveryNumColumn,
render: (_, rcode, index) => {
return (<Input />)
},
editable: true,
},
{
key: 'action',
...FlowOptionsColumn,
render: () => (<Button type='link'>删除</Button>)
}
]}
/>
</BaseInfo>
<BaseInfo className='mt-16' title={Remarks.name} id={Remarks.key} cols={1}>
<Form.Item
// { ...formItemLayout }
labelCol={{ span: 0 }}
wrapperCol={{ span: 24 }}
>
<Input.TextArea rows={6} maxLength={300} placeholder='最长600个字符,300个汉字。' />
</Form.Item>
</BaseInfo>
</Form>
</AnchorPage>
)
}
export default DeliveryNoticeManagementAwaitB2BDetails
/**
* 订单能力 - 送货通知单管理 - 修改待提交送货通知单B2B
* @author: Gavin
*/
import React, { useRef } from 'react'
import { history } from 'umi'
import AddEditContent from './components/AddEditContent'
const DeliveryNoticeManagementAwaitB2BEdit: React.FC = () => {
const id = history.location?.query?.id
return (
<AddEditContent
type='edit'
id={id as string}
/>
)
}
export default DeliveryNoticeManagementAwaitB2BEdit
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @author: Gavin * @author: Gavin
* @description: 与SRM内容大致相同,文件分开方便后续对接以及日后变动修改二开 * @description: 与SRM内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/ */
import React, { useRef, useState } from 'react' import React, { useRef } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Button, Card, Space, Tag } from 'antd' import { Button, Card, Space, Tag } from 'antd'
import StandardTable from '@/components/StandardTable' import StandardTable from '@/components/StandardTable'
...@@ -11,31 +11,28 @@ ...@@ -11,31 +11,28 @@
import TableOperation from '@/components/TableOperation' import TableOperation from '@/components/TableOperation'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import NiceForm from '@/components/NiceForm' import NiceForm from '@/components/NiceForm'
import AuthButton from '@/components/AuthButton'
import { createFormActions } from '@formily/antd' import { createFormActions } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch' import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const' import { FORM_FILTER_PATH } from '@/formSchema/const'
import { deliveryNoticeManagementB2BSchema } from './schema' import { deliveryNoticeManagementB2BSchema } from './schema'
import { getOrderDeliveryNoticeOrderVendorPage } from '@/services/OrderNewV2Api'
const tagStatusColor = { import { ORDER_TYPE, TAG_STATUS_COLOR, OUTER_STATUS, STATUS_NAME } from '../constant'
// 待提交 import { history } from 'umi'
2: { color: '#f4f5f7', fontColor: '#5c626a' }, import { PlusOutlined } from '@ant-design/icons'
// 待确认
3: { color: '#ecf2fe', fontColor: '#4787f0' },
// 待修订
4: { color: '#eae6ff', fontColor: '#9963d8' },
// 已确认
5: { color: '#ebf9f6', fontColor: '#00a98f' },
// 已生产送货单
6: { color: '#f0f5ff', fontColor: '#f0f5ff' },
// 已作废
7: { color: '#fff2f0', fontColor: '#ff4d4f' },
}
const DeliveryNoticeManagementAwaitB2B: React.FC = () => { const DeliveryNoticeManagementAwaitB2B: React.FC = () => {
const ref = useRef<any>({}) const ref = useRef<any>({})
const formActions = createFormActions() const formActions = createFormActions()
const controllerBtns = (<Space></Space>) const controllerBtns = (
<Space>
<AuthButton btnCode='' menuCode=''>
<Button type='primary' icon={<PlusOutlined/>}>新增</Button>
</AuthButton>
</Space>
)
const renderOptionButton = (record: any) => { const renderOptionButton = (record: any) => {
const btnAuthOfOperationTextMap = { const btnAuthOfOperationTextMap = {
'修改': 'DevTest', '修改': 'DevTest',
...@@ -47,7 +44,7 @@ const DeliveryNoticeManagementAwaitB2B: React.FC = () => { ...@@ -47,7 +44,7 @@ const DeliveryNoticeManagementAwaitB2B: React.FC = () => {
} }
const operationHandler = { const operationHandler = {
'修改': () => { console.log('修改 :>> ',) }, '修改': () => { console.log('修改 :>> ',) },
'查看': () => { console.log('查看 :>> ',) }, '查看': () => { history.push(`/memberCenter/order/deliveryNoticeManagement/awaitB2B/details?id=${record.id}`) },
} }
return ( return (
<TableOperation <TableOperation
...@@ -57,26 +54,27 @@ const DeliveryNoticeManagementAwaitB2B: React.FC = () => { ...@@ -57,26 +54,27 @@ const DeliveryNoticeManagementAwaitB2B: React.FC = () => {
/> />
) )
} }
const columns: ColumnType<unknown>[] = [ const columns: ColumnType<unknown>[] = [
{ {
title: '通知单号', title: '通知单号',
dataIndex: 'id', dataIndex: 'noticeNo',
key: 'id', key: 'noticeNo',
width: 160, width: 160,
ellipsis: true, ellipsis: true,
render: (text: unknown, record: unknown) => <EyePreview url='/memberCenter/order/deliveryNoticeManagement/awaitB2B/details'>{text}</EyePreview> render: (text: unknown, record: any) => <EyePreview url={`/memberCenter/order/deliveryNoticeManagement/awaitB2B/details?id=${record.id}`}>{text}</EyePreview>
}, },
{ title: '通知单摘要', dataIndex: 'id2', key: 'id2' }, { title: '通知单摘要', dataIndex: 'digest', key: 'digest' },
{ title: '送货日期', dataIndex: 'id3', key: 'id3' }, { title: '送货日期', dataIndex: 'deliveryTime', key: 'deliveryTime' },
{ title: '采购会员', dataIndex: 'id5', key: 'id5' }, { title: '采购会员', dataIndex: 'memberName', key: 'memberName' },
{ title: '单据时间', dataIndex: 'id4', key: 'id4' }, { title: '单据时间', dataIndex: 'createTime', key: 'createTime' },
{ {
title: '外部状态', title: '外部状态',
dataIndex: 'id6', dataIndex: 'status',
key: 'id6', key: 'status',
render: (text: string, record: any) => ( render: (text: string, record: any) => (
<Tag color={tagStatusColor[record.id3]?.color}> <Tag color={TAG_STATUS_COLOR[text]?.color}>
<span style={{ color: tagStatusColor[record.id3]?.fontColor }}>{text}</span> <span style={{ color: TAG_STATUS_COLOR[text]?.fontColor }}>{STATUS_NAME[text]}</span>
</Tag> </Tag>
) )
}, },
...@@ -89,22 +87,17 @@ const DeliveryNoticeManagementAwaitB2B: React.FC = () => { ...@@ -89,22 +87,17 @@ const DeliveryNoticeManagementAwaitB2B: React.FC = () => {
}, },
] ]
const fetchData = (params: unknown) => { const fetchData = (params: any) => {
console.log('params :>> ', params);
return new Promise((resolve) => { return new Promise((resolve) => {
const data = { getOrderDeliveryNoticeOrderVendorPage({
totalCount: 1, data: [ ...params,
{ id: 1, id2: 2, id3: 4, id4: 4, id5: 5, id6: 6 }, orderType: ORDER_TYPE.B2B,
{ id: 2, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, status: OUTER_STATUS.WAIT_SUBMIT
{ id: 3, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, }).then(({ code, data }) => {
{ id: 4, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, if (code === 1000) {
{ id: 5, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, resolve(data)
{ id: 6, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, }
{ id: 7, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, })
{ id: 8, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
]
}
resolve(data)
}) })
} }
...@@ -128,7 +121,7 @@ const DeliveryNoticeManagementAwaitB2B: React.FC = () => { ...@@ -128,7 +121,7 @@ const DeliveryNoticeManagementAwaitB2B: React.FC = () => {
useStateFilterSearchLinkageEffect( useStateFilterSearchLinkageEffect(
$, $,
actions, actions,
'planCode', 'noticeNo',
FORM_FILTER_PATH, FORM_FILTER_PATH,
) )
}} }}
...@@ -141,4 +134,4 @@ const DeliveryNoticeManagementAwaitB2B: React.FC = () => { ...@@ -141,4 +134,4 @@ const DeliveryNoticeManagementAwaitB2B: React.FC = () => {
) )
} }
export default DeliveryNoticeManagementAwaitB2B export default DeliveryNoticeManagementAwaitB2B
\ No newline at end of file
...@@ -26,7 +26,7 @@ export const deliveryNoticeManagementB2BSchema: ISchema = { ...@@ -26,7 +26,7 @@ export const deliveryNoticeManagementB2BSchema: ISchema = {
children: '{{controllerBtns}}', children: '{{controllerBtns}}',
}, },
}, },
planCode: { noticeNo: {
type: 'string', type: 'string',
'x-component': 'Search', 'x-component': 'Search',
'x-component-props': { 'x-component-props': {
...@@ -48,25 +48,25 @@ export const deliveryNoticeManagementB2BSchema: ISchema = { ...@@ -48,25 +48,25 @@ export const deliveryNoticeManagementB2BSchema: ISchema = {
}, },
}, },
properties: { properties: {
abstract: { digest: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
allowClear: true, allowClear: true,
placeholder: '通知单摘要' placeholder: '通知单摘要'
} }
}, },
'[startTime, endTime]': { '[startDate, endDate]': {
type: 'daterange', type: 'daterange',
'x-component-props': { 'x-component-props': {
allowClear: true, allowClear: true,
placeholder: ['送货开始日期', '送货结束日期'], placeholder: ['送货开始日期', '送货结束日期'],
}, },
}, },
supplyMember: { memberName: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
allowClear: true, allowClear: true,
placeholder: '供应会员' placeholder: '采购会员'
} }
}, },
submit: { submit: {
...@@ -83,4 +83,4 @@ export const deliveryNoticeManagementB2BSchema: ISchema = { ...@@ -83,4 +83,4 @@ export const deliveryNoticeManagementB2BSchema: ISchema = {
} }
} }
} }
} }
\ No newline at end of file
/**
* 订单能力 - 送货通知单管理 - 新增待提交送货通知单SRM
* @author: Gavin
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import React, { useRef } from 'react'
import AddEditContent from './components/AddEditContent'
const DeliveryNoticeManagementAwaitSRMAdd: React.FC = () => {
return (
<AddEditContent type='add' />
)
}
export default DeliveryNoticeManagementAwaitSRMAdd
/**
* 订单能力 - 待提交送货通知单SRM - 增修送货通知单SRM详情
* @author: Gavin
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import React, { useState } from 'react'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { history } from 'umi'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import { Button, DatePicker, Form, Input, message, Steps, Table, TimePicker } from 'antd'
import { PlusOutlined } from '@ant-design/icons'
import { AddressDrawer } from '@/components/AddressDrawer'
import AuthButton from '@/components/AuthButton'
import { RoleSelect } from '@/components/RoleSelect'
import DeliveryGoodTableSelect from '../../../../components/DeliveryGoodTableSelect/DeliveryGoodTableSelect';
import { HarvestMaterialContextProvider, HarvestMaterialInput } from '../../../../assets/context';
import { getLogisticsSelectListReceiverAddress } from '@/services/LogisticsV2Api'
import { postOrderDeliveryNoticeOrderSrmCreate } from '@/services/OrderNewV2Api'
import { BaseInfo as base_info, DeliveryList, Remarks, ExternalRoamRecord, Circulation, Purchaser, SubmitDeliveryNotice, Supplier, ConfirmDeliveryNotice, NoticeSummary, BuyerLabel, DeliveryDate, DeliveryTime, ReceivingAddress, ShippingInfo } from '../../../../constants'
import { BrandColumn, ClassColumn, FlowOptionsColumn, MaterialModelColumn, MaterialNameColumn, MaterialNoColumn, OrderCreatedAtColumn, OrderNoColumn, OredrNumColumn, PlannedDeliveryNumColumn, UntilColumn } from '../../../../constants/table-column'
import dayjs from 'dayjs'
type PropsType = {
type: 'add' | 'edit';
id?: string;
}
enum PAGE_TYPE {
ADD = 'add',
EDIT = 'edit'
}
const PAGE_TYPE_LABEL = {
[PAGE_TYPE.ADD]: '新增',
[PAGE_TYPE.EDIT]: '编辑',
}
const formItemLayout = {
labelCol: { span: 4 },
wrapperCol: { span: 18 }
}
const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ type, id }) => {
const [ form ] = Form.useForm()
const [iAnchors, setiAnchors] = useState<AnchorsItem[]>([
Circulation,
base_info,
ShippingInfo,
DeliveryList,
Remarks,
])
const [details, setDetails] = useState<any>({})
const [tableDataSource, setTableDataSource] = useState<any[]>()
const [loading, setLoading] = useState<boolean>(false)
const handleSubmit = () => {
form.validateFields().then(({
deliveryStartEndTime,
deliveryTime,
digest,
member,
receivingAddress,
remark
}) => {
const { name: buyerMemberName, roleType, ...buyerMemberRest } = member
const params = {
...buyerMemberRest,
buyerMemberName,
digest,
...receivingAddress,
deliveryTime: dayjs(deliveryTime).format('YYYY-MM-DD'),
deliveryStartTime: dayjs(deliveryStartEndTime[0]).format('hh:mm'),
deliveryEndTime : dayjs(deliveryStartEndTime[1]).format('hh:mm'),
products: tableDataSource,
remark
}
console.log('params', params)
setLoading(true)
postOrderDeliveryNoticeOrderSrmCreate(params).then(({ code, data }) => {
if (code === 1000) {
message.success('提交成功')
history.goBack()
}
}).finally(() => {
setLoading(false)
})
})
}
const handleRemoveMaterialTableRow = (i: number) => {
const source: any[] = tableDataSource;
const newSource = source.splice(i, 0)
setTableDataSource(newSource);
}
return (
<AnchorPage
title={`${PAGE_TYPE_LABEL[type]}送货通知单(SRM)`}
onBack={() => history.goBack()}
anchors={iAnchors}
extra={
<AuthButton btnCode='' menuCode=''>
<Button loading={loading} onClick={handleSubmit} type='primary'>提交</Button>
</AuthButton>
}
>
<Form labelAlign='left' form={form}>
<BaseInfo className='mt-0' title={Circulation.name} id={Circulation.key} cols={1}>
<Steps progressDot current={0}>
<Steps.Step title={Purchaser} description={SubmitDeliveryNotice} />
<Steps.Step title={Supplier} description={ConfirmDeliveryNotice} />
</Steps>
</BaseInfo>
<BaseInfo className='mt-16' title={base_info.name} id={base_info.key}>
<Form.Item
{...formItemLayout}
name='digest'
label={NoticeSummary}
rules={[
{ required: true, message: `请填写${NoticeSummary}` }
]}
>
<Input />
</Form.Item>
<Form.Item
{...formItemLayout}
rules={[
{ required: true, message: `请选择${BuyerLabel}` }
]}
label={BuyerLabel} name="member">
<RoleSelect formatFeils={(e) => {
return {
buyerMemberId: e.memberId,
buyerRoleId: e.roleId,
roleType: 2,
name: e.name
}
}} />
</Form.Item>
</BaseInfo>
<BaseInfo className='mt-16' title={ShippingInfo.name} id={ShippingInfo.key}>
<Form.Item
{...formItemLayout}
label={DeliveryDate}
name='deliveryTime'
rules={[
{ required: true, message: `请选择${DeliveryDate}` }
]}
>
<DatePicker style={{ width: '100%' }} />
</Form.Item>
<Form.Item
{...formItemLayout}
label={ReceivingAddress}
name='receivingAddress'
rules={[
{ required: true, message: `请选择${ReceivingAddress}` }
]}
>
<AddressDrawer
disabled
rows={1}
addressListRequest={(val) => {
return getLogisticsSelectListReceiverAddress(val)
}}
/>
</Form.Item>
<Form.Item
{...formItemLayout}
label={DeliveryTime}
name='deliveryStartEndTime'
rules={[
{ required: true, message: `请选择${DeliveryTime}` }
]}
>
<TimePicker.RangePicker format={'HH:mm'} style={{ width: '100%' }} />
</Form.Item>
</BaseInfo>
<BaseInfo className='mt-16' title={DeliveryList.name} id={DeliveryList.key} cols={1}>
<DeliveryGoodTableSelect
form={form}
onChange={(value) => {
if (value.length > 0) {
let addr = {
provinceName: value[0].provinceName,
cityName: value[0].cityName,
districtName: value[0].districtName,
streetName: value[0].streetName || '0',
address: value[0].address,
phone: value[0].phone,
consignee: value[0].consignee,
consigneeId: value[0].consigneeId,
fullAddress: `${value[0].provinceName}${value[0].cityName}${value[0].districtName}${value[0].streetName}${value[0].address}`
}
form.setFieldsValue({
'receivingAddress': addr
})
}
setTableDataSource(value)
}}
/>
<HarvestMaterialContextProvider value={{
dataSource: tableDataSource
}}>
<Table
rowKey={row => row.orderNo}
columns={
[
...[
{ ...MaterialNoColumn, dataIndex: 'orderProductId' },
{ ...MaterialNameColumn, dataIndex: 'productName' },
{ ...MaterialModelColumn, dataIndex: 'spec' },
{ ...ClassColumn, dataIndex: 'category' },
{ ...BrandColumn, dataIndex: 'brand' },
{ ...UntilColumn, dataIndex: 'unit' },
{ ...OrderNoColumn, dataIndex: 'orderNo' },
{ ...OrderCreatedAtColumn, dataIndex: 'createTime' },
{ ...OredrNumColumn, dataIndex: 'purchaseCount' },
],
{
title: '计划送货数量',
width: 100,
align: 'center',
render: (t, rcode, index) => {
return (
<HarvestMaterialInput
value={rcode[OredrNumColumn.key]}
index={index}
keyUp="deliveryCount"
/>
)
}
},
{
title: "操作",
render: (t, r, i) => {
return (
<Button type='link' onClick={() => handleRemoveMaterialTableRow(i)}>删除</Button>
)
}
}
]}
dataSource={tableDataSource}
/>
</HarvestMaterialContextProvider>
</BaseInfo>
<BaseInfo className='mt-16' title={Remarks.name} id={Remarks.key} cols={1}>
<Form.Item
labelCol={{ span: 0 }}
wrapperCol={{ span: 24 }}
name='remark'
>
<Input.TextArea rows={6} maxLength={300} placeholder='最长600个字符,300个汉字' />
</Form.Item>
</BaseInfo>
</Form>
</AnchorPage>
)
}
export default DeliveryNoticeManagementAwaitSRMDetails
/**
* 订单能力 - 送货通知单管理 - 修改待提交送货通知单SRM
* @author: Gavin
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import React, { useRef } from 'react'
import { history } from 'umi'
import AddEditContent from './components/AddEditContent'
const DeliveryNoticeManagementAwaitSRMEdit: React.FC = () => {
const id = history.location?.query?.id
return (
<AddEditContent
type='edit'
id={id as string}
/>
)
}
export default DeliveryNoticeManagementAwaitSRMEdit
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @author: Gavin * @author: Gavin
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开 * @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/ */
import React, { useRef, useState } from 'react' import React, { useRef } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Button, Card, Space, Tag } from 'antd' import { Button, Card, Space, Tag } from 'antd'
import StandardTable from '@/components/StandardTable' import StandardTable from '@/components/StandardTable'
...@@ -11,31 +11,44 @@ ...@@ -11,31 +11,44 @@
import TableOperation from '@/components/TableOperation' import TableOperation from '@/components/TableOperation'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import NiceForm from '@/components/NiceForm' import NiceForm from '@/components/NiceForm'
import AuthButton from '@/components/AuthButton'
import { createFormActions } from '@formily/antd' import { createFormActions } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch' import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const' import { FORM_FILTER_PATH } from '@/formSchema/const'
import { deliveryNoticeManagementSRMSchema } from './schema' import { deliveryNoticeManagementSRMSchema } from './schema'
import { getOrderDeliveryNoticeOrderVendorPage } from '@/services/OrderNewV2Api'
import { ORDER_TYPE, TAG_STATUS_COLOR, OUTER_STATUS, STATUS_NAME, STATUS } from '../constant'
import { history } from 'umi'
import { PlusOutlined } from '@ant-design/icons'
const tagStatusColor = { const mock = {
// 待提交 totalCount: 4,
2: { color: '#f4f5f7', fontColor: '#5c626a' }, data: [
// 待确认 {id: 1, noticeNo: '2e12e', status: STATUS.WAIT_CONFIRM},
3: { color: '#ecf2fe', fontColor: '#4787f0' }, {id: 2, noticeNo: 'axascac', status: STATUS.WAIT_REVISE},
// 待修订 {id: 3, noticeNo: 'fafa', status: STATUS.HAD_CONFIRM},
4: { color: '#eae6ff', fontColor: '#9963d8' }, {id: 4, noticeNo: 'fasffqw', status: STATUS.HAD_CONFIRM},
// 已确认 ]
5: { color: '#ebf9f6', fontColor: '#00a98f' }, }
// 已生产送货单
6: { color: '#f0f5ff', fontColor: '#f0f5ff' },
// 已作废
7: { color: '#fff2f0', fontColor: '#ff4d4f' },
}
const DeliveryNoticeManagementAwaitSRM: React.FC = () => { const DeliveryNoticeManagementAwaitSRM: React.FC = () => {
const ref = useRef<any>({}) const ref = useRef<any>({})
const formActions = createFormActions() const formActions = createFormActions()
const controllerBtns = (<Space></Space>) const controllerBtns = (
<Space>
<AuthButton btnCode='' menuCode=''>
<Button
type='primary'
icon={<PlusOutlined/>}
onClick={() => history.push(`/memberCenter/order/deliveryNoticeManagement/awaitSRM/add`)}
>
新增
</Button>
</AuthButton>
</Space>
)
const renderOptionButton = (record: any) => { const renderOptionButton = (record: any) => {
const btnAuthOfOperationTextMap = { const btnAuthOfOperationTextMap = {
'修改': 'DevTest', '修改': 'DevTest',
...@@ -46,8 +59,8 @@ const DeliveryNoticeManagementAwaitSRM: React.FC = () => { ...@@ -46,8 +59,8 @@ const DeliveryNoticeManagementAwaitSRM: React.FC = () => {
'查看': true, '查看': true,
} }
const operationHandler = { const operationHandler = {
'修改': () => { console.log('修改 :>> ',) }, '修改': () => { history.push(`/memberCenter/order/deliveryNoticeManagement/awaitSRM/edit?id=${record.id}`) },
'查看': () => { console.log('查看 :>> ',) }, '查看': () => { history.push(`/memberCenter/order/deliveryNoticeManagement/awaitSRM/details?id=${record.id}`) },
} }
return ( return (
<TableOperation <TableOperation
...@@ -57,25 +70,26 @@ const DeliveryNoticeManagementAwaitSRM: React.FC = () => { ...@@ -57,25 +70,26 @@ const DeliveryNoticeManagementAwaitSRM: React.FC = () => {
/> />
) )
} }
const columns: ColumnType<unknown>[] = [ const columns: ColumnType<unknown>[] = [
{ {
title: '通知单号', title: '通知单号',
dataIndex: 'id', dataIndex: 'noticeNo',
key: 'id', key: 'noticeNo',
width: 160, width: 160,
render: (text: unknown, record: unknown) => <EyePreview url='/memberCenter/order/deliveryNoticeManagement/awaitSRM/details'>{text}</EyePreview> render: (text: unknown, record: any) => <EyePreview url={`/memberCenter/order/deliveryNoticeManagement/awaitSRM/details?id=${record.id}`}>{text}</EyePreview>
}, },
{ title: '通知单摘要', dataIndex: 'id2', key: 'id2' }, { title: '通知单摘要', dataIndex: 'digest', key: 'digest' },
{ title: '送货日期', dataIndex: 'id3', key: 'id3' }, { title: '送货日期', dataIndex: 'deliveryTime', key: 'deliveryTime' },
{ title: '采购会员', dataIndex: 'id5', key: 'id5' }, { title: '采购会员', dataIndex: 'memberName', key: 'memberName' },
{ title: '单据时间', dataIndex: 'id4', key: 'id4' }, { title: '单据时间', dataIndex: 'createTime', key: 'createTime' },
{ {
title: '外部状态', title: '外部状态',
dataIndex: 'id6', dataIndex: 'status',
key: 'id6', key: 'status',
render: (text: string, record: any) => ( render: (text: string, record: any) => (
<Tag color={tagStatusColor[record.id3]?.color}> <Tag color={TAG_STATUS_COLOR[text]?.color}>
<span style={{ color: tagStatusColor[record.id3]?.fontColor }}>{text}</span> <span style={{ color: TAG_STATUS_COLOR[text]?.fontColor }}>{STATUS_NAME[text]}</span>
</Tag> </Tag>
) )
}, },
...@@ -88,22 +102,17 @@ const DeliveryNoticeManagementAwaitSRM: React.FC = () => { ...@@ -88,22 +102,17 @@ const DeliveryNoticeManagementAwaitSRM: React.FC = () => {
}, },
] ]
const fetchData = (params: unknown) => { const fetchData = (params: any) => {
console.log('params :>> ', params);
return new Promise((resolve) => { return new Promise((resolve) => {
const data = { getOrderDeliveryNoticeOrderVendorPage({
totalCount: 1, data: [ ...params,
{ id: 1, id2: 2, id3: 4, id4: 4, id5: 5, id6: 6 }, orderType: ORDER_TYPE.SRM,
{ id: 2, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, status: OUTER_STATUS.WAIT_SUBMIT
{ id: 3, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, }).then(({ code, data }) => {
{ id: 4, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, if (code === 1000) {
{ id: 5, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, resolve(data)
{ id: 6, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, }
{ id: 7, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, })
{ id: 8, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
]
}
resolve(data)
}) })
} }
...@@ -127,7 +136,7 @@ const DeliveryNoticeManagementAwaitSRM: React.FC = () => { ...@@ -127,7 +136,7 @@ const DeliveryNoticeManagementAwaitSRM: React.FC = () => {
useStateFilterSearchLinkageEffect( useStateFilterSearchLinkageEffect(
$, $,
actions, actions,
'planCode', 'noticeNo',
FORM_FILTER_PATH, FORM_FILTER_PATH,
) )
}} }}
...@@ -140,4 +149,4 @@ const DeliveryNoticeManagementAwaitSRM: React.FC = () => { ...@@ -140,4 +149,4 @@ const DeliveryNoticeManagementAwaitSRM: React.FC = () => {
) )
} }
export default DeliveryNoticeManagementAwaitSRM export default DeliveryNoticeManagementAwaitSRM
\ No newline at end of file
...@@ -26,7 +26,7 @@ export const deliveryNoticeManagementSRMSchema: ISchema = { ...@@ -26,7 +26,7 @@ export const deliveryNoticeManagementSRMSchema: ISchema = {
children: '{{controllerBtns}}', children: '{{controllerBtns}}',
}, },
}, },
planCode: { noticeNo: {
type: 'string', type: 'string',
'x-component': 'Search', 'x-component': 'Search',
'x-component-props': { 'x-component-props': {
...@@ -48,25 +48,25 @@ export const deliveryNoticeManagementSRMSchema: ISchema = { ...@@ -48,25 +48,25 @@ export const deliveryNoticeManagementSRMSchema: ISchema = {
}, },
}, },
properties: { properties: {
abstract: { digest: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
allowClear: true, allowClear: true,
placeholder: '通知单摘要' placeholder: '通知单摘要'
} }
}, },
'[startTime, endTime]': { '[startDate, endDate]': {
type: 'daterange', type: 'daterange',
'x-component-props': { 'x-component-props': {
allowClear: true, allowClear: true,
placeholder: ['送货开始日期', '送货结束日期'], placeholder: ['送货开始日期', '送货结束日期'],
}, },
}, },
supplyMember: { memberName: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
allowClear: true, allowClear: true,
placeholder: '供应会员' placeholder: '采购会员'
} }
}, },
submit: { submit: {
...@@ -83,4 +83,4 @@ export const deliveryNoticeManagementSRMSchema: ISchema = { ...@@ -83,4 +83,4 @@ export const deliveryNoticeManagementSRMSchema: ISchema = {
} }
} }
} }
} }
\ No newline at end of file
import { useState, useImperativeHandle, forwardRef, useRef } from 'react'
import { Modal, Input, Form, message } from 'antd'
import { postOrderDeliveryNoticeOrderInvalid } from '@/services/OrderNewV2Api'
import dayjs from "dayjs"
export type HandleType = {
show: (flag: boolean, id?: string | number) => void;
}
type PropsType = {
onOk: () => void;
}
const TextArea = Input.TextArea
const ToVoidModal = ({ onOk }: PropsType, ref: any) => {
const [form] = Form.useForm()
const [visible, setVisible] = useState<boolean>(false)
const [loading, setLoading] = useState<boolean>(false)
const idRef = useRef<string | number>();
const _onOk = () => {
form.validateFields().then((values) => {
setLoading(true)
postOrderDeliveryNoticeOrderInvalid({ id: idRef.current, ...values}).then(({ code, data }) => {
if (code === 1000) {
message.success('已作废')
setVisible(false)
onOk?.()
}
}).finally(() => {
setLoading(false)
})
})
}
useImperativeHandle(ref, () => ({
show(flag: boolean, id: string | number) {
id && (idRef.current = id);
setVisible(flag)
}
}))
return (
<Modal
title={'作废原因'}
maskClosable={false}
destroyOnClose
visible={visible}
onOk={_onOk}
okText='保存'
onCancel={() => setVisible(false)}
confirmLoading={loading}
>
<Form form={form}>
<Form.Item
name="time"
label="作废时间"
required
initialValue={dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')}
>
<Input disabled />
</Form.Item>
<Form.Item
name="remark"
label="作废原因"
required
rules={[
{ required: true, message: '请输入作废原因' },
{ pattern: /^[\u4e00-\u9fa5]{0,50}|[0-9a-zA-Z]{0,100}$/, message: '最大100个字符,50个文字' }
]}
>
<TextArea
rows={3}
maxLength={100}
placeholder="请输入作废原因(最大100个字符,50个文字)"
/>
</Form.Item>
</Form>
</Modal>
)
}
export default forwardRef(ToVoidModal)
/** /**
* 订单能力 - 送货通知单管理 - 送货通知单详情 * 订单能力 - 送货通知单管理 - 送货通知单详情
* @author: Gavin * @author: Gavin
* @description: * @description:
*/ */
import React, { useState } from 'react' import React, { useEffect, useState } from 'react'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage' import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { history } from 'umi' import { history, useLocation } from 'umi'
import { Circulation, ConfirmDeliveryPlan, DeliveryNoticeDetaitlsAnchors, Purchaser, SubmitDeliveryPlan, Supplier, BaseInfo as base_Info, NoticeNo, BuyerLabel, NoticeSummary, ExternalState, ShippingInfo, DeliveryDate, DeliveryTime, ReceivingAddress, DeliveryList, ExternalRoamRecord, } from '../../constants' import { Circulation, ConfirmDeliveryPlan, DeliveryNoticeDetaitlsAnchors, Purchaser, SubmitDeliveryPlan, Supplier, BaseInfo as base_Info, NoticeNo, BuyerLabel, NoticeSummary, ExternalState, ShippingInfo, DeliveryDate, DeliveryTime, ReceivingAddress, DeliveryList, ExternalRoamRecord, } from '../../constants'
import BaseInfo from '@/components/BaseInfo/BaseInfo' import BaseInfo from '@/components/BaseInfo/BaseInfo'
import StandardTable from '@/components/StandardTable'
import { Steps, Table, Tag } from 'antd' import { Steps, Table, Tag } from 'antd'
import { DeliveryMaterialsTableColumn, ExternalRoamRecordTableColumn } from '../../constants/page-table-column' import { DeliveryMaterialsTableColumn, ExternalRoamRecordTableColumn } from '../../constants/page-table-column'
import { getOrderDeliveryNoticeOrderDetail, getOrderDeliveryNoticeOrderDetailPage, getOrderDeliveryNoticeOrderDeliveryHistory } from '@/services/OrderNewV2Api'
import { STATUS_NAME } from '../constant'
const DeliveryNoticeManagementDetails: React.FC = () => { const DeliveryNoticeManagementDetails: React.FC = () => {
const id = history.location?.query?.id
const [iAnchors, setiAnchors] = useState<AnchorsItem[]>(DeliveryNoticeDetaitlsAnchors) const [iAnchors, setiAnchors] = useState<AnchorsItem[]>(DeliveryNoticeDetaitlsAnchors)
const [details, setDetails] = useState<any>({}) const [details, setDetails] = useState<any>({})
const getDetail = async () => {
if (id) {
const { code, data } = await getOrderDeliveryNoticeOrderDetail({ id });
if (code === 1000) {
setDetails(data || {})
}
}
}
const fetchData = (api: Function, params: any) => {
return new Promise((resolve) => {
api({ ...params, orderId: id }).then(({ code, data }) => {
if (code === 1000) {
resolve(data)
}
})
})
}
useEffect(() => {
getDetail()
}, [])
return ( return (
<AnchorPage <AnchorPage
title={details?.name || '没有title'} title={details?.noticeNo}
onBack={() => history.goBack()} onBack={() => history.goBack()}
anchors={iAnchors} anchors={iAnchors}
> >
<BaseInfo className='mt-0' title={Circulation.name} id={Circulation.key} cols={1}> <BaseInfo className='mt-0' title={Circulation.name} id={Circulation.key} cols={1}>
<Steps progressDot current={0}> <Steps progressDot current={details.outerStatus - 1}>
<Steps.Step title={Purchaser} description={SubmitDeliveryPlan} /> <Steps.Step title={Purchaser} description={SubmitDeliveryPlan} />
<Steps.Step title={Supplier} description={ConfirmDeliveryPlan} /> <Steps.Step title={Supplier} description={ConfirmDeliveryPlan} />
</Steps> </Steps>
</BaseInfo> </BaseInfo>
<BaseInfo className='mt-16' title={base_Info.name} id={base_Info.key}> <BaseInfo className='mt-16' title={base_Info.name} id={base_Info.key}>
<BaseInfo.BaseInfoItem label={NoticeNo}> <BaseInfo.BaseInfoItem label={NoticeNo}>
DL2014070100001 {details.noticeNo}
</BaseInfo.BaseInfoItem> </BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={BuyerLabel}> <BaseInfo.BaseInfoItem label={BuyerLabel}>
温州龙昌手袋有限公司 {details.buyerMemberName}
</BaseInfo.BaseInfoItem> </BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={NoticeSummary}> <BaseInfo.BaseInfoItem label={NoticeSummary}>
2014-07-01~2014-07-31 广州白马皮具交易中心送货计划 {details.digest}
</BaseInfo.BaseInfoItem> </BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={ExternalState}> <BaseInfo.BaseInfoItem label={ExternalState}>
<Tag color='green'>已提交</Tag> <Tag color='green'>{STATUS_NAME[details.status]}</Tag>
</BaseInfo.BaseInfoItem> </BaseInfo.BaseInfoItem>
</BaseInfo> </BaseInfo>
<BaseInfo className='mt-16' title={ShippingInfo.name} id={ShippingInfo.key}> <BaseInfo className='mt-16' title={ShippingInfo.name} id={ShippingInfo.key}>
<BaseInfo.BaseInfoItem label={DeliveryDate}> <BaseInfo.BaseInfoItem label={DeliveryDate}>
2020-08-25 {details.deliveryTime}
</BaseInfo.BaseInfoItem> </BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={ReceivingAddress}> <BaseInfo.BaseInfoItem label={ReceivingAddress}>
<div>李四/18600001999</div> <div>{details.consignee}/{details.phone}</div>
<div>广东省东莞市南城区鸿福东路1068号美居中心6楼 李四/18600001999</div> <div>{details.provinceName}{details.cityName}{details.districtName}{details.streetName}{details.address}</div>
</BaseInfo.BaseInfoItem> </BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={DeliveryTime}> <BaseInfo.BaseInfoItem label={DeliveryTime}>
08:00 至 12:00 {details.deliveryStartTime}{details.deliveryEndTime}
</BaseInfo.BaseInfoItem> </BaseInfo.BaseInfoItem>
</BaseInfo> </BaseInfo>
<BaseInfo className='mt-16' title={DeliveryList.name} id={DeliveryList.key} cols={1}> <BaseInfo className='mt-16' title={DeliveryList.name} id={DeliveryList.key} cols={1}>
{/* SRM 物料列表(DeliveryMaterialsTableColumn), B2B商品列表(DeliveryGoodsTableColumn) */} {/* SRM 物料列表(DeliveryMaterialsTableColumn), B2B商品列表(DeliveryGoodsTableColumn) */}
<Table <StandardTable
rowKey={'id'}
dataSource={[{
id: '1',
'name1': '1',
'name2': '2',
'name3': '3',
'name4': '4',
'name5': '5',
'name6': '6',
'name7': '7',
'name8': '8',
'name9': '6',
},]}
columns={DeliveryMaterialsTableColumn} columns={DeliveryMaterialsTableColumn}
tableProps={{ rowKey: 'id', }}
fetchTableData={(params: any) => fetchData(getOrderDeliveryNoticeOrderDetailPage, { ...params, orderId: id })}
controlRender={<div></div>}
/> />
</BaseInfo> </BaseInfo>
<BaseInfo className='mt-16' title={ExternalRoamRecord.name} id={ExternalRoamRecord.key} cols={1}> <BaseInfo className='mt-16' title={ExternalRoamRecord.name} id={ExternalRoamRecord.key} cols={1}>
<Table <StandardTable
rowKey={'id'}
dataSource={[{
id: '1',
'name1': '1',
'name2': '操作角色',
'name3': '状态',
'name4': '操作',
'name5': '操作时间',
'name6': '备注',
},]}
columns={ExternalRoamRecordTableColumn} columns={ExternalRoamRecordTableColumn}
tableProps={{ rowKey: 'id', }}
fetchTableData={(params: any) => fetchData(getOrderDeliveryNoticeOrderDeliveryHistory, { ...params, id })}
controlRender={<div></div>}
/> />
</BaseInfo> </BaseInfo>
</AnchorPage> </AnchorPage>
) )
} }
export default DeliveryNoticeManagementDetails export default DeliveryNoticeManagementDetails
\ No newline at end of file
/** /**
* 订单能力 - 送货通知单管理 - 送货通知单查询 * 订单能力 - 送货通知单管理 - 送货通知单查询
* @author: Gavin * @author: Gavin
* @description: * @description:
*/ */
import React, { useRef, useState } from 'react' import React, { useRef } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Button, Card, Space, Tag } from 'antd' import { Modal, Card, Space, Tag } from 'antd'
import { history, useIntl } from 'umi';
import StandardTable from '@/components/StandardTable' import StandardTable from '@/components/StandardTable'
import { ColumnType } from 'antd/lib/table' import { ColumnType } from 'antd/lib/table'
import TableOperation from '@/components/TableOperation' import TableOperation from '@/components/TableOperation'
...@@ -15,45 +16,46 @@ ...@@ -15,45 +16,46 @@
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch' import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const' import { FORM_FILTER_PATH } from '@/formSchema/const'
import { deliveryNoticeManagementQuerySchema } from './schema' import { deliveryNoticeManagementQuerySchema } from './schema'
import { getOrderDeliveryNoticeOrderVendorPage } from '@/services/OrderNewV2Api'
import { TAG_STATUS_COLOR, STATUS, STATUS_NAME } from '../constant'
import ToVoidModal, { HandleType } from './components/ToVoidModal'
const tagStatusColor = { const mock = {
// 待提交 totalCount: 4,
2: { color: '#f4f5f7', fontColor: '#5c626a' }, data: [
// 待确认 {id: 1, noticeNo: '2e12e', status: STATUS.WAIT_CONFIRM},
3: { color: '#ecf2fe', fontColor: '#4787f0' }, {id: 2, noticeNo: 'axascac', status: STATUS.WAIT_REVISE},
// 待修订 {id: 3, noticeNo: 'fafa', status: STATUS.HAD_CONFIRM},
4: { color: '#eae6ff', fontColor: '#9963d8' }, {id: 4, noticeNo: 'fasffqw', status: STATUS.HAD_CONFIRM},
// 已确认 ]
5: { color: '#ebf9f6', fontColor: '#00a98f' }, }
// 已生产送货单
6: { color: '#f0f5ff', fontColor: '#f0f5ff' },
// 已作废
7: { color: '#fff2f0', fontColor: '#ff4d4f' },
}
const DeliveryNoticeManagementQuery: React.FC = () => { const DeliveryNoticeManagementQuery: React.FC = () => {
const intl = useIntl()
const ref = useRef<any>({}) const ref = useRef<any>({})
const toVoidModalRef = useRef<HandleType>()
const formActions = createFormActions() const formActions = createFormActions()
const controllerBtns = (<Space></Space>) const controllerBtns = (<Space></Space>)
const renderOptionButton = (record: any) => { const renderOptionButton = (record: any) => {
const btnAuthOfOperationTextMap = { const btnAuthOfOperationTextMap = {
'生送货单': 'DevTest', '生送货单': 'DevTest',
'变更': 'DevTest', '变更': 'DevTest',
'作废': 'DevTest', '作废': 'DevTest',
'查看': 'DevTest', '查看': 'DevTest',
} }
const buttonGroup = { const buttonGroup = {
'生产送货单': true, '生成送货单': [STATUS.HAD_CONFIRM].includes(record.status),
'变更': true, '变更': [STATUS.HAD_CONFIRM].includes(record.status),
'作废': true, '作废': [STATUS.WAIT_CONFIRM, STATUS.WAIT_REVISE, STATUS.HAD_CONFIRM].includes(record.status),
'查看': true, '查看': true,
} }
const operationHandler = { const operationHandler = {
'生产送货单': () => { console.log('生产送货单 :>> ',) }, '生成送货单': () => {},
'变更': () => { console.log('变更 :>> ',) }, '变更': () => { console.log('变更 :>> ',) },
'作废': () => { console.log('作废 :>> ',) }, '作废': () => { toVoidModalRef.current.show(true, record.id) },
'查看': () => { console.log('查看 :>> ',) }, '查看': () => { history.push(`/memberCenter/order/deliveryNoticeManagement/query/details?id=${record.id}`) },
} }
return ( return (
<TableOperation <TableOperation
...@@ -66,22 +68,22 @@ const DeliveryNoticeManagementQuery: React.FC = () => { ...@@ -66,22 +68,22 @@ const DeliveryNoticeManagementQuery: React.FC = () => {
const columns: ColumnType<unknown>[] = [ const columns: ColumnType<unknown>[] = [
{ {
title: '通知单号', title: '通知单号',
dataIndex: 'id', dataIndex: 'noticeNo',
key: 'id', key: 'noticeNo',
width: 160, width: 160,
render: (text: unknown, record: unknown) => <EyePreview url='/memberCenter/order/deliveryNoticeManagement/query/details'>{text}</EyePreview> render: (text: unknown, record: any) => <EyePreview url={`/memberCenter/order/deliveryNoticeManagement/query/details?id=${record.id}`}>{text}</EyePreview>
}, },
{ title: '通知单摘要', dataIndex: 'id2', key: 'id2' }, { title: '通知单摘要', dataIndex: 'digest', key: 'digest' },
{ title: '送货日期', dataIndex: 'id3', key: 'id3' }, { title: '送货日期', dataIndex: 'deliveryTime', key: 'deliveryTime' },
{ title: '采购会员', dataIndex: 'id5', key: 'id5' }, { title: '采购会员', dataIndex: 'memberName', key: 'memberName' },
{ title: '单据时间', dataIndex: 'id4', key: 'id4' }, { title: '单据时间', dataIndex: 'createTime', key: 'createTime' },
{ {
title: '外部状态', title: '外部状态',
dataIndex: 'id6', dataIndex: 'status',
key: 'id6', key: 'status',
render: (text: string, record: any) => ( render: (text: string, record: any) => (
<Tag color={tagStatusColor[record.id]?.color}> <Tag color={TAG_STATUS_COLOR[text]?.color}>
<span style={{ color: tagStatusColor[record.id]?.fontColor }}>{text}</span> <span style={{ color: TAG_STATUS_COLOR[text]?.fontColor }}>{STATUS_NAME[text]}</span>
</Tag> </Tag>
) )
}, },
...@@ -94,22 +96,14 @@ const DeliveryNoticeManagementQuery: React.FC = () => { ...@@ -94,22 +96,14 @@ const DeliveryNoticeManagementQuery: React.FC = () => {
}, },
] ]
const fetchData = (params: unknown) => { const fetchData = (params: any) => {
console.log('params :>> ', params);
return new Promise((resolve) => { return new Promise((resolve) => {
const data = { getOrderDeliveryNoticeOrderVendorPage(params).then(({ code, data }) => {
totalCount: 1, data: [ if (code === 1000) {
{ id: 1, id2: 2, id3: 3, id4: 4, id5: 5, id6: 6 }, resolve(data)
{ id: 2, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, // resolve(mock)
{ id: 3, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, }
{ id: 4, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }, })
{ id: 5, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
{ id: 6, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
{ id: 7, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
{ id: 8, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
]
}
resolve(data)
}) })
} }
...@@ -133,7 +127,7 @@ const DeliveryNoticeManagementQuery: React.FC = () => { ...@@ -133,7 +127,7 @@ const DeliveryNoticeManagementQuery: React.FC = () => {
useStateFilterSearchLinkageEffect( useStateFilterSearchLinkageEffect(
$, $,
actions, actions,
'planCode', 'noticeNo',
FORM_FILTER_PATH, FORM_FILTER_PATH,
) )
}} }}
...@@ -142,6 +136,11 @@ const DeliveryNoticeManagementQuery: React.FC = () => { ...@@ -142,6 +136,11 @@ const DeliveryNoticeManagementQuery: React.FC = () => {
} }
/> />
</Card> </Card>
<ToVoidModal
ref={toVoidModalRef}
onOk={() => ref.current.reload()}
/>
</PageHeaderWrapper> </PageHeaderWrapper>
) )
} }
......
...@@ -26,7 +26,7 @@ export const deliveryNoticeManagementQuerySchema: ISchema = { ...@@ -26,7 +26,7 @@ export const deliveryNoticeManagementQuerySchema: ISchema = {
children: '{{controllerBtns}}', children: '{{controllerBtns}}',
}, },
}, },
planCode: { noticeNo: {
type: 'string', type: 'string',
'x-component': 'Search', 'x-component': 'Search',
'x-component-props': { 'x-component-props': {
...@@ -48,25 +48,25 @@ export const deliveryNoticeManagementQuerySchema: ISchema = { ...@@ -48,25 +48,25 @@ export const deliveryNoticeManagementQuerySchema: ISchema = {
}, },
}, },
properties: { properties: {
abstract: { digest: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
allowClear: true, allowClear: true,
placeholder: '通知单摘要' placeholder: '通知单摘要'
} }
}, },
'[startTime, endTime]': { '[startDate, endDate]': {
type: 'daterange', type: 'daterange',
'x-component-props': { 'x-component-props': {
allowClear: true, allowClear: true,
placeholder: ['送货开始日期', '送货结束日期'], placeholder: ['送货开始日期', '送货结束日期'],
}, },
}, },
supplyMember: { memberName: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
allowClear: true, allowClear: true,
placeholder: '供应会员' placeholder: '采购会员'
} }
}, },
submit: { submit: {
...@@ -83,4 +83,4 @@ export const deliveryNoticeManagementQuerySchema: ISchema = { ...@@ -83,4 +83,4 @@ export const deliveryNoticeManagementQuerySchema: ISchema = {
} }
} }
} }
} }
\ No newline at end of file
...@@ -16,6 +16,7 @@ export const fetchOrderApi = { ...@@ -16,6 +16,7 @@ export const fetchOrderApi = {
/** 请购单物料 获取商品货品列表 */ /** 请购单物料 获取商品货品列表 */
async getPurchaseRequesitionMaterielList(params) { async getPurchaseRequesitionMaterielList(params) {
params.materialGroupId = params.materialGroupId ? params.materialGroupId?.pop() :''
const { data } = await getProductGoodsGetGoodsList(params) const { data } = await getProductGoodsGetGoodsList(params)
return data return data
}, },
......
...@@ -8,13 +8,16 @@ import Search from '@/components/NiceForm/components/Search' ...@@ -8,13 +8,16 @@ import Search from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit'; import Submit from '@/components/NiceForm/components/Submit';
import Children from '@/components/NiceForm/components/Children'; import Children from '@/components/NiceForm/components/Children';
import { addRequesitionMaterialSchema } from '../../schema/modal' import { addRequesitionMaterialSchema } from '../../schema/modal'
import { Tooltip } from 'antd' import { Cascader, Tooltip } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons' import { QuestionCircleOutlined } from '@ant-design/icons'
import { clearModalParams } from '@/utils' import { clearModalParams } from '@/utils'
import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch' import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch'
import CustomInputSearch from '@/components/NiceForm/components/CustomInputSearch' import CustomInputSearch from '@/components/NiceForm/components/CustomInputSearch'
import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from '../../effects' import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from '../../effects'
import { useIntl, getIntl } from 'umi' import { useIntl, getIntl } from 'umi'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { getProductMaterialGroupTree } from '@/services/ProductV2Api'
import { fetchTreeData, useAsyncCascader } from './useGetTableSearchData'
export interface MaterialModalTableProps extends ModalTableProps { export interface MaterialModalTableProps extends ModalTableProps {
type?: 'radio' | 'checkbox', type?: 'radio' | 'checkbox',
...@@ -46,6 +49,17 @@ export const materialColumns: any[] = [ ...@@ -46,6 +49,17 @@ export const materialColumns: any[] = [
key: 'name', key: 'name',
}, },
{ {
title: "物料组",
dataIndex: 'materialGroup',
align: 'center',
key: 'materialGroup',
render: (text, record) => {
return (
<div>{record.name}</div>
)
}
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.guigexinghao', defaultMessage: '规格型号' }), title: getIntl().formatMessage({ id: 'purchaseRequisition.guigexinghao', defaultMessage: '规格型号' }),
dataIndex: 'type', dataIndex: 'type',
align: 'center', align: 'center',
...@@ -71,7 +85,7 @@ export const materialColumns: any[] = [ ...@@ -71,7 +85,7 @@ export const materialColumns: any[] = [
}, },
] ]
const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => { const MaterialModalTable: React.FC<MaterialModalTableProps> = (props) => {
const intl = useIntl() const intl = useIntl()
const { type = 'checkbox', schemaAction, confirmModal, currentRef, sectionProps, ...restProps } = props const { type = 'checkbox', schemaAction, confirmModal, currentRef, sectionProps, ...restProps } = props
const { visible, setVisible, rowSelection, rowSelectionCtl } = sectionProps const { visible, setVisible, rowSelection, rowSelectionCtl } = sectionProps
...@@ -89,11 +103,11 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => { ...@@ -89,11 +103,11 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
const addMaterialProcessField = (value, origin) => { const addMaterialProcessField = (value, origin) => {
let tempOriginData = [...origin] let tempOriginData = [...origin]
// 对选中值去重 // 对选中值去重
const _value = Object.values(value.reduce((item, next)=>{ const _value = Object.values(value.reduce((item, next) => {
item[next.id] = next item[next.id] = next
return item return item
},{})) }, {}))
if(Array.isArray(_value)) { if (Array.isArray(_value)) {
let processData = _value.map(v => { let processData = _value.map(v => {
let temp: any = {}; let temp: any = {};
temp.id = v.id; temp.id = v.id;
...@@ -108,7 +122,7 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => { ...@@ -108,7 +122,7 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
}) })
let originIds = tempOriginData.map(item => item.id) let originIds = tempOriginData.map(item => item.id)
processData.map(item => { processData.map(item => {
if(!originIds.includes(item.id)) { if (!originIds.includes(item.id)) {
tempOriginData.push(item) tempOriginData.push(item)
} }
}) })
...@@ -123,14 +137,14 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => { ...@@ -123,14 +137,14 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
setVisible(false) setVisible(false)
clearModalParams() clearModalParams()
} }
// http://10.0.0.25:4000/project/1301/interface/api/189388
const handleCancel = () => { const handleCancel = () => {
setVisible(false) setVisible(false)
clearModalParams() clearModalParams()
} }
const otherHandle = <> const otherHandle = <>
<a className="ant-btn" href="/memberCenter/commodityAbility/commodity/goods/add" target="_blank" style={{marginRight: 16}}>{intl.formatMessage({ id: 'purchaseRequisition.xinzenghuopin', defaultMessage: '新增货品' })}</a> <a className="ant-btn" href="/memberCenter/commodityAbility/commodity/goods/add" target="_blank" style={{ marginRight: 16 }}>{intl.formatMessage({ id: 'purchaseRequisition.xinzenghuopin', defaultMessage: '新增货品' })}</a>
<Tooltip title={intl.formatMessage({ id: 'purchaseRequisition.dianjichaxun', defaultMessage: '点击查询,列表可显示新增的物料' })}> <Tooltip title={intl.formatMessage({ id: 'purchaseRequisition.dianjichaxun', defaultMessage: '点击查询,列表可显示新增的物料' })}>
<QuestionCircleOutlined /> <QuestionCircleOutlined />
</Tooltip> </Tooltip>
...@@ -146,7 +160,7 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => { ...@@ -146,7 +160,7 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
cancel={handleCancel} cancel={handleCancel}
fetchTableData={fetchOrderApi.getPurchaseRequesitionMaterielList} fetchTableData={fetchOrderApi.getPurchaseRequesitionMaterielList}
rowSelection={rowSelection} rowSelection={rowSelection}
resetModal={{destroyOnClose: true}} resetModal={{ destroyOnClose: true }}
modalType='none' modalType='none'
tableProps={{ tableProps={{
rowKey: 'id', rowKey: 'id',
...@@ -158,33 +172,35 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => { ...@@ -158,33 +172,35 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
}) })
}} }}
formilyProps={{ formilyProps={{
ctx: { ctx: {
schema: addRequesitionMaterialSchema, schema: addRequesitionMaterialSchema,
components: { components: {
ModalSearch: Search, ModalSearch: Search,
Submit, Submit,
Children, Children,
CustomInputSearch, CustomInputSearch,
CustomCategorySearch CustomCategorySearch,
}, Cascader
effects: ($, actions) => { },
useStateFilterSearchLinkageEffect( effects: ($, actions) => {
$, useStateFilterSearchLinkageEffect(
actions, $,
'code', actions,
FORM_FILTER_PATH, 'code',
); FORM_FILTER_PATH,
FormEffectHooks.onFieldChange$('brandId').subscribe(() => { );
searchBrandOptionEffect(actions, 'brandId') useAsyncCascader('materialGroupId', fetchTreeData)
}) FormEffectHooks.onFieldChange$('brandId').subscribe(() => {
FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(() => { searchBrandOptionEffect(actions, 'brandId')
searchCustomerCategoryOptionEffect(actions, 'customerCategoryId') })
}) FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(() => {
}, searchCustomerCategoryOptionEffect(actions, 'customerCategoryId')
expressionScope: { })
otherHandle },
} expressionScope: {
otherHandle
} }
}
}} }}
{...restProps} {...restProps}
/> />
......
import { getProductMaterialGroupTree } from "@/services/ProductV2Api"
import { createFormActions, FormEffectHooks, FormPath } from "@formily/antd"
const { onFormMount$ } = FormEffectHooks
const EMPTY_ARRAY = []
export const EMPTY = {
totalCount: 0,
data: [],
}
export const useAsyncCascader = async (name, service: () => Promise<any[]>) => {
const { setFieldState } = createFormActions()
onFormMount$().subscribe(() => {
service().then(res => {
setFieldState(name, state => {
FormPath.setIn(state, 'props.x-component-props.options', res)
})
}).catch(err => {
setFieldState(name, state => {
FormPath.setIn(state, 'props.x-component-props.options', [])
})
})
})
}
export const fetchTreeData = async () => {
try {
const { data, code } = await getProductMaterialGroupTree({ rootNodeId: '0' });
if (code === 1000) {
return data;
}
return EMPTY_ARRAY
} catch {
return EMPTY_ARRAY
}
}
...@@ -4,4 +4,19 @@ ...@@ -4,4 +4,19 @@
width: 100%; width: 100%;
} }
} }
.RadioMian{
display: flex;
.RadioItem{
border-radius: 4px;
background: #F5F6F7;
padding: 5px 10px;
margin-right: 10px;
}
.Select{
background: rgba(0,169,143,0.04);
border: 1px solid #00A98F;
}
}
} }
import React, { useRef, useState, useEffect } from 'react' import React, { useRef, useState, useEffect, useMemo } from 'react'
import { history, useIntl } from 'umi' import { history, useIntl } from 'umi'
import { usePageStatus } from '@/hooks/usePageStatus' import { usePageStatus } from '@/hooks/usePageStatus'
import { Button, Col, message, Row, Select, Upload } from 'antd' import { Button, Col, message, Radio, Row, Select, Upload } from 'antd'
import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd' import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd'
import { SaveOutlined, LinkOutlined, UploadOutlined } from '@ant-design/icons' import { SaveOutlined, LinkOutlined, UploadOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm' import NiceForm from '@/components/NiceForm'
...@@ -26,6 +26,7 @@ import { UPLOAD_TYPE } from '@/constants' ...@@ -26,6 +26,7 @@ import { UPLOAD_TYPE } from '@/constants'
import styles from './index.less' import styles from './index.less'
import { getAuth } from '@/utils/auth' import { getAuth } from '@/utils/auth'
const addSchemaAction = createFormActions() const addSchemaAction = createFormActions()
const { Option } = Select; const { Option } = Select;
const RowStyle = styled(props => <Row style={{ marginTop: 12, justifyContent: "flex-end" }} justify='end' {...props}> const RowStyle = styled(props => <Row style={{ marginTop: 12, justifyContent: "flex-end" }} justify='end' {...props}>
...@@ -71,6 +72,9 @@ const IncreaseRequisition: React.FC<{}> = () => { ...@@ -71,6 +72,9 @@ const IncreaseRequisition: React.FC<{}> = () => {
const [initFormValue, setInitFormValue] = useState<any>({}) const [initFormValue, setInitFormValue] = useState<any>({})
const { formContext } = useFormDetail() const { formContext } = useFormDetail()
const rowvendorMemberInfoRef = useRef<any>({}); const rowvendorMemberInfoRef = useRef<any>({});
const deliveryTypeListRef = useRef<any>({});
const [deliveryType, setdeliveryType] = useState('');
const [deliveryTypeList, setdeliveryTypeList] = useState([]);
const intl = useIntl() const intl = useIntl()
// 请购单物料 // 请购单物料
...@@ -81,37 +85,60 @@ const IncreaseRequisition: React.FC<{}> = () => { ...@@ -81,37 +85,60 @@ const IncreaseRequisition: React.FC<{}> = () => {
setFormLoading(true) setFormLoading(true)
getPurchaseRequisitionDetail({ id }).then((res: any) => { getPurchaseRequisitionDetail({ id }).then((res: any) => {
const { data } = res const { data } = res
console.log(data, 'data')
const _orderProductRequests = procurementRenderField(data) const _orderProductRequests = procurementRenderField(data)
addSchemaAction.setFieldState('deliveryAddressId', state => { addSchemaAction.setFieldState('deliveryAddressId', state => {
state.props.isDefaultAddress = false; state.props.isDefaultAddress = false;
state.visible = data.deliveryMethod == 1 ? true : false;
});
addSchemaAction.setFieldState('deliveryAddress', state => {
state.visible = data.deliveryMethod != 1 ? true : false;
}); });
if (data.deliveryType) {
if (data.deliveryMethod == 1) {
deliveryTypeListRef.current.deliveryTypeList = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: false } })
setdeliveryTypeList(deliveryTypeListRef.current.deliveryTypeList)
}
if (data.deliveryMethod == 2) {
deliveryTypeListRef.current.deliveryTypeList = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: item.disabled = item.deliveryTypeName == '直送客户' ? true : false } })
setdeliveryTypeList(deliveryTypeListRef.current.deliveryTypeList)
}
addSchemaAction.setFieldState('deliveryType', state => {
state.visible = true;
});
setdeliveryType(data.deliveryType)
}
setInitFormValue(() => procurmentRenderInit(data)) setInitFormValue(() => procurmentRenderInit(data))
setTimeout(() => { setTimeout(() => {
addSchemaAction.setFieldValue('products', _orderProductRequests) addSchemaAction.setFieldValue('products', _orderProductRequests)
addSchemaAction.setFieldValue('attachments', data.attachments) addSchemaAction.setFieldValue('attachments', data.attachments)
addSchemaAction.setFieldValue('deliveryAddressId', data.receiverAddressResponse) addSchemaAction.setFieldValue('deliveryAddressId', data.receiverAddressResponse)
addSchemaAction.setFieldValue('deliveryType', data.deliveryType)
}, 500) }, 500)
setFormLoading(false) setFormLoading(false)
}) })
} else { } else {
const userInfo = getAuth(); const userInfo: any = getAuth();
addSchemaAction.setFieldValue('requisitioner', userInfo.name) addSchemaAction.setFieldValue('requisitioner', userInfo.name)
addSchemaAction.setFieldValue('requisitionerId', userInfo.userId) addSchemaAction.setFieldValue('requisitionerId', userInfo.userId)
if (userInfo.orgId && userInfo.orgName) {
addSchemaAction.setFieldValue('vendorMemberName', userInfo.orgName || '')
addSchemaAction.setFieldValue('deliveryType', userInfo.orgId || '')
}
} }
}, []) }, [])
const setLik = (row) => { const setLik = (row) => {
console.log(row)
rowvendorMemberInfoRef.current = row; rowvendorMemberInfoRef.current = row;
} }
const Jump = () => { const Jump = () => {
if (Object.keys(rowvendorMemberInfoRef.current).length) { if (Object.keys(rowvendorMemberInfoRef.current).length) {
history.push(`/memberAbility/manage/maintain/detail/basicInfo?id=${rowvendorMemberInfoRef.current.memberId}&validateId=${rowvendorMemberInfoRef.current.id}`) history.push(`/memberCenter/memberAbility/manage/maintain/detail/basicInfo?id=${rowvendorMemberInfoRef.current.memberId}&validateId=${rowvendorMemberInfoRef.current.id}`)
} }
} }
// 供应会员 // 供应会员
...@@ -174,6 +201,27 @@ const IncreaseRequisition: React.FC<{}> = () => { ...@@ -174,6 +201,27 @@ const IncreaseRequisition: React.FC<{}> = () => {
const handleOrderMember = () => { const handleOrderMember = () => {
memberRef.current.setVisible(true) memberRef.current.setVisible(true)
} }
// 配送方式
const changeDeliveryType = (e) => {
addSchemaAction.setFieldValue('deliveryType', e.target.value)
}
// 自定义组建
const RadioNode = () => {
return (
<Radio.Group onChange={changeDeliveryType} defaultValue={id ? deliveryType : ""}>
<div className={styles.RadioMian}>
{
deliveryTypeList.map((item) => (
<div className={`${styles.RadioItem} ${item.deliveryType == deliveryType ? styles.Select : ''}`} key={item.deliveryType}>
<Radio value={item.deliveryType} disabled={item.disabled}>{item.deliveryTypeName}</Radio>
</div>
))
}
</div>
</Radio.Group>
)
}
const memberBtn = <div className='connectBtn' onClick={handleOrderMember}><LinkOutlined style={{ marginRight: 4 }} />{intl.formatMessage({ id: 'purchaseRequisition.xuanze', defaultMessage: '选择' })}</div> const memberBtn = <div className='connectBtn' onClick={handleOrderMember}><LinkOutlined style={{ marginRight: 4 }} />{intl.formatMessage({ id: 'purchaseRequisition.xuanze', defaultMessage: '选择' })}</div>
...@@ -278,10 +326,12 @@ const IncreaseRequisition: React.FC<{}> = () => { ...@@ -278,10 +326,12 @@ const IncreaseRequisition: React.FC<{}> = () => {
} }
const fetchOptions = (service) => { const fetchOptions = (service) => {
console.log(service, 'service')
return async function () { return async function () {
const res = await service(); const res = await service();
if (res.code === 1000) { if (res.code === 1000) {
const deliveryTypeList = res.data.deliveryTypes.map(item => { return { ...item, disabled: true } })
deliveryTypeListRef.current.deliveryTypeList = deliveryTypeList;
setdeliveryTypeList(deliveryTypeList)
return res.data.deliveryMethods.map((item) => { return { label: item.deliveryMethodName, value: item.deliveryMethod } }) return res.data.deliveryMethods.map((item) => { return { label: item.deliveryMethodName, value: item.deliveryMethod } })
} }
return []; return [];
...@@ -334,6 +384,9 @@ const IncreaseRequisition: React.FC<{}> = () => { ...@@ -334,6 +384,9 @@ const IncreaseRequisition: React.FC<{}> = () => {
actions={addSchemaAction} actions={addSchemaAction}
schema={increaseSchema} schema={increaseSchema}
onSubmit={handleSubmit} onSubmit={handleSubmit}
components={{
RadioNode
}}
effects={($, ctx) => { effects={($, ctx) => {
$('onFormMount').subscribe(() => { }) $('onFormMount').subscribe(() => { })
useEditHideField() useEditHideField()
...@@ -351,20 +404,39 @@ const IncreaseRequisition: React.FC<{}> = () => { ...@@ -351,20 +404,39 @@ const IncreaseRequisition: React.FC<{}> = () => {
formContext.useAttachmentChangeForContext(ctx) formContext.useAttachmentChangeForContext(ctx)
$('onFieldChange', 'deliveryMethod').subscribe(res => { $('onFieldChange', 'deliveryMethod').subscribe(res => {
if (res.value === 2) {
if (res.values[1]?.title === "物流") {
deliveryTypeListRef.current.deliveryTypeList = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: false } })
setdeliveryTypeList(deliveryTypeListRef.current.deliveryTypeList)
addSchemaAction.setFieldState('deliveryAddress', state => { addSchemaAction.setFieldState('deliveryAddress', state => {
state.visible = false; state.visible = false;
}); });
addSchemaAction.setFieldValue('deliveryType', "")
addSchemaAction.setFieldState('deliveryAddressId', state => { addSchemaAction.setFieldState('deliveryAddressId', state => {
state.visible = true; state.visible = true;
}); });
} else { addSchemaAction.setFieldState('deliveryType', state => {
state.visible = true;
});
} if (res.values[1]?.title === "自提") {
deliveryTypeListRef.current.deliveryTypeList = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: item.disabled = item.deliveryTypeName == '直送客户' ? true : false } })
setdeliveryTypeList(deliveryTypeListRef.current.deliveryTypeList)
addSchemaAction.setFieldState('deliveryType', state => {
state.visible = true;
});
addSchemaAction.setFieldValue('deliveryType', "")
} if (res.values[1]?.title === "无需配送") {
deliveryTypeListRef.current.deliveryTypeList = deliveryTypeListRef.current.deliveryTypeList && deliveryTypeListRef.current?.deliveryTypeList.map(item => { return { ...item, disabled: true } })
setdeliveryTypeList(deliveryTypeListRef.current.deliveryTypeList)
addSchemaAction.setFieldState('deliveryAddress', state => { addSchemaAction.setFieldState('deliveryAddress', state => {
state.visible = true; state.visible = true;
}); });
addSchemaAction.setFieldState('deliveryAddressId', state => { addSchemaAction.setFieldState('deliveryAddressId', state => {
state.visible = false; state.visible = false;
}); });
addSchemaAction.setFieldValue('deliveryType', "")
} }
}) })
...@@ -380,6 +452,7 @@ const IncreaseRequisition: React.FC<{}> = () => { ...@@ -380,6 +452,7 @@ const IncreaseRequisition: React.FC<{}> = () => {
enclosureColumns, enclosureColumns,
enclosureColumnsButton, enclosureColumnsButton,
vendorMemberNameNode, vendorMemberNameNode,
}} }}
/> />
......
...@@ -187,6 +187,16 @@ const delivery: ISchema = { ...@@ -187,6 +187,16 @@ const delivery: ISchema = {
span: 1 span: 1
} }
}, },
deliveryType: {
type: 'string',
visible:false,
title: "客户配送方式",
"x-component": 'RadioNode',
"x-component-props": {
span: 1,
},
},
// //
deliveryAddressId: { deliveryAddressId: {
visible:false, visible:false,
......
...@@ -66,6 +66,17 @@ import { getIntl } from 'umi'; ...@@ -66,6 +66,17 @@ import { getIntl } from 'umi';
fieldNames: { label: 'title', value: 'id', children: 'children' }, fieldNames: { label: 'title', value: 'id', children: 'children' },
}, },
}, },
materialGroupId: {
type: 'string',
'x-component': 'Cascader',
'x-component-props': {
placeholder: '物料组',
allowClear: true,
fieldNames: { label: 'title', value: 'id', children: 'children' },
style: { width: '150px' },
showSearch: true
},
},
type: { type: {
type: 'string', type: 'string',
"x-component-props": { "x-component-props": {
......
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