开发个人业绩组件

This commit is contained in:
Kane Wang 2023-09-01 19:05:30 +08:00
parent 7c5da24f5a
commit ae68f047f4
6 changed files with 55 additions and 34 deletions

View File

@ -67,7 +67,7 @@ module.exports = {
js: "espree",
"<template>": "espree",
},
// project: "./tsconfig.json",
project: "./tsconfig.json",
extraFileExtensions: [".vue",],
},
plugins: ["eslint-plugin-vue",],
@ -75,7 +75,7 @@ module.exports = {
"plugin:vue/vue3-essential",
"plugin:vue/recommended",
"eslint:recommended",
// "standard-with-typescript",
"standard-with-typescript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
],

View File

@ -29,11 +29,11 @@ export default {
setup( props )
{
const ui = reactive({
mensualList:[],
mensualList: [],
});
//
const initCharts = () =>
const initCharts = (): void =>
{
console.log( "每月业绩", props.chartData );
const chartDom = document.getElementById( "chartWrapper" );
@ -55,7 +55,7 @@ export default {
],
};
option && myChart.setOption( option );
myChart.setOption( option );
window.onresize = function ()
{

View File

@ -11,10 +11,10 @@
<div class="caller-archievment-wrapper">
<table>
<tr>
<td>坐席名称</td><td>{{ ui.callerName }}</td>
<td>坐席名称</td><td>{{ CallerName }}</td>
</tr>
<tr>
<td>车险保费</td><td>{{ ui.thisMonthPremium }}</td>
<td>车险保费</td><td>{{ PresentMonthPremium }}&nbsp;万元</td>
</tr>
<tr>
<td>车非渗透率</td><td>{{ ui.attachingRate }}</td>
@ -26,7 +26,8 @@
</div>
</template>
<script lang="ts">
interface CallerArchievementComponentUI
import { computed } from "vue";
interface CallerArchievementComponentUI
{
callerName: string,
thisMonthPremium: number,
@ -36,25 +37,43 @@ interface CallerArchievementComponentUI
export default {
name: "CallerArchievementComponent",
props:{
props: {
callerName: {
type: String,
require: true,
default: (): string => "",
},
thisMonthPremium: {
type: Number,
require: true,
default:()=>0,
default: (): number => 0,
},
},
setup()
setup( props )
{
const ui:CallerArchievementComponentUI = {
const ui: CallerArchievementComponentUI = {
callerName: "",
thisMonthPremium: 0,
attachingRate: "0.0",
renewalRate: "0.0",
};
return {ui,};
const PresentMonthPremium = computed((): string =>
{
return ( props.thisMonthPremium / 10000 ).toFixed( 2 );
});
const CallerName = computed((): string =>
{
return props.callerName;
});
return {
CallerName,
PresentMonthPremium,
ui,
};
},
};
</script>
<style scoped lang="scss">
</style>
</style>

View File

@ -93,7 +93,7 @@ import
queryDepartmentArchievement,
queryCallerArchievement
} from "@/utils/archievement.js";
import { RankingListItem } from "@/types/cpicxim/RankingListItem.js";
import { type RankingListItem } from "@/types/cpicxim/RankingListItem.js";
import
{
type RankingListRequest,
@ -139,7 +139,7 @@ export default {
{
const monthIndex = new Date();
const thisMonth: number = monthIndex.getMonth() + 1; // getMonth0
const thisMonthString = thisMonth > 10 ? String( thisMonth ): "0" + String( thisMonth );
const thisMonthString = thisMonth > 10 ? String( thisMonth ) : "0" + String( thisMonth );
const thisYear: number = monthIndex.getFullYear();
const thisYearString: string = String( thisYear );
const numInChinese = [
@ -173,7 +173,7 @@ export default {
});
let timerHandler = 0;
const getTotalArchievement = computed(():string =>
const getTotalArchievement = computed((): string =>
{
const cnyFormat = new Intl.NumberFormat( "zh-cn", {
style: "currency",
@ -194,7 +194,7 @@ export default {
// console.log( "", data );
//
if ( data.success !== true )
if ( !data.success )
{
// 退
ElMessage({
@ -226,7 +226,7 @@ export default {
const applyCallerArchievementData = ( data: CallerArchievement ): void =>
{
//
if ( data.success !== true )
if ( !data.success )
{
// 退
ElMessage({
@ -268,7 +268,7 @@ export default {
};
// 退
const logoutDesktopArchievement = () =>
const logoutDesktopArchievement = (): void =>
{
console.log( "111" );
logout();
@ -285,13 +285,13 @@ export default {
center: true,
});
router.push( "/login" );
router.push( "/login" ).then(() => {}).catch(() => {});
}
/**
* 用于定时对页面进行刷新其中会请求最新的业绩数据
*/
const refresh = () =>
const refresh = (): void =>
{
const deparmentInfo: Department = {
departmentCode: callerInfo.departmentCode,
@ -304,6 +304,8 @@ export default {
month: thisMonthString,
};
console.log( "refresh", rankinglistRequest );
queryDepartmentArchievement( deparmentInfo, applyDepartmentArchievementData );
queryCallerArchievement( callerInfo, applyCallerArchievementData );
requestRankingList( rankinglistRequest, applyRankingListData );

View File

@ -71,7 +71,7 @@ import { saveStaffInfo, getUserType, saveUserType, getCallerInfo, saveCallerInfo
import { login, loginCaller, type LoginCallerInfo, type LoginCallerResult } from "@/utils/account";
import { ElMessage } from "element-plus";
import { StaffInfo } from "@/types/cpicxim/StaffInfo";
import { TelSaler } from "@/types/cpicxim/TelSaler";
import { type TelSaler } from "@/types/cpicxim/TelSaler";
export default {
name: "LoginPage",
@ -95,7 +95,7 @@ export default {
/**
* 保存p13账号
*/
const savedP13uid = () =>
const savedP13uid = (): void =>
{
window.localStorage.setItem( "stuff_account", ui.account );
};
@ -103,7 +103,7 @@ export default {
/**
* 登录函数根据ui.currentMenu判断登录的是坐席还是员工
*/
const onLogin = () =>
const onLogin = (): void =>
{
//
saveUserType( ui.currentMenu );
@ -145,7 +145,7 @@ export default {
saveStaffInfo( staffInfo );
//
router.push( "/desktop" );
router.push( "/desktop" ).then(() => {}).catch(() => {});
}
else
{
@ -177,12 +177,12 @@ export default {
//
.then(( response ) =>
{
const data:LoginCallerResult = response.data ?? { success: false, };
const data: LoginCallerResult = response.data ?? { success: false, };
// debugger;
//
if ( data.success === true )
if ( data.success )
{
//
ElMessage({
@ -190,7 +190,7 @@ export default {
type: "success",
});
const telsaler:TelSaler = {
const telsaler: TelSaler = {
telSalerCode: data.tel_saler_code,
telSalerName: data.tel_saler_name,
teamCode: data.team_code,
@ -201,7 +201,7 @@ export default {
saveCallerInfo( telsaler );
router.push( "/desktop_archievement" );
router.push( "/desktop_archievement" ).then(() => {}).catch(() => {});
}
else
{
@ -249,7 +249,7 @@ export default {
});
//
router.push( "/desktop_archievement" );
router.push( "/desktop_archievement" ).then(() => {}).catch(() => {});
}
}
else if ( staffType === "cpicxim_staff" )
@ -258,7 +258,7 @@ export default {
}
});
const onToggleMenu = ( type: string ) =>
const onToggleMenu = ( type: string ): void =>
{
ui.currentMenu = type;
};

View File

@ -120,7 +120,7 @@ export default {
callers: [],
});
const onCurrentPageIndexChange = ( pageIndex: number ) =>
const onCurrentPageIndexChange = ( pageIndex: number ): void =>
{
ui.table_current_page_index = pageIndex;
};
@ -129,7 +129,7 @@ export default {
* 设置表格每页显示记录的数量
* @param pageSize 表格页记录数量
*/
const onTablePageSizeChange = ( pageSize: number ) =>
const onTablePageSizeChange = ( pageSize: number ): void =>
{
ui.table_page_size = pageSize;
};