/**
* 如果是null '' 'null' 'undefined'
* @param item
* @returns
*/
export function isEmptyCheck (value) {
if (value == null || value === "" || value == "null" || typeof value == "undefined") {
return true;
}
return false;
}
/**
* 如果不是是null '' 'null' 'undefined'
* @param item
* @returns
*/
export function isNotEmptyCheck (value) {
return !isEmptyCheck(value);
}
export function toFixed (value) {
if (value == 0 || value == '0') {
return 0
} else {
return new Number(value).toFixed(2);
}
}
/**
* 根据状态工单类型ID获取名称
*/
export function getDistanceName (distance) {
let str = "";
if (isNotEmptyCheck(distance)) {
if (distance > 1000) {
var dis = distance / 1000;
dis = dis.toFixed(1);
str = dis + "km";
} else {
str = distance + "m";
}
}
return str;
}
/**
* 业务类型
*/
export function jobTypeArray () {
let jobTypeArray = [
{
id: "0",
name: "代理招聘",
name2: "代理招聘",
value: "0",
text: "代理招聘",
checked: false,
},
{
id: "1",
name: "劳务派遣",
name2: "全职",
value: "1",
text: "劳务派遣",
checked: false,
},
{
id: "2",
name: "劳务外包",
name2: "兼职",
value: "2",
text: "劳务外包",
checked: false,
},
{
id: "4",
name: "劳务外包挂靠",
name2: "劳务外包挂靠",
value: "4",
text: "劳务外包挂靠",
checked: false,
},
];
return jobTypeArray;
}
/**
* 根据业务类型ID获取名称
*/
export function getJobTypeById (id) {
let str = "";
let array = jobTypeArray();
array.forEach((item) => {
if (item.id == id) {
str = item.name;
}
});
return str;
}
/**
* 工种类型
*/
export function workTypeArray () {
let workTypeArray = [
{
id: 0,
name: "全职",
value: "0",
text: "全职",
checked: false,
},
{
id: 1,
name: "兼职",
value: "1",
text: "兼职",
checked: false,
},
{
id: 2,
name: "寒暑假工",
value: "2",
text: "寒暑假工",
checked: false,
},
{
id: 3,
name: "实习生",
value: "3",
text: "实习生",
checked: false,
},
{
id: 4,
name: "零工",
value: "4",
text: "零工",
checked: false,
},
];
return workTypeArray;
}
/**
* 根据工种类型ID获取名称
*/
export function getWorkTypeById (id) {
let str = "";
let array = workTypeArray();
array.forEach((item) => {
if (item.id == id) {
str = item.name;
}
});
return str;
}
/**
* 根据传递的scene参数,获取里面的内容
*/
export function sceneToJson (sceneStr) {
let json = {};
let array = sceneStr.split(",");
array.forEach((item) => {
let arr = item.split("=");
let key = arr[0];
let value = arr[1];
json[key] = value;
});
return json;
}
var isMarry = [
// { id: "", name: "请选择"},
{ id: "未婚", name: "未婚" },
{ id: "已婚", name: "已婚" },
{ id: "离异", name: "离异" },
{ id: "其它", name: "其它" },
];
var isMarry2 = [
{ id: "", name: "请选择" },
{ id: "未婚", name: "未婚" },
{ id: "已婚", name: "已婚" },
{ id: "离异", name: "离异" },
{ id: "其它", name: "其它" },
];
var education = [
// { id: "", name: "请选择"},
{ id: "初中", name: "初中" },
{ id: "中专", name: "中专" },
{ id: "高中", name: "高中" },
{ id: "大专", name: "大专" },
{ id: "本科及以上", name: "本科及以上" },
];
// { id: "-1", name: "请选择" },
var sex = [
{ id: "1", name: "男" },
{ id: "2", name: "女" },
];
var attendanceStatus = [
{ id: "-1", name: "请选择" },
{ id: "1", name: "旷工" },
{ id: "2", name: "正常出勤" },
// { id: "3", name: "上班缺卡"},
// { id: "4", name: "下班缺卡"}
];
var attendanceStatus2 = [
{ id: "-1", name: "请选择" },
{ id: "1", name: "旷工" },
{ id: "2", name: "正常出勤" },
{ id: "3", name: "上班缺卡" },
{ id: "4", name: "下班缺卡" },
{ id: "5", name: "请假" },
{ id: "6", name: "休息" },
];
var signatoryTypeArray = [
{ id: "0", name: "甲方" },
{ id: "1", name: "乙方" },
{ id: "2", name: "丙方" },
{ id: "3", name: "丁方" },
{ id: "4", name: "午方" },
{ id: "5", name: "己方" },
{ id: "6", name: "庚方" },
{ id: "7", name: "辛方" },
{ id: "8", name: "壬方" },
{ id: "9", name: "癸方" },
];
var contractTypeArray = [
{ id: "0", name: "个人" },
{ id: "1", name: "企业" },
];
var hourArray = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"];
var timeArray1 = [["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"], ["00", "30"], ["-"], ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"], ["00", "30"]];
//是否可以面试
var interviewArray = [
{ id: "0", name: "请选择" },
{ id: "1", name: "可以面试" },
{ id: "2", name: "不能面试" },
];
//面试反馈状态
var interviewStatusArray = [
{ id: "0", name: "请选择", checked: false },
{ id: "1", name: "不缺人", checked: false },
{ id: "2", name: "候选人不合适", checked: false },
{ id: "3", name: "面试时间不合适", checked: false },
{ id: "4", name: "面试地点不合适", checked: false },
{ id: "10", name: "爽约", checked: false },
{ id: "11", name: "未通过-形象不符", checked: false },
{ id: "12", name: "未通过-能力不匹配", checked: false },
{ id: "13", name: "放弃", checked: false },
{ id: "21", name: "通过-无法安置", checked: false },
{ id: "20", name: "通过-候选人考虑中", checked: false },
{ id: "29", name: "通过-安排入职", checked: false },
];
//面试反馈状态
var interviewStatusArray1 = [
{ id: "0", name: "请选择", checked: false },
{ id: "1", name: "不缺人", checked: false },
{ id: "2", name: "候选人不合适", checked: false },
{ id: "3", name: "面试时间不合适", checked: false },
{ id: "4", name: "面试地点不合适", checked: false },
];
//面试反馈状态
var interviewStatusArray2 = [
{ id: "0", name: "请选择", checked: false },
{ id: "10", name: "爽约", checked: false },
{ id: "13", name: "放弃", checked: false },
{ id: "11", name: "未通过-形象不符", checked: false },
{ id: "12", name: "未通过-能力不匹配", checked: false },
{ id: "21", name: "通过-无法安置", checked: false },
{ id: "20", name: "通过-候选人考虑中", checked: false },
{ id: "29", name: "通过-安排入职", checked: false },
];
//入职反馈状态
var entryStatusArray = [
{ id: "0", name: "请选择", checked: false },
{ id: "1", name: "候选人主动放弃", checked: false },
{ id: "2", name: "候选人被淘汰", checked: false },
{ id: "10", name: "已入职", checked: false },
];
var workType = [
{ id: "1", name: "全职" },
{ id: "2", name: "兼职" },
{ id: "3", name: "小时工" },
];
var workType2 = [
{ id: "0", name: "请选择" },
{ id: "1", name: "全职" },
{ id: "2", name: "兼职" },
{ id: "3", name: "小时工" },
];
var workType3 = [
{ id: "0", name: "长期工" },
{ id: "1", name: "短期工" },
{ id: "2", name: "寒暑假工" },
{ id: "3", name: "实习生" },
];
var workType4 = [
{ id: "-1", name: "请选择" },
{ id: "0", name: "长期工" },
{ id: "1", name: "短期工" },
{ id: "2", name: "寒暑假工" },
{ id: "3", name: "实习生" },
];
//职位工资结算周期
var settlementCycleArray = [
{ id: "0", name: "月结", checked: false },
{ id: "1", name: "半月结", checked: false },
{ id: "2", name: "周结", checked: false },
{ id: "3", name: "日结", checked: false },
{ id: "4", name: "次结", checked: false },
];
//职位计薪方式
var salaryTypeArray = [
{ id: "0", name: "按月计薪", subName: "月计", checked: false, type: 1 },
{ id: "1", name: "按日计薪", subName: "日计", checked: false, type: 1 },
{ id: "2", name: "按时计薪", subName: "时计", checked: false, type: 1 },
{ id: "3", name: "按次计薪", subName: "次计", checked: false, type: 1 },
];
var hopeLive = [
{ id: "", name: "请选择" },
{ id: "住宿舍", name: "住宿舍" },
{ id: "不住宿舍", name: "不住宿舍" },
];
var workExp = [
// { id: "", name: "请选择"},
{ id: "无工作经验", name: "无工作经验" },
{ id: "餐饮管理经验", name: "餐饮管理经验" },
{ id: "餐饮服务岗经验", name: "餐饮服务岗经验" },
{ id: "非餐饮岗位经验", name: "非餐饮岗位经验" },
{ id: "星级酒店前厅岗位经验", name: "星级酒店前厅岗位经验" },
{ id: "其他", name: "其他" },
];
var education2 = [
{ id: "", name: "请选择" },
{ id: "初中", name: "初中" },
{ id: "中专", name: "中专" },
{ id: "高中", name: "高中" },
{ id: "大专", name: "大专" },
{ id: "本科及以上", name: "本科及以上" },
];
var bankAuth = [
{ id: "0", name: "未认证" },
{ id: "1", name: "已认证" },
{ id: "2", name: "审核中" },
];
var auth = [
{ id: "0", name: "未认证" },
{ id: "1", name: "已认证" },
];
var healthAuth = [
{ id: "0", name: "未绑定" },
{ id: "1", name: "已绑定" },
];
// function CommonUtil(){}
export function getHealthArray () {
return healthAuth;
}
export function getAuthArray () {
return auth;
}
//初始化picker选中项
export function initAuthPicker (id) {
for (var i = 0; i < auth.length; i++) {
if (auth[i].id == id) {
return i;
}
}
return 0;
}
export function getAuthValue (index) {
return auth[index].id;
}
export function getIsMarryArray () {
return isMarry;
}
//初始化picker选中项
export function initIsMarryPicker (name) {
for (var i = 0; i < isMarry.length; i++) {
if (isMarry[i].name == name) {
return i;
}
}
return 0;
}
export function getIsMarryValue (index) {
return isMarry[index].id;
}
export function getEducationArray () {
return education;
}
//初始化picker选中项
export function initEducationPicker (name) {
for (var i = 0; i < education.length; i++) {
if (education[i].name == name) {
return i;
}
}
return 0;
}
export function getEducationValue (index) {
return education[index].id;
}
export function getSexValue (index) {
return sex[index].id;
}
export function getSexArray () {
return sex;
}
//初始化picker选中项
export function initSexPicker (id) {
for (var i = 0; i < sex.length; i++) {
if (sex[i].id == id) {
return i;
}
}
return 0;
}
export function getAttendanceStatus () {
return attendanceStatus;
}
export function getAttendanceStatusValue (index) {
return attendanceStatus[index].id;
}
export function getAttendanceStatusIndex (id) {
for (var i = 0; i < attendanceStatus.length; i++) {
if (attendanceStatus[i].id == id) {
return i;
}
}
return 0;
}
export function getAttendanceStatusName (id) {
for (var i = 0; i < attendanceStatus.length; i++) {
if (attendanceStatus[i].id == id) {
return attendanceStatus[i].name;
}
}
return "";
}
export function getAttendanceStatusNameOfIndex (index) {
for (var i = 0; i < attendanceStatus.length; i++) {
if (index == i) {
return attendanceStatus[i].name;
}
}
return "";
}
export function getAttendanceStatus2 () {
return attendanceStatus2;
}
export function getAttendanceStatusValue2 (index) {
return attendanceStatus2[index].id;
}
export function getAttendanceStatusIndex2 (id) {
for (var i = 0; i < attendanceStatus2.length; i++) {
if (attendanceStatus2[i].id == id) {
return i;
}
}
return 0;
}
export function getAttendanceStatusName2 (id) {
for (var i = 0; i < attendanceStatus2.length; i++) {
if (attendanceStatus2[i].id == id) {
return attendanceStatus2[i].name;
}
}
return "";
}
export function getAttendanceStatusNameOfIndex2 (index) {
for (var i = 0; i < attendanceStatus2.length; i++) {
if (index == i) {
return attendanceStatus2[i].name;
}
}
return "";
}
export function getSignatoryTypeArray () {
return signatoryTypeArray;
}
export function getContractTypeArrayArray () {
return contractTypeArray;
}
export function getHourArray () {
return hourArray;
}
export function getTimeArray1 () {
return timeArray1;
}
export function getInterviewArray () {
return interviewArray;
}
export function getInterviewArrayName (id) {
for (var i = 0; i < interviewArray.length; i++) {
if (interviewArray[i].id == id) {
return interviewArray[i].name;
}
}
return "";
}
export function getInterviewStatusArray () {
return interviewStatusArray;
}
export function getInterviewStatusName (id) {
for (var i = 0; i < interviewStatusArray.length; i++) {
if (interviewStatusArray[i].id == id) {
return interviewStatusArray[i].name;
}
}
return "";
}
export function getInterviewStatusArray1 () {
return interviewStatusArray1;
}
export function getInterviewStatusName1 (id) {
for (var i = 0; i < interviewStatusArray1.length; i++) {
if (interviewStatusArray1[i].id == id) {
return interviewStatusArray1[i].name;
}
}
return "";
}
export function getInterviewStatusIndex1 (id) {
for (var i = 0; i < interviewStatusArray1.length; i++) {
if (interviewStatusArray1[i].id == id) {
return i;
}
}
return -1;
}
export function getInterviewStatusArray2 () {
return interviewStatusArray2;
}
export function getInterviewStatusName2 (id) {
for (var i = 0; i < interviewStatusArray2.length; i++) {
if (interviewStatusArray2[i].id == id) {
return interviewStatusArray2[i].name;
}
}
return "";
}
export function getInterviewStatusIndex2 (id) {
for (var i = 0; i < interviewStatusArray2.length; i++) {
if (interviewStatusArray2[i].id == id) {
return i;
}
}
return -1;
}
export function getEntryStatusArray () {
return entryStatusArray;
}
export function getEntryStatusName (id) {
for (var i = 0; i < entryStatusArray.length; i++) {
if (entryStatusArray[i].id == id) {
return entryStatusArray[i].name;
}
}
return "";
}
export function getEntryStatusIndex (id) {
for (var i = 0; i < entryStatusArray.length; i++) {
if (entryStatusArray[i].id == id) {
return i;
}
}
return -1;
}
export function getWorkTypeArray () {
return workType;
}
//初始化picker选中项
export function initWorkTypePicker (id) {
for (var i = 0; i < workType.length; i++) {
if (workType[i].id == id) {
return i;
}
}
return 0;
}
export function getWorkTypeValue (index) {
return workType[index].id;
}
export function getWorkType2Array () {
return workType2;
}
//初始化picker选中项
export function initWorkType2Picker (id) {
for (var i = 0; i < workType2.length; i++) {
if (workType2[i].id == id) {
return i;
}
}
return 0;
}
export function getWorkType2Value (index) {
return workType2[index].id;
}
export function getWorkType3Array () {
return workType3;
}
//初始化picker选中项
export function initWorkType3Picker (id) {
for (var i = 0; i < workType3.length; i++) {
if (workType3[i].id == id) {
return i;
}
}
return 0;
}
export function getWorkType3Value (index) {
return workType3[index].id;
}
export function getWorkType3Name (id) {
for (var i = 0; i < workType3.length; i++) {
if (workType3[i].id == id) {
return workType3[i].name;
}
}
return "";
}
export function getWorkType4Array () {
return workType4;
}
//初始化picker选中项
export function initWorkType4Picker (id) {
for (var i = 0; i < workType4.length; i++) {
if (workType4[i].id == id) {
return i;
}
}
return 0;
}
export function getWorkType4Value (index) {
return workType4[index].id;
}
export function getWorkType4Name (id) {
for (var i = 0; i < workType4.length; i++) {
if (workType4[i].id == id) {
return workType4[i].name;
}
}
return "";
}
export function getSettlementCycleArray () {
return settlementCycleArray;
}
export function getSettlementCycleName (id) {
for (var i = 0; i < settlementCycleArray.length; i++) {
if (settlementCycleArray[i].id == id) {
return settlementCycleArray[i].name;
}
}
return "";
}
export function getSalaryTypeArray () {
return salaryTypeArray;
}
export function getSalaryTypeName (id) {
for (var i = 0; i < salaryTypeArray.length; i++) {
if (salaryTypeArray[i].id == id) {
return salaryTypeArray[i].name;
}
}
return "";
}
export function getSalaryTypeSubName (id) {
for (var i = 0; i < salaryTypeArray.length; i++) {
if (salaryTypeArray[i].id == id) {
return salaryTypeArray[i].subName;
}
}
return "";
}
export function getHopeLiveArray () {
return hopeLive;
}
//初始化picker选中项
export function initHopeLivePicker (name) {
for (var i = 0; i < hopeLive.length; i++) {
if (hopeLive[i].id == name) {
return i;
}
}
return 0;
}
export function getHopeLiveValue (index) {
return hopeLive[index].id;
}
export function getWorkExpArray () {
return workExp;
}
//初始化picker选中项
export function initWorkExpPicker (name) {
for (var i = 0; i < workExp.length; i++) {
if (workExp[i].name == name) {
return i;
}
}
return 0;
}
export function getWorkExpValue (index) {
return workExp[index].id;
}
export function getEducation2Array () {
return education2;
}
//初始化picker选中项
export function initEducation2Picker (name) {
for (var i = 0; i < education2.length; i++) {
if (education2[i].name == name) {
return i;
}
}
return 0;
}
export function getEducation2Value (index) {
return education2[index].id;
}
export function getIsMarry2Array () {
return isMarry2;
}
//初始化picker选中项
export function initIsMarry2Picker (name) {
for (var i = 0; i < isMarry2.length; i++) {
if (isMarry2[i].name == name) {
return i;
}
}
return 0;
}
export function getIsMarry2Value (index) {
return isMarry2[index].id;
}
export function getBankAuthArray () {
return bankAuth;
}
//初始化picker选中项
export function initBankAuthPicker (id) {
for (var i = 0; i < bankAuth.length; i++) {
if (bankAuth[i].id == id) {
return i;
}
}
return 0;
}
export function getBankAuthValue (index) {
return bankAuth[index].id;
}
/**
*
* @param district 省市县
* @param detailPosition 详细地址
* @returns {string}
*/
export function getStoreAddress (district, detailPosition) {
var res = "";
if (isNotEmptyCheck(district)) {
var tmpArr = district.split(",");
if (tmpArr.length == 3 && tmpArr[0] == tmpArr[1]) {
res += tmpArr[1] + tmpArr[2];
} else {
res += district.replace(/,/g, "");
}
}
if (isNotEmptyCheck(detailPosition)) {
res += detailPosition;
}
return res;
}
/**
* 代理推广明细事件
*/
export function agencyPromotionDetailEventArray () {
let agencyPromotionDetailEventArray = [
{ id: "10", name: "扫码", value: "10", text: "扫码", checked: false },
{ id: "20", name: "报名", value: "20", text: "报名", checked: false },
{ id: "30", name: "面试", value: "30", text: "面试", checked: false },
{ id: "40", name: "入职", value: "40", text: "入职", checked: false },
{ id: "50", name: "离职", value: "50", text: "离职", checked: false },
];
return agencyPromotionDetailEventArray;
}
/**
* 根据代理推广明细事件ID获取名称
*/
export function getAgencyPromotionDetailEventNameId (id) {
let str = "";
let array = agencyPromotionDetailEventArray();
array.forEach((item) => {
if (item.id == id) {
str = item.name;
}
});
return str;
}
/**
* 代理推广明细佣金状态
*/
export function agencyPromotionDetailMoneyStatusArray () {
let agencyPromotionDetailMoneyStatusArray = [
{ id: "0", name: "无佣金", value: "0", text: "无佣金", checked: false },
{ id: "10", name: "待结算", value: "10", text: "待结算", checked: false },
{ id: "20", name: "已结算", value: "20", text: "已结算", checked: false },
{ id: "30", name: "已失效", value: "30", text: "已失效", checked: false },
];
return agencyPromotionDetailMoneyStatusArray;
}
/**
* 根据代理推广明细佣金状态ID获取名称
*/
export function getAgencyPromotionDetailMoneyStatusNameId (id) {
let str = "";
let array = agencyPromotionDetailMoneyStatusArray();
array.forEach((item) => {
if (item.id == id) {
str = item.name;
}
});
return str;
}
export function moneyToFixed (money, fixed = 2, multiplicator = 100) {
if (money != 0 && money != null && money != "" && money != undefined) {
return cutZero(new Number(money / multiplicator).toFixed(fixed));
} else {
return "0";
}
}
export function cutZero (old) {
//拷贝一份 返回去掉零的新串
let newstr = old;
//循环变量 小数部分长度
var leng = old.length - old.indexOf(".") - 1;
//判断是否有效数
if (old.indexOf(".") > -1) {
//循环小数部分
for (var i = leng; i > 0; i--) {
//如果newstr末尾有0
if (newstr.lastIndexOf("0") > -1 && newstr.substr(newstr.length - 1, 1) == 0) {
var k = newstr.lastIndexOf("0");
//如果小数点后只有一个0 去掉小数点
if (newstr.charAt(k - 1) == ".") {
return newstr.substring(0, k - 1);
} else {
//否则 去掉一个0
newstr = newstr.substring(0, k);
}
} else {
//如果末尾没有0
return newstr;
}
}
}
return old;
}
// export function getCurrentPageUrlWithArgs() {
// // const pages = getCurrentPages()
// const currentPage = pages[pages.length - 1]
// const url = currentPage.route
// const options = currentPage.options
// let urlWithArgs = `/${url}?`
// for (let key in options) {
// const value = options[key]
// urlWithArgs += `${key}=${value}&`
// }
// urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1)
// return urlWithArgs
// }
export function getDateArrayOfScope () {
// var multiArray = [['2000年', '2001年'], ['01月', '02月', '03月', '04月', '05月'], ['-'],['2000年', '2001年'], ['01月', '02月', '03月', '04月', '05月']];
var multiArray = [[], ["01月", "02月", "03月", "04月", "05月", "06月", "07月", "08月", "09月", "10月", "11月", "12月"], ["-"], [], ["01月", "02月", "03月", "04月", "05月", "06月", "07月", "08月", "09月", "10月", "11月", "12月"]];
var date = new Date();
var end = date.getFullYear();
var yearArray = [];
for (var i = 1990; i <= end; i++) {
yearArray.push(i + "年");
}
multiArray[0] = yearArray;
multiArray[3] = yearArray;
return multiArray;
}
export function educationArray () {
let educationArray = [
{ id: "初中", name: "初中" },
{ id: "高中", name: "高中" },
{ id: "大专", name: "大专" },
{ id: "本科", name: "本科" },
{ id: "硕士", name: "硕士" },
{ id: "博士", name: "博士" },
];
return educationArray;
}
/**
* 时间格式化 2017-01-01
* @param val
* @returns {string}
*/
export function formatDateYMD (val) {
if (val == null || val == "") {
return null;
}
if ((val != null || val == "") && typeof val == "string") {
if (val.indexOf("T")) {
val = val.replace("T", " "); //原来L端可能返回的时间格式有带T的格式,处理一下
}
val = val.replace("-", "/").replace("-", "/");
}
var value = new Date(val);
//console.log(val);
var fmt = "yyyy-MM-dd";
var o = {
"M+": value.getMonth() + 1, //月份
"d+": value.getDate(), //日
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (value.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
}
}
return fmt;
}
export function formatDateYMDHMS (val) {
// model -> view,在更新 `` 元素之前格式化值
if (val !== "") {
if (val !== null && val !== "" && typeof val == "string") {
if (val.indexOf("T")) {
val = val.replace("T", " "); //原来L端可能返回的时间格式有带T的格式,处理一下
}
val = val.replace("-", "/").replace("-", "/");
}
var value = new Date(val);
//console.log(val);
var fmt = "yyyy-MM-dd HH:mm";
var o = {
"M+": value.getMonth() + 1, //月份
"d+": value.getDate(), //日
"H+": value.getHours(), //小时
//"h+": val.getHours()%12 == 0 ? 12 : val.getHours()%12, //小时
"m+": value.getMinutes(), //分
"s+": value.getSeconds(), //秒
//"S": val.getMilliseconds() //毫秒
//"q+": Math.floor((val.getMonth() + 3) / 3) //季度
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (value.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
}
}
return fmt;
}
}
/**
* 时间格式化 2017-01-01 01:01
* @param val
* @returns {string}
*/
export function formatDateYMDHM (val) {
// model -> view,在更新 `` 元素之前格式化值
if (isEmptyCheck(val)) {
return "";
} else {
if ((val != null || val == "") && typeof val == "string") {
val = val.replace("-", "/").replace("-", "/");
}
var value = new Date(val);
//console.log(val);
var fmt = "yyyy-MM-dd HH:mm";
var o = {
"M+": value.getMonth() + 1, //月份
"d+": value.getDate(), //日
"H+": value.getHours(), //小时
//"h+": val.getHours()%12 == 0 ? 12 : val.getHours()%12, //小时
"m+": value.getMinutes(), //分
// "s+": value.getSeconds() //秒
//"S": val.getMilliseconds() //毫秒
//"q+": Math.floor((val.getMonth() + 3) / 3) //季度
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (value.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
}
}
return fmt;
}
}
function getJobSpecialLabelNamesArray (jobSpecialLabelNames) {
if (isNotEmptyCheck(jobSpecialLabelNames)) {
return new String(jobSpecialLabelNames).split(", ");
}
return [];
}
/**
* 处理工单状态
*/
export function userApplyOrderStatusArray () {
// let orderStatus = [
// { id: "10", name: "审核中", value: "10", text: "审核中" },
// { id: "20", name: "待面试", value: "20", text: "待面试" },
// { id: "30", name: "待入职", value: "30", text: "待入职" },
// { id: "40", name: "在职中", value: "40", text: "在职中" },
// { id: "50", name: "待离职", value: "50", text: "待离职" },
// { id: "60", name: "已完成", value: "60", text: "已完成" },
// ];
let orderStatus = [
{
id: "10",
name: "已报名,审核中",
value: "10",
text: "报名审核中",
num: 0,
},
{
id: "20",
name: "报名成功,待面试",
value: "20",
text: "审核通过",
num: 0,
},
{
id: "21",
name: "审核未通过,报名失败",
value: "21",
text: "审核未通过",
num: 0,
},
{ id: "25", name: "已接到", value: "25", text: "已接到", num: 0 },
{ id: "26", name: "未接到", value: "26", text: "未接到", num: 0 },
{
id: "30",
name: "面试通过,待入职",
value: "30",
text: "面试通过",
num: 0,
},
{ id: "35", name: "面试未通过", value: "35", text: "面试未通过", num: 0 },
{ id: "40", name: "已入职,在职中", value: "40", text: "已入职", num: 0 },
{
id: "45",
name: "面试通过,未入职",
value: "45",
text: "通过未入职",
num: 0,
},
{ id: "50", name: "已离职", value: "50", text: "已离职", num: 0 },
// { id: "60", name: "已完成", value: "60", text: "已完成", num: 0 }
];
return orderStatus;
}
/**
* 获取服务费类型
*/
export function setReturnFee (returnFee, returnFeeType) {
console.log(returnFee);
console.log(returnFeeType);
let servetype
if (returnFeeType === 0) {
servetype = `${returnFee / 100 || "--"}元/小时`;
} else if (returnFeeType === 1) {
servetype = `${returnFee / 100 || "--"}元/日`;
} else if (returnFeeType === 2) {
servetype = `${returnFee / 100 || "--"}元/月`;
} else if (returnFeeType === 3) {
servetype = `${returnFee / 100 || "--"}元/次`;
} else if (returnFeeType === 4) {
servetype = `${returnFee / 100 || "--"}元/件`;
} else if (returnFeeType === 5) {
servetype = `工人收入${returnFee / 100 || "--"}%`;
} else if (returnFeeType === 6) {
servetype = `共${returnFee / 100 || "--"}元`;
} else if (returnFeeType === 7) {
servetype = `费用待定`;
}
return servetype
}
/**
* 根据工单状态ID获取名称 我的老乡
*/
export function getUserApplyOrderStatusById (id) {
let str = "";
let array = userApplyOrderStatusArray();
array.forEach((item) => {
if (id == "50") {
str = "离职";
} else if (id == "40") {
str = "在职";
} else {
str = "报名";
}
});
return str;
}
/**
* 根据工单状态ID获取名称 我的工单
*/
export function getUserApplyOrderStatusByIdToBill (id) {
let str = "";
let array = userApplyOrderStatusArray();
array.forEach((item) => {
if (item.id == id) {
str = item.name;
}
});
return str;
}
// 处理职位列表的方法
export function disposeJobListData (jobList) {
console.log('jobList123',jobList);
if (jobList !== undefined) {
if (Array.isArray(jobList)) {
jobList.forEach((item,index) => {
item["workType"] = getWorkTypeById(item.workTypeMulti);
item["sort"] = index + 1;
if (isNotEmptyCheck(item.distance)) {
item["distanceKm"] = getDistanceName(item.distance);
}
if (isNotEmptyCheck(item.jobDesp)) {
item["jobDesp"] = item["jobDesp"].replaceAll("*****", "");
}
//年龄
// console.log(jobList);
var ageStr = "";
if (isNotEmptyCheck(item.minAge) && isNotEmptyCheck(item.maxAge)) {
ageStr = item.minAge + "-" + item.maxAge + "岁";
} else if (isNotEmptyCheck(item.minAge)) {
ageStr = item.minAge + "岁以上";
} else if (isNotEmptyCheck(item.maxAge)) {
ageStr = item.maxAge + "岁以下";
}
item["age"] = ageStr;
item.updateTime = formatDateYMDHM(item.updateTime);
// 更新时间距离现在的差距
let differenceTime = new Date().getTime() - new Date(item.updateTime || new Date()).getTime();
var D = Math.floor(differenceTime / (24 * 60 * 60 * 1000));
var leave1 = differenceTime % (24 * 3600 * 1000);
var H = Math.floor(leave1 / (3600 * 1000));
var leave2 = leave1 % (3600 * 1000);
var M = Math.floor(leave2 / (60 * 1000));
var leave3 = leave2 % (60 * 1000);
var S = Math.floor(leave3 / 1000);
item.diffTime = null;
if (D > 0) {
item.diffTime = D + "天前";
} else if (H > 0) {
item.diffTime = H + "小时前";
} else if (M > 0) {
item.diffTime = M + "分钟前";
} else {
item.diffTime = S + "秒前";
}
// 服务费
// console.log(item);
if (item.returnFeeType) {
item.returnFee = item.returnFee / 100
if (item.returnFeeType === 0) {
item.servetype = `${item.returnFee || "--"}元/小时`;
} else if (item.returnFeeType === 1) {
item.servetype = `${item.returnFee || "--"}元/日`;
} else if (item.returnFeeType === 2) {
item.servetype = `${item.returnFee || "--"}元/月`;
} else if (item.returnFeeType === 3) {
item.servetype = `${item.returnFee || "--"}元/次`;
} else if (item.returnFeeType === 4) {
item.servetype = `${item.returnFee || "--"}元/件`;
} else if (item.returnFeeType === 5) {
item.servetype = `工人收入${item.returnFee || "--"}%`;
} else if (item.returnFeeType === 6) {
item.servetype = `共${item.returnFee || "--"}元`;
} else if (item.returnFeeType === 7) {
item.servetype = `费用待定`;
}
// console.log(item);
// item["returnFee"] = item.returnFee / 100;
} else {
item.servetype = `${item.returnFee/100 || "--"}元/小时`;
}
//时薪
// var hourlyPayStr = "";
// var hasHourlyPay = false;
// if (isNotEmptyCheck(item.hourlyPay)) {
// hourlyPayStr = item.hourlyPay + "元/小时";
// hasHourlyPay = true;
// } else if (isNotEmptyCheck(item.dayPay)) {
// hourlyPayStr = item.dayPay + "元/日";
// hasHourlyPay = true;
// } else {
// if (
// isNotEmptyCheck(item.minMonthlyPay) &&
// isNotEmptyCheck(item.maxMonthlyPay)
// ) {
// if (item.minMonthlyPay == item.maxMonthlyPay) {
// hourlyPayStr = item.minMonthlyPay;
// } else {
// hourlyPayStr = item.minMonthlyPay + "-" + item.maxMonthlyPay;
// }
// } else if (isNotEmptyCheck(item.minMonthlyPay)) {
// hourlyPayStr = item.minMonthlyPay;
// } else if (isNotEmptyCheck(item.maxMonthlyPay)) {
// hourlyPayStr = item.maxMonthlyPay;
// }
// }
// item["hourlyPay"] = hourlyPayStr;
//月薪
// var monthlyPayStr = "";
// if (hasHourlyPay) {
// if (
// isNotEmptyCheck(item.minMonthlyPay) &&
// isNotEmptyCheck(item.maxMonthlyPay)
// ) {
// if (item.minMonthlyPay == item.maxMonthlyPay) {
// monthlyPayStr = item.minMonthlyPay;
// } else {
// monthlyPayStr = item.minMonthlyPay + "-" + item.maxMonthlyPay;
// }
// } else if (isNotEmptyCheck(item.minMonthlyPay)) {
// monthlyPayStr = item.minMonthlyPay;
// } else if (isNotEmptyCheck(item.maxMonthlyPay)) {
// monthlyPayStr = item.maxMonthlyPay;
// }
// }
// item["monthlyPay"] = monthlyPayStr;
//地址深圳丨龙岗区丨
var districtStr = "";
if (isNotEmptyCheck(item.district)) {
// console.log(item.district);
var districtArr = item.district.split(",");
var districtArr1 = [];
// console.log(districtArr);
districtArr.forEach((item1) => {
if (item1.length != 0) {
item1 = item1 + "丨";
districtArr1.push(item1);
}
});
if (districtArr.length < 3) {
districtStr = districtArr1[districtArr1.length - 1];
} else {
districtStr = districtArr1.join("");
}
if (item.district.indexOf("undefined") > -1) {
districtStr = "-丨";
}
//districtStr = districtArr[1] + '丨' + districtArr[2];
}
item["district"] = districtStr;
//职位特色
item["jobRequestLabelNames"] = getJobSpecialLabelNamesArray(item.jobRequestLabelNames);
item["jobSpecialLabelNames"] = getJobSpecialLabelNamesArray(item.jobSpecialLabelNames);
// 特色标签
// console.log(item.jobSpecialLabelNames);
const jobSpecialLabelNames = [];
if (isNotEmptyCheck(item.jobSpecialLabelNames) && Array.isArray(item.jobSpecialLabelNames)) {
item.jobSpecialLabelNames.forEach((item, index) => {
if (index <= 2) {
jobSpecialLabelNames.push(item);
// console.log(jobSpecialLabelNames);
} else {
return;
}
});
item.jobSpecialLabelNames = jobSpecialLabelNames;
}
// 年龄限制
if (Boolean(item.minAgeWoman) === true && Boolean(item.minAgeMan) === false) {
item.gender = "女丨";
} else if (Boolean(item.minAgeWoman) === false && Boolean(item.minAgeMan) === true) {
item.gender = "男丨";
} else {
item.gender = "男女不限丨";
}
});
} else {
console.log('jobList',jobList);
jobList["workType"] = getWorkTypeById(jobList.workTypeMulti);
if (isNotEmptyCheck(jobList.distance)) {
jobList["distanceKm"] = getDistanceName(jobList.distance);
}
if (isNotEmptyCheck(jobList.jobDesp)) {
jobList["jobDesp"] = jobList["jobDesp"].replaceAll("*****", "");
}
//年龄
var ageStr = "";
if (isNotEmptyCheck(jobList.minAge) && isNotEmptyCheck(jobList.maxAge)) {
ageStr = jobList.minAge + "-" + jobList.maxAge + "岁";
} else if (isNotEmptyCheck(jobList.minAge)) {
ageStr = jobList.minAge + "岁以上";
} else if (isNotEmptyCheck(jobList.maxAge)) {
ageStr = jobList.maxAge + "岁以下";
}
jobList["age"] = ageStr;
//时薪
// var hourlyPayStr = "";
// var hasHourlyPay = false;
// if (isNotEmptyCheck(jobList.hourlyPay)) {
// hourlyPayStr = jobList.hourlyPay + "元/小时";
// hasHourlyPay = true;
// } else if (isNotEmptyCheck(jobList.dayPay)) {
// hourlyPayStr = jobList.dayPay + "元/日";
// hasHourlyPay = true;
// } else {
// if (
// isNotEmptyCheck(jobList.minMonthlyPay) &&
// isNotEmptyCheck(jobList.maxMonthlyPay)
// ) {
// if (jobList.minMonthlyPay == jobList.maxMonthlyPay) {
// hourlyPayStr = jobList.minMonthlyPay;
// } else {
// hourlyPayStr = jobList.minMonthlyPay + "-" + jobList.maxMonthlyPay;
// }
// } else if (isNotEmptyCheck(jobList.minMonthlyPay)) {
// hourlyPayStr = jobList.minMonthlyPay;
// } else if (isNotEmptyCheck(jobList.maxMonthlyPay)) {
// hourlyPayStr = jobList.maxMonthlyPay;
// }
// }
// jobList["hourlyPay"] = hourlyPayStr;
//月薪
// var monthlyPayStr = "";
// if (hasHourlyPay) {
// if (
// isNotEmptyCheck(jobList.minMonthlyPay) &&
// isNotEmptyCheck(jobList.maxMonthlyPay)
// ) {
// if (jobList.minMonthlyPay == jobList.maxMonthlyPay) {
// monthlyPayStr = jobList.minMonthlyPay;
// } else {
// monthlyPayStr = jobList.minMonthlyPay + "-" + jobList.maxMonthlyPay;
// }
// } else if (isNotEmptyCheck(jobList.minMonthlyPay)) {
// monthlyPayStr = jobList.minMonthlyPay;
// } else if (isNotEmptyCheck(jobList.maxMonthlyPay)) {
// monthlyPayStr = jobList.maxMonthlyPay;
// }
// }
// jobList["monthlyPay"] = monthlyPayStr;
//服务费
// console.log(item);
if (jobList.returnFeeType) {
jobList.returnFee = jobList.returnFee / 100
if (jobList.returnFeeType === 0) {
jobList.servetype = `${jobList.returnFee || "--"}元/小时`;
} else if (jobList.returnFeeType === 1) {
jobList.servetype = `${jobList.returnFee || "--"}元/日`;
} else if (jobList.returnFeeType === 2) {
jobList.servetype = `${jobList.returnFee || "--"}元/月`;
} else if (jobList.returnFeeType === 3) {
jobList.servetype = `${jobList.returnFee || "--"}元/次`;
} else if (jobList.returnFeeType === 4) {
jobList.servetype = `${jobList.returnFee || "--"}元/件`;
} else if (jobList.returnFeeType === 5) {
jobList.servetype = `工人收入${jobList.returnFee || "--"}%`;
} else if (jobList.returnFeeType === 6) {
jobList.servetype = `共${jobList.returnFee || "--"}元`;
} else if (jobList.returnFeeType === 7) {
jobList.servetype = `费用待定`;
}
} else {
jobList.servetype = `${jobList.returnFee/100 || "--"}元/小时`;
}
// if (jobList.returnFeeType || jobList.returnFeeType === 0) {
// if (jobList.returnFeeType === 0) {
// jobList.servetype = "元/小时";
// } else if (jobList.returnFeeType === 1) {
// jobList.servetype = "元/日";
// } else if (jobList.returnFeeType === 2) {
// jobList.servetype = "元/月";
// } else if (jobList.returnFeeType === 3) {
// jobList.servetype = "元/次";
// }
// // console.log(jobList);
// // jobList["returnFee"] = jobList.returnFee / 100;
// } else {
// jobList.servetype = "元/小时";
// }
//地址深圳丨龙岗区丨
var districtStr = "";
if (isNotEmptyCheck(jobList.district)) {
var districtArr = jobList.district.split(",");
var districtArr1 = [];
// console.log(districtArr);
districtArr.forEach((item1) => {
if (item1.length != 0) {
item1 = item1 + "丨";
districtArr1.push(item1);
}
});
if (districtArr.length < 3) {
districtStr = districtArr1[districtArr1.length - 1];
} else {
// districtStr = districtArr[1] + "丨" + districtArr[2];
districtStr = districtArr1.join("");
}
if (jobList.district.indexOf("undefined") > -1) {
districtStr = "-丨";
}
//districtStr = districtArr[1] + '丨' + districtArr[2];
}
jobList["district"] = districtStr;
//职位特色
jobList["jobRequestLabelNames"] = getJobSpecialLabelNamesArray(jobList.jobRequestLabelNames);
jobList["jobSpecialLabelNames"] = getJobSpecialLabelNamesArray(jobList.jobSpecialLabelNames);
// console.log(jobList.jobSpecialLabelNames);
// 特色标签
// console.log(jobList.jobSpecialLabelNames);
const jobSpecialLabelNames = [];
if (isNotEmptyCheck(jobList.jobSpecialLabelNames) && Array.isArray(jobList.jobSpecialLabelNames)) {
jobList.jobSpecialLabelNames.forEach((item, index) => {
if (index <= 4) {
jobSpecialLabelNames.push(item);
// console.log(jobSpecialLabelNames);
} else {
return;
}
});
jobList.jobSpecialLabelNames = jobSpecialLabelNames;
}
// 年龄限制
// console.log(jobList);
// console.log(jobList["gender"]);
if (Boolean(jobList.minAgeWoman) === true && Boolean(jobList.minAgeMan) === false) {
jobList.gender = "女丨";
} else if (Boolean(jobList.minAgeWoman) === false && Boolean(jobList.minAgeMan) === true) {
jobList.gender = "男丨";
} else {
jobList.gender = "男女不限丨";
}
// if (jobList["gender"] === 1) {
// jobList["gender"] = "丨男";
// } else if (jobList["gender"] === 2) {
// jobList["gender"] = "丨女";
// } else if (jobList["gender"] === 3) {
// jobList["gender"] = "丨男女不限";
// } else {
// jobList["gender"] = "丨男女不限";
// }
}
}
return jobList;
}
/**
* 根据薪资类型和薪资值获取薪资展示
*/
export function getSalaryClassifyValue (salaryClassify, salaryClassifyValue) {
var hourlyPay = moneyToFixed(salaryClassifyValue);
if (salaryClassify == 0) {
return `${hourlyPay}元/小时`;
} else if (salaryClassify == 1) {
return `${hourlyPay}元/天`;
} else if (salaryClassify == 2) {
return `补${hourlyPay}元`;
} else if (salaryClassify == 3) {
return `返${hourlyPay}元`;
} else if (salaryClassify == 4) {
return "计件";
} else if (salaryClassify == 5) {
return `保底${hourlyPay}元`;
} else if (salaryClassify == 6) {
return `面议`;
} else if (salaryClassify == 7) {
// return '请配置薪资';
return `月薪`;
} else {
return "-";
}
}
/**
* 根据薪资类型和薪资值获取薪资展示
*/
export function getSalaryClassifyValueText (salaryClassify, salaryClassifyValue) {
var hourlyPay = moneyToFixed(salaryClassifyValue);
if (salaryClassify == 0) {
return `${hourlyPay}元/小时`;
} else if (salaryClassify == 1) {
return `${hourlyPay}元/天`;
} else if (salaryClassify == 2) {
return `补${hourlyPay}元`;
} else if (salaryClassify == 3) {
return `返${hourlyPay}元`;
} else if (salaryClassify == 4) {
return "计件";
} else if (salaryClassify == 5) {
return `保底${hourlyPay}元`;
} else if (salaryClassify == 6) {
return `面议`;
} else if (salaryClassify == 7) {
// return '请配置薪资';
return `月薪`;
} else {
return "-";
}
}
// 通过身份证获取信息
export function getAgeFromBirthday (bir) {
if (isEmptyCheck(bir)) {
return "";
}
var infoObj = { age: "", gender: "" };
var birth = bir.substr(6, 8);
var age = bir.substr(16, 1);
// console.log(age);
// console.log(birth);
if (age % 2 == 0) {
infoObj.gender = "2";
} else {
infoObj.gender = "1";
}
// console.log(bir);
var returnAge;
// var strBirthdayArr = bir.split("-");
// if (strBirthdayArr.length == 1) {
// var d = new Date();
// var nowYear = d.getFullYear();
// return nowYear - strBirthdayArr[0] + 1;
// }
var birthYear = birth.substr(0, 4);
var birthMonth = birth.substr(4, 2);
var birthDay = birth.substr(6, 2);
var d = new Date();
var nowYear = d.getFullYear();
var nowMonth = d.getMonth() + 1;
var nowDay = d.getDate();
if (nowYear == birthYear) {
returnAge = 0; //同年 则为0岁
} else {
var ageDiff = nowYear - birthYear; //年之差
if (ageDiff > 0) {
if (nowMonth == birthMonth) {
var dayDiff = nowDay - birthDay; //日之差
if (dayDiff < 0) {
returnAge = ageDiff - 1;
} else {
returnAge = ageDiff;
}
} else {
var monthDiff = nowMonth - birthMonth; //月之差
if (monthDiff < 0) {
returnAge = ageDiff - 1;
} else {
returnAge = ageDiff;
}
}
} else {
returnAge = -1; //返回-1 表示出生日期输入错误 晚于今天
}
}
infoObj.age = returnAge;
return infoObj; //返回周岁年龄
}
/**
* 代理成员角色类型
*/
export function agencyRoleTypeArray () {
let workTypeArray = [
{ id: 7261, name: "创建人", value: 7261, text: "创建人", checked: false },
{ id: 7262, name: "管理员", value: 7262, text: "管理员", checked: false },
{ id: 7263, name: "成员", value: 7263, text: "成员", checked: false },
];
return workTypeArray;
}
/**
* 根据代理成员角色ID获取名称
*/
export function getAgencyRoleTypeById (id) {
let str = "";
let array = agencyRoleTypeArray();
array.forEach((item) => {
if (item.id == id) {
str = item.name;
}
});
return str;
}
/**
* 全拷贝
*
*
*/
export function fullCopy (data) {
return JSON.parse(JSON.stringify(data))
}
/**
* table最小宽度优化
*
*
*/
export function tableWidth (_context, columns, widthNum) {
let num = 0;
console.log(columns);
for (var i = 0; i < columns.length; i++) {
if (typeof (columns[i].width) == "undefined") {
num += widthNum
console.log(widthNum);
} else {
num += columns[i].width
}
}
console.log(num);
_context.currWidth = num;
console.log(_context.currWidth + "==============表宽")
}
/**
* 代理成员权限
*/
export function agencyPermissionArray () {
//查看职位、报名、查看报名、查看老乡、修改密码、修改手机号、新增成员、修改成员信息、删除成员
let workTypeArray = [
{
id: 1,
name: "查看职位",
value: "job:list",
text: "查看职位",
checked: false,
},
{ id: 2, name: "报名", value: "apply:add", text: "报名", checked: false },
{
id: 3,
name: "查看报名",
value: "apply:list",
text: "查看报名",
checked: false,
},
{
id: 4,
name: "查看老乡",
value: "apply:user",
text: "查看老乡",
checked: false,
},
{
id: 5,
name: "修改密码",
value: "user:pwd",
text: "修改密码",
checked: false,
},
{
id: 6,
name: "修改手机号",
value: "user:tel",
text: "修改手机号",
checked: false,
},
{
id: 7,
name: "新增成员",
value: "user:add",
text: "新增成员",
checked: false,
},
{
id: 8,
name: "修改成员信息",
value: "user:update",
text: "修改成员信息",
checked: false,
},
{
id: 9,
name: "删除成员",
value: "user:del",
text: "删除成员",
checked: false,
},
];
return workTypeArray;
}
/**
* 根据代理权限ID获取名称
*/
export function getAgencyPermissionNameById (permissionStr) {
// let str = "";
let array = agencyPermissionArray();
let names = [];
let permissions = permissionStr.split(",");
array.forEach((item) => {
if (permissions.indexOf(item.value) >= 0) {
names.push(item.name);
}
});
return names.join(",");
}
/**
* 根据代理角色获取权限
*/
export function getAgencyPermissionsByRole (role) {
if (role == 1) {
return "job:list,apply:add,apply:list,apply:user,user:pwd,user:tel,user:add,user:update,user:del";
} else {
return "job:list,apply:add,apply:list,apply:user,user:pwd,user:tel";
}
}
/**
* 获取当前时间
*/
export function getDateYMD () {
// 开始时间
let date = new Date();
let prevYear = date.getFullYear();
let prevMonth = date.getMonth() + 1;
let prevDay = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
return prevYear + "-" + (prevMonth >= 10 ? prevMonth : "0" + prevMonth) + "-" + prevDay;
}
/*
处理详情地址
*/
export function setJobInfoPosition (pos) {
let city = [];
let citys = [];
if (isNotEmptyCheck(pos)) {
city = pos.split(",");
}
city.forEach((i) => {
if (isNotEmptyCheck(i)) {
citys.push(i);
}
});
citys = citys.join(",").replace(/,/g, " | ");
return citys ;
}