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