Commit d143c394 authored by leimo's avatar leimo

Merge branch 'v2-0418-transferOrder-molei' into 'v2-220418'

新增 送货单 SRM 的业务操作 See merge request linkseeks-design/pro-platform!86
parents c039a6e5 fcb40f71
......@@ -29,6 +29,14 @@ const DeliveryNotice = [
hideInMenu: true,
noMargin: true
},
{
/** 送货单编辑SRM*/
path: '/memberCenter/order/deliveryNotice/manageSRM/edit',
name: '送货单编辑(SRM)',
component: '@/pages/order/deliveryNotice/manageSRM/edit',
hideInMenu: true,
noMargin: true
},
{
......
......@@ -88,7 +88,7 @@ function AddressDrawer(props: AddressDrawerProps) {
<AddressRaioContextProvider value={addrList}>
<Row gutter={10}>
<Col span={20}>
<Input.TextArea value={`${value?.fullAddress} ${value?.shipperName} ${value?.phone}`} />
<Input.TextArea value={`${value?.fullAddress} ${value?.shipperName ? value?.shipperName : value?.receiverName} ${value?.phone}`} />
</Col>
<Col span={4}>
......
import LogisticsCompanySelect, { CooperateType } from "./LogisticsCompanySelect"
function LogisticsCompanyMerchantsSelect(props) {
const { onChange } = props;
return (
<LogisticsCompanySelect onChange={onChange} cooperateType={CooperateType.Merchants} />
)
}
export default LogisticsCompanyMerchantsSelect
\ No newline at end of file
import LogisticsCompanySelect, { CooperateType } from "./LogisticsCompanySelect";
function LogisticsCompanyPltformSelect(props) {
const { onChange } = props;
return (
<LogisticsCompanySelect onChange={onChange} cooperateType={CooperateType.Platform} />
)
}
export default LogisticsCompanyPltformSelect
\ No newline at end of file
import { getLogisticsSelectListCompany } from "@/services/LogisticsV2Api";
import { Select } from "antd";
import { useEffect, useState } from "react";
export enum CooperateType {
Platform = "1",
Merchants = "2"
}
interface LogisticsCompanySelectProps {
onChange?: (value) => void
cooperateType: CooperateType.Platform | CooperateType.Merchants
}
function LogisticsCompanySelect(props: LogisticsCompanySelectProps) {
const { onChange, cooperateType } = props;
const [options, setOptions] = useState([]);
useEffect(() => {
fetchData()
}, [])
const fetchData = () => {
getLogisticsSelectListCompany({
cooperateType
}).then(res => {
const options =
res.data ?
res.data.map(item => ({
label: item.name,
value: item.id,
})) :
[];
setOptions(options)
})
}
return (
<Select options={options} onChange={(v) => {
const option = options.find(o => {
return o.value == v
})
onChange(option)
}} />
)
}
export default LogisticsCompanySelect
\ No newline at end of file
export { default as LogisticsCompanySelect } from './LogisticsCompanySelect'
\ No newline at end of file
import { Button, Col, Drawer, Form, Input, Radio, Row, Table } from "antd";
import { useCallback, useEffect, useState } from "react";
import { TableMemberColumn } from "./columns";
import {
///member/manage/lower/consumer/member/page
getMemberManageLowerProviderMerchantPage,
getMemberManageUpperProviderMerchantPage,
getMemberManageLowerConsumerMemberPage
} from '@/services/MemberV2Api';
interface RoleSelectProps {
request?: (payload: any) => Promise<any>
onChange?: (e) => void
}
/**
* 用户角色选择器
* @param request (payload) => Promise<any> 请求接口
* @returns
*/
function RoleSelect(props: RoleSelectProps) {
const { onChange } = props
const [visible, setVisible] = useState(false);
const [form] = Form.useForm()
const [dataSource, setDataSource] = useState([])
const [intV, setIntV] = useState<any>();
const showDrawer = useCallback(() => {
setVisible(true)
}, [visible])
const closeDrawer = useCallback(() => {
setVisible(false)
}, [visible])
useEffect(() => {
getMemberManageLowerConsumerMemberPage(form.getFieldsValue()).then(res => {
setDataSource(res.data.data)
})
}, [])
return (
<>
<Row gutter={4}>
<Col span={18}>
<Input value={intV?.name} />
</Col>
<Col span={6}>
<Button onClick={showDrawer}>选择采购会员</Button>
</Col>
</Row>
<Drawer
visible={visible}
title="选择采购会员"
onClose={closeDrawer}
width="50vw"
footer={
<Button.Group>
<Button type="primary" onClick={closeDrawer}>
确定
</Button>
</Button.Group>
}
>
<Form>
<Form.Item name="name">
<Input.Search />
</Form.Item>
</Form>
<Radio.Group className="block w-full" onChange={(e) => {
const value = e.target.value
let target = {
buyerMemberId: value.memberId,
buyerRoleId: value.roleId,
roleType: 2
}
setIntV(target)
onChange(target)
}}>
<Table
className="w-full"
columns={TableMemberColumn}
dataSource={dataSource}
/>
</Radio.Group>
</Drawer>
</>
);
}
export default RoleSelect;
\ No newline at end of file
import { Radio } from "antd";
export const TableMemberColumn = [
{
title: '',
render: (t, r) =>{
return (
<Radio value={r}/>
)
}
},
{
title: '序号',
dataIndex: 'id'
},
{
title: '会员ID',
dataIndex: 'memberId'
},
{
title: '会员名称',
dataIndex: 'name'
},
{
title: '会员类型',
dataIndex: 'memberTypeName'
},
{
title: '会员角色',
dataIndex: 'roleName'
},
{
title: '会员等级',
dataIndex: 'levelTag'
}
];
\ No newline at end of file
export {default as RoleSelect} from './RoleSelect'
\ No newline at end of file
......@@ -47,4 +47,5 @@ export default class NoteFactoryService {
static getInstance() {
return new NoteService()
}
}
\ No newline at end of file
}
import { isDev } from '@/constants';
import { getOrderDeliveryPlanOrderSrmProductPage } from '@/services/OrderNewV2Api';
import { getOrderDeliveryOrderDetailProductPage, getOrderDeliveryPlanOrderProductPage } from '@/services/OrderNewV2Api';
import { FormInstance } from 'antd';
import DeliveryGoodTableSelectMock from '../mock/DeliveryGoodTableSelectMock';
class DeliveryNoticeOrder {
getOrderDeliveryPlanProduct() {
if (isDev) {
return Promise.resolve({
data: DeliveryGoodTableSelectMock
});
return getOrderDeliveryOrderDetailProductPage().then(res => {
return res.data;
})
}
getOrderDeliveryPlanOrderProductPage(form: FormInstance) {
let fields = form.getFieldsValue();
let payload: any = {
memberId: fields.member?.buyerMemberId,
roleId: fields.member?.buyerRoleId,
roleType: fields.member?.roleType,
orderType: 1,
current: 1,
pageSize: 100,
// startDate: '2022-03-22',
// endDate: '2022-03-24'
}
return getOrderDeliveryPlanOrderSrmProductPage().then(res => {
// return Promise.resolve({data:DeliveryGoodTableSelectMock});
return getOrderDeliveryPlanOrderProductPage(payload).then(res => {
return res.data;
})
}
......
import { HandelFormFieldsKeyValue } from "@/utils/form";
import { FormInstance, message } from "antd"
import { postOrderDeliveryOrderSrmCreate } from '@/services/OrderNewV2Api';
import moment from "moment";
export class HandleFormSubmit {
......@@ -14,6 +17,10 @@ export class HandleFormSubmit {
return this.#tableData;
}
getForm() {
return this.#form;
}
getSubmitRequest(): (vals: any) => Promise<any> {
return () => Promise.resolve('');
}
......@@ -27,7 +34,11 @@ export class HandleFormSubmit {
}
handleBeforeRequestParamas(...args): any {
return {};
let result = {}
for (const arg of args) {
result = { ...result, ...arg }
}
return result;
}
validateFormFields() {
......@@ -38,7 +49,7 @@ export class HandleFormSubmit {
}
submit() {
if (this.handleBeforeFields()) return;
if (this.handleBeforeFields()) return Promise.reject("error");
return this.validateFormFields()
}
......@@ -76,3 +87,48 @@ export class ReceivingNoteAddService extends HandleFormSubmit {
}
export class DeliveryNoteAddService extends HandleFormSubmit {
handleBeforeFields(): boolean {
let b = this.getTableData().some((v) => Number(v.deliveryCount) < Number(v.purchaseCount))
if (b) {
message.error('收货数量不能少于送货数量')
}
return b;
}
getSubmitRequest() {
return postOrderDeliveryOrderSrmCreate;
}
validateFormFields() {
return this.getForm().validateFields().then(values => {
values = HandelFormFieldsKeyValue(values)
values.deliveryStartTime = values.deliveryRangeTime[0]
values.deliveryEndTime = values.deliveryRangeTime[1]
values.buyerRoleId = values.member.buyerRoleId
values.buyerMemberId = values.member.buyerMemberId
values.buyerMemberName = values.member.buyerMemberName
values.receiveVO.consignee = values.receiveVO.shipperName
values.deliveryVO.consignee = values.deliveryVO.receiverName
values.logisticsCompanyId = values.logisticsCompanyInt.value
values.logisticsCompany = values.logisticsCompanyInt.label
values.sendTime = moment(values.sendTime).format('YYYY-MM-DD HH:mm:ss')
console.log(values)
var params = this.handleBeforeRequestParamas(values, { products: this.getTableData().map(v=>{
return {
...v,
createTime:moment(v.createTime).format('YYYY-MM-DD HH:mm:ss')
}
}) });
return this.getSubmitRequest()(params)
})
}
}
import { getOrderReceiveOrderDeliveryPage } from '@/services/OrderNewV2Api';
// 收货单送货单管理
class ReceiveNoteManage {
getQuery(payload?: any) {
return getOrderReceiveOrderDeliveryPage().then(res => {
return res.data;
})
}
}
class ReceiveNoteQuery {
getQuery(payload?: any) {
return getOrderReceiveOrderDeliveryPage().then(res => {
return res.data;
})
}
}
export default class ReceiveNoteFacotry {
static getInstance(type: 'Manage' | 'Query' = 'Manage') {
switch (type) {
case 'Manage':
return new ReceiveNoteManage();
default:
return new ReceiveNoteQuery();
}
}
}
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import NoteFactoryService from '../handles/DeliveryNoteService';
export function useDetailInfoById(id) {
const [info, setInfo] = useState<any>();
const service = NoteFactoryService.getInstance();
useEffect(() => {
service.getDetailInfoById(id).then(res => {
setInfo(res as any)
})
}, [])
return [info];
}
export default [
{
"skuId": "demoData",
"productNo": "demoData",
"orderProductId": 1,
"productName": "demoData",
"spec": "demoData",
"category": "demoData",
"brand": "demoData",
"unit": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"skuId": "1075",
"productNo": "",
"orderProductId": null,
"productName": "可机洗枕芯舒适抗菌枕头家纺床上用品枕芯单个装",
"spec": "白色/70*45CM",
"category": "家纺家饰",
"brand": "富安娜",
"unit": "",
"purchaseCountSum": 1.0000,
"receiveCountSum": 0.0000,
"transitCountSum": 1.0000,
"leftCountSum": 0.0000,
"planCountSum": 0,
"orders": [
{
"orderNo": "demoData1",
"orderProductId": 1,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
},
{
"orderNo": "demoData2",
"orderProductId": 2,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
},
{
"orderNo": "demoData3",
"orderProductId": 3,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
}
]
},
{
"skuId": "demoData",
"productNo": "demoData",
"orderProductId": 2,
"productName": "demoData",
"spec": "demoData",
"category": "demoData",
"brand": "demoData",
"unit": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"orders": [
{
"orderNo": "demoData4",
"orderProductId": 4,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
},
{
"orderNo": "demoData5",
"orderProductId": 5,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
},
{
"orderNo": "demoData6",
"orderProductId": 6,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
"planOrderId": null,
"orderNo": "D8K47BKTR",
"orderProductId": 676,
"skuId": "1075",
"productName": "可机洗枕芯舒适抗菌枕头家纺床上用品枕芯单个装",
"orderDigest": "可机洗枕芯舒适抗菌枕头家纺床上用品枕芯单个装",
"createTime": "2022-03-16T11:42:29.61",
"purchaseCount": 1.0000,
"receiveCount": 0.0000,
"transitCount": 1.0000,
"leftCount": 0.0000,
"planCount": 0,
"consigneeId": 106,
"consignee": "小明",
"provinceName": "山东省",
"cityName": "济南市",
"districtName": "历下区",
"streetName": "",
"address": "青云街二巷1008号",
"phone": "13333888877",
"planDays": null
}
]
],
"dayNumbers": null
}
]
\ No newline at end of file
]
import { Button, Drawer, Table } from "antd";
import { guid } from "@/utils/uuid";
import { Button, Drawer, FormInstance, Table } from "antd";
import { isNull } from "lodash";
import { useCallback, useEffect, useLayoutEffect, useState } from "react";
import DeliveryNoticeOrderFactory from "../../assets/handles/DeliveryNoticeOrder";
import { PlannedDeliveryMaterialExpandableTableColumn, PlannedDeliveryMaterialTableColumn } from "../../constants/page-table-column";
import ExpandedRowTableRender from "./ExpandedRowTableRender";
const selectedRowKeys = new Map()
interface DeliveryGoodTableModalProps {
form: FormInstance
onChange: (value) => void
}
/**
* 查询计划周期内的计划送货物料 Table Select
* @param form 当前页面操作的form
* @param onChange table 选择的callback (value:OrderInfo[]) => void
*/
function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) {
const { onChange } = props;
const { onChange, form } = props;
const [visible, setVisible] = useState(false)
const service = DeliveryNoticeOrderFactory.getInstance()
const [tableData, setTableData] = useState([])
const selectedRowKeys = new Map()
const handleVisible = useCallback(() => {
setVisible(true)
}, [visible])
......@@ -34,12 +39,18 @@ function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) {
}, [visible])
useEffect(() => {
service.getOrderDeliveryPlanProduct().then(res => {
service.getOrderDeliveryPlanOrderProductPage(form).then(res => {
if (isNull(res)) return;
const data = res.data
setTableData(data)
let result = data.map(v => {
return {
...v,
id: guid()
}
})
setTableData(result)
})
}, [])
}, [visible])
const expandedRowRender = (record, index) => {
let data = record;
......@@ -55,7 +66,7 @@ function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) {
return (
<ExpandedRowTableRender
row={index}
row={data.id}
dataSource={combination}
onChange={(keys, index) => {
selectedRowKeys.set(index, keys);
......@@ -82,12 +93,22 @@ function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) {
}
>
<Table
columns={PlannedDeliveryMaterialTableColumn}
rowKey={row => row.orderProductId}
dataSource={tableData}
expandedRowRender={expandedRowRender}
/>
{
tableData.map(t => {
return (
<Table
className="mt-16"
columns={PlannedDeliveryMaterialTableColumn}
rowKey={row => row.orderProductId}
dataSource={[t]}
expandedRowRender={expandedRowRender}
defaultExpandAllRows={true}
expandIcon={() => ""}
pagination={false}
/>
)
})
}
</Drawer>
</>
......
......@@ -23,6 +23,7 @@ function ExpandedRowTableRender(props: ExpandedRowTableRenderProps) {
const onSelectChange = (selectedRowKeys: any[]) => {
setSelectedRowKeys(selectedRowKeys)
let result = props.dataSource.filter(v => selectedRowKeys.includes(v.orderNo));
console.log(row)
onChange(result, row)
};
......
......@@ -62,17 +62,17 @@ export const DeliveryNoticeTableColumn: any = [
// 计划送货物料表格
export const PlannedDeliveryMaterialTableColumn: any = [
{ dataIndex: 'skuId', width: 80, ...MaterialNoColumn, },
{ dataIndex: 'productName', width: 192, ...MaterialNameColumn, },
{ width: 80, ...MaterialNoColumn, dataIndex: 'skuId', },
{ width: 192, ...MaterialNameColumn, dataIndex: 'productName', },
{ dataIndex: 'spec', width: 128, ...MaterialModelColumn, },
{ dataIndex: 'category', width: 96, ...ClassColumn, },
{ dataIndex: 'brand', width: 96, ...BrandColumn, },
{ dataIndex: 'unit', width: 64, ...UntilColumn, },
{ dataIndex: 'purchaseCount', width: 96, ...OredrNumColumn, },
{ dataIndex: 'receiveCount', width: 96, ...ConsigneeNumColumn, },
{ dataIndex: 'transitCount', width: 96, ...TransitNumColumn, },
{ dataIndex: 'leftCount', width: 96, ...DeliveredNumColumn, },
{ dataIndex: 'planCount', width: 128, ...PlannedDeliveryNumColumn, },
{ width: 96, ...OredrNumColumn, dataIndex: 'purchaseCountSum', },
{ ...ConsigneeNumColumn, dataIndex: 'receiveCountSum', width: 96, },
{ ...TransitNumColumn, dataIndex: 'transitCountSum', width: 96, },
{ ...DeliveredNumColumn, dataIndex: 'leftCountSum', width: 96, },
{ ...PlannedDeliveryNumColumn, dataIndex: 'planCountSum', width: 128, },
];
// 计划送货物料子表格
......@@ -89,12 +89,12 @@ export const PlannedDeliveryMaterialExpandableTableColumn: any = [
// 外部单据流转记录
export const ExternalRoamRecordTableColumn: any = [
{ dataIndex: 'id', ...FlowOnColumn, },
{ dataIndex: 'operatorRoleName', ...FlowRoleColumn, },
{ dataIndex: 'statusName', ...FlowStatusColumn, },
{ dataIndex: 'operation', ...FlowOptionsColumn, },
{ dataIndex: 'createTime', ...FlowOptionsTimeColumn, },
{ dataIndex: 'remark', ...FlowNoteColumn },
{ ...FlowOnColumn, dataIndex: 'id' },
{ ...FlowRoleColumn, dataIndex: 'operatorRoleName' },
{ ...FlowStatusColumn, dataIndex: 'statusName' },
{ ...FlowOptionsColumn, dataIndex: 'operation' },
{ ...FlowOptionsTimeColumn, dataIndex: 'createTime', },
{ ...FlowNoteColumn, dataIndex: 'remark', },
]
// 送货物料
......
......@@ -5,52 +5,32 @@
*/
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import React, { useCallback, useEffect, useState, useContext } from 'react'
import { BillsInfo, BuyerLabel, ConsigneeLabel, ConsigneePhoneLabel, ConsigneeTimeLabel, DeliveryAbstractLabel, DeliveryAddrLabel, DeliveryDateLabel, DeliveryGood, DeliveryInfo, DeliveryNameLabel, DeliveryNoLabel, DeliveryPhoneLabel, DeliverySlefAddrLabel, DeliveryTimeLabel, DeliveryTypeLabel, Distribution, LogisticsCarNoLabel, LogisticsCompanyLabel, LogisticsInfo, LogisticsNoLabel, NoteLabel, OutStatusLabel } from '../../constants'
import { BillsInfo, BuyerLabel, ConsigneeLabel, ConsigneePhoneLabel, ConsigneeTimeLabel, DeliveryAbstractLabel, DeliveryAddrLabel, DeliveryDateLabel, DeliveryGood, DeliveryInfo, DeliveryNameLabel, DeliveryNoLabel, DeliveryPhoneLabel, DeliverySlefAddrLabel, DeliveryTimeLabel, DeliveryTypeLabel, Distribution, LogisticsCarNoLabel, LogisticsCompanyLabel, LogisticsInfo, LogisticsNoLabel, NoteLabel, OutStatusLabel, ReceivingAddress } from '../../constants'
import { BaseInfo as ContentBox } from '@/components/BaseInfo'
import { Input, Table, Row, Col, Select, Radio, Form, Button } from 'antd';
import { DeliveryNoticeTableColumn } from '../../constants/page-table-column';
import { FormItem } from '@/components/FormItem';
import { DatePickerSelect } from '@/components/DatePickerSelect'
import DatePicker from '@/components/DatePicker';
import { AddressDrawer } from '@/components/AddressDrawer';
import { getLogisticsSelectListShipperAddress, postLogisticsShipperAddressAdd, postLogisticsShipperAddressUpdate } from '@/services/LogisticsV2Api';
import { getLogisticsSelectListReceiverAddress, getLogisticsSelectListShipperAddress, postLogisticsReceiverAddressAdd, postLogisticsReceiverAddressUpdate, postLogisticsShipperAddressAdd, postLogisticsShipperAddressUpdate } from '@/services/LogisticsV2Api';
import DeliveryGoodTableSelect from '../../components/DeliveryGoodTableSelect/DeliveryGoodTableSelect';
import { HarvestMaterialContextProvider, HarvestMaterialContext } from '../../assets/context';
import moment from 'moment';
import { HandelFormFieldsKeyValue } from '@/utils/form';
import { DeliveryNoteAddService } from '../../assets/handles/HandleFormSubmit';
import { RoleSelect } from '@/components/RoleSelect';
import DeliveryNoticeOrderFactory from '../../assets/handles/DeliveryNoticeOrder';
import LogisticsCompanyMerchantsSelect from '@/components/LogisticsCompanySelect/LogisticsCompanyMerchantsSelect';
import { values } from 'lodash';
const ContentBoxItem = ContentBox.BaseInfoItem;
const DeliveryNoticeManageSRMDetails: React.FC = () => {
const [tableDataSource, setTableDataSource] = useState([
{
"skuId": "demoData",
"productNo": "demoData",
"orderProductId": 2,
"productName": "demoData",
"spec": "demoData",
"category": "demoData",
"brand": "demoData",
"unit": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"orderNo": "demoData2",
"orderDigest": "demoData",
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
}
]);
const dataSource$ = useContext(HarvestMaterialContext)
const [tableDataSource, setTableDataSource] = useState();
const [form] = Form.useForm()
const service = new DeliveryNoteAddService(form);
const [anchors, setAnchors] = useState<AnchorsItem[]>([
BillsInfo,
......@@ -60,40 +40,22 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
DeliveryGood,
])
const initData = {
"digest": "11",
"remark": "22",
"buyerMemberId": "333",
"deliveryTime": moment('2015-01-14'),
"executorVO.consignee": "莫雷 ",
"deliveryRangeTime": [
moment('2015-01-15'),
moment('2015-01-16')
],
"executorVO.phone": "13286326255",
"sendTime": moment('2015-01-14 08:25:21'),
"receiveVO": {
"id": 5,
"shipperName": "李工",
"fullAddress": "天津市天津市河东区和平路",
"phone": "18800000000",
"isDefault": 1
},
"deliveryType": 1,
"executorVO.carNumbers": "11234",
"logisticsCompanyId": null,
"logisticsNo": "112334"
}
useEffect(() => {
form.setFieldsValue(initData)
form.setFieldsValue({ sourceType: 0 })
}, [])
const handleSubmit = useCallback(() => {
// console.log(form.getFieldsValue())
console.log(tableDataSource)
service.setTableData(tableDataSource);
service.submit().then(res => {
if (res.code === 1000) {
history.go(-1)
}
});
}, [form, tableDataSource])
return (
<AnchorPage title="送货单管理详情(SRM)"
anchors={anchors}
......@@ -106,6 +68,10 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<Form
form={form}
>
<FormItem name="sourceType">
<Input type="hidden" />
</FormItem>
<ContentBox title={BillsInfo.name} id={BillsInfo.key}>
<FormItem label={DeliveryAbstractLabel} name="digest">
<Input />
......@@ -115,8 +81,8 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<Input />
</FormItem>
<FormItem label={BuyerLabel} name="buyerMemberId">
<Input />
<FormItem label={BuyerLabel} name="member">
<RoleSelect />
</FormItem>
</ContentBox>
......@@ -126,8 +92,20 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<DatePickerSelect className='w-full' />
</FormItem>
<FormItem label={DeliveryNameLabel} name="executorVO.consignee">
<Input />
<FormItem label={DeliveryNameLabel} name="deliveryVO">
<AddressDrawer
addressListRequest={(val) => {
return getLogisticsSelectListReceiverAddress(val)
}}
sumbitRequest={{
update: (val) => {
return postLogisticsReceiverAddressUpdate(val)
},
add: (val) => {
return postLogisticsReceiverAddressAdd(val)
}
}}
/>
</FormItem>
<FormItem label={DeliveryTimeLabel} name="deliveryRangeTime">
......@@ -144,7 +122,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<DatePickerSelect className="w-full" />
</FormItem>
<FormItem label={DeliveryAddrLabel} name="receiveVO">
<FormItem label={ReceivingAddress} name="receiveVO">
<AddressDrawer
addressListRequest={(val) => {
return getLogisticsSelectListShipperAddress(val)
......@@ -175,10 +153,12 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<FormItem label={LogisticsCarNoLabel} name="executorVO.carNumbers">
<Input />
</FormItem>
<FormItem label={LogisticsCompanyLabel} name="logisticsCompanyId">
<Select>
<Select.Option>顺丰快递</Select.Option>
</Select>
<FormItem label={LogisticsCompanyLabel} name="logisticsCompanyInt"
rules={[
{ required: true }
]}
>
<LogisticsCompanyMerchantsSelect />
</FormItem>
<FormItem label={LogisticsNoLabel} name="logisticsNo">
<Input />
......@@ -188,7 +168,26 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<ContentBox title={DeliveryGood.name} id={DeliveryGood.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,
address: value[0].address,
phone: value[0].phone,
consignee: value[0].consignee,
receiverName: value[0].consignee,
fullAddress:`${value[0].provinceName}${value[0].cityName}${value[0].districtName}${value[0].streetName}${value[0].address}`
}
form.setFieldsValue({
'receiveVO': addr
})
}
setTableDataSource(value)
}}
/>
......
......@@ -12,6 +12,7 @@ import { DeliveryNoticeTableColumn, ExternalRoamRecordTableColumn } from '../../
import NoteFactoryService from '../../assets/handles/DeliveryNoteService';
import { useLocation } from 'umi';
import qs from 'query-string';
import { useDetailInfoById } from '../../assets/hooks/useDetailInfoById';
const ContentBoxItem = ContentBox.BaseInfoItem;
......@@ -31,15 +32,12 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
ExternalRoamRecord
])
const [info, setInfo] = useState<any>()
const [info] = useDetailInfoById(query.id);
const [tableDataSource, setTableDataSource] = useState([]);
const [totalCount, setTotalCount] = useState(1);
const [outerHistoryList, setOuterHistoryList] = useState([]);
useEffect(() => {
service.getDetailInfoById(query.id as string).then(res => {
setInfo(res)
})
service.getDetailInfoProductById(query.id as string).then(res => {
setTableDataSource(res.data)
......@@ -86,42 +84,38 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
</ContentBoxItem>
<ContentBoxItem label={DeliveryNameLabel}>
{info?.executorVO?.consignee}
{info?.deliverVO?.consignee}
</ContentBoxItem>
<ContentBoxItem label={DeliveryTimeLabel}>
{info?.sendTime}
</ContentBoxItem>
<ContentBoxItem label={DeliveryPhoneLabel}>
{info?.executorVO?.phone}
{info?.deliverVO?.phone}
</ContentBoxItem>
</ContentBox>
<ContentBox title={DeliveryInfo.name} id={DeliveryInfo.key}>
<ContentBoxItem label={ConsigneeTimeLabel}>
{info?.deliverVO?.receiverBO}
</ContentBoxItem>
<ContentBoxItem label={DeliveryAddrLabel}>
<ContentBoxItem label={info?.deliveryType === 0 ? DeliveryAddrLabel : DeliverySlefAddrLabel}>
<div>
{info?.receiverBO?.provinceName}
{info?.receiverBO?.cityName}
{info?.receiverBO?.districtName}
{info?.receiverBO?.streetName}
{info?.receiverBO?.address}
{info?.deliverVO?.provinceName}
{info?.deliverVO?.cityName}
{info?.deliverVO?.districtName}
{info?.deliverVO?.streetName}
{info?.deliverVO?.address}
</div>
<div>
{info?.receiverBO.phone}
{info?.receiverBO.consignee}
{info?.deliverVO.phone}
{info?.deliverVO.consignee}
</div>
</ContentBoxItem>
<ContentBoxItem label={DeliverySlefAddrLabel}>
</ContentBoxItem>
</ContentBox>
<ContentBox title={LogisticsInfo.name} id={LogisticsInfo.key}>
......
/**
* 订单能力 - 送货单 - 送货单管理详情SRM
* @author: Gavin
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import React, { useCallback, useEffect, useState, useContext } from 'react'
import { BillsInfo, BuyerLabel, ConsigneeLabel, ConsigneePhoneLabel, ConsigneeTimeLabel, DeliveryAbstractLabel, DeliveryAddrLabel, DeliveryDateLabel, DeliveryGood, DeliveryInfo, DeliveryNameLabel, DeliveryNoLabel, DeliveryPhoneLabel, DeliverySlefAddrLabel, DeliveryTimeLabel, DeliveryTypeLabel, Distribution, LogisticsCarNoLabel, LogisticsCompanyLabel, LogisticsInfo, LogisticsNoLabel, NoteLabel, OutStatusLabel, ReceivingAddress } from '../../constants'
import { BaseInfo as ContentBox } from '@/components/BaseInfo'
import { Input, Table, Row, Col, Select, Radio, Form, Button } from 'antd';
import { DeliveryNoticeTableColumn } from '../../constants/page-table-column';
import { FormItem } from '@/components/FormItem';
import { DatePickerSelect } from '@/components/DatePickerSelect'
import { AddressDrawer } from '@/components/AddressDrawer';
import { getLogisticsSelectListReceiverAddress, getLogisticsSelectListShipperAddress, postLogisticsReceiverAddressAdd, postLogisticsReceiverAddressUpdate, postLogisticsShipperAddressAdd, postLogisticsShipperAddressUpdate } from '@/services/LogisticsV2Api';
import DeliveryGoodTableSelect from '../../components/DeliveryGoodTableSelect/DeliveryGoodTableSelect';
import { HarvestMaterialContextProvider, HarvestMaterialContext } from '../../assets/context';
import moment from 'moment';
import { HandelFormFieldsKeyValue } from '@/utils/form';
import { DeliveryNoteAddService } from '../../assets/handles/HandleFormSubmit';
import { RoleSelect } from '@/components/RoleSelect';
import DeliveryNoticeOrderFactory from '../../assets/handles/DeliveryNoticeOrder';
import LogisticsCompanyMerchantsSelect from '@/components/LogisticsCompanySelect/LogisticsCompanyMerchantsSelect';
import { useLocation } from 'umi';
import { useDetailInfoById } from '../../assets/hooks/useDetailInfoById';
const ContentBoxItem = ContentBox.BaseInfoItem;
const DeliveryNoticeManageSRMEdit: React.FC = () => {
const [tableDataSource, setTableDataSource] = useState();
const location: any = useLocation()
const { id } = location.query
const [info] = useDetailInfoById(id);
const [form] = Form.useForm()
const service = new DeliveryNoteAddService(form);
const [anchors, setAnchors] = useState<AnchorsItem[]>([
BillsInfo,
Distribution,
DeliveryInfo,
LogisticsInfo,
DeliveryGood,
])
useEffect(() => {
form.setFieldsValue({ sourceType: 0 })
console.log(info)
form.setFieldsValue(info)
}, [info])
const handleSubmit = useCallback(() => {
service.setTableData(tableDataSource);
service.submit().then(res => {
if (res.code === 1000) {
history.go(-1)
}
});
}, [form, tableDataSource])
return (
<AnchorPage title="送货单管理详情(SRM)"
anchors={anchors}
extra={
<Button.Group>
<Button onClick={handleSubmit} type='primary'>提交</Button>
</Button.Group>
}
>
<Form
form={form}
>
<FormItem name="sourceType">
<Input type="hidden" />
</FormItem>
<ContentBox title={BillsInfo.name} id={BillsInfo.key}>
<FormItem label={DeliveryAbstractLabel} name="digest">
<Input />
</FormItem>
<FormItem label={NoteLabel} name="remark">
<Input />
</FormItem>
<FormItem label={BuyerLabel} name="member">
<RoleSelect />
</FormItem>
</ContentBox>
<ContentBox title={Distribution.name} id={Distribution.key}>
<FormItem label={DeliveryDateLabel} name="deliveryTime">
<DatePickerSelect className='w-full' />
</FormItem>
<FormItem label={DeliveryNameLabel} name="deliveryVO">
<AddressDrawer
addressListRequest={(val) => {
return getLogisticsSelectListReceiverAddress(val)
}}
sumbitRequest={{
update: (val) => {
return postLogisticsReceiverAddressUpdate(val)
},
add: (val) => {
return postLogisticsReceiverAddressAdd(val)
}
}}
/>
</FormItem>
<FormItem label={DeliveryTimeLabel} name="deliveryRangeTime">
<DatePickerSelect.RangePicker className="w-full" picker='time' />
</FormItem>
<FormItem label={DeliveryPhoneLabel} name="executorVO.phone">
<Input />
</FormItem>
</ContentBox>
<ContentBox title={DeliveryInfo.name} id={DeliveryInfo.key}>
<FormItem label={ConsigneeTimeLabel} name="sendTime">
<DatePickerSelect className="w-full" />
</FormItem>
<FormItem label={ReceivingAddress} name="receiveVO">
<AddressDrawer
addressListRequest={(val) => {
return getLogisticsSelectListShipperAddress(val)
}}
sumbitRequest={{
update: (val) => {
return postLogisticsShipperAddressUpdate(val)
},
add: (val) => {
return postLogisticsShipperAddressAdd(val)
}
}}
/>
</FormItem>
</ContentBox>
<ContentBox title={LogisticsInfo.name} id={LogisticsInfo.key}>
<FormItem label={DeliveryTypeLabel} name="deliveryType">
<Radio.Group>
<Radio.Button value={1}>物流</Radio.Button>
<Radio.Button value={2}>自提</Radio.Button>
{/* <Radio.Button value={3}>无效配送</Radio.Button> */}
</Radio.Group>
</FormItem>
<FormItem label={LogisticsCarNoLabel} name="executorVO.carNumbers">
<Input />
</FormItem>
<FormItem label={LogisticsCompanyLabel} name="logisticsCompanyInt"
rules={[
{ required: true }
]}
>
<LogisticsCompanyMerchantsSelect />
</FormItem>
<FormItem label={LogisticsNoLabel} name="logisticsNo">
<Input />
</FormItem>
</ContentBox>
<ContentBox title={DeliveryGood.name} id={DeliveryGood.key} cols={1}>
<DeliveryGoodTableSelect
form={form}
onChange={(value) => {
console.log(value)
setTableDataSource(value)
}}
/>
<HarvestMaterialContextProvider value={{
dataSource: tableDataSource
}}>
<Table
rowKey={row => row.orderNo}
columns={DeliveryNoticeTableColumn}
dataSource={tableDataSource}
/>
</HarvestMaterialContextProvider>
</ContentBox>
</Form>
</AnchorPage>
)
}
export default DeliveryNoticeManageSRMEdit
\ No newline at end of file
......@@ -19,13 +19,14 @@ import { deliveryNoticeManageSRMSchema } from './schema'
import NoteFactoryService from '../../assets/handles/DeliveryNoteService'
import dayjs from 'dayjs'
import { TagStatus, TagStatusFactory } from '../../utils'
import { Link } from 'umi'
import { Link, useHistory } from 'umi'
const DeliveryNoticeManageSRM: React.FC = () => {
const ref = useRef<any>({})
const formActions = createFormActions()
const service = NoteFactoryService.getInstance();
const tagStatus = TagStatusFactory.getInstance();
const history = useHistory()
const statusTxt = new Map([[1, '已提交'], [2, '已收货'], [3, '已作废']]);
......@@ -50,7 +51,7 @@ const DeliveryNoticeManageSRM: React.FC = () => {
'查看': true,
}
const operationHandler = {
'修改': () => { console.log('修改 :>> ',) },
'修改': () => { history.push(`/memberCenter/order/deliveryNotice/manageSRM/edit?id=${record.id}`) },
'作废': () => { console.log('作废 :>> ',) },
'查看': () => { console.log('查看 :>> ',) },
}
......
......@@ -3,38 +3,29 @@
* @author: Gavin
* @description:
*/
import React, { useRef, useState } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Space, Tag } from 'antd'
import StandardTable from '@/components/StandardTable'
import { ColumnType } from 'antd/lib/table'
import TableOperation from '@/components/TableOperation'
import EyePreview from '@/components/EyePreview'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { deliveryNoteManageSchema } from './schema'
import React, { useRef, useState } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Space, Tag } from 'antd'
import StandardTable from '@/components/StandardTable'
import { ColumnType } from 'antd/lib/table'
import TableOperation from '@/components/TableOperation'
import EyePreview from '@/components/EyePreview'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { deliveryNoteManageSchema } from './schema'
import ReceiveNoteFacotry from '../../assets/handles/ReceiveNotePage'
import { TagStatusFactory } from '../../utils'
const tagStatusColor = {
// 待提交
2: { color: '#f4f5f7', fontColor: '#5c626a' },
// 待确认
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 tagService = TagStatusFactory.getInstance()
const DeliveryNoteManage: React.FC = () => {
const ref = useRef<any>({})
const formActions = createFormActions()
const service = ReceiveNoteFacotry.getInstance();
const controllerBtns = (<Space></Space>)
const renderOptionButton = (record: any) => {
const btnAuthOfOperationTextMap = {
......@@ -68,21 +59,23 @@ const DeliveryNoteManage: React.FC = () => {
width: 160,
render: (text: unknown, record: unknown) => <EyePreview url='/memberCenter/order/receivingNote/deliveryNoteManage/details'>{text}</EyePreview>
},
{ title: '收货单摘要', dataIndex: 'id2', key: 'id2' },
{ title: '收货日期', dataIndex: 'id3', key: 'id3' },
{ title: '送货单号', dataIndex: 'id3', key: 'id3' },
{ title: '送货日期', dataIndex: 'id3', key: 'id3' },
{ title: '采购会员', dataIndex: 'id5', key: 'id5' },
{ title: '单据时间', dataIndex: 'id4', key: 'id4' },
{ title: '收货单摘要', dataIndex: 'digest', key: 'digest' },
{ title: '送货单号', dataIndex: 'deliveryNo', key: 'deliveryNo' },
{ title: '送货日期', dataIndex: 'deliveryTime', key: 'deliveryTime' },
{ title: '采购会员', dataIndex: 'buyerMemberName', key: 'buyerMemberName' },
{ title: '单据时间', dataIndex: 'createTime', key: 'createTime' },
{
title: '外部状态',
dataIndex: 'id6',
key: 'id6',
render: (text: string, record: any) => (
<Tag color={tagStatusColor[record.id]?.color}>
<span style={{ color: tagStatusColor[record.id]?.fontColor }}>{text}</span>
</Tag>
)
render: (text: string, record: any) => {
const styles = tagService.getTagStyle(record.outerStatus);
return (
<Tag color={styles.bgColor}>
<span style={{ color: styles.fontColor }}>{text}</span>
</Tag>
)
}
},
{
title: '操作',
......@@ -94,22 +87,7 @@ const DeliveryNoteManage: React.FC = () => {
]
const fetchData = (params: unknown) => {
console.log('params :>> ', params);
return new Promise((resolve) => {
const data = {
totalCount: 1, data: [
{ id: 1, id2: 2, id3: 3, id4: 4, id5: 5, id6: 6 },
{ id: 2, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
{ 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)
})
return service.getQuery(params);
}
return (
......
......@@ -15,6 +15,8 @@ import { createFormActions } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { deliveryNoteQuerySchema } from './schema'
import ReceiveNoteFacotry from '../../assets/handles/ReceiveNotePage'
import { TagStatusFactory } from '../../utils'
......@@ -30,25 +32,13 @@ enum StatusEnum {
}
const tagStatusColor: IStatusEnum = {
// 待提交
[StatusEnum.ToSbumit]: { color: '#f4f5f7', fontColor: '#5c626a' },
// 待确认
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 DeliveryNoteQuery: React.FC = () => {
const ref = useRef<any>({})
const formActions = createFormActions()
const service = ReceiveNoteFacotry.getInstance('Query')
const tagStatus = TagStatusFactory.getInstance();
const controllerBtns = (<Space></Space>)
const renderOptionButton = (record: any) => {
const btnAuthOfOperationTextMap = {
......@@ -79,20 +69,23 @@ const DeliveryNoteQuery: React.FC = () => {
width: 160,
render: (text: unknown, record: unknown) => <EyePreview url='/memberCenter/order/receivingNote/deliveryNoteQuery/details'>{text}</EyePreview>
},
{ title: '收货单摘要', dataIndex: 'id2', key: 'id2' },
{ title: '收货日期', dataIndex: 'id3', key: 'id3' },
{ title: '送货日期', dataIndex: 'id3', key: 'id3' },
{ title: '采购会员', dataIndex: 'id5', key: 'id5' },
{ title: '单据时间', dataIndex: 'id4', key: 'id4' },
{ title: '收货单摘要', dataIndex: 'digest', key: 'digest' },
{ title: '收货日期', dataIndex: 'receiveTime', key: 'receiveTime' },
{ title: '送货日期', dataIndex: 'deliveryTime', key: 'deliveryTime' },
{ title: '采购会员', dataIndex: 'buyerMemberName', key: 'buyerMemberName' },
{ title: '单据时间', dataIndex: 'createTime', key: 'createTime' },
{
title: '外部状态',
dataIndex: 'id6',
key: 'id6',
render: (text: string, record: any) => (
<Tag color={tagStatusColor[record.id]?.color}>
<span style={{ color: tagStatusColor[record.id]?.fontColor }}>{text}</span>
</Tag>
)
render: (text: string, record: any) => {
const styles = tagStatus.getTagStyle(record.outerStatus)
return (
<Tag color={styles.bgColor}>
<span style={{ color: styles.fontColor }}>{record.outerStatus}</span>
</Tag>
)
}
},
{
title: '操作',
......@@ -104,22 +97,7 @@ const DeliveryNoteQuery: React.FC = () => {
]
const fetchData = (params: unknown) => {
console.log('params :>> ', params);
return new Promise((resolve) => {
const data = {
totalCount: 1, data: [
{ id: 1, id2: 2, id3: 3, id4: 4, id5: 5, id6: 6 },
{ id: 2, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
{ 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)
})
return service.getQuery(params).then(res => res.data)
}
return (
......
import moment, { isMoment, Moment } from "moment";
export function HandelFormFieldsKeyValue(fields) {
let result = {}
for (const field in fields) {
const split = field.split('.');
if (split.length > 1) {
//为空的时候创建一个默认对象
if (result[split[0]] === undefined) {
result[split[0]] = {}
}
result[split[0]][split[1]] = momentFormatValue(fields[field]);
} else {
if (['deliveryRangeTime'].includes(field)) {
result[field] = fields[field].map(v => momentFormatValue(v, 'HH:mm:ss'))
} else {
result[field] = momentFormatValue(fields[field]);
}
}
}
return result;
}
export function momentFormatValue(value, format = "YYYY-MM-DD") {
return isMoment(value) ? value.format(format) : value
}
function HandelFormFieldsKeyValue() {
}
\ No newline at end of file
function S4() {
return (((1 + Math.random()) * 0x10000 | 0).toString(16))
}
function guid() {
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4())
}
export { guid }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment