performanceDetails.js 46 KB

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