index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="工单列表" background-color="#157A2C" color="#fff"
  4. @clickLeft="back"></uni-nav-bar>
  5. <view class="top-wrapper">
  6. <uni-section>
  7. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchFrom.keyWord" placeholder="请输入">
  8. </uni-easyinput>
  9. </uni-section>
  10. <button class="search_btn" @click="doSearch">搜索</button>
  11. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  12. </view>
  13. <view class="">
  14. <view class="tab_box rx-sc">
  15. <view class="tab_item" :class="{ active: tabType == 5 }" @click="handTab(5)">生产中</view>
  16. <view class="tab_item" :class="{ active: tabType == 4 }" @click="handTab(4)">待生产</view>
  17. <view class="tab_item" :class="{ active: tabType == 6 }" @click="handTab(6)">已完成</view>
  18. <view class="tab_item" :class="{ active: tabType == 7 }" @click="handTab(7)">已延期</view>
  19. </view>
  20. </view>
  21. <view class="list_box">
  22. <u-list @scrolltolower="scrolltolower" key="list" lowerThreshold="100" preLoadScreen="1.5">
  23. <u-list-item v-for="(item, index) in dataList" :key="index">
  24. <workCard :item="item" @handleDetail="handleDetail"></workCard>
  25. </u-list-item>
  26. <u-list-item v-if="dataList.length === 0">
  27. <view style='margin-top: 20vh;'>
  28. <u-empty iconSize='150' textSize='32' text='暂无工单'>
  29. </u-empty>
  30. </view>
  31. </u-list-item>
  32. </u-list>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import workCard from '../../components/workCard.vue'
  38. import {
  39. workorderPage
  40. } from '@/api/pda/workOrder.js'
  41. let [isEnd] = [false]
  42. export default {
  43. components: {
  44. workCard
  45. },
  46. data() {
  47. return {
  48. page: 1,
  49. size: 10,
  50. dataList: [],
  51. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  52. .clientEnvironmentId,
  53. searchFrom: {
  54. keyWord: null
  55. },
  56. tabType:5
  57. }
  58. },
  59. onShow() {
  60. this.getList()
  61. },
  62. methods: {
  63. handTab(value){
  64. this.tabType=value
  65. this.page=1
  66. this.getList()
  67. },
  68. async getList() {
  69. let params = {
  70. pageNum: this.page,
  71. customerClient: 2,
  72. size: this.size,
  73. workOrderType: 1,
  74. statusList:[this.tabType],
  75. ...this.searchFrom
  76. }
  77. isEnd = false
  78. const res = await workorderPage(params)
  79. if (params.pageNum === 1) {
  80. this.dataList = []
  81. }
  82. this.dataList.push(...res.list)
  83. console.log(this.dataList, 'dataList')
  84. isEnd = this.dataList.length >= res.count
  85. },
  86. doSearch() {
  87. this.page = 1
  88. this.getList()
  89. },
  90. scrolltolower() {
  91. if (isEnd) return
  92. this.page++
  93. this.getList()
  94. },
  95. handleDetail(item) {
  96. let url = '/pages/pda/workOrder/extrusionMolding/index'
  97. url += `?id=${item.id}&title=${item.taskName}&singleReport=${item.singleReport}`
  98. uni.navigateTo({
  99. url
  100. })
  101. },
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .content-box {
  107. height: 100vh;
  108. overflow: hidden;
  109. display: flex;
  110. flex-direction: column;
  111. background-color: $page-bg;
  112. }
  113. .top-wrapper {
  114. background-color: #fff;
  115. display: flex;
  116. width: 750rpx;
  117. height: 88rpx;
  118. padding: 16rpx 32rpx;
  119. align-items: center;
  120. gap: 16rpx;
  121. /deep/.uni-section {
  122. margin-top: 0px;
  123. }
  124. /deep/.uni-section-header {
  125. padding: 0px;
  126. }
  127. .search_btn {
  128. width: 120rpx;
  129. height: 70rpx;
  130. line-height: 70rpx;
  131. padding: 0 24rpx;
  132. background: $theme-color;
  133. font-size: 32rpx;
  134. color: #fff;
  135. margin: 0;
  136. margin-left: 26rpx;
  137. }
  138. .menu_icon {
  139. width: 44rpx;
  140. height: 44rpx;
  141. margin-left: 14rpx;
  142. }
  143. }
  144. .list_box {
  145. flex: 1;
  146. overflow: hidden;
  147. padding: 16rpx 0;
  148. .u-list {
  149. height: 100% !important;
  150. }
  151. }
  152. .tab_box {
  153. width: 100%;
  154. height: 68rpx;
  155. border-bottom: 1rpx solid #E1E1E1;
  156. .tab_item {
  157. height: 68rpx;
  158. line-height: 68rpx;
  159. padding: 0 20rpx;
  160. font-size: 32rpx;
  161. color: #979C9E;
  162. }
  163. .active {
  164. box-sizing: border-box;
  165. border-bottom: 6rpx solid $theme-color;
  166. color: $theme-color;
  167. }
  168. }
  169. </style>