staff.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*******************************************************************************
  2. * Copyright(c) 2022 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:
  5. * 2.员工资料列表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * admin 2024-2-12 1.00
  9. *******************************************************************************/
  10. const mixins = require('@/mixins/index.js')
  11. const Constants = require('@/utils/Constants.js')
  12. Page({
  13. mixins: [mixins],
  14. /**
  15. * 页面的初始数据
  16. */
  17. data: {
  18. // 查询条件
  19. searchContent: [],
  20. totallength: 0, //视图下方提醒数量
  21. // 底部保存按钮
  22. buttonFootList: [{
  23. name: 'add',
  24. title: mixins.$t('add')
  25. }],
  26. contentnFootList: [
  27. ],
  28. btnFormData: null,
  29. active: 0,
  30. tagList: [
  31. { title: mixins.$t('all') },
  32. { title: mixins.$t('resignation') },
  33. { title: mixins.$t('leaveOffice') }
  34. ],
  35. // 列表区(内容)
  36. contentList: [
  37. { name: 'staffCode', title: mixins.$t('staffCode') },
  38. { name: 'staffPhone', title: mixins.$t('staffPhone') },
  39. { name: 'orgName', title: mixins.$t('orgId') },
  40. { name: 'roleNames', title: mixins.$t('roleName') },
  41. ],
  42. // 弹出按钮
  43. buttonList: [
  44. { name: 'staffRight', title: mixins.$t('functionalPermissions') },
  45. { name: 'staffPurview', title: mixins.$t('purviewPermissions') },
  46. { name: 'leaveOffice', title: mixins.$t('leaveOffice') },
  47. ],
  48. // 主键Id
  49. primaryKey: 'staffId',
  50. // 路由
  51. routeObjName: 'staff',
  52. },
  53. /**
  54. * @desc : 切换页面
  55. * @date : 2024/2/1 15:49
  56. * @author : 姜永辉
  57. */
  58. onChangeTabs(e) {
  59. let index = e.detail.detail.index
  60. this.setData({
  61. active: index,
  62. })
  63. // 默认查询
  64. this.searchData();
  65. },
  66. /**
  67. * @desc : 设置额外参数
  68. * @date : 2024/2/1 15:49
  69. * @author : 姜永辉
  70. */
  71. setSearchParams(params) {
  72. // 在职离职状态
  73. params.hrStatus = (this.data.active == 0 ? null : this.data.active)
  74. return params
  75. },
  76. /**
  77. * @desc : 查询
  78. * @date : 2024/2/1 15:49
  79. * @author : 姜永辉
  80. */
  81. getData(params) {
  82. return this.excute(this.data.service, this.data.service.selectByCond, params);
  83. },
  84. /**
  85. * @desc : 如果页面需要后续处理,再进行处理
  86. * @date : 2024/2/1 15:49
  87. * @author : 姜永辉
  88. */
  89. handleSearchData(data) {
  90. // 员工的数量
  91. let tableData = this.data.tableData || []
  92. let contentnFootList = this.data.contentnFootList
  93. tableData.forEach(it => {
  94. if (it.hrStatus == 0) {
  95. it.backgroundColor = 'red'
  96. }
  97. })
  98. contentnFootList.forEach(it => {
  99. if (it.type == 'count') {
  100. it.bill = tableData.length
  101. }
  102. })
  103. this.setData({
  104. tableData,
  105. contentnFootList
  106. })
  107. },
  108. /**
  109. * @desc : 离职
  110. * @date : 2024/2/1 15:49
  111. * @author : 姜永辉
  112. */
  113. leaveOffice(e) {
  114. console.log(e);
  115. let item = e
  116. let id = item.staffId
  117. let params = {
  118. staffId: item.staffId,
  119. flgValid: false,
  120. wxUserId: item.wxUserId,
  121. hrStatus: 2 // 离职2 在职1
  122. }
  123. this.excute(this.data.service, this.data.service.leaveOffice, params).then(res => {
  124. if (res.data.code == Constants.SUCESS_CODE) {
  125. // 重新查询
  126. this.searchData()
  127. }
  128. })
  129. },
  130. })