transfer-approval.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view>
  3. <view class="">
  4. <template v-if="listData.length > 0">
  5. <view
  6. class="mx3 my2 p3 bg-color-white box p-relative"
  7. v-for="(item, index) in listData"
  8. :key="index"
  9. @tap="handleDetail(item.id)"
  10. >
  11. <view class="d-flex j-between border-bottom pb-2 a-center">
  12. <view class="text-color-b f-size-26">{{ item.sbName }}</view>
  13. <my-badge text="转派审批中" status="processing" />
  14. </view>
  15. <view class="mt-2 d-flex j-between">
  16. <view class="text-color-3 f-size-32 f-weight-bold">{{
  17. item.userName
  18. }}</view>
  19. </view>
  20. <view class="f-size-26 text-color-6 f-weight-4 mt-2">{{
  21. item.applyTime
  22. }}</view>
  23. <view class="d-flex j-end edit-box">
  24. <view class="text-color-3 f-size-32 edit">
  25. <view @click.stop="handleApprove(item)">同意</view>
  26. </view>
  27. <view class="text-color-3 f-size-32 edit">
  28. <view @click.stop="handleReject(item)">驳回</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="py3">
  33. <u-loadmore :status="status" />
  34. </view>
  35. </template>
  36. <template v-else>
  37. <view class="empty">
  38. <u-empty text="暂无待审批的转派工单" mode="list"></u-empty>
  39. </view>
  40. </template>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. // 加载更多
  49. status: 'loadmore',
  50. page: 1,
  51. limit: 10,
  52. loadMore: true,
  53. listData: []
  54. };
  55. },
  56. onPullDownRefresh() {
  57. this.page = 1;
  58. this.loadMore = true;
  59. this.listData = [];
  60. this.initData();
  61. uni.stopPullDownRefresh();
  62. },
  63. onReachBottom() {
  64. if (this.loadMore) {
  65. this.page++;
  66. this.initData();
  67. }
  68. },
  69. onShow() {
  70. this.page = 1;
  71. this.loadMore = true;
  72. this.listData = [];
  73. this.initData();
  74. },
  75. methods: {
  76. // 同意转派
  77. handleApprove(item) {
  78. const that = this;
  79. uni.showModal({
  80. title: '同意转派',
  81. editable: true,
  82. placeholderText: '可填写审批意见(选填)',
  83. success: function (res) {
  84. if (res.confirm) {
  85. that.$Http
  86. .transferApprove({
  87. id: item.id,
  88. repairDispatchRemark: res.content || ''
  89. })
  90. .then(() => {
  91. uni.showToast({ title: '已同意', icon: 'success' });
  92. that.refresh();
  93. });
  94. }
  95. }
  96. });
  97. },
  98. // 驳回转派
  99. handleReject(item) {
  100. const that = this;
  101. uni.showModal({
  102. title: '驳回转派',
  103. editable: true,
  104. placeholderText: '请填写驳回原因',
  105. success: function (res) {
  106. if (res.confirm) {
  107. if (!res.content || !res.content.trim()) {
  108. uni.showToast({ title: '请填写驳回原因', icon: 'none' });
  109. return;
  110. }
  111. that.$Http
  112. .transferReject({
  113. id: item.id,
  114. repairDispatchRemark: res.content
  115. })
  116. .then(() => {
  117. uni.showToast({ title: '已驳回', icon: 'success' });
  118. that.refresh();
  119. });
  120. }
  121. }
  122. });
  123. },
  124. // 跳转详情(复用报修审核详情,含转派记录展示)
  125. handleDetail(id) {
  126. uni.navigateTo({
  127. url: '/pages/repair-check/repair-detail?detailId=' + id
  128. });
  129. },
  130. refresh() {
  131. this.page = 1;
  132. this.loadMore = true;
  133. this.listData = [];
  134. this.initData();
  135. },
  136. // 初始化:查询转派审批中(searchType=4)的工单
  137. initData() {
  138. const that = this;
  139. that.status = 'loading';
  140. this.$Http
  141. .getRepairApplicationFormPage({
  142. pageNum: this.page,
  143. pageSize: this.limit,
  144. searchType: 4,
  145. filter: 0,
  146. dataScope: {
  147. sortBy: 'desc',
  148. sortName: 'update_time'
  149. }
  150. })
  151. .then((res) => {
  152. const data = res.data.rows;
  153. if (data && data.length > 0 && data.length < that.limit) {
  154. that.status = 'nomore';
  155. that.loadMore = false;
  156. } else if (data.length == that.limit) {
  157. that.status = 'loadmore';
  158. } else {
  159. that.status = 'nomore';
  160. }
  161. that.listData = [...that.listData, ...data];
  162. });
  163. }
  164. }
  165. };
  166. </script>
  167. <style lang="less">
  168. page {
  169. background-color: #f4f4f4;
  170. }
  171. .box {
  172. border-radius: 20rpx;
  173. padding-right: 0;
  174. }
  175. .edit-box {
  176. padding: 0 30rpx;
  177. margin-top: 40rpx;
  178. .edit {
  179. padding: 8rpx 40rpx;
  180. border: 1px solid #ddd;
  181. border-radius: 20rpx;
  182. font-size: 26rpx;
  183. color: #666;
  184. margin-left: 30rpx;
  185. }
  186. }
  187. </style>