Compare commits

...

2 Commits

Author SHA1 Message Date
Kane Wang 80e4b24e4f 保存进度! 2023-06-08 18:08:57 +08:00
Kane Wang 664c2335ca 保存进度! 2023-06-07 17:19:47 +08:00
7 changed files with 143 additions and 17 deletions

View File

@ -30,7 +30,7 @@
"eslint-config-standard-with-typescript": "^35.0.0",
"eslint-plugin-vue": "^9.14.1",
"node-sass": "^9.0.0",
"sass": "^1.62.1",
"sass": "^1.63.2",
"style-loader": "^3.3.3",
"typescript": "^5.1.3",
"vue-eslint-parser": "^9.3.0"
@ -12242,9 +12242,9 @@
"dev": true
},
"node_modules/sass": {
"version": "1.62.1",
"resolved": "https://registry.npmmirror.com/sass/-/sass-1.62.1.tgz",
"integrity": "sha512-NHpxIzN29MXvWiuswfc1W3I0N8SXBd8UR26WntmDlRYf0bSADnwnOjsyMZ3lMezSlArD33Vs3YFhp7dWvL770A==",
"version": "1.63.2",
"resolved": "https://registry.npmmirror.com/sass/-/sass-1.63.2.tgz",
"integrity": "sha512-u56TU0AIFqMtauKl/OJ1AeFsXqRHkgO7nCWmHaDwfxDo9GUMSqBA4NEh6GMuh1CYVM7zuROYtZrHzPc2ixK+ww==",
"devOptional": true,
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",

View File

@ -31,7 +31,7 @@
"eslint-config-standard-with-typescript": "^35.0.0",
"eslint-plugin-vue": "^9.14.1",
"node-sass": "^9.0.0",
"sass": "^1.62.1",
"sass": "^1.63.2",
"style-loader": "^3.3.3",
"typescript": "^5.1.3",
"vue-eslint-parser": "^9.3.0"

View File

@ -8,6 +8,6 @@
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
import { testNewCitizen } from "./identify.js";
import { testRankingListRequest } from "./testRankingListRequest.js";
testNewCitizen();
testRankingListRequest();

View File

@ -13,7 +13,7 @@ import axios, { type AxiosInstance } from "axios";
const service: AxiosInstance = axios.create(
{
baseURL: "",
timeout: 5000,
timeout: 10000,
}
);

View File

@ -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
};

View File

@ -64,6 +64,8 @@ import { useRouter } from "vue-router";
import { getCallerInfo } from "@/utils/api/localStorage.js";
import { ElMessage } from "element-plus";
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 ArchievementChart from "@/components/ArchievementChartComponent.vue";
import ArchievementCompleteRateComponent from "@/components/ArchievementCompleteRateComponent.vue";
@ -73,6 +75,21 @@ import RankingListComponent from "@/components/RankingListComponent.vue";
import { logout } from "@/utils/account.js";
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 {
name: "DesktopArchievement",
components: {
@ -88,7 +105,7 @@ export default {
const numInChinese = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二",];
const router = useRouter();
const callerInfo: TelSaler = getCallerInfo();
const ui = reactive({
const ui: ui = reactive({
currentMonth: numInChinese[monthIndex.getMonth() - 1],
chartData: [0,], //
totalArchievement: 0, //
@ -98,8 +115,10 @@ export default {
advance_reward_gainers: ["",], //
dishonorPersons: ["",],
showUI: true, //
attachingRankingList: [], //
renewalRankingList: [], //
});
const timerHandler = 0;
let timerHandler = 0;
const getTotalArchievement = computed(() =>
{
@ -114,8 +133,8 @@ export default {
return archievement;
});
//
const renderData = ( data:Archievement ) =>
//
const applyArchievementData = ( data:Archievement ) =>
{
console.log( "部门业绩数据", data );
@ -134,6 +153,18 @@ export default {
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 = () =>
{
@ -155,6 +186,9 @@ export default {
router.push( "/login" );
}
/**
* 刷新页面
*/
const refresh = () =>
{
const deparmentInfo:Department =
@ -163,24 +197,38 @@ export default {
departmentName: callerInfo.departmentName,
};
queryDepartmentArchievement( deparmentInfo, renderData );
const rankinglistRequest: RankingListRequest =
{
departmentCode: callerInfo.departmentCode,
year: "2023",
month: "06",
};
queryDepartmentArchievement( deparmentInfo, applyArchievementData );
requestRankingList( rankinglistRequest, applyRankingListData );
};
/**
* 加载前
*/
onBeforeMount(() =>
{
// 10
// timerHandler = setInterval( refresh, 5000 );
timerHandler = setInterval( refresh, 5000 );
refresh();
});
/**
* 页面卸载前
*/
onUnmounted(():void =>
{
// 退
clearInterval( timerHandler );
});
return { ui, callerInfo, timerHandler, getTotalArchievement, renderData, refresh, logoutDesktopArchievement, };
return { ui, callerInfo, timerHandler, getTotalArchievement, renderData: applyArchievementData, refresh, logoutDesktopArchievement, };
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: Kane
* @Date: 2023-02-15 09:25:52
* @LastEditors: Kane
* @LastEditTime: 2023-03-30 21:09:30
* @LastEditTime: 2023-06-07 15:53:53
* @FilePath: /task_schedule/vite.config.js
* @Description:
*
@ -18,6 +18,7 @@ export default defineConfig(( command, mode ) =>
const env = loadEnv( mode, process.cwd(), "" );
return {
server:{ host: "localhost", port: 3000, },
plugins: [vue(),],
base: "./",
resolve: {