repair-reason-select.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view>
  3. <view class="p3">
  4. <u-search
  5. :show-action="true"
  6. action-text="搜索"
  7. :animation="false"
  8. v-model="params.keyword"
  9. @custom="search"
  10. @clear="search"
  11. @search="search"></u-search>
  12. </view>
  13. <scroll-view
  14. scroll-y="true"
  15. class="scroll-Y"
  16. @scrolltolower="lower"
  17. refresher-enabled="true"
  18. :refresher-triggered="triggered"
  19. :refresher-threshold="50"
  20. refresher-background="#f4f4f4"
  21. @refresherrefresh="onRefresh"
  22. @refresherrestore="onRestore"
  23. @refresherabort="onAbort">
  24. <view class="list" @tap="navigateTo(item)" v-for="item in dataList" :key="item.id">
  25. <view class="time">
  26. <u-tag size="mini" :text="levelMap[item.level]" :type="$DictCache.COLOR.CHECK_JOB_STATUS[item.level]"></u-tag>
  27. </view>
  28. <view>
  29. <view>
  30. <text class="my1 u-line-1 f-size-26">部件编号:{{ item.no }}</text>
  31. </view>
  32. <view class="text-color-9">
  33. <text>部件名称:{{ item.name }}</text>
  34. </view>
  35. <view class="my1">
  36. <text class="text-color-9">部件类别:{{ item.typeName }}</text>
  37. </view>
  38. <!-- <view class="my1">
  39. <text class="text-color-9">中标供应商: {{item.companyId}}</text>
  40. </view> -->
  41. </view>
  42. </view>
  43. <u-loadmore :status="loadmore" />
  44. </scroll-view>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. // 表示value等于这些值,就属于默认值
  52. loadmore: 'loadmore',
  53. dataList: [],
  54. params: {
  55. pageNum: 1,
  56. pageSize: 10,
  57. keyword: null,
  58. sbId: this.$route.query.sbId,
  59. dataScope: {
  60. sortBy: 'desc',
  61. sortName: 'update_time'
  62. }
  63. },
  64. levelMap: {}
  65. }
  66. },
  67. onLoad(options) {
  68. this.levelMap = this.$DictCache.getLabelByValueMapByType('PART_LEVEL')
  69. },
  70. onShow() {
  71. this.onRefresh()
  72. },
  73. methods: {
  74. navigateTo(item) {
  75. const pages = getCurrentPages();
  76. const prevPage = pages[pages.length - 2];
  77. prevPage.bom = {
  78. sbPartId: item.id,
  79. sbPartName: item.name
  80. }
  81. uni.navigateBack();
  82. },
  83. getData() {
  84. this.$Http.getPartInfoPage(this.params).then(res => {
  85. this.total = res.data.total
  86. this.triggered = false
  87. this._freshing = false
  88. this.dataList = [...this.dataList, ...res.data.rows]
  89. if (this.total > this.dataList.length) {
  90. this.loadmore = 'loadmore'
  91. } else {
  92. this.loadmore = 'nomore'
  93. }
  94. })
  95. },
  96. search() {
  97. this.dataList = []
  98. this.params.pageNum = 1
  99. this.getData()
  100. },
  101. onPulling(e) {
  102. console.log('onpulling', e)
  103. },
  104. onRefresh() {
  105. if (this._freshing) return
  106. this._freshing = true
  107. this.dataList = []
  108. this.triggered = 'restore'
  109. this.getData()
  110. },
  111. onRestore() {
  112. this.triggered = 'restore' // 需要重置
  113. },
  114. onAbort() {
  115. console.log('onAbort')
  116. },
  117. lower() {
  118. if (this.loadmore === 'loadmore') {
  119. this.params.pageNum++
  120. this.getData()
  121. }
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="scss" scoped>
  127. .scroll-Y {
  128. height: calc(100vh - 124px);
  129. }
  130. .list {
  131. margin: 20rpx;
  132. background: #ffffff;
  133. box-shadow: 0rpx 3rpx 7rpx 0rpx rgba(47, 47, 47, 0.19);
  134. border-radius: 12rpx;
  135. position: relative;
  136. padding: 35rpx 30rpx;
  137. font-size: 12px;
  138. margin-bottom: 10px;
  139. .time {
  140. position: absolute;
  141. right: 20rpx;
  142. color: #999999;
  143. top: 20rpx;
  144. }
  145. .btn {
  146. position: absolute;
  147. right: 20rpx;
  148. bottom: 20rpx;
  149. display: flex;
  150. & > view {
  151. margin: 0 10rpx;
  152. }
  153. }
  154. }
  155. </style>