整理代码!

This commit is contained in:
Kane Wang 2023-03-24 15:11:47 +08:00
parent bee1061e20
commit 7dbd48152f
14 changed files with 119 additions and 80 deletions

View File

@ -32,10 +32,10 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
a_end_date);
FOR caller_record IN (SELECT *
FROM 车非每日保费_t)
FROM desktop_archievement_admin.车非每日保费_t)
LOOP
BEGIN
DELETE 车非每日保费 cf
DELETE desktop_archievement_admin.车非每日保费 cf
WHERE cf.签单日期 = caller_record.签单日期
AND cf.部门 = caller_record.部门
AND cf.经办人n = caller_record.经办人n
@ -45,7 +45,7 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
NULL;
END;
INSERT INTO 车非每日保费
INSERT INTO desktop_archievement_admin.车非每日保费
VALUES caller_record;
END LOOP;
@ -62,9 +62,9 @@ CREATE OR REPLACE PACKAGE BODY telsale_archievement_pkg IS
a_end_date IN DATE
) IS
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
(SELECT to_char(t.signature_date,
'yyyy-mm-dd') 签单日期,

View File

@ -22,6 +22,7 @@ module.exports = {
extends:["eslint:recommended",],
rules:{
indent: ["warn", 4,],
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-unused-vars": "warn",
@ -73,7 +74,7 @@ module.exports = {
],
rules: {
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-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-unused-vars": "warn",
@ -136,7 +137,7 @@ module.exports = {
"plugin:@typescript-eslint/recommended",
],
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-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"@typescript-eslint/indent": ["error", 4,],

View File

@ -26,7 +26,7 @@ export default {
default: () => [],
},
},
setup(props)
setup( props )
{
const ui = reactive({
});
@ -34,8 +34,8 @@ export default {
//
const initCharts = () =>
{
const chartDom = document.getElementById("chartWrapper");
const myChart = echarts.init(chartDom as HTMLDivElement);
const chartDom = document.getElementById( "chartWrapper" );
const myChart = echarts.init( chartDom as HTMLDivElement );
const option = {
xAxis: {
type: "category",
@ -53,7 +53,7 @@ export default {
],
};
option && myChart.setOption(option);
option && myChart.setOption( option );
window.onresize = function ()
{

View File

@ -36,9 +36,9 @@ export default {
default: "",
},
},
setup(props)
setup( props )
{
const percentage = Number(props.percentage).valueOf();
const percentage = Number( props.percentage ).valueOf();
const ui = reactive({
percentage,

View File

@ -34,7 +34,7 @@ class StaffInfo
return this._stuffCode;
}
public set stuffCode(stuffCode: string)
public set stuffCode( stuffCode: string )
{
this._stuffCode = stuffCode;
}
@ -44,7 +44,7 @@ class StaffInfo
return this._stuffName;
}
public set stuffName(stuffName: string)
public set stuffName( stuffName: string )
{
this._stuffName = stuffName;
}
@ -54,12 +54,12 @@ class StaffInfo
return this._p13uid;
}
public set P13UID(p13uid: string)
public set P13UID( p13uid: string )
{
this._p13uid = p13uid;
}
public set departmentCode(departmentCode: string)
public set departmentCode( departmentCode: string )
{
this._departmentCode = departmentCode;
}
@ -69,7 +69,7 @@ class StaffInfo
return this._departmentCode;
}
public set departmentName(departmentName: string)
public set departmentName( departmentName: string )
{
this._departmentName = departmentName;
}

View File

@ -12,7 +12,13 @@
<span class="company-name">CPIC</span>
<div class="version-wrapper">
<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>
</template>

View File

@ -2,7 +2,7 @@
* @Author: Kane
* @Date: 2023-02-15 09:25:52
* @LastEditors: Kane
* @LastEditTime: 2023-03-23 16:32:01
* @LastEditTime: 2023-03-24 14:34:52
* @FilePath: /task_schedule/src/main.js
* @Description:
*
@ -21,17 +21,17 @@ import "./assets/css/index.scss";
// element-plus
import ElementPlus from "element-plus";
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的图标
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(router);
app.use(store);
app.mount("#app");
app.use( ElementPlus );
app.use( router );
app.use( store );
app.mount( "#app" );

View File

@ -38,7 +38,7 @@ const routes = [
title: "总览",
icon: "house",
},
component: ()=> import("../layout/Index.vue"),
component: ()=> import( "../layout/Index.vue" ),
children:[
{
path:"/desktop",
@ -47,7 +47,7 @@ const routes = [
title:"工作台",
icon: "house",
},
component: ()=> import("../views/Desktop.vue"),
component: ()=> import( "../views/Desktop.vue" ),
},
],
},
@ -59,7 +59,7 @@ const routes = [
title:"数据管理",
icon: "document",
},
component: ()=> import("../layout/Index.vue"),
component: ()=> import( "../layout/Index.vue" ),
children:[
{
path:"/staff_data",
@ -68,7 +68,7 @@ const routes = [
title:"坐席管理",
icon: "user",
},
component: ()=> import("../views/StaffManagement.vue"),
component: ()=> import( "../views/StaffManagement.vue" ),
},
{
path:"/archievement_data",
@ -77,7 +77,7 @@ const routes = [
title:"数据管理",
icon: "document",
},
component: ()=> import("../views/DataManagement.vue"),
component: ()=> import( "../views/DataManagement.vue" ),
},
],
},
@ -104,12 +104,12 @@ function hasOnlyChild( children )
return false;
}
const routes = children.filter((item)=>
const routes = children.filter(( item )=>
{
return !item.hidden;
});
if ( routes.length === 1)
if ( routes.length === 1 )
{
return true;
}

View File

@ -11,7 +11,7 @@
import { type AxiosResponse } from "axios";
import { service as instance } from "./api/request.js";
import { API_URL } from "./api/config.js";
import { cleanStaffInfo } from "./api/localStorage.js";
import { cleanStaffInfo, clearCallerInfo } from "./api/localStorage.js";
// @ts-expect-error 之后再补充类型文件
import { router } from "../router/index.js";
@ -38,6 +38,7 @@ async function login( data: LoginInfo ): Promise<AxiosResponse<any, any>>
function logout(): void
{
cleanStaffInfo();
clearCallerInfo();
void router.push( "/login" );
}

View File

@ -10,6 +10,7 @@
import { StaffInfo } from "@/data/cpicxim/StaffInfo.js";
const STUFF_ITEM = "stuff_info";
const CALLER_ITEM = "call_info";
const USER_TYPE_ITEM = "user_type";
function loadStaffInfo(): StaffInfo
@ -61,10 +62,28 @@ function getUserType(): string
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 {
loadStaffInfo,
saveStaffInfo,
cleanStaffInfo,
saveUserType,
getUserType
getUserType,
saveCallerInfo,
getCallerInfo,
clearCallerInfo
};

View File

@ -66,7 +66,7 @@ function getParamsFromURL( url: string ): stringkey
// 拆分属性
const paramArray: string[] = paramString.split( "&" );
paramArray.forEach( ( item ) =>
paramArray.forEach(( item ) =>
{
if ( item.length === 0 )
{
@ -76,7 +76,7 @@ function getParamsFromURL( url: string ): stringkey
const param = item.split( "=" );
paramObj[param[0]] = param[1] ?? "";
} );
});
return paramObj;
}

View File

@ -30,11 +30,11 @@ interface Archievement
*/
function queryDepartmentArchievement( render: any ): void
{
instance.request( {
instance.request({
method: "post",
url: API_URL.URL_DEPARTMENT_ARCHIEVEMENT,
} )
.then( ( response ) =>
})
.then(( response ) =>
{
const archievement: Archievement = {
success: false,
@ -60,11 +60,11 @@ function queryDepartmentArchievement( render: any ): void
archievement.backward_list = data.backward_list ?? [];
render( data );
} )
.catch( ( error ) =>
})
.catch(( error ) =>
{
console.log( error );
} );
});
}
export { queryDepartmentArchievement, type Archievement };

View File

@ -58,7 +58,7 @@
<script lang="ts">
import { computed, reactive, onBeforeMount } from "vue";
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 { type Archievement, queryDepartmentArchievement } from "@/utils/archievement.js";
import ArchievementChart from "@/components/ArchievementChartComponent.vue";
@ -78,7 +78,7 @@ export default {
setup()
{
const router = useRouter();
const staffInfo = loadStaffInfo();
const callerInfo = getCallerInfo();
const ui = reactive({
chartData: [0,], //
totalArchievement: 0, //
@ -92,21 +92,21 @@ export default {
const getTotalArchievement = computed(() =>
{
const cnyFormat = new Intl.NumberFormat("zh-cn",
const cnyFormat = new Intl.NumberFormat( "zh-cn",
{
style: "currency",
currency: "CNY",
minimumFractionDigits: 0,
});
const archievement = cnyFormat.format(ui.totalArchievement);
const archievement = cnyFormat.format( ui.totalArchievement );
return archievement;
});
//
const renderData = (data:Archievement) =>
const renderData = ( data:Archievement ) =>
{
console.log("部门业绩数据", data);
console.log( "部门业绩数据", data );
ui.chartData = data.mensual_archievement_list;
ui.totalArchievement = data.total_archievement;
@ -116,20 +116,20 @@ export default {
// UI
ui.showUI = false;
setTimeout(() => { ui.showUI = true; }, 0);
setTimeout(() => { ui.showUI = true; }, 0 );
};
// 退
const logoutDesktopArchievement = () =>
{
console.log("111");
console.log( "111" );
logout();
// router.push("/login");
};
//
if (staffInfo.P13UID === "")
if ( callerInfo === "" )
{
ElMessage({
message: "登录信息失效,请重新登录!",
@ -137,12 +137,12 @@ export default {
center: true,
});
router.push("/login");
router.push( "/login" );
}
onBeforeMount(() =>
{
queryDepartmentArchievement(renderData);
queryDepartmentArchievement( renderData );
});
return { ui, getTotalArchievement, renderData, logoutDesktopArchievement, };

View File

@ -67,7 +67,7 @@
<script lang="ts">
import { reactive, onBeforeMount } from "vue";
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 { ElMessage } from "element-plus";
import { StaffInfo } from "@/data/cpicxim/StaffInfo";
@ -93,16 +93,19 @@ export default {
const savedP13uid = () =>
{
window.localStorage.setItem("stuff_account", ui.account);
window.localStorage.setItem( "stuff_account", ui.account );
};
/**
*
*/
const onLogin = () =>
{
//
saveUserType(ui.currentMenu);
saveUserType( ui.currentMenu );
//
if (ui.currentMenu === "cpicxim_staff")
if ( ui.currentMenu === "cpicxim_staff" )
{
//
const info = {
@ -110,12 +113,12 @@ export default {
password: ui.password,
};
login(info)
.then((response) =>
login( info )
.then(( response ) =>
{
const data = response.data ?? { success: false, };
if (data.success === true)
if ( data.success === true )
{
// localStorage
ElMessage({
@ -134,10 +137,10 @@ export default {
data.staff_info.p13section_office_nameuid ?? ""
);
saveStaffInfo(staffInfo);
saveStaffInfo( staffInfo );
//
router.push("/desktop");
router.push( "/desktop" );
}
else
{
@ -148,40 +151,49 @@ export default {
});
}
console.log(data);
console.log( data );
})
.catch((error) =>
.catch(( error ) =>
{
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(() =>
{
const staffInfo = loadStaffInfo();
const staffType = getUserType();
// P13
if (staffInfo.P13UID !== "")
//
if ( staffType === "tele_saler" )
{
ElMessage({
message: `已登录账号:${staffInfo.stuffName}`,
type: "success",
center: true,
});
const callInfo = getCallerInfo();
//
// router.push("/desktop_archievement");
// P13
if ( callInfo !== "" )
{
ElMessage({
message: `已登录账号:${callInfo}`,
type: "success",
center: true,
});
//
router.push( "/desktop_archievement" );
}
}
});
const onToggleMenu = (type: string) =>
const onToggleMenu = ( type: string ) =>
{
ui.currentMenu = type;
};