Commit aafaec45 by zqm

update: 网关换成云之家的

parent aa0d5d30
This diff could not be displayed because it is too large.
......@@ -19,8 +19,8 @@ const FastClick = require('fastclick');
// shr员工编号字段
const employeenumberField = process.env.PACK_ENV === 'product' ? '5893b734-4537-4036-9f1c-16ff831b64b2' : '72f1d584-bc3d-4616-85d0-4a67c1829d1c';
// shr员工类型: 房开、物业、合诚
var orgTypeField = process.env.PACK_ENV === 'product' ? '20791150-9fbd-4db0-96b7-82d301c6531c' : '2cd7a5eb-371d-4d32-8220-6ebb64a5b214'
var orgTypeField = process.env.PACK_ENV === 'product' ? '20791150-9fbd-4db0-96b7-82d301c6531c' : '2cd7a5eb-371d-4d32-8220-6ebb64a5b214';
const ccAppKey = process.env.PACK_ENV === 'product' ? '781d2ec4' : 'd504275e';
window.topHeight = 115;
......@@ -57,10 +57,13 @@ const tipsModal = document.querySelector('.tips__modal');
const tipsmMdalClose = document.querySelector('.tips__close');
app.ready(() => {
initUser().then(() => {
initUser()
.then(() => {
console.log('111>>');
$mas.token = token;
mount();
}).catch((e) => {
})
.catch((e) => {
if (!configuration.product) {
_uid = configuration.uid;
......@@ -113,7 +116,8 @@ function getUserInfoByOid(oId) {
opt.success = function(result) {
const success = (result || {}).success || false;
const data = (result || {}).data || [];
if (String(success).toLowerCase() !== 'true') {
if (String(success)
.toLowerCase() !== 'true') {
reject(result.error || '获取人员信息失败!');
return;
}
......@@ -122,14 +126,14 @@ function getUserInfoByOid(oId) {
const employeenumberInfo = extra.filter(({ publicid }) => {
return employeenumberField === publicid;
});
var orgTypeInfo = extra.filter(function (item) {
return orgTypeField === item.publicid
})
var orgTypeInfo = extra.filter(function(item) {
return orgTypeField === item.publicid;
});
resolve({
uid: userInfo.username || '',
avatar: userInfo.avatar || '',
employeenumber: (employeenumberInfo[0] || {}).value,
orgType: (orgTypeInfo[0] || {}).value
employeenumber: (employeenumberInfo[ 0 ] || {}).value,
orgType: (orgTypeInfo[ 0 ] || {}).value
});
};
opt.error = function(e) {
......@@ -153,22 +157,23 @@ function getPersonInfosByJobNo(jobNos) {
data: {
jobNos: jobNos.join(',')
}
};
return new Promise(function(resolve, reject) {
opt.success = function(result) {
var success = (result || {}).success || false;
var data = (result || {}).data || [];
if (String(success)
.toLowerCase() !== 'true' || data.length === 0) {
reject(result.error || '获取人员信息失败!');
return;
}
return new Promise(function (resolve, reject) {
opt.success = function (result) {
var success = (result || {}).success || false
var data = (result || {}).data || []
if (String(success).toLowerCase() !== 'true' || data.length === 0) {
reject(result.error || '获取人员信息失败!')
return
}
resolve(result.data)
}
opt.error = function (e) {
reject(e)
}
qing.call('request', opt)
})
resolve(result.data);
};
opt.error = function(e) {
reject(e);
};
qing.call('request', opt);
});
}
......@@ -177,21 +182,21 @@ async function initUser() {
let openId = getUrlParamVal('openId');
const jobNo = getUrlParamVal('uid');
if (jobNo) {
let isOK = false
let isOK = false;
try {
const [ personInfo = {} ] = await getPersonInfosByJobNo([jobNo])
const [personInfo = {}] = await getPersonInfosByJobNo([jobNo]);
if (personInfo.oId) {
openId = personInfo.oId
isOK = true
openId = personInfo.oId;
isOK = true;
} else {
isOK = false
isOK = false;
}
} catch (e) {
isOK = false
isOK = false;
}
if (!isOK) {
alert('应用启动发生错误,请联系开发人员')
return
alert('应用启动发生错误,请联系开发人员');
return;
}
}
const isFromPersonDetail = 'persondetail' === getUrlParamVal('source');
......@@ -203,7 +208,7 @@ async function initUser() {
if (user.orgType) {
user.extra = {
orgType: user.orgType
}
};
}
// user 查看者
// viewee 被查看者
......@@ -223,7 +228,7 @@ async function initUser() {
if (viewee.orgType) {
extra.extra = {
orgType: viewee.orgType
}
};
}
userid = isFromPersonDetail ? extra.employeenumber : user.employeenumber;
_uid = isFromPersonDetail ? extra.uid : user.uid;
......@@ -232,7 +237,12 @@ async function initUser() {
alert('应用启动发生错误,请联系开发人员');
}
token = user.ssoToken;
appKey = extra.appkey || configuration.appkey;
console.log('extra>>', extra);
console.log('configuration>>', configuration);
console.log('ccAppKey>>', ccAppKey);
appKey = extra.appkey || configuration.appkey || ccAppKey;
console.log('appKey>>', appKey);
/* old-code
let orgType;
if (!extra.extra) {
......@@ -243,10 +253,11 @@ async function initUser() {
eval('(' + user.extra + ')').orgType;
}
*/
const _extra = extra.extra || user.extra || {}
const orgType = '' + _extra.orgType
const _extra = extra.extra || user.extra || {};
orgType = '' + _extra.orgType;
// 2024-08-08 黄延龄反馈:1是房开 2是物业 合诚待定
// 将物业(原来是6)调整为2,原来是2的怡家园调整为6
switch (orgType) {
// 房产
case '1':
......@@ -278,7 +289,7 @@ async function initUser() {
url = configuration.methods.wyResume;
break;
// 合诚
case '7':
case '4':
$mas.config({
baseUrl: configuration.baseUrl,
code: configuration.hcCode
......@@ -289,9 +300,9 @@ async function initUser() {
// alert('权限不足,无法查看简历');
// app.exit();
showToast('暂无数据,请联系管理员');
setTimeout(() => {
app.exit();
}, 2000);
// setTimeout(() => {
// app.exit();
// }, 2000);
}
})
.catch(e => {
......@@ -357,6 +368,11 @@ function mount() {
tipsModal.onclick = function() {
tipsModal.style.display = 'none';
};
console.log('开始获取>>', url, {
loginuserid,
userid,
appKey
});
$mas.restful(url, {
loginuserid,
userid,
......@@ -365,11 +381,13 @@ function mount() {
.then(({
data
}) => {
console.log('restful>>', url, data);
console.log('获取成功>>', url, data);
render(data);
return data;
})
.catch(e => {
console.log('获取失败>>', e);
});
// 获取头像
renderPhoto();
......@@ -397,8 +415,8 @@ function scrollBehavior() {
let scale = (window.topHeight - this.scrollTop) / window.topHeight;
scale = scale > 1 ? 1 : scale;
let value = `scale(${scale}) translateZ(0)`;
photo.style['transform'] = value;
photo.style['-webkit-transform'] = value;
photo.style[ 'transform' ] = value;
photo.style[ '-webkit-transform' ] = value;
}
if (this.scrollTop > window.topHeight) {
header.classList.add('show');
......@@ -410,7 +428,7 @@ function scrollBehavior() {
function openPhoto() {
if (!items.length) return;
var pswpElement = document.querySelectorAll('.pswp')[0];
var pswpElement = document.querySelectorAll('.pswp')[ 0 ];
// define options (if needed)
var options = {
......@@ -461,13 +479,13 @@ function render(data) {
rewardPunishVoList: configuration.renderItem.rewardPunishVoList
};
for (let r in RENDER_ITEM) {
if (data[r]) {
if (data[ r ]) {
//物业是用新的绩效
let dataArr = filterData(r, data[r],true);
let dataArr = filterData(r, data[ r ], true);
if (!dataArr) {
continue;
}
propertyRenderer(RENDER_ITEM[r], dataArr);
propertyRenderer(RENDER_ITEM[ r ], dataArr);
}
}
break;
......@@ -482,12 +500,12 @@ function render(data) {
};
for (let r in RENDER_ITEM) {
if (data[r]) {
let dataArr = filterData(r, data[r],true);
if (data[ r ]) {
let dataArr = filterData(r, data[ r ], true);
if (!dataArr) {
continue;
}
propertyRenderer(RENDER_ITEM[r], dataArr);
propertyRenderer(RENDER_ITEM[ r ], dataArr);
}
}
break;
......@@ -516,7 +534,7 @@ function render(data) {
console.log('房开人员', RENDER_ITEM);
// // showToast('房开人员');
for (let r in RENDER_ITEM) {
if (data[r]) {
if (data[ r ]) {
//新版绩效
// let dataArr = data[r];
// if (r == 'assessVoList') {
......@@ -532,13 +550,12 @@ function render(data) {
// }
// }
//旧版绩效
console.log('旧版绩效 data[r]>>', data[r]);
let dataArr = filterData(r, data[r],false);
let dataArr = filterData(r, data[ r ], false);
if (!dataArr) {
continue;
}
renderer(RENDER_ITEM[r], dataArr);
renderer(RENDER_ITEM[ r ], dataArr);
}
}
// for (let r in RENDER_ITEM) {
......@@ -704,21 +721,21 @@ function listARenderer(list, data, extra = '') {
for (let name in list) {
let value;
let title;
if (list[name] instanceof Object) {
if (list[ name ] instanceof Object) {
if (name.indexOf('&') !== -1) {
let names = name.split('&');
title = `${data[names[0]] || '未知'}-${
data[names[1]] || '未知'
title = `${data[ names[ 0 ] ] || '未知'}-${
data[ names[ 1 ] ] || '未知'
}`;
} else {
title = data[name];
title = data[ name ];
}
let t1 = data[list[name][0]];
let t2 = data[list[name][1]];
let t1 = data[ list[ name ][ 0 ] ];
let t2 = data[ list[ name ][ 1 ] ];
value = `${t1}${nowOrNot(t2)}`;
} else {
title = list[name];
value = data[name];
title = list[ name ];
value = data[ name ];
}
temp.innerHTML += itemRenderer(title || '未知', value || '无', 'light');
}
......@@ -734,16 +751,16 @@ function listBRenderer(list, data) {
if (list.subTitle) {
list.subTitle.forEach((s, i) => {
sub += (i && '|') || '';
sub += item[s] || '无';
sub += item[ s ] || '无';
});
}
if (note instanceof Object && note.length) {
let t1 = data[index][list.note[0]];
let t2 = data[index][list.note[1]];
let t1 = data[ index ][ list.note[ 0 ] ];
let t2 = data[ index ][ list.note[ 1 ] ];
//temp += itemRenderer(item[list[0]], item[list[1]], index > 2 && 'hide')
temp +=
`<div class='item_main'><div class='item__content work'>${
item[list.title] || '无'
item[ list.title ] || '无'
}</div>` +
itemRenderer(
`<p class='item__content-sub-title'>${sub}</p>`,
......@@ -755,9 +772,9 @@ function listBRenderer(list, data) {
} else {
temp += itemRenderer(
`${
item[list.title]
item[ list.title ]
}<p class='item__content-sub-title'>${sub}</p>`,
`<p class='item__content-note'>${item[note]}</p>`
`<p class='item__content-note'>${item[ note ]}</p>`
);
}
});
......@@ -778,29 +795,29 @@ function listCRenderer(list, data) {
switch (i) {
case 1:
sub += (i && ' | ') || '';
if (item[s] === '无' || !item[s]) {
item[s] = '无学历';
if (item[ s ] === '无' || !item[ s ]) {
item[ s ] = '无学历';
}
sub += item[s];
sub += item[ s ];
break;
case 2:
sub += (i && ' | ') || '';
if (item[s] === '无' || !item[s]) {
if (item[ s ] === '无' || !item[ s ]) {
sub += '无学位';
} else {
sub += item[s];
sub += item[ s ];
}
break;
default:
sub += (i && ' | ') || '';
sub += item[s] || '无';
sub += item[ s ] || '无';
break;
}
});
temp += itemRenderer(
`${item[list.title]}
`${item[ list.title ]}
<p class='item__content-sub-title'>${sub}</p><p class='item__content-sub-title'>毕业于${
item[list.note]
item[ list.note ]
}</p>`,
'',
'edu long-title '
......@@ -819,13 +836,13 @@ function listERenderer(list, data) {
data.forEach((item, index) => {
let sub = '';
list.subTitle.forEach((s, i) => {
sub += `<p class='item__content-sub-title'>${list.subTitleName[i]}${item[s]}</p>`;
sub += `<p class='item__content-sub-title'>${list.subTitleName[ i ]}${item[ s ]}</p>`;
});
temp += itemRenderer(
`${item[list.title]} | ${
item[list.title1]
`${item[ list.title ]} | ${
item[ list.title1 ]
}<span style='float: right;padding-right:16px'>${
item[list.title2]
item[ list.title2 ]
}</span>
${sub}`,
'',
......@@ -845,14 +862,14 @@ function listFRenderer(list, data) {
data.forEach((item, index) => {
temp += itemRenderer(
`${
item[list.title]
item[ list.title ]
}<span style='float: right;padding-right:16px'>${
item[list.title1]
item[ list.title1 ]
}</span>
<p class='item__content-sub-title'>${
item[list.subTitle]
item[ list.subTitle ]
}<span style='float: right;padding-right:12px'>${
item[list.subTitle1]
item[ list.subTitle1 ]
}年度</span></p>`,
'',
'edu long-title '
......@@ -970,7 +987,7 @@ function listJXRenderer(list, data) {
if (allYears.length > 0) {
// 绩效显示到当前年份
let currentYear = new Date().getFullYear();
let firstYear = Number(allYears[0]);
let firstYear = Number(allYears[ 0 ]);
let count = currentYear - firstYear;
for (var i = 1; i <= count; i++) {
allYears.unshift(`${firstYear + i}`);
......@@ -1050,7 +1067,7 @@ function listJXRenderer(list, data) {
let tabIndex = 0;
if (dataset.item) {
let item = JSON.parse(dataset.item);
let text = item[dataset.type];
let text = item[ dataset.type ];
if (text === '/') {
return;
} else {
......@@ -1171,12 +1188,12 @@ function listJXRenderer(list, data) {
a5.dataset.type = 'punish';
a5.href = `#punish${item.year}`;
td1.innerHTML = `${item[list.yearShow]}`;
td1.innerHTML = `${item[ list.yearShow ]}`;
a2.innerHTML = `${item[list.performance]}`;
a3.innerHTML = `${item[list.appraise]}`;
a4.innerHTML = `${item[list.award]}`;
a5.innerHTML = `${item[list.punish]}`;
a2.innerHTML = `${item[ list.performance ]}`;
a3.innerHTML = `${item[ list.appraise ]}`;
a4.innerHTML = `${item[ list.award ]}`;
a5.innerHTML = `${item[ list.punish ]}`;
td2.appendChild(a2);
......@@ -1309,9 +1326,9 @@ function modalDidSelectedIndex(index) {
let tabBox = document.querySelector('.modal__tab__box');
let lis = tabBox.getElementsByTagName('li');
for (var i = 0; i < lis.length; i++) {
lis[i].classList.remove('modal__tab__active');
if (Number(lis[i].dataset.index) === index) {
lis[i].classList.add('modal__tab__active');
lis[ i ].classList.remove('modal__tab__active');
if (Number(lis[ i ].dataset.index) === index) {
lis[ i ].classList.add('modal__tab__active');
}
}
// console.log('modalDidSelectedIndex', index)
......@@ -1728,17 +1745,17 @@ function performanceGroups(arr) {
let map = {},
dest = [];
for (var i = 0; i < arr.length; i++) {
var ai = arr[i];
if (!map[ai.assyear]) {
var ai = arr[ i ];
if (!map[ ai.assyear ]) {
dest.push({
year: ai.assyear,
assyear: ai.assyear,
children: [ai]
});
map[ai.assyear] = ai;
map[ ai.assyear ] = ai;
} else {
for (var j = 0; j < dest.length; j++) {
var dj = dest[j];
var dj = dest[ j ];
if (dj.assyear == ai.assyear) {
dj.children.push(ai);
break;
......@@ -1751,8 +1768,8 @@ function performanceGroups(arr) {
});
// 设置父级字段
dest.forEach((item) => {
item['assgrade'] = '';
item['gradeNumStr'] = '';
item[ 'assgrade' ] = '';
item[ 'gradeNumStr' ] = '';
console.log(item.children);
let childrenList = [...item.children];
......@@ -1760,7 +1777,7 @@ function performanceGroups(arr) {
childrenList.forEach((childItem, index) => {
// console.log(childItem)
if (childItem.asstype == '年度') {
item['assgrade'] = childItem.assgrade;
item[ 'assgrade' ] = childItem.assgrade;
// 年度子项中不显示
return;
}
......@@ -1796,17 +1813,17 @@ function performanceGroups(arr) {
let childMap = {},
childDest = [];
for (var i = 0; i < tmpList.length; i++) {
var ai = childrenList[i];
if (!childMap[ai.assgrade]) {
var ai = childrenList[ i ];
if (!childMap[ ai.assgrade ]) {
childDest.push({
assgrade: ai.assgrade,
assgradenumber: Number(ai.assgradenumber),
children: [ai]
});
childMap[ai.assgrade] = ai;
childMap[ ai.assgrade ] = ai;
} else {
for (var j = 0; j < childDest.length; j++) {
var dj = childDest[j];
var dj = childDest[ j ];
if (dj.assgrade == ai.assgrade) {
dj.children.push(ai);
break;
......@@ -1823,7 +1840,7 @@ function performanceGroups(arr) {
total = total + item.children.length;
grades.push(`${item.children.length}${item.assgrade}`);
});
item['gradeNumStr'] = `(${grades.join('、')}/共${total}次)`;
item[ 'gradeNumStr' ] = `(${grades.join('、')}/共${total}次)`;
}
......@@ -1835,16 +1852,16 @@ function appraiseGroups(arr) {
let map = {},
dest = [];
for (var i = 0; i < arr.length; i++) {
var ai = arr[i];
if (!map[ai.year]) {
var ai = arr[ i ];
if (!map[ ai.year ]) {
dest.push({
year: ai.year,
children: [ai]
});
map[ai.year] = ai;
map[ ai.year ] = ai;
} else {
for (var j = 0; j < dest.length; j++) {
var dj = dest[j];
var dj = dest[ j ];
if (dj.year == ai.year) {
dj.children.push(ai);
break;
......@@ -1874,16 +1891,16 @@ function rewardpunishGroups(arr) {
let map = {},
dest = [];
for (var i = 0; i < arr.length; i++) {
var ai = arr[i];
if (!map[ai.state]) {
var ai = arr[ i ];
if (!map[ ai.state ]) {
dest.push({
state: ai.state,
children: [ai]
});
map[ai.state] = ai;
map[ ai.state ] = ai;
} else {
for (var j = 0; j < dest.length; j++) {
var dj = dest[j];
var dj = dest[ j ];
if (dj.state == ai.state) {
dj.children.push(ai);
break;
......@@ -1900,16 +1917,16 @@ function rewardGroups(arr, flowers) {
let map = {},
dest = [];
for (var i = 0; i < arr.length; i++) {
var ai = arr[i];
if (!map[ai.year]) {
var ai = arr[ i ];
if (!map[ ai.year ]) {
dest.push({
year: ai.year,
children: [ai]
});
map[ai.year] = ai;
map[ ai.year ] = ai;
} else {
for (var j = 0; j < dest.length; j++) {
var dj = dest[j];
var dj = dest[ j ];
if (dj.year == ai.year) {
dj.children.push(ai);
break;
......@@ -1952,15 +1969,15 @@ function rewardGroups(arr, flowers) {
*/
dest.forEach((item) => {
item['annualRanking'] = {
item[ 'annualRanking' ] = {
title: '年度专项排名:',
list: []
};
item['annualAward'] = {
item[ 'annualAward' ] = {
title: '年度专项奖励:',
list: []
};
item['dailyAward'] = {
item[ 'dailyAward' ] = {
title: '日常专项奖励:',
list: []
};
......@@ -2010,20 +2027,20 @@ function rewardtypeGroups(arr) {
let map = {},
dest = [];
arr.forEach((item) => {
item['title'] = item.rewardtype;
item[ 'title' ] = item.rewardtype;
});
for (var i = 0; i < arr.length; i++) {
var ai = arr[i];
if (!map[ai.title]) {
var ai = arr[ i ];
if (!map[ ai.title ]) {
dest.push({
title: ai.title,
rewardsort: Number(ai.rewardsort),
children: [ai]
});
map[ai.title] = ai;
map[ ai.title ] = ai;
} else {
for (var j = 0; j < dest.length; j++) {
var dj = dest[j];
var dj = dest[ j ];
if (dj.title == ai.title) {
dj.children.push(ai);
break;
......@@ -2042,16 +2059,16 @@ function punishGroups(arr) {
let map = {},
dest = [];
for (var i = 0; i < arr.length; i++) {
var ai = arr[i];
if (!map[ai.year]) {
var ai = arr[ i ];
if (!map[ ai.year ]) {
dest.push({
year: ai.year,
children: [ai]
});
map[ai.year] = ai;
map[ ai.year ] = ai;
} else {
for (var j = 0; j < dest.length; j++) {
var dj = dest[j];
var dj = dest[ j ];
if (dj.year == ai.year) {
dj.children.push(ai);
break;
......@@ -2064,11 +2081,11 @@ function punishGroups(arr) {
});
dest.forEach((item) => {
item['annualPunish'] = {
item[ 'annualPunish' ] = {
title: '年度专项处罚:',
list: []
};
item['dailyPunish'] = {
item[ 'dailyPunish' ] = {
title: '日常专项处罚:',
list: []
};
......@@ -2102,15 +2119,15 @@ function punishGroups(arr) {
function changeSelect() {
let icon_img = document.getElementsByClassName('icon_img');
for (let i = 0; i < icon_img.length; i++) {
let clickNode = icon_img[i].nextElementSibling;
listenerChange(icon_img[i], clickNode, i);
let clickNode = icon_img[ i ].nextElementSibling;
listenerChange(icon_img[ i ], clickNode, i);
}
}
function listenerChange(target, clickNode, i) {
clickNode.addEventListener('click', () => {
let second_box = document.getElementsByClassName('second-box');
let sNode = second_box[i];
let sNode = second_box[ i ];
// let wrap_content = document.getElementsByClassName('wrap_content');
if (target.className.indexOf('icon_01_img') > -1) {
target.classList.remove('icon_01_img');
......@@ -2167,32 +2184,31 @@ function renderFileName(attachmentName) {
function listGRenderer(list, data) {
let temp = ``;
if (data && data.length) {
let cadreFile = []
let cadreFile = [];
data.forEach((item, index) => {
let note = list.note;
let chil = list.chilkey
let children = item[list.children] //附件
let halfArr = item.halfArr
let chil = list.chilkey;
let children = item[ list.children ]; //附件
let halfArr = item.halfArr;
// 有附件或有半年度
if ((chil instanceof Array && children)|| (halfArr && halfArr.length)) {
if ((chil instanceof Array && children) || (halfArr && halfArr.length)) {
let childrenHtml = ``
let childrenHtml = ``;
// 文件名称排序
let sortChildren =children? children.sort((a, b) => {
return a[list.chilkey[0]].localeCompare(b[list.chilkey[0]])
}):[]
let sortChildren = children ? children.sort((a, b) => {
return a[ list.chilkey[ 0 ] ].localeCompare(b[ list.chilkey[ 0 ] ]);
}) : [];
sortChildren.forEach((items) => {
childrenHtml += itemRenderer(
`<span class="file_link"> ${renderFileIcon(items[list.chilkey[1]])} ${renderFileName(items[list.chilkey[0]])}</span>`,
`<span class="file_link"> ${renderFileIcon(items[ list.chilkey[ 1 ] ])} ${renderFileName(items[ list.chilkey[ 0 ] ])}</span>`,
'',
'children_content'
);
cadreFile.push(items[list.chilkey[1]])
})
cadreFile.push(items[ list.chilkey[ 1 ] ]);
});
// 半年度
if(halfArr){
if (halfArr) {
halfArr.forEach((items) => {
......@@ -2202,40 +2218,39 @@ function listGRenderer(list, data) {
'children_content half_content'
);
// 半年度文件名称排序
let halfattAchmentArray = items.attachmentArray||[]
let sortChildren =halfattAchmentArray.sort((a, b) => {
return a[list.chilkey[0]].localeCompare(b[list.chilkey[0]])
})
let halfattAchmentArray = items.attachmentArray || [];
let sortChildren = halfattAchmentArray.sort((a, b) => {
return a[ list.chilkey[ 0 ] ].localeCompare(b[ list.chilkey[ 0 ] ]);
});
sortChildren.forEach((items) => {
childrenHtml += itemRenderer(
`<span class="file_link"> ${renderFileIcon(items[list.chilkey[1]])} ${renderFileName(items[list.chilkey[0]])}</span>`,
`<span class="file_link"> ${renderFileIcon(items[ list.chilkey[ 1 ] ])} ${renderFileName(items[ list.chilkey[ 0 ] ])}</span>`,
'',
'children_content half_content'
);
cadreFile.push(items[list.chilkey[1]])
})
})
cadreFile.push(items[ list.chilkey[ 1 ] ]);
});
});
}
temp += itemRenderer(
`${item[list.title]}年`,
`<span class="item__content-note t-black ">${item[note] || ''}</span>`,
`${item[ list.title ]}年`,
`<span class="item__content-note t-black ">${item[ note ] || ''}</span>`,
`${childrenHtml ? 'has-children text-left' : 'text-left'}`
);
if (childrenHtml) {
temp += `<div class="children_box">${childrenHtml}</div>`
temp += `<div class="children_box">${childrenHtml}</div>`;
}
}else {
} else {
temp += itemRenderer(
`${item[list.title]}年`,
`<span class="item__content-note t-black">${item[note]}</span>`
`${item[ list.title ]}年`,
`<span class="item__content-note t-black">${item[ note ]}</span>`
);
}
});
cadreFileList = cadreFile
cadreFileList = cadreFile;
} else {
temp = noDataRenderer();
......@@ -2249,7 +2264,7 @@ function addFileEvent() {
let file_note = document.getElementsByClassName('file_link');
// console.log('assFileList>>', assFileList)
for (let i = 0; i < file_note.length; i++) {
registerEvent(file_note[i], cadreFileList[i]);
registerEvent(file_note[ i ], cadreFileList[ i ]);
}
}
......@@ -2258,7 +2273,7 @@ function addAssFileEvent() {
let file_note = document.getElementsByClassName('ass_file_link');
console.log('assFileList>>', assFileList);
for (let i = 0; i < file_note.length; i++) {
registerEvent(file_note[i], assFileList[i]);
registerEvent(file_note[ i ], assFileList[ i ]);
}
}
......@@ -2268,7 +2283,7 @@ function registerEvent(clickNode, data) {
clickNode.addEventListener('click', () => {
// console.log('registerEvent--data>>', data)
const fileName = data.split('?')[1] || '';
const fileName = data.split('?')[ 1 ] || '';
const index = fileName.lastIndexOf('.');
console.log('. index>>', index);
//获取后缀
......@@ -2277,15 +2292,15 @@ function registerEvent(clickNode, data) {
console.log('orgType>>', orgType);
let apiCode = 'hr.resume.attachmentInfoV';
switch (orgType) {
case 1:
case '1':
// 房开
apiCode = 'hr.resume.attachmentInfoV';
break;
case 6:
case '6':
// 物业
apiCode = 'wyhr.resume.attachmentInfoV';
break;
case 7:
case '4':
// 合诚
apiCode = 'hchr.resume.attachmentInfoV';
break;
......@@ -2356,8 +2371,8 @@ function listDRenderer(list, data) {
//新增月度数据
temp += itemRenderer(
`${item[list.title]}年`,
`<span class='item__content-note t-black'>${item[note]} </span>`,
`${item[ list.title ]}年`,
`<span class='item__content-note t-black'>${item[ note ]} </span>`,
`${(item.months && item.months.length) || (item.attachmentArray && item.attachmentArray.length) ? 'has-children text-left' : 'text-left'}`
);
......@@ -2448,21 +2463,21 @@ function propertyListARenderer(list, data, extra = '') {
for (let name in list) {
let value;
let title;
if (list[name] instanceof Object) {
if (list[ name ] instanceof Object) {
if (name.indexOf('&') !== -1) {
let names = name.split('&');
title = `${data[names[0]] || '未知'}-${
data[names[1]] || '未知'
title = `${data[ names[ 0 ] ] || '未知'}-${
data[ names[ 1 ] ] || '未知'
}`;
} else {
title = data[name];
title = data[ name ];
}
let t1 = data[list[name][0]];
let t2 = data[list[name][1]];
let t1 = data[ list[ name ][ 0 ] ];
let t2 = data[ list[ name ][ 1 ] ];
value = `${t1}${nowOrNot(t2)}`;
} else {
title = list[name];
value = data[name];
title = list[ name ];
value = data[ name ];
}
temp.innerHTML += propertyItemRenderer(
title || '未知',
......@@ -2482,15 +2497,15 @@ function propertyListBRenderer(list, data) {
if (list.subTitle) {
list.subTitle.forEach((s, i) => {
sub += (i && '|') || '';
sub += item[s] || '无';
sub += item[ s ] || '无';
});
}
if (note instanceof Object && note.length) {
let t1 = data[index][list.note[0]];
let t2 = data[index][list.note[1]];
let t1 = data[ index ][ list.note[ 0 ] ];
let t2 = data[ index ][ list.note[ 1 ] ];
temp +=
`<div class='item_main'><div class='item__content work'>${
item[list.title] || '无'
item[ list.title ] || '无'
}</div>` +
propertyItemRenderer(
`<p class='item__content-sub-title'>${sub}</p>`,
......@@ -2502,9 +2517,9 @@ function propertyListBRenderer(list, data) {
} else {
temp += propertyItemRenderer(
`${
item[list.title]
item[ list.title ]
}<p class='item__content-sub-title'>${sub}</p>`,
`<p class='item__content-note'>${item[note]}</p>`
`<p class='item__content-note'>${item[ note ]}</p>`
);
}
});
......@@ -2524,29 +2539,29 @@ function propertyListCRenderer(list, data) {
switch (i) {
case 1:
sub += (i && ' | ') || '';
if (item[s] === '无' || !item[s]) {
item[s] = '无学历';
if (item[ s ] === '无' || !item[ s ]) {
item[ s ] = '无学历';
}
sub += item[s];
sub += item[ s ];
break;
case 2:
sub += (i && ' | ') || '';
if (item[s] === '无' || !item[s]) {
if (item[ s ] === '无' || !item[ s ]) {
sub += '无学位';
} else {
sub += item[s];
sub += item[ s ];
}
break;
default:
sub += (i && ' | ') || '';
sub += item[s] || '无';
sub += item[ s ] || '无';
break;
}
});
temp += propertyItemRenderer(
`${item[list.title]}
`${item[ list.title ]}
<p class='item__content-sub-title'>${sub}</p><p class='item__content-sub-title'>毕业于${
item[list.note]
item[ list.note ]
}</p>`,
'',
'edu long-title '
......@@ -2570,15 +2585,15 @@ function propertyListDRenderer(list, data) {
if (list.subTitle) {
list.subTitle.forEach((s, i) => {
sub += (i && '|') || '';
sub += item[s] || '无';
sub += item[ s ] || '无';
});
}
if (note instanceof Object && note.length) {
let t1 = data[index][list.note[0]];
let t2 = data[index][list.note[1]];
let t1 = data[ index ][ list.note[ 0 ] ];
let t2 = data[ index ][ list.note[ 1 ] ];
temp += propertyItemRenderer(
`${
item[list.title]
item[ list.title ]
}<p class='item__content-sub-title'>${sub}</p>`,
`<span class='item__content-note'>${t1}${nowOrNot(
t2
......@@ -2586,8 +2601,8 @@ function propertyListDRenderer(list, data) {
);
} else {
temp += propertyItemRenderer(
`${item[list.title]}年`,
`<span class='item__content-note'>${item[note]}</span>`
`${item[ list.title ]}年`,
`<span class='item__content-note'>${item[ note ]}</span>`
);
}
});
......@@ -2604,13 +2619,13 @@ function propertyListERenderer(list, data) {
data.forEach((item, index) => {
let sub = '';
list.subTitle.forEach((s, i) => {
sub += `<p class='item__content-sub-title'>${list.subTitleName[i]}${item[s]}</p>`;
sub += `<p class='item__content-sub-title'>${list.subTitleName[ i ]}${item[ s ]}</p>`;
});
temp += propertyItemRenderer(
`${item[list.title]} | ${
item[list.title1]
`${item[ list.title ]} | ${
item[ list.title1 ]
}<span style='float: right;padding-right:16px'>${
item[list.title2]
item[ list.title2 ]
}</span>
${sub}`,
'',
......@@ -2630,14 +2645,14 @@ function propertyListFRenderer(list, data) {
data.forEach((item, index) => {
temp += propertyItemRenderer(
`${
item[list.title]
item[ list.title ]
}<span style='float: right;padding-right:16px'>${
item[list.title1]
item[ list.title1 ]
}</span>
<p class='item__content-sub-title'>${
item[list.subTitle]
item[ list.subTitle ]
}<span style='float: right;padding-right:12px'>${
item[list.subTitle1]
item[ list.subTitle1 ]
}年度</span></p>`,
'',
'edu long-title '
......@@ -2726,7 +2741,8 @@ function showToast(txt) {
function attachAtivated(element) {
let els = (typeof element === 'string' &&
document.querySelectorAll(element)) || [element];
Array.from(els).forEach(el => {
Array.from(els)
.forEach(el => {
el.addEventListener('touchstart', function() {
this.classList.add('activated');
});
......@@ -2773,11 +2789,11 @@ function filterData(item, data, isAssessNew) {
break;
}
}
let templist = []
let sumList = []
let templist = [];
let sumList = [];
for (let i = 0; i < data.length; i++) {
const index = templist.indexOf(data[ i ].assyear)
let _assyear = data[ i ].asstype
const index = templist.indexOf(data[ i ].assyear);
let _assyear = data[ i ].asstype;
// if(data[i].asstype==="半年度"){
// if(data[i].assendtime.substring(5,10)==="06-30"){
// _assyear='上半年度'
......@@ -2821,49 +2837,49 @@ function filterData(item, data, isAssessNew) {
obj[ item.assyear ] = [];
}
if (item.asstype === '月度') {
item.month = Number(item.assendtime.substring(5, 7)) + '月'
item.monthNum = Number(item.assendtime.substring(5, 7))
item.month = Number(item.assendtime.substring(5, 7)) + '月';
item.monthNum = Number(item.assendtime.substring(5, 7));
obj[ item.assyear ].push(item);
}
});
assessData = data.filter(i => i.asstype === '年度')
let objKeys = Object.keys(obj)
let dataYears = assessData.map(item => item.assyear)
let noYearData = []
assessData = data.filter(i => i.asstype === '年度');
let objKeys = Object.keys(obj);
let dataYears = assessData.map(item => item.assyear);
let noYearData = [];
// let noYearData = {}
if (objKeys.length !== assessData.length) {
// noYearData = {assyear: objKeys.find(item => !dataYears.includes(item)), assgrade: ''}
//兼容多条没有年度数据的情况
for (let i = 0; i < objKeys.length; i++) {
if (!dataYears.includes(objKeys[ i ])) {
noYearData.push({assyear: objKeys[ i ], assgrade: ''})
noYearData.push({ assyear: objKeys[ i ], assgrade: '' });
}
}
}
// if (noYearData.assyear) {
if (noYearData.length) {
// assessData.unshift(noYearData)
assessData = noYearData.concat(assessData)
assessData = noYearData.concat(assessData);
assessData.sort((a, b) => {
return b.assyear - a.assyear
})
return b.assyear - a.assyear;
});
}
assessData.forEach(item => {
item.months = obj[ item.assyear ]
})
item.months = obj[ item.assyear ];
});
//月份升序
assessData.forEach(item => {
if (item.months && item.months.length) {
item.months.sort((a, b) => {
return a.monthNum - b.monthNum
})
return a.monthNum - b.monthNum;
});
}
})
});
}
......@@ -2873,26 +2889,26 @@ function filterData(item, data, isAssessNew) {
//处理干部考核半年度数据
if (item === 'cadreEvaluationVoList') {
let arr = []
console.log('干部考核数据处理 前>>', assessData)
let arr = [];
console.log('干部考核数据处理 前>>', assessData);
// 将数据按 先半年度再年度的顺序排序
assessData.map(i => {
if (i.checkTypeName === '半年度') {
i.timeTemp = new Date(i.year, 5, 1).getTime()
console.log('半年度 timeTemp>>', i.timeTemp)
i.timeTemp = new Date(i.year, 5, 1).getTime();
console.log('半年度 timeTemp>>', i.timeTemp);
} else if (i.checkTypeName === '年度') {
i.timeTemp = new Date(i.year, 11, 1).getTime()
console.log('年度 timeTemp>>', i.timeTemp)
i.timeTemp = new Date(i.year, 11, 1).getTime();
console.log('年度 timeTemp>>', i.timeTemp);
}
return i
})
assessData.sort((a, b) => b.timeTemp - a.timeTemp) //降序
console.log('干部考核数据处理 后>>', assessData)
return i;
});
assessData.sort((a, b) => b.timeTemp - a.timeTemp); //降序
console.log('干部考核数据处理 后>>', assessData);
assessData.forEach(item => {
if (item.checkTypeName === '年度') {
arr.push({...item, halfArr: []})
arr.push({ ...item, halfArr: [] });
} else if (item.checkTypeName === '半年度') {
let idx = arr.findIndex(i => item.year === i.year)
let idx = arr.findIndex(i => item.year === i.year);
if (idx === -1) {
//只有半年度数据没有年度数据
arr.push({
......@@ -2901,26 +2917,27 @@ function filterData(item, data, isAssessNew) {
year: item.year,
result: '',
halfArr: [item]
})
});
} else {
arr[ idx ].halfArr.push(item)
arr[ idx ].halfArr.push(item);
}
}
});
assessData = arr
assessData = arr;
}
return assessData;
}
function eleHide() {
let wrap_content = document.getElementsByClassName('wrap_content');
console.log('wrap_content>>', wrap_content);
for (let i = 0; i < wrap_content.length; i++) {
if (wrap_content[i].childNodes.length > 3) {
let clickNode = wrap_content[i].nextElementSibling;
wrapContent(wrap_content[i], clickNode);
if (wrap_content[ i ].childNodes.length > 3) {
let clickNode = wrap_content[ i ].nextElementSibling;
wrapContent(wrap_content[ i ], clickNode);
}
}
}
......@@ -2930,8 +2947,8 @@ function eleHideChil() {
let wrap_box = document.getElementsByClassName('children_box');
let hasChildrenEle = document.getElementsByClassName('has-children');
for (let i = 0; i < wrap_box.length; i++) {
let clickNode = hasChildrenEle[i];
wrapContentChil(wrap_box[i], clickNode);
let clickNode = hasChildrenEle[ i ];
wrapContentChil(wrap_box[ i ], clickNode);
}
console.log('eleHideChil>>>');
}
......@@ -2942,7 +2959,7 @@ function wrapContentChil(target, clickNode, num = 0) {
let allHeight = target.offsetHeight + 'px';
let showEleHeight = 0;
for (let i = 0; i < num; i++) {
showEleHeight += item[i].offsetHeight;
showEleHeight += item[ i ].offsetHeight;
if (i === num - 1) {
showEleHeight += 'px';
}
......@@ -2968,9 +2985,9 @@ function wrapContentChil(target, clickNode, num = 0) {
function eleHideShrink(type) {
let wrap_content_shrink = document.getElementsByClassName('wrap_content_shrink');
for (let i = 0; i < wrap_content_shrink.length; i++) {
if (wrap_content_shrink[i].childNodes.length > 3) {
let clickNode = wrap_content_shrink[i].nextElementSibling;
wrapContentShrink(wrap_content_shrink[i], clickNode, type);
if (wrap_content_shrink[ i ].childNodes.length > 3) {
let clickNode = wrap_content_shrink[ i ].nextElementSibling;
wrapContentShrink(wrap_content_shrink[ i ], clickNode, type);
}
}
}
......@@ -2981,7 +2998,7 @@ function wrapContent(target, clickNode, num = 3) {
let allHeight = target.offsetHeight + 'px';
let showEleHeight = 0;
for (let i = 0; i < num; i++) {
showEleHeight += item[i].offsetHeight;
showEleHeight += item[ i ].offsetHeight;
if (i === num - 1) {
showEleHeight += 'px';
}
......@@ -3005,7 +3022,7 @@ function wrapContentShrink(target, clickNode, type, num = 3) {
let item = target.childNodes;
let showEleHeight = 0;
for (let i = 0; i < num; i++) {
showEleHeight += item[i].offsetHeight;
showEleHeight += item[ i ].offsetHeight;
if (i === num - 1) {
showEleHeight += 'px';
}
......@@ -3034,9 +3051,9 @@ function wrapContentShrink(target, clickNode, type, num = 3) {
function eleHideShrinkExtend() {
let wrap_content_shrink = document.getElementsByClassName('wrap_content_shrink');
for (let i = 0; i < wrap_content_shrink.length; i++) {
if (wrap_content_shrink[i].childNodes.length > 3) {
let clickNode = wrap_content_shrink[i];
wrapContentExtend(wrap_content_shrink[i], clickNode);
if (wrap_content_shrink[ i ].childNodes.length > 3) {
let clickNode = wrap_content_shrink[ i ];
wrapContentExtend(wrap_content_shrink[ i ], clickNode);
}
}
}
......@@ -3046,7 +3063,7 @@ function wrapContentExtend(target, clickNode, num = 3) {
let allHeight = target.offsetHeight + 'px';
let showEleHeight = 0;
for (let i = 0; i < num; i++) {
showEleHeight += item[i].offsetHeight;
showEleHeight += item[ i ].offsetHeight;
if (i === num - 1) {
showEleHeight += 'px';
}
......@@ -3095,7 +3112,7 @@ function createIScroller() {
let frozenCols = document.querySelectorAll(Selector + ' table tr td.cols');
for (let i = 0; i < frozenCols.length; i++) {
frozenCols[i].style.transform = 'translate(' + -1 * this.x + 'px, 0px) translateZ(0px)';
frozenCols[ i ].style.transform = 'translate(' + -1 * this.x + 'px, 0px) translateZ(0px)';
}
}
......
......@@ -65,7 +65,7 @@ export default class MAS {
* @memberof MAS
*/
getData(url, params, options = {}) {
console.log('getData');
console.log('mas getData>>',{url, params, options});
let method = (options && options.method) || this.method || 'get';
// let baseUrl = (options && options.baseUrl) || this.baseUrl;
return axios({
......
import axios from 'axios'
import axios from 'axios';
var originAdapter = axios.defaults.adapter
axios.defaults.adapter = function (config) {
var originAdapter = axios.defaults.adapter;
axios.defaults.adapter = function(config) {
if (!/^https?/.test(config.url)) {
return originAdapter(config)
return originAdapter(config);
}
return request(config)
}
return request(config);
};
function isObject(value) {
return value !== null && typeof value === 'object'
return value !== null && typeof value === 'object';
}
function isString(fd) {
return Object.prototype.toString.call(fd) === '[object String]'
return Object.prototype.toString.call(fd) === '[object String]';
}
function isFormData(fd) {
return Object.prototype.toString.call(fd) === '[object FormData]'
return Object.prototype.toString.call(fd) === '[object FormData]';
}
function formData2obj(fd) {
var data = {}
var data = {};
for (var p of fd.entries()) {
data[p[0]] = p[1]
data[ p[ 0 ] ] = p[ 1 ];
}
return data
return data;
}
function params2object(url) {
var params = {}
var params = {};
if (typeof url === 'object') {
return url
return url;
} else if (typeof url === 'string') {
url
.replace(/^.*\?|#.*$/g, '')
.split('&')
.forEach((n) => {
n = n.split('=')
n = n.split('=');
if (n.length === 2) {
params[n[0]] = decodeURIComponent(n[1])
params[ n[ 0 ] ] = decodeURIComponent(n[ 1 ]);
}
})
});
}
return params
return params;
}
function request(opt) {
let serializer = opt.serializer || 'form'
opt = opt || {}
let serializer = opt.serializer || 'form';
opt = opt || {};
if (!opt.url) {
return Promise.reject('interface url is required!')
return Promise.reject('interface url is required!');
}
// 默认get请求
opt.method = opt.method || 'get'
opt.method = opt.method || 'get';
// 处理params
var urlParams = opt.params || {}
var urlParams = opt.params || {};
// 合并url和params字段的数据,如果params字段与url中有重名参数,以params中的为准
urlParams = Object.assign(params2object(opt.url), urlParams)
urlParams = Object.assign(params2object(opt.url), urlParams);
// 处理url
// url如果包含空格,会在iOS中报错
opt.url = opt.url.replace(/^\s+|\s+$/g, '')
opt.url = opt.url.replace(/^\s+|\s+$/g, '');
// 将params拼接到url中
opt.url =
opt.url.split('?')[0] +
opt.url.split('?')[ 0 ] +
'?' +
Object.keys(urlParams)
.map((key) => {
var val = urlParams[key]
var val = urlParams[ key ];
if (isObject(val)) {
val = JSON.stringify(val)
val = encodeURIComponent(val)
val = JSON.stringify(val);
val = encodeURIComponent(val);
} else if (/[^\x00-\xff]/.test(val)) {
val = encodeURIComponent(val)
val = encodeURIComponent(val);
}
return key + '=' + val
return key + '=' + val;
})
.join('&')
.join('&');
// post非json即是form。
if (opt.method.toLowerCase() === 'post') {
var data = opt.data
const headers = opt.headers
const contentType = headers['content-type'] || headers['Content-Type'] || headers['CONTENT-TYPE'] || ''
var data = opt.data;
const headers = opt.headers;
const contentType = headers[ 'content-type' ] || headers[ 'Content-Type' ] || headers[ 'CONTENT-TYPE' ] || '';
if (contentType.indexOf('application/json') !== -1) {
serializer = 'json'
serializer = 'json';
}
if ((serializer === 'form') && isFormData(data)) {
opt.data = formData2obj(data)
}
else if (isString(data)) {
opt.data = formData2obj(data);
} else if (isString(data)) {
if (serializer === 'json') {
try {
opt.data = JSON.parse(data)
opt.data = JSON.parse(data);
} catch (error) {
opt.data = {}
opt.data = {};
}
} else {
opt.data = params2object(data)
opt.data = params2object(data);
}
}
}
// 处理header
opt.headers = opt.headers || {}
const headers = {}
opt.headers = opt.headers || {};
const headers = {};
// headers字段值必须是字符串型
Object.keys(opt.headers).forEach(function (key) {
var val = opt.headers[key]
Object.keys(opt.headers)
.forEach(function(key) {
var val = opt.headers[ key ];
if (val) {
var type = typeof val
var type = typeof val;
if (type !== 'string') {
val = val + ''
val = val + '';
}
// 因content-type可能存在大小写不规范,这里先过滤掉,后面根据serializer统一添加
var _key = key.toLowerCase()
var _key = key.toLowerCase();
if (_key !== 'content-type') {
headers[_key] = val
headers[ _key ] = val;
}
}
})
});
// 根据serializer统一添加content-type
headers['content-type'] = serializer === 'json' ? 'application/json' : 'application/x-www-form-urlencoded'
opt.headers = headers
return new Promise(function (resolve, reject) {
headers[ 'content-type' ] = serializer === 'json' ? 'application/json' : 'application/x-www-form-urlencoded';
opt.headers = headers;
console.log('请求到这 opt>>', opt);
return new Promise(function(resolve, reject) {
qing.call('request', {
url: opt.url,
method: opt.method.toUpperCase(),
......@@ -134,35 +134,41 @@ function request(opt) {
header: opt.headers,
data: opt.data || {},
dataType: opt.dataType,
success: function (resp) {
success: function(resp) {
console.log('qing success>>', resp);
if (resp.data.errMsg || resp.data.error) {
alert(resp.data.errMsg + ':' + resp.data.error);
}
var response = {
data: resp.data,
status: resp.statusCode,
headers: resp.header,
config: opt
}
var validateStatus = response.config.validateStatus
};
var validateStatus = response.config.validateStatus;
// Note: status is not exposed by XDomainRequest
if (
!response.status ||
!validateStatus ||
validateStatus(response.status)
) {
resolve(response)
resolve(response);
} else {
var error = new Error(
'Request failed with status code ' + response.status
)
error.config = response.config
error.response = response
reject(error)
);
error.config = response.config;
error.response = response;
reject(error);
}
},
error: function (e) {
var error = new Error(e)
error.config = opt
reject(error)
}
})
})
error: function(e) {
console.log('qing error>>', e);
var error = new Error(e);
error.config = opt;
reject(error);
}
});
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment