增加数据加载进度指示

feature/2.0-sales-trade
LiaoYijun 3 years ago
parent 428069ac0d
commit c4579cdf1a

@ -13,12 +13,13 @@ class CustomerServices {
this.startDateString = this.startDate.format(config.DATE_FORMAT); this.startDateString = this.startDate.format(config.DATE_FORMAT);
this.endDateString = this.endDate.format(config.DATE_FORMAT) + '%2023:59'; this.endDateString = this.endDate.format(config.DATE_FORMAT) + '%2023:59';
this.dateType = 'startDate'; this.dateType = 'startDate';
this.inProgress = false;
this.selectedAgent = {VendorName: '请选择地接社'}; this.selectedAgent = {VendorName: '请选择地接社'};
makeAutoObservable(this); makeAutoObservable(this);
} }
fetchAgentList() { fetchAgentList() {
this.inProgress = true;
req.fetchJSON(config.HT_HOST + '/service-web/QueryData/GetAgentGroupInfoALL?DateType=' + this.dateType + '&Date1=' + this.startDateString + '&Date2=' + this.endDateString + '&OldDate1=' + this.startDateString + '&OldDate2=' + this.endDateString) req.fetchJSON(config.HT_HOST + '/service-web/QueryData/GetAgentGroupInfoALL?DateType=' + this.dateType + '&Date1=' + this.startDateString + '&Date2=' + this.endDateString + '&OldDate1=' + this.startDateString + '&OldDate2=' + this.endDateString)
.then(json => { .then(json => {
if (json.errcode === 0) { if (json.errcode === 0) {
@ -119,10 +120,14 @@ class CustomerServices {
]; ];
}); });
} }
})
.then(() => {
this.inProgress = false;
}); });
} }
fetchGroupListByAgentId(agentId) { fetchGroupListByAgentId(agentId) {
this.inProgress = true;
this.selectedAgent = {VendorName: '...'}; this.selectedAgent = {VendorName: '...'};
this.groupList = []; this.groupList = [];
this.groupListColumns = []; this.groupListColumns = [];
@ -225,6 +230,9 @@ class CustomerServices {
]; ];
}); });
} }
})
.then(() => {
this.inProgress = false;
}); });
} }
@ -250,6 +258,7 @@ class CustomerServices {
endDateString; endDateString;
dateType; dateType;
selectedAgent; selectedAgent;
inProgress;
groupList = []; groupList = [];

@ -12,10 +12,10 @@ import zhCNlocale from 'antd/es/date-picker/locale/zh_CN';
const AgentList = () => { const AgentList = () => {
const { customerServicesStore } = useContext(stores_Context); const {customerServicesStore} = useContext(stores_Context);
const agentList = customerServicesStore.agentList; const agentList = customerServicesStore.agentList;
const agentListColumns = customerServicesStore.agentListColumns; const agentListColumns = customerServicesStore.agentListColumns;
const { startDate, endDate, dateType } = customerServicesStore; const {startDate, endDate, dateType, inProgress} = customerServicesStore;
const handleSearchClick = () => { const handleSearchClick = () => {
customerServicesStore.fetchAgentList(); customerServicesStore.fetchAgentList();
@ -57,7 +57,7 @@ const AgentList = () => {
<Button <Button
type="primary" type="primary"
icon={<SearchOutlined />} icon={<SearchOutlined />}
loading={false} loading={inProgress}
onClick={() => { onClick={() => {
handleSearchClick(); handleSearchClick();
}}> }}>
@ -73,7 +73,7 @@ const AgentList = () => {
columns={agentListColumns} columns={agentListColumns}
size="small" size="small"
rowKey={(record) => record.key} rowKey={(record) => record.key}
loading={false} loading={inProgress}
pagination={false} pagination={false}
scroll={{ x: "100%" }} scroll={{ x: "100%" }}
/> />

@ -22,7 +22,7 @@ const GroupList = () => {
const groupList = customerServicesStore.groupList; const groupList = customerServicesStore.groupList;
const groupListColumns = customerServicesStore.groupListColumns; const groupListColumns = customerServicesStore.groupListColumns;
const {startDate, endDate, dateType} = customerServicesStore; const {startDate, endDate, dateType, inProgress} = customerServicesStore;
return ( return (
<> <>
@ -63,7 +63,7 @@ const GroupList = () => {
<Button <Button
type="primary" type="primary"
icon={<SearchOutlined />} icon={<SearchOutlined />}
loading={false} loading={inProgress}
onClick={() => { onClick={() => {
customerServicesStore.fetchGroupListByAgentId(agentId); customerServicesStore.fetchGroupListByAgentId(agentId);
customerServicesStore.fetchAgentList(); customerServicesStore.fetchAgentList();
@ -75,7 +75,7 @@ const GroupList = () => {
<Row> <Row>
<Col span={24}> <Col span={24}>
<Typography.Title level={3}>{customerServicesStore.selectedAgent.VendorName}</Typography.Title> <Typography.Title level={3}>{customerServicesStore.selectedAgent.VendorName}</Typography.Title>
<Table dataSource={groupList} columns={groupListColumns} size="small" rowKey={(record) => record.key} loading={false} pagination={false} scroll={{ x: "100%" }} /> <Table dataSource={groupList} columns={groupListColumns} size="small" rowKey={(record) => record.key} loading={inProgress} pagination={false} scroll={{ x: "100%" }} />
</Col> </Col>
</Row> </Row>
</Space> </Space>

Loading…
Cancel
Save