service.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view>
  3. <common-tabs :list="list" :current="current" @change="change" />
  4. <view class="p-top8">
  5. <template v-if="listData.length > 0">
  6. <view class="mx3 my2 p3 bg-color-white box p-relative" v-for="(item, index) in listData" :key="index"
  7. @tap="handleDetail(item)" @longpress="showMask(item.id, $event)">
  8. <common-mask :item="item" :maskId="maskId" @hide="maskId = 0" @del="handleDel(item.id)" />
  9. <view class="d-flex j-between border-bottom pb-2 a-center">
  10. <view class="text-color-b f-size-26">{{ item.sbName }} ({{ item.sbNo }})</view>
  11. <view class="f-size-24 state-orange">{{
  12. statusMap[item.status]
  13. }}</view>
  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.actualUser
  18. }}-{{
  19. item.sbCph
  20. }}</view>
  21. </view>
  22. <view class="f-size-26 text-color-6 f-weight-4 mt-2">{{
  23. item.applyTime
  24. }}</view>
  25. <!-- 列表页不再直接提供接收/转派/完成/提交审核等操作,统一进入详情页处理 -->
  26. <view class="d-flex j-end edit-box">
  27. <view class="text-color-3 f-size-32 edit" @click.stop="handleDetail(item)">
  28. <view>查看详情</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. list: [
  49. ],
  50. current: 0,
  51. // 加载更多
  52. status: 'loadmore',
  53. page: 1,
  54. limit: 10,
  55. sbId: '',
  56. type: 0,
  57. filter: -1,
  58. loadMore: true,
  59. listData: [],
  60. statusMap: {},
  61. sourceMap: {},
  62. maskId: 0
  63. };
  64. },
  65. onPullDownRefresh() {
  66. // 请求结束取消刷新
  67. this.page = 1;
  68. this.loadMore = true;
  69. this.listData = [];
  70. this.initData();
  71. uni.stopPullDownRefresh();
  72. },
  73. onReachBottom() {
  74. if (this.loadMore) {
  75. this.page++;
  76. this.initData();
  77. }
  78. },
  79. onLoad(options) {
  80. this.sbId = options.sbId
  81. this.filter = options.filter
  82. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  83. this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS
  84. );
  85. this.sourceMap = this.$DictCache.getLabelByValueMapByType(
  86. this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE
  87. );
  88. this.list = [{ label: '全部', value: '' }].concat(
  89. this.$DictCache.getChildrenList(this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
  90. );
  91. },
  92. onShow() {
  93. this.page = 1;
  94. this.loadMore = true;
  95. this.listData = [];
  96. this.initData();
  97. },
  98. onHide() {
  99. this.maskId = 0
  100. },
  101. methods: {
  102. showMask(id, e) {
  103. this.maskId = id
  104. // #ifdef H5
  105. e.preventDefault()
  106. // #endif
  107. },
  108. handleDel(id) {
  109. const that = this;
  110. const params = [];
  111. params.push(id);
  112. uni.showModal({
  113. title: '提示',
  114. content: '您确认删除吗?',
  115. success: (res) => {
  116. if (res.confirm) {
  117. this.$Http.deleteRepairForms(params).then((res) => {
  118. uni.showToast({ title: '删除成功' });
  119. this.page = 1;
  120. this.loadMore = true;
  121. this.listData = [];
  122. this.initData();
  123. });
  124. } else if (res.cancel) {
  125. }
  126. }
  127. });
  128. },
  129. // tab
  130. change(index) {
  131. this.current = index;
  132. // type 做相应改变
  133. this.type = index;
  134. this.page = 1;
  135. this.loadMore = true;
  136. this.listData = [];
  137. this.initData();
  138. },
  139. // 跳转详情
  140. handleDetail(item) {
  141. // if (index == 0) {
  142. // uni.navigateTo({
  143. // url: '../service-add/service-add'
  144. // });
  145. // } else {
  146. // uni.navigateTo({
  147. // url: '../service-detail/service-detail'
  148. // });
  149. // }
  150. if (this.maskId != 0) return this.maskId = 0
  151. uni.navigateTo({
  152. url: '/pages/service-detail/service-detail?id=' + item.id
  153. });
  154. },
  155. initData() {
  156. const that = this;
  157. that.status = 'loading';
  158. this.$Http
  159. .getRepairApplicationFormPage({
  160. pageNum: this.page,
  161. pageSize: this.limit,
  162. sbId: this.sbId,
  163. searchType: 2,
  164. type: 1,
  165. filter: this.filter,
  166. status: this.type,
  167. dataScope: {
  168. sortBy: 'asc, desc',
  169. sortName: 'status, apply_time'
  170. }
  171. })
  172. .then((res) => {
  173. const data = res.data.rows;
  174. console.log(res);
  175. if (data && data.length > 0 && data.length < that.limit) {
  176. that.status = 'nomore';
  177. that.loadMore = false;
  178. } else if (data.length === that.limit) {
  179. that.status = 'loadmore';
  180. } else {
  181. that.status = 'nomore';
  182. }
  183. that.listData = [...that.listData, ...data];
  184. });
  185. }
  186. }
  187. };
  188. </script>
  189. <style lang="scss">
  190. page {
  191. background-color: #f4f4f4;
  192. }
  193. .box {
  194. padding-right: 0;
  195. border-radius: 20rpx;
  196. }
  197. .edit-box {
  198. padding: 0 30rpx;
  199. margin-top: 40rpx;
  200. .edit {
  201. padding: 8rpx 40rpx;
  202. border: 1px solid #ddd;
  203. border-radius: 20rpx;
  204. font-size: 26rpx;
  205. color: #666;
  206. margin-left: 30rpx;
  207. }
  208. }
  209. </style>