workList.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. var app = getApp();
  2. var that;
  3. Page({
  4. data: {
  5. id: '',
  6. minuteIndex: 0,//条件选择
  7. minuteArray: [
  8. { value: 0, text: '全部' },
  9. { value: 1, text: '目标制定' },
  10. { value: 2, text: '目标确认' },
  11. { value: 3, text: '执行中' },
  12. { value: 4, text: '结果值录入' },
  13. { value: 5, text: '评分' },
  14. { value: 9, text: '审批' },
  15. { value: 11, text: '结束' }
  16. ],
  17. popupCx: '',
  18. showStaff: false,//显示员工选择
  19. staffVal: '全部员工',
  20. showTissue: false,//显示部门组件
  21. TissueVal: '全公司',
  22. employee_list: [{ id: 0, name: '全部员工' }],
  23. employee_index: 0,
  24. },
  25. onLoad(e) {
  26. that = this;
  27. this.setData({
  28. id: e.id,
  29. e:e,
  30. })
  31. dd.setNavigationBar({ title: e.tel });
  32. this.getInitData();
  33. this.getList();
  34. },
  35. getStr(type) {
  36. let is = '';
  37. switch (type) {
  38. case 1:
  39. is = '目标制定';
  40. break;
  41. case 2:
  42. is = '目标确认';
  43. break;
  44. case 3:
  45. is = '执行中';
  46. break;
  47. case 4:
  48. is = '结果值录入';
  49. break;
  50. case 5:
  51. is = '评分';
  52. break;
  53. case 9:
  54. is = '审批';
  55. break;
  56. case 11:
  57. is = '结束';
  58. break;
  59. }
  60. return is;
  61. },
  62. getInitData() {
  63. app.$get('api/per/package/info_v3_aid', { package_id: this.data.id }).then(res => {
  64. let employee_list = this.data.employee_list;
  65. employee_list.push(...res.data.data.employees);
  66. this.setData({
  67. employee_list: employee_list
  68. })
  69. })
  70. },
  71. getList(is) {
  72. if (!is) { this.setData({ page: 1 }) };
  73. this.setData({ list: [] })
  74. let data = {
  75. package_id: this.data.id,
  76. doing_id: this.data.minuteArray[this.data.minuteIndex].value,
  77. page: this.data.page,
  78. page_size: 20,
  79. }
  80. if (this.data.dept_id) {
  81. data.dept_ids = JSON.stringify([this.data.dept_id]);
  82. }
  83. if (this.data.employee_index != 0) {
  84. data.employee_ids = JSON.stringify([this.data.employee_list[this.data.employee_index].id])
  85. }
  86. app.$get('api/per/package/info_v3', data).then((res) => {
  87. var list = res.data.data.list;
  88. list.forEach(item => {
  89. item.str=this.getStr(item.doing_id);
  90. if (item.employee_id&&app.globalData.usersList[item.employee_id]) {
  91. //当是导入导出时,显示登录者
  92. item.userInfo = app.globalData.usersList[item.employee_id];
  93. item.dept_list = app.globalData.usersList[item.employee_id].dept_list
  94. }
  95. });
  96. if (this.data.page !== 1) {
  97. list = this.data.list.concat(list);
  98. }
  99. this.setData({
  100. list: list,
  101. isData: list.length == res.data.data.total
  102. })
  103. })
  104. },
  105. openDetail(e){
  106. let item=e.target.dataset.item
  107. let str=`../performanceDetails/performanceDetails?assId=${this.data.id}&staffId=${item.employee_id}&tel=${this.data.e.tel}`
  108. dd.navigateTo({
  109. url: str
  110. })
  111. },
  112. activeItem(e) {
  113. console.log(e.detail.value)
  114. this.setData({ employee_index: e.detail.value, })
  115. this.getList();
  116. },
  117. activeItem2(e) {
  118. this.setData({ minuteIndex: e.detail.value, })
  119. this.getList();
  120. },
  121. //上啦加载
  122. onScrollToLower() {
  123. if (!that.data.isData) {
  124. this.setData({
  125. page: ++this.data.page
  126. })
  127. this.getList(true);
  128. }
  129. },
  130. //显示部门选择组件
  131. selectTissue() {
  132. this.setData({ showTissue: !this.data.showTissue, popupCx: 'container__mask', })
  133. },
  134. //选择部门
  135. onConfirmTissue(data) {
  136. console.log(data);
  137. this.setData({ dept_id: data.dept_id, TissueVal: data.name })
  138. this.getList();
  139. },
  140. //显示选择员工
  141. selectStaff() {
  142. this.setData({
  143. popupCx: 'container__mask',
  144. showStaff: true
  145. })
  146. },
  147. //关闭弹窗
  148. onClose() {
  149. this.setData({
  150. showTissue: false,
  151. showStaff: false,
  152. popupCx: '',
  153. rule_item_id: ''
  154. })
  155. },
  156. //选择员工
  157. onConfirmStaff(data) {
  158. if (!data) {
  159. this.setData({ staffVal: '全部员工', employee_ids: '', page: 1, rule_item_id: '' })
  160. this.getData();
  161. return false;
  162. }
  163. if (data.length > 0) {
  164. if (data.length > 1) {
  165. var str = "";
  166. var arr = [];
  167. data.forEach((item) => {
  168. str += item.name + ','
  169. arr.push(item.id);
  170. })
  171. var employee_ids = arr.join(',');
  172. this.setData({ staffVal: str.substring(0, str.length - 1), employee_ids: employee_ids, page: 1, rule_item_id: '' })
  173. } else {
  174. this.setData({ staffVal: data[0].name, employee_ids: [data[0].id], page: 1, rule_item_id: '' })
  175. }
  176. } else {
  177. this.setData({ staffVal: '全部员工', employee_ids: [], page: 1, rule_item_id: '' })
  178. }
  179. this.getData();
  180. },
  181. });