Commit eb13eca7 authored by 前端-许佳敏's avatar 前端-许佳敏

Merge branch 'v2-220418' of…

Merge branch 'v2-220418' of ssh://gitlab.shushangyun.com:8122/linkseeks-design/pro-platform into v2-220418
parents ff5d35f8 21178661
......@@ -29,7 +29,7 @@ export default {
// Font-size
'@font-size-base': '12px',
'@font-size-lg': '14px',
'@font-size-lg': '16px',
'@font-size-sm': '12px',
// Layout
......
......@@ -47,8 +47,8 @@ const homeRoute = {
],
};
// isDev ? [ homeRoute, OrderRoute ] :
const routes = asyncRoutes;
// const routes = isDev ? [ homeRoute, OrderRoute ] : asyncRoutes;
// const routes = asyncRoutes;
const routes = isDev ? [ homeRoute, OrderRoute ] : asyncRoutes;
const memberCenterRoute = {
path: '/memberCenter',
......
......@@ -2,6 +2,7 @@ import { debounceFn, throttleFn } from '@/utils/throttleFn';
import { useDebounce } from '@umijs/hooks';
import { Button, Col, Drawer, Form, FormInstance, Input, Radio, Row, Select, Space } from 'antd';
import React, { useContext, useEffect, useState } from 'react';
import { FormatValue } from '.';
import AddressForm from './AddressForm';
import AddressRaio, { AddressRaioContext, AddressRaioContextProvider } from './AddressRaio';
import AreaSet from './AreaSet';
......@@ -38,7 +39,8 @@ interface AddressDrawerProps {
title: {
name: string,
label: string
}
},
className?: string
}
function AddressDrawer(props: AddressDrawerProps) {
......@@ -47,9 +49,10 @@ function AddressDrawer(props: AddressDrawerProps) {
addressListRequest, value: addr, disabled = false, rows = 1,
showDefault = false,
formatValue = (addr) => {
return `${addr?.fullAddress ?? ''} ${addr?.shipperName ? addr?.shipperName ?? '' : addr?.receiverName ?? ''} ${addr?.phone ?? ''}`
return FormatValue(addr)
},
title
title,
className
} = props;
const [visible, setVisible] = useState<boolean>(false);
......@@ -57,7 +60,7 @@ function AddressDrawer(props: AddressDrawerProps) {
const [value, setValue] = useState(addr);
const [addrForm] = Form.useForm(formInstance);
const [addrList, setAddrList] = useState([]);
const [flash,setFlash] = useState(false);
const [flash, setFlash] = useState(false);
const handleInputChangeHooks = debounceFn((str) => {
......@@ -162,7 +165,7 @@ function AddressDrawer(props: AddressDrawerProps) {
return (
<AddressRaioContextProvider value={addrList}>
<Row gutter={10}>
<Row className={className} gutter={10}>
<Col span={20}>
<Input.TextArea rows={rows} disabled={disabled}
value={value}
......
......@@ -6,10 +6,10 @@ export { default as AddressDrawer } from './AddressDrawer'
export const ReceiverAddress = (props) => {
return (
<AddressDrawer
title={{
label: '收货人',
name: 'receiverName'
}}
title={{
label: '收货人',
name: 'receiverName'
}}
{...props}
addressListRequest={(val) => {
return getLogisticsSelectListReceiverAddress(val)
......@@ -53,4 +53,10 @@ export const ShipperAddress = (props) => {
}}
/>
)
}
export const FormatValue = (addr) => {
let result = `${addr?.fullAddress ?? ''} ${addr?.shipperName ? addr?.shipperName ?? '' : addr?.receiverName ?? ''} ${addr?.phone ?? ''}`
console.log(result);
return result
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ interface DatePickerSelectProps {
className?: string
value?: any
disabled?: boolean
hidden?: boolean
}
/**
......@@ -18,7 +19,7 @@ interface DatePickerSelectProps {
*/
function DatePickerSelect(props: DatePickerSelectProps) {
const { defualtToday = false, onChange, className, value, disabled = false } = props;
const { defualtToday = false, onChange, className, value, disabled = false, hidden = false } = props;
const disabledDate = (current) => {
return current && current < moment().startOf('day');
......@@ -37,6 +38,9 @@ function DatePickerSelect(props: DatePickerSelectProps) {
return (
<DatePicker
style={{
display: hidden ? 'none' : 'block'
}}
className={className}
disabledDate={disabledDate}
disabled={disabled}
......
......@@ -69,8 +69,28 @@ const CustomColumnsConfigureModal: React.ForwardRefRenderFunction<CustomColumnsC
}
return columnsSource.find((column) => column.dataIndex === item)!;
}).filter(Boolean);
const fixedLeftItems: SortableColumnType<any>[] = [];
const fixedRightItems: SortableColumnType<any>[] = [];
const fixedNormalItems: SortableColumnType<any>[] = [];
// 重现排序
for (let i = 0; i < newInnerColumns.length; i++) {
const item = newInnerColumns[i];
if (item.fixed && item.fixed === 'left') {
fixedLeftItems.push(item);
continue;
}
if (item.fixed && item.fixed === 'right') {
fixedRightItems.push(item);
continue;
}
fixedNormalItems.push(item);
}
const compouned = [...fixedLeftItems, ...fixedNormalItems, ...fixedRightItems];
setChecks(value);
setInnerColumns(newInnerColumns);
setInnerColumns(compouned);
};
const handleClose = (dataIndex: string) => {
......
......@@ -13,8 +13,8 @@ export default function usePrompt() {
)
}
const handleLeave = () => {
setIsFormChange(true)
const handleLeave = (isFormChange = true) => {
setIsFormChange(isFormChange)
}
return {
......
......@@ -31,6 +31,14 @@ class NoteSrmService {
})
}
formatAddress(data) {
return {
...data,
shipperName: data?.consignee,
fullAddress: data?.provinceName ?? '' + data?.cityName ?? '' + data?.districtName ?? '' + data?.streetName ?? ''
}
}
formatField(data) {
let formField = {
digest: data?.digest,
......@@ -75,7 +83,8 @@ class NoteSrmService {
outerHistoryList: data?.outerHistoryList,
deliveryNo: data?.deliveryNo
}
console.log(formField);
return formField
}
......
......@@ -38,7 +38,8 @@ export class HandleFormSubmit {
return (
{
...v,
deliveryCount: Number(v.deliveryCount)
deliveryCount: Number(v.deliveryCount),
receiveCount: Number(v.receiveCount)
}
)
});
......@@ -83,7 +84,7 @@ export class HandleFormSubmit {
let formField = {
digest: data?.digest,
remark: data?.remark,
sourceNo:data?.sourceNo,
sourceNo: data?.sourceNo,
member: {
buyerMemberId: data?.buyerMemberId,
buyerMemberName: data?.buyerMemberName,
......@@ -264,22 +265,30 @@ export class DeliveryNoteB2bUploadService extends DeliveryNoteUploadService {
export class ReceiveOrderCreate extends DeliveryNoteAddService {
handleBeforeFields(): boolean {
return false;
return false;
}
handleBeforeRequestParamas(...arg) {
return {
...arg[0],
receiveTime: arg[0].deliveryTime + " " + arg[0].deliveryEndTime,
products: arg[1].products.map(v => {
products: this.getTableData().map(v => {
return {
deliveryOrderProductId: v.id,
receiveCount: Number(v.deliveryCount)
receiveCount: Number(v.receiveCount ? v.receiveCount : v.deliveryCount)
}
})
}
}
validateFormFields(): Promise<any> {
return this.getForm().validateFields().then(values => {
values = HandelFormFieldsKeyValue(values)
values.receiveTime = values.receiveTime + ' 08:00:00'
var params = this.handleBeforeRequestParamas(values);
return this.getSubmitRequest()(params)
})
}
getSubmitRequest(): (vals: any) => Promise<any> {
return postOrderReceiveOrderCreate
}
......
......@@ -96,12 +96,10 @@ const Remarks: AnchorsItem = {
}
const DeliveryNoteQuery: AnchorsItem[] = [
BaseInfo,
Harvest,
BillsInfo,
Distribution,
DeliveryInfo,
LogisticsInfo,
Material,
ExternalRoamRecord
]
const DeliveryPlanDetails: AnchorsItem[] = [
......@@ -130,7 +128,7 @@ const DeliveryPlanCollaborationAnchors: AnchorsItem[] = [
// deliveryNoticeManagement -> deliveryNoticeDetaitls
const DeliveryNoticeDetaitlsAnchors: AnchorsItem[] =[
DeliveryNoticeCirculation,
Circulation,
BaseInfo,
ShippingInfo,
// Material,
......
......@@ -30,7 +30,7 @@ const ReceivingNoteQuery: React.FC = () => {
const controllerBtns = (<Space></Space>)
const renderOptionButton = (r: any) => {
const btnAuthOfOperationTextMap = {
'查看': 'DevTest',
'查看': 'deliveryNoticeManageSRM.looking',
}
const buttonGroup = {
'查看': true,
......
......@@ -13,7 +13,7 @@ import { DeliveryMaterialsTableColumn, DeliveryGoodsTableColumn, ExternalRoamRec
import { getOrderDeliveryNoticeOrderDeliveryHistory, getOrderDeliveryNoticeOrderDetail, getOrderDeliveryNoticeOrderDetailPage, postOrderDeliveryNoticeOrderConfirm } from '@/services/OrderNewV2Api'
import StandardTable from '@/components/StandardTable'
import CustomizedModal from '../../components/customizedModal'
import { STATUS_NAME, STATUS, ORDER_TYPE } from '../../constants/deliveryNotice'
import { STATUS_NAME, STATUS, ORDER_TYPE, TAG_STATUS_COLOR } from '../../constants/deliveryNotice'
import AuthButton from '@/components/AuthButton'
enum PAGE_TYPE {
......@@ -47,12 +47,6 @@ const DeliveryNoticeAwaitDetails: React.FC = () => {
const id = history.location?.query?.id
const type = history.location?.query?.type
const [iAnchors, setiAnchors] = useState<AnchorsItem[]>([
Circulation,
base_info,
ShippingInfo,
ExternalRoamRecord,
])
const [details, setDetails] = useState<any>({})
const [historyData, setHistoryData] = useState<any>([])
const [loading, setLoading] = useState<boolean>(false)
......@@ -111,8 +105,8 @@ const DeliveryNoticeAwaitDetails: React.FC = () => {
return (
<AnchorPage
// title={details?.noticeNo || '送货通知单管理 - 送货通知单详情'}
title='确认送货通知单'
title={details?.noticeNo || '送货通知单管理 - 送货通知单详情'}
// title='确认送货通知单'
onBack={() => history.goBack()}
anchors={getConst(details.type, deliveryLen).Anchors}
extra={
......@@ -125,7 +119,7 @@ const DeliveryNoticeAwaitDetails: React.FC = () => {
</AuthButton>
}
>
<BaseInfo className='mt-0' title='送货通知单外部流转' id={Circulation.key} cols={1}>
<BaseInfo className='mt-0' title={Circulation.name} id={Circulation.key} cols={1}>
<Steps progressDot current={details?.outerStatus - 1}>
<Steps.Step title={Supplier} description={SubmitDeliveryNotice} />
<Steps.Step title={Purchaser} description={ConfirmDeliveryNotice} />
......@@ -142,7 +136,9 @@ const DeliveryNoticeAwaitDetails: React.FC = () => {
{details.digest}
</BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={ExternalState}>
<Tag color='green'>{STATUS_NAME[details.status]}</Tag>
<Tag color={TAG_STATUS_COLOR[details.status]?.color}>
<span style={{ color: TAG_STATUS_COLOR[details.status]?.fontColor }}>{STATUS_NAME[details.status]}</span>
</Tag>
</BaseInfo.BaseInfoItem>
</BaseInfo>
<BaseInfo className='mt-16' title={ShippingInfo.name} id={ShippingInfo.key}>
......
......@@ -212,6 +212,7 @@ const DeliveryNoticeManagementAwaitB2BDetails: React.FC<PropsType> = ({ type, id
]
!planData && columns.push({
title: "操作",
align: 'center',
render: (t, r, i) => {
return (
<Button type='link' onClick={() => handleRemoveMaterialTableRow(i)}>删除</Button>
......
......@@ -6,21 +6,24 @@
import React, { useEffect, useState } from 'react'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { history, useLocation } from 'umi'
import { Circulation, DeliveryNoticeDetaitlsAnchors, Purchaser, Supplier, BaseInfo as base_Info, NoticeNo, BuyerLabel, NoticeSummary, ExternalState, ShippingInfo, DeliveryDate, DeliveryTime, ReceivingAddress, DeliveryList, ExternalRoamRecord, SubmitDeliveryNotice, ConfirmDeliveryNotice, } from '../../constants'
import { Circulation, B2BDeliveryNoticeDetaitlsAnchors, DeliveryGood, Purchaser, Supplier, BaseInfo as base_Info, NoticeNo, BuyerLabel, NoticeSummary, ExternalState, ShippingInfo, DeliveryDate, DeliveryTime, ReceivingAddress, DeliveryList, ExternalRoamRecord, SubmitDeliveryNotice, ConfirmDeliveryNotice } from '../../constants'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import StandardTable from '@/components/StandardTable'
import { Steps, Table, Tag } from 'antd'
import { DeliveryMaterialsTableColumn, ExternalRoamRecordTableColumn } from '../../constants/page-table-column'
import { DeliveryGoodsTableColumn, ExternalRoamRecordTableColumn } from '../../constants/page-table-column'
import { getOrderDeliveryNoticeOrderDetail, getOrderDeliveryNoticeOrderDetailPage, getOrderDeliveryNoticeOrderDeliveryHistory } from '@/services/OrderNewV2Api'
import { STATUS_NAME } from '../../constants/deliveryNotice'
import { STATUS_NAME, TAG_STATUS_COLOR } from '../../constants/deliveryNotice'
const getAnchors = (len = 0) => {
return [...B2BDeliveryNoticeDetaitlsAnchors, { ...DeliveryGood, name: `${DeliveryGood.name}${!!len ? `(${len})` : ''}` }]
}
const DeliveryNoticeManagementAwaitB2BDetails: React.FC = () => {
const id = history.location?.query?.id
const [iAnchors, setiAnchors] = useState<AnchorsItem[]>(DeliveryNoticeDetaitlsAnchors)
const [details, setDetails] = useState<any>({})
const [historyData, setHistoryData] = useState<any>([])
const [len, setLen] = useState<number>(0)
const getDetail = async () => {
const { code, data } = await getOrderDeliveryNoticeOrderDetail({ id: id as string });
......@@ -41,6 +44,7 @@
return new Promise((resolve) => {
api({ ...params, orderId: id }).then(({ code, data }) => {
if (code === 1000) {
setLen(data.data?.length || 0)
resolve(data)
}
})
......@@ -58,7 +62,7 @@
<AnchorPage
title={`${details?.digest} | ${details?.noticeNo}`}
onBack={() => history.goBack()}
anchors={iAnchors}
anchors={getAnchors(len)}
>
<BaseInfo className='mt-0' title={Circulation.name} id={Circulation.key} cols={1}>
<Steps progressDot current={details?.outerStatus - 1}>
......@@ -77,7 +81,9 @@
{details.digest}
</BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={ExternalState}>
<Tag color='green'>{STATUS_NAME[details.status]}</Tag>
<Tag color={TAG_STATUS_COLOR[details.status]?.color}>
<span style={{ color: TAG_STATUS_COLOR[details.status]?.fontColor }}>{STATUS_NAME[details.status]}</span>
</Tag>
</BaseInfo.BaseInfoItem>
</BaseInfo>
<BaseInfo className='mt-16' title={ShippingInfo.name} id={ShippingInfo.key}>
......@@ -92,10 +98,10 @@
{details.deliveryStartTime}{details.deliveryEndTime}
</BaseInfo.BaseInfoItem>
</BaseInfo>
<BaseInfo className='mt-16' title={DeliveryList.name} id={DeliveryList.key} cols={1}>
<BaseInfo className='mt-16' title={DeliveryGood.name} id={DeliveryGood.key} cols={1}>
{/* SRM 物料列表(DeliveryMaterialsTableColumn), B2B商品列表(DeliveryGoodsTableColumn) */}
<StandardTable
columns={DeliveryMaterialsTableColumn}
columns={DeliveryGoodsTableColumn}
tableProps={{ rowKey: 'id', }}
fetchTableData={(params: any) => fetchData(getOrderDeliveryNoticeOrderDetailPage, { ...params, orderId: id })}
controlRender={<div></div>}
......
......@@ -211,6 +211,7 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ type, id
]
!planData && columns.push({
title: "操作",
align: 'center',
render: (t, r, i) => {
return (
<Button type='link' onClick={() => handleRemoveMaterialTableRow(i)}>删除</Button>
......
......@@ -6,21 +6,24 @@
import React, { useEffect, useState } from 'react'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { history } from 'umi'
import { Circulation, DeliveryNoticeDetaitlsAnchors, Purchaser, Supplier, BaseInfo as base_Info, NoticeNo, BuyerLabel, NoticeSummary, ExternalState, ShippingInfo, DeliveryDate, DeliveryTime, ReceivingAddress, DeliveryList, ExternalRoamRecord, SubmitDeliveryNotice, ConfirmDeliveryNotice, } from '../../constants'
import { Circulation, Purchaser, Supplier, BaseInfo as base_Info, NoticeNo, BuyerLabel, NoticeSummary, ExternalState, ShippingInfo, DeliveryDate, DeliveryTime, ReceivingAddress, DeliveryList, ExternalRoamRecord, SubmitDeliveryNotice, ConfirmDeliveryNotice, DeliveryNoticeDetaitlsAnchors, Material } from '../../constants'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import StandardTable from '@/components/StandardTable'
import { Steps, Table, Tag } from 'antd'
import { DeliveryMaterialsTableColumn, ExternalRoamRecordTableColumn } from '../../constants/page-table-column'
import { getOrderDeliveryNoticeOrderDetail, getOrderDeliveryNoticeOrderDetailPage, getOrderDeliveryNoticeOrderDeliveryHistory } from '@/services/OrderNewV2Api'
import { STATUS_NAME } from '../../constants/deliveryNotice'
import { STATUS_NAME, TAG_STATUS_COLOR } from '../../constants/deliveryNotice'
const getAnchors = (len = 0) => {
return [...DeliveryNoticeDetaitlsAnchors, { ...Material, name: `${Material.name}${!!len ? `(${len})` : ''}` }]
}
const DeliveryNoticeManagementAwaitSRMDetails: React.FC = () => {
const id = history.location?.query?.id
const [iAnchors, setiAnchors] = useState<AnchorsItem[]>(DeliveryNoticeDetaitlsAnchors)
const [details, setDetails] = useState<any>({})
const [historyData, setHistoryData] = useState<any>([])
const [len, setLen] = useState<number>(0)
const getDetail = async () => {
const { code, data } = await getOrderDeliveryNoticeOrderDetail({ id: id as string });
......@@ -41,6 +44,7 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC = () => {
return new Promise((resolve) => {
api({ ...params, orderId: id }).then(({ code, data }) => {
if (code === 1000) {
setLen(data.data?.length || 0)
resolve(data)
}
})
......@@ -58,7 +62,7 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC = () => {
<AnchorPage
title={`${details?.digest} | ${details?.noticeNo}`}
onBack={() => history.goBack()}
anchors={iAnchors}
anchors={getAnchors(len)}
>
<BaseInfo className='mt-0' title={Circulation.name} id={Circulation.key} cols={1}>
<Steps progressDot current={details?.outerStatus - 1}>
......@@ -77,7 +81,9 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC = () => {
{details.digest}
</BaseInfo.BaseInfoItem>
<BaseInfo.BaseInfoItem label={ExternalState}>
<Tag color='green'>{STATUS_NAME[details.status]}</Tag>
<Tag color={TAG_STATUS_COLOR[details.status]?.color}>
<span style={{ color: TAG_STATUS_COLOR[details.status]?.fontColor }}>{STATUS_NAME[details.status]}</span>
</Tag>
</BaseInfo.BaseInfoItem>
</BaseInfo>
<BaseInfo className='mt-16' title={ShippingInfo.name} id={ShippingInfo.key}>
......@@ -92,7 +98,7 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC = () => {
{details.deliveryStartTime}{details.deliveryEndTime}
</BaseInfo.BaseInfoItem>
</BaseInfo>
<BaseInfo className='mt-16' title={DeliveryList.name} id={DeliveryList.key} cols={1}>
<BaseInfo className='mt-16' title={Material.name} id={Material.key} cols={1}>
{/* SRM 物料列表(DeliveryMaterialsTableColumn), B2B商品列表(DeliveryGoodsTableColumn) */}
<StandardTable
columns={DeliveryMaterialsTableColumn}
......
......@@ -47,11 +47,11 @@ const DeliveryNoteManageDetails: React.FC = () => {
>
<ListInfo className='mt-15' title={BillsInfo.name} id={BillsInfo.key}>
<ListInfoItem className="mt-16" label='送货单编号'>
{info?.deliveryNo}
<ListInfoItem className="mt-16" label='收货单号'>
{info?.receiveNo}
</ListInfoItem>
<ListInfoItem label='供应会员'>
<ListInfoItem label='采购会员'>
{info?.buyerMemberName}
</ListInfoItem>
......@@ -72,45 +72,50 @@ const DeliveryNoteManageDetails: React.FC = () => {
<ListInfo className='mt-15' title={Harvest.name} id={Harvest.key}>
<ListInfoItem className="mt-16" label='收货单号'>
{info?.receiveNo}
</ListInfoItem>
<ListInfoItem className="mt-16" label='收货日期'>
{info?.receiveTime}
</ListInfoItem>
<div>
<ListInfoItem className="mt-16" label='收货日期'>
{info?.receiveTime}
</ListInfoItem>
<ListInfoItem className="mt-16" label='收货货人'>
{info?.receiverBO?.consignee}
</ListInfoItem>
<ListInfoItem className="mt-16" label='收货电话'>
{info?.receiverBO?.phone}
</ListInfoItem>
</div>
<div>
<ListInfoItem className="mt-16" label='收货地址'>
{info?.receiverBO?.provinceName ?? ''}{info?.receiverBO?.cityName ?? ''}{info?.receiverBO?.districtName ?? ''}{info?.receiverBO?.streetName ?? ''}{info?.receiverBO?.address ?? ''}
</ListInfoItem>
</div>
<ListInfoItem className="mt-16" label='收货地址'>
{info?.receiverBO?.provinceName ?? ''}{info?.receiverBO?.cityName ?? ''}{info?.receiverBO?.districtName ?? ''}{info?.receiverBO?.streetName ?? ''}{info?.receiverBO?.address ?? ''}
</ListInfoItem>
</ListInfo>
<ListInfoItem className="mt-16" label='收货货人'>
{info?.receiverBO?.consignee}
</ListInfoItem>
<ListInfo className='mt-15' title={DeliveryInfo.name} id={DeliveryInfo.key}>
<div>
<ListInfoItem className="mt-16" label='收货电话'>
{info?.receiverBO?.phone}
</ListInfoItem>
<ListInfoItem className="mt-16" label='送货单编号'>
{info?.deliveryNo}
</ListInfoItem>
<ListInfoItem className="mt-16" label='发货时间'>
{info?.sendTime}
</ListInfoItem>
</ListInfo>
</div>
<ListInfo className='mt-15' title={DeliveryInfo.name} id={DeliveryInfo.key}>
<ListInfoItem className="mt-16" label='发货时间'>
{info?.sendTime}
</ListInfoItem>
<div>
<ListInfoItem className="mt-16" label='发货(自提)地址'>
{info?.deliverVO?.provinceName ?? ''}{info?.deliverVO?.cityName ?? ''}{info?.deliverVO?.districtName ?? ''}{info?.deliverVO?.streetName ?? ''}{info?.deliverVO?.address ?? ''}
</ListInfoItem>
</div>
<ListInfoItem className="mt-16" label='发货(自提)地址'>
{info?.deliverVO?.provinceName ?? ''}{info?.deliverVO?.cityName ?? ''}{info?.deliverVO?.districtName ?? ''}{info?.deliverVO?.streetName ?? ''}{info?.deliverVO?.address ?? ''}
</ListInfoItem>
</ListInfo>
<ListInfo className='mt-15' title={LogisticsInfo.name} id={LogisticsInfo.key}>
<ListInfoItem label='物流单号'>
{info?.logisticsNo ?? '-'}
</ListInfoItem>
<ListInfoItem label='物流公司'>
{info?.logisticsCompany}
</ListInfoItem>
......@@ -118,6 +123,11 @@ const DeliveryNoteManageDetails: React.FC = () => {
<ListInfoItem label='车牌号码'>
{info?.executorVO?.carNumbers ?? '-'}
</ListInfoItem>
<ListInfoItem label='物流单号'>
{info?.logisticsNo ?? '-'}
</ListInfoItem>
</ListInfo>
<ListInfo className='mt-15' title={Material.name} id={Material.key} cols={1}>
......
......@@ -62,17 +62,15 @@ const DeliveryNoteManage: React.FC = () => {
title: '收货单号',
dataIndex: 'id',
key: 'id',
width: 160,
render: (t, r) =>
<EyePreview url={`/memberCenter/order/receivingNote/deliveryNoteManage/details?id=${r.id}`}>
{r.receiveNo}
</EyePreview>
},
{ title: '收货单摘要', dataIndex: 'digest', key: 'digest' },
{ title: '收货日期', dataIndex: 'receiveTime', key: 'receiveTime' },
{ title: '送货单号', dataIndex: 'deliveryNo', key: 'deliveryNo' },
{ title: '送货日期', dataIndex: 'deliveryTime', key: 'deliveryTime' },
{ title: '收货单号', dataIndex: 'receiveNo', key: 'receiveNo' },
{ title: '收货日期', dataIndex: 'receiveTime', key: 'receiveTime' },
{ title: '供应会员', dataIndex: 'buyerMemberName', key: 'buyerMemberName' },
{ title: '单据时间', dataIndex: 'createTime', key: 'createTime' },
{
......
......@@ -2,85 +2,86 @@
* 订单能力 -收货单 - 收货单管理 - Schema
* @author: Gavin
*/
import { ISchema } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
export const deliveryNoteManageSchema: ISchema = {
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{controllerBtns}}',
},
},
'receiveNo': {
type: 'string',
'x-component': 'Search',
'x-component-props': {
allowClear: true,
placeholder: '请输入送货单号查询'
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
'digest': {
type: 'string',
'x-component-props': {
allowClear: true,
placeholder: '收货单摘要'
}
},
'[startDate, endDate]': {
type: 'daterange',
'x-component-props': {
allowClear: true,
placeholder: ['送货开始日期', '送货结束日期'],
},
},
'vendorMemberName': {
type: 'string',
'x-component-props': {
allowClear: true,
placeholder: '供应会员'
}
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
}
}
}
}
}
}
\ No newline at end of file
import { ISchema } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
export const deliveryNoteManageSchema: ISchema = {
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
className: 'useMegaStart'
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{controllerBtns}}',
},
},
'receiveNo': {
type: 'string',
'x-component': 'Search',
'x-component-props': {
allowClear: true,
placeholder: '请输入收货单号查询'
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
justifyContent: 'flex-start'
},
colStyle: {
marginRight: 20,
},
},
properties: {
'digest': {
type: 'string',
'x-component-props': {
allowClear: true,
placeholder: '收货单摘要'
}
},
'[startDate, endDate]': {
type: 'daterange',
'x-component-props': {
allowClear: true,
placeholder: ['收货开始日期', '收货结束日期'],
},
},
'vendorMemberName': {
type: 'string',
'x-component-props': {
allowClear: true,
placeholder: '供应会员'
}
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
}
}
}
}
}
}
\ No newline at end of file
......@@ -6,11 +6,11 @@
import React, { useEffect, useState } from 'react'
import AnchorPage from '@/components/AnchorPage'
import { BaseInfo as ListInfo } from '@/components/BaseInfo'
import { BillsInfo, DeliveryInfo, DeliveryNoteQuery, LogisticsInfo, Material, Distribution, BaseInfo } from '../../constants'
import { BillsInfo, DeliveryInfo, DeliveryNoteQuery, LogisticsInfo, Material, Distribution, BaseInfo, ExternalRoamRecord } from '../../constants'
import { Table, Tag } from 'antd'
import ReceiveNoteFacotry from '../../assets/handles/ReceiveNotePage'
import { useLocation } from 'umi'
import { DeliveryNoticeTableColumn, DeliveryNoticeTableColumnSRM } from '../../constants/page-table-column'
import { DeliveryNoticeTableColumn, DeliveryNoticeTableColumnSRM, ExternalRoamRecordTableColumn } from '../../constants/page-table-column'
import { DeliveryNumColumn } from '../../constants/table-column'
const service = ReceiveNoteFacotry.getInstance('Query')
......@@ -19,12 +19,14 @@ const ListInfoItem = ListInfo.BaseInfoItem;
const DeliveryNoteDetails: React.FC = () => {
const anchors = DeliveryNoteQuery
const [anchors, setAnchors] = useState(DeliveryNoteQuery)
const [info, setInfo] = useState<any>({})
const [tableDataSource, setTableDataSource] = useState<any>([])
const location = useLocation()
const { id } = (location as any).query
const [outerHistoryList, setOuterHistoryList] = useState([])
useEffect(() => {
Promise.all([
service.getDetailById(id),
......@@ -33,6 +35,24 @@ const DeliveryNoteDetails: React.FC = () => {
console.log(values[0])
setInfo(values[0])
setTableDataSource(values[1].data)
setOuterHistoryList(values[0]?.outerHistoryList)
setAnchors([
...anchors,
{
...Material,
...{
name: `${Material.name}(${values[1].totalCount})`
}
},
{
...ExternalRoamRecord,
...{
name: `${ExternalRoamRecord.name}(${values[0].outerHistoryList.length})`
}
}
])
})
}, [])
......@@ -42,12 +62,12 @@ const DeliveryNoteDetails: React.FC = () => {
anchors={anchors}
>
<ListInfo className='mt-15' title={BaseInfo.name} id={BaseInfo.key}>
<ListInfo className='mt-15' title={BillsInfo.name} id={BillsInfo.key}>
<ListInfoItem label='送货单编号'>
{info?.deliveryNo}
</ListInfoItem>
<ListInfoItem label='采购会员'>
<ListInfoItem label='供应会员'>
{info?.buyerMemberName}
</ListInfoItem>
......@@ -77,8 +97,8 @@ const DeliveryNoteDetails: React.FC = () => {
{info?.deliveryStartTime}{info?.deliveryEndTime}
</ListInfoItem>
<ListInfoItem label='送货电话'>
{info?.executorVO?.phone??'暂无信息'}
<ListInfoItem label='送货电话'>
{info?.executorVO?.phone ?? '暂无信息'}
</ListInfoItem>
</ListInfo>
......@@ -111,6 +131,10 @@ const DeliveryNoteDetails: React.FC = () => {
<ListInfo className='mt-15' title={LogisticsInfo.name} id={LogisticsInfo.key}>
<ListInfoItem label='配送方式'>
{info?.deliveryType === 1 ? '物流' : '自提'}
</ListInfoItem>
<ListInfoItem label='物流单号'>
{info?.logisticsNo}
</ListInfoItem>
......@@ -141,6 +165,16 @@ const DeliveryNoteDetails: React.FC = () => {
/>
</ListInfo>
<ListInfo className='mt-15' title={ExternalRoamRecord.name} id={ExternalRoamRecord.key} cols={1}>
<Table
columns={[
...ExternalRoamRecordTableColumn,
]}
rowKey="id"
dataSource={outerHistoryList}
/>
</ListInfo>
</AnchorPage>
)
}
......
......@@ -32,7 +32,7 @@ const ContentBox = BaseInfo;
function DeliveryNoteAddForm() {
const [tableDataSource, setTableDataSource] = useState<any>([])
const [outerHistoryList, setOuterHistoryList] = useState([])
const location = useLocation()
const { id } = (location as any).query
const [form] = useForm()
......@@ -61,7 +61,6 @@ function DeliveryNoteAddForm() {
deliveryType: 1,
...res
})
setOuterHistoryList(res.outerHistoryList)
setType(res?.type)
})
......@@ -255,16 +254,6 @@ function DeliveryNoteAddForm() {
</ContentBox>
<ContentBox className='mt-15' title={ExternalRoamRecord.name} id={ExternalRoamRecord.key} cols={1}>
<Table
columns={[
...ExternalRoamRecordTableColumn,
]}
rowKey="id"
dataSource={outerHistoryList}
/>
</ContentBox>
</Form>
</AnchorPage>
......
......@@ -83,15 +83,15 @@ const DeliveryNoteQuery: React.FC = () => {
}
const columns: ColumnType<any>[] = [
{
title: '货单号',
title: '货单号',
dataIndex: 'id',
key: 'id',
width: 160,
render: (t: any, r: any) => <EyePreview url={`/memberCenter/order/receivingNote/deliveryNoteQuery/details?id=${r.id}`}>{r.deliveryNo}</EyePreview>
},
{ title: '货单摘要', dataIndex: 'digest', key: 'digest' },
{ title: '货单摘要', dataIndex: 'digest', key: 'digest' },
{ title: '送货日期', dataIndex: 'deliveryTime', key: 'deliveryTime' },
{ title: '采购会员', dataIndex: 'buyerMemberName', key: 'buyerMemberName' },
{ title: '供应会员', dataIndex: 'buyerMemberName', key: 'buyerMemberName' },
{ title: '单据时间', dataIndex: 'createTime', key: 'createTime' },
{
title: '外部状态',
......
......@@ -2,85 +2,86 @@
* 订单能力 - 收货单 - 送货单查询 - Schema
* @author: Gavin
*/
import { ISchema } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
export const deliveryNoteQuerySchema: ISchema = {
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{controllerBtns}}',
},
},
'deliveryNo': {
type: 'string',
'x-component': 'Search',
'x-component-props': {
allowClear: true,
placeholder: '请输入送货单号查询'
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
'digest': {
type: 'string',
'x-component-props': {
allowClear: true,
placeholder: '送货单摘要'
}
},
'[startDate, endDate]': {
type: 'daterange',
'x-component-props': {
allowClear: true,
placeholder: ['送货开始日期', '送货结束日期'],
},
},
'buyerMemberName': {
type: 'string',
'x-component-props': {
allowClear: true,
placeholder: '采购会员'
}
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
}
}
}
}
}
}
\ No newline at end of file
import { ISchema } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
export const deliveryNoteQuerySchema: ISchema = {
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
className: 'useMegaStart'
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{controllerBtns}}',
},
},
'deliveryNo': {
type: 'string',
'x-component': 'Search',
'x-component-props': {
allowClear: true,
placeholder: '请输入送货单号查询'
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
justifyContent: 'flex-start'
},
colStyle: {
marginRight: 20,
},
},
properties: {
'digest': {
type: 'string',
'x-component-props': {
allowClear: true,
placeholder: '送货单摘要'
}
},
'[startDate, endDate]': {
type: 'daterange',
'x-component-props': {
allowClear: true,
placeholder: ['送货开始日期', '送货结束日期'],
},
},
'buyerMemberName': {
type: 'string',
'x-component-props': {
allowClear: true,
placeholder: '供应会员'
}
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
}
}
}
}
}
}
\ No newline at end of file
@import '~antd/es/style/themes/default.less';
.date-cycle {
display: inline-block;
......@@ -7,4 +9,10 @@
background-color: #F5F6F7;
}
}
&-btn {
&-active {
color: @primary-color;
}
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@
*/
import React from 'react';
import { Button, Space } from 'antd';
import classNames from 'classnames';
import styles from './index.less';
// 这里偷懒直接以后台接口返回字段命名
......@@ -10,13 +11,17 @@ export type DateCycleType = 'weekList' | 'monthList' | 'yearList'
interface DateCycleProps {
/**
* value,当前选中的项,完全受控
*/
value: DateCycleType,
/**
* 选择周期改变触发事件
*/
onChange?: (value: DateCycleType) => void,
}
const DateCycle: React.FC<DateCycleProps> = (props) => {
const { onChange } = props;
const { value, onChange } = props;
const handleClick = (type: DateCycleType) => {
onChange?.(type);
......@@ -25,9 +30,27 @@ const DateCycle: React.FC<DateCycleProps> = (props) => {
return (
<div className={styles['date-cycle']}>
<Space>
<Button size="small" onClick={() => handleClick('weekList')}></Button>
<Button size="small" onClick={() => handleClick('monthList')}></Button>
<Button size="small" onClick={() => handleClick('yearList')}></Button>
<Button
size="small"
onClick={() => handleClick('weekList')}
className={classNames({ [styles['date-cycle-btn-active']]: value === 'weekList' })}
>
</Button>
<Button
size="small"
onClick={() => handleClick('monthList')}
className={classNames({ [styles['date-cycle-btn-active']]: value === 'monthList' })}
>
</Button>
<Button
size="small"
onClick={() => handleClick('yearList')}
className={classNames({ [styles['date-cycle-btn-active']]: value === 'yearList' })}
>
</Button>
</Space>
</div>
);
......
......@@ -2,6 +2,10 @@
@import '../../../../global/styles/utils.less';
.message {
&-title {
font-size: @font-size-lg;
}
&-list {
height: 158px;
overflow-y: auto;
......
......@@ -92,7 +92,7 @@ const TodoCard: React.FC = () => {
return (
<MellowCard
title="消息提醒"
title={(<div className={styles['message-title']}>消息提醒</div>)}
extra={(
<Space>
<Button
......
@import '~antd/es/style/themes/default.less';
.purchase-order-analysis {
&-title {
font-size: @font-size-lg;
}
}
\ No newline at end of file
......@@ -2,13 +2,40 @@
* @Description 采购订单统计
*/
import React, { useMemo, useState } from 'react';
import { Chart, Tooltip, Axis, Point, Line, Interval } from 'bizcharts';
import { Chart, Tooltip, Axis, Point, Line, Interval, registerShape } from 'bizcharts';
import { getReportMemberHomeGetOrderList, GetReportMemberHomeGetOrderListResponse } from '@/services/ReportV2Api';
import { useHttpRequest } from '@/hooks/useHttpRequest';
import MellowCard from '@/components/MellowCard';
import DateCycle, { DateCycleType } from '../DateCycle';
import styles from './index.less';
// registerShape('interval', 'border-radius', {
// draw(cfg, container) {
// const { points } = cfg;
// let path = [];
// path.push(['M', points[0].x, points[0].y]);
// path.push(['L', points[1].x, points[1].y]);
// path.push(['L', points[2].x, points[2].y]);
// path.push(['L', points[3].x, points[3].y]);
// path.push('Z');
// path = this.parsePath(path); // 将 0 - 1 转化为画布坐标
// const group = container.addGroup();
// group.addShape('rect', {
// attrs: {
// x: path[1][1], // 矩形起始点为左上角
// y: path[1][2],
// width: path[2][1] - path[1][1],
// height: path[0][2] - path[1][2],
// fill: cfg.color,
// radius: [4, 4, 0, 0], // test
// },
// });
// return group;
// },
// });
const PurchaseOrderAnalysis: React.FC = () => {
const [dateType, setDateType] = useState<DateCycleType>('weekList');
......@@ -36,15 +63,15 @@ const PurchaseOrderAnalysis: React.FC = () => {
},
};
const colors = ['#6394f9', '#62daaa'];
const colors = ['#00A98F', '#4787F0'];
const currentData = useMemo(() => data?.[dateType] || [], [dateType, data]);
return (
<MellowCard
title="采购订单统计"
title={(<div className={styles['purchase-order-analysis-title']}>采购订单统计</div>)}
extra={(
<DateCycle onChange={handleDateCycleChange} />
<DateCycle value={dateType} onChange={handleDateCycleChange} />
)}
bodyStyle={{
paddingRight: 20,
......@@ -83,7 +110,17 @@ const PurchaseOrderAnalysis: React.FC = () => {
},
}}
/>
<Interval position="dateTime*count" color={colors[0]} />
<Interval
position="dateTime*count"
color={colors[0]}
// shape={['dateTime*count', (dateTime, val) => {
// if (val === 0) {
// return;
// }
// // eslint-disable-next-line consistent-return
// return 'border-radius';
// }]}
/>
<Line
position="dateTime*amount"
color={colors[1]}
......
@import '~antd/es/style/themes/default.less';
.recently {
&-title {
font-size: @font-size-lg;
}
&-list {
margin: -@padding-xs;
display: flex;
......
......@@ -14,7 +14,7 @@ const RecentlyVisited: React.FC = () => {
}
return (
<MellowCard title="最近访问" fullHeight>
<MellowCard title={(<div className={styles['recently-title']}>最近访问</div>)} fullHeight>
<div className={styles['recently-list']}>
{Object.keys(recentVisit).map((item) => {
const menuName = item.split(".");
......
@import '~antd/es/style/themes/default.less';
.supplier-analysis {
&-title {
font-size: @font-size-lg;
}
}
\ No newline at end of file
......@@ -35,9 +35,9 @@ const SupplierAnalysis: React.FC = () => {
return (
<MellowCard
title="供应商统计"
title={(<div className={styles['supplier-analysis-title']}>供应商统计</div>)}
extra={(
<DateCycle onChange={handleDateCycleChange} />
<DateCycle value={dateType} onChange={handleDateCycleChange} />
)}
>
<Chart
......
@import '~antd/es/style/themes/default.less';
.todo {
&-title {
font-size: @font-size-lg;
}
&-total {
font-size: @font-size-base * 2;
color: @text-color;
......@@ -15,7 +19,7 @@
&-item {
display: inline-block;
padding: @padding-xss / 2 @padding-xs;
padding: @padding-xss + 2 @padding-md;
margin-right: @margin-md;
margin-bottom: @margin-md;
background-color: #EBF9F6;
......
......@@ -2,7 +2,7 @@
* @Description 欢迎卡片
*/
import React, { useState, useEffect } from 'react';
import { message } from 'antd';
import { message, Spin } from 'antd';
import classNames from 'classnames';
import { history } from 'umi';
import { SRM_HOME_TODO } from '@/constants/home';
......@@ -47,7 +47,7 @@ const API_MAP: { [key in Apikeys]: ApiFnType } = {
'/memberCenter/order': getReportMemberHomeGetOrderTally as unknown as ApiFnType,
'/memberCenter/procurementAbility': getReportMemberHomeGetPurchaseTally as unknown as ApiFnType,
'/memberCenter/contract': getReportMemberHomeGetContractTally as unknown as ApiFnType,
'/memberCenter/commodityAbility': () => (
'/memberCenter/commodityAbility': () => ( // 调整返回数据格式,与其他接口保持一致
new Promise((resolve, reject) => {
getReportMemberHomeGetCommodityTally().then((res) => {
if (res.code === 1000) {
......@@ -63,7 +63,7 @@ const API_MAP: { [key in Apikeys]: ApiFnType } = {
),
'/memberCenter/balance': getReportMemberHomeGetSettleAccountTally as unknown as ApiFnType,
'/memberCenter/afterService': getReportMemberHomeGetAfterSaleTally as unknown as ApiFnType,
'/memberCenter/logisticsAbility': () => (
'/memberCenter/logisticsAbility': () => ( // 调整返回数据格式,与其他接口保持一致
new Promise((resolve, reject) => {
getReportMemberHomeGetLogisticsTally().then((res) => {
if (res.code === 1000) {
......@@ -154,6 +154,7 @@ const TodoCard: React.FC = () => {
const [currentTag, setCurrentTag] = useState<Apikeys | ''>('');
const [todoTags, setTodoTags] = useState<TodoTagType[]>([]);
const [todoList, setTodoList] = useState<TodoType[][]>([]);
const [listLoading, setListLoading] = useState(false);
const handleTagChange = (url: Apikeys) => {
setCurrentTag(url);
......@@ -163,10 +164,13 @@ const TodoCard: React.FC = () => {
return;
}
setListLoading(true);
API_MAP[url]().then((res) => {
if (res.code === 1000) {
setTodoList(normalizeTodoList(res.data));
}
}).finally(() => {
setListLoading(false);
});
};
......@@ -191,7 +195,7 @@ const TodoCard: React.FC = () => {
};
return (
<MellowCard title="今日待办">
<MellowCard title={(<div className={styles['todo-title']}>今日待办</div>)}>
<ul className={styles['todo-tag-list']}>
{todoTags.map((item) => (
<li
......@@ -208,28 +212,30 @@ const TodoCard: React.FC = () => {
</li>
))}
</ul>
<div className={styles['todo-list']}>
<div className={styles['todo-list-content']}>
{todoList.map((group, index) => (
<div key={index} className={styles['todo-list-group']}>
{group.map((item, groupItemIndex) => (
<div
key={`${item.url + groupItemIndex}`}
className={styles['todo-list-item']}
onClick={() => handleJump(item.url)}
>
<div className={styles['todo-list-item-name']}>
{item.name}
<Spin spinning={listLoading}>
<div className={styles['todo-list']}>
<div className={styles['todo-list-content']}>
{todoList.map((group, index) => (
<div key={index} className={styles['todo-list-group']}>
{group.map((item, groupItemIndex) => (
<div
key={`${item.url + groupItemIndex}`}
className={styles['todo-list-item']}
onClick={() => handleJump(item.url)}
>
<div className={styles['todo-list-item-name']}>
{item.name}
</div>
<div className={styles['todo-list-item-total']}>
{item.total}
</div>
</div>
<div className={styles['todo-list-item-total']}>
{item.total}
</div>
</div>
))}
</div>
))}
))}
</div>
))}
</div>
</div>
</div>
</Spin>
</MellowCard>
);
};
......
......@@ -6,7 +6,7 @@ import NiceForm from '@/components/NiceForm';
import { createFormActions } from '@formily/antd';
import { PageStatus, usePageStatus } from '@/hooks/usePageStatus';
import { history, getIntl } from 'umi';
import { getMemberAbilitySalesChannel, getMemberAbilitySalesChannelPage, getMemberAbilitySalesSelect, postMemberAbilitySalesChannelBind, postMemberAbilitySalesChannelUnbind } from '@/services/MemberV2Api';
import { getMemberAbilitySalesChannel, getMemberAbilitySalesSelect, postMemberAbilitySalesChannelBind, postMemberAbilitySalesChannelPage, postMemberAbilitySalesChannelUnbind } from '@/services/MemberV2Api';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import Search from '@/components/NiceForm/components/Search';
import Submit from '@/components/NiceForm/components/Submit';
......@@ -25,7 +25,7 @@ export const Tablink = [
const formAction = createFormActions();
const fetchMemberAbilitySelect = async (params) => {
const { data } = await getMemberAbilitySalesSelect(params)
const { data } = await getMemberAbilitySalesSelect()
return data
}
......@@ -36,7 +36,12 @@ const SalesmanBindAdded = (props) => {
const [memberVisible, setMemberVisible] = useState(false)
const { pageStatus, id } = usePageStatus()
const [tableData, setTableData] = useState<any[]>([])
const [keywordName, setKeywordName] = useState<string>('')
const [keywordName, setKeywordName] = useState<string>('');
const [loading, setLoading] = useState(false)
/** 用户Id(业务员Id) */
const [userId, setUserId] = useState<number>()
/** 过滤已有的下级会员 */
const fliterTableData = useMemo(() => {
if (!keywordName) {
......@@ -60,9 +65,9 @@ const SalesmanBindAdded = (props) => {
}).then((res) => {
if (res.code === 1000) {
formAction.setFieldValue('userId', [res.data])
// 添加一个remote标识, 带有此标识的 将会调用接口解绑
console.log(res.data.data.map(v => ({ ...v, isRemote: true })))
setTableData(res.data.data.map(v => ({ ...v, isRemote: true })))
// rowCtl.setSelectRow(res.data.data)
// rowCtl.setSelectedRowKeys(res.data.data.map(_item => _item.relationId))
setTableData(res.data.data)
}
})
}
......@@ -208,21 +213,13 @@ const SalesmanBindAdded = (props) => {
]
const fetchTableData = async (params) => {
const { data } = await getMemberAbilitySalesChannelPage(params)
const { data } = await postMemberAbilitySalesChannelPage({ ...params, userId, relationIds: tableData.map(_item => _item?.relationId) }, { ctlType: 'none' })
return data
}
const handleConfirm = () => {
setMemberVisible(false)
setTableData(tableData => {
return [...tableData, ...rowCtl.selectRow.filter(v => !tableData.find(j => j.memberId === v.memberId))]
})
}
const validateMember = () => {
const userInfo = formAction.getFieldValue('userId')
return userInfo && userInfo.length > 0
setTableData(rowCtl.selectRow)
}
const unBindMember = async (options?) => {
......@@ -258,24 +255,6 @@ const SalesmanBindAdded = (props) => {
}
relationIds.push(...remoteRowKey)
}
if (validateMember()) {
const userInfo = formAction.getFieldValue('userId')
const userId = userInfo[0].userId
const { code } = await postMemberAbilitySalesChannelUnbind({
userId,
relationIds: relationIds
})
if (code === 1000) {
setTableData(d => {
clearRealRowCtl(relationIds)
return d.filter(v => !relationIds.includes(v.relationId))
})
}
} else {
message.error(intl.formatMessage({ id: 'channel.member.select' }))
}
}
const clearRealRowCtl = (ids: any[]) => {
......@@ -287,35 +266,19 @@ const SalesmanBindAdded = (props) => {
const userInfo = formAction.getFieldValue('userId')
if (userInfo && userInfo.length > 0) {
const userId = userInfo[0].userId
setLoading(true)
const result = await postMemberAbilitySalesChannelBind({
userId,
relationIds: tableData.map(v => v.relationId)
})
if (result.code === 1000) {
history.goBack()
}
}
};
const fetchMemberSaleChannel = async (params) => {
const userInfo = formAction.getFieldValue('userId')
if (userInfo && userInfo.length > 0) {
const userId = userInfo[0].userId
const { data, code } = await getMemberAbilitySalesChannel({
userId,
...params
})
if (code !== 1000) {
message.error(intl.formatMessage({ id: code }))
setTableData([])
if (result.code !== 1000) {
setLoading(false)
return
}
setTableData([...data.data.map(v => ({ ...v, isRemote: true }))])
} else {
return []
history.goBack()
}
}
};
return (
<PeripheralLayout
......@@ -326,6 +289,7 @@ const SalesmanBindAdded = (props) => {
<Button
type="primary"
disabled={pageStatus === PageStatus.PREVIEW}
loading={loading}
onClick={handleSubmit}
>
{intl.formatMessage({ id: 'common.button.save' })}
......@@ -441,6 +405,13 @@ const SalesmanBindAdded = (props) => {
},
},
}}
effects={($, ctx) => {
$('onFieldValueChange', 'userId').subscribe(async state => {
if (state?.value) {
setUserId(state?.value[0].userId);
}
})
}}
/>
</Col>
</Row>
......@@ -459,7 +430,7 @@ const SalesmanBindAdded = (props) => {
<Button type='default' style={{ marginLeft: 20 }} onClick={() => setKeywordName('')}>{intl.formatMessage({ id: 'common.button.reset' })}</Button>
</Col>
</Row>
<Button style={{ marginBottom: '16px' }} block type='dashed' onClick={() => setMemberVisible(true)} disabled={pageStatus === PageStatus.PREVIEW}>{intl.formatMessage({ id: 'channel.member.wait.bind.select' })}</Button>
<Button style={{ marginBottom: '16px' }} block type='dashed' onClick={() => setMemberVisible(true)} disabled={!!!userId}>{intl.formatMessage({ id: 'channel.member.wait.bind.select' })}</Button>
<StandardTable
columns={connectMemberColumns}
rowSelection={pageStatus !== PageStatus.PREVIEW && realRowSelection}
......
......@@ -150,7 +150,7 @@ const SalesmanBindDetail = (props) => {
<Form.Item label={intl.formatMessage({ id: 'channel.member.table.memberRoleName' })}>
<Typography.Text>{data?.memberRoleName}</Typography.Text>
</Form.Item>
<Form.Item label={intl.formatMessage({ id: 'cchannel.member.table.bindphone' })}>
<Form.Item label={intl.formatMessage({ id: 'channel.member.table.bindphone' })}>
<Typography.Text>{data?.phone}</Typography.Text>
</Form.Item>
</Form>
......
......@@ -69,6 +69,7 @@ const PeripheralLayout: React.FC<IProps> = (props: any) => {
targetOffset={targetOffset}
onChange={onChange}
onClick={onClick}
getContainer={() => document.querySelector('main.ant-pro-basicLayout-content') as HTMLElement}
>
{/* 头部信息 */}
<div style={{ flex: 1 }}>
......
......@@ -150,7 +150,7 @@ const RecordLayout: React.FC<ProgressProps> = (props: any) => {
RecordLayout.defaultProps = {
layoutId: 'recordLayout',
layoutTitle: intl.formatMessage({ id: 'detail.purchase.progressLayout' })
layoutTitle: intl.formatMessage({ id: 'detail.purchase.recordLyout' })
}
export default RecordLayout
......@@ -63,6 +63,7 @@ const PeripheralLayout: React.FC<IProps> = (props: any) => {
targetOffset={targetOffset}
onChange={onChange}
onClick={onClick}
getContainer={() => document.querySelector('main.ant-pro-basicLayout-content') as HTMLElement}
>
{/* 头部信息 */}
<div style={{ flex: 1 }}>
......
......@@ -4,6 +4,7 @@ export function HandelFormFieldsKeyValue(fields) {
let result = {}
for (const field in fields) {
const split = field.split('.');
if (split.length > 1) {
//为空的时候创建一个默认对象
if (result[split[0]] === undefined) {
......
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