Commit 4beddd16 authored by Gavin Peng's avatar Gavin Peng

fix: 修复选择会员组件分页器已知问题

parent fe2e17d3
......@@ -32,6 +32,7 @@ function RoleSelect(props: RoleSelectProps) {
const [dataSource, setDataSource] = useState([])
const [total, setTotal] = useState(0)
const [current, setCurrent] = useState(1);
const [pageSize, setPageSize] = useState(10);
const showDrawer = useCallback(() => {
setVisible(true)
......@@ -106,12 +107,16 @@ function RoleSelect(props: RoleSelectProps) {
columns={TableMemberColumn}
dataSource={dataSource}
pagination={{
total: total,
pageSize: 10,
current: current,
onChange: (page: number) => {
form.setFieldsValue({ 'current': page });
setCurrent(page);
position: ['bottomCenter'],
total,
pageSize,
current,
showTotal: (total: number, range: [number, number]) => (`共 ${total} 条`),
showQuickJumper: true,
onChange: (page: number, pageSize: number) => {
form.setFieldsValue({ 'current': page })
setCurrent(page)
setPageSize(pageSize)
fetchData()
}
}}
......
......@@ -7,7 +7,7 @@
import { history } from 'umi'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { BaseInfo as base_Info, Remarks, PlanningCycle, SupplyMembersLabel, PlanSummary, ExternalState, Circulation, Purchaser, SubmitDeliveryPlan, Supplier, ConfirmDeliveryPlan, PlannedDelivery, DeliveryPlanText, DeliveryPlanRemark, CreateDeliveryPlanTitleSRM } from '../../constants'
import { Button, DatePicker, Form, Input, InputNumber, message, Space, Steps, Table } from 'antd'
import { Button, DatePicker, Form, Input, InputNumber, message, Space, Spin, Steps, Table } from 'antd'
import { SaveOutlined } from '@ant-design/icons'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import _ from 'lodash'
......@@ -55,7 +55,9 @@ const initExpandIconColumn = [
const datesRef = useRef<any>(null)
const materialTableDataRef = useRef(null)
const [iAnchors, setiAnchors] = useState<AnchorsItem[]>([
const [spinning, setSpinning] = useState<boolean>(false)
const [iAnchors, setIAnchors] = useState<AnchorsItem[]>([
Circulation,
base_Info,
PlannedDelivery,
......@@ -78,8 +80,6 @@ const initExpandIconColumn = [
const [selectedMember, setSelectedMember] = useState<any>({})
// 计划送货物料 列表
const [materialTableData, setMaterialTableData] = useState<any>(null)
// 外部流转单据记录
const [externalRoamRecordData, setExternalRoamRecordData] = useState<any>(null)
// 保存
const save = () => {
......@@ -87,8 +87,10 @@ const initExpandIconColumn = [
// console.log('values :>> ', values)
if (_.isEmpty(materialTableDataRef.current)) {
message.warning('没有找到可执行计划送货')
setSpinning(false)
return
}
setSpinning(true)
const productList = materialTableDataRef.current.map((item: any) => {
return {
...item,
......@@ -111,7 +113,12 @@ const initExpandIconColumn = [
remark: values.remark,
productList
}).then((res: any) => {
console.log('保存 :>> ', res)
setSpinning(false)
if (res.code === 1000) {
history.goBack()
}
}).catch(err => {
setSpinning(false)
})
})
}
......@@ -202,6 +209,7 @@ const initExpandIconColumn = [
}, [selectedDate, selectedMember])
return (
<Spin spinning={spinning}>
<AnchorPage
title={CreateDeliveryPlanTitleSRM}
onBack={() => history.goBack()}
......@@ -284,6 +292,7 @@ const initExpandIconColumn = [
</BaseInfo>
</Form>
</AnchorPage>
</Spin>
)
}
......
......@@ -7,7 +7,7 @@ import React, { useEffect, useRef, useState } from 'react'
import { history, useHistory } from 'umi'
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import { BaseInfo as base_Info, Remarks, PlanningCycle, SupplyMembersLabel, PlanSummary, ExternalRoamRecord, ExternalState, Circulation, Purchaser, SubmitDeliveryPlan, Supplier, ConfirmDeliveryPlan, PlannedDelivery, DeliveryPlanRemark } from '../../constants'
import { Button, Form, Input, InputNumber, message, Space, Steps, Table, Tag } from 'antd'
import { Button, Form, Input, InputNumber, message, Space, Spin, Steps, Table, Tag } from 'antd'
import { SaveOutlined } from '@ant-design/icons'
import BaseInfo from '@/components/BaseInfo/BaseInfo'
import { ExternalRoamRecordTableColumn } from '../../constants/page-table-column'
......@@ -32,7 +32,9 @@ const DeliveryPlanAwaitSRMUpdate: React.FC = () => {
const datesRef = useRef(null)
const materialTableDataRef = useRef(null)
const [iAnchors, setiAnchors] = useState<AnchorsItem[]>([
const [spinning, setSpinning] = useState<boolean>(false)
const [iAnchors, setIAnchors] = useState<AnchorsItem[]>([
Circulation,
base_Info,
PlannedDelivery,
......@@ -85,6 +87,7 @@ const DeliveryPlanAwaitSRMUpdate: React.FC = () => {
message.warning('没有找到可执行计划送货')
return
}
setSpinning(true)
const orders = materialTableDataRef.current.flatMap((item: any) => item.orders).flatMap((o: any) => ({
...o,
planDays: Object.keys(o).filter((f: any) => f.startsWith('$')).map((p: any) => o[p])
......@@ -95,7 +98,12 @@ const DeliveryPlanAwaitSRMUpdate: React.FC = () => {
remark: values.remark,
orders
}).then((res: any) => {
console.log('保存 :>> ', res)
setSpinning(false)
if (res.code === 1000) {
history.goBack()
}
}).catch(err => {
setSpinning(false)
})
})
}
......@@ -181,6 +189,7 @@ const DeliveryPlanAwaitSRMUpdate: React.FC = () => {
}, [])
return (
<Spin spinning={spinning}>
<AnchorPage
title={details?.planNo}
onBack={() => history.goBack()}
......@@ -254,6 +263,7 @@ const DeliveryPlanAwaitSRMUpdate: React.FC = () => {
</BaseInfo>
</Form>
</AnchorPage>
</Spin>
)
}
......
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