Commit 09b93b61 by zhongqm

update:添加水印

parent 99216db5
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<head>
<meta charset='utf-8'>
<meta name='viewport' content='initial-scale=1.0, maximum-scale=1.0, user-scalable=0'>
<title>简历</title>
<script src="miniapp://common/js/qing/qing.js"></script>
<script src='miniapp://common/js/qing/qing.js'></script>
<!-- <script src="https://staging.jffctest.com/public/js/qing/latest/qing.js"></script>-->
</head>
<body>
<div class="header">
</div>
<a class="header__button" id="back"></a>
<div class="container">
<div class="banner">
<a class="banner__img loading" id="mainPhoto">
</head>
<body>
<div class='header'>
</div>
<a class='header__button' id='back'></a>
<div class='container'>
<div class='banner'>
<a class='banner__img loading' id='mainPhoto'>
<img>
</a>
<div id="name">正在加载</div>
<div id='name'>正在加载</div>
</div>
<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<div class='pswp' tabindex='-1' role='dialog' aria-hidden='true'>
<!-- Background of PhotoSwipe.
It's a separate element as animating opacity is faster than rgba(). -->
<div class="pswp__bg"></div>
<div class='pswp__bg'></div>
<!-- Slides wrapper with overflow:hidden. -->
<div class="pswp__scroll-wrap">
<div class='pswp__scroll-wrap'>
<!-- Container that holds slides.
PhotoSwipe keeps only 3 of them in the DOM to save memory.
Don't modify these 3 pswp__item elements, data is added later on. -->
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class='pswp__container'>
<div class='pswp__item'></div>
<div class='pswp__item'></div>
<div class='pswp__item'></div>
</div>
<!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
<div class="pswp__ui pswp__ui--hidden">
<div class='pswp__ui pswp__ui--hidden'>
<div class="pswp__top-bar">
<div class='pswp__top-bar'>
<!-- Controls are self-explanatory. Order can be changed. -->
<div class="pswp__counter"></div>
<div class='pswp__counter'></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
<button class="pswp__button pswp__button--save">保存</button>
<button class='pswp__button pswp__button--close' title='Close (Esc)'></button>
<button class='pswp__button pswp__button--save'>保存</button>
<!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
<!-- element will get class pswp__preloader--active when preloader is running -->
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
<div class='pswp__preloader'>
<div class='pswp__preloader__icn'>
<div class='pswp__preloader__cut'>
<div class='pswp__preloader__donut'></div>
</div>
</div>
</div>
</div>
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
<div class="pswp__share-tooltip"></div>
<div class='pswp__share-modal pswp__share-modal--hidden pswp__single-tap'>
<div class='pswp__share-tooltip'></div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
<button class='pswp__button pswp__button--arrow--left' title='Previous (arrow left)'>
</button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
<button class='pswp__button pswp__button--arrow--right' title='Next (arrow right)'>
</button>
<div class="pswp__caption">
<div class="pswp__caption__center"></div>
<div class='pswp__caption'>
<div class='pswp__caption__center'></div>
</div>
</div>
......@@ -80,59 +80,59 @@
</div>
</div>
<div class="toast" id="toast">
<div class="toast-content"></div>
</div>
</div>
<div class='toast' id='toast'>
<div class='toast-content'></div>
</div>
<!-- 自定义弹窗 -->
<div class="my__modal">
<div class="modal__content">
<!-- 自定义弹窗 -->
<div class='my__modal'>
<div class='modal__content'>
<!-- 头部 -->
<div class="modal__header">
<div class='modal__header'>
</div>
<!-- 内容 -->
<div class="modal__body">
<div class='modal__body'>
</div>
<!-- 尾部 -->
<div class="model__footer">
<div class="model__line"></div>
<span class="modal__close">&times;</span>
</div>
<div class='model__footer'>
<div class='model__line'></div>
<span class='modal__close'>&times;</span>
</div>
</div>
</div>
<div class="tips__modal">
<div class="tips__content">
<div class='tips__modal'>
<div class='tips__content'>
<!-- 头部 -->
<div class="tips__header">
<div class='tips__header'>
提示
</div>
<!-- 内容 -->
<div class="tips__body">
<div><span style="font-weight: 500;">年度绩效结果分为:</span>优秀、良好、合格、待改进</div>
<div><span style="font-weight: 500;">月度绩效结果分为:</span>A、B+、B、B-、C</div>
<div class="tips__title">1、出现如下情形之一,评价等级为A:</div>
<div class='tips__body'>
<div><span style='font-weight: 500;'>年度绩效结果分为:</span>优秀、良好、合格、待改进</div>
<div><span style='font-weight: 500;'>月度绩效结果分为:</span>A、B+、B、B-、C</div>
<div class='tips__title'>1、出现如下情形之一,评价等级为A:</div>
<div>(1)工作成效显著,且时间较大幅度提前。</div>
<div>(2)员工独立思考,有创新方法,工作成效超出预期。</div>
<div class="tips__title">2.评价等级为B(±):</div>
<div class='tips__title'>2.评价等级为B(±):</div>
<div> 评价B+:和过往比有较大进步或在工作难度/强度较大的情况下仍保质保量完成工作。</div>
<div> 评价B:按时保质完成工作。</div>
<div> 评价B-:工作出现偏差,无法按时保质完成。</div>
<div class="tips__title">3.出现如下情形之一,评价等级为C:</div>
<div class='tips__title'>3.出现如下情形之一,评价等级为C:</div>
<div>(1)工作出现重大失误,被公司通报批评。</div>
<div>(2)工作完成时间较计划存在较大幅度延后。</div>
<div>(3)工作成效差或远低于预期。</div>
</div>
<!-- 尾部 -->
<div class="tips__footer">
<div class="tips__line"></div>
<span class="tips__close">&times;</span>
</div>
</div>
<div class='tips__footer'>
<div class='tips__line'></div>
<span class='tips__close'>&times;</span>
</div>
</div>
</div>
</div>
<!-- <script defer src="cordova.js"></script> -->
</body>
</body>
</html>
......@@ -16,7 +16,7 @@ import common from './common';
// userid: '46000011',
// appKey: 'd504275e',
// uid: 'hqhuang@cndrealty.com',
// token: 'T4769446611354624',
// token: 'T5578909826679808',
// baseUrl: 'https://mxytest.cndrealty.com:4433/',
// };
......@@ -39,10 +39,19 @@ import common from './common';
// token: 'T4777933018317824',
// baseUrl: 'https://mxytest.cndrealty.com:4433/',
// };
// const config = {
// product: false,
// ssoToken: 'token',
// appkey: 'd504275e',
// baseUrl: 'https://mxytest.cndrealty.com:4433/',
// };
const config = {
product: false,
ssoToken: 'token',
appkey: 'd504275e',
userid: '46000011',
appKey: 'd504275e',
uid: 'zcm',
token: 'T5579119180350464',
baseUrl: 'https://mxytest.cndrealty.com:4433/',
};
......
......@@ -4,16 +4,18 @@ import configuration from 'configuration';
import app from './lib/app';
import MAS from './lib/mas';
import IScroll from 'iscroll/build/iscroll-probe';
import createWatermark from './lib/wmSVG';
import { setWaterMark } from './lib/wmCanvas';
const PhotoSwipe = require('./lib/photoswipe.min').PhotoSwipe;
const PhotoSwipeUI_Default = require('./lib/photoswipe-ui-default.min')
.PhotoSwipeUI_Default;
const FastClick = require('fastclick')
const FastClick = require('fastclick');
// const IScroll = require('iscroll/build/iscroll-probe')
// shr员工编号字段
const employeenumberField = process.env.PACK_ENV === 'product' ? '5893b734-4537-4036-9f1c-16ff831b64b2' : '72f1d584-bc3d-4616-85d0-4a67c1829d1c'
const employeenumberField = process.env.PACK_ENV === 'product' ? '5893b734-4537-4036-9f1c-16ff831b64b2' : '72f1d584-bc3d-4616-85d0-4a67c1829d1c';
window.topHeight = 115;
......@@ -28,7 +30,7 @@ let url = configuration.methods.resume;
const $mas = new MAS().config({
baseUrl: configuration.baseUrl,
code: configuration.code,
code: configuration.code
});
const RENDER_TYPE = configuration.renderType;
......@@ -51,26 +53,42 @@ app.ready(() => {
initUser().then(() => {
$mas.token = token;
mount();
}).catch((e) => {
console.log('-开发环境>>');
if (!configuration.product) {
_uid = configuration.uid;
userid = configuration.userid;
token = configuration.token;
appKey = configuration.appKey;
} else {
alert(e);
alert('应用启动发生错误,请联系开发人员');
}
$mas.token = token;
mount();
//添加水印
setWaterMark(`黄华强hqhuang@cndrealty.com`,'')
// createWatermark({ content: '黄华强hqhuang@cndrealty.com' });
});
// 取消延迟响应
FastClick.attach(document.body);
}, configuration.product);
function getUrlParamVal(paramName) {
const params = location.search.slice(1)
const reg = new RegExp(`(?:^|&)${paramName}=([^&]+)`)
const params = location.search.slice(1);
const reg = new RegExp(`(?:^|&)${paramName}=([^&]+)`);
if (reg.test(params)) {
return decodeURIComponent(RegExp.$1)
return decodeURIComponent(RegExp.$1);
}
return null
return null;
}
function getUserInfoByOid (oId) {
return new Promise(function (resolve, reject) {
function getUserInfoByOid(oId) {
return new Promise(function(resolve, reject) {
// 直接点击“简历”应用,是没有openId的,这时候不能报错。
if (!oId) {
resolve({})
return
resolve({});
return;
}
const opt = {
url: '/gateway/xmjf-other-service/person/role/query/openId',
......@@ -83,34 +101,35 @@ function getUserInfoByOid (oId) {
data: {
oid: oId
}
}
opt.success = function (result) {
const success = (result || {}).success || false
const data = (result || {}).data || []
};
opt.success = function(result) {
const success = (result || {}).success || false;
const data = (result || {}).data || [];
if (String(success).toLowerCase() !== 'true') {
reject(result.error || '获取人员信息失败!')
return
reject(result.error || '获取人员信息失败!');
return;
}
const userInfo = data.userInfo || {}
const extra = data.extra || []
const userInfo = data.userInfo || {};
const extra = data.extra || [];
const employeenumberInfo = extra.filter(({ publicid }) => {
return employeenumberField === publicid
})
return employeenumberField === publicid;
});
resolve({
uid: userInfo.username || '',
employeenumber: (employeenumberInfo[0] || {}).value
})
}
opt.error = function (e) {
reject(e)
}
window.qing.call('request', opt)
})
});
};
opt.error = function(e) {
reject(e);
};
window.qing.call('request', opt);
});
}
function initUser() {
const openId = getUrlParamVal('openId')
const isFromPersonDetail = 'persondetail' === getUrlParamVal('source')
console.log('initUser>>');
const openId = getUrlParamVal('openId');
const isFromPersonDetail = 'persondetail' === getUrlParamVal('source');
// 判断是否来自人员详情。
// 如果是从人员详情过来的,需要对employeenumber、uid做强校验。
// 如果不是从人员详情过来的,employeenumber、uid从当前人员的获取。
......@@ -118,14 +137,18 @@ function initUser() {
.then(([user, viewee]) => {
// user 查看者
// viewee 被查看者
console.log('user:', user)
console.log('viewee:', viewee)
console.log('user:', user);
console.log('viewee:', viewee);
//添加水印
// setWaterMark(`${user.cn}${user.uid}`, '');
createWatermark({ content: `${user.cn}${user.uid}` });
// todo:目前先写死房产,待黄延龄确认orgType怎么获取后再将orgType变成动态的。
const extra = {
employeenumber: viewee.employeenumber,
uid: viewee.uid,
extra: '{"orgType": 1}'
}
};
userid = isFromPersonDetail ? extra.employeenumber : user.employeenumber;
_uid = isFromPersonDetail ? extra.uid : user.uid;
if (!userid || !_uid) {
......@@ -149,7 +172,7 @@ function initUser() {
case 2:
$mas.config({
baseUrl: configuration.baseUrl,
code: configuration.yjyCode,
code: configuration.yjyCode
});
url = configuration.methods.yjyResume;
userid = userid.replace('YJY', '');
......@@ -159,7 +182,7 @@ function initUser() {
case 3:
$mas.config({
baseUrl: configuration.baseUrl,
code: configuration.hjCode,
code: configuration.hjCode
});
url = configuration.methods.hjResume;
break;
......@@ -167,7 +190,7 @@ function initUser() {
case 6:
$mas.config({
baseUrl: configuration.baseUrl,
code: configuration.wyCode,
code: configuration.wyCode
});
url = configuration.methods.wyResume;
break;
......@@ -175,7 +198,7 @@ function initUser() {
case 7:
$mas.config({
baseUrl: configuration.baseUrl,
code: configuration.hcCode,
code: configuration.hcCode
});
url = configuration.methods.hcResume;
break;
......@@ -189,7 +212,7 @@ function initUser() {
}
})
.catch(e => {
console.log('e:', e.toString())
console.log('e:', e.toString());
if (!configuration.product) {
_uid = configuration.uid;
userid = configuration.userid;
......@@ -209,7 +232,7 @@ function mount() {
attachAtivated(photo);
//TODO
// render(dataJson.data)
container.classList.add('container__scrolling')
container.classList.add('container__scrolling');
backButton.addEventListener('click', () => {
app.exit();
});
......@@ -223,7 +246,7 @@ function mount() {
);
*/
// 清除backbutton上的历史事件,绑定新事件
customEvt.removeEventListener('backbutton')
customEvt.removeEventListener('backbutton');
customEvt.addEventListener('backbutton', () => {
app.exit();
});
......@@ -244,28 +267,29 @@ function mount() {
// 关闭弹窗
tabModalClose.onclick = function() {
switchTabModal(false)
}
switchTabModal(false);
};
// 关闭tips弹窗
tipsModal.onclick = function() {
tipsModal.style.display = 'none'
}
tipsModal.style.display = 'none';
};
$mas.restful(url, {
userid,
appKey,
appKey
})
.then(({
data
}) => {
console.log('restful>>',url, data)
console.log('restful>>', url, data);
render(data);
return data;
})
.catch(e => {});
.catch(e => {
});
// 获取头像
$mas.getData(configuration.baseUrl + configuration.methods.photo, {
uid: _uid,
appKey,
appKey
})
.then(data => {
if (data && data.code && data.data) {
......@@ -304,7 +328,7 @@ function openPhoto() {
var options = {
// optionName: 'option value'
// for example:
index: 0, // start at first slide
index: 0 // start at first slide
};
// Initializes and opens PhotoSwipe
......@@ -343,7 +367,7 @@ function render(data) {
// 社会关系
familyVoList: configuration.renderItem.familyVoList,
// 奖惩信息
rewardPunishVoList: configuration.renderItem.rewardPunishVoList,
rewardPunishVoList: configuration.renderItem.rewardPunishVoList
};
for (let r in RENDER_ITEM) {
if (data[r]) {
......@@ -362,7 +386,7 @@ function render(data) {
jobVoList: configuration.renderItem.jobVoList,
jobHistoryVoList: configuration.renderItem.jobHistoryVoList,
assessVoList: configuration.renderItem.assessVoList,
rewardPunishVoList: configuration.renderItem.rewardPunishVoList,
rewardPunishVoList: configuration.renderItem.rewardPunishVoList
};
for (let r in RENDER_ITEM) {
......@@ -393,9 +417,9 @@ function render(data) {
// 绩效信息
assessVoList: configuration.renderItem.assessVoList,
//奖惩
rewardPunishVoList: configuration.renderItem.rewardPunishVoList,
rewardPunishVoList: configuration.renderItem.rewardPunishVoList
};
console.log('房开人员',RENDER_ITEM)
console.log('房开人员', RENDER_ITEM);
// // showToast('房开人员');
for (let r in RENDER_ITEM) {
if (data[r]) {
......@@ -414,7 +438,7 @@ function render(data) {
// }
// }
//旧版绩效
console.log('data[r]',data[r])
console.log('data[r]', data[r]);
let dataArr = filter(r, data[r]);
if (!dataArr) {
continue;
......@@ -488,9 +512,9 @@ function headerRenderer(data) {
}
function itemRenderer(title, value, extra = '') {
return `<div class="item__content ${extra}">
<div class="item__content-title bbd">${title}</div>
<div class="item__content-value bbd">${value}</div>
return `<div class='item__content ${extra}'>
<div class='item__content-title bbd'>${title}</div>
<div class='item__content-value bbd'>${value}</div>
</div>`;
}
......@@ -541,9 +565,9 @@ function propertyHeaderRenderer(data) {
}
function propertyItemRenderer(title, value, extra = '') {
return `<div class="item__content ${extra}">
<div class="item__content-title bbd">${title}</div>
<div class="item__content-value bbd">${value}</div>
return `<div class='item__content ${extra}'>
<div class='item__content-title bbd'>${title}</div>
<div class='item__content-value bbd'>${value}</div>
</div>`;
}
......@@ -608,12 +632,12 @@ function listBRenderer(list, data) {
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">${
`<div class='item_main'><div class='item__content work'>${
item[list.title] || '无'
}</div>` +
itemRenderer(
`<p class="item__content-sub-title">${sub}</p>`,
`<p class="item__content-note">${t1}${nowOrNot(
`<p class='item__content-sub-title'>${sub}</p>`,
`<p class='item__content-note'>${t1}${nowOrNot(
t2
)}</p>`
) +
......@@ -622,8 +646,8 @@ function listBRenderer(list, data) {
temp += itemRenderer(
`${
item[list.title]
}<p class="item__content-sub-title">${sub}</p>`,
`<p class="item__content-note">${item[note]}</p>`
}<p class='item__content-sub-title'>${sub}</p>`,
`<p class='item__content-note'>${item[note]}</p>`
);
}
});
......@@ -665,7 +689,7 @@ function listCRenderer(list, data) {
});
temp += itemRenderer(
`${item[list.title]}
<p class="item__content-sub-title">${sub}</p><p class="item__content-sub-title">毕业于${
<p class='item__content-sub-title'>${sub}</p><p class='item__content-sub-title'>毕业于${
item[list.note]
}</p>`,
'',
......@@ -685,12 +709,12 @@ 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]
}<span style="float: right;padding-right:16px">${
}<span style='float: right;padding-right:16px'>${
item[list.title2]
}</span>
${sub}`,
......@@ -712,12 +736,12 @@ function listFRenderer(list, data) {
temp += itemRenderer(
`${
item[list.title]
}<span style="float: right;padding-right:16px">${
}<span style='float: right;padding-right:16px'>${
item[list.title1]
}</span>
<p class="item__content-sub-title">${
<p class='item__content-sub-title'>${
item[list.subTitle]
}<span style="float: right;padding-right:12px">${
}<span style='float: right;padding-right:12px'>${
item[list.subTitle1]
}年度</span></p>`,
'',
......@@ -754,9 +778,9 @@ let performanceTableArr = [];
function listJXRenderer(list, data) {
// console.log('员工绩效', data)
performanceArr = performanceGroups(data.assessVoList)
performanceArr = performanceGroups(data.assessVoList);
appraiseArr = appraiseGroups(data.rewardPunishVoList)
appraiseArr = appraiseGroups(data.rewardPunishVoList);
// 评优测试数据
// appraiseArr = [{
......@@ -779,73 +803,71 @@ function listJXRenderer(list, data) {
// }]
// }]
let rewardpunishArr = rewardpunishGroups(data.specialtyRewadVoList)
let rewardpunishArr = rewardpunishGroups(data.specialtyRewadVoList);
console.log('rewardpunishArr-------', rewardpunishArr);
rewardpunishArr.forEach((item) => {
if (item.state === '奖励') {
awardArr = rewardGroups(item.children, data.sakeredFlowerVoList)
awardArr = rewardGroups(item.children, data.sakeredFlowerVoList);
console.log('awardArr-------', awardArr);
} else {
punishArr = punishGroups(item.children)
punishArr = punishGroups(item.children);
}
})
});
console.log('绩效', performanceArr)
console.log('评优', appraiseArr)
console.log('绩效', performanceArr);
console.log('评优', appraiseArr);
console.log('奖励', awardArr);
console.log('处罚', punishArr);
let tmpYears = []
let tmpYears = [];
performanceArr.forEach((item, index) => {
tmpYears.push(item.year)
tmpYears.push(item.year);
if (index === 0) {
performanceSelected = item.year
performanceSelected = item.year;
}
})
});
appraiseArr.forEach((item) => {
tmpYears.push(item.year)
appraiseMenu.push(item.year)
})
tmpYears.push(item.year);
appraiseMenu.push(item.year);
});
awardArr.forEach((item, index) => {
tmpYears.push(item.year)
tmpYears.push(item.year);
if (index === 0) {
awardMenuSelected = item.year
awardMenuSelected = item.year;
}
awardMenu.push(item.year)
})
awardMenu.push(item.year);
});
punishArr.forEach((item, index) => {
tmpYears.push(item.year)
tmpYears.push(item.year);
if (index === 0) {
punishMenuSelected = item.year
punishMenuSelected = item.year;
}
punishMenu.push(item.year)
})
punishMenu.push(item.year);
});
// 配置弹窗
setUpYGJXModal()
setUpYGJXModal();
let tmpAllYears = [...new Set(tmpYears)]
let tmpAllYears = [...new Set(tmpYears)];
let allYears = tmpAllYears.sort((a, b) => {
return b - a
})
return b - a;
});
if (allYears.length > 0) {
// 绩效显示到当前年份
let currentYear = new Date().getFullYear()
let firstYear = Number(allYears[0])
let count = currentYear - firstYear
let currentYear = new Date().getFullYear();
let firstYear = Number(allYears[0]);
let count = currentYear - firstYear;
for (var i = 1; i <= count; i++) {
allYears.unshift(`${firstYear+i}`)
allYears.unshift(`${firstYear + i}`);
}
}
let tableData = []
let tableData = [];
allYears.forEach((year) => {
// 设置空数据
let tableItem = {
......@@ -854,246 +876,246 @@ function listJXRenderer(list, data) {
performance: '/',
appraise: '/',
award: '/',
punish: '/',
}
punish: '/'
};
// 分配绩效数据
performanceArr.forEach((item) => {
if (item.year == year) {
let itemStr = JSON.stringify(item)
let textColor = getGradeColor(item.assgrade)
let itemStr = JSON.stringify(item);
let textColor = getGradeColor(item.assgrade);
tableItem.performance =
`<div data-item='${itemStr}' data-type="performance" class='${textColor}'>${item.assgrade||'/'}</div>
<div data-item='${itemStr}' data-type="performance" class='ygjx_table__grade ${textColor}'>${item.gradeNumStr||''}</div>`
`<div data-item='${itemStr}' data-type='performance' class='${textColor}'>${item.assgrade || '/'}</div>
<div data-item='${itemStr}' data-type='performance' class='ygjx_table__grade ${textColor}'>${item.gradeNumStr || ''}</div>`;
}
})
});
appraiseArr.forEach((item) => {
if (item.year == year) {
tableItem.appraise = `${item.children.length}次`
tableItem.appraise = `${item.children.length}次`;
}
})
});
awardArr.forEach((item) => {
if (item.year == year) {
if (item.children.length > 0) {
tableItem.award = `${item.children.length}次`
tableItem.award = `${item.children.length}次`;
}
}
})
});
punishArr.forEach((item) => {
if (item.year == year) {
if (item.children.length > 0) {
tableItem.punish = `${item.children.length}次`
tableItem.punish = `${item.children.length}次`;
}
}
})
tableData.push(tableItem)
})
});
tableData.push(tableItem);
});
let bgBox = document.createElement('div')
bgBox.classList.add('ygjx_bg_box')
let bgBox = document.createElement('div');
bgBox.classList.add('ygjx_bg_box');
if (tableData && tableData.length) {
let hintMoreNode = document.createElement('div')
hintMoreNode.classList.add('hint_more')
let hintMoreNode = document.createElement('div');
hintMoreNode.classList.add('hint_more');
hintMoreNode.innerHTML = `<div></div>
<div>左右滑动,查看更多数据</div>
<div></div>`
bgBox.appendChild(hintMoreNode)
<div></div>`;
bgBox.appendChild(hintMoreNode);
let ygjxTableBox = document.createElement('div')
ygjxTableBox.classList.add('ygjx_table_box')
let ygjxTableBox = document.createElement('div');
ygjxTableBox.classList.add('ygjx_table_box');
let ygjxTable = document.createElement('table')
ygjxTable.classList.add('ygjx_table')
let ygjxTable = document.createElement('table');
ygjxTable.classList.add('ygjx_table');
// ygjxTable.border = '1'
//表格点击事件处理
ygjxTable.onclick = function(e) {
// console.log(e.target);
let dataset = e.target.dataset
let dataset = e.target.dataset;
if (dataset.tips) { // 提示弹窗显示
tipsModal.style.display = "block";
tipsModal.style.display = 'block';
} else if (dataset.type) { //
let tabIndex = 0
let tabIndex = 0;
if (dataset.item) {
let item = JSON.parse(dataset.item)
let text = item[dataset.type]
let item = JSON.parse(dataset.item);
let text = item[dataset.type];
if (text === '/') {
return
return;
} else {
if (dataset.type === 'performance') {
console.log('performanceSelected', performanceSelected);
performanceSelected = item.year
tabIndex = 0
performanceSelectedUpdate(true)
performanceSelected = item.year;
tabIndex = 0;
performanceSelectedUpdate(true);
}
if (dataset.type === 'appraise') { // 评优
appraiseMenuSelected = '全部'
tabIndex = 1
modalPYTabView()
appraiseMenuSelected = '全部';
tabIndex = 1;
modalPYTabView();
}
if (dataset.type === 'award') {
awardMenuSelected = '全部' //item.year
tabIndex = 2
modalJLTabView()
awardMenuSelected = '全部'; //item.year
tabIndex = 2;
modalJLTabView();
}
if (dataset.type === 'punish') {
punishMenuSelected = '全部' //item.year
tabIndex = 3
modalCFTabView()
punishMenuSelected = '全部'; //item.year
tabIndex = 3;
modalCFTabView();
}
}
}
switchTabModal(true)
modalDidSelectedIndex(tabIndex)
switchTabModal(true);
modalDidSelectedIndex(tabIndex);
}
}
let colsWidth = 50
let tableWidth = document.body.clientWidth - colsWidth - 10 * 2 - 28
let itemWidth = tableWidth / 2 - 10 * 2
let tr1 = document.createElement('tr')
let tr2 = document.createElement('tr')
let tr3 = document.createElement('tr')
let tr4 = document.createElement('tr')
let tr5 = document.createElement('tr')
let colstd1 = document.createElement('td')
let colstd2 = document.createElement('td')
let colstd3 = document.createElement('td')
let colstd4 = document.createElement('td')
let colstd5 = document.createElement('td')
colstd1.classList.add('cols')
colstd2.classList.add('cols')
colstd3.classList.add('cols')
colstd4.classList.add('cols')
colstd5.classList.add('cols')
colstd1.style.minWidth = `${colsWidth}px`
colstd2.style.minWidth = `${colsWidth}px`
colstd3.style.minWidth = `${colsWidth}px`
colstd4.style.minWidth = `${colsWidth}px`
colstd5.style.minWidth = `${colsWidth}px`
};
colstd1.style.width = `${colsWidth}px`
colstd2.style.width = `${colsWidth}px`
colstd3.style.width = `${colsWidth}px`
colstd4.style.width = `${colsWidth}px`
colstd5.style.width = `${colsWidth}px`
let colsWidth = 50;
let tableWidth = document.body.clientWidth - colsWidth - 10 * 2 - 28;
let itemWidth = tableWidth / 2 - 10 * 2;
let tr1 = document.createElement('tr');
let tr2 = document.createElement('tr');
let tr3 = document.createElement('tr');
let tr4 = document.createElement('tr');
let tr5 = document.createElement('tr');
let colstd1 = document.createElement('td');
let colstd2 = document.createElement('td');
let colstd3 = document.createElement('td');
let colstd4 = document.createElement('td');
let colstd5 = document.createElement('td');
colstd1.classList.add('cols');
colstd2.classList.add('cols');
colstd3.classList.add('cols');
colstd4.classList.add('cols');
colstd5.classList.add('cols');
colstd1.style.minWidth = `${colsWidth}px`;
colstd2.style.minWidth = `${colsWidth}px`;
colstd3.style.minWidth = `${colsWidth}px`;
colstd4.style.minWidth = `${colsWidth}px`;
colstd5.style.minWidth = `${colsWidth}px`;
colstd1.style.width = `${colsWidth}px`;
colstd2.style.width = `${colsWidth}px`;
colstd3.style.width = `${colsWidth}px`;
colstd4.style.width = `${colsWidth}px`;
colstd5.style.width = `${colsWidth}px`;
colstd2.innerHTML = `
<div class="js__box">绩效
<div data-tips=${1} class="icon__help"></div>
<div class='js__box'>绩效
<div data-tips='${1}' class='icon__help'></div>
</div>
`
colstd3.innerHTML = `<div>评优</div>`
colstd4.innerHTML = `<div>奖励</div>`
colstd5.innerHTML = `<div>处罚</div>`
`;
colstd3.innerHTML = `<div>评优</div>`;
colstd4.innerHTML = `<div>奖励</div>`;
colstd5.innerHTML = `<div>处罚</div>`;
tr1.appendChild(colstd1)
tr2.appendChild(colstd2)
tr3.appendChild(colstd3)
tr4.appendChild(colstd4)
tr5.appendChild(colstd5)
tr1.appendChild(colstd1);
tr2.appendChild(colstd2);
tr3.appendChild(colstd3);
tr4.appendChild(colstd4);
tr5.appendChild(colstd5);
tableData.forEach((item, index) => {
// if (index >= 1) {
// return
// }
let td1 = document.createElement('td')
let td2 = document.createElement('td')
let td3 = document.createElement('td')
let td4 = document.createElement('td')
let td5 = document.createElement('td')
td1.style.minWidth = `${itemWidth}px`
td2.style.minWidth = `${itemWidth}px`
td3.style.minWidth = `${itemWidth}px`
td4.style.minWidth = `${itemWidth}px`
td5.style.minWidth = `${itemWidth}px`
let td1 = document.createElement('td');
let td2 = document.createElement('td');
let td3 = document.createElement('td');
let td4 = document.createElement('td');
let td5 = document.createElement('td');
td1.style.minWidth = `${itemWidth}px`;
td2.style.minWidth = `${itemWidth}px`;
td3.style.minWidth = `${itemWidth}px`;
td4.style.minWidth = `${itemWidth}px`;
td5.style.minWidth = `${itemWidth}px`;
// td1.style.width = `${itemWidth}px`
// td2.style.width = `${itemWidth}px`
// td3.style.width = `${itemWidth}px`
// td4.style.width = `${itemWidth}px`
// td5.style.width = `${itemWidth}px`
let a2 = document.createElement('a')
let a3 = document.createElement('a')
let a4 = document.createElement('a')
let a5 = document.createElement('a')
a2.dataset.item = JSON.stringify(item)
a2.dataset.type = 'performance'
a2.href = `#performance${item.year}`
a3.dataset.item = JSON.stringify(item)
a3.dataset.type = 'appraise'
a3.href = `#appraise${item.year}`
a4.dataset.item = JSON.stringify(item)
a4.dataset.type = 'award'
a4.href = `#award${item.year}`
a5.dataset.item = JSON.stringify(item)
a5.dataset.type = 'punish'
a5.href = `#punish${item.year}`
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]}`
td2.appendChild(a2)
td3.appendChild(a3)
td4.appendChild(a4)
td5.appendChild(a5)
tr1.appendChild(td1)
tr2.appendChild(td2)
tr3.appendChild(td3)
tr4.appendChild(td4)
tr5.appendChild(td5)
})
ygjxTable.appendChild(tr1)
let a2 = document.createElement('a');
let a3 = document.createElement('a');
let a4 = document.createElement('a');
let a5 = document.createElement('a');
a2.dataset.item = JSON.stringify(item);
a2.dataset.type = 'performance';
a2.href = `#performance${item.year}`;
a3.dataset.item = JSON.stringify(item);
a3.dataset.type = 'appraise';
a3.href = `#appraise${item.year}`;
a4.dataset.item = JSON.stringify(item);
a4.dataset.type = 'award';
a4.href = `#award${item.year}`;
a5.dataset.item = JSON.stringify(item);
a5.dataset.type = 'punish';
a5.href = `#punish${item.year}`;
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]}`;
td2.appendChild(a2);
td3.appendChild(a3);
td4.appendChild(a4);
td5.appendChild(a5);
tr1.appendChild(td1);
tr2.appendChild(td2);
tr3.appendChild(td3);
tr4.appendChild(td4);
tr5.appendChild(td5);
});
ygjxTable.appendChild(tr1);
// if (performanceArr.length > 0) {
ygjxTable.appendChild(tr2)
ygjxTable.appendChild(tr2);
// }
// if (appraiseArr.length > 0) {
ygjxTable.appendChild(tr3)
ygjxTable.appendChild(tr3);
// }
// if (awardArr.length > 0) {
ygjxTable.appendChild(tr4)
ygjxTable.appendChild(tr4);
// }
// if (punishArr.length > 0) {
ygjxTable.appendChild(tr5)
ygjxTable.appendChild(tr5);
// }
ygjxTableBox.appendChild(ygjxTable)
bgBox.appendChild(ygjxTableBox)
ygjxTableBox.appendChild(ygjxTable);
bgBox.appendChild(ygjxTableBox);
setTimeout(() => {
createIScroller()
}, 300)
createIScroller();
}, 300);
} else {
bgBox.innerHTML = noDataRenderer();
}
return bgBox
return bgBox;
}
function switchTabModal(on) {
if (on) {
tabModal.style.display = "block"
tabModal.style.display = 'block';
if (container.classList.contains('container__scrolling')) {
container.classList.remove('container__scrolling')
container.classList.remove('container__scrolling');
}
} else {
tabModal.style.display = 'none'
tabModal.style.display = 'none';
if (!container.classList.contains('container__scrolling')) {
container.classList.add('container__scrolling')
container.classList.add('container__scrolling');
}
}
}
......@@ -1101,93 +1123,94 @@ function switchTabModal(on) {
// 设置员工绩效弹窗
function setUpYGJXModal() {
let modalHeader = document.querySelector('.modal__header')
let modalHeader = document.querySelector('.modal__header');
// 设置头部tab选择
let tabBox = document.createElement('div')
tabBox.classList.add('modal__tab__box')
let tabBox = document.createElement('div');
tabBox.classList.add('modal__tab__box');
let tabHTML = ''
let tabHTML = '';
// if (performanceArr.length > 0) {
tabHTML += '<li data-index="0" class="modal__tab__active">绩效</li>'
tabHTML += '<li data-index="0" class="modal__tab__active">绩效</li>';
// }
// if (appraiseArr.length > 0) {
tabHTML += '<li data-index="1">评优</li>'
tabHTML += '<li data-index="1">评优</li>';
// }
// if (awardArr.length > 0) {
tabHTML += '<li data-index="2">奖励</li>'
tabHTML += '<li data-index="2">奖励</li>';
// }
// if (punishArr.length > 0) {
tabHTML += '<li data-index="3">处罚</li>'
tabHTML += '<li data-index="3">处罚</li>';
// }
tabBox.innerHTML = `<ul>${tabHTML}</ul>`
tabBox.innerHTML = `<ul>${tabHTML}</ul>`;
tabBox.onclick = function(e) {
let tabIndex = Number(e.target.dataset.index)
let tabIndex = Number(e.target.dataset.index);
if (isNaN(tabIndex)) {
return
return;
}
modalDidSelectedIndex(tabIndex)
}
modalHeader.appendChild(tabBox)
modalDidSelectedIndex(tabIndex);
};
modalHeader.appendChild(tabBox);
let yearBox = document.createElement('div')
yearBox.classList.add('year__box')
let yearBox = document.createElement('div');
yearBox.classList.add('year__box');
yearBox.onclick = function(e) {
// console.log('yearBox onclick', e.target.dataset);
let dropdownBox = document.querySelector('.dropdown__content')
let dropdownBox = document.querySelector('.dropdown__content');
if (dropdownBox.style.display == 'block') {
dropdownBox.style.display = 'none'
dropdownBox.style.display = 'none';
} else {
dropdownBox.style.display = 'block'
dropdownBox.style.display = 'block';
}
let dataset = e.target.dataset
let dataset = e.target.dataset;
if (dataset.type && dataset.item) {
let selecedMenu = document.querySelector('.seleced_menu')
selecedMenu.innerText = dataset.item
let selecedMenu = document.querySelector('.seleced_menu');
selecedMenu.innerText = dataset.item;
if (dataset.type === '1') {
appraiseMenuSelected = dataset.item
modalPYTabView()
appraiseMenuSelected = dataset.item;
modalPYTabView();
}
if (dataset.type === '2') {
awardMenuSelected = dataset.item
modalJLTabView()
awardMenuSelected = dataset.item;
modalJLTabView();
}
if (dataset.type === '3') {
punishMenuSelected = dataset.item
modalCFTabView()
punishMenuSelected = dataset.item;
modalCFTabView();
}
}
}
modalHeader.appendChild(yearBox)
};
modalHeader.appendChild(yearBox);
// 设置各个标签内容
modalJXTabView()
modalPYTabView()
modalJLTabView()
modalCFTabView()
modalJXTabView();
modalPYTabView();
modalJLTabView();
modalCFTabView();
}
// 弹窗标签选择
function modalDidSelectedIndex(index) {
let tabBox = document.querySelector('.modal__tab__box')
let lis = tabBox.getElementsByTagName('li')
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")
lis[i].classList.remove('modal__tab__active');
if (Number(lis[i].dataset.index) === index) {
lis[i].classList.add("modal__tab__active")
lis[i].classList.add('modal__tab__active');
}
}
// console.log('modalDidSelectedIndex', index)
let jxTabView = document.querySelector('.modal__jx__view')
let pyTabView = document.querySelector('.modal__py__view')
let jlTabView = document.querySelector('.modal__jl__view')
let cfTabView = document.querySelector('.modal__cf__view')
let jxTabView = document.querySelector('.modal__jx__view');
let pyTabView = document.querySelector('.modal__py__view');
let jlTabView = document.querySelector('.modal__jl__view');
let cfTabView = document.querySelector('.modal__cf__view');
let yearBox = document.querySelector('.year__box')
let yearBox = document.querySelector('.year__box');
// console.log('yearBox', yearBox);
yearBox.style.display = 'none';
......@@ -1197,395 +1220,399 @@ function modalDidSelectedIndex(index) {
cfTabView.style.display = 'none';
if (0 === index) {
jxTabView.style.display = 'block';
jxTabView.scrollTop = 0
jxTabView.scrollTop = 0;
} else if (1 === index) {
pyTabView.style.display = 'block';
pyTabView.scrollTop = 0
pyTabView.scrollTop = 0;
// 设置下拉菜单
if (appraiseMenu.length > 1) {
let menus = ``
let menus = ``;
appraiseMenu.forEach((item) => {
menus += `<div data-type='${index}' data-item='${item}'>${item}</div>`
})
yearBox.innerHTML = `<div class="seleced_menu">${appraiseMenuSelected}</div><div class="year__down"></div>
<div class="dropdown__content">${menus}</div>`
menus += `<div data-type='${index}' data-item='${item}'>${item}</div>`;
});
yearBox.innerHTML = `<div class='seleced_menu'>${appraiseMenuSelected}</div><div class='year__down'></div>
<div class='dropdown__content'>${menus}</div>`;
yearBox.style.display = 'inline-block';
}
} else if (2 === index) {
jlTabView.style.display = 'block';
jlTabView.scrollTop = 0
jlTabView.scrollTop = 0;
// 设置下拉菜单
if (awardMenu.length > 1) {
let menus = ``
let menus = ``;
awardMenu.forEach((item) => {
menus += `<div data-type='${index}' data-item='${item}'>${item}</div>`
})
yearBox.innerHTML = `<div class="seleced_menu">${awardMenuSelected}</div><div class="year__down"></div>
<div class="dropdown__content">${menus}</div>`
menus += `<div data-type='${index}' data-item='${item}'>${item}</div>`;
});
yearBox.innerHTML = `<div class='seleced_menu'>${awardMenuSelected}</div><div class='year__down'></div>
<div class='dropdown__content'>${menus}</div>`;
yearBox.style.display = 'inline-block';
}
} else if (3 === index) {
cfTabView.style.display = 'block';
cfTabView.scrollTop = 0
cfTabView.scrollTop = 0;
// 设置下拉菜单
if (punishMenu.length > 1) {
let menus = ``
let menus = ``;
punishMenu.forEach((item) => {
menus += `<div data-type='${index}' data-item='${item}'>${item}</div>`
})
yearBox.innerHTML = `<div class="seleced_menu">${punishMenuSelected}</div><div class="year__down"></div>
<div class="dropdown__content">${menus}</div>`
menus += `<div data-type='${index}' data-item='${item}'>${item}</div>`;
});
yearBox.innerHTML = `<div class='seleced_menu'>${punishMenuSelected}</div><div class='year__down'></div>
<div class='dropdown__content'>${menus}</div>`;
yearBox.style.display = 'inline-block';
}
}
}
// 弹窗-绩效-标签页
function modalJXTabView() {
let jxTabView = document.querySelector('.modal__jx__view')
let jxTabView = document.querySelector('.modal__jx__view');
if (!jxTabView) {
jxTabView = document.createElement('div')
jxTabView.classList.add('modal__tab__view')
jxTabView.classList.add('modal__jx__view')
jxTabView = document.createElement('div');
jxTabView.classList.add('modal__tab__view');
jxTabView.classList.add('modal__jx__view');
let modalBody = document.querySelector('.modal__body')
modalBody.appendChild(jxTabView)
let modalBody = document.querySelector('.modal__body');
modalBody.appendChild(jxTabView);
// 设置选中状态
modalBody.onclick = function(e) {
let year = e.target.dataset.year
let year = e.target.dataset.year;
if (!year) {
return
}
performanceSelected = year
performanceSelectedUpdate()
return;
}
performanceSelected = year;
performanceSelectedUpdate();
};
}
let sectionHtml = ``
let sectionHtml = ``;
if (performanceArr && performanceArr.length) {
performanceArr.forEach((item, index) => {
let subSectionHtml = ``
let subSectionHtml = ``;
item.children.forEach((childItem, childInde) => {
subSectionHtml += `<li>
<div class="section__content_month">
<div class='section__content_month'>
${childItem.asstype}
</div>
<div class='section__content_grade ${getGradeColor(childItem.assgrade)}'>
${childItem.assgrade}
</div>
</li>`
})
</li>`;
});
sectionHtml += `<li>
<div id=performance${item.assyear} class="section__title" data-year="${item.assyear}">
<div class="section__title_left" data-year="${item.assyear}">
<div data-year="${item.assyear}"></div>
<div data-year="${item.assyear}">
<div id='performance${item.assyear}' class='section__title' data-year='${item.assyear}'>
<div class='section__title_left' data-year='${item.assyear}'>
<div data-year='${item.assyear}'></div>
<div data-year='${item.assyear}'>
${item.assyear}
</div>
</div>
<div class='section__title_right ${getGradeColor(item.assgrade)}' data-year="${item.assyear}">
${item.assgrade}${item.gradeNumStr||''}
<div class='section__title_right ${getGradeColor(item.assgrade)}' data-year='${item.assyear}'>
${item.assgrade}${item.gradeNumStr || ''}
</div>
</div>
<ul>
${subSectionHtml}
</ul>
</li>`
</li>`;
})
jxTabView.innerHTML = `<ul>${sectionHtml}</ul>`
});
jxTabView.innerHTML = `<ul>${sectionHtml}</ul>`;
} else {
jxTabView.innerHTML = noDataRenderer()
jxTabView.innerHTML = noDataRenderer();
}
}
function performanceSelectedUpdate(init) {
// console.log('performanceSelectedUpdate', init);
if (init) {
performanceArr.forEach((item, i) => {
let section = document.querySelector(`.modal__jx__view>ul>li:nth-child(${i+1})`)
let img = section.querySelector('.section__title .section__title_left div:first-child')
let subSection = section.querySelector('ul')
subSection.style.display = 'none'
let section = document.querySelector(`.modal__jx__view>ul>li:nth-child(${i + 1})`);
let img = section.querySelector('.section__title .section__title_left div:first-child');
let subSection = section.querySelector('ul');
subSection.style.display = 'none';
if (img.classList.contains('icon_02_img')) {
img.classList.remove('icon_02_img')
img.classList.remove('icon_02_img');
}
if (img.classList.contains('icon_01_img')) {
img.classList.remove('icon_01_img')
img.classList.remove('icon_01_img');
}
if (item.children.length > 0) {
img.classList.add('icon_01_img')
img.classList.add('icon_01_img');
if (item.year == performanceSelected) {
subSection.style.display = 'block'
img.classList.remove('icon_01_img')
img.classList.add('icon_02_img')
subSection.style.display = 'block';
img.classList.remove('icon_01_img');
img.classList.add('icon_02_img');
}
}
})
});
} else {
performanceArr.forEach((item, i) => {
if (item.year == performanceSelected) {
let section = document.querySelector(`.modal__jx__view>ul>li:nth-child(${i+1})`)
let img = section.querySelector('.section__title .section__title_left div:first-child')
let section = document.querySelector(`.modal__jx__view>ul>li:nth-child(${i + 1})`);
let img = section.querySelector('.section__title .section__title_left div:first-child');
// console.log('performanceArr', performanceArr);
if (item.children.length > 0) {
if (img.classList.contains('icon_02_img')) {
img.classList.remove('icon_02_img')
img.classList.add('icon_01_img')
img.classList.remove('icon_02_img');
img.classList.add('icon_01_img');
} else {
img.classList.remove('icon_01_img')
img.classList.add('icon_02_img')
img.classList.remove('icon_01_img');
img.classList.add('icon_02_img');
}
}
let subSection = section.querySelector('ul')
let subSection = section.querySelector('ul');
if (subSection.style.display == 'none') {
subSection.style.display = 'block'
subSection.style.display = 'block';
} else {
subSection.style.display = 'none'
subSection.style.display = 'none';
}
}
})
});
}
}
function getGradeColor(grade) {
let textColor = ''
let textColor = '';
if (grade &&
(grade.indexOf('良好') !== -1 ||
grade.indexOf('B') !== -1)) {
textColor = 'grade__greed'
textColor = 'grade__greed';
} else if (grade &&
(grade.indexOf('优秀') !== -1 ||
grade.indexOf('A') !== -1)) {
textColor = 'grade__red'
textColor = 'grade__red';
}
return textColor
return textColor;
}
// 弹窗-评优-标签页
function modalPYTabView() {
let pyTabView = document.querySelector('.modal__py__view')
let pyTabView = document.querySelector('.modal__py__view');
if (!pyTabView) {
pyTabView = document.createElement('div')
pyTabView.classList.add('modal__tab__view')
pyTabView.classList.add('modal__py__view')
pyTabView = document.createElement('div');
pyTabView.classList.add('modal__tab__view');
pyTabView.classList.add('modal__py__view');
let modalBody = document.querySelector('.modal__body')
modalBody.appendChild(pyTabView)
let modalBody = document.querySelector('.modal__body');
modalBody.appendChild(pyTabView);
}
if (appraiseArr.length == 0) {
pyTabView.innerHTML = noDataRenderer()
return
pyTabView.innerHTML = noDataRenderer();
return;
}
let data = JSON.parse(JSON.stringify(appraiseArr))
let data = JSON.parse(JSON.stringify(appraiseArr));
if (appraiseMenuSelected != '全部') {
data = data.filter((item => item.year === appraiseMenuSelected))
data = data.filter((item => item.year === appraiseMenuSelected));
}
let sectionHtml = ``
let sectionHtml = ``;
if (data && data.length) {
data.forEach((item, index) => {
let subSectionHtml = ``
let subSectionHtml = ``;
item.children.forEach((childItem) => {
subSectionHtml += `<li>
<div> ${childItem.content} </div>
<div> ${childItem.company} </div>
</li>`
})
sectionHtml += `<li style="margin-bottom: 15px;">
<div id=appraise${item.year} class="section__title" data-index="${index}" style="padding: 9px 12px;">
</li>`;
});
sectionHtml += `<li style='margin-bottom: 15px;'>
<div id='appraise${item.year}' class='section__title' data-index='${index}' style='padding: 9px 12px;'>
${item.year}
</div>
<ul>
${subSectionHtml}
</ul>
</li>`
</li>`;
})
});
}
pyTabView.innerHTML = `<ul>${sectionHtml}</ul>`
pyTabView.innerHTML = `<ul>${sectionHtml}</ul>`;
}
// 弹窗-奖励-标签页
function modalJLTabView(index = 0) {
let jlTabView = document.querySelector('.modal__jl__view')
let jlTabView = document.querySelector('.modal__jl__view');
if (!jlTabView) {
jlTabView = document.createElement('div')
jlTabView.classList.add('modal__tab__view')
jlTabView.classList.add('modal__jl__view')
jlTabView = document.createElement('div');
jlTabView.classList.add('modal__tab__view');
jlTabView.classList.add('modal__jl__view');
let modalBody = document.querySelector('.modal__body')
modalBody.appendChild(jlTabView)
let modalBody = document.querySelector('.modal__body');
modalBody.appendChild(jlTabView);
}
if (awardArr.length == 0) {
jlTabView.innerHTML = noDataRenderer()
return
jlTabView.innerHTML = noDataRenderer();
return;
}
let data = JSON.parse(JSON.stringify(awardArr))
let data = JSON.parse(JSON.stringify(awardArr));
if (awardMenuSelected != '全部') {
data = data.filter((item => item.year === awardMenuSelected))
data = data.filter((item => item.year === awardMenuSelected));
}
let sectionHtml = ``
let sectionHtml = ``;
if (data && data.length) {
data.forEach((itemData, index) => {
let subSectionHtml = ``
let subSectionHtml = ``;
if (itemData.annualRanking.list.length > 0) {
let itemHtml = ``
let itemHtml = ``;
itemData.annualRanking.list.forEach((item, index) => {
itemHtml += `<div style="padding:4px 8px"> ${item} </div>`
})
itemHtml += `<div style='padding:4px 8px'> ${item} </div>`;
});
subSectionHtml += `<li>
<div class="rewardpunish__section"><div class="icon__liststyle"></div> ${itemData.annualRanking.title} </div>
<div class='rewardpunish__section'><div class='icon__liststyle'></div> ${itemData.annualRanking.title} </div>
${itemHtml}
</li>`
</li>`;
}
if (itemData.annualAward.list.length > 0) {
let itemHtml = ``
let itemHtml = ``;
itemData.annualAward.list.forEach((item, index) => {
itemHtml += `<div class="rewardpunish__tiem">
itemHtml += `<div class='rewardpunish__tiem'>
<div >
<div>${itemData.year}${item.awards}</div>
<div>${item.project}</div>
</div>
<div>评定单位:${item.publish}</div>
</div>`
})
</div>`;
});
subSectionHtml += `<li>
<div class="rewardpunish__section"><div class="icon__liststyle"></div> ${itemData.annualAward.title} </div>
<div class='rewardpunish__section'><div class='icon__liststyle'></div> ${itemData.annualAward.title} </div>
${itemHtml}
</li>`
</li>`;
}
if (itemData.dailyAward.list.length > 0) {
let itemHtml = ``
let itemHtml = ``;
itemData.dailyAward.list.forEach((item, index) => {
itemHtml += `<div class="daily__section"><div class="daily__mark2"></div> ${item.title} </div>`
itemHtml += `<div class='daily__section'><div class='daily__mark2'></div> ${item.title} </div>`;
if (item.children) {
item.children.forEach((itemChild) => {
itemHtml += `<div class="daily__item">
itemHtml += `<div class='daily__item'>
<div>${itemChild.rewardpunish} </div>
<div>${itemChild.rewardunit||''} </div>
</div>`
})
<div>${itemChild.rewardunit || ''} </div>
</div>`;
});
}
})
});
subSectionHtml += `<li>
<div class="rewardpunish__section"><div class="icon__liststyle"></div> ${itemData.dailyAward.title} </div>
<div class='rewardpunish__section'><div class='icon__liststyle'></div> ${itemData.dailyAward.title} </div>
${itemHtml}
</li>`
</li>`;
}
sectionHtml += `<li style="margin-bottom: 15px;">
<div id="award${itemData.year}" class="section__title" style="padding: 9px 12px;">
sectionHtml += `<li style='margin-bottom: 15px;'>
<div id='award${itemData.year}' class='section__title' style='padding: 9px 12px;'>
${itemData.year}
</div>
<ul>
${subSectionHtml}
</ul>
</li>`
</li>`;
})
});
}
jlTabView.innerHTML = `<ul>${sectionHtml}</ul>`
jlTabView.innerHTML = `<ul>${sectionHtml}</ul>`;
}
// 弹窗-处罚-标签页
function modalCFTabView() {
let cfTabView = document.querySelector('.modal__cf__view')
let cfTabView = document.querySelector('.modal__cf__view');
if (!cfTabView) {
cfTabView = document.createElement('div')
cfTabView.classList.add('modal__tab__view')
cfTabView.classList.add('modal__cf__view')
let modalBody = document.querySelector('.modal__body')
modalBody.appendChild(cfTabView)
cfTabView = document.createElement('div');
cfTabView.classList.add('modal__tab__view');
cfTabView.classList.add('modal__cf__view');
let modalBody = document.querySelector('.modal__body');
modalBody.appendChild(cfTabView);
}
if (punishArr.length == 0) {
cfTabView.innerHTML = noDataRenderer()
return
cfTabView.innerHTML = noDataRenderer();
return;
}
let data = JSON.parse(JSON.stringify(punishArr))
let data = JSON.parse(JSON.stringify(punishArr));
if (punishMenuSelected != '全部') {
data = data.filter((item => item.year === punishMenuSelected))
data = data.filter((item => item.year === punishMenuSelected));
}
let sectionHtml = ``
let sectionHtml = ``;
if (data && data.length) {
data.forEach((itemData, index) => {
let subSectionHtml = ``
let subSectionHtml = ``;
if (itemData.annualPunish.list.length > 0) {
let itemHtml = ``
let itemHtml = ``;
itemData.annualPunish.list.forEach((item, index) => {
itemHtml += `<div class="rewardpunish__tiem">
itemHtml += `<div class='rewardpunish__tiem'>
<div >
<div>${itemData.year}${item.awards}</div>
<div>${item.project}</div>
</div>
<div>评定单位:${item.publish}</div>
</div>`
})
</div>`;
});
subSectionHtml += `<li>
<div class="rewardpunish__section"><div class="icon__liststyle"></div> ${itemData.annualPunish.title} </div>
<div class='rewardpunish__section'><div class='icon__liststyle'></div> ${itemData.annualPunish.title} </div>
${itemHtml}
</li>`
</li>`;
}
if (itemData.dailyPunish.list.length > 0) {
let itemHtml = ``
let itemHtml = ``;
itemData.dailyPunish.list.forEach((item, index) => {
itemHtml += `<div class="daily__section"><div class="daily__mark2"></div> ${item.title} </div>`
itemHtml += `<div class='daily__section'><div class='daily__mark2'></div> ${item.title} </div>`;
if (item.children) {
item.children.forEach((itemChild) => {
itemHtml += `<div class="daily__item">
itemHtml += `<div class='daily__item'>
<div>${itemChild.rewardpunish} </div>
<div>${itemChild.rewardunit||''} </div>
</div>`
})
<div>${itemChild.rewardunit || ''} </div>
</div>`;
});
}
})
});
subSectionHtml += `<li>
<div class="rewardpunish__section"><div class="icon__liststyle"></div> ${itemData.dailyPunish.title} </div>
<div class='rewardpunish__section'><div class='icon__liststyle'></div> ${itemData.dailyPunish.title} </div>
${itemHtml}
</li>`
</li>`;
}
sectionHtml += `<li style="margin-bottom: 15px;">
<div id=punish${itemData.year} class="section__title" style="padding: 9px 12px;">
sectionHtml += `<li style='margin-bottom: 15px;'>
<div id='punish${itemData.year}' class='section__title' style='padding: 9px 12px;'>
${itemData.year}
</div>
<ul>
${subSectionHtml}
</ul>
</li>`
</li>`;
})
});
}
cfTabView.innerHTML = `<ul>${sectionHtml}</ul>`
cfTabView.innerHTML = `<ul>${sectionHtml}</ul>`;
}
// 绩效数据分组
function performanceGroups(arr) {
let map = {},
......@@ -1596,7 +1623,7 @@ function performanceGroups(arr) {
dest.push({
year: ai.assyear,
assyear: ai.assyear,
children: [ai],
children: [ai]
});
map[ai.assyear] = ai;
} else {
......@@ -1610,50 +1637,50 @@ function performanceGroups(arr) {
}
}
dest = dest.sort((a, b) => {
return b.year - a.year
})
return b.year - a.year;
});
// 设置父级字段
dest.forEach((item) => {
item['assgrade'] = ''
item['gradeNumStr'] = ''
console.log(item.children)
let childrenList = [...item.children]
item['assgrade'] = '';
item['gradeNumStr'] = '';
console.log(item.children);
let childrenList = [...item.children];
let tmpList = []
let tmpList = [];
childrenList.forEach((childItem, index) => {
// console.log(childItem)
if (childItem.asstype == '年度') {
item['assgrade'] = childItem.assgrade
item['assgrade'] = childItem.assgrade;
// 年度子项中不显示
return
return;
}
let month = Number(childItem.assendtime.substr(5, 2))
if (childItem.asstype === "半年度") {
let month = Number(childItem.assendtime.substr(5, 2));
if (childItem.asstype === '半年度') {
if (month <= 6) {
childItem.asstype = '上半年度'
childItem.asstype = '上半年度';
} else {
childItem.asstype = '下半年度'
childItem.asstype = '下半年度';
}
} else if (childItem.asstype === "季度") {
} else if (childItem.asstype === '季度') {
// console.log(childItem);
if (month <= 3) {
childItem.asstype = '第一季度'
childItem.asstype = '第一季度';
} else if (month <= 6) {
childItem.asstype = '第二季度'
childItem.asstype = '第二季度';
} else if (month <= 9) {
childItem.asstype = '第三季度'
childItem.asstype = '第三季度';
} else {
childItem.asstype = '第四季度'
childItem.asstype = '第四季度';
}
} else if (childItem.asstype === "月度") {
childItem.asstype = `${month}月`
} else if (childItem.asstype === '月度') {
childItem.asstype = `${month}月`;
}
tmpList.push(childItem)
tmpList.push(childItem);
})
item.children = tmpList
});
item.children = tmpList;
// 统计除年度等级
let childMap = {},
......@@ -1664,7 +1691,7 @@ function performanceGroups(arr) {
childDest.push({
assgrade: ai.assgrade,
assgradenumber: Number(ai.assgradenumber),
children: [ai],
children: [ai]
});
childMap[ai.assgrade] = ai;
} else {
......@@ -1679,19 +1706,19 @@ function performanceGroups(arr) {
}
// console.log('childDest', childDest);
if (childDest.length > 0) {
childDest = childDest.sort((a, b) => a.assgradenumber - b.assgradenumber)
childDest = childDest.sort((a, b) => a.assgradenumber - b.assgradenumber);
let grades = [],
total = 0
total = 0;
childDest.forEach((item) => {
total = total + item.children.length
grades.push(`${item.children.length}${item.assgrade}`)
})
item['gradeNumStr'] = `(${grades.join('、')}/共${total}次)`
total = total + item.children.length;
grades.push(`${item.children.length}${item.assgrade}`);
});
item['gradeNumStr'] = `(${grades.join('、')}/共${total}次)`;
}
})
return dest
});
return dest;
}
function appraiseGroups(arr) {
......@@ -1702,7 +1729,7 @@ function appraiseGroups(arr) {
if (!map[ai.year]) {
dest.push({
year: ai.year,
children: [ai],
children: [ai]
});
map[ai.year] = ai;
} else {
......@@ -1716,24 +1743,24 @@ function appraiseGroups(arr) {
}
}
dest = dest.sort((a, b) => {
return b.year - a.year
})
return dest
return b.year - a.year;
});
return dest;
}
// 区分:奖励、处罚
function rewardpunishGroups(arr) {
if (!arr || arr.length == 0) {
return []
return [];
}
arr.forEach(item => {
// item.spetype === '年度专业排名' || item.spetype === '营运类奖'
if (item.spetype.indexOf("排名") != -1 || item.spetype.indexOf("奖") != -1) {
item.state = '奖励'
if (item.spetype.indexOf('排名') != -1 || item.spetype.indexOf('奖') != -1) {
item.state = '奖励';
} else {
item.state = '处罚'
item.state = '处罚';
}
})
});
let map = {},
dest = [];
for (var i = 0; i < arr.length; i++) {
......@@ -1741,7 +1768,7 @@ function rewardpunishGroups(arr) {
if (!map[ai.state]) {
dest.push({
state: ai.state,
children: [ai],
children: [ai]
});
map[ai.state] = ai;
} else {
......@@ -1754,8 +1781,9 @@ function rewardpunishGroups(arr) {
}
}
}
return dest
return dest;
}
// 奖励分组
function rewardGroups(arr, flowers) {
// 奖励分组
......@@ -1766,7 +1794,7 @@ function rewardGroups(arr, flowers) {
if (!map[ai.year]) {
dest.push({
year: ai.year,
children: [ai],
children: [ai]
});
map[ai.year] = ai;
} else {
......@@ -1780,8 +1808,8 @@ function rewardGroups(arr, flowers) {
}
}
dest = dest.sort((a, b) => {
return b.year - a.year
})
return b.year - a.year;
});
// 营销小红花按年分组
/*
let flowerMap = {},
......@@ -1817,29 +1845,29 @@ function rewardGroups(arr, flowers) {
item['annualRanking'] = {
title: '年度专项排名:',
list: []
}
};
item['annualAward'] = {
title: '年度专项奖励:',
list: []
}
};
item['dailyAward'] = {
title: '日常专项奖励:',
list: []
}
let dailyArr = []
};
let dailyArr = [];
item.children.forEach((childItem) => {
// if (Number(childItem.month) == 1) { // 年度
if (childItem.spetype.indexOf("排名") != -1) {
item.annualRanking.list.push(${childItem.ranking}`)
if (childItem.spetype.indexOf('排名') != -1) {
item.annualRanking.list.push(${childItem.ranking}`);
}
if (childItem.spetype.indexOf("奖") != -1) {
if (childItem.spetype.indexOf('奖') != -1) {
// item.annualAward.list.push(`· ${childItem.rewardpunish}`)
item.annualAward.list.push({
awards: childItem.rewardpunish, //'奖项',
project: childItem.awardunit, // '获奖项目、获奖单位',
publish: childItem.unit //'颁奖单位'
})
});
}
// }
/*
......@@ -1849,7 +1877,7 @@ function rewardGroups(arr, flowers) {
}
}
*/
})
});
/*
......@@ -1864,23 +1892,23 @@ function rewardGroups(arr, flowers) {
item.dailyAward.list = item.dailyAward.list.concat(rewardtypeGroups(dailyArr))
*/
})
return dest
});
return dest;
}
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]) {
dest.push({
title: ai.title,
rewardsort: Number(ai.rewardsort),
children: [ai],
children: [ai]
});
map[ai.title] = ai;
} else {
......@@ -1893,9 +1921,9 @@ function rewardtypeGroups(arr) {
}
}
}
dest = dest.sort((a, b) => a.rewardsort - b.rewardsort)
dest = dest.sort((a, b) => a.rewardsort - b.rewardsort);
return dest
return dest;
}
......@@ -1908,7 +1936,7 @@ function punishGroups(arr) {
if (!map[ai.year]) {
dest.push({
year: ai.year,
children: [ai],
children: [ai]
});
map[ai.year] = ai;
} else {
......@@ -1922,28 +1950,28 @@ function punishGroups(arr) {
}
}
dest = dest.sort((a, b) => {
return b.year - a.year
})
return b.year - a.year;
});
dest.forEach((item) => {
item['annualPunish'] = {
title: '年度专项处罚:',
list: []
}
};
item['dailyPunish'] = {
title: '日常专项处罚:',
list: []
}
let dailyArr = []
};
let dailyArr = [];
item.children.forEach((childItem) => {
// if (Number(childItem.month) == 1) { // 年度
if (childItem.spetype.indexOf("罚") != -1) {
if (childItem.spetype.indexOf('罚') != -1) {
// item.annualPunish.list.push(`· ${childItem.rewardpunish}`)
item.annualPunish.list.push({
awards: childItem.rewardpunish, //'奖项',
project: childItem.awardunit, // '获奖项目、获奖单位',
publish: childItem.unit //'颁奖单位'
})
});
}
// }
/*
......@@ -1954,11 +1982,11 @@ function punishGroups(arr) {
}
}
*/
})
item.dailyPunish.list = rewardtypeGroups(dailyArr)
})
});
item.dailyPunish.list = rewardtypeGroups(dailyArr);
});
return dest
return dest;
}
function changeSelect() {
......@@ -1975,20 +2003,20 @@ function listenerChange(target, clickNode, 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')
target.classList.add('icon_02_img')
sNode.style.display = 'block'
target.classList.remove('icon_01_img');
target.classList.add('icon_02_img');
sNode.style.display = 'block';
} else {
target.classList.remove('icon_02_img')
target.classList.add('icon_01_img')
sNode.style.display = 'none'
target.classList.remove('icon_02_img');
target.classList.add('icon_01_img');
sNode.style.display = 'none';
}
eleHideShrinkExtend()
eleHideShrinkExtend();
});
}
function listDRenderer(list, data) {
console.log('绩效', {list,data})
console.log('绩效', { list, data });
//旧版绩效
let temp = ``;
if (data && data.length) {
......@@ -2008,15 +2036,15 @@ function listDRenderer(list, data) {
temp += itemRenderer(
`${
item[list.title]
}<p class="item__content-sub-title">${sub}</p>`,
`<span class="item__content-note">${t1}${nowOrNot(
}<p class='item__content-sub-title'>${sub}</p>`,
`<span class='item__content-note'>${t1}${nowOrNot(
t2
)}</span>`
);
} else {
temp += itemRenderer(
`${item[list.title]}年`,
`<span class="item__content-note">${item[note]}</span>`
`<span class='item__content-note'>${item[note]}</span>`
);
}
});
......@@ -2117,12 +2145,12 @@ function propertyListBRenderer(list, data) {
let t1 = data[index][list.note[0]];
let t2 = data[index][list.note[1]];
temp +=
`<div class="item_main"><div class="item__content work">${
`<div class='item_main'><div class='item__content work'>${
item[list.title] || '无'
}</div>` +
propertyItemRenderer(
`<p class="item__content-sub-title">${sub}</p>`,
`<p class="item__content-note">${t1}${nowOrNot(
`<p class='item__content-sub-title'>${sub}</p>`,
`<p class='item__content-note'>${t1}${nowOrNot(
t2
)}</p>`
) +
......@@ -2131,8 +2159,8 @@ function propertyListBRenderer(list, data) {
temp += propertyItemRenderer(
`${
item[list.title]
}<p class="item__content-sub-title">${sub}</p>`,
`<p class="item__content-note">${item[note]}</p>`
}<p class='item__content-sub-title'>${sub}</p>`,
`<p class='item__content-note'>${item[note]}</p>`
);
}
});
......@@ -2173,7 +2201,7 @@ function propertyListCRenderer(list, data) {
});
temp += propertyItemRenderer(
`${item[list.title]}
<p class="item__content-sub-title">${sub}</p><p class="item__content-sub-title">毕业于${
<p class='item__content-sub-title'>${sub}</p><p class='item__content-sub-title'>毕业于${
item[list.note]
}</p>`,
'',
......@@ -2207,15 +2235,15 @@ function propertyListDRenderer(list, data) {
temp += propertyItemRenderer(
`${
item[list.title]
}<p class="item__content-sub-title">${sub}</p>`,
`<span class="item__content-note">${t1}${nowOrNot(
}<p class='item__content-sub-title'>${sub}</p>`,
`<span class='item__content-note'>${t1}${nowOrNot(
t2
)}</span>`
);
} else {
temp += propertyItemRenderer(
`${item[list.title]}年`,
`<span class="item__content-note">${item[note]}</span>`
`<span class='item__content-note'>${item[note]}</span>`
);
}
});
......@@ -2232,12 +2260,12 @@ 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]
}<span style="float: right;padding-right:16px">${
}<span style='float: right;padding-right:16px'>${
item[list.title2]
}</span>
${sub}`,
......@@ -2259,12 +2287,12 @@ function propertyListFRenderer(list, data) {
temp += propertyItemRenderer(
`${
item[list.title]
}<span style="float: right;padding-right:16px">${
}<span style='float: right;padding-right:16px'>${
item[list.title1]
}</span>
<p class="item__content-sub-title">${
<p class='item__content-sub-title'>${
item[list.subTitle]
}<span style="float: right;padding-right:12px">${
}<span style='float: right;padding-right:12px'>${
item[list.subTitle1]
}年度</span></p>`,
'',
......@@ -2279,11 +2307,11 @@ function propertyListFRenderer(list, data) {
}
function noDataRenderer() {
return `<div class="item__content empty">暂无数据</div>`;
return `<div class='item__content empty'>暂无数据</div>`;
}
function renderNoWrap(content, needExpand) {
console.log(23143214, needExpand)
console.log(23143214, needExpand);
let wrap = document.createElement('div');
let wrap_content = document.createElement('div');
wrap.classList.add('item__wrap');
......@@ -2295,7 +2323,7 @@ function renderNoWrap(content, needExpand) {
ctrl.id = Math.random();
ctrl.classList.add('item__content');
ctrl.classList.add('item__content-clickable');
ctrl.innerHTML = `<span class="item__wrap-control-icon">`;
ctrl.innerHTML = `<span class='item__wrap-control-icon'>`;
wrap.appendChild(ctrl);
}
return wrap;
......@@ -2314,7 +2342,7 @@ function renderWrap(content, needExpand) {
ctrl.id = Math.random();
ctrl.classList.add('item__content');
ctrl.classList.add('item__content-clickable');
ctrl.innerHTML = `<span class="item__wrap-control-icon">`;
ctrl.innerHTML = `<span class='item__wrap-control-icon'>`;
wrap.appendChild(ctrl);
}
return wrap;
......@@ -2326,7 +2354,7 @@ function renderPhoto() {
let item = {
src: photoUrl,
w: img.naturalWidth,
h: img.naturalHeight,
h: img.naturalHeight
};
img.src = photoUrl;
img.onload = function() {
......@@ -2372,6 +2400,7 @@ function getDateFormat(date) {
// let month = now.getMonth(); // 得到月份
// let date = now.getDate(); // 得到日期
}
//新版
// function filter(item, data) {
// let assessData = data;
......@@ -2405,11 +2434,11 @@ function filter(item, data) {
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='上半年度'
......@@ -2446,8 +2475,8 @@ function filter(item, data) {
// assessData = sumList
}
assessData= data.filter(i=>i.asstype==='年度')
console.log(3333,assessData)
assessData = data.filter(i => i.asstype === '年度');
console.log(3333, assessData);
}
return assessData;
......@@ -2499,7 +2528,7 @@ function wrapContent(target, clickNode, num = 3) {
}
function wrapContentShrink(target, clickNode, type, num = 3) {
console.log(535656, )
console.log(535656);
let item = target.childNodes;
let showEleHeight = 0;
for (let i = 0; i < num; i++) {
......@@ -2516,7 +2545,7 @@ function wrapContentShrink(target, clickNode, type, num = 3) {
}
target.style.transitionDuration = target.offsetHeight / 150 + 's';
clickNode.addEventListener('click', () => {
console.log(4555, target.style.height)
console.log(4555, target.style.height);
if (target.parentNode.className.indexOf('expand') === -1) {
target.parentNode.classList.toggle('expand');
target.style = '';
......@@ -2549,7 +2578,7 @@ function wrapContentExtend(target, clickNode, num = 3) {
showEleHeight += 'px';
}
}
console.log(555, target.style.height, showEleHeight, target.parentNode.className.indexOf('expand'))
console.log(555, target.style.height, showEleHeight, target.parentNode.className.indexOf('expand'));
if (target.parentNode.className.indexOf('expand') > -1) {
target.parentNode.classList.remove('expand');
target.style.height = showEleHeight;
......@@ -2560,7 +2589,7 @@ function wrapContentExtend(target, clickNode, num = 3) {
}
let scroller = null;
let Selector = "";
let Selector = '';
function createIScroller() {
Selector = '.ygjx_table_box';
......
......@@ -8,6 +8,7 @@ function doReady (fn) {
})
}
ready = true
console.log('config>>',config);
sessionStorage.setItem(config.appName, ready)
fn.apply(window)
}
......
/** 水印添加方法 */
var getPixelRatio = function(context) {
var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1;
return (window.devicePixelRatio || 1) / backingStore;
};
const setWatermarkFn = (str1, str2, isHide) => {
const id = 'waterMark';
let fs = 14; //字体大小
let len = str1.length;
let xb = len * fs;
let rt = -20 * Math.PI / 180; //旋转角度
if (document.getElementById(id) !== null) {
document.body.removeChild(document.getElementById(id));
}
const dpr = window.devicePixelRatio || 1;
console.log('dpr>>', dpr, 'drp-->>');
const can = document.createElement('canvas');
const cans = can.getContext('2d');
let ratio = getPixelRatio(cans);
can.style.border = '1px solid #f00';
// 设置canvas画布大小
can.width = Math.abs(Math.cos(rt) * xb);// 180;
console.log('对边>>', Math.abs(Math.sin(rt) * xb));
can.height = Math.abs(Math.sin(rt) * xb);//动态设置高度
// can.width = dpr * 180;
// can.height = dpr * 140;
console.log('宽高-前>>', { w: can.width, h: can.height });
console.log('can.getBoundingClientRect();>>', can.getBoundingClientRect());
can.style.width = can.width + 'px';
can.style.height = can.height + 'px';
can.width = can.width * ratio;
can.height = can.height * ratio;
console.log('宽高-后>>', { w: can.width, h: can.height });
console.log('ratio>>', ratio);
cans.scale(ratio, ratio);
cans.translate(0, -can.height / 2);
cans.rotate(rt); // 水印旋转角度
cans.font = fs + 'px Vedana';
// cans.font = '16px Microsoft Yahei';
cans.fillStyle = 'rgba(153 ,153, 153,1)';
// cans.textAlign = 'center';
// cans.textBaseline = 'middle';
cans.fillText(str1, 0, 150); // 水印在画布的位置x,y轴
// cans.fillText(str1, 0, can.height); // 水印在画布的位置x,y轴
cans.fillText(str2, can.width / 2, can.height + 10);
const div = document.createElement('div');
div.id = id;
div.style.pointerEvents = 'none';
div.style.top = '0px';
div.style.left = '0px';
//控制水印显隐
if (isHide) {
div.style.opacity = '0';
} else {
div.style.opacity = '1';
}
div.style.position = 'fixed';
div.style.zIndex = '1000';
let winW = document.documentElement.clientWidth || document.body.clientWidth;
let winH = document.documentElement.clientHeight || document.body.clientHeight;
div.style.width = winW + 'px';
div.style.height = winH + 'px';
div.style.background = 'url(' + can.toDataURL('image/png') + ') left top repeat';
document.body.appendChild(div);
return id;
};
// 添加水印方法
export const setWaterMark = (str1, str2) => {
let id = setWatermarkFn(str1, str2);
if (document.getElementById(id) === null) {
id = setWatermarkFn(str1, str2);
}
};
// 移除水印方法
export const removeWatermark = () => {
const id = 'waterMark';
if (document.getElementById(id) !== null) {
document.body.removeChild(document.getElementById(id));
}
};
const createWatermark = ({
content = "水印内容",
container = document.body,
width = "240px",
height = "150px",
fontSize = "14px",
opacity = "0.4",
rotate = -14,
color = "#999",
zIndex = 9999,
}) => {
// 创建水印svg
const svgStr = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
<text x="50%" y="50%" dy="12px"
text-anchor="middle"
stroke="${color}"
stroke-width="1"
stroke-opacity="${opacity}"
fill="none"
transform="rotate(${rotate}, ${parseFloat(width) / 2}, ${
parseFloat(height) / 2
})"
style="font-size: ${fontSize};">
${content}
</text>
</svg>`;
// 利用window.btoa创建base64编码的字符串
const base64Url = `data:image/svg+xml;base64,${window.btoa(
unescape(encodeURIComponent(svgStr))
)}`;
const watermark = document.createElement("div");
watermark.setAttribute(
"style",
`position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:${zIndex};
pointer-events:none;
background-image:url('${base64Url}')`
);
container.style.position = "relative";
container.insertBefore(watermark, container.firstChild);
};
export default createWatermark;
......@@ -177,8 +177,10 @@
'Cloudoffice-Version': 'v0.0.1'
},
data: {},
success: callback
success: callback,
error:callback
}
console.log('getCurrentUserInfo>>',opt);
qing.call('request', opt)
}
var handlers = {
......@@ -335,6 +337,7 @@
// shr员工编号字段
var employeenumberField = process.env.PACK_ENV === 'product' ? '5893b734-4537-4036-9f1c-16ff831b64b2' : '72f1d584-bc3d-4616-85d0-4a67c1829d1c'
getCurrentUserInfo(function (result) {
console.log('getCurrentUserInfo-success>>',result);
var success = (result || {}).success
var error = (result || {}).error
var data = (result || {}).data || {}
......
import axios from 'axios'
var originAdapter = axios.defaults.adapter
axios.defaults.adapter = function (config) {
if (!/^https?/.test(config.url)) {
return originAdapter(config)
}
return request(config)
}
// axios.defaults.adapter = function (config) {
// if (!/^https?/.test(config.url)) {
// return originAdapter(config)
// }
// return request(config)
// }
function isObject(value) {
return value !== null && typeof value === 'object'
......
This diff could not be displayed because it is too large.
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