配置针对vue文件eslint

This commit is contained in:
2023-03-17 14:40:04 +08:00
parent 884641abbf
commit 8053360878
16 changed files with 1282 additions and 841 deletions

View File

@@ -2,34 +2,33 @@
* @Author: Kane
* @Date: 2023-02-15 09:25:52
* @LastEditors: Kane
* @LastEditTime: 2023-03-03 10:00:54
* @LastEditTime: 2023-03-17 14:31:14
* @FilePath: /task_schedule/src/App.vue
* @Description:
* @Description:
* 应用的框架
* 1配置el-config-provider配置为中文
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
* 1配置el-config-provider配置为中文
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
-->
<template>
<el-config-provider :locale="locale">
<router-view></router-view>
</el-config-provider>
<el-config-provider :locale="locale">
<router-view />
</el-config-provider>
</template>
<script lang="ts">
import zhCn from "element-plus/lib/locale/lang/zh-cn"; //element-plus语言组件
import zhCn from "element-plus/lib/locale/lang/zh-cn"; // element-plus语言组件
export default {
name: "App",
components: {},
setup()
{
const locale = zhCn;
name: "App",
components: {},
setup()
{
const locale = zhCn;
return { locale, };
},
return { locale, };
},
};
</script>
<style scoped></style>

View File

@@ -4,12 +4,12 @@
* @LastEditors: Kane
* @FilePath: /task_schedule/src/components/ArchievementChartComponent.vue
* @Description: 业绩图表组件
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
-->
<template>
<div class="archievement-wrapper">
<div id="chartWrapper"></div>
<div id="chartWrapper" />
</div>
</template>
@@ -18,58 +18,58 @@ import { reactive, onMounted } from "vue";
import * as echarts from "echarts";
export default {
name: "ArchievementChartComponent",
props: {
chart_data: {
type: Array,
require: true,
},
name: "ArchievementChartComponent",
props: {
chartData: {
type: Array,
require: true,
default: () => [],
},
setup(props)
},
setup (props)
{
const ui = reactive({
chart_data: props.chartData,
});
// 设置图表
const initCharts = () =>
{
const ui = reactive({
chart_data: props.chart_data,
});
const chartDom = document.getElementById("chartWrapper");
const myChart = echarts.init(chartDom as HTMLDivElement);
const option = {
xAxis: {
type: "category",
data: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二",],
},
yAxis: {
type: "value",
data: [200, 400, 600, 800, 1000,],
},
series: [
{
data: props.chartData,
type: "line",
},
],
};
//设置图表
const initCharts = () =>
{
const chartDom = document.getElementById("chartWrapper");
// @ts-ignore
const myChart = echarts.init(chartDom);
const option = {
xAxis: {
type: "category",
data: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二",],
},
yAxis: {
type: "value",
data: [200, 400, 600, 800, 1000,],
},
series: [
{
data: props.chart_data,
type: "line",
},
],
};
option && myChart.setOption(option);
option && myChart.setOption(option);
window.onresize = function ()
{
// 自适应大小
myChart.resize();
};
};
window.onresize = function ()
{
//自适应大小
myChart.resize();
};
};
onMounted(() =>
{
initCharts();
});
onMounted(() =>
{
initCharts();
});
return { ui, initCharts, };
},
return { ui, initCharts, };
},
};
</script>
@@ -105,4 +105,4 @@ export default {
border-radius: 5px;
}
}
</style>
</style>

View File

@@ -9,8 +9,11 @@
-->
<template>
<div class="complete-rate-wrapper">
<el-progress type="circle" :percentage="ui.percentage">
<template #default="{ percentage }">
<el-progress
type="circle"
:percentage="ui.percentage"
>
<template #default>
<span class="percentage-label">{{ ui.indicator }}</span>
<span class="percentage-value">{{ percentage }}%</span>
</template>
@@ -26,6 +29,7 @@ export default {
percentage: {
type: String,
require: true,
default:()=>"0",
},
indicator: {
type: String,

View File

@@ -3,14 +3,17 @@
* @Date: 2023-03-08 18:32:13
* @LastEditors: Kane
* @FilePath: /task_schedule/src/components/DishonorListComponent.vue
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
-->
<template>
<div class="dishonorlist-wrapper">
<div class="banner-wrapper">
<img src="@/assets/img/ranking/stop.png" alt="">
<img
src="@/assets/img/ranking/stop.png"
alt=""
>
<div class="title-wrapper">
<span>"消7灭6"突围战</span>
<span>二月入营坐席</span>
@@ -21,18 +24,23 @@
<script lang="ts">
export default {
name: "DishonorListComponent",
props: {
month: {
type: String,
require: true,
},
dishonorPersons: {
type: Array,
require: true,
},
name: "DishonorListComponent",
props: {
month: {
type: String,
require: true,
default: () => "本",
},
setup() { },
dishonorPersons: {
type: Array,
require: true,
default: () => [],
},
},
setup ()
{
return {};
},
};
</script>
@@ -72,4 +80,4 @@ export default {
}
}
}
</style>
</style>

View File

@@ -13,13 +13,19 @@
<div class="reward-wrapper">
<div class="leading-reward-wrapper">
<div class="banner-wrapper">
<img src="@/assets/img/ranking/medal.png" alt="领跑奖">
<img
src="@/assets/img/ranking/medal.png"
alt="领跑奖"
>
<span>领跑奖</span>
</div>
</div>
<div class="advance-reward-wrapper">
<div class="banner-wrapper">
<img src="@/assets/img/ranking/copper_medal.png" alt="飞跃奖">
<img
src="@/assets/img/ranking/copper_medal.png"
alt="飞跃奖"
>
<span>飞跃奖</span>
</div>
</div>
@@ -34,17 +40,20 @@ export default {
month: {
type: String,
require: true,
default:()=>"本",
},
leadingReward: {
type: String,
require: true,
default:()=>"",
},
advanceReward: {
type: String,
require: true,
default:()=>"",
},
},
setup(props)
setup()
{
return {};
},

View File

@@ -2,37 +2,36 @@
* @Author: Kane
* @Date: 2023-02-15 09:25:52
* @LastEditors: Kane
* @LastEditTime: 2023-03-03 15:50:08
* @LastEditTime: 2023-03-17 12:07:48
* @FilePath: /task_schedule/src/main.js
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
import { createApp } from 'vue';
import { createApp } from "vue";
import { router } from "./router/index";
import store from "@/store/index";
import App from './App.vue';
import App from "./App.vue";
//css
import './style.css';
// css
import "./style.css";
import "./assets/css/index.scss";
import("element-plus/dist/index.css");
//element-plus
// element-plus
import ElementPlus from "element-plus";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import("element-plus/dist/index.css");
const app = createApp(App);
//注册element-plus的图标
// 注册element-plus的图标
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.mount("#app");

View File

@@ -17,9 +17,9 @@ function loadStaffInfo(): StaffInfo
try
{
obj = JSON.parse(window.localStorage.getItem(STUFF_ITEM) ?? "{}");
obj = JSON.parse( window.localStorage.getItem( STUFF_ITEM ) ?? "{}" );
}
catch (error)
catch ( error )
{
obj = {};
}
@@ -31,16 +31,16 @@ function loadStaffInfo(): StaffInfo
obj._department_code ?? "",
obj._department_name ?? "",
obj._section_office_code ?? "",
obj._section_office_name ?? "");
obj._section_office_name ?? "" );
return stuff;
}
function saveStaffInfo(stuff: StaffInfo): void
function saveStaffInfo( stuff: StaffInfo ): void
{
const json = JSON.stringify(stuff);
const json = JSON.stringify( stuff );
window.localStorage.setItem(STUFF_ITEM, json);
window.localStorage.setItem( STUFF_ITEM, json );
};
export { loadStaffInfo, saveStaffInfo };

View File

@@ -19,27 +19,27 @@ const service: AxiosInstance = axios.create(
// 请求拦截
service.interceptors.request.use(
(config) =>
( config ) =>
{
return config;
},
async (error) =>
async ( error ) =>
{
console.log(error);
console.log( error );
return await Promise.reject(error);
return await Promise.reject( error );
}
);
// 响应拦截
service.interceptors.response.use(
(response) =>
( response ) =>
{
return response;
},
async (error) =>
async ( error ) =>
{
return await Promise.reject(error);
return await Promise.reject( error );
}
);

View File

@@ -15,15 +15,15 @@ type stringkey = Record<string, string>;
* @param url 访问的url
* @returns
*/
function getURLParams(url: string): Record<string, string>
function getURLParams( url: string ): Record<string, string>
{
const arr = url.split("?");
const params = arr[1].split("&");
const arr = url.split( "?" );
const params = arr[1].split( "&" );
const obj: stringkey = {};
for (let i = 0; i < params.length; i++)
for ( let i = 0; i < params.length; i++ )
{
const param = params[i].split("=");
const param = params[i].split( "=" );
obj[param[0]] = param[1];
}
@@ -36,47 +36,47 @@ function getURLParams(url: string): Record<string, string>
* @param url url字符串
* @returns 返回包含url中参数作为key值作为value的对象。
*/
function getParamsFromURL(url: string): stringkey
function getParamsFromURL( url: string ): stringkey
{
const indexOfQuestionMark: number = url.indexOf("?");
const indexOfSharp: number = url.indexOf("#");
const indexOfQuestionMark: number = url.indexOf( "?" );
const indexOfSharp: number = url.indexOf( "#" );
const paramObj: stringkey = {};
let paramString;
// url中没有问号说明没有参数
if (indexOfQuestionMark < 0)
if ( indexOfQuestionMark < 0 )
{
return paramObj;
}
// 检查是否有#号
if (indexOfSharp < 0)
if ( indexOfSharp < 0 )
{
// 没有#号,可以直接截取参数字符串
paramString = url.substring(indexOfQuestionMark);
// 没有#号,可以直接截取参数字符串
paramString = url.substring( indexOfQuestionMark );
}
else
{
// 有#号,截取?和#之间的字符串
// 有#号,截取?和#之间的字符串
const end: number = indexOfQuestionMark < indexOfSharp ? indexOfSharp : url.length;
paramString = url.substring(indexOfQuestionMark + 1, end);
paramString = url.substring( indexOfQuestionMark + 1, end );
}
// 拆分属性
const paramArray: string[] = paramString.split("&");
const paramArray: string[] = paramString.split( "&" );
paramArray.forEach((item) =>
paramArray.forEach( ( item ) =>
{
if (item.length === 0)
if ( item.length === 0 )
{
return;
}
const param = item.split("=");
const param = item.split( "=" );
paramObj[param[0]] = param[1] ?? "";
});
} );
return paramObj;
}

View File

@@ -4,8 +4,8 @@
* @LastEditors: Kane
* @FilePath: /task_schedule/src/views/DesktopArchievement.vue
* @Description: 显示在桌面上展示任务量与业绩的view
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
-->
<template>
<div class="view-wrapper">
@@ -17,21 +17,35 @@
</div>
<div class="archievement-wrapper">
<div class="total-archievement-rate-wrapper">
<ArchievementCompleteRateComponent indicator="续保完成率" percentage=95 />
<ArchievementCompleteRateComponent indicator="车非渗透率" percentage=95 />
<ArchievementCompleteRateComponent
indicator="续保完成率"
percentage="95"
/>
<ArchievementCompleteRateComponent
indicator="车非渗透率"
percentage="95"
/>
</div>
<div class="total-archievement-charts-wrapper">
<ArchievementChart total_archievement="435220" :chart_data="ui.chartData" />
<ArchievementChart
total_archievement="435220"
:chart_data="ui.chartData"
/>
</div>
</div>
<div class="reward-wrapper">
<HonorListComponent month="二" leading-reward="王炜" advance-reward="王炜" />
<DishonorListComponent month="二" :dishonorPersons="ui.dishonorPersons" />
<HonorListComponent
month="二"
leading-reward="王炜"
advance-reward="王炜"
/>
<DishonorListComponent
month="二"
:dishonor-persons="ui.dishonorPersons"
/>
</div>
</div>
<div class="right-wrapper">
</div>
<div class="right-wrapper" />
</div>
</template>
@@ -76,8 +90,8 @@ export default {
return archievement;
});
//检查存储的登录信息,不存在则返回登录页面
if (staffInfo.P13UID == "")
// 检查存储的登录信息,不存在则返回登录页面
if (staffInfo.P13UID === "")
{
ElMessage({
message: "登录信息失效,请重新登录!",
@@ -228,4 +242,4 @@ div {
// border: 1px solid red;
box-sizing: border-box;
}
</style>
</style>

View File

@@ -3,11 +3,11 @@
* @Date: 2023-02-28 00:57:21
* @LastEditors: Kane
* @FilePath: /task_schedule/src/views/Login.vue
* @Description:
* @Description:
* 登录页面路由默认指向这个页面
* 1判断url中的参数取得用户信息根据用户的部门改变路由
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
-->
<template>
<div class="page-wrapper">
@@ -16,14 +16,26 @@
<el-form ref="loginForm">
<el-form-item>
<label class="form-label">用户名</label>
<el-input type="text" v-model.trim.lazy="ui.account" placeholder="请输入P13账号或P09工号"></el-input>
<el-input
v-model.trim.lazy="ui.account"
type="text"
placeholder="请输入P13账号或P09工号"
/>
</el-form-item>
<el-form-item>
<label class="form-label">密码</label>
<el-input type="password" v-model.trim.lazy="ui.password" placeholder="请输入P13密码"></el-input>
<el-input
v-model.trim.lazy="ui.password"
type="password"
placeholder="请输入P13密码"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" class="el-button-block" @click="onLogin">
<el-button
type="primary"
class="el-button-block"
@click="onLogin"
>
登录
</el-button>
</el-form-item>
@@ -47,7 +59,6 @@ export default {
name: "LoginPage",
setup()
{
const router = useRouter();
const ui = reactive({
@@ -73,11 +84,11 @@ export default {
login(info)
.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({
message: data.message,
type: "success",
@@ -85,18 +96,18 @@ export default {
});
const staffInfo = new StaffInfo(
data.staff_info.p13uid || "",
data.staff_info.code || "",
data.staff_info.name || "",
data.staff_info.department_code || "",
data.staff_info.department_name || "",
data.staff_info.section_office_code || "",
data.staff_info.p13section_office_nameuid || ""
data.staff_info.p13uid && "",
data.staff_info.code && "",
data.staff_info.name && "",
data.staff_info.department_code && "",
data.staff_info.department_name && "",
data.staff_info.section_office_code && "",
data.staff_info.p13section_office_nameuid && ""
);
saveStaffInfo(staffInfo);
//跳转路由
// 跳转路由
router.push("/desktop_archievement");
}
else
@@ -121,8 +132,8 @@ export default {
{
const staffInfo = loadStaffInfo();
//判断是否已经记录了P13账号有则提示已登录然后跳转路由
if (staffInfo.P13UID != "")
// 判断是否已经记录了P13账号有则提示已登录然后跳转路由
if (staffInfo.P13UID !== "")
{
ElMessage({
message: `已登录账号:${staffInfo.stuffName}`,
@@ -130,7 +141,7 @@ export default {
center: true,
});
//跳转路由
// 跳转路由
router.push("/desktop_archievement");
}
});
@@ -173,7 +184,6 @@ export default {
border-radius: 5px;
// backdrop-filter: ;
h1 {
font-family: "FZ-ZHUOHEI";
font-size: 70px;

View File

@@ -3,22 +3,22 @@
* @Date: 2023-02-28 19:10:54
* @LastEditors: Kane
* @FilePath: /task_schedule/src/views/Public.vue
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
-->
<template>
公共页面
<div>公共</div>
</template>
<script lang="ts">
export default {
name: "PublicPage",
setup()
setup()
{
return {};
},
};
</script>
<style lang="scss"></style>
<style lang="scss"></style>