绩效考核PC端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

542 lines
12 KiB

//性别
const sexData=[
{
id:1,
tittle:'男'
},
{
id:2,
tittle:'女'
},
];
// 用工关系选择列表
const emptypeList=[
{
id:1,
tittle:'临时工'
},
{
id:2,
tittle:'编外人员'
},
{
id:3,
tittle:'实习&实习生'
},
{
id:4,
tittle:'试用员工'
},
{
id:5,
tittle:'待分配'
},
{
id:6,
tittle:'待岗'
},
{
id:7,
tittle:'临时调入'
},
{
id:8,
tittle:'正式员工'
},
{
id:9,
tittle:'长期病假'
},
{
id:10,
tittle:'停薪留职'
},
{
id:11,
tittle:'退休'
},
{
id:12,
tittle:'辞职'
},
{
id:13,
tittle:'辞退'
},
{
id:14,
tittle:'离职'
},
];
// 星座列表
const constellationList = [
{
id:1,
tittle:'白羊座'
},
{
id:2,
tittle:'金牛座'
},
{
id:3,
tittle:'双子座'
},
{
id:4,
tittle:'巨蟹座'
},
{
id:5,
tittle:'狮子座'
},
{
id:6,
tittle:'处女座'
},
{
id:7,
tittle:'天枰座'
},
{
id:8,
tittle:'天蝎座'
},
{
id:9,
tittle:'射手座'
},
{
id:10,
tittle:'摩羯座'
},
{
id:11,
tittle:'水瓶座'
},
{
id:12,
tittle:'双鱼座'
},
];
// 婚姻状态列表
const marriageList=[
{
id:1,
tittle:'未婚'
},
{
id:2,
tittle:'已婚'
},
{
id:3,
tittle:'丧偶'
},
{
id:4,
tittle:'离异'
},
];
// 健康状况列表
const healthList=[
{
id:1,
tittle:'良好'
},
{
id:2,
tittle:'一般'
},
{
id:3,
tittle:'较弱'
},
{
id:4,
tittle:'有生理缺陷'
},
{
id:5,
tittle:'残废'
},
];
// 政治面貌列表
const politicsList=[
{
id:1,
tittle:'群众'
},
{
id:2,
tittle:'无党派'
},
{
id:3,
tittle:'台盟会员'
},
{
id:4,
tittle:'九三社员'
},
{
id:5,
tittle:'致公党员'
},
{
id:6,
tittle:'农工党员'
},
{
id:7,
tittle:'民进会员'
},
{
id:8,
tittle:'民建会员'
},
{
id:9,
tittle:'民盟盟员'
},
{
id:10,
tittle:'民革会员'
},
{
id:11,
tittle:'共青团员'
},
{
id:12,
tittle:'预备党员'
},
{
id:13,
tittle:'中共党员'
},
];
// 教育经历列表
const educationList=[
{
id:1,
tittle:'初中及以下'
},
{
id:2,
tittle:'中专'
},
{
id:3,
tittle:'高中'
},
{
id:4,
tittle:'中技'
},
{
id:5,
tittle:'高技'
},
{
id:6,
tittle:'函数专科'
},
{
id:7,
tittle:'大学专科'
},
{
id:8,
tittle:'函数本科'
},
{
id:9,
tittle:'大学本科'
},
{
id:10,
tittle:'硕士研究生'
},
{
id:11,
tittle:'博士研究生'
},
{
id:12,
tittle:'专家、教授'
},
];
//雇佣类型
const employmentType = [
{
id:1,
tittle:'雇佣入职'
},
{
id:2,
tittle:'再入职'
}
];
//入职等级
const positiongrade = [
{
id:10000,
tittle:'无'
},
{
id:1,
tittle:'一级'
},
{
id:2,
tittle:'二级'
},
{
id:3,
tittle:'三级'
}
];
//学位
const academicDegree =[
{
id:1,
title:'无'
},
{
id:2,
title:'学士'
},
{
id:3,
title:'硕士'
},
{
id:4,
title:'博士'
},
];
//主职与兼职
const mainAndPartTimeJobs = [
{
id:1,
title:'主职'
},
{
id:2,
title:'兼职'
}
];
// 职位变动类型
const postChangeType=[
{
id:1,
title:'预入职'
},
{
id:2,
title:'雇佣入职'
},
{
id:3,
title:'转正'
},
{
id:4,
title:'晋升'
},
{
id:5,
title:'降级'
},
{
id:6,
title:'职等调整'
},
{
id:7,
title:'调动调入'
},
{
id:8,
title:'跨公司调动调入'
},
{
id:9,
title:'借调'
},
{
id:10,
title:'平调'
},
{
id:11,
title:'兼职'
},
{
id:12,
title:'预离职'
},
{
id:13,
title:'离职'
},
{
id:14,
title:'退休'
},
{
id:15,
title:'返聘'
},
{
id:16,
title:'员工初始化'
},
];
//注册定义的方法
export const peopleMethod= {
sexData,
emptypeList,
constellationList,
marriageList,
healthList,
politicsList,
educationList,
employmentType,
positiongrade,
academicDegree,
mainAndPartTimeJobs,
postChangeType
};
//date 当前日期,num 几个月
export function getNtoMonth(date, num) {
if (!date || !num) return;
var num1 = parseInt(num);
var d = new Date(date);
var thisMonth = d.getMonth() + 1;
var thisYear = d.getFullYear();
var thisDay = d.getDate();
var dateStr = "";
var addCount = thisMonth + num1;
var diffMonthCount = parseInt(addCount / 12); //取整
if ((thisMonth + num1) === 12 * diffMonthCount) { //如果是本年
if ((thisMonth + num1) === 12) {
diffMonthCount = 0;
} else {
diffMonthCount = diffMonthCount - 1;
}
}
if (thisMonth + num1 > 12) { //如果是大于一年
thisYear += diffMonthCount;
}
thisMonth = (addCount) - 12 * diffMonthCount;
if (thisMonth < 10) {
thisMonth = "0" + thisMonth;
}
var thatDate = new Date(thisYear, thisMonth, 0); //当天数为0 js自动处理为上一月的最后一天
var thatDay = thatDate.getDate();//指定年月的当月最大天数
let m1 = date.substring(5, 7);
if (thisDay === 30 || thisDay === 31 || (m1 === "02" && thisDay >= 28)) {
thisDay = thatDay;
console.log("thisYear------------->",thisYear,thisDay,date)
if (date) {
let m2 = date.substring(5, 10);
// 成立日为2月份,且期限为整年的判断闰年
if (m2 === "02-28" && num % 12 === 0) {
if (!(thisYear % (thisYear % 100 ? 4 : 400))) {
thisDay = "29";
}
}
console.log("thisYear-------1------>",thisYear,thisMonth,thisDay,date,m2,num)
}
dateStr = thisYear + "-" + thisMonth + "-" + thisDay;
} else {
console.log("thisYear-------2------>",thisYear,thisDay,date,m1)
dateStr = addMonth2(date, num);
}
return dateStr;
}
function addMonth2(date, num) {
var monthnum = 0;
if (typeof (num) === "string") { monthnum = parseInt(num); } else { monthnum = num; }
if (typeof (date) === "string") { date = new Date(date); }
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var sumMonths = month + monthnum;
var newyear = year + parseInt(sumMonths / 12);
var newmonth = sumMonths % 12;
var newday = day;
if (newmonth < 1) {
if (newmonth === 0) newyear--;
newmonth = 0 - (sumMonths - 1) % 12;
}
var da = new Date(newyear, newmonth, 0);
var newDayMax = da.getDate()
// if()
// console.log("thisYear-------4---1--->",newyear)
// console.log("thisYear-------4---2--->",newmonth)
// console.log("thisYear-------4---3--->",newday)
// console.log("thisYear-------4---4--->",date)
// console.log("thisYear-------4---5--->",da)
// console.log("thisYear-------4---6--->",year)
// console.log("thisYear-------4---7--->",month)
// console.log("thisYear-------4---8--->",day)
// console.log("thisYear-------4---9--->",newDayMax)
return newyear + "-" + newmonth + "-" + (da.getDate() < newday ? da.getDate() : newday);
};
//判断是不是数组
export function judgeArray(ary){
if(!ary) return false;
if(ary.isArray){
return true;
}else{
if (Object.prototype.toString.call(ary) === '[object Array]') {
return true;
}
}
return false;
};
//计算高度
//定义wappered boolean值是为了区别我自己定义的同名方法,可忽略
export function calcHeightx(value, wappered = true) {
//项目自定义的公共header部分的高度,可忽略
let header = variable.headerHeight;
//value为动态计算table界面高度时,减去的其他空白部分,需自行在调试找到临界值,剩下的就是table表格的高度(包含header+body部分)
value = value == undefined ? 100 : value;
let res = window.innerHeight - parseInt(header.substring(0, header.indexOf('px'))) - value;
if (wappered) {
//通过原生方法,获取dom节点的高度------获取element-ui table表格body的元素
let wapper = window.document.getElementsByClassName('el-table__body-wrapper');
//通过原生方法,获取dom节点的高度------获取element-ui table表格header的元素
let header = window.document.getElementsByClassName('el-table__header-wrapper');
//必须加延时,要不然赋不上去值
setTimeout(() => {
//通过上边计算得到的table高度的value值,减去table表格的header高度,剩下的通过dom节点直接强行赋给table表格的body
wapper[0].style.height = (value - header[0].clientHeight) + 'px';
}, 100)
}
return res;
};