完成坐席业绩的请求方法。

This commit is contained in:
Kane Wang 2023-08-29 10:55:30 +08:00
parent a74e612546
commit 8e0505bd49
4 changed files with 262 additions and 31 deletions

View File

@ -24,7 +24,7 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.22.11", "@babel/eslint-parser": "^7.22.11",
"@typescript-eslint/eslint-plugin": "^6.4.1", "@typescript-eslint/eslint-plugin": "^6.5.0",
"@vitejs/plugin-vue": "^4.3.3", "@vitejs/plugin-vue": "^4.3.3",
"@vue/cli-plugin-eslint": "^5.0.8", "@vue/cli-plugin-eslint": "^5.0.8",
"axios": "~1.5.0", "axios": "~1.5.0",
@ -1560,16 +1560,16 @@
} }
}, },
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "6.4.1", "version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.4.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.5.0.tgz",
"integrity": "sha512-3F5PtBzUW0dYlq77Lcqo13fv+58KDwUib3BddilE8ajPJT+faGgxmI9Sw+I8ZS22BYwoir9ZhNXcLi+S+I2bkw==", "integrity": "sha512-2pktILyjvMaScU6iK3925uvGU87E+N9rh372uGZgiMYwafaw9SXq86U04XPq3UH6tzRvNgBsub6x2DacHc33lw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/regexpp": "^4.5.1", "@eslint-community/regexpp": "^4.5.1",
"@typescript-eslint/scope-manager": "6.4.1", "@typescript-eslint/scope-manager": "6.5.0",
"@typescript-eslint/type-utils": "6.4.1", "@typescript-eslint/type-utils": "6.5.0",
"@typescript-eslint/utils": "6.4.1", "@typescript-eslint/utils": "6.5.0",
"@typescript-eslint/visitor-keys": "6.4.1", "@typescript-eslint/visitor-keys": "6.5.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"graphemer": "^1.4.0", "graphemer": "^1.4.0",
"ignore": "^5.2.4", "ignore": "^5.2.4",
@ -1590,6 +1590,50 @@
} }
} }
}, },
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-6.5.0.tgz",
"integrity": "sha512-A8hZ7OlxURricpycp5kdPTH3XnjG85UpJS6Fn4VzeoH4T388gQJ/PGP4ole5NfKt4WDVhmLaQ/dBLNDC4Xl/Kw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.5.0",
"@typescript-eslint/visitor-keys": "6.5.0"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-6.5.0.tgz",
"integrity": "sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.5.0.tgz",
"integrity": "sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.5.0",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/eslint-visitor-keys": {
"version": "3.4.3",
"resolved": "https://registry.npmmirror.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": { "node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz", "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz",
@ -1661,13 +1705,13 @@
} }
}, },
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "6.4.1", "version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-6.4.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-6.5.0.tgz",
"integrity": "sha512-7ON8M8NXh73SGZ5XvIqWHjgX2f+vvaOarNliGhjrJnv1vdjG0LVIz+ToYfPirOoBi56jxAKLfsLm40+RvxVVXA==", "integrity": "sha512-f7OcZOkRivtujIBQ4yrJNIuwyCQO1OjocVqntl9dgSIZAdKqicj3xFDqDOzHDlGCZX990LqhLQXWRnQvsapq8A==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/typescript-estree": "6.4.1", "@typescript-eslint/typescript-estree": "6.5.0",
"@typescript-eslint/utils": "6.4.1", "@typescript-eslint/utils": "6.5.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"ts-api-utils": "^1.0.1" "ts-api-utils": "^1.0.1"
}, },
@ -1683,6 +1727,93 @@
} }
} }
}, },
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-6.5.0.tgz",
"integrity": "sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.5.0.tgz",
"integrity": "sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.5.0",
"@typescript-eslint/visitor-keys": "6.5.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"semver": "^7.5.4",
"ts-api-utils": "^1.0.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.5.0.tgz",
"integrity": "sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.5.0",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/eslint-visitor-keys": {
"version": "3.4.3",
"resolved": "https://registry.npmmirror.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
"node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/types": {
"version": "6.4.1", "version": "6.4.1",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-6.4.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-6.4.1.tgz",
@ -1749,17 +1880,17 @@
"dev": true "dev": true
}, },
"node_modules/@typescript-eslint/utils": { "node_modules/@typescript-eslint/utils": {
"version": "6.4.1", "version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-6.4.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-6.5.0.tgz",
"integrity": "sha512-F/6r2RieNeorU0zhqZNv89s9bDZSovv3bZQpUNOmmQK1L80/cV4KEu95YUJWi75u5PhboFoKUJBnZ4FQcoqhDw==", "integrity": "sha512-9nqtjkNykFzeVtt9Pj6lyR9WEdd8npPhhIPM992FWVkZuS6tmxHfGVnlUcjpUP2hv8r4w35nT33mlxd+Be1ACQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.4.0", "@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12", "@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0", "@types/semver": "^7.5.0",
"@typescript-eslint/scope-manager": "6.4.1", "@typescript-eslint/scope-manager": "6.5.0",
"@typescript-eslint/types": "6.4.1", "@typescript-eslint/types": "6.5.0",
"@typescript-eslint/typescript-estree": "6.4.1", "@typescript-eslint/typescript-estree": "6.5.0",
"semver": "^7.5.4" "semver": "^7.5.4"
}, },
"engines": { "engines": {
@ -1769,6 +1900,73 @@
"eslint": "^7.0.0 || ^8.0.0" "eslint": "^7.0.0 || ^8.0.0"
} }
}, },
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-6.5.0.tgz",
"integrity": "sha512-A8hZ7OlxURricpycp5kdPTH3XnjG85UpJS6Fn4VzeoH4T388gQJ/PGP4ole5NfKt4WDVhmLaQ/dBLNDC4Xl/Kw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.5.0",
"@typescript-eslint/visitor-keys": "6.5.0"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
}
},
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-6.5.0.tgz",
"integrity": "sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
}
},
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.5.0.tgz",
"integrity": "sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.5.0",
"@typescript-eslint/visitor-keys": "6.5.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"semver": "^7.5.4",
"ts-api-utils": "^1.0.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.5.0.tgz",
"integrity": "sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.5.0",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
}
},
"node_modules/@typescript-eslint/utils/node_modules/eslint-visitor-keys": {
"version": "3.4.3",
"resolved": "https://registry.npmmirror.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/@typescript-eslint/utils/node_modules/lru-cache": { "node_modules/@typescript-eslint/utils/node_modules/lru-cache": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz", "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz",

View File

@ -25,7 +25,7 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.22.11", "@babel/eslint-parser": "^7.22.11",
"@typescript-eslint/eslint-plugin": "^6.4.1", "@typescript-eslint/eslint-plugin": "^6.5.0",
"@vitejs/plugin-vue": "^4.3.3", "@vitejs/plugin-vue": "^4.3.3",
"@vue/cli-plugin-eslint": "^5.0.8", "@vue/cli-plugin-eslint": "^5.0.8",
"axios": "~1.5.0", "axios": "~1.5.0",

View File

@ -26,7 +26,7 @@ interface DepartmentArchievement // 定义业绩对象的结构
backward_list: string[]; backward_list: string[];
} }
interface CallerArchievement // 坐席业绩 interface CallerArchievement // 坐席业绩对象
{ {
success: boolean; success: boolean;
message: string; message: string;
@ -36,15 +36,16 @@ interface CallerArchievement // 坐席的业绩
attaching_rate: string; attaching_rate: string;
} }
interface MenusalArchievementItem interface MenusalArchievementItem // 每月业绩清单的项目
{ {
month: string; month: number;
premium: number; premium: string;
} }
/** /**
* *
* @param render * @param departmentInfo
* @param render DepartmentArchievement对象调用
*/ */
function queryDepartmentArchievement( departmentInfo: Department, render: any ): void function queryDepartmentArchievement( departmentInfo: Department, render: any ): void
{ {
@ -98,6 +99,14 @@ function queryDepartmentArchievement( departmentInfo: Department, render: any ):
}); });
} }
/**
* .
* 1
* 2012
* 3
* @param callerInfo
* @param render CallerArchievement作为参数
*/
function queryCallerArchievement( callerInfo: TelSaler, render: any ): void function queryCallerArchievement( callerInfo: TelSaler, render: any ): void
{ {
const caller = { const caller = {
@ -105,6 +114,7 @@ function queryCallerArchievement( callerInfo: TelSaler, render: any ): void
callName: callerInfo.telSalerName, callName: callerInfo.telSalerName,
}; };
// 发送请求
instance.request({ instance.request({
method: "post", method: "post",
url: API_URL.URL_CALLER_ARCHIEVEMENT, url: API_URL.URL_CALLER_ARCHIEVEMENT,
@ -124,8 +134,29 @@ function queryCallerArchievement( callerInfo: TelSaler, render: any ): void
attaching_rate: data.attaching_rate ?? "0.0", attaching_rate: data.attaching_rate ?? "0.0",
}; };
// 检查业绩清单有没有缺漏缺漏的用0补上
const checkedList = checkMensualArchievement( data.mensual_archievement_list ); const checkedList = checkMensualArchievement( data.mensual_archievement_list );
// 排序一下
checkedList.sort(( a: MenusalArchievementItem, b: MenusalArchievementItem ): number =>
{
return a.month - b.month;
});
// 将排序后的每月业绩写到业绩对象中
checkedList.forEach(( item: MenusalArchievementItem ): void =>
{
const premium = Number( item.premium );
callArchievement.mensual_archievement_list.push( premium );
});
// 调用渲染函数
if ( render !== undefined )
{
render( callArchievement );
}
console.log( `queryCallerArchievement查询结果${data}` ); console.log( `queryCallerArchievement查询结果${data}` );
}) })
// 请求失败 // 请求失败
@ -137,8 +168,9 @@ function queryCallerArchievement( callerInfo: TelSaler, render: any ): void
/** /**
* 0 * 0
* @param mensualArchievementList * 12
* @returns * @param mensualArchievementList MenusalArchievementItem类型的数组
* @returns MenusalArchievementItem数组
*/ */
function checkMensualArchievement( mensualArchievementList: MenusalArchievementItem[]): MenusalArchievementItem[] function checkMensualArchievement( mensualArchievementList: MenusalArchievementItem[]): MenusalArchievementItem[]
{ {

View File

@ -89,7 +89,8 @@ import { ElMessage } from "element-plus";
import import
{ {
type DepartmentArchievement, type DepartmentArchievement,
queryDepartmentArchievement queryDepartmentArchievement,
queryCallerArchievement
} from "@/utils/archievement.js"; } from "@/utils/archievement.js";
import { RankingListItem } from "@/types/cpicxim/RankingListItem.js"; import { RankingListItem } from "@/types/cpicxim/RankingListItem.js";
import import
@ -178,7 +179,7 @@ export default {
}); });
// //
const applyArchievementData = ( data: DepartmentArchievement ) => const applyDepartmentArchievementData = ( data: DepartmentArchievement ) =>
{ {
console.log( "部门业绩数据", data ); console.log( "部门业绩数据", data );
@ -254,7 +255,7 @@ export default {
month: "06", month: "06",
}; };
queryDepartmentArchievement( deparmentInfo, applyArchievementData ); queryDepartmentArchievement( deparmentInfo, applyDepartmentArchievementData );
requestRankingList( rankinglistRequest, applyRankingListData ); requestRankingList( rankinglistRequest, applyRankingListData );
}; };
@ -283,7 +284,7 @@ export default {
callerInfo, callerInfo,
timerHandler, timerHandler,
getTotalArchievement, getTotalArchievement,
renderData: applyArchievementData, renderData: applyDepartmentArchievementData,
refresh, refresh,
logoutDesktopArchievement, logoutDesktopArchievement,
}; };