整理代码!
This commit is contained in:
parent
bee1061e20
commit
7dbd48152f
@ -32,10 +32,10 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
a_end_date);
|
a_end_date);
|
||||||
|
|
||||||
FOR caller_record IN (SELECT *
|
FOR caller_record IN (SELECT *
|
||||||
FROM 车非每日保费_t)
|
FROM desktop_archievement_admin.车非每日保费_t)
|
||||||
LOOP
|
LOOP
|
||||||
BEGIN
|
BEGIN
|
||||||
DELETE 车非每日保费 cf
|
DELETE desktop_archievement_admin.车非每日保费 cf
|
||||||
WHERE cf.签单日期 = caller_record.签单日期
|
WHERE cf.签单日期 = caller_record.签单日期
|
||||||
AND cf.部门 = caller_record.部门
|
AND cf.部门 = caller_record.部门
|
||||||
AND cf.经办人n = caller_record.经办人n
|
AND cf.经办人n = caller_record.经办人n
|
||||||
@ -45,7 +45,7 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
NULL;
|
NULL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
INSERT INTO 车非每日保费
|
INSERT INTO desktop_archievement_admin.车非每日保费
|
||||||
VALUES caller_record;
|
VALUES caller_record;
|
||||||
|
|
||||||
END LOOP;
|
END LOOP;
|
||||||
@ -62,9 +62,9 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
|
|||||||
a_end_date IN DATE
|
a_end_date IN DATE
|
||||||
) IS
|
) IS
|
||||||
BEGIN
|
BEGIN
|
||||||
EXECUTE IMMEDIATE 'truncate table 车非每日保费_t';
|
EXECUTE IMMEDIATE 'truncate table desktop_archievement_admin.车非每日保费_t';
|
||||||
|
|
||||||
INSERT INTO 车非每日保费_t
|
INSERT INTO desktop_archievement_admin.车非每日保费_t
|
||||||
WITH aa AS
|
WITH aa AS
|
||||||
(SELECT to_char(t.signature_date,
|
(SELECT to_char(t.signature_date,
|
||||||
'yyyy-mm-dd') 签单日期,
|
'yyyy-mm-dd') 签单日期,
|
||||||
|
@ -22,6 +22,7 @@ module.exports = {
|
|||||||
extends:["eslint:recommended",],
|
extends:["eslint:recommended",],
|
||||||
rules:{
|
rules:{
|
||||||
indent: ["warn", 4,],
|
indent: ["warn", 4,],
|
||||||
|
"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",
|
||||||
@ -73,7 +74,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",
|
||||||
@ -136,7 +137,7 @@ module.exports = {
|
|||||||
"plugin:@typescript-eslint/recommended",
|
"plugin:@typescript-eslint/recommended",
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
"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",
|
||||||
"@typescript-eslint/indent": ["error", 4,],
|
"@typescript-eslint/indent": ["error", 4,],
|
||||||
|
@ -26,7 +26,7 @@ export default {
|
|||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props)
|
setup( props )
|
||||||
{
|
{
|
||||||
const ui = reactive({
|
const ui = reactive({
|
||||||
});
|
});
|
||||||
@ -34,8 +34,8 @@ export default {
|
|||||||
// 设置图表
|
// 设置图表
|
||||||
const initCharts = () =>
|
const initCharts = () =>
|
||||||
{
|
{
|
||||||
const chartDom = document.getElementById("chartWrapper");
|
const chartDom = document.getElementById( "chartWrapper" );
|
||||||
const myChart = echarts.init(chartDom as HTMLDivElement);
|
const myChart = echarts.init( chartDom as HTMLDivElement );
|
||||||
const option = {
|
const option = {
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: "category",
|
type: "category",
|
||||||
@ -53,7 +53,7 @@ export default {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
option && myChart.setOption(option);
|
option && myChart.setOption( option );
|
||||||
|
|
||||||
window.onresize = function ()
|
window.onresize = function ()
|
||||||
{
|
{
|
||||||
|
@ -36,9 +36,9 @@ export default {
|
|||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props)
|
setup( props )
|
||||||
{
|
{
|
||||||
const percentage = Number(props.percentage).valueOf();
|
const percentage = Number( props.percentage ).valueOf();
|
||||||
|
|
||||||
const ui = reactive({
|
const ui = reactive({
|
||||||
percentage,
|
percentage,
|
||||||
|
@ -34,7 +34,7 @@ class StaffInfo
|
|||||||
return this._stuffCode;
|
return this._stuffCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public set stuffCode(stuffCode: string)
|
public set stuffCode( stuffCode: string )
|
||||||
{
|
{
|
||||||
this._stuffCode = stuffCode;
|
this._stuffCode = stuffCode;
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ class StaffInfo
|
|||||||
return this._stuffName;
|
return this._stuffName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public set stuffName(stuffName: string)
|
public set stuffName( stuffName: string )
|
||||||
{
|
{
|
||||||
this._stuffName = stuffName;
|
this._stuffName = stuffName;
|
||||||
}
|
}
|
||||||
@ -54,12 +54,12 @@ class StaffInfo
|
|||||||
return this._p13uid;
|
return this._p13uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public set P13UID(p13uid: string)
|
public set P13UID( p13uid: string )
|
||||||
{
|
{
|
||||||
this._p13uid = p13uid;
|
this._p13uid = p13uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public set departmentCode(departmentCode: string)
|
public set departmentCode( departmentCode: string )
|
||||||
{
|
{
|
||||||
this._departmentCode = departmentCode;
|
this._departmentCode = departmentCode;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ class StaffInfo
|
|||||||
return this._departmentCode;
|
return this._departmentCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public set departmentName(departmentName: string)
|
public set departmentName( departmentName: string )
|
||||||
{
|
{
|
||||||
this._departmentName = departmentName;
|
this._departmentName = departmentName;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,13 @@
|
|||||||
<span class="company-name">CPIC</span>
|
<span class="company-name">CPIC</span>
|
||||||
<div class="version-wrapper">
|
<div class="version-wrapper">
|
||||||
<span>测试版</span>
|
<span>测试版</span>
|
||||||
<span>3.6.7 x64 Build 202208301257</span>
|
<span>Build-202303251257</span>
|
||||||
|
</div>
|
||||||
|
<div class="button-wrapper">
|
||||||
|
<component
|
||||||
|
:is="'user'"
|
||||||
|
class="icons"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -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-23 16:32:01
|
* @LastEditTime: 2023-03-24 14:34:52
|
||||||
* @FilePath: /task_schedule/src/main.js
|
* @FilePath: /task_schedule/src/main.js
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@ -21,17 +21,17 @@ import "./assets/css/index.scss";
|
|||||||
// element-plus
|
// element-plus
|
||||||
import ElementPlus from "element-plus";
|
import ElementPlus from "element-plus";
|
||||||
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
|
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
|
||||||
import("element-plus/dist/index.css");
|
import( "element-plus/dist/index.css" );
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp( App );
|
||||||
|
|
||||||
// 注册element-plus的图标
|
// 注册element-plus的图标
|
||||||
for (const [key, component,] of Object.entries(ElementPlusIconsVue))
|
for ( const [key, component,] of Object.entries( ElementPlusIconsVue ))
|
||||||
{
|
{
|
||||||
app.component(key, component);
|
app.component( key, component );
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use(ElementPlus);
|
app.use( ElementPlus );
|
||||||
app.use(router);
|
app.use( router );
|
||||||
app.use(store);
|
app.use( store );
|
||||||
app.mount("#app");
|
app.mount( "#app" );
|
||||||
|
@ -38,7 +38,7 @@ const routes = [
|
|||||||
title: "总览",
|
title: "总览",
|
||||||
icon: "house",
|
icon: "house",
|
||||||
},
|
},
|
||||||
component: ()=> import("../layout/Index.vue"),
|
component: ()=> import( "../layout/Index.vue" ),
|
||||||
children:[
|
children:[
|
||||||
{
|
{
|
||||||
path:"/desktop",
|
path:"/desktop",
|
||||||
@ -47,7 +47,7 @@ const routes = [
|
|||||||
title:"工作台",
|
title:"工作台",
|
||||||
icon: "house",
|
icon: "house",
|
||||||
},
|
},
|
||||||
component: ()=> import("../views/Desktop.vue"),
|
component: ()=> import( "../views/Desktop.vue" ),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -59,7 +59,7 @@ const routes = [
|
|||||||
title:"数据管理",
|
title:"数据管理",
|
||||||
icon: "document",
|
icon: "document",
|
||||||
},
|
},
|
||||||
component: ()=> import("../layout/Index.vue"),
|
component: ()=> import( "../layout/Index.vue" ),
|
||||||
children:[
|
children:[
|
||||||
{
|
{
|
||||||
path:"/staff_data",
|
path:"/staff_data",
|
||||||
@ -68,7 +68,7 @@ const routes = [
|
|||||||
title:"坐席管理",
|
title:"坐席管理",
|
||||||
icon: "user",
|
icon: "user",
|
||||||
},
|
},
|
||||||
component: ()=> import("../views/StaffManagement.vue"),
|
component: ()=> import( "../views/StaffManagement.vue" ),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path:"/archievement_data",
|
path:"/archievement_data",
|
||||||
@ -77,7 +77,7 @@ const routes = [
|
|||||||
title:"数据管理",
|
title:"数据管理",
|
||||||
icon: "document",
|
icon: "document",
|
||||||
},
|
},
|
||||||
component: ()=> import("../views/DataManagement.vue"),
|
component: ()=> import( "../views/DataManagement.vue" ),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -104,12 +104,12 @@ function hasOnlyChild( children )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const routes = children.filter((item)=>
|
const routes = children.filter(( item )=>
|
||||||
{
|
{
|
||||||
return !item.hidden;
|
return !item.hidden;
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( routes.length === 1)
|
if ( routes.length === 1 )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
import { type AxiosResponse } from "axios";
|
import { type AxiosResponse } from "axios";
|
||||||
import { service as instance } from "./api/request.js";
|
import { service as instance } from "./api/request.js";
|
||||||
import { API_URL } from "./api/config.js";
|
import { API_URL } from "./api/config.js";
|
||||||
import { cleanStaffInfo } from "./api/localStorage.js";
|
import { cleanStaffInfo, clearCallerInfo } from "./api/localStorage.js";
|
||||||
|
|
||||||
// @ts-expect-error 之后再补充类型文件
|
// @ts-expect-error 之后再补充类型文件
|
||||||
import { router } from "../router/index.js";
|
import { router } from "../router/index.js";
|
||||||
@ -38,6 +38,7 @@ async function login( data: LoginInfo ): Promise<AxiosResponse<any, any>>
|
|||||||
function logout(): void
|
function logout(): void
|
||||||
{
|
{
|
||||||
cleanStaffInfo();
|
cleanStaffInfo();
|
||||||
|
clearCallerInfo();
|
||||||
|
|
||||||
void router.push( "/login" );
|
void router.push( "/login" );
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
import { StaffInfo } from "@/data/cpicxim/StaffInfo.js";
|
import { StaffInfo } from "@/data/cpicxim/StaffInfo.js";
|
||||||
|
|
||||||
const STUFF_ITEM = "stuff_info";
|
const STUFF_ITEM = "stuff_info";
|
||||||
|
const CALLER_ITEM = "call_info";
|
||||||
const USER_TYPE_ITEM = "user_type";
|
const USER_TYPE_ITEM = "user_type";
|
||||||
|
|
||||||
function loadStaffInfo(): StaffInfo
|
function loadStaffInfo(): StaffInfo
|
||||||
@ -61,10 +62,28 @@ function getUserType(): string
|
|||||||
return userType;
|
return userType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveCallerInfo( callerCode: string ): void
|
||||||
|
{
|
||||||
|
window.localStorage.setItem( CALLER_ITEM, callerCode );
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCallerInfo(): string
|
||||||
|
{
|
||||||
|
return window.localStorage.getItem( CALLER_ITEM ) ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearCallerInfo(): void
|
||||||
|
{
|
||||||
|
window.localStorage.removeItem( CALLER_ITEM );
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
loadStaffInfo,
|
loadStaffInfo,
|
||||||
saveStaffInfo,
|
saveStaffInfo,
|
||||||
cleanStaffInfo,
|
cleanStaffInfo,
|
||||||
saveUserType,
|
saveUserType,
|
||||||
getUserType
|
getUserType,
|
||||||
|
saveCallerInfo,
|
||||||
|
getCallerInfo,
|
||||||
|
clearCallerInfo
|
||||||
};
|
};
|
||||||
|
@ -66,7 +66,7 @@ function getParamsFromURL( url: string ): stringkey
|
|||||||
// 拆分属性
|
// 拆分属性
|
||||||
const paramArray: string[] = paramString.split( "&" );
|
const paramArray: string[] = paramString.split( "&" );
|
||||||
|
|
||||||
paramArray.forEach( ( item ) =>
|
paramArray.forEach(( item ) =>
|
||||||
{
|
{
|
||||||
if ( item.length === 0 )
|
if ( item.length === 0 )
|
||||||
{
|
{
|
||||||
@ -76,7 +76,7 @@ function getParamsFromURL( url: string ): stringkey
|
|||||||
const param = item.split( "=" );
|
const param = item.split( "=" );
|
||||||
|
|
||||||
paramObj[param[0]] = param[1] ?? "";
|
paramObj[param[0]] = param[1] ?? "";
|
||||||
} );
|
});
|
||||||
|
|
||||||
return paramObj;
|
return paramObj;
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,11 @@ interface Archievement
|
|||||||
*/
|
*/
|
||||||
function queryDepartmentArchievement( render: any ): void
|
function queryDepartmentArchievement( render: any ): void
|
||||||
{
|
{
|
||||||
instance.request( {
|
instance.request({
|
||||||
method: "post",
|
method: "post",
|
||||||
url: API_URL.URL_DEPARTMENT_ARCHIEVEMENT,
|
url: API_URL.URL_DEPARTMENT_ARCHIEVEMENT,
|
||||||
} )
|
})
|
||||||
.then( ( response ) =>
|
.then(( response ) =>
|
||||||
{
|
{
|
||||||
const archievement: Archievement = {
|
const archievement: Archievement = {
|
||||||
success: false,
|
success: false,
|
||||||
@ -60,11 +60,11 @@ function queryDepartmentArchievement( render: any ): void
|
|||||||
archievement.backward_list = data.backward_list ?? [];
|
archievement.backward_list = data.backward_list ?? [];
|
||||||
|
|
||||||
render( data );
|
render( data );
|
||||||
} )
|
})
|
||||||
.catch( ( error ) =>
|
.catch(( error ) =>
|
||||||
{
|
{
|
||||||
console.log( error );
|
console.log( error );
|
||||||
} );
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export { queryDepartmentArchievement, type Archievement };
|
export { queryDepartmentArchievement, type Archievement };
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, reactive, onBeforeMount } from "vue";
|
import { computed, reactive, onBeforeMount } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { loadStaffInfo } 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 ArchievementChart from "@/components/ArchievementChartComponent.vue";
|
import ArchievementChart from "@/components/ArchievementChartComponent.vue";
|
||||||
@ -78,7 +78,7 @@ export default {
|
|||||||
setup()
|
setup()
|
||||||
{
|
{
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const staffInfo = loadStaffInfo();
|
const callerInfo = getCallerInfo();
|
||||||
const ui = reactive({
|
const ui = reactive({
|
||||||
chartData: [0,], // 业绩表
|
chartData: [0,], // 业绩表
|
||||||
totalArchievement: 0, // 总业绩
|
totalArchievement: 0, // 总业绩
|
||||||
@ -92,21 +92,21 @@ export default {
|
|||||||
|
|
||||||
const getTotalArchievement = computed(() =>
|
const getTotalArchievement = computed(() =>
|
||||||
{
|
{
|
||||||
const cnyFormat = new Intl.NumberFormat("zh-cn",
|
const cnyFormat = new Intl.NumberFormat( "zh-cn",
|
||||||
{
|
{
|
||||||
style: "currency",
|
style: "currency",
|
||||||
currency: "CNY",
|
currency: "CNY",
|
||||||
minimumFractionDigits: 0,
|
minimumFractionDigits: 0,
|
||||||
});
|
});
|
||||||
const archievement = cnyFormat.format(ui.totalArchievement);
|
const archievement = cnyFormat.format( ui.totalArchievement );
|
||||||
|
|
||||||
return archievement;
|
return archievement;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 绘制数据
|
// 绘制数据
|
||||||
const renderData = (data:Archievement) =>
|
const renderData = ( data:Archievement ) =>
|
||||||
{
|
{
|
||||||
console.log("部门业绩数据", data);
|
console.log( "部门业绩数据", data );
|
||||||
|
|
||||||
ui.chartData = data.mensual_archievement_list;
|
ui.chartData = data.mensual_archievement_list;
|
||||||
ui.totalArchievement = data.total_archievement;
|
ui.totalArchievement = data.total_archievement;
|
||||||
@ -116,20 +116,20 @@ export default {
|
|||||||
// 更新UI
|
// 更新UI
|
||||||
ui.showUI = false;
|
ui.showUI = false;
|
||||||
|
|
||||||
setTimeout(() => { ui.showUI = true; }, 0);
|
setTimeout(() => { ui.showUI = true; }, 0 );
|
||||||
};
|
};
|
||||||
|
|
||||||
// 退出桌面霸屏
|
// 退出桌面霸屏
|
||||||
const logoutDesktopArchievement = () =>
|
const logoutDesktopArchievement = () =>
|
||||||
{
|
{
|
||||||
console.log("111");
|
console.log( "111" );
|
||||||
logout();
|
logout();
|
||||||
|
|
||||||
// router.push("/login");
|
// router.push("/login");
|
||||||
};
|
};
|
||||||
|
|
||||||
// 检查存储的登录信息,不存在则返回登录页面
|
// 检查存储的登录信息,不存在则返回登录页面
|
||||||
if (staffInfo.P13UID === "")
|
if ( callerInfo === "" )
|
||||||
{
|
{
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: "登录信息失效,请重新登录!",
|
message: "登录信息失效,请重新登录!",
|
||||||
@ -137,12 +137,12 @@ export default {
|
|||||||
center: true,
|
center: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
router.push("/login");
|
router.push( "/login" );
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() =>
|
onBeforeMount(() =>
|
||||||
{
|
{
|
||||||
queryDepartmentArchievement(renderData);
|
queryDepartmentArchievement( renderData );
|
||||||
});
|
});
|
||||||
|
|
||||||
return { ui, getTotalArchievement, renderData, logoutDesktopArchievement, };
|
return { ui, getTotalArchievement, renderData, logoutDesktopArchievement, };
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { reactive, onBeforeMount } from "vue";
|
import { reactive, onBeforeMount } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { loadStaffInfo, saveStaffInfo, getUserType, saveUserType } from "@/utils/api/localStorage";
|
import { loadStaffInfo, saveStaffInfo, getUserType, saveUserType, getCallerInfo, saveCallerInfo } from "@/utils/api/localStorage";
|
||||||
import { login } from "@/utils/account";
|
import { login } from "@/utils/account";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { StaffInfo } from "@/data/cpicxim/StaffInfo";
|
import { StaffInfo } from "@/data/cpicxim/StaffInfo";
|
||||||
@ -93,16 +93,19 @@ export default {
|
|||||||
|
|
||||||
const savedP13uid = () =>
|
const savedP13uid = () =>
|
||||||
{
|
{
|
||||||
window.localStorage.setItem("stuff_account", ui.account);
|
window.localStorage.setItem( "stuff_account", ui.account );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
const onLogin = () =>
|
const onLogin = () =>
|
||||||
{
|
{
|
||||||
// 保存用户类型
|
// 保存用户类型
|
||||||
saveUserType(ui.currentMenu);
|
saveUserType( ui.currentMenu );
|
||||||
|
|
||||||
// 判断是坐席还是内勤
|
// 判断是坐席还是内勤
|
||||||
if (ui.currentMenu === "cpicxim_staff")
|
if ( ui.currentMenu === "cpicxim_staff" )
|
||||||
{
|
{
|
||||||
// 是内勤员工
|
// 是内勤员工
|
||||||
const info = {
|
const info = {
|
||||||
@ -110,12 +113,12 @@ export default {
|
|||||||
password: ui.password,
|
password: ui.password,
|
||||||
};
|
};
|
||||||
|
|
||||||
login(info)
|
login( info )
|
||||||
.then((response) =>
|
.then(( response ) =>
|
||||||
{
|
{
|
||||||
const data = response.data ?? { success: false, };
|
const data = response.data ?? { success: false, };
|
||||||
|
|
||||||
if (data.success === true)
|
if ( data.success === true )
|
||||||
{
|
{
|
||||||
// 提示登录成功,并保存到localStorage,然后路由跳转
|
// 提示登录成功,并保存到localStorage,然后路由跳转
|
||||||
ElMessage({
|
ElMessage({
|
||||||
@ -134,10 +137,10 @@ export default {
|
|||||||
data.staff_info.p13section_office_nameuid ?? ""
|
data.staff_info.p13section_office_nameuid ?? ""
|
||||||
);
|
);
|
||||||
|
|
||||||
saveStaffInfo(staffInfo);
|
saveStaffInfo( staffInfo );
|
||||||
|
|
||||||
// 跳转路由
|
// 跳转路由
|
||||||
router.push("/desktop");
|
router.push( "/desktop" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -148,40 +151,49 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(data);
|
console.log( data );
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch(( error ) =>
|
||||||
{
|
{
|
||||||
debugger;
|
debugger;
|
||||||
console.log(`登录失败,返回信息:${error}`);
|
console.log( `登录失败,返回信息:${error}` );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (ui.currentMenu === "tele_saler")
|
else if ( ui.currentMenu === "tele_saler" )
|
||||||
{
|
{
|
||||||
// 坐席
|
// 坐席
|
||||||
|
saveCallerInfo( ui.account );
|
||||||
|
|
||||||
|
// 跳转路由
|
||||||
|
router.push( "/desktop_archievement" );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onBeforeMount(() =>
|
onBeforeMount(() =>
|
||||||
{
|
{
|
||||||
const staffInfo = loadStaffInfo();
|
const staffType = getUserType();
|
||||||
|
|
||||||
// 判断是否已经记录了P13账号,有则提示已登录,然后跳转路由
|
// 判断已登录的信息是坐席还是内勤
|
||||||
if (staffInfo.P13UID !== "")
|
if ( staffType === "tele_saler" )
|
||||||
{
|
{
|
||||||
ElMessage({
|
const callInfo = getCallerInfo();
|
||||||
message: `已登录账号:${staffInfo.stuffName}`,
|
|
||||||
type: "success",
|
|
||||||
center: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
// 跳转路由
|
// 判断是否已经记录了P13账号,有则提示已登录,然后跳转路由
|
||||||
// router.push("/desktop_archievement");
|
if ( callInfo !== "" )
|
||||||
|
{
|
||||||
|
ElMessage({
|
||||||
|
message: `已登录账号:${callInfo}`,
|
||||||
|
type: "success",
|
||||||
|
center: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 跳转路由
|
||||||
|
router.push( "/desktop_archievement" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const onToggleMenu = (type: string) =>
|
const onToggleMenu = ( type: string ) =>
|
||||||
{
|
{
|
||||||
ui.currentMenu = type;
|
ui.currentMenu = type;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user