approveDetail.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. }, function () { })
  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. dd.navigateTo({
  59. url: '../approve/approve?id=' + that.data.dataDetail.id
  60. })
  61. },
  62. bindTextAreaBlur(e) {
  63. this.setData({
  64. textArea: e.detail.value
  65. });
  66. },
  67. openBh(e) {
  68. this.setData({ isBh: !this.data.isBh, textArea: '' })
  69. },
  70. confirmBh() {
  71. if (!that.data.textArea) {
  72. app.globalData.showToast("请输入审批意见");
  73. return;
  74. }
  75. this.setData({ disabled: true });
  76. app.$post("api/integral/review", { review_id: that.data.review_id, remark: that.data.textArea, action: "refuse", ticket_count: 0 }).then((res) => {
  77. app.globalData.showToast("已驳回");
  78. that.setData({ disabled: false });
  79. var pages = getCurrentPages();//当上一页的page不等于一时,执行上一页的方法
  80. var active = pages[pages.length - 2];
  81. if (active) {
  82. if (active.data.page != 1) {
  83. active.refreshData(that.data.review_id);
  84. }
  85. setTimeout(() => {
  86. dd.navigateBack({ delta: 1 });
  87. }, 1000);
  88. } else {
  89. setTimeout(() => {
  90. dd.reLaunch({
  91. url: '/pages/workbench/index/index'
  92. })
  93. }, 1000);
  94. }
  95. })
  96. },
  97. openCx() {
  98. dd.confirm({
  99. title: '撤掉审批',
  100. content: '您确定撤掉此项吗?',
  101. confirmButtonText: '确定',
  102. cancelButtonText: '取消',
  103. success: (result) => {
  104. if (result.confirm) {
  105. app.$post("api/integral/review/destroy", { review_id: that.data.review_id }).then((res) => {
  106. app.globalData.showToast("已撤掉");
  107. var pages = getCurrentPages();//当上一页的page不等于一时,执行上一页的方法
  108. var active = pages[pages.length - 2];
  109. if (active) {
  110. if (active.data.page != 1) {
  111. active.refreshData(that.data.review_id);
  112. active.filtrationList(2, item.review_id);
  113. }
  114. setTimeout(() => {
  115. dd.navigateBack({delta: 1})
  116. }, 1000);
  117. } else {
  118. setTimeout(() => {
  119. dd.reLaunch({
  120. url: '/pages/workbench/index/index'
  121. })
  122. }, 1000);
  123. }
  124. })
  125. }
  126. },
  127. });
  128. },
  129. getData() {
  130. app.$get("api/integral/review", { review_id: that.data.review_id }).then((res) => {
  131. var data = res.data.data;
  132. data.typeName = app.getTypesItem(data.pt_id).name;
  133. this.setData({
  134. dataDetail: data
  135. })
  136. })
  137. },
  138. });