performanceDetails.js 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515
  1. var that;
  2. var app = getApp();
  3. var animation;
  4. import { returnStr, setCache, getCache, _debounce, getRole } from '../../../utils/util'
  5. Page({
  6. data: {
  7. param: {},//参数
  8. userInfo: {},
  9. userList: [],
  10. users: [],//沟通选择的人员
  11. textArea: '',//内容
  12. animationInfo: {},
  13. isShow: false,
  14. isShowText: false,
  15. has_finish: 0, //是否归档 0否 1是
  16. perfstepFlow: [], // 步骤
  17. smdsinsFlow: 0, // 当前绩效流程所在位置
  18. flowNow: {}, // 当前节点
  19. thecurrentFlow: '', // 当前节点
  20. ruleScore: 1, // 1-指标均要评分 2-评分总结
  21. mandatoryScore: false, // 指标说明是否必填
  22. weight: '',
  23. apList: [], // 执行计划数据
  24. planIndex: [], // 执行计划的下标,当点击表格查看时用到
  25. // 按钮显示隐藏
  26. targetConfirmed: false, // 目标确认
  27. gradeButShow: false, // 评分
  28. examineButShow: false, // 审批
  29. isAction: false, // 审批驳回
  30. resultButShow: false, // 结果值录入
  31. actionButShow: false, // 执行计划
  32. recordsManagement: false, // 管理记录
  33. feedbackBut: false, // 沟通反馈按钮
  34. transferBut: false, // 转交按钮
  35. careOfPeopleId: [], // 转交的 -- 转出ID
  36. selectZj: false,
  37. zjId: 0, // 转交用户ID
  38. revocationShow: false, //是否可以撤销
  39. revocationNodeId: 1, //撤销节点ID
  40. recordList: [], // 记录列表
  41. recordAllList: [], // 记录列表
  42. selectUser: false, // 沟通反馈@
  43. emtags: [], // 沟通反馈@选中人员
  44. selectpradio: '',
  45. selectpradio1: '',
  46. rejectList: [],
  47. rejectListIndex: -1,
  48. rejectList1: [],
  49. rejectList1Index: 0,
  50. rejectdlg: false, // 驳回选项弹窗
  51. rejectData: {}, // 驳回数据
  52. rejectProp: false, // 驳回--选人
  53. popupknowFrom: 0, // 0:沟通反馈,1:驳回,2审批,3目标确认,4.撤销
  54. gradeval: 0, // 评分总分
  55. graded: false, // 评分模块开关
  56. commFeedback: '', // 沟通弹窗反馈
  57. show_dept_selector: false, // 转交选人
  58. Information: {
  59. // 顶部员工信息
  60. name: '',
  61. deptList: []
  62. },
  63. // 执行中
  64. inExecution: [],
  65. scoreInfo: [], // 各个节点的人评的总分
  66. titList: [],
  67. bootBool: false, // 防止多次请求
  68. isCs: false, // 是否抄送人进入(抄送人能看到全部评分内容)
  69. com_height: '100%',
  70. isDisabled: false, //是否显示上下一条
  71. headuDown: [],
  72. pendingList: [],
  73. page: 1,
  74. isJz: true,
  75. activeName: '', //待办带进来的节点类型
  76. checked: false, //只看自己评分
  77. recordMemberIds: [],
  78. flexDialog: false,
  79. flexIndex: 0,
  80. // 评分确认列表
  81. pointList: [],
  82. pointData: {},
  83. isPoint: false,
  84. isShowPoint: true,
  85. publicity: 0,
  86. isShowText: false,
  87. logText: '执行计划',
  88. logList: [],
  89. apDetails: {},
  90. isShowCx: false,
  91. checked: false,//是否查看更多
  92. isSuperior: false,//判断当前登录者是否是该考核人的上级
  93. boxTop:0,
  94. ding_msg: false,//判断当前登录者是否是该考核人的上级
  95. recordIndex:5,
  96. recordStr:'全部记录',
  97. },
  98. onLoad(e) {
  99. that = this;
  100. // dd.alert({
  101. // title: '亲',
  102. // content: JSON.stringify(e),
  103. // buttonText: '我知道了',
  104. // success: () => {
  105. // },
  106. // });
  107. dd.setNavigationBar({ title: e.tel });
  108. this.setData({
  109. param: e,
  110. userInfo: app.globalData.userData,
  111. userList: app.globalData.usersList
  112. });
  113. if (e.corpId) {
  114. that.setData({ corpId: e.corpId });
  115. app.globalData.corpId = e.corpId
  116. }
  117. if (this.data.param.paths && this.data.param.data) {
  118. let data = JSON.parse(this.data.param.data);
  119. data.employee_id_code = app.returnCode(data.employee_id)
  120. app.$post('api/per/package/msg/cc', data).then(res => {});
  121. }
  122. },
  123. onShow() {
  124. animation = dd.createAnimation({
  125. duration: 200,
  126. timeFunction: "linear",
  127. });
  128. if (app.globalData.userData) {
  129. that.employeeDet();
  130. } else {
  131. let corpId = that.data.corpId ? that.data.corpId : app.globalData.corpId
  132. app.login(corpId, function (is) {
  133. if (is) {
  134. that.setData({
  135. userInfo: app.globalData.userData,
  136. });
  137. that.getUserList(()=>{
  138. that.setData({
  139. userList: app.globalData.usersList
  140. });
  141. that.employeeDet();
  142. })
  143. } else {
  144. dd.reLaunch({
  145. url: '../../index/noJurisdiction/noJurisdiction'
  146. })
  147. }
  148. }, function () { })
  149. }
  150. },
  151. getUserList(fun=function(){}) {
  152. app.$get("api/per/user/employee_list", { page: 0, page_size: 0 }).then((res) => {
  153. let list = res.data.data.list
  154. let data = {}
  155. for (let i in list) {
  156. if (list[i].is_scope === 0||list[i].is_official ===0) {
  157. list[i].name = list[i].name + '(未启用)';
  158. }
  159. data[list[i].id] = list[i];
  160. }
  161. app.globalData.usersList = data;
  162. fun()
  163. })
  164. },
  165. showRecord(){
  166. if(this.data.recordIndex==5){
  167. this.setData({
  168. recordIndex:100000,
  169. recordStr:'收起',
  170. })
  171. }else{
  172. this.setData({
  173. recordIndex:5,
  174. recordStr:'全部记录',
  175. })
  176. }
  177. },
  178. onPageScroll(e) {
  179. if (e.scrollTop != 0) {
  180. this.setData({
  181. boxTop: e.scrollTop
  182. })
  183. }
  184. },
  185. onChangeC(e) {
  186. this.setData({
  187. checked: e.detail.value
  188. })
  189. this.isShowOneself();
  190. },
  191. onChangeC2(e) {
  192. this.setData({
  193. ding_msg: e.detail.value
  194. })
  195. },
  196. // 确认评分
  197. scorerveok(e) {
  198. let num = e.target.dataset.index
  199. let data = {
  200. id: this.data.employeeID, // 个人考核包ID
  201. is_submit: num, // 是否提交 0否(暂存) 1 是
  202. node_id: this.data.smdsinsFlow // 当前节点
  203. };
  204. let point_info = []; // 各项评分数据
  205. let sumData = {
  206. // 总分数据
  207. total_score: '',
  208. total_score_comment: ''
  209. };
  210. this.data.inExecution.forEach(item => {
  211. let resultInfo = {};
  212. if (this.data.ruleScore == 1 && !item.totalScore) {
  213. // 各项评分
  214. resultInfo = {
  215. // 评分信息--只评总分不需要
  216. score: item.resultval ? item.resultval : '', // 单项目结果值
  217. score_remark: item.remarks,
  218. dimension_key: item.dimension_key, // 维度索引
  219. index_key: item.index_key, // 指标索引
  220. index_id: item.id, // 指标ID
  221. name: item.name,
  222. // 用于计算分数
  223. d_weight: item.dimension_weight, // 维度权重
  224. weight: item.weight, // 指标权重
  225. type: item.type // 所属指标种类 1-量化指标 2-行为价值观指标 3-额外加分项 4-额外扣分项
  226. };
  227. point_info.push(resultInfo);
  228. } else {
  229. // 等于2:只评总分
  230. if (item.totalScore) {
  231. sumData = {
  232. total_score: item.resultval ? item.resultval : '',
  233. total_score_comment: item.remarks
  234. };
  235. }
  236. }
  237. });
  238. let isMust = true,isExplain = true; // isMust验证评分,isExplain验证说明
  239. if (num == 1) {
  240. // 提交验证必填
  241. if (this.data.ruleScore == 1) {
  242. // 各项评分
  243. point_info.forEach(item => {
  244. if (this.data.mandatoryScore) {
  245. // 评分说明必填
  246. if (!item.score_remark) {
  247. isExplain = false;
  248. }
  249. }
  250. if (!item.score) {
  251. isMust = false;
  252. }
  253. });
  254. if (!isMust) {
  255. app.globalData.showToast('请输入所有结果值');
  256. return false;
  257. }
  258. if (!isExplain) {
  259. app.globalData.showToast('请输入所有评分说明');
  260. return false;
  261. }
  262. } else {
  263. // 总分
  264. if (!sumData.total_score) {
  265. app.globalData.showToast('请输入评分总分');
  266. return false;
  267. }
  268. if (this.data.mandatoryScore) {
  269. if (!sumData.total_score_comment) {
  270. app.globalData.showToast('请输入总分说明');
  271. return false;
  272. }
  273. }
  274. }
  275. }
  276. if (this.data.ruleScore == 1) {
  277. data.total_score = this.fomatFloat(this.totalPointsCount(point_info), 2); // 计算的个人评出的总分(保留小数后两位)
  278. } else {
  279. data.total_score = this.fomatFloat(sumData.total_score, 2); // 计算的个人评出的总分(保留小数后两位)
  280. data.total_score_comment = sumData.total_score_comment;
  281. }
  282. data.point_info = JSON.stringify(point_info); // 评分信息 -- 填所有评分时必须的字段(传入某指标的分数、说明、维度索引、制表索引、指标ID)
  283. if (this.data.bootBool) {
  284. return;
  285. }
  286. let pointList = JSON.parse(JSON.stringify(point_info));
  287. pointList.push({
  288. name: '总分',
  289. score: data.total_score,
  290. score_remark: data.total_score_comment
  291. });
  292. this.setData({
  293. pointList: pointList,
  294. pointData: data
  295. })
  296. if (this.data.ruleScore == 1&&num==1) {
  297. //只评总分不需要弹窗
  298. this.setData({
  299. isPoint: true,
  300. })
  301. } else {
  302. this.score();
  303. }
  304. },
  305. fomatFloat(src, pos) {
  306. return Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos);
  307. },
  308. // 计算总分
  309. totalPointsCount(data) {
  310. let ct = this.data.empDetList.calc_type; // 1-加和计算 2-加权计算
  311. let cd = this.data.empDetList.calc_dimension; // 是否维度权重参与计算 1-是 0-否
  312. let num = 0;
  313. data.forEach(item => {
  314. if (item.score) {
  315. if (item.type == 3) {
  316. // 3-额外加分项
  317. num += Number(item.score);
  318. } else if (item.type == 4) {
  319. // 4-额外扣分项 不计算
  320. num -= Number(item.score);
  321. } else {
  322. if (ct == 1 && cd == 0) {
  323. // 加和
  324. num += Number(item.score);
  325. } else if (ct == 1 && cd == 1) {
  326. // 加和--维度权重参与计算
  327. num += Number(item.score) * Number(item.d_weight / 100);
  328. } else if (ct == 2 && cd == 0) {
  329. // 加权
  330. num += Number(item.score) * Number(item.weight / 100);
  331. } else if (ct == 2 && cd == 1) {
  332. // 加权--维度权重参与计算
  333. num += Number(item.score) * Number(item.d_weight / 100) * Number(item.weight / 100);
  334. }
  335. }
  336. }
  337. });
  338. return num;
  339. },
  340. // 评分-文本框失去焦点时触发
  341. watresultval(e) {
  342. let item = e.target.dataset.item
  343. let val = item.resultval;
  344. let totalScore = item.totalScore ? item.totalScore : false;
  345. if (totalScore) {
  346. this.setData({
  347. gradeval: this.fomatFloat(val, 2)
  348. })
  349. } else {
  350. let tPoints = [];
  351. this.data.inExecution.forEach(item => {
  352. if (item.resultval) {
  353. tPoints.push({
  354. score: item.resultval, // 分值
  355. d_weight: item.dimension_weight, // 维度权重
  356. weight: item.weight, // 指标权重
  357. type: item.type // 所属指标种类 1-量化指标 2-行为价值观指标 3-额外加分项 4-额外扣分项
  358. });
  359. }
  360. });
  361. this.setData({
  362. gradeval: this.fomatFloat(this.totalPointsCount(tPoints), 2)
  363. })
  364. }
  365. this.setData({
  366. isShowPoint: true
  367. })
  368. },
  369. // e当前行 ,item用于判断当前输入是否超过评分上限
  370. sgradeInp(e) {
  371. let item = e.target.dataset.item;
  372. let index = e.target.dataset.index;
  373. // item.resultval = item.resultval.match(/\d+(\.\d{0,2})?/) ? item.resultval.match(/\d+(\.\d{0,2})?/)[0] : '';
  374. this.setData({
  375. [`inExecution[${index}].resultval`]: e.detail.value
  376. })
  377. if (item) {
  378. if (item.type == 3 || item.type == 4) {
  379. if (item.point_limit) {
  380. if (this.data.inExecution[index].resultval > Number(item.point_limit)) {
  381. app.globalData.showToast('评分超过上限');
  382. this.setData({
  383. [`inExecution[${index}].resultval`]: ''
  384. })
  385. return false;
  386. }
  387. }
  388. }
  389. }
  390. },
  391. bindText: _debounce(function (e) {
  392. let index = e.target.dataset.index;
  393. this.setData({
  394. [`inExecution[${index}].remarks`]: e.detail.value
  395. })
  396. }),
  397. score() {
  398. app.$post('api/per/package/submit_score', this.data.pointData).then(res => {
  399. app.globalData.showToast('提交成功');
  400. this.setData({
  401. bootBool: false,
  402. isPoint: false,
  403. graded: false,
  404. })
  405. this.employeeDet();
  406. });
  407. },
  408. // 显示评分
  409. gradeClick() {
  410. that.setData({
  411. graded: true
  412. });
  413. let dnsion = [];
  414. this.data.inExecution.forEach(item => {
  415. if (item.employee_id == this.data.userInfo.id && item.flowId == this.data.smdsinsFlow) {
  416. dnsion.push(item);
  417. }
  418. });
  419. let totalScore = {
  420. theDimension: '总分',
  421. wdLeg: 0,
  422. totalScore: true
  423. };
  424. this.data.perfstepFlow.forEach(item => {
  425. if (item.code == 'score_supervisor' && item.status == 1) {
  426. this.setData({
  427. ruleScore: item.rule == 2 ? 2 : 1, // 1-指标均要评分 2-评分总结
  428. thecurrentFlow: 'score_supervisor'
  429. });
  430. totalScore.codeId = item.id;
  431. } else if (item.code == 'special_scorer' && item.status == 1) {
  432. this.setData({
  433. ruleScore: 1, // 1-指标均要评分 2-评分总结
  434. });
  435. }
  436. if ((item.code == 'score_supervisor' && item.status == 1) || (item.code == 'special_scorer' && item.status == 1)) {
  437. // 上级评分,特定评分 评分人必填项
  438. item.action.forEach(arr => {
  439. this.setData({
  440. mandatoryScore: arr == 'comment', // 指标说明是否必填
  441. });
  442. });
  443. }
  444. });
  445. // 总分
  446. this.data.scoreInfo.forEach(item => {
  447. item.employees.forEach(arr => {
  448. if (arr.employee_id == this.data.userInfo.id) {
  449. this.setData({
  450. gradeval: arr.point ? arr.point : 0,
  451. });
  452. if (item.id == totalScore.codeId && this.data.ruleScore == 2) {
  453. totalScore.resultval = arr.point;
  454. totalScore.remarks = arr.comment ? arr.comment : '';
  455. }
  456. }
  457. });
  458. });
  459. let dimenList = [];
  460. let users = []; // 当前节点的自己的信息
  461. this.data.perfstepFlow.forEach(item => {
  462. // 根据流程当前节点,找节点的人员中的登陆者
  463. if (item.status == 1) {
  464. item.target.some(arr => {
  465. if (arr.employee_id == this.data.userInfo.id) {
  466. arr.flowStatusId = item.id; // 当前节点的ID
  467. users = arr;
  468. return true;
  469. }
  470. });
  471. }
  472. });
  473. users.list.forEach(att => {
  474. // 获取当前节点审批人员中的登陆者
  475. dnsion.forEach(add => {
  476. if (att.index_id == add.id && att.dimension_key == add.planIndex[0] && att.index_key == add.planIndex[1]) {
  477. add.dimension_key = att.dimension_key; // 维度索引
  478. add.index_key = att.index_key; // 指标索引
  479. add.score_infos.forEach(user => {
  480. // 显示的文案,找到当前登录人
  481. if (user.id == users.flowStatusId) {
  482. if (user.employee_id == this.data.userInfo.id) {
  483. this.setData({
  484. [`scoreTab.title`]: user.title,
  485. [`scoreTab.explain`]: user.title.split(':')[0] + '说明',
  486. })
  487. }
  488. }
  489. });
  490. dimenList.push(add);
  491. }
  492. });
  493. });
  494. this.data.scoreInfo.forEach(item => {
  495. item.employees.forEach(arr => {
  496. if (arr.employee_id == this.data.userInfo.id) {
  497. this.setData({
  498. gradeval: arr.point ? arr.point : 0
  499. })
  500. if (item.id == totalScore.codeId && this.data.ruleScore == 2) {
  501. totalScore.resultval = arr.point;
  502. totalScore.remarks = arr.comment ? arr.comment : '';
  503. }
  504. }
  505. });
  506. });
  507. this.data.perfstepFlow.forEach(item => {
  508. if (item.code == 'score_supervisor' && item.status == 1 && this.data.ruleScore == 2) {
  509. dimenList.push(totalScore);
  510. }
  511. });
  512. this.setData({
  513. inExecution: dimenList
  514. })
  515. },
  516. // 评分取消
  517. scorerveno() {
  518. this.setData({
  519. graded: false,
  520. skeletonLoad: false,
  521. })
  522. this.employeeDet();
  523. },
  524. confirmBh() {
  525. if (!this.data.textArea) {
  526. app.globalData.showToast('请输入沟通内容');
  527. return false;
  528. }
  529. let target_id = this.data.users.map(item => {
  530. return item.id;
  531. });
  532. app.$post('api/per/package/negotiation', {
  533. id: this.data.employeeID,
  534. content: this.data.textArea,
  535. target_id: JSON.stringify(target_id),
  536. ding_msg:this.data.ding_msg? 1:0
  537. }).then(res => {
  538. app.globalData.showToast('已沟通');
  539. this.employeeDet();
  540. this.showGt();
  541. this.setData({
  542. content:'',
  543. ding_msg:false
  544. })
  545. });
  546. },
  547. // 沟通@人员
  548. onSelectUser(item) {
  549. that.setData({
  550. users: item
  551. });
  552. },
  553. //转交
  554. openSelectUser(e) {
  555. if (this.data.careOfPeopleId.length == 1) {
  556. this.openSelect(e)
  557. } else {
  558. let items = this.data.careOfPeopleId.map(item => {
  559. return item.employee_name
  560. })
  561. dd.showActionSheet({
  562. title: '请选择被转交人员',
  563. items: items,
  564. cancelButtonText: '取消',
  565. success: (res) => {
  566. if (res.index !== -1) {
  567. this.setData({
  568. zjId: this.data.careOfPeopleId[res.index].employee_id, //被转出人ID
  569. })
  570. this.openSelect(e)
  571. }
  572. },
  573. });
  574. }
  575. },
  576. //选择
  577. openSelect(e) {
  578. let index = e.target.dataset.index
  579. animation.translateY(0).step();
  580. that.setData({
  581. // users:[],
  582. // textArea:'',
  583. isShowstaff: index,
  584. animationInfo: animation.export(),
  585. popupCx: 'container__mask',
  586. });
  587. },
  588. //转交人员
  589. confirm(data) {
  590. that.setData({
  591. employeeObj: data
  592. });
  593. let item = data[0];
  594. dd.confirm({
  595. title: '温馨提示',
  596. content: '确认转交:' + item.name + '?',
  597. confirmButtonText: '确定',
  598. cancelButtonText: '取消',
  599. success: (result) => {
  600. if (result.confirm) {
  601. let employeeId = this.data.careOfPeopleId.length == 1 ? this.data.careOfPeopleId[0].employee_id : this.data.zjId;
  602. let data = {
  603. id: this.data.employeeID, // 个人考核记录ID
  604. node_id: this.data.flowNow.id, // 节点ID
  605. to_employee_id_code: item.code, // 接收用户ID
  606. from_employee_id_code: app.returnCode(employeeId) // 转出用户ID
  607. };
  608. app.$post('api/per/package/transfer', data).then(res => {
  609. if (res.data.code == 1) {
  610. app.globalData.showToast('转交成功');
  611. this.employeeDet();
  612. this.closeWindows();
  613. }
  614. });
  615. }
  616. },
  617. });
  618. },
  619. showGt() {
  620. that.setData({
  621. users: [],
  622. isShowGt: !this.data.isShowGt
  623. });
  624. },
  625. showCx() {
  626. that.setData({
  627. isShowCx: true
  628. });
  629. },
  630. //关闭规则
  631. onClose() {
  632. animation.translateY(1200).step();
  633. that.setData({
  634. animationInfo: animation.export(),
  635. isShowstaff: false,
  636. popupCx: '',
  637. });
  638. setTimeout(() => {
  639. dd.pageScrollTo({
  640. scrollTop: that.data.boxTop
  641. })
  642. }, 100)
  643. },
  644. showImg(e) {
  645. let item = e.target.dataset.item
  646. app.$get('api/drive/grant', { file_id: item.fileId }).then(res => {
  647. dd.previewFileInDingTalk({
  648. corpId: app.globalData.corpId,
  649. spaceId: item.spaceId,
  650. fileId: item.fileId,
  651. fileName: item.fileName,
  652. fileSize: item.fileSize,
  653. fileType: item.fileType,
  654. })
  655. })
  656. },
  657. openVas(e) {
  658. let index = e.target.dataset.index
  659. let item = e.target.dataset.item
  660. if(index=="2"){
  661. item.mamage_record.forEach(item=>{
  662. item.userName=app.globalData.usersList[item.employee_id].name
  663. })
  664. }
  665. this.setData({
  666. logText: index == '1' ? '执行计划' : '管理记录',
  667. logList: index == '1' ? item.schedule : item.mamage_record,
  668. apDetails: item,
  669. isShowText: true,
  670. });
  671. },
  672. rotateAndScale() {
  673. this.setData({
  674. isShow: !this.data.isShow
  675. });
  676. },
  677. //关闭所有弹窗
  678. closeWindows() {
  679. this.setData({
  680. // 目标确认
  681. rejectdlg: false,
  682. commFeedback: '',
  683. // 转交
  684. employeeObj: [],
  685. users: [],
  686. textArea: '',
  687. isShowGt: false,
  688. isPoint: false,
  689. isShowText: false,
  690. isShow: false,
  691. isShowCx: false,
  692. })
  693. },
  694. // 录入结果值
  695. enteringResult() {
  696. dd.navigateTo({
  697. url: `../resultValueEntry/resultValueEntry?id=${this.data.employeeID}&packageName=${this.data.param.tel}`
  698. })
  699. },
  700. agree0Prop(e) {
  701. let num = e.target.dataset.num
  702. let data = {
  703. id: this.data.employeeID, // 个人考核包ID
  704. agree: num, // 同意1 驳回0
  705. c_node_id: this.data.flowNow.id // 当前节点ID
  706. };
  707. if (num == 0) {
  708. if (!this.data.commFeedback) {
  709. app.globalData.showToast('请输入驳回内容');
  710. return false;
  711. }
  712. if (!this.data.rejectData.node_id) {
  713. app.globalData.showToast('请选择驳回节点!');
  714. return false;
  715. }
  716. if (!this.data.rejectData.employee_id) {
  717. app.globalData.showToast('至少选择一名重置人员!');
  718. return false;
  719. }
  720. data.employee_id_code = app.returnCode(this.data.rejectData.employee_id);
  721. data.node_id = this.data.rejectData.node_id;
  722. }
  723. if (this.data.commFeedback) {
  724. data.comment = this.data.commFeedback; // 审核意见
  725. }
  726. // console.log(data);
  727. // return false
  728. app.$post('api/per/package/review', data).then(res => {
  729. app.globalData.showToast('提交成功');
  730. this.employeeDet();
  731. this.closeWindows();
  732. });
  733. },
  734. isShowOneself() {
  735. let inExecution = this.data.inExecution
  736. inExecution.forEach((e, index) => {
  737. e.scoreList.forEach(item => {
  738. if (!this.data.checked) {
  739. if (item.employee_id == this.data.userInfo.id) {
  740. item.isShow = true;
  741. } else {
  742. item.isShow = false;
  743. }
  744. } else {
  745. item.isShow = true;
  746. }
  747. })
  748. })
  749. this.setData({
  750. inExecution: inExecution
  751. })
  752. },
  753. // 驳回选择节点
  754. clickreject(e) {
  755. this.setData({
  756. rejectListIndex: e.detail.value,
  757. rejectList1: [],
  758. rejectData: {},
  759. })
  760. let item = this.data.rejectList[this.data.rejectListIndex]
  761. let rejectList1 = [];
  762. if (item.staff.length > 1) {
  763. rejectList1.push({ employee_id: 0, employee_name: '选择人员' });
  764. item.staff.forEach(item => {
  765. if (item.status == 2) {
  766. rejectList1.push(item);
  767. }
  768. });
  769. this.setData({
  770. rejectProp: true,
  771. rejectList1: rejectList1,
  772. })
  773. } else {
  774. this.setData({
  775. rejectProp: false,
  776. [`rejectData.employee_id`]: [item.staff[0].employee_id],
  777. })
  778. }
  779. this.setData({
  780. [`rejectData.node_id`]: item.id,
  781. })
  782. },
  783. //驳回选择人员
  784. clickreject1(e) {
  785. this.setData({
  786. rejectList1Index: e.detail.value,
  787. })
  788. let item = this.data.rejectList1[this.data.rejectList1Index]
  789. if (item.employee_id == 0) {
  790. let arr = [];
  791. this.data.rejectList1.forEach(aoo => {
  792. if (aoo.employee_id && aoo.employee_id != 0) {
  793. arr.push(aoo.employee_id);
  794. }
  795. });
  796. this.setData({
  797. [`rejectData.employee_id`]: arr,
  798. })
  799. } else {
  800. this.setData({
  801. [`rejectData.employee_id`]: [item.employee_id],
  802. })
  803. }
  804. },
  805. bindFeedback: function (e) {
  806. this.setData({
  807. commFeedback: e.detail.value,
  808. });
  809. },
  810. bindTextAreaBlur: function (e) {
  811. this.setData({
  812. textArea: e.detail.value,
  813. });
  814. },
  815. employeeDet() {
  816. let params = {};
  817. if (this.data.param.id) {
  818. params.id = this.data.param.id;
  819. } else if (this.data.param.assId && this.data.param.staffId) {
  820. params.package_id = this.data.param.assId;
  821. params.employee_id_code = app.returnCode(this.data.param.staffId);
  822. }
  823. this.skeletonLoad = true;
  824. app.$get('api/per/package/employee/info', params).then(res => {
  825. if (res.data.code == 1) {
  826. let data = res.data.data;
  827. if (this.data.pendingList.length > 0) { //上下考核人
  828. this.setUpD();
  829. }
  830. data.flow.map(item => {
  831. if (item.target && item.target.length > 0) {
  832. item.target.map(item2 => {
  833. item2.employee_name =app.globalData.usersList[item2.employee_id].name;
  834. });
  835. }
  836. });
  837. this.setData({
  838. has_finish: data.has_finish,
  839. recordMemberIds: data.record_member_ids || [],
  840. empDetList: data,
  841. employeeID: data.id, // 考核记录id
  842. Information: app.globalData.usersList[data.relevance_employee.id], // 考核人员信息
  843. [`Information.deptList`]: data.relevance_employee.dept_list, // 部门
  844. perfstepFlow: data.flow, // 流程
  845. apList: JSON.stringify(data.dimension),
  846. scoreInfo: data.score_info, // 各个节点的人评的总分
  847. feedbackBut: data.config.assessment.feedback == '1', // 沟通反馈是否启用
  848. resultButShow: false, // 录入结果值
  849. gradeButShow: false, // 评分按钮
  850. examineButShow: false, // 审批按钮
  851. transferBut: false, // 转交按钮
  852. targetConfirmed: false, // 目标确认
  853. publicity: data.publicity,
  854. actionButShow: false, // 执行计划按钮
  855. recordsManagement: false, // 管理记录按钮
  856. revocationShow: false,
  857. smdsinsFlow: 0,
  858. flexIndex: 0,
  859. })
  860. this.buttonIf2(); //判断管理记录/执行计划按钮是否显示
  861. let executor = {}; // 与当前登录账号相同的执行人
  862. let review = {}; // 与当前登录账号相同的审批人
  863. data.flow.forEach((item, index) => {
  864. if (item.code == 'execution') {
  865. // 查找 已开始或已结束的执行节点中有无当前账号
  866. if (item.status != 0) {
  867. item.target.forEach(tar => {
  868. if (tar.employee_id == this.data.userInfo.id) {
  869. executor = tar; // 存入与当前登录账号相同的执行人
  870. executor.newCode = 'employee'; // 保存执行人节点code
  871. }
  872. });
  873. }
  874. }
  875. if (item.code == 'review') {
  876. // 查找 已开始或已结束的审批节点中有无当前账号
  877. if (item.status != 0) {
  878. item.target.forEach(tar => {
  879. if (tar.employee_id == this.data.userInfo.id) {
  880. review = tar; // 存入与当前登录账号相同的审批人
  881. review.newCode = 'reviewer'; // 保存审批人节点code
  882. }
  883. });
  884. }
  885. }
  886. this.buttonIf(item);
  887. if (item.status == 1) {
  888. if (item.code != 'cc') {
  889. this.isRevocation(item, data.flow[index - 1]);
  890. }
  891. data.flow.push({ id: data.flow.length + 1, remark: '结束', status: 0, target: [] });
  892. this.setData({
  893. flowNow: item,
  894. smdsinsFlow: item.id,
  895. flexIndex: index + 1,
  896. })
  897. }
  898. });
  899. if (this.data.flexIndex == 0) {
  900. data.flow.push({ id: data.flow.length + 1, remark: '结束', status: 2, target: [] });
  901. this.setData({
  902. flexIndex: data.flow.length,
  903. perfstepFlow: data.flow, // 流程
  904. })
  905. }
  906. if (this.data.smdsinsFlow == 0) {
  907. // 如果当前节点id为0,代表此考核详情已完毕,把最后一个节点作为当前节点
  908. this.setData({
  909. smdsinsFlow: data.flow[data.flow.length - 1].id
  910. })
  911. let cs
  912. data.flow.forEach(item=>{
  913. if(item.code=='cc'){
  914. cs = item;
  915. }
  916. })
  917. if(cs){
  918. cs.target.some(item => {
  919. if (item.employee_id == this.data.userInfo.id) {
  920. this.setData({
  921. isCs: true
  922. })
  923. return true;
  924. }
  925. });
  926. }
  927. }
  928. // 整合表格格式
  929. let dimension = data.dimension;
  930. let dimeTab = [];
  931. let weight = 0; // 权重统计
  932. // poiSco 评分权限
  933. // poicom 说明权限
  934. let poiSco = data.config.assessment.point_scope; // 评分可见权限
  935. let poicom = data.config.assessment.point_comment; // 说明可见权限
  936. dimension.forEach((item, keys) => {
  937. item.index.forEach((arr, index) => {
  938. weight += Number(arr.weight);
  939. arr.theDimension = item.name + '(' + Number(index + 1) + ')';
  940. arr.dimension_weight = item.dimension_weight; // 维度权重
  941. arr.score_infos = [];
  942. arr.planIndex = [keys, index]; // 当打开执行计划时的下标
  943. let tar = null;
  944. if (this.initData(arr.result)) {
  945. tar = this.initData(arr.result) + arr.unit;
  946. }
  947. arr.tabList = [
  948. {
  949. lab: '指标类型',
  950. prop: this.indexType(this.initData(arr.type))
  951. },
  952. {
  953. lab: '指标权重(%)',
  954. prop: this.initData(arr.weight) ? '指标权重:' + this.initData(arr.weight) + '%' : null
  955. }
  956. ];
  957. arr.details = [
  958. // {
  959. // lab: '指标类型',
  960. // prop: this.indexType(this.initData(arr.type))
  961. // },
  962. { lab: '目标值', prop: this.initData(arr.target) ? + this.initData(arr.target) + arr.unit : '' },
  963. { lab: '结果值', prop: tar },
  964. { lab: '加扣分上限', prop: this.initData(arr.point_limit) },
  965. // { lab: '考核标准', prop: this.initData(arr.per_remark) },
  966. // {
  967. // lab: '指标权重(%)',
  968. // prop: this.initData(arr.weight) ? this.initData(arr.weight) + '%' : null
  969. // },
  970. { lab: '备注', prop: this.initData(arr.remark) }
  971. ];
  972. // 权限区分
  973. arr.scoreList = [];
  974. arr.score_info.forEach((list, auto) => {
  975. if (list.id <= this.data.smdsinsFlow) {
  976. // smdsinsFlow为当前节点id。。数据-id <= 当前节点id . :筛选出当前节点及之前的评分节点的数据
  977. list.employees.forEach(emplo => {
  978. if (emplo.employee_id == this.data.userInfo.id && list.id == this.data.smdsinsFlow) {
  979. arr.resultval = emplo.point;
  980. arr.remarks = emplo.remark;
  981. arr.employee_id = emplo.employee_id;
  982. arr.flowId = list.id;
  983. }
  984. // 获取code
  985. data.flow.forEach(codes => {
  986. if (codes.id == list.id) {
  987. if (codes.code == 'review') {
  988. // 审批
  989. emplo.newCode = 'reviewer';
  990. } else if (codes.code == 'execution') {
  991. // 执行中
  992. emplo.newCode = 'employee';
  993. } else if (codes.code == 'score_supervisor') {
  994. // 指定上级
  995. emplo.newCode = 'manager';
  996. } else if (codes.code == 'special_scorer') {
  997. // 特定上级
  998. emplo.newCode = 'special';
  999. }
  1000. codes.target.some(tar => {
  1001. //找到每个评分人获取评分状态
  1002. if (tar.employee_id == emplo.employee_id) {
  1003. emplo.status = tar.status;
  1004. return true;
  1005. }
  1006. });
  1007. }
  1008. });
  1009. // item为评分数据,数据内只有两个节点:指定(score_supervisor,权限名:manager) 特定上级(special_scorer,权限名:special)
  1010. // executor 执行人中的当前登陆账号
  1011. // review 审批人中的当前登陆账号
  1012. if (executor.employee_id) {
  1013. // 若有数据,那么当前登录账号必定在执行人中并且执行节点正在执行或已结束(哪怕正在执行也无所谓,前方已经过滤评分数据,会得到[])
  1014. if (poiSco[executor.newCode] == '2') {
  1015. // 已有数据并且为2 ‘查看所有的’ ,那就可以将所有的评分权限都改为 ‘2’
  1016. for (let i in poiSco) {
  1017. poiSco[i] = '2';
  1018. }
  1019. }
  1020. if (poicom[executor.newCode] == '2') {
  1021. // 说明同上
  1022. for (let i in poicom) {
  1023. poicom[i] = '2';
  1024. }
  1025. }
  1026. }
  1027. if (review.employee_id) {
  1028. // 审批节点--同上 (审批节点默认为2,可以直接全部变成2)
  1029. if (poiSco[review.newCode] == '2') {
  1030. for (let i in poiSco) {
  1031. poiSco[i] = '2';
  1032. }
  1033. }
  1034. if (poicom[review.newCode] == '2') {
  1035. // 说明同上
  1036. for (let i in poicom) {
  1037. poicom[i] = '2';
  1038. }
  1039. }
  1040. }
  1041. if (item.employee_id == executor.employee_id) {
  1042. // 判断当前评分数据是否 与 执行节点的当前帐号一致
  1043. if (poiSco[executor.newCode] == '2') {
  1044. // 如果一致并且执行节点为‘2’即查看所有,那么就修改当前 评分数据 的权限也为‘2’
  1045. poiSco[item.newCode] = '2';
  1046. }
  1047. if (poicom[executor.newCode] == '2') {
  1048. // 执行中的 -- 说明权限-同上
  1049. poicom[item.newCode] = '2';
  1050. }
  1051. }
  1052. if (item.employee_id == review.employee_id) {
  1053. // 判断当前评分数据是否 与 审批节点的当前帐号一致
  1054. if (poiSco[review.newCode] == '2') {
  1055. poiSco[item.newCode] = '2';
  1056. }
  1057. if (poicom[review.newCode] == '2') {
  1058. // 审批的 -- 说明权限-同上
  1059. poicom[item.newCode] = '2';
  1060. }
  1061. }
  1062. let scoredata = {
  1063. // 评分&&说明
  1064. lab: emplo.title,
  1065. prop: emplo.point,
  1066. newCode: emplo.newCode,
  1067. employee_id: emplo.employee_id,
  1068. level: emplo.level,
  1069. remark: emplo.remark,
  1070. knowFrom: 0,
  1071. status: emplo.status
  1072. };
  1073. arr.scoreList.push(scoredata);
  1074. // 单项总分显示
  1075. if (this.retrunFs(list.id, emplo).length > 0 && !emplo.point) { //单项指标评分不显示总分,只评总分显示,要去掉,请把!emplo.point判断去掉
  1076. arr.scoreList.push(...this.retrunFs(list.id, emplo));
  1077. }
  1078. });
  1079. }
  1080. });
  1081. dimeTab.push(arr);
  1082. });
  1083. });
  1084. this.setData({
  1085. weight: weight + '%',
  1086. })
  1087. let poiSOk = false; // 评分--为true时所有评分可看
  1088. let poiCOk = false; // 说明--为true时所有说明可看
  1089. dimeTab.forEach(arr => {
  1090. arr.scoreList.forEach(item => {
  1091. // 判断评分
  1092. if (poiSco[item.newCode] == '1' && item.employee_id == this.data.userInfo.id) {
  1093. item.pointShow = true; //是否显示评分
  1094. } else if (poiSco[item.newCode] == '2') {
  1095. // 当前 评分 数据权限等于2时并且(当前数据id为登陆账号 或 执行中权限等于2(代表当前登陆账号为执行中的一员) 或 审批权限等于2(代表当前登陆账号为审批中的一员)) 时,所有评分都可见
  1096. if (item.employee_id == this.data.userInfo.id || poiSco[executor.newCode] == '2' || poiSco[review.newCode] == '2') {
  1097. poiSOk = true;
  1098. }
  1099. }
  1100. // 判断说明
  1101. if (poicom[item.newCode] == '1' && item.employee_id == this.data.userInfo.id) {
  1102. item.textShow = true; //是否显示说明
  1103. } else if (poicom[item.newCode] == '2') {
  1104. if (item.employee_id == this.data.userInfo.id || poicom[executor.newCode] == '2' || poicom[review.newCode] == '2') {
  1105. poiCOk = true;
  1106. }
  1107. }
  1108. });
  1109. });
  1110. dimeTab.forEach(arr => {
  1111. arr.returnStr = returnStr(arr.update_time)
  1112. let points = []; //最终显示评分
  1113. arr.scoreList.forEach(item => {
  1114. item.isShow = false;//控制是否显示更多
  1115. if(item.employee_id==this.data.userInfo.id){
  1116. item.isShow = true;//控制是否显示更多
  1117. }
  1118. if (poiSOk || getRole(1) || this.data.isCs) {
  1119. item.pointShow = true;
  1120. }
  1121. if (poiCOk || getRole(1) || this.data.isCs) {
  1122. item.textShow = true;
  1123. }
  1124. if (item.status != 2 && item.id != this.data.smdsinsFlow) {
  1125. // delete duplicat[index]
  1126. } else {
  1127. points.push(item);
  1128. }
  1129. });
  1130. arr.scoreList = points;
  1131. });
  1132. this.setData({
  1133. inExecution: dimeTab,
  1134. })
  1135. this.pdLc(); //流程结束后的判断
  1136. let titDatas = [];
  1137. if (data.publicity == 1 && (!this.data.flowNow.code || this.data.flowNow.code == 'review')) {
  1138. // 判断是否公开,并且是审批节点或者流程结束,(流程结束flowNow为空)
  1139. if (this.initData(data.final_point)) {
  1140. titDatas.push({ lab: '考核结果', prop: data.final_point });
  1141. }
  1142. if (this.initData(data.final_level)) {
  1143. titDatas.push({ lab: '绩效等级', prop: data.final_level });
  1144. }
  1145. }
  1146. this.setData({
  1147. titList: titDatas,// 顶部数据
  1148. recordList: []
  1149. })
  1150. let recordList = [];
  1151. // 记录
  1152. let record = res.data.data.record;
  1153. record.forEach((item, index) => {
  1154. if (this.data.userList[item.employee_id]) {
  1155. item.name = this.data.userList[item.employee_id].name;
  1156. }
  1157. // if (index < 3) {
  1158. recordList.push(item);
  1159. // }
  1160. });
  1161. this.setData({
  1162. recordAllList: record,// 顶部数据
  1163. recordList: recordList
  1164. })
  1165. this.skeletonLoad = false;
  1166. } else if (res.data.code == 0) {
  1167. dd.reLaunch({
  1168. url: '../../index/noPage/noPage'
  1169. })
  1170. }
  1171. }).catch((err) => {
  1172. console.log(err)
  1173. if (err.data.code == 0) {
  1174. dd.reLaunch({
  1175. url: '../../index/noPage/noPage'
  1176. })
  1177. }
  1178. })
  1179. },
  1180. pdLc() {
  1181. let flow = JSON.parse(JSON.stringify(this.data.perfstepFlow)).reverse(); //反转流程,找第一个评分节点
  1182. //流程结束,但是最后一个“评分”节点里有自己显示撤销
  1183. if (this.data.publicity == 1) {
  1184. flow.some(item => {
  1185. if (item.code == 'review' || item.code == 'cc') {
  1186. return true;
  1187. }
  1188. if (item.code == 'score_supervisor' || item.code == 'special_scorer') {
  1189. item.target.some(e => {
  1190. if (e.employee_id == this.data.userInfo.id && e.status == 2) {
  1191. this.setData({
  1192. revocationNodeId: item.id,
  1193. revocationShow: true
  1194. })
  1195. return true;
  1196. }
  1197. });
  1198. return true;
  1199. }
  1200. });
  1201. }
  1202. },
  1203. buttonIf2() {
  1204. if (this.data.Information.id == this.data.userInfo.id) {
  1205. this.setData({
  1206. actionButShow: true
  1207. })
  1208. }
  1209. // 指定管理记录人是否包含自己
  1210. this.data.recordMemberIds.some(item => {
  1211. if (item == this.data.userInfo.id) {
  1212. this.setData({
  1213. recordsManagement: true
  1214. })
  1215. return true;
  1216. }
  1217. });
  1218. this.getSuperior(this.data.Information.id)//判断是否当前被考核人的上级
  1219. if (this.data.userInfo.is_creator == 1) {
  1220. // 如果是创始人也可以操作
  1221. this.setData({
  1222. recordsManagement: true
  1223. })
  1224. }
  1225. if (app.getPermis(3)) {
  1226. // 如果是子管理员并且管理范围权限为“全公司”
  1227. this.setData({
  1228. recordsManagement: true
  1229. })
  1230. }
  1231. },
  1232. buttonIf(item) {
  1233. // 按钮控制
  1234. if (item.status == 1) {
  1235. // 目标确认
  1236. if (item.code == 'confirm') {
  1237. item.target.forEach(tar => {
  1238. if (tar.employee_id == this.data.userInfo.id && tar.status == 1) {
  1239. this.setData({
  1240. targetConfirmed: true
  1241. })
  1242. }
  1243. });
  1244. }
  1245. // 评分按钮
  1246. if (item.code == 'score_self' || item.code == 'score_mutual' || item.code == 'score_supervisor' || item.code == 'special_scorer') {
  1247. item.target.forEach(tar => {
  1248. if (tar.employee_id == this.data.userInfo.id && tar.status == 1) {
  1249. this.setData({
  1250. gradeButShow: true
  1251. })
  1252. }
  1253. });
  1254. }
  1255. // 结果值录入按钮
  1256. if (item.code == 'result_value') {
  1257. item.target.forEach(tar => {
  1258. if (tar.employee_id == this.data.userInfo.id) {
  1259. this.setData({
  1260. resultButShow: true
  1261. })
  1262. }
  1263. });
  1264. }
  1265. // 审批按钮
  1266. if (item.code == 'review') {
  1267. let reviewif = false;
  1268. item.target.forEach(tar => {
  1269. if (tar.employee_id == this.data.userInfo.id && tar.status == 1) {
  1270. reviewif = true;
  1271. }
  1272. });
  1273. this.setData({
  1274. examineButShow: !!reviewif,
  1275. isAction: item.action.indexOf('refuse') >= 0
  1276. })
  1277. }
  1278. this.setData({
  1279. careOfPeopleId: [],
  1280. })
  1281. let careOfPeopleId = [], transferBut = false;
  1282. // 当是结果值录入,上级评分,指定人评分,审批时显示转交按钮
  1283. if (
  1284. item.code == 'target' ||
  1285. item.code == 'score_supervisor' ||
  1286. item.code == 'special_scorer' ||
  1287. item.code == 'result_value' ||
  1288. item.code == 'review' ||
  1289. item.code == 'confirm'
  1290. ) {
  1291. item.target.forEach(add => {
  1292. if ((add.employee_id == this.data.userInfo.id || getRole(1)) && add.status == 1) {
  1293. if (item.code == 'review' || item.code == 'confirm') {
  1294. if (item.action.indexOf('transfer') >= 0 || getRole(1)) {
  1295. careOfPeopleId.push(add);
  1296. transferBut = true
  1297. }
  1298. } else if (item.code == 'score_supervisor') {
  1299. if (item.transfer || getRole(1)) {
  1300. careOfPeopleId.push(add);
  1301. transferBut = true
  1302. }
  1303. } else {
  1304. careOfPeopleId.push(add);
  1305. transferBut = true
  1306. }
  1307. this.setData({
  1308. careOfPeopleId: careOfPeopleId,
  1309. transferBut: transferBut
  1310. })
  1311. }
  1312. });
  1313. }
  1314. }
  1315. },
  1316. // 管理记录||执行计划
  1317. openTrackPath(e) {
  1318. console.log( this.data.planIndex)
  1319. let add = e.target.dataset.str
  1320. let data = {
  1321. know: add,
  1322. apList: this.data.apList,
  1323. packId: this.data.employeeID,
  1324. assessID: this.data.Information.id,
  1325. planIndex: this.data.planIndex,
  1326. recordMemberIds: this.data.recordMemberIds
  1327. };
  1328. setCache('actionplanList', data);
  1329. dd.navigateTo({
  1330. url: `../actionplanList/actionplanList`
  1331. })
  1332. },
  1333. // 判断是否当前被考核人的上级
  1334. getSuperior(id) {
  1335. app.$get('api/per/user/manager_list', { id_code: app.returnCode(id) }).then(res => {
  1336. let superiorList = res.data.data; //被考核人上级
  1337. superiorList.some(item => {
  1338. if (item.id == this.data.userInfo.id) {
  1339. this.setData({
  1340. recordsManagement: true
  1341. })
  1342. return true
  1343. }
  1344. })
  1345. });
  1346. },
  1347. // 撤销
  1348. revocation() {
  1349. let params = {
  1350. id: this.data.employeeID,
  1351. node_id: this.data.revocationNodeId,
  1352. comment: this.data.textArea
  1353. };
  1354. app.$post('api/per/package/revoke', params)
  1355. .then(res => {
  1356. if (res.data.code == 1) {
  1357. app.globalData.showToast('撤销成功');
  1358. this.employeeDet();
  1359. }
  1360. this.closeWindows();
  1361. })
  1362. },
  1363. // 判断是否显示撤销按钮
  1364. isRevocation(dqItem, upItem) {
  1365. // 当前只需要评分节点需要撤回
  1366. //当前节点包含自己并且其他任意一人未完成的显示按钮
  1367. if (dqItem.code == 'score_supervisor' || dqItem.code == 'special_scorer') {
  1368. dqItem.target.some((item, index) => {
  1369. if (item.employee_id == this.data.userInfo.id && item.status == 2) {
  1370. dqItem.target.some((item2, index2) => {
  1371. if (item2.status == 1) {
  1372. this.setData({
  1373. revocationNodeId: dqItem.id,
  1374. revocationShow: true
  1375. })
  1376. return true;
  1377. }
  1378. });
  1379. }
  1380. });
  1381. }
  1382. let is = true; //判断当前节点人员是否有完成的
  1383. //上一节点中包含登录者并且是完成的状态显示按钮
  1384. if (upItem) {
  1385. dqItem.target.some((item, index) => {
  1386. if (item.status == 2) {
  1387. is = false;
  1388. }
  1389. });
  1390. if (upItem.code == 'score_supervisor' || upItem.code == 'special_scorer') {
  1391. upItem.target.some((item, index) => {
  1392. if (item.employee_id == this.data.userInfo.id && item.status == 2 && is) {
  1393. this.setData({
  1394. revocationNodeId: upItem.id,
  1395. revocationShow: true
  1396. })
  1397. return true;
  1398. }
  1399. });
  1400. }
  1401. }
  1402. },
  1403. // 数据初始化,没有值或者空数组的显示-
  1404. initData(str) {
  1405. if (str == null) {
  1406. return str || null;
  1407. }
  1408. if (typeof str === 'object') {
  1409. return str.length > 0 ? str : null;
  1410. } else {
  1411. return str || null;
  1412. }
  1413. },
  1414. indexType(item) {
  1415. return item == 1 ? '量化指标' : item == 2 ? '非量化指标' : item == 3 ? '额外加分项' : item == 4 ? '额外扣分项' : '';
  1416. },
  1417. // 返回节点评分是只评总分的
  1418. retrunFs(eid, e) {
  1419. let arr = [];
  1420. this.data.scoreInfo.forEach(item => {
  1421. if (item.id == eid) {
  1422. item.employees.forEach(u => {
  1423. if (u.point && u.employee_id == e.employee_id) {
  1424. let scoredata = {
  1425. // 评分
  1426. lab: e.title,
  1427. prop: u.point + '(总分)',
  1428. newCode: e.newCode,
  1429. knowFrom: 0,
  1430. employee_id: e.employee_id,
  1431. level: '',
  1432. remark: u.comment,
  1433. status: 2
  1434. };
  1435. arr.push(scoredata);
  1436. }
  1437. });
  1438. }
  1439. });
  1440. return arr;
  1441. },
  1442. gradeTurn() {
  1443. this.setData({
  1444. selectpradio: '',
  1445. selectpradio1: '',
  1446. rejectProp: false,
  1447. rejectData: {},
  1448. })
  1449. let list = [];
  1450. this.data.perfstepFlow.forEach((item, index) => {
  1451. if (item.status == 2 && item.code != 'execution' && item.code != 'cc' && item.target.length != 0) {
  1452. let arr = {};
  1453. arr.id = item.id;
  1454. arr.name = item.remark;
  1455. item.target.forEach((att, aoo) => {
  1456. arr.name += att.employee_name;
  1457. arr.name += item.target.length - aoo > 1 ? ',' : '';
  1458. });
  1459. arr.staff = item.target;
  1460. list.push(arr);
  1461. }
  1462. });
  1463. this.setData({
  1464. rejectList: list,
  1465. popupknowFrom: 1,
  1466. rejectdlg: true,
  1467. })
  1468. },
  1469. // 审批同意
  1470. gradeOk() {
  1471. if (this.data.flowNow.code == 'confirm') {
  1472. // 驳回
  1473. this.setData({
  1474. popupknowFrom: 3
  1475. })
  1476. this.popupknowFrom = 3;
  1477. } else if (this.data.flowNow.code == 'review') {
  1478. // 审批
  1479. this.setData({
  1480. popupknowFrom: 2
  1481. })
  1482. }
  1483. this.setData({
  1484. rejectdlg: true,
  1485. })
  1486. },
  1487. });