actionplanList.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. var app = getApp();
  2. var that;
  3. import { returnStr, setCache, getCache, _debounce, getRole } from '../../../utils/util'
  4. Page({
  5. data: {
  6. Tit: '',
  7. knowFrom: '',
  8. backlogList: [],
  9. packId: 0, //记录id
  10. assessID: 0, //记录人
  11. recordMemberIds: []
  12. },
  13. onLoad() {
  14. that = this;
  15. },
  16. onShow() {
  17. this.setData({
  18. query: getCache('actionplanList')
  19. })
  20. this.init()
  21. },
  22. openPlanPath(e) {
  23. let apList=e.target.dataset.item
  24. let data = {
  25. know: this.data.knowFrom,
  26. apList: JSON.stringify(apList),
  27. packId: this.data.packId,
  28. assessID: this.data.assessID
  29. };
  30. setCache('actionplanDetails', data);
  31. dd.navigateTo({
  32. url: `../actionplanDetails/actionplanDetails?`
  33. })
  34. },
  35. init() {
  36. let query = this.data.query;
  37. this.setData({
  38. knowFrom: query.know,
  39. Tit:query.know=='action'? '执行计划':'管理记录',
  40. packId: query.packId,
  41. assessID: query.assessID,
  42. recordMemberIds: query.recordMemberIds ? query.recordMemberIds : [],
  43. })
  44. if (this.data.knowFrom == 'action') {
  45. //执行计划
  46. dd.setNavigationBar({ title: "执行计划" });
  47. } else if (this.data.knowFrom == 'admnin') {
  48. //管理记录
  49. dd.setNavigationBar({ title: "管理记录" });
  50. }
  51. let apList = JSON.parse(query.apList);
  52. apList.forEach((item, keys) => {
  53. item.index.forEach((arr, index) => {
  54. arr.planIndex = [keys, index]; //当打开执行计划时的下标
  55. arr.isOperation = true;
  56. });
  57. });
  58. // 当有管理记录人时过滤数据
  59. let isFiltration = true; //是否需要过滤数据源
  60. if (this.data.recordMemberIds.length > 0) {
  61. // this.$getEmployeeAll()[this.assessID].employee_detail.superior_list.some(item => {
  62. // // 判断被考核人的上级是否包含登录者
  63. // if (item.id == this.$getUserData_jx().id) {
  64. // isFiltration = false;
  65. // return true;
  66. // }
  67. // });
  68. if (app.globalData.userData.is_creator == 1) {
  69. // 如果是创始人也可以操作
  70. isFiltration = false;
  71. }
  72. if (app.getPermis(3)) {
  73. // 如果是子管理员并且管理范围权限为“全公司”
  74. isFiltration = false;
  75. }
  76. if (isFiltration) {
  77. let actionPlanList = JSON.parse(JSON.stringify(apList));
  78. actionPlanList.forEach((item, index) => {
  79. item.index.forEach(item2 => {
  80. item2.isOperation = false;
  81. if (item2.record_ids.indexOf(app.globalData.userData.id) >= 0) {
  82. item2.isOperation = true;
  83. }
  84. });
  85. });
  86. this.setData({
  87. backlogList: actionPlanList
  88. })
  89. } else {
  90. this.setData({
  91. backlogList: apList
  92. })
  93. }
  94. } else {
  95. this.setData({
  96. backlogList: apList
  97. })
  98. }
  99. }
  100. });