repair-edit.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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"
  7. v-for="(item, index) in listData"
  8. :key="index"
  9. @tap="handleDetail(item.applicationId)"
  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
  14. :text="$BaseTool.Object.getField(statusMap, item.status)"
  15. :status="
  16. $DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[item.status]
  17. "
  18. />
  19. </view>
  20. <view class="mt-2 d-flex j-between">
  21. <view class="text-color-3 f-size-32 f-weight-bold">{{
  22. item.repairUserName
  23. }}</view>
  24. </view>
  25. <view class="f-size-26 text-color-6 f-weight-4 mt-2">{{
  26. item.applyTime
  27. }}</view>
  28. <view
  29. class="d-flex j-end edit-box"
  30. v-if="
  31. $DictCache.VALUE.REPAIR_CHECK_STATUS.NOT_ACCEPTANCED ===
  32. item.status
  33. "
  34. >
  35. <view class="text-color-3 f-size-32 edit">
  36. <view @click.stop="handleApprove(item)">通过</view>
  37. </view>
  38. <view class="text-color-3 f-size-32 edit">
  39. <view @click.stop="handleReturn(item)">驳回</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="py3">
  44. <u-loadmore :status="status" />
  45. </view>
  46. </template>
  47. <template v-else>
  48. <view class="empty">
  49. <u-empty text="暂无数据" mode="list"></u-empty>
  50. </view>
  51. </template>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. list: [],
  60. current: 0,
  61. // 加载更多
  62. status: "loadmore",
  63. page: 1,
  64. limit: 10,
  65. type: "",
  66. loadMore: true,
  67. listData: [],
  68. statusMap: {},
  69. };
  70. },
  71. onPullDownRefresh() {
  72. // 请求结束取消刷新
  73. this.page = 1;
  74. this.loadMore = true;
  75. this.listData = [];
  76. this.initData();
  77. uni.stopPullDownRefresh();
  78. },
  79. onReachBottom() {
  80. if (this.loadMore) {
  81. this.page++;
  82. this.initData();
  83. }
  84. },
  85. onLoad() {},
  86. onShow() {
  87. this.page = 1;
  88. this.loadMore = true;
  89. this.listData = [];
  90. this.initData();
  91. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  92. this.$DictCache.TYPE.REPAIR_CHECK_STATUS
  93. );
  94. },
  95. methods: {
  96. handleReturn(item) {
  97. let that = this;
  98. uni.showModal({
  99. title: "提示",
  100. content: "确认驳回?",
  101. success: function (res) {
  102. if (res.confirm) {
  103. uni.navigateTo({
  104. url: "/pages/repair/repair-return?id=" + item.id,
  105. });
  106. // that.$Http
  107. // .fetchRepairCheck({
  108. // id:item.id
  109. // })
  110. // .then((res) => {
  111. // console.log(res);
  112. // that.page = 1;
  113. // that.loadMore = true;
  114. // that.listData = [];
  115. // that.initData();
  116. // })
  117. }
  118. },
  119. });
  120. },
  121. // 通过
  122. handleApprove(item) {
  123. let that = this;
  124. uni.showModal({
  125. title: "提示",
  126. content: "确认通过?",
  127. success: function (res) {
  128. if (res.confirm) {
  129. that.$Http.approve(item).then((res) => {
  130. that.page = 1;
  131. that.loadMore = true;
  132. that.listData = [];
  133. that.initData();
  134. });
  135. }
  136. },
  137. });
  138. },
  139. handleClick() {
  140. uni.navigateTo({
  141. url: "/pages/repair-add/repair-add",
  142. });
  143. },
  144. // 跳转详情
  145. handleDetail(id) {
  146. uni.navigateTo({
  147. url: "/pages/repair-detail/repair-detail?detailId=" + id,
  148. });
  149. },
  150. // 初始化
  151. initData() {
  152. const that = this;
  153. that.status = "loading";
  154. this.$Http
  155. .getRepairCheckPage({
  156. pageNum: this.page,
  157. pageSize: this.limit,
  158. filter: 0,
  159. })
  160. .then((res) => {
  161. let data = res.data.rows;
  162. if (data && data.length > 0 && data.length < that.limit) {
  163. that.status = "nomore";
  164. that.loadMore = false;
  165. } else if (data.length == that.limit) {
  166. that.status = "loadmore";
  167. } else {
  168. that.status = "nomore";
  169. }
  170. that.listData = [...that.listData, ...data];
  171. });
  172. },
  173. },
  174. };
  175. </script>
  176. <style lang="less">
  177. page {
  178. background-color: #f4f4f4;
  179. }
  180. .box {
  181. border-radius: 20rpx;
  182. padding-right: 0;
  183. }
  184. .edit-box {
  185. padding: 0 30rpx;
  186. margin-top: 40rpx;
  187. .edit {
  188. padding: 8rpx 40rpx;
  189. border: 1px solid #ddd;
  190. border-radius: 20rpx;
  191. font-size: 26rpx;
  192. color: #666;
  193. margin-left: 30rpx;
  194. }
  195. }
  196. </style>