编写前端请求代码
This commit is contained in:
parent
6f4dbdbd7e
commit
31d175d36a
@ -1,3 +1,4 @@
|
|||||||
NODE_ENV = 'development'
|
NODE_ENV = 'development'
|
||||||
VITE_URL_VALIDATE_ACCOUNT="http://222.76.244.118:11001/desktop_archievement_backend/account/query_staff_info.do"
|
VITE_URL_VALIDATE_ACCOUNT="http://222.76.244.118:11001/desktop_archievement_backend/account/query_staff_info.do"
|
||||||
VITE_URL_LOGIN = "http://222.76.244.118:11001/admin-system/account/p13_account_check"
|
VITE_URL_LOGIN = "http://222.76.244.118:11001/admin-system/account/p13_account_check"
|
||||||
|
VITE_URL_DEPARTMENT_ARCHIEVEMENT="http://222.76.244.118:11001/desktop_archievement_backend/archievement/query_department_archievement.do"
|
@ -36,7 +36,7 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
indent: ["warn", 4,],
|
indent: ["warn", 4,],
|
||||||
"space-in-parens": ["error", "always", { exceptions: ["empty",], },],
|
// "space-in-parens": ["error", "always", { exceptions: ["empty",], },],
|
||||||
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
|
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
|
||||||
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
|
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
|
||||||
"no-unused-vars": "warn",
|
"no-unused-vars": "warn",
|
||||||
|
@ -41,7 +41,7 @@ export default {
|
|||||||
const percentage = Number(props.percentage).valueOf();
|
const percentage = Number(props.percentage).valueOf();
|
||||||
|
|
||||||
const ui = reactive({
|
const ui = reactive({
|
||||||
percentage: percentage,
|
percentage,
|
||||||
indicator: props.indicator,
|
indicator: props.indicator,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -79,6 +79,5 @@ export default {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -8,21 +8,4 @@
|
|||||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { type LoginInfo, login } from "../utils/account.js";
|
import { queryDepartmentArchievement } from "../utils/archievement.js";
|
||||||
|
|
||||||
const loginInfo: LoginInfo = {
|
|
||||||
p13account: "wangwei-202",
|
|
||||||
password: "Kane@1983",
|
|
||||||
};
|
|
||||||
|
|
||||||
login(loginInfo)
|
|
||||||
.then((response: any) =>
|
|
||||||
{
|
|
||||||
const data = response.data ?? {};
|
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
})
|
|
||||||
.catch((error: any) =>
|
|
||||||
{
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
|
@ -10,4 +10,7 @@
|
|||||||
export const API_URL = {
|
export const API_URL = {
|
||||||
// URL_LOGIN: import.meta.env.VITE_URL_LOGIN,
|
// URL_LOGIN: import.meta.env.VITE_URL_LOGIN,
|
||||||
URL_LOGIN: "http://222.76.244.118:11001/admin-system/account/p13_account_check",
|
URL_LOGIN: "http://222.76.244.118:11001/admin-system/account/p13_account_check",
|
||||||
|
|
||||||
|
// URL_DEPARTMENT_ARCHIEVEMENT: import.meta.env.VITE_URL_DEPARTMENT_ARCHIEVEMENT,
|
||||||
|
URL_DEPARTMENT_ARCHIEVEMENT: "http://222.76.244.118:11001/desktop_archievement_backend/archievement/query_department_archievement.do",
|
||||||
};
|
};
|
||||||
|
66
code/web/task_schedule/src/utils/archievement.ts
Normal file
66
code/web/task_schedule/src/utils/archievement.ts
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-03-17 15:17:44
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @FilePath: /task_schedule/src/utils/archievement.ts
|
||||||
|
* @Description: 请求业绩数据
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
import { service as instance } from "./api/request.js";
|
||||||
|
import { API_URL } from "./api/config.js";
|
||||||
|
// import { type AxiosResponse } from "axios";
|
||||||
|
|
||||||
|
interface Archievement
|
||||||
|
{
|
||||||
|
success: boolean;
|
||||||
|
message: string;
|
||||||
|
total_archievement: number;
|
||||||
|
mensual_archievement_list: string[];
|
||||||
|
insurance_renewal_rate: string;
|
||||||
|
attaching_rate: string;
|
||||||
|
leading_reward_gainers: string[];
|
||||||
|
advance_reward_gainers: string[];
|
||||||
|
backward_list: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
function queryDepartmentArchievement( render: any ): void
|
||||||
|
{
|
||||||
|
instance.request( {
|
||||||
|
method: "post",
|
||||||
|
url: API_URL.URL_DEPARTMENT_ARCHIEVEMENT,
|
||||||
|
} )
|
||||||
|
.then( ( response ) =>
|
||||||
|
{
|
||||||
|
const archievement: Archievement = {
|
||||||
|
success: false,
|
||||||
|
message: "",
|
||||||
|
total_archievement: 0,
|
||||||
|
mensual_archievement_list: [],
|
||||||
|
insurance_renewal_rate: "",
|
||||||
|
attaching_rate: "",
|
||||||
|
leading_reward_gainers: [],
|
||||||
|
advance_reward_gainers: [],
|
||||||
|
backward_list: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const data = response.data ?? {};
|
||||||
|
|
||||||
|
archievement.success = data.success ?? false;
|
||||||
|
archievement.message = data.message ?? "";
|
||||||
|
archievement.mensual_archievement_list = data.mensual_archievement_list ?? [];
|
||||||
|
archievement.insurance_renewal_rate = data.insurance_renewal_rate ?? "0.0";
|
||||||
|
archievement.attaching_rate = data.attaching_rate ?? "0.0";
|
||||||
|
archievement.leading_reward_gainers = data.leading_reward_gainers ?? [];
|
||||||
|
archievement.advance_reward_gainers = data.advance_reward_gainers ?? [];
|
||||||
|
archievement.backward_list = data.backward_list ?? [];
|
||||||
|
|
||||||
|
render( data );
|
||||||
|
} )
|
||||||
|
.catch( ( error ) =>
|
||||||
|
{
|
||||||
|
console.log( error );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
export { queryDepartmentArchievement, type Archievement };
|
@ -53,6 +53,7 @@ import { computed, reactive } from "vue";
|
|||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { loadStaffInfo } from "@/utils/api/localStorage.js";
|
import { loadStaffInfo } from "@/utils/api/localStorage.js";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
|
import { type Archievement, queryDepartmentArchievement } from "@/utils/archievement.js";
|
||||||
import ArchievementChart from "@/components/ArchievementChartComponent.vue";
|
import ArchievementChart from "@/components/ArchievementChartComponent.vue";
|
||||||
import ArchievementCompleteRateComponent from "@/components/ArchievementCompleteRateComponent.vue";
|
import ArchievementCompleteRateComponent from "@/components/ArchievementCompleteRateComponent.vue";
|
||||||
import HonorListComponent from "@/components/HonorListComponent.vue";
|
import HonorListComponent from "@/components/HonorListComponent.vue";
|
||||||
@ -89,6 +90,21 @@ export default {
|
|||||||
return archievement;
|
return archievement;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const requestArchievement = () =>
|
||||||
|
{
|
||||||
|
const archievement: Archievement = {
|
||||||
|
success: false,
|
||||||
|
message: "",
|
||||||
|
total_archievement: 0,
|
||||||
|
mensual_archievement_list: [],
|
||||||
|
insurance_renewal_rate: "",
|
||||||
|
attaching_rate: "",
|
||||||
|
leading_reward_gainers: [],
|
||||||
|
advance_reward_gainers: [],
|
||||||
|
backward_list: [],
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
// 检查存储的登录信息,不存在则返回登录页面
|
// 检查存储的登录信息,不存在则返回登录页面
|
||||||
if (staffInfo.P13UID === "")
|
if (staffInfo.P13UID === "")
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user