var STATE_CODE_SUCCESS = 1000;//成功 var STATE_CODE_FAIL = 1001;//失败 var STATE_CODE_INFO_NOT_COMPLETE = 1020;//信息不完整 var STATE_CODE_NOT_LOGIN = 1037;//系统用户没有登录 var UTILS = {}; //处理返回非空数据 UTILS.processEmptyData = function (data) { return (data === undefined || data === null) ? "" : data; }; UTILS.isArray = function (val) { return Object.prototype.toString.call(val) === '[object Array]'; }; UTILS.isString = function (val) { return Object.prototype.toString.call(val) === '[object String]'; }; // post请求时,format数据 UTILS.dealPostDataWithAxios = function (data, returnParam, parentString) { if (UTILS.isArray(data)) { data.forEach(function(item, index) { UTILS.dealPostDataWithAxios(item, returnParam, parentString + '[' + index + ']'); }); } else if (Object.prototype.toString.call(data) === '[object Object]') { Object.keys(data).forEach(function (key) { UTILS.dealPostDataWithAxios(data[key], returnParam, parentString ? parentString + '[' + key + ']' : key) }) } else { returnParam.append(parentString, data === undefined || data === null ? '' : data); } }; // 页面storage缓存 UTILS.setStorage = function (name, value) { localStorage && localStorage.setItem(name, value); }; UTILS.getStorage = function (name) { return localStorage ? localStorage.getItem(name) : ""; }; UTILS.removeStorage = function (name) { localStorage && localStorage.removeItem(name); }; /** * * @param _self this * @param actions * action : * { * type: 'Button', * props: {type: 'primary', icon: 'click'}, * action: function(){}, * params: {}, * style: {}, * name: '点击' * } */ UTILS.createTableActions = function (_self, actions) { if(!actions) return; var createElement = _self.$createElement; if (!UTILS.isArray(actions)) { actions = [actions]; } var children = actions.map(function (action) { var type = action.type || 'a-button'; action.params = action.params || {}; action.params.props = action.props || {}; action.params.attrs = action.attrs || {}; action.params.style = action.style || {}; action.params.class = action.class || {}; action.params.on = action.params.on || {}; if(action.action){ action.params.on.click = action.action; } if(action.tooltip){ return createElement('a-tooltip', { props: {title: action.tooltip, transfer: true, overlayStyle: {'white-space': 'pre-wrap'}} }, [ createElement(type, action.params, action.name) ]); }else{ return createElement(type, action.params, action.name); } }); return createElement('div', {'class': 'table-actions-wrapper'}, children); }; // 高度集成显示列表图片 UTILS.createTableWithImage = function (createElement, src) { var arr = []; if(src){ if(UTILS.isArray(src)){ src.forEach(function (url) { arr.push({ type: "img", style: { cursor: "pointer", marginRight:'5px', marginBottom:'5px', width: "30px", height: "30px" }, attrs: { src: url }, action: function () { UTILS.openImage(url); } }); }) }else{ arr.push({ type: "img", style: { cursor: "pointer", width: "30px", height: "30px" }, attrs: { src: src }, action: function (elem) { UTILS.openImage(src); } }); } } return arr.length ? UTILS.createTableActions(createElement, arr) : ""; }; window.openImageTimeout = ""; UTILS.openImage = function (url) { if(!document.getElementById('open_image_viewer')){ var img = document.createElement('img'); img.id = 'open_image_viewer'; img.style.display = 'none'; img.style.src = ''; document.body.appendChild(img); } window.vi = new Viewer(document.getElementById('open_image_viewer'), { title: false, navbar: false, url: function () { return url; }, hidden: function () { vi && vi.destroy(); }, view: function (elem) { if(elem && elem.detail && elem.detail.image){ if(window.openImageTimeout){ clearTimeout(window.openImageTimeout); } //5秒后如果图片还打不开,就提示出错 window.openImageTimeout = setTimeout(function () { !vi.destroyed && elem.detail.image.classList.length === 0 && Vue.prototype.$error({ title: '图片请求不成功', content: '请重新刷新页面或更新数据', zIndex: 999999 }); }, 5000); } }, }); vi && vi.show(); }; UTILS.initImageByDom = function (dom, config) { if(!dom){return;} new Viewer(dom, Object.assign({ title: false, }, config || {})); }; UTILS.toggleFullScreen = function(currentSignal) { if (!currentSignal) { var el = document.documentElement; if (el.requestFullscreen) { el.requestFullscreen(); } else if (el.mozRequestFullScreen) { el.mozRequestFullScreen(); } else if (el.webkitRequestFullscreen) { el.webkitRequestFullscreen(); } else if (el.msRequestFullscreen) { el.msRequestFullscreen(); } currentSignal = true; } else if(document){ if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.msExitFullscreen) { document.msExitFullscreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); } else if (document.webkitExitFullScreen) { document.webkitExitFullScreen(); } currentSignal = false; } return currentSignal; } // 处理提交的数据 UTILS.formFormat = function (form) { //必须先 Copy form, 否则会改变 vm model 里的引用值而导致出错 var newForm = UTILS.deepCopy(form); var _replace = function (obj) { for (var key in obj) { //moment处理 if(typeof moment != 'undefined' && moment.isMoment(obj[key])){ obj[key] = obj[key].unix(); continue; } //日期处理 if (Object.prototype.toString.call(obj[key]) === '[object Date]') { obj[key] = parseInt(obj[key].getTime() / 1000); continue; } //布尔值处理 if (Object.prototype.toString.call(obj[key]) === '[object Boolean]') { obj[key] = obj[key] ? 1 : 0; continue; } //单个附件处理 if(Object.prototype.toString.call(obj[key]) === '[object Object]' && typeof obj[key].short_url !== 'undefined'){ obj[key] = obj[key].short_url; continue; } //数组处理 if (UTILS.isArray(obj[key])) { var isUploader = false; for (var index in obj[key]) { if (Object.prototype.toString.call(obj[key][index]) === '[object Object]') { if(typeof obj[key][index].short_url !== 'undefined'){ isUploader = true; break; }else{ _replace(obj[key][index]) } } } //多个附件处理 if(isUploader){ obj[key] = obj[key].map(function (item) { return item.short_url; }).join('$$$'); } } } }; _replace(newForm); return newForm; }; // 处理返回的数据 UTILS.processReturnFormData = function (form) { //必须先 Copy form, 否则会改变 vm model 里的引用值而导致出错 var newForm = Object.assign({}, form); var _replace = function (obj) { for (var key in obj) { if(key && key.indexOf("_three_code") >= 0){ //地区代码 obj[key.replace("_three_code", "")] = (obj[key] && obj[key].length) ? obj[key].map(function (item) { return item.code+""; }) : []; }else if (UTILS.isArray(obj[key])) { for (var index in obj[key]) { if (Object.prototype.toString.call(obj[key][index]) === '[object Object]') { _replace(obj[key][index]) } } }else{ obj[key] = UTILS.processEmptyData(obj[key]); } } }; _replace(newForm); return newForm; }; // 深度复制object数据 UTILS.deepCopy = function (p, c) { c = c || (UTILS.isArray(p) ? [] : {}); for (var i in p) { if (typeof p[i] === 'object') { if (p[i] === null) { c[i] = null; } else if(Object.prototype.toString.call(p[i]) === '[object Date]') { c[i] = new Date(p[i].getTime()); } else { c[i] = (p[i].constructor === Array) ? [] : {}; UTILS.deepCopy(p[i], c[i]); } } else { c[i] = p[i]; } } return c; }; UTILS.dateFormatType = function(time, special){ if (!time || time === "0") { return ''; } if(typeof moment !== 'undefined'){ if ((/^\d+$/.test(time) || /^\-\d+$/.test(time)) && (time + '').length <= 10) { time = parseInt(time + '000'); } return new Date( special ? moment(time, special) : moment(time) ); } }; UTILS.dateFormatMoment = function(time, special){ if (!time || time === "0") { return ''; } if(typeof moment !== 'undefined'){ if ((/^\d+$/.test(time) || /^\-\d+$/.test(time)) && (time + '').length <= 10) { time = parseInt(time + '000'); } return special ? moment(time, special) : moment(time) ; } }; // 格式化日期 UTILS.dateFormat = function (time, format) { if (!time || time === "0") { return ''; } if(typeof moment !== 'undefined'){ if ((/^\d+$/.test(time) || /^\-\d+$/.test(time)) && (time + '').length <= 10) { time = parseInt(time + '000'); } return moment(time).format(format || 'YYYY-MM-DD HH:mm'); }else{ var date = undefined; if (Object.prototype.toString.call(time) === '[object Date]') { date = time; } else if (/^\d+$/.test(time) && (time + '').length <= 10) { date = new Date(parseInt(time + '000')); } else { date = new Date(); } format = format || 'Y-M-D H:m'; format = format.replace('Y', date.getFullYear()); format = format.replace('M', date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1); format = format.replace('D', date.getDate() < 10 ? '0' + date.getDate() : date.getDate()); format = format.replace('H', date.getHours() < 10 ? '0' + date.getHours() : date.getHours()); format = format.replace('m', date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()); format = format.replace('s', date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()); return format; } }; UTILS.dateFormatGetTime = function(d){ if(!d){ return ''; } if(typeof moment !== 'undefined'){ if ((/^\d+$/.test(d) || /^\-\d+$/.test(d)) && (d + '').length <= 10) { d = parseInt(d + '000'); } return moment(d).unix() || ''; }else{ return parseInt( new Date(d).getTime() / 1000 ) || ''; } }; UTILS.timeFormat = function (time, format) { if (!time) { return ''; } format = format || 'H:m'; var h = parseInt(time / 3600); var m = parseInt((time-h*3600) / 60); var s = time - h*3600 - m*60; format = format.replace('H', h < 10 ? "0"+h : h+""); format = format.replace('m', m < 10 ? "0"+m : m+""); format = format.replace('s', s < 10 ? "0"+s : s+""); return format; }; /** * 处理返回值的参数提醒 * @param status String 返回值的状态码 * @param ops Array 要进行处理的状态码 * @param msg String message * eq: [code, action, code1, action1] */ UTILS.processStatus = function (status, ops, msg) { if(!status){ return; } var json = {}; for (var i = 0; i < ops.length - 1; i = i + 2) { json[ops[i]] = ops[i + 1]; } var predefined = {}; predefined['def'] = "请求失败, 请检查数据并重试"; predefined[STATE_CODE_FAIL] = "请求失败, 请检查数据并重试"; predefined[STATE_CODE_INFO_NOT_COMPLETE] = "请求失败, 请完善数据信息并重试"; var op = json[status]; if (!op) { op = predefined[status]; } if(status == STATE_CODE_SUCCESS){ if (typeof op == 'string') { Vue.prototype.$message.success(op); } else if (typeof op == 'object') { Vue.prototype.$message[op[0]](op[1]) } else if (typeof op == 'function') { op() } }else{ if (!op) { op = json.def || predefined.def; } if (typeof op == 'string') { Vue.prototype.$message.error(msg || op); } else if (typeof op == 'object') { Vue.prototype.$message[op[0]](msg || op[1]) } else if (typeof op == 'function') { op() } } }; //防抖 UTILS.debounce = function(fn, delay, immediate = false) { // 1.定义一个定时器, 保存上一次的定时器 let timer = null let isInvoke = false // 2.真正执行的函数 const _debounce = function(...args) { return new Promise((resolve, reject) => { // 取消上一次的定时器 if (timer) clearTimeout(timer) // 判断是否需要立即执行 if (immediate && !isInvoke) { const result = fn.apply(this, args) resolve(result) isInvoke = true } else { // 延迟执行 timer = setTimeout(() => { // 外部传入的真正要执行的函数, 拿到函数返回值并调用resolve const result = fn.apply(this, args) resolve(result) isInvoke = false timer = null }, delay) } }) } // 封装取消功能 _debounce.cancel = function() { if (timer) clearTimeout(timer) timer = null isInvoke = false } return _debounce } // 格式化url UTILS.parseUrl = function (str, sep, eq) { var trim = String.prototype.trim ? function (str) { return (str == null) ? '' : String.prototype.trim.call(str); } : function (str) { return (str == null) ? '' : str.toString().replace(/^\s+/, '').replace(/\s+$/, ''); }; if (typeof str === 'undefined' && typeof document !== 'undefined') { str = document.location.search } var ret = {}; if (typeof str !== 'string' || trim(str).length === 0) { return ret; } // remove ^? str = str.replace(/^\?/, ''); var pairs = str.split(sep || '&'); eq = eq || '='; var unescape = function (s) { // The + character is interpreted as a space on the server side as well as // generated by forms with spaces in their fields. return decodeURIComponent(s.replace(/\+/g, ' ')); }; var isArray = Array.isArray || function (val) { return Object.prototype.toString.call(val) === '[object Array]'; }; for (var i = 0; i < pairs.length; i++) { var pair = pairs[i].split(eq); var key = unescape(trim(pair[0])); var val = unescape(trim(pair.slice(1).join(eq))); var m = key.match(/^(\w+)\[\]$/); if (m && m[1]) { key = m[1]; } if (Object.prototype.hasOwnProperty.call(ret, key)) { if (!isArray(ret[key])) { ret[key] = [ret[key]]; } ret[key].push(val); } else { ret[key] = m ? [val] : val; } } return ret; }; // 拿下拉选择的列表 UTILS.fetchCommonSelectList = function (type, callback) { axios.get('/web/tool/list_select', {params: {key: type}}).then(function (res) { UTILS.processStatus(res.status, [STATE_CODE_SUCCESS, function () { callback && callback(res.result && res.result.split(",") || []); }]); }); }; UTILS.checkPsw = function(pwd){//检测密码强度是否够 function CharMode(iN){ if (iN>=48 && iN <=57) //数字 return 1; if (iN>=65 && iN <=90) //大写字母 return 2; if (iN>=97 && iN <=122) //小写 return 4; else return 8; //特殊字符 } //bitTotal函数 //计算出当前密码当中一共有多少种模式 function bitTotal(num){ var modes=0; for (var i=0;i<4;i++){ if (num & 1) modes++; num>>>=1; } return modes; } //返回密码的强度级别 function checkStrong(sPW){ if (sPW.length<6) return 0; //密码太短 var Modes=0; for (var i=0;i=3; }; UTILS.messageScheduleTips = function (scheduled_time) { var text = ''; if(scheduled_time[3] != '-'){ text += '每年'+scheduled_time[3]+'月份'; } if(scheduled_time[4] != '-'){ if(!text){ text += '每' } var week = ['一', '二', '三', '四', '五', '六', '日']; text += '星期' + week[scheduled_time[4]-1]; } if(scheduled_time[2] != '-' && scheduled_time[4] == '-'){ if(scheduled_time[3] == '-'){ text += '每个月' } text += scheduled_time[2]+'号'; } if(scheduled_time[1] != '-'){ if(scheduled_time[2] == '-' && scheduled_time[4] == '-'){ text += '每天' } text += scheduled_time[1]+'点'; }else{ text += '每小时' } text += scheduled_time[0]+'分'; return text; }; // 配合iview的form进行返回值错误提示 UTILS.showMsgByFormLabel = function (_this, code, form) { var hasShow = false; _this.$refs[form || "form"].fields.forEach(function (item) { if (item.prop == code) { hasShow = true; Vue.prototype.$message.error("请填写 “" + item.label + "”"); } }); !hasShow && Vue.prototype.$message.error("请填写 “" + code + "”"); }; // 根据iview弹出comfirm窗口 UTILS.confirmModal = function (msg, okFn, loading, cancelFn) { var modal = Vue.prototype.$confirm({ title: '提示', content: msg || "", onOk: function () { okFn && okFn(); if(loading){ modal.update({ okButtonProps: { loading: true } }); return new Promise(function () {}); } }, onCancel: cancelFn || function () { } }); return modal; }; // 编辑完内容后,弹出信息并关闭该页面 UTILS.successModal = function (page, msg, needFresh) { Vue.prototype.$success({ title: '提示', content: msg || "保存成功", onOk: function () { if(page){ UTILS.closeDetail(page, needFresh); } } }); }; UTILS.getObjectURL = function (file) { var url = null; if (window.createObjectURL != undefined) { // basic url = window.createObjectURL(file); } else if (window.URL != undefined) { // mozilla(firefox) url = window.URL.createObjectURL(file); } else if (window.webkitURL != undefined) { // webkit or chrome url = window.webkitURL.createObjectURL(file); } return url; }; UTILS.generateDetail = function (listDom, url) { var container = document.getElementsByClassName('main-wrapper'); if(!container || !container[0]){ return; } container = container[0]; var name = 'dataRemarkDetail'; UTILS[name] = listDom; var detailContainer = document.getElementById(name); if(!detailContainer){ var b = document.createElement('div'); b.id = name; b.className = 'main-content'; detailContainer = container.appendChild(b); } app.loadingTopBar = 1; var inter = setInterval(function () { if(app.loadingTopBar < 98){ app.loadingTopBar += 5; }else{ clearInterval(inter); } },500); Vue.axios.get(PHP.path + "/" + url).then(function (res) { setTimeout(function () { clearInterval(inter); app.loadingTopBar = false; },0); var html = res; var reg = /<\s*script\s*type\s*=\s*["|']\s*text\/javascript\s*["|']\s*>([\s\S]+)<\/script>/g; var matches = reg.exec(html); if (matches) { detailContainer.innerHTML = html.replace(matches[0], ''); if (matches.length > 1 && matches[1].trim().length > 0) { UTILS[name+'Memory'] = new Function(matches[1])(); } } UTILS[name] && UTILS[name].hideContainer(); }).catch(function () { clearInterval(inter); app.loadingTopBar = false; Vue.prototype.$error({ title: '提示', content: "网络出错" }); }); }; UTILS.closeDetail = function (name, needRefresh) { name = 'dataRemarkDetail'; needRefresh && UTILS[name] && UTILS[name].doFetch(); UTILS[name] && UTILS[name].showContainer(); var detailContainer = document.getElementById(name); detailContainer && detailContainer.parentElement.removeChild(detailContainer); UTILS[name+'Memory'] && UTILS[name+'Memory'].$destroy(); }; UTILS.refreshListDom = function () { var name = 'dataRemarkDetail'; UTILS[name] && UTILS[name].doFetch(); }; UTILS.getListDom = function () { var name = 'dataRemarkDetail'; return UTILS[name] || ''; }; UTILS.getItemByKey = function(key, data){ if(!data){return ''} var result = ''; data.map(function (item) { if(item.value === key){ result = item; } }); return result; }; UTILS.getLabelByKey = function(key, data){ if(!data){return ''} var result = ''; data.map(function (item) { if(item.value === key){ result = item.label; } }); return result; }; UTILS.urlEncode = function(param, key, encode) { if (param==null) return ''; var paramStr = ''; var t = typeof (param); if (t == 'string' || t == 'number' || t == 'boolean') { paramStr += '&' + key + '=' + ((encode==null||encode) ? encodeURIComponent(param) : param); } else { for (var i in param) { var k = key == null ? i : key + (param instanceof Array ? '[' + i + ']' : '.' + i); paramStr += UTILS.urlEncode(param[i], k, encode); } } return paramStr; }; /** * 得到一个数组不重复的元素集合 * 唯一化一个数组 * @returns {Array} 由不重复元素构成的数组 **/ UTILS.arrayRemoveRepeat = function(arr){ var ra = []; for(var i = 0; i < arr.length; i ++){ if(ra.indexOf(arr[i]) === -1){ ra.push(arr[i]); } } return ra; }; /** * 删除数组交集数据 * @returns {Array} **/ UTILS.arrayRemoveDiff = function(a, b){ return a.filter(function (item) {return b.indexOf(item) === -1}); }; UTILS.getBaseByKey = function (key, column, table, role, uni_code) { if(!key || !column || !table){ return ''; } var result = ''; if(PD_CONFIG && PD_CONFIG[table] && PD_CONFIG[table][column]){ var col = PD_CONFIG[table][column]; //var key1 = key+"_"+role+"_"+uni_code; //优先拿有角色有学校代码的 //var key2 = key+"_"+role; //次而拿角色 var key3 = key+"_"+uni_code; //再次之拿学校代码 var key4 = key+"_"+(PHP && PHP.special_code); //再次之拿特殊学校代码 /*if(typeof col[key1] !== 'undefined'){ result = col[key1]; }else if(typeof col[key2] !== 'undefined'){ result = col[key2]; }else */if(typeof col[key3] !== 'undefined'){ result = col[key3]; }else if(typeof col[key4] !== 'undefined'){ result = col[key4]; }else if(typeof col[key] !== 'undefined'){ result = col[key]; } } return result; }; UTILS.checkExistInArray = function (data, key) { var signal = false; data && data.forEach(function (item) { if(item.value == key){ signal = true; }else if(item.children && item.children.length > 0){ var childSignal = UTILS.checkExistInArray(item.children, key); if(childSignal){ signal = true; } } }); return signal; }; UTILS.createCodeForNoExist = function (code, name) { if(!code || code.length === 0){ return []; } code = [].concat(code); var obj = { value: code[0], label: name, disabled: true }; if(code.length > 1){ code.shift(); obj.children = UTILS.createCodeForNoExist(code, name); } return [obj]; }; /** * ========== 以下是该项目相关的工具 ========== * */ var color_green = '#19be6b'; var color_blue = '#2db7f5'; var color_yellow = '#F7BA2A'; var color_red = '#ed4014'; var color_orange = '#ff9900'; var color_purple = '#722ed1'; //学生生源信息的状态 UTILS.getStuInfoStateObj = function(data, has_history){ var obj = { 0: { value: '', color: '', label: "初始化" }, 10: { value: '10', color: color_yellow, label: "待院系审核" }, 15: { value: '15', color: color_orange, label: "院系不同意" }, 20: { value: '20', color: color_blue, label: "待学校审核" }, 25: { value: '25', color: color_red, label: "学校不同意" }, 30: { value: '30', color: color_green, label: "学校已审核" }, }; return (data && obj[data.s_state]) || {} ; }; UTILS.getStuInfoStateLabel = function (data) { return UTILS.getStuInfoStateObj(data)['label']; }; //学生锁定状态 UTILS.getStuLockObj = function(data){ var result = { color: color_green, label: '正常' }; if(data == 1){ result.color = color_red; result.label = '已锁定' } return result; }; //预约咨询的状态 UTILS.getBookingStateObj = function(data){ var obj = { 10: { value: '10', color: color_yellow, label: "待老师确定" }, 15: { value: '15', color: color_red, label: "学生已取消" }, 25: { value: '25', color: color_orange, label: "老师因故取消" }, 30: { value: '30', color: color_orange, label: "老师过期未确认" }, 40: { value: '40', color: color_red, label: "学生失约" }, 60: { value: '60', color: color_blue, label: "老师已确认" }, 90: { value: '90', color: color_green, label: "已完成" }, }; var result = (data && obj[data.q_state]) || {} ; if(data.q_state == 60 && data.resulttime != '0'){ result.label = '老师已反馈'; } return result; }; UTILS.getBookingStateLabel = function (data) { return UTILS.getBookingStateObj(data)['label']; }; //项目活动的审核状态(注意:优秀毕业生也有用到) UTILS.getSybProjectStateObj = function(data, is_college){ var result = { color: '', label: '待审核' }; if(!is_college && data.uni_review_time != '0' && data.uni_review){ if(data.uni_review === 'YES'){ result.color = color_green; result.label = '学校审核通过'; }else if(data.uni_review === 'NO'){ result.color = color_red; result.label = '学校审核不通过'; }else if(data.uni_review === 'BACK'){ result.color = color_yellow; result.label = '学校退回'; }else if(data.uni_review === 'RE'){ result.color = color_blue; result.label = '退回已重做,待学校审核'; } }else{ if(data.department_review === 'YES'){ result.color = color_blue; result.label = '院系审核通过'; }else if(data.department_review === 'NO'){ result.color = color_orange; result.label = '院系审核不通过'; }else if(data.department_review === 'BACK'){ result.color = color_yellow; result.label = '院系退回'; }else if(data.department_review === 'RE'){ result.color = color_blue; result.label = '退回已重做,待学院审核'; } } return result; }; UTILS.getSybProjectStateLabel = function (data, is_college) { return UTILS.getSybProjectStateObj(data, is_college)['label']; }; //优秀毕业生 UTILS.getExcellentStateObj = function(data,is_college){ return UTILS.getSybProjectStateObj(data,is_college); }; UTILS.getExcellentStateLabel = function (data,is_college) { return UTILS.getExcellentStateObj(data,is_college)['label']; }; //用人单位审核状态 UTILS.getComStateObj = function(state){ state = state || ''; var obj = { '10': { color: color_orange, label: "待审核", tooltip: '等待学校认证审核的状态', }, '20': { color: color_blue, label: "已邀请", tooltip: '', }, '30': { color: color_green, label: "已入驻", tooltip: '', }, '40': { color: color_yellow, label: "待复审", tooltip: '名称、统一社会信用代码及扫描件、单位详情有异常的,需重新审核', }, '50': { color: color_red, label: "不通过", tooltip: '资料认证不通过的状态', }, '': { color: color_red, label: "未关联", tooltip: '请审核', } }; return obj[state] || {} ; }; UTILS.getComStateLabel = function (data) { return UTILS.getComStateObj(data)['label']; }; //别样的审核状态 UTILS.getOtherStateObj = function(state){ var obj = { '0': { color: color_red, label: "审核不通过" }, '1': { color: color_green, label: "审核通过" }, '2': { color: '', label: "待审核" }, '3': { color: color_blue, label: "待复审" }, }; return obj[state] || {} ; }; UTILS.getOtherStateLabel = function (data) { return UTILS.getOtherStateObj(data)['label']; }; //用人单位预约面试同意状态 UTILS.getComJobsInviteStateObj = function(state){ var obj = { '0': { color: '', label: "学生待处理" }, '1': { color: color_green, label: "学生同意" }, '2': { color: color_red, label: "学生不同意" }, '9': { color: color_yellow, label: "用人单位取消" }, }; return obj[state] || {} ; }; UTILS.getComJobsInviteStateLabel = function (data) { return UTILS.getComJobsInviteStateObj(data)['label']; }; //共同用到YES,NO,RE,BACK的审核 UTILS.getNormalStateObj = function(state){ var obj = { 'NO': { color: color_red, label: "审核不通过" }, 'YES': { color: color_green, label: "审核通过" }, '': { color: '', label: "待审核" }, 'RE': { color: color_blue, label: "待复审" }, 'BACK': { color: color_yellow, label: "退回重做" }, 'MARK': { color: color_orange, label: "已受理" }, }; return obj[state] || {} ; }; UTILS.getNormalStateLabel = function (state) { return UTILS.getNormalStateObj(state)['label']; }; //简历审核状态,宣讲会审核状态 UTILS.getFourStateObj = function(state){ var obj = { '2': { color: color_red, label: "审核不通过" }, '1': { color: color_green, label: "审核通过" }, '0': { color: '', label: "待审核" }, '3': { color: color_blue, label: "待复审" }, }; return obj[state] || {} ; }; UTILS.getFourStateLabel = function (data) { return UTILS.getFourStateObj(data)['label']; }; //就业信息核查 UTILS.getStuJobVerifyOptions = function () { return [ {value: '', color: '', label: '未核实'}, {value: 'IS_TRUE', color: color_green, label: '属实'}, {value: 'NOT_TRUE', color: color_red, label: '不属实'}, {value: 'TRAINEE', color: color_blue, label: '原实习单位'}, {value: 'QUIT', color: color_orange, label: '已离职'}, {value: 'NOT_EMPLOYMENT', color: color_yellow, label: '意向单位未确定录用'}, {value: 'EMPLOYMENT', color: color_blue, label: '确定录用未入职'}, {value: 'OTHER', color: color_orange, label: '其他信息有误'}, ]; }; UTILS.getStuJobVerifyObj = function(status){ if(!status){ status = ''; } var obj = {}; UTILS.getStuJobVerifyOptions().forEach(function (item) { if(item.value === status){ obj = item; } }) return obj; }; UTILS.getStuJobVerifyLabel = function (data) { return UTILS.getStuJobVerifyObj(data)['label']; }; UTILS.getStuJobVerifyFromOptions = function(){ return [ {value: '', label: '未核实'}, {value: 'UNI', label: '就业单位'}, {value: 'STU', label: '毕业生'}, {value: 'FRIENDS', label: '亲友'}, {value: 'OTHER', label: '其他'}, ]; }; //求职创业补贴状态 UTILS.getJobSubsidyStateObj = function(state){ var obj = { '2': { color: color_red, label: "审核不通过" }, '1': { color: color_green, label: "审核通过" }, '0': { color: '', label: "待审核" }, '3': { color: color_blue, label: "已受理" }, '4': { color: color_orange, label: "重新申请" }, }; return obj[state] || {} ; }; UTILS.getJobSubsidyStateLabel = function (data) { return UTILS.getJobSubsidyStateObj(data)['label']; };