保存进度!
This commit is contained in:
		@@ -8,6 +8,6 @@
 | 
				
			|||||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved.
 | 
					 * Copyright (c) ${2022} by Kane, All Rights Reserved.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { testNewCitizen } from "./identify.js";
 | 
					import { testRankingListRequest } from "./testRankingListRequest.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
testNewCitizen();
 | 
					testRankingListRequest();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ import axios, { type AxiosInstance } from "axios";
 | 
				
			|||||||
const service: AxiosInstance = axios.create(
 | 
					const service: AxiosInstance = axios.create(
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        baseURL: "",
 | 
					        baseURL: "",
 | 
				
			||||||
        timeout: 5000,
 | 
					        timeout: 10000,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,4 +32,81 @@ interface RankingListResponse
 | 
				
			|||||||
    renewalRankintList: RankingListItem[];
 | 
					    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
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,6 +64,8 @@ import { useRouter } from "vue-router";
 | 
				
			|||||||
import { getCallerInfo } from "@/utils/api/localStorage.js";
 | 
					import { getCallerInfo } from "@/utils/api/localStorage.js";
 | 
				
			||||||
import { ElMessage } from "element-plus";
 | 
					import { ElMessage } from "element-plus";
 | 
				
			||||||
import { type Archievement, queryDepartmentArchievement } from "@/utils/archievement.js";
 | 
					import { type Archievement, queryDepartmentArchievement } from "@/utils/archievement.js";
 | 
				
			||||||
 | 
					import { RankingListItem } from "@/types/cpicxim/RankingListItem.js";
 | 
				
			||||||
 | 
					import { type RankingListRequest, type RankingListResponse, requestRankingList } from "@/utils/ranking.js";
 | 
				
			||||||
import { type Department } from "@/types/cpicxim/Department";
 | 
					import { type Department } from "@/types/cpicxim/Department";
 | 
				
			||||||
import ArchievementChart from "@/components/ArchievementChartComponent.vue";
 | 
					import ArchievementChart from "@/components/ArchievementChartComponent.vue";
 | 
				
			||||||
import ArchievementCompleteRateComponent from "@/components/ArchievementCompleteRateComponent.vue";
 | 
					import ArchievementCompleteRateComponent from "@/components/ArchievementCompleteRateComponent.vue";
 | 
				
			||||||
@@ -73,6 +75,21 @@ import RankingListComponent from "@/components/RankingListComponent.vue";
 | 
				
			|||||||
import { logout } from "@/utils/account.js";
 | 
					import { logout } from "@/utils/account.js";
 | 
				
			||||||
import { type TelSaler } from "@/types/cpicxim/TelSaler";
 | 
					import { type TelSaler } from "@/types/cpicxim/TelSaler";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					interface ui
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    currentMonth: string;
 | 
				
			||||||
 | 
					    chartData: number[];
 | 
				
			||||||
 | 
					    totalArchievement: number;
 | 
				
			||||||
 | 
					    attaching_rate: string;
 | 
				
			||||||
 | 
					    insurance_renewal_rate: string; // 续保率
 | 
				
			||||||
 | 
					    leading_reward_gainers: string[]; // 领跑奖
 | 
				
			||||||
 | 
					    advance_reward_gainers: string[]; // 飞跃奖
 | 
				
			||||||
 | 
					    dishonorPersons: string[];
 | 
				
			||||||
 | 
					    showUI: boolean; // 用来刷新页面的开关
 | 
				
			||||||
 | 
					    attachingRankingList: RankingListItem[]; // 坐席车非渗透率榜单
 | 
				
			||||||
 | 
					    renewalRankingList: RankingListItem[];
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
    name: "DesktopArchievement",
 | 
					    name: "DesktopArchievement",
 | 
				
			||||||
    components: {
 | 
					    components: {
 | 
				
			||||||
@@ -88,7 +105,7 @@ export default {
 | 
				
			|||||||
        const numInChinese = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二",];
 | 
					        const numInChinese = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二",];
 | 
				
			||||||
        const router = useRouter();
 | 
					        const router = useRouter();
 | 
				
			||||||
        const callerInfo: TelSaler = getCallerInfo();
 | 
					        const callerInfo: TelSaler = getCallerInfo();
 | 
				
			||||||
        const ui = reactive({
 | 
					        const ui: ui = reactive({
 | 
				
			||||||
            currentMonth: numInChinese[monthIndex.getMonth() - 1],
 | 
					            currentMonth: numInChinese[monthIndex.getMonth() - 1],
 | 
				
			||||||
            chartData: [0,], // 业绩表
 | 
					            chartData: [0,], // 业绩表
 | 
				
			||||||
            totalArchievement: 0, // 总业绩
 | 
					            totalArchievement: 0, // 总业绩
 | 
				
			||||||
@@ -98,6 +115,8 @@ export default {
 | 
				
			|||||||
            advance_reward_gainers: ["",], // 飞跃奖
 | 
					            advance_reward_gainers: ["",], // 飞跃奖
 | 
				
			||||||
            dishonorPersons: ["",],
 | 
					            dishonorPersons: ["",],
 | 
				
			||||||
            showUI: true, // 用来刷新页面的开关
 | 
					            showUI: true, // 用来刷新页面的开关
 | 
				
			||||||
 | 
					            attachingRankingList: [], // 坐席车非渗透率榜单
 | 
				
			||||||
 | 
					            renewalRankingList: [], // 坐席续保率榜单
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        const timerHandler = 0;
 | 
					        const timerHandler = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -114,8 +133,8 @@ export default {
 | 
				
			|||||||
            return archievement;
 | 
					            return archievement;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 绘制数据
 | 
					        // 保存业绩数据
 | 
				
			||||||
        const renderData = ( data:Archievement ) =>
 | 
					        const applyArchievementData = ( data:Archievement ) =>
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            console.log( "部门业绩数据", data );
 | 
					            console.log( "部门业绩数据", data );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -134,6 +153,18 @@ export default {
 | 
				
			|||||||
            setTimeout(() => { ui.showUI = true; }, 0 );
 | 
					            setTimeout(() => { ui.showUI = true; }, 0 );
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const applyRankingListData = ( data: RankingListResponse ): void =>
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ui.attachingRankingList = data.attachingRankingList;
 | 
				
			||||||
 | 
					            ui.renewalRankingList = data.renewalRankintList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // 更新UI
 | 
				
			||||||
 | 
					            // 先不显示界面,往队列中加入显示队列的回调,让vue刷新组件。
 | 
				
			||||||
 | 
					            ui.showUI = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            setTimeout(() => { ui.showUI = true; }, 0 );
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 退出桌面霸屏
 | 
					        // 退出桌面霸屏
 | 
				
			||||||
        const logoutDesktopArchievement = () =>
 | 
					        const logoutDesktopArchievement = () =>
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -155,6 +186,9 @@ export default {
 | 
				
			|||||||
            router.push( "/login" );
 | 
					            router.push( "/login" );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * 刷新页面
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
        const refresh = () =>
 | 
					        const refresh = () =>
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            const deparmentInfo:Department =
 | 
					            const deparmentInfo:Department =
 | 
				
			||||||
@@ -163,9 +197,20 @@ export default {
 | 
				
			|||||||
                departmentName: callerInfo.departmentName,
 | 
					                departmentName: callerInfo.departmentName,
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            queryDepartmentArchievement( deparmentInfo, renderData );
 | 
					            const rankinglistRequest: RankingListRequest =
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                departmentCode: callerInfo.departmentCode,
 | 
				
			||||||
 | 
					                year: "2023",
 | 
				
			||||||
 | 
					                month: "06",
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            queryDepartmentArchievement( deparmentInfo, applyArchievementData );
 | 
				
			||||||
 | 
					            requestRankingList( rankinglistRequest, applyRankingListData );
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * 加载前
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
        onBeforeMount(() =>
 | 
					        onBeforeMount(() =>
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // 设置每10分钟刷新一次
 | 
					            // 设置每10分钟刷新一次
 | 
				
			||||||
@@ -174,13 +219,16 @@ export default {
 | 
				
			|||||||
            refresh();
 | 
					            refresh();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * 页面卸载前
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
        onUnmounted(():void =>
 | 
					        onUnmounted(():void =>
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // 退出页面前关掉定时器
 | 
					            // 退出页面前关掉定时器
 | 
				
			||||||
            clearInterval( timerHandler );
 | 
					            clearInterval( timerHandler );
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return { ui, callerInfo, timerHandler, getTotalArchievement, renderData, refresh, logoutDesktopArchievement, };
 | 
					        return { ui, callerInfo, timerHandler, getTotalArchievement, renderData: applyArchievementData, refresh, logoutDesktopArchievement, };
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
 * @Author: Kane
 | 
					 * @Author: Kane
 | 
				
			||||||
 * @Date: 2023-02-15 09:25:52
 | 
					 * @Date: 2023-02-15 09:25:52
 | 
				
			||||||
 * @LastEditors: Kane
 | 
					 * @LastEditors: Kane
 | 
				
			||||||
 * @LastEditTime: 2023-03-30 21:09:30
 | 
					 * @LastEditTime: 2023-06-07 15:53:53
 | 
				
			||||||
 * @FilePath: /task_schedule/vite.config.js
 | 
					 * @FilePath: /task_schedule/vite.config.js
 | 
				
			||||||
 * @Description: 
 | 
					 * @Description: 
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
@@ -18,6 +18,7 @@ export default defineConfig(( command, mode ) =>
 | 
				
			|||||||
    const env = loadEnv( mode, process.cwd(), "" );
 | 
					    const env = loadEnv( mode, process.cwd(), "" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
 | 
					        server:{ host: "localhost", port: 3000, },
 | 
				
			||||||
        plugins: [vue(),],
 | 
					        plugins: [vue(),],
 | 
				
			||||||
        base: "./",
 | 
					        base: "./",
 | 
				
			||||||
        resolve: {
 | 
					        resolve: {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user