service.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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 }}</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. <view class="d-flex j-end edit-box">
  26. <view class="text-color-3 f-size-32 edit" v-if="
  27. item.status ===
  28. $DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED">
  29. <view @click.stop="handleDealEdit(item)">接收</view>
  30. </view>
  31. <view class="text-color-3 f-size-32 edit" v-if="!item.fourRepairUser && item.repairUserId">
  32. <view @click.stop="handleDispatching(item)">转派</view>
  33. </view>
  34. <view class="text-color-3 f-size-32 edit" v-if="
  35. [
  36. $DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING,
  37. $DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK,
  38. ].includes(item.status)
  39. ">
  40. <view @click.stop="handleEdit(item)">完成</view>
  41. </view>
  42. <view class="text-color-3 f-size-32 edit" v-if="
  43. item.status ===
  44. $DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.WAIT_SUBMIT ||
  45. item.status ===
  46. $DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK
  47. ">
  48. <view @click.stop="handleExamine(item)">提交审核</view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="py3">
  53. <u-loadmore :status="status" />
  54. </view>
  55. </template>
  56. <template v-else>
  57. <view class="empty">
  58. <u-empty text="暂无数据" mode="list"></u-empty>
  59. </view>
  60. </template>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. export default {
  66. data() {
  67. return {
  68. list: [
  69. ],
  70. current: 2,
  71. // 加载更多
  72. status: 'loadmore',
  73. page: 1,
  74. limit: 10,
  75. sbId: '',
  76. type: 2,
  77. filter: -1,
  78. loadMore: true,
  79. listData: [],
  80. statusMap: {},
  81. sourceMap: {},
  82. maskId: 0
  83. };
  84. },
  85. onPullDownRefresh() {
  86. // 请求结束取消刷新
  87. this.page = 1;
  88. this.loadMore = true;
  89. this.listData = [];
  90. this.initData();
  91. uni.stopPullDownRefresh();
  92. },
  93. onReachBottom() {
  94. if (this.loadMore) {
  95. this.page++;
  96. this.initData();
  97. }
  98. },
  99. onLoad(options) {
  100. this.sbId = options.sbId
  101. this.filter = options.filter
  102. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  103. this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS
  104. );
  105. this.sourceMap = this.$DictCache.getLabelByValueMapByType(
  106. this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE
  107. );
  108. this.list = [{ label: '全部', value: '' }].concat(
  109. this.$DictCache.getChildrenList(this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
  110. );
  111. },
  112. onShow() {
  113. this.page = 1;
  114. this.loadMore = true;
  115. this.listData = [];
  116. this.initData();
  117. },
  118. onHide() {
  119. this.maskId = 0
  120. },
  121. methods: {
  122. showMask(id, e) {
  123. this.maskId = id
  124. // #ifdef H5
  125. e.preventDefault()
  126. // #endif
  127. },
  128. // 提交审批验收
  129. handleExamine(item) {
  130. var that = this;
  131. uni.showModal({
  132. title: '提示',
  133. content: '确认提交审核?',
  134. success: function (res) {
  135. if (res.confirm) {
  136. that.$Http
  137. .examine({
  138. id: item.id
  139. })
  140. .then((res) => {
  141. uni.showToast({
  142. title: '已提交,请等待审核'
  143. });
  144. that.initData();
  145. });
  146. }
  147. }
  148. });
  149. },
  150. handleDel(id) {
  151. const that = this;
  152. const params = [];
  153. params.push(id);
  154. uni.showModal({
  155. title: '提示',
  156. content: '您确认删除吗?',
  157. success: (res) => {
  158. if (res.confirm) {
  159. this.$Http.deleteRepairForms(params).then((res) => {
  160. uni.showToast({ title: '删除成功' });
  161. this.page = 1;
  162. this.loadMore = true;
  163. this.listData = [];
  164. this.initData();
  165. });
  166. } else if (res.cancel) {
  167. }
  168. }
  169. });
  170. },
  171. handleDealEdit(item) {
  172. const that = this;
  173. uni.showModal({
  174. title: '提示',
  175. content: '确认接收该维修任务?',
  176. success: function (res) {
  177. if (res.confirm) {
  178. that.$Http.repairFormDeal(item).then((res) => {
  179. that.page = 1;
  180. that.loadMore = true;
  181. that.listData = [];
  182. that.initData();
  183. });
  184. }
  185. }
  186. });
  187. },
  188. handleDispatching(item) {
  189. uni.navigateTo({
  190. url: '/pages/repair-detail/transfer?id=' + item.id
  191. });
  192. },
  193. handleEdit(item) {
  194. uni.navigateTo({
  195. url: '/pages/service-add/service-add?id=' + item.id
  196. });
  197. },
  198. // tab
  199. change(index) {
  200. this.current = index;
  201. // type 做相应改变
  202. this.type = index;
  203. this.page = 1;
  204. this.loadMore = true;
  205. this.listData = [];
  206. this.initData();
  207. },
  208. // 跳转详情
  209. handleDetail(item) {
  210. // if (index == 0) {
  211. // uni.navigateTo({
  212. // url: '../service-add/service-add'
  213. // });
  214. // } else {
  215. // uni.navigateTo({
  216. // url: '../service-detail/service-detail'
  217. // });
  218. // }
  219. if (this.maskId != 0) return this.maskId = 0
  220. uni.navigateTo({
  221. url: '/pages/service-detail/service-detail?id=' + item.id
  222. });
  223. },
  224. initData() {
  225. const that = this;
  226. that.status = 'loading';
  227. this.$Http
  228. .getRepairApplicationFormPage({
  229. pageNum: this.page,
  230. pageSize: this.limit,
  231. sbId: this.sbId,
  232. searchType: 2,
  233. filter: this.filter,
  234. status: this.type,
  235. dataScope: {
  236. sortBy: 'asc, desc',
  237. sortName: 'status, apply_time'
  238. }
  239. })
  240. .then((res) => {
  241. const data = res.data.rows;
  242. console.log(res);
  243. if (data && data.length > 0 && data.length < that.limit) {
  244. that.status = 'nomore';
  245. that.loadMore = false;
  246. } else if (data.length === that.limit) {
  247. that.status = 'loadmore';
  248. } else {
  249. that.status = 'nomore';
  250. }
  251. that.listData = [...that.listData, ...data];
  252. });
  253. }
  254. }
  255. };
  256. </script>
  257. <style lang="scss">
  258. page {
  259. background-color: #f4f4f4;
  260. }
  261. .box {
  262. padding-right: 0;
  263. border-radius: 20rpx;
  264. }
  265. .edit-box {
  266. padding: 0 30rpx;
  267. margin-top: 40rpx;
  268. .edit {
  269. padding: 8rpx 40rpx;
  270. border: 1px solid #ddd;
  271. border-radius: 20rpx;
  272. font-size: 26rpx;
  273. color: #666;
  274. margin-left: 30rpx;
  275. }
  276. }
  277. </style>