approveDetail.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. var app = getApp()
  2. var that;
  3. Page({
  4. data: {
  5. review_id: '',
  6. isBh: false,//是否显示驳回弹窗
  7. textArea: "",
  8. disabled: false,
  9. corpId: '',
  10. },
  11. onLoad(e) {
  12. that = this;
  13. dd.setNavigationBar({ title: "详情" });
  14. if (e.id) {
  15. that.setData({ review_id: parseInt(e.id), userData: app.globalData.userData });
  16. }
  17. if (e.is) {
  18. that.setData({ is: e.is });
  19. }
  20. if (e.corpId) {
  21. that.setData({ corpId: e.corpId });
  22. app.globalData.corpId = e.corpId
  23. }
  24. },
  25. onShow() {
  26. if (app.globalData.userData) {
  27. dd.hideLoading();
  28. that.getData();
  29. } else {
  30. let corpId = that.data.corpId ? that.data.corpId : app.globalData.corpId
  31. app.login(corpId, function (is) {
  32. if (is) {
  33. dd.hideLoading();
  34. that.setData({ userData: app.globalData.userData });
  35. that.getData();
  36. } else {
  37. dd.reLaunch({
  38. url: '../../noJurisdiction/noJurisdiction'
  39. })
  40. }
  41. })
  42. }
  43. },
  44. openDetail() {
  45. dd.navigateTo({
  46. url: '../../statistics/workDetail/workDetail?id=' + that.data.dataDetail.source_id + '&isNot=true'
  47. })
  48. },
  49. showImg(e) {
  50. var index = e.target.dataset.index;
  51. var item = e.target.dataset.item
  52. dd.previewImage({
  53. current: index,
  54. urls: item
  55. });
  56. },
  57. submit() {
  58. // 暂时无法解决这个中途删除积分规则的问题
  59. // if (that.data.dataDetail.item_max_point == -1 && that.data.dataDetail.item_min_point == -1&&that.data.dataDetail.item.item_id) {
  60. // app.globalData.showToast("系统发现此条积分规则制度有变动, 请驳回后让员工按最新的规则重新申请");
  61. // return;
  62. // }
  63. dd.navigateTo({
  64. url: '../approve/approve?id=' + that.data.dataDetail.id
  65. })
  66. },
  67. bindTextAreaBlur(e) {
  68. this.setData({
  69. textArea: e.detail.value
  70. });
  71. },
  72. openBh(e) {
  73. this.setData({ isBh: !this.data.isBh, textArea: '' })
  74. },
  75. confirmBh() {
  76. if (!that.data.textArea) {
  77. app.globalData.showToast("请输入审批意见");
  78. return;
  79. }
  80. this.setData({ disabled: true });
  81. app.$post("api/integral/review", { review_id: that.data.review_id, remark: that.data.textArea, action: "refuse", ticket_count: 0 }).then((res) => {
  82. app.globalData.showToast("已驳回");
  83. that.setData({ disabled: false });
  84. var pages = getCurrentPages();//当上一页的page不等于一时,执行上一页的方法
  85. var active = pages[pages.length - 2];
  86. if (active) {
  87. if (active.data.page != 1) {
  88. active.refreshData(that.data.review_id);
  89. }
  90. setTimeout(() => {
  91. dd.navigateBack({ delta: 1 });
  92. }, 1000);
  93. } else {
  94. setTimeout(() => {
  95. dd.reLaunch({
  96. url: '/pages/workbench/index/index'
  97. })
  98. }, 1000);
  99. }
  100. })
  101. },
  102. openCx() {
  103. dd.confirm({
  104. title: '撤掉审批',
  105. content: '你确定撤掉此项吗?',
  106. confirmButtonText: '确定',
  107. cancelButtonText: '取消',
  108. success: (result) => {
  109. if (result.confirm) {
  110. app.$post("api/integral/review/destroy", { review_id: that.data.review_id }).then((res) => {
  111. app.globalData.showToast("已撤掉");
  112. var pages = getCurrentPages();//当上一页的page不等于一时,执行上一页的方法
  113. var active = pages[pages.length - 2];
  114. if (active) {
  115. if (active.data.page != 1) {
  116. active.refreshData(that.data.review_id);
  117. active.filtrationList(2, item.review_id);
  118. }
  119. setTimeout(() => {
  120. dd.navigateBack({ delta: 1 })
  121. }, 1000);
  122. } else {
  123. setTimeout(() => {
  124. dd.reLaunch({
  125. url: '/pages/workbench/index/index'
  126. })
  127. }, 1000);
  128. }
  129. })
  130. }
  131. },
  132. });
  133. },
  134. getData() {
  135. app.$get("api/integral/review", { review_id: that.data.review_id }).then((res) => {
  136. var data = res.data.data;
  137. data.typeName = app.getTypesItem(data.pt_id).name;
  138. this.setData({
  139. dataDetail: data
  140. })
  141. })
  142. },
  143. });