service.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="service-page">
  3. <navigation title="设备维修"></navigation>
  4. <view class="tab-box">
  5. <u-subsection :list="list" :current="curNow" fontSize="16" @change="sectionChange"></u-subsection>
  6. </view>
  7. <view class="list-box" v-if="dataList.length>0">
  8. <view class="list-item" v-for="(item, index) in dataList" :key="index">
  9. <view class="item-text">工单编号:{{ item.num || '-' }}</view>
  10. <view class="item-text">设备名称:{{ item.equipmentName || '-' }}</view>
  11. <view class="item-text">工单描述:{{ item.orderMsg || '-' }}</view>
  12. <view class="item-text" v-if="curNow == 0">负责人:{{ item.ownerUserName || '-' }}</view>
  13. <view class="item-text" v-if="curNow == 0">认领时间:{{ item.receiveTime || '-' }}</view>
  14. <view class="item-text" v-if="curNow == 0">完成时间:{{ item.completeTime || '-' }}</view>
  15. <view class="item-text">发生时间:{{ item.happenTime || '-' }}</view>
  16. <view class="btn-box" v-if="curNow == 0">
  17. <view class="btn-item" @click="toDetail(item.id)">
  18. <view>详情</view>
  19. </view>
  20. <view class="btn-item" @click="confirmInfo(item.id, item.num)">
  21. <view>完工</view>
  22. </view>
  23. <view class="btn-item btn-gray" @click="cancelInfo(item.id)">
  24. <view>取消</view>
  25. </view>
  26. </view>
  27. <view class="btn-box" v-else>
  28. <view class="btn-item" @click="toDetail(item.id)">
  29. <view>详情</view>
  30. </view>
  31. <view class="btn-item" @click="claimInfo(item.id)">
  32. <view>认领</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <empty v-else text="暂无数据"></empty>
  38. <!-- 取消确认框 -->
  39. <uni-popup ref="alertDialog" type="dialog">
  40. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="提示" content="确认取消该任务吗?"
  41. @confirm="dialogConfirm"></uni-popup-dialog>
  42. </uni-popup>
  43. <!-- 认领确认框 -->
  44. <uni-popup ref="alertDialogClaim" type="dialog">
  45. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="提示" content="确认要认领该任务吗?"
  46. @confirm="dialogConfirmClaim"></uni-popup-dialog>
  47. </uni-popup>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. list: ['我的', '待处理'],
  55. curNow: 0,
  56. dataList: [],
  57. id: '',
  58. userId: uni.getStorageSync('userInfo').id
  59. }
  60. },
  61. onShow() {
  62. this.getList()
  63. },
  64. methods: {
  65. sectionChange(index) {
  66. this.curNow = index;
  67. if (index == 0) {
  68. this.getList()
  69. } else if (index == 1) {
  70. this.getWaitReceiveList()
  71. }
  72. },
  73. getList() {
  74. uni.showLoading({
  75. title: '正在加载...'
  76. })
  77. let params = {
  78. ownerUserId: this.userId
  79. }
  80. this.$api.workOrderList(params).then(res => {
  81. this.dataList = res.rows
  82. uni.hideLoading()
  83. }).catch(err => {})
  84. },
  85. getWaitReceiveList() {
  86. uni.showLoading({
  87. title: '正在加载...'
  88. })
  89. this.$api.listWaitReceive().then(res => {
  90. this.dataList = res.rows
  91. uni.hideLoading()
  92. }).catch(err => {})
  93. },
  94. // 完工
  95. confirmInfo(id, num) {
  96. uni.navigateTo({
  97. url: '/subPackages/repair/finish?id=' + id + '&num=' + num
  98. });
  99. },
  100. // 取消
  101. cancelInfo(id) {
  102. this.id = id
  103. this.$refs.alertDialog.open()
  104. },
  105. dialogConfirm() {
  106. let that = this
  107. this.$api.cancelOrder(this.id).then(res => {
  108. uni.showToast({
  109. title: '任务取消成功!',
  110. duration: 2000
  111. });
  112. setTimeout(function() {
  113. that.getList()
  114. }, 2000);
  115. }).catch(err => {})
  116. },
  117. // 认领
  118. claimInfo(id) {
  119. this.id = id
  120. this.$refs.alertDialogClaim.open()
  121. },
  122. dialogConfirmClaim() {
  123. let that = this
  124. this.$api.receiveOrder(this.id).then(res => {
  125. uni.showToast({
  126. title: '任务认领成功!',
  127. duration: 2000
  128. });
  129. setTimeout(function() {
  130. that.curNow = 0;
  131. that.getList()
  132. }, 2000);
  133. }).catch(err => {})
  134. },
  135. toDetail(id) {
  136. uni.navigateTo({
  137. url: '/subPackages/repair/detail?id=' + id
  138. });
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. .service-page {
  145. .tab-box {
  146. // width: 100%;
  147. // position: fixed;
  148. }
  149. .list-box {
  150. padding: 0 20rpx;
  151. color: $uni-text-color-list;
  152. .list-item {
  153. background-color: $uni-bg-color;
  154. padding: 20rpx;
  155. border-radius: 20rpx;
  156. margin-top: 28rpx;
  157. .item-text {
  158. margin-top: 10rpx;
  159. }
  160. }
  161. .btn-box {
  162. display: flex;
  163. justify-content: flex-end;
  164. margin-top: 10rpx;
  165. .btn-item {
  166. width: 175rpx;
  167. height: 50rpx;
  168. line-height: 50rpx;
  169. text-align: center;
  170. border-radius: 24rpx;
  171. margin-left: 20rpx;
  172. border: 1px solid #43adfd;
  173. color: #43adfd;
  174. }
  175. .btn-gray {
  176. border: 1px solid #aaa;
  177. color: #aaa;
  178. }
  179. }
  180. }
  181. }
  182. </style>