performanceDetails.js 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521
  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. openVas(e) {
  645. let index = e.target.dataset.index
  646. let item = e.target.dataset.item
  647. if(index=="2"){
  648. item.mamage_record.forEach(item=>{
  649. item.userName=app.globalData.usersList[item.employee_id].name
  650. })
  651. }
  652. this.setData({
  653. logText: index == '1' ? '执行计划' : '管理记录',
  654. logList: index == '1' ? item.schedule : item.mamage_record,
  655. apDetails: item,
  656. isShowText: true,
  657. });
  658. },
  659. rotateAndScale() {
  660. this.setData({
  661. isShow: !this.data.isShow
  662. });
  663. },
  664. //关闭所有弹窗
  665. closeWindows() {
  666. this.setData({
  667. // 目标确认
  668. rejectdlg: false,
  669. commFeedback: '',
  670. // 转交
  671. employeeObj: [],
  672. users: [],
  673. textArea: '',
  674. isShowGt: false,
  675. isPoint: false,
  676. isShowText: false,
  677. isShow: false,
  678. isShowCx: false,
  679. })
  680. },
  681. // 录入结果值
  682. enteringResult() {
  683. dd.navigateTo({
  684. url: `../resultValueEntry/resultValueEntry?id=${this.data.employeeID}&packageName=${this.data.param.tel}`
  685. })
  686. },
  687. agree0Prop(e) {
  688. let num = e.target.dataset.num
  689. let data = {
  690. id: this.data.employeeID, // 个人考核包ID
  691. agree: num, // 同意1 驳回0
  692. c_node_id: this.data.flowNow.id // 当前节点ID
  693. };
  694. if (num == 0) {
  695. if (!this.data.commFeedback) {
  696. app.globalData.showToast('请输入驳回内容');
  697. return false;
  698. }
  699. if (!this.data.rejectData.node_id) {
  700. app.globalData.showToast('请选择驳回节点!');
  701. return false;
  702. }
  703. if (!this.data.rejectData.employee_id) {
  704. app.globalData.showToast('至少选择一名重置人员!');
  705. return false;
  706. }
  707. data.employee_id_code = app.returnCode(this.data.rejectData.employee_id);
  708. data.node_id = this.data.rejectData.node_id;
  709. }
  710. if (this.data.commFeedback) {
  711. data.comment = this.data.commFeedback; // 审核意见
  712. }
  713. // console.log(data);
  714. // return false
  715. app.$post('api/per/package/review', data).then(res => {
  716. app.globalData.showToast('提交成功');
  717. this.employeeDet();
  718. this.closeWindows();
  719. });
  720. },
  721. isShowOneself() {
  722. let inExecution = this.data.inExecution
  723. inExecution.forEach((e, index) => {
  724. e.scoreList.forEach(item => {
  725. if (!this.data.checked) {
  726. if (item.employee_id == this.data.userInfo.id) {
  727. item.isShow = true;
  728. } else {
  729. item.isShow = false;
  730. }
  731. } else {
  732. item.isShow = true;
  733. }
  734. })
  735. })
  736. this.setData({
  737. inExecution: inExecution
  738. })
  739. },
  740. // 驳回选择节点
  741. clickreject(e) {
  742. this.setData({
  743. rejectListIndex: e.detail.value,
  744. rejectList1: [],
  745. rejectData: {},
  746. })
  747. let item = this.data.rejectList[this.data.rejectListIndex]
  748. let rejectList1 = [];
  749. if (item.staff.length > 1) {
  750. rejectList1.push({ employee_id: 0, employee_name: '选择人员' });
  751. item.staff.forEach(item => {
  752. if (item.status == 2) {
  753. rejectList1.push(item);
  754. }
  755. });
  756. this.setData({
  757. rejectProp: true,
  758. rejectList1: rejectList1,
  759. })
  760. } else {
  761. this.setData({
  762. rejectProp: false,
  763. [`rejectData.employee_id`]: [item.staff[0].employee_id],
  764. })
  765. }
  766. this.setData({
  767. [`rejectData.node_id`]: item.id,
  768. })
  769. },
  770. //驳回选择人员
  771. clickreject1(e) {
  772. this.setData({
  773. rejectList1Index: e.detail.value,
  774. })
  775. let item = this.data.rejectList1[this.data.rejectList1Index]
  776. if (item.employee_id == 0) {
  777. let arr = [];
  778. this.data.rejectList1.forEach(aoo => {
  779. if (aoo.employee_id && aoo.employee_id != 0) {
  780. arr.push(aoo.employee_id);
  781. }
  782. });
  783. this.setData({
  784. [`rejectData.employee_id`]: arr,
  785. })
  786. } else {
  787. this.setData({
  788. [`rejectData.employee_id`]: [item.employee_id],
  789. })
  790. }
  791. },
  792. bindFeedback: function (e) {
  793. this.setData({
  794. commFeedback: e.detail.value,
  795. });
  796. },
  797. bindTextAreaBlur: function (e) {
  798. this.setData({
  799. textArea: e.detail.value,
  800. });
  801. },
  802. employeeDet() {
  803. let params = {};
  804. if (this.data.param.id) {
  805. params.id = this.data.param.id;
  806. } else if (this.data.param.assId && this.data.param.staffId) {
  807. params.package_id = this.data.param.assId;
  808. params.employee_id_code = app.returnCode(this.data.param.staffId);
  809. }
  810. this.skeletonLoad = true;
  811. app.$get('api/per/package/employee/info', params).then(res => {
  812. if (res.data.code == 1) {
  813. let data = res.data.data;
  814. if (this.data.pendingList.length > 0) { //上下考核人
  815. this.setUpD();
  816. }
  817. data.flow.map(item => {
  818. if (item.target && item.target.length > 0) {
  819. item.target.map(item2 => {
  820. item2.employee_name =app.globalData.usersList[item2.employee_id].name;
  821. });
  822. }
  823. });
  824. this.setData({
  825. has_finish: data.has_finish,
  826. recordMemberIds: data.record_member_ids || [],
  827. empDetList: data,
  828. employeeID: data.id, // 考核记录id
  829. Information: app.globalData.usersList[data.relevance_employee.id], // 考核人员信息
  830. [`Information.deptList`]: data.relevance_employee.dept_list, // 部门
  831. perfstepFlow: data.flow, // 流程
  832. apList: JSON.stringify(data.dimension),
  833. scoreInfo: data.score_info, // 各个节点的人评的总分
  834. feedbackBut: data.config.assessment.feedback == '1', // 沟通反馈是否启用
  835. resultButShow: false, // 录入结果值
  836. gradeButShow: false, // 评分按钮
  837. examineButShow: false, // 审批按钮
  838. transferBut: false, // 转交按钮
  839. targetConfirmed: false, // 目标确认
  840. publicity: data.publicity,
  841. actionButShow: false, // 执行计划按钮
  842. recordsManagement: false, // 管理记录按钮
  843. revocationShow: false,
  844. smdsinsFlow: 0,
  845. flexIndex: 0,
  846. })
  847. this.buttonIf2(); //判断管理记录/执行计划按钮是否显示
  848. let executor = {}; // 与当前登录账号相同的执行人
  849. let review = {}; // 与当前登录账号相同的审批人
  850. data.flow.forEach((item, index) => {
  851. if (item.code == 'execution') {
  852. // 查找 已开始或已结束的执行节点中有无当前账号
  853. if (item.status != 0) {
  854. item.target.forEach(tar => {
  855. if (tar.employee_id == this.data.userInfo.id) {
  856. executor = tar; // 存入与当前登录账号相同的执行人
  857. executor.newCode = 'employee'; // 保存执行人节点code
  858. }
  859. });
  860. }
  861. }
  862. if (item.code == 'review') {
  863. // 查找 已开始或已结束的审批节点中有无当前账号
  864. if (item.status != 0) {
  865. item.target.forEach(tar => {
  866. if (tar.employee_id == this.data.userInfo.id) {
  867. review = tar; // 存入与当前登录账号相同的审批人
  868. review.newCode = 'reviewer'; // 保存审批人节点code
  869. }
  870. });
  871. }
  872. }
  873. this.buttonIf(item);
  874. if (item.status == 1) {
  875. if (item.code != 'cc') {
  876. this.isRevocation(item, data.flow[index - 1]);
  877. }
  878. data.flow.push({ id: data.flow.length + 1, remark: '结束', status: 0, target: [] });
  879. this.setData({
  880. flowNow: item,
  881. smdsinsFlow: item.id,
  882. flexIndex: index + 1,
  883. })
  884. }
  885. });
  886. if (this.data.flexIndex == 0) {
  887. data.flow.push({ id: data.flow.length + 1, remark: '结束', status: 2, target: [] });
  888. this.setData({
  889. flexIndex: data.flow.length,
  890. perfstepFlow: data.flow, // 流程
  891. })
  892. }
  893. if (this.data.smdsinsFlow == 0) {
  894. // 如果当前节点id为0,代表此考核详情已完毕,把最后一个节点作为当前节点
  895. this.setData({
  896. smdsinsFlow: data.flow[data.flow.length - 1].id
  897. })
  898. let cs
  899. data.flow.forEach(item=>{
  900. if(item.code=='cc'){
  901. cs = item;
  902. }
  903. })
  904. if(cs){
  905. cs.target.some(item => {
  906. if (item.employee_id == this.data.userInfo.id) {
  907. this.setData({
  908. isCs: true
  909. })
  910. return true;
  911. }
  912. });
  913. }
  914. }
  915. // 整合表格格式
  916. let dimension = data.dimension;
  917. let dimeTab = [];
  918. let weight = 0; // 权重统计
  919. // poiSco 评分权限
  920. // poicom 说明权限
  921. let poiSco = data.config.assessment.point_scope; // 评分可见权限
  922. let poicom = data.config.assessment.point_comment; // 说明可见权限
  923. dimension.forEach((item, keys) => {
  924. item.index.forEach((arr, index) => {
  925. weight += Number(arr.weight);
  926. arr.theDimension = item.name + '(' + Number(index + 1) + ')';
  927. arr.dimension_weight = item.dimension_weight; // 维度权重
  928. arr.score_infos = [];
  929. arr.planIndex = [keys, index]; // 当打开执行计划时的下标
  930. let tar = null;
  931. if(arr.result!==null&&arr.result!==''){
  932. tar=arr.result + arr.unit
  933. }
  934. arr.tabList = [
  935. {
  936. lab: '指标类型',
  937. prop: this.indexType(this.initData(arr.type))
  938. },
  939. {
  940. lab: '指标权重(%)',
  941. prop: this.initData(arr.weight) ? '指标权重:' + this.initData(arr.weight) + '%' : null
  942. }
  943. ];
  944. let isFile=true;
  945. if(arr.result_file.append.length==0&&arr.result_file.images.length==0){
  946. isFile=false;
  947. }
  948. arr.details = [
  949. // {
  950. // lab: '指标类型',
  951. // prop: this.indexType(this.initData(arr.type))
  952. // },
  953. { lab: '目标值', prop: arr.target ? arr.target +''+ arr.unit:'' },
  954. { lab: '结果值', prop: tar },
  955. { lab: '结果值附件', prop:isFile ? arr.result_file.append:''},
  956. { lab: '加扣分上限', prop: this.initData(arr.point_limit) },
  957. // { lab: '考核标准', prop: this.initData(arr.per_remark) },
  958. // {
  959. // lab: '指标权重(%)',
  960. // prop: this.initData(arr.weight) ? this.initData(arr.weight) + '%' : null
  961. // },
  962. { lab: '备注', prop: this.initData(arr.remark) }
  963. ];
  964. // 权限区分
  965. arr.scoreList = [];
  966. arr.score_info.forEach((list, auto) => {
  967. if (list.id <= this.data.smdsinsFlow) {
  968. // smdsinsFlow为当前节点id。。数据-id <= 当前节点id . :筛选出当前节点及之前的评分节点的数据
  969. list.employees.forEach(emplo => {
  970. if (emplo.employee_id == this.data.userInfo.id && list.id == this.data.smdsinsFlow) {
  971. arr.resultval = emplo.point;
  972. arr.remarks = emplo.remark;
  973. arr.employee_id = emplo.employee_id;
  974. arr.flowId = list.id;
  975. }
  976. // 获取code
  977. data.flow.forEach(codes => {
  978. if (codes.id == list.id) {
  979. if (codes.code == 'review') {
  980. // 审批
  981. emplo.newCode = 'reviewer';
  982. } else if (codes.code == 'execution') {
  983. // 执行中
  984. emplo.newCode = 'employee';
  985. } else if (codes.code == 'score_supervisor') {
  986. // 指定上级
  987. emplo.newCode = 'manager';
  988. } else if (codes.code == 'special_scorer') {
  989. // 特定上级
  990. emplo.newCode = 'special';
  991. }
  992. codes.target.some(tar => {
  993. //找到每个评分人获取评分状态
  994. if (tar.employee_id == emplo.employee_id) {
  995. emplo.status = tar.status;
  996. return true;
  997. }
  998. });
  999. }
  1000. });
  1001. // item为评分数据,数据内只有两个节点:指定(score_supervisor,权限名:manager) 特定上级(special_scorer,权限名:special)
  1002. // executor 执行人中的当前登陆账号
  1003. // review 审批人中的当前登陆账号
  1004. if (executor.employee_id) {
  1005. // 若有数据,那么当前登录账号必定在执行人中并且执行节点正在执行或已结束(哪怕正在执行也无所谓,前方已经过滤评分数据,会得到[])
  1006. if (poiSco[executor.newCode] == '2') {
  1007. // 已有数据并且为2 ‘查看所有的’ ,那就可以将所有的评分权限都改为 ‘2’
  1008. for (let i in poiSco) {
  1009. poiSco[i] = '2';
  1010. }
  1011. }
  1012. if (poicom[executor.newCode] == '2') {
  1013. // 说明同上
  1014. for (let i in poicom) {
  1015. poicom[i] = '2';
  1016. }
  1017. }
  1018. }
  1019. if (review.employee_id) {
  1020. // 审批节点--同上 (审批节点默认为2,可以直接全部变成2)
  1021. if (poiSco[review.newCode] == '2') {
  1022. for (let i in poiSco) {
  1023. poiSco[i] = '2';
  1024. }
  1025. }
  1026. if (poicom[review.newCode] == '2') {
  1027. // 说明同上
  1028. for (let i in poicom) {
  1029. poicom[i] = '2';
  1030. }
  1031. }
  1032. }
  1033. if (item.employee_id == executor.employee_id) {
  1034. // 判断当前评分数据是否 与 执行节点的当前帐号一致
  1035. if (poiSco[executor.newCode] == '2') {
  1036. // 如果一致并且执行节点为‘2’即查看所有,那么就修改当前 评分数据 的权限也为‘2’
  1037. poiSco[item.newCode] = '2';
  1038. }
  1039. if (poicom[executor.newCode] == '2') {
  1040. // 执行中的 -- 说明权限-同上
  1041. poicom[item.newCode] = '2';
  1042. }
  1043. }
  1044. if (item.employee_id == review.employee_id) {
  1045. // 判断当前评分数据是否 与 审批节点的当前帐号一致
  1046. if (poiSco[review.newCode] == '2') {
  1047. poiSco[item.newCode] = '2';
  1048. }
  1049. if (poicom[review.newCode] == '2') {
  1050. // 审批的 -- 说明权限-同上
  1051. poicom[item.newCode] = '2';
  1052. }
  1053. }
  1054. let scoredata = {
  1055. // 评分&&说明
  1056. lab: emplo.title,
  1057. prop: emplo.point,
  1058. newCode: emplo.newCode,
  1059. employee_id: emplo.employee_id,
  1060. level: emplo.level,
  1061. remark: emplo.remark,
  1062. knowFrom: 0,
  1063. status: emplo.status
  1064. };
  1065. arr.scoreList.push(scoredata);
  1066. // 单项总分显示
  1067. if (this.retrunFs(list.id, emplo).length > 0 && !emplo.point) { //单项指标评分不显示总分,只评总分显示,要去掉,请把!emplo.point判断去掉
  1068. arr.scoreList.push(...this.retrunFs(list.id, emplo));
  1069. }
  1070. });
  1071. }
  1072. });
  1073. dimeTab.push(arr);
  1074. });
  1075. });
  1076. this.setData({
  1077. weight: weight + '%',
  1078. })
  1079. let poiSOk = false; // 评分--为true时所有评分可看
  1080. let poiCOk = false; // 说明--为true时所有说明可看
  1081. dimeTab.forEach(arr => {
  1082. arr.scoreList.forEach(item => {
  1083. // 判断评分
  1084. if (poiSco[item.newCode] == '1' && item.employee_id == this.data.userInfo.id) {
  1085. item.pointShow = true; //是否显示评分
  1086. } else if (poiSco[item.newCode] == '2') {
  1087. // 当前 评分 数据权限等于2时并且(当前数据id为登陆账号 或 执行中权限等于2(代表当前登陆账号为执行中的一员) 或 审批权限等于2(代表当前登陆账号为审批中的一员)) 时,所有评分都可见
  1088. if (item.employee_id == this.data.userInfo.id || poiSco[executor.newCode] == '2' || poiSco[review.newCode] == '2') {
  1089. poiSOk = true;
  1090. }
  1091. }
  1092. // 判断说明
  1093. if (poicom[item.newCode] == '1' && item.employee_id == this.data.userInfo.id) {
  1094. item.textShow = true; //是否显示说明
  1095. } else if (poicom[item.newCode] == '2') {
  1096. if (item.employee_id == this.data.userInfo.id || poicom[executor.newCode] == '2' || poicom[review.newCode] == '2') {
  1097. poiCOk = true;
  1098. }
  1099. }
  1100. });
  1101. });
  1102. dimeTab.forEach(arr => {
  1103. arr.returnStr = returnStr(arr.update_time)
  1104. let points = []; //最终显示评分
  1105. arr.scoreList.forEach(item => {
  1106. item.isShow = false;//控制是否显示更多
  1107. if(item.employee_id==this.data.userInfo.id){
  1108. item.isShow = true;//控制是否显示更多
  1109. }
  1110. if (poiSOk || getRole(1) || this.data.isCs) {
  1111. item.pointShow = true;
  1112. }
  1113. if (poiCOk || getRole(1) || this.data.isCs) {
  1114. item.textShow = true;
  1115. }
  1116. if (item.status != 2 && item.id != this.data.smdsinsFlow) {
  1117. // delete duplicat[index]
  1118. } else {
  1119. points.push(item);
  1120. }
  1121. });
  1122. arr.scoreList = points;
  1123. });
  1124. this.setData({
  1125. inExecution: dimeTab,
  1126. })
  1127. this.pdLc(); //流程结束后的判断
  1128. let titDatas = [];
  1129. if (data.publicity == 1 && (!this.data.flowNow.code || this.data.flowNow.code == 'review')) {
  1130. // 判断是否公开,并且是审批节点或者流程结束,(流程结束flowNow为空)
  1131. if (this.initData(data.final_point)) {
  1132. titDatas.push({ lab: '考核结果', prop: data.final_point });
  1133. }
  1134. if (this.initData(data.final_level)) {
  1135. titDatas.push({ lab: '绩效等级', prop: data.final_level });
  1136. }
  1137. }
  1138. this.setData({
  1139. titList: titDatas,// 顶部数据
  1140. recordList: []
  1141. })
  1142. let recordList = [];
  1143. // 记录
  1144. let record = res.data.data.record;
  1145. record.forEach((item, index) => {
  1146. if (this.data.userList[item.employee_id]) {
  1147. item.name = this.data.userList[item.employee_id].name;
  1148. }
  1149. // if (index < 3) {
  1150. recordList.push(item);
  1151. // }
  1152. });
  1153. this.setData({
  1154. recordAllList: record,// 顶部数据
  1155. recordList: recordList
  1156. })
  1157. this.skeletonLoad = false;
  1158. } else if (res.data.code == 0) {
  1159. dd.reLaunch({
  1160. url: '../../index/noPage/noPage'
  1161. })
  1162. }
  1163. }).catch((err) => {
  1164. console.log(err)
  1165. if (err.data.code == 0) {
  1166. dd.reLaunch({
  1167. url: '../../index/noPage/noPage'
  1168. })
  1169. }
  1170. })
  1171. },
  1172. showImg(e) {
  1173. let item = e.target.dataset.item
  1174. app.$get('api/drive/grant', { file_id: item.fileId }).then(res => {
  1175. dd.previewFileInDingTalk({
  1176. corpId: app.globalData.corpId,
  1177. spaceId: item.spaceId,
  1178. fileId: item.fileId,
  1179. fileName: item.fileName,
  1180. fileSize: item.fileSize,
  1181. fileType: item.fileType,
  1182. })
  1183. })
  1184. },
  1185. pdLc() {
  1186. let flow = JSON.parse(JSON.stringify(this.data.perfstepFlow)).reverse(); //反转流程,找第一个评分节点
  1187. //流程结束,但是最后一个“评分”节点里有自己显示撤销
  1188. if (this.data.publicity == 1) {
  1189. flow.some(item => {
  1190. if (item.code == 'review' || item.code == 'cc') {
  1191. return true;
  1192. }
  1193. if (item.code == 'score_supervisor' || item.code == 'special_scorer') {
  1194. item.target.some(e => {
  1195. if (e.employee_id == this.data.userInfo.id && e.status == 2) {
  1196. this.setData({
  1197. revocationNodeId: item.id,
  1198. revocationShow: true
  1199. })
  1200. return true;
  1201. }
  1202. });
  1203. return true;
  1204. }
  1205. });
  1206. }
  1207. },
  1208. buttonIf2() {
  1209. if (this.data.Information.id == this.data.userInfo.id) {
  1210. this.setData({
  1211. actionButShow: true
  1212. })
  1213. }
  1214. // 指定管理记录人是否包含自己
  1215. this.data.recordMemberIds.some(item => {
  1216. if (item == this.data.userInfo.id) {
  1217. this.setData({
  1218. recordsManagement: true
  1219. })
  1220. return true;
  1221. }
  1222. });
  1223. this.getSuperior(this.data.Information.id)//判断是否当前被考核人的上级
  1224. if (this.data.userInfo.is_creator == 1) {
  1225. // 如果是创始人也可以操作
  1226. this.setData({
  1227. recordsManagement: true
  1228. })
  1229. }
  1230. if (app.getPermis(3)) {
  1231. // 如果是子管理员并且管理范围权限为“全公司”
  1232. this.setData({
  1233. recordsManagement: true
  1234. })
  1235. }
  1236. },
  1237. buttonIf(item) {
  1238. // 按钮控制
  1239. if (item.status == 1) {
  1240. // 目标确认
  1241. if (item.code == 'confirm') {
  1242. item.target.forEach(tar => {
  1243. if (tar.employee_id == this.data.userInfo.id && tar.status == 1) {
  1244. this.setData({
  1245. targetConfirmed: true
  1246. })
  1247. }
  1248. });
  1249. }
  1250. // 评分按钮
  1251. if (item.code == 'score_self' || item.code == 'score_mutual' || item.code == 'score_supervisor' || item.code == 'special_scorer') {
  1252. item.target.forEach(tar => {
  1253. if (tar.employee_id == this.data.userInfo.id && tar.status == 1) {
  1254. this.setData({
  1255. gradeButShow: true
  1256. })
  1257. }
  1258. });
  1259. }
  1260. // 结果值录入按钮
  1261. if (item.code == 'result_value') {
  1262. item.target.forEach(tar => {
  1263. if (tar.employee_id == this.data.userInfo.id) {
  1264. this.setData({
  1265. resultButShow: true
  1266. })
  1267. }
  1268. });
  1269. }
  1270. // 审批按钮
  1271. if (item.code == 'review') {
  1272. let reviewif = false;
  1273. item.target.forEach(tar => {
  1274. if (tar.employee_id == this.data.userInfo.id && tar.status == 1) {
  1275. reviewif = true;
  1276. }
  1277. });
  1278. this.setData({
  1279. examineButShow: !!reviewif,
  1280. isAction: item.action.indexOf('refuse') >= 0
  1281. })
  1282. }
  1283. this.setData({
  1284. careOfPeopleId: [],
  1285. })
  1286. let careOfPeopleId = [], transferBut = false;
  1287. // 当是结果值录入,上级评分,指定人评分,审批时显示转交按钮
  1288. if (
  1289. item.code == 'target' ||
  1290. item.code == 'score_supervisor' ||
  1291. item.code == 'special_scorer' ||
  1292. item.code == 'result_value' ||
  1293. item.code == 'review' ||
  1294. item.code == 'confirm'
  1295. ) {
  1296. item.target.forEach(add => {
  1297. if ((add.employee_id == this.data.userInfo.id || getRole(1)) && add.status == 1) {
  1298. if (item.code == 'review' || item.code == 'confirm') {
  1299. if (item.action.indexOf('transfer') >= 0 || getRole(1)) {
  1300. careOfPeopleId.push(add);
  1301. transferBut = true
  1302. }
  1303. } else if (item.code == 'score_supervisor') {
  1304. if (item.transfer || getRole(1)) {
  1305. careOfPeopleId.push(add);
  1306. transferBut = true
  1307. }
  1308. } else {
  1309. careOfPeopleId.push(add);
  1310. transferBut = true
  1311. }
  1312. this.setData({
  1313. careOfPeopleId: careOfPeopleId,
  1314. transferBut: transferBut
  1315. })
  1316. }
  1317. });
  1318. }
  1319. }
  1320. },
  1321. // 管理记录||执行计划
  1322. openTrackPath(e) {
  1323. console.log( this.data.planIndex)
  1324. let add = e.target.dataset.str
  1325. let data = {
  1326. know: add,
  1327. apList: this.data.apList,
  1328. packId: this.data.employeeID,
  1329. assessID: this.data.Information.id,
  1330. planIndex: this.data.planIndex,
  1331. recordMemberIds: this.data.recordMemberIds
  1332. };
  1333. setCache('actionplanList', data);
  1334. dd.navigateTo({
  1335. url: `../actionplanList/actionplanList`
  1336. })
  1337. },
  1338. // 判断是否当前被考核人的上级
  1339. getSuperior(id) {
  1340. app.$get('api/per/user/manager_list', { id_code: app.returnCode(id) }).then(res => {
  1341. let superiorList = res.data.data; //被考核人上级
  1342. superiorList.some(item => {
  1343. if (item.id == this.data.userInfo.id) {
  1344. this.setData({
  1345. recordsManagement: true
  1346. })
  1347. return true
  1348. }
  1349. })
  1350. });
  1351. },
  1352. // 撤销
  1353. revocation() {
  1354. let params = {
  1355. id: this.data.employeeID,
  1356. node_id: this.data.revocationNodeId,
  1357. comment: this.data.textArea
  1358. };
  1359. app.$post('api/per/package/revoke', params)
  1360. .then(res => {
  1361. if (res.data.code == 1) {
  1362. app.globalData.showToast('撤销成功');
  1363. this.employeeDet();
  1364. }
  1365. this.closeWindows();
  1366. })
  1367. },
  1368. // 判断是否显示撤销按钮
  1369. isRevocation(dqItem, upItem) {
  1370. // 当前只需要评分节点需要撤回
  1371. //当前节点包含自己并且其他任意一人未完成的显示按钮
  1372. if (dqItem.code == 'score_supervisor' || dqItem.code == 'special_scorer') {
  1373. dqItem.target.some((item, index) => {
  1374. if (item.employee_id == this.data.userInfo.id && item.status == 2) {
  1375. dqItem.target.some((item2, index2) => {
  1376. if (item2.status == 1) {
  1377. this.setData({
  1378. revocationNodeId: dqItem.id,
  1379. revocationShow: true
  1380. })
  1381. return true;
  1382. }
  1383. });
  1384. }
  1385. });
  1386. }
  1387. let is = true; //判断当前节点人员是否有完成的
  1388. //上一节点中包含登录者并且是完成的状态显示按钮
  1389. if (upItem) {
  1390. dqItem.target.some((item, index) => {
  1391. if (item.status == 2) {
  1392. is = false;
  1393. }
  1394. });
  1395. if (upItem.code == 'score_supervisor' || upItem.code == 'special_scorer') {
  1396. upItem.target.some((item, index) => {
  1397. if (item.employee_id == this.data.userInfo.id && item.status == 2 && is) {
  1398. this.setData({
  1399. revocationNodeId: upItem.id,
  1400. revocationShow: true
  1401. })
  1402. return true;
  1403. }
  1404. });
  1405. }
  1406. }
  1407. },
  1408. // 数据初始化,没有值或者空数组的显示-
  1409. initData(str) {
  1410. if (str == null) {
  1411. return str || null;
  1412. }
  1413. if (typeof str === 'object') {
  1414. return str.length > 0 ? str : null;
  1415. } else {
  1416. return str || null;
  1417. }
  1418. },
  1419. indexType(item) {
  1420. return item == 1 ? '量化指标' : item == 2 ? '非量化指标' : item == 3 ? '额外加分项' : item == 4 ? '额外扣分项' : '';
  1421. },
  1422. // 返回节点评分是只评总分的
  1423. retrunFs(eid, e) {
  1424. let arr = [];
  1425. this.data.scoreInfo.forEach(item => {
  1426. if (item.id == eid) {
  1427. item.employees.forEach(u => {
  1428. if (u.point && u.employee_id == e.employee_id) {
  1429. let scoredata = {
  1430. // 评分
  1431. lab: e.title,
  1432. prop: u.point + '(总分)',
  1433. newCode: e.newCode,
  1434. knowFrom: 0,
  1435. employee_id: e.employee_id,
  1436. level: '',
  1437. remark: u.comment,
  1438. status: 2
  1439. };
  1440. arr.push(scoredata);
  1441. }
  1442. });
  1443. }
  1444. });
  1445. return arr;
  1446. },
  1447. gradeTurn() {
  1448. this.setData({
  1449. selectpradio: '',
  1450. selectpradio1: '',
  1451. rejectProp: false,
  1452. rejectData: {},
  1453. })
  1454. let list = [];
  1455. this.data.perfstepFlow.forEach((item, index) => {
  1456. if (item.status == 2 && item.code != 'execution' && item.code != 'cc' && item.target.length != 0) {
  1457. let arr = {};
  1458. arr.id = item.id;
  1459. arr.name = item.remark;
  1460. item.target.forEach((att, aoo) => {
  1461. arr.name += att.employee_name;
  1462. arr.name += item.target.length - aoo > 1 ? ',' : '';
  1463. });
  1464. arr.staff = item.target;
  1465. list.push(arr);
  1466. }
  1467. });
  1468. this.setData({
  1469. rejectList: list,
  1470. popupknowFrom: 1,
  1471. rejectdlg: true,
  1472. })
  1473. },
  1474. // 审批同意
  1475. gradeOk() {
  1476. if (this.data.flowNow.code == 'confirm') {
  1477. // 驳回
  1478. this.setData({
  1479. popupknowFrom: 3
  1480. })
  1481. this.popupknowFrom = 3;
  1482. } else if (this.data.flowNow.code == 'review') {
  1483. // 审批
  1484. this.setData({
  1485. popupknowFrom: 2
  1486. })
  1487. }
  1488. this.setData({
  1489. rejectdlg: true,
  1490. })
  1491. },
  1492. });