保存进度!
This commit is contained in:
@@ -32,4 +32,81 @@ interface RankingListResponse
|
||||
renewalRankintList: RankingListItem[];
|
||||
};
|
||||
|
||||
export { type RankingListRequest, type RankingListResponse };
|
||||
/**
|
||||
* 请求坐席排行榜。
|
||||
* @param reqParam 请求参数
|
||||
* @param rander 保存请求结果的回调函数
|
||||
* @returns 返回RankingListResponse对象,里面包含请求状态和数据。
|
||||
*/
|
||||
function requestRankingList( reqParam: RankingListRequest, rander: any ): void // eslint-disable-line
|
||||
{
|
||||
// let attachingRankingList: RankingListItem[];
|
||||
// let renewalRankintList: RankingListItem[];
|
||||
|
||||
const rankingListResponse: RankingListResponse = {
|
||||
success: false,
|
||||
message: "",
|
||||
departmentCode: reqParam.departmentCode,
|
||||
year: reqParam.year,
|
||||
month: reqParam.month,
|
||||
attachingRankingList: [],
|
||||
renewalRankintList: [],
|
||||
};
|
||||
|
||||
instance.request(
|
||||
{
|
||||
method: "post",
|
||||
url: API_URL.URL_RANKINGLIST,
|
||||
data: reqParam,
|
||||
})
|
||||
.then(( response ) =>
|
||||
{
|
||||
const data: RankingListResponse = response.data as RankingListResponse;
|
||||
|
||||
rankingListResponse.success = data.success ?? false;
|
||||
rankingListResponse.message = data.message ?? "";
|
||||
rankingListResponse.departmentCode = data.departmentCode ?? "";
|
||||
rankingListResponse.year = data.year ?? "";
|
||||
rankingListResponse.month = data.month ?? "";
|
||||
|
||||
// 遍历排行榜元素
|
||||
for ( const item of ( data.attachingRankingList ?? [] )) // eslint-disable-line
|
||||
{
|
||||
const index: number = item.index ?? -1;
|
||||
|
||||
if ( index === -1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
rankingListResponse.attachingRankingList.push( item );
|
||||
}
|
||||
|
||||
for ( const item of ( data.renewalRankintList ?? [] )) // eslint-disable-line
|
||||
{
|
||||
const index: number = item.index ?? -1;
|
||||
|
||||
if ( index === -1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
rankingListResponse.renewalRankintList.push( item );
|
||||
}
|
||||
|
||||
// 调用回调函数保存数据
|
||||
rander( rankingListResponse );
|
||||
|
||||
console.log( data );
|
||||
})
|
||||
.catch(( error ) =>
|
||||
{
|
||||
console.log( error );
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
type RankingListRequest,
|
||||
type RankingListResponse,
|
||||
requestRankingList
|
||||
};
|
||||
|
Reference in New Issue
Block a user