service.vue 10.0 KB

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