index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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: 480rpx" 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="list_box">
  14. <u-list @scrolltolower="scrolltolower" key="list" :preLoadScreen="page * 10">
  15. <u-list-item v-for="(item, index) in dataList" :key="index">
  16. <workCard :item="item" @handleDetail="handleDetail"></workCard>
  17. </u-list-item>
  18. <u-list-item v-if="dataList.length === 0">
  19. <view class="nodata"> 暂无数据 </view>
  20. </u-list-item>
  21. </u-list>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import workCard from '../../components/workCard.vue'
  27. import {
  28. workorderPage
  29. } from '@/api/pda/workOrder.js'
  30. let [isEnd] = [false]
  31. export default {
  32. components: {
  33. workCard
  34. },
  35. data() {
  36. return {
  37. page: 1,
  38. size: 5,
  39. dataList: [],
  40. searchFrom: {
  41. keyWord: null
  42. },
  43. }
  44. },
  45. onShow() {
  46. this.getList()
  47. },
  48. methods: {
  49. async getList() {
  50. let params = {
  51. pageNum: this.page,
  52. size: this.size,
  53. status: [4, 5, 6, 7],
  54. ...this.searchFrom
  55. }
  56. isEnd = false
  57. const res = await workorderPage(params)
  58. console.log(res)
  59. if (params.page === 1) {
  60. this.dataList = []
  61. }
  62. this.dataList.push(...res.list)
  63. isEnd = this.dataList.length >= res.count
  64. },
  65. doSearch() {},
  66. scrolltolower() {
  67. if (isEnd) return
  68. this.page++
  69. this.getList()
  70. },
  71. handleDetail(item) {
  72. let url = '/pages/pda/workOrder/extrusionMolding/index'
  73. url += `?id=${item.id}&title=${item.produceTaskInstanceName}`
  74. console.log(url)
  75. uni.navigateTo({
  76. url
  77. })
  78. console.log(item)
  79. },
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. .content-box {
  85. height: 100vh;
  86. overflow: hidden;
  87. display: flex;
  88. flex-direction: column;
  89. background-color: $page-bg;
  90. }
  91. .top-wrapper {
  92. background-color: #fff;
  93. display: flex;
  94. width: 750rpx;
  95. height: 88rpx;
  96. padding: 16rpx 32rpx;
  97. align-items: center;
  98. gap: 16rpx;
  99. /deep/.uni-section {
  100. margin-top: 0px;
  101. }
  102. /deep/.uni-section-header {
  103. padding: 0px;
  104. }
  105. .search_btn {
  106. width: 120rpx;
  107. height: 70rpx;
  108. line-height: 70rpx;
  109. padding: 0 24rpx;
  110. background: $theme-color;
  111. font-size: 32rpx;
  112. color: #fff;
  113. margin: 0;
  114. }
  115. .menu_icon {
  116. width: 44rpx;
  117. height: 44rpx;
  118. }
  119. }
  120. .list_box {
  121. flex: 1;
  122. overflow: hidden;
  123. padding: 16rpx 0;
  124. .u-list {
  125. height: 100% !important;
  126. }
  127. }
  128. .nodata {
  129. font-size: 40rpx;
  130. text-align: center;
  131. padding-top: 30rpx;
  132. }
  133. </style>