Commit 09b93b61 by zhongqm

update:添加水印

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