index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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" right-icon="scan" @clickRight="HandlScanCode">
  5. </uni-nav-bar>
  6. <view class="top-wrapper">
  7. <view class="tab_box rx-sc">
  8. <view class="tab_item" :class="{active: tabType == 1}" @click="handTab(1)">生产工单列表</view>
  9. <view class="tab_item" :class="{active: tabType == 2}" @click="handTab(2)">领料工单列表</view>
  10. </view>
  11. <view class="nav_box rx-sc" v-if='tabType == 1'>
  12. <view class="nav_item " :class="{active: navType == 1}" @click="handNav(1)">未领料</view>
  13. <view class="nav_item" :class="{active: navType == 2}" @click="handNav(2)">已领料</view>
  14. </view>
  15. </view>
  16. <view class="list_box">
  17. <u-list @scrolltolower="scrolltolower" v-if="tabType == 1">
  18. <pickCard :list="dataList"> </pickCard>
  19. </u-list>
  20. </view>
  21. <view class="bottom-wrapper rx-bc">
  22. <view>
  23. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  24. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  25. </checkbox>
  26. </view>
  27. <view>
  28. <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
  29. <view> 选择( {{ checkListLen }} ) </view>
  30. </u-button>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import pickCard from '../components/pickCard.vue'
  37. import {
  38. workorderPage
  39. } from '@/api/pda/workOrder.js'
  40. let [isEnd] = [false]
  41. export default {
  42. components: {
  43. pickCard
  44. },
  45. data() {
  46. return {
  47. tabType: 1,
  48. navType: 1,
  49. page: 1,
  50. size: 5,
  51. dataList: [],
  52. seletedAll: false, //全选状态
  53. }
  54. },
  55. //选择的列表长度
  56. computed: {
  57. checkListLen() {
  58. let _fitArr = this.dataList.filter(f => f.checked)
  59. return _fitArr.length
  60. }
  61. },
  62. onShow() {
  63. this.getList()
  64. },
  65. methods: {
  66. async getList() {
  67. let params = {
  68. pageNum: this.page,
  69. size: this.size,
  70. status: [4, 5, 6, 7],
  71. }
  72. isEnd = false
  73. const res = await workorderPage(params)
  74. console.log(res)
  75. if (params.page === 1) {
  76. this.dataList = []
  77. }
  78. let _list = res.list.map(m => {
  79. return {
  80. checked: false,
  81. ...m
  82. }
  83. })
  84. this.dataList.push(..._list)
  85. isEnd = this.dataList.length >= res.count
  86. },
  87. handTab(type) {
  88. if (type != this.tabType) {
  89. this.tabType = type
  90. }
  91. },
  92. handNav(type) {
  93. if (type != this.navType) {
  94. this.navType = type
  95. }
  96. },
  97. scrolltolower() {
  98. if (isEnd) return
  99. this.page++
  100. this.getList()
  101. },
  102. _seletedAll() {
  103. if (!this.seletedAll) {
  104. this.seletedAll = true
  105. this.dataList.forEach(e => {
  106. e.checked = true
  107. })
  108. } else {
  109. this.seletedAll = false
  110. this.dataList.forEach(e => {
  111. e.checked = false
  112. })
  113. }
  114. },
  115. jumpAdd() {},
  116. // 相机扫码
  117. HandlScanCode() {
  118. let _this = this
  119. uni.scanCode({
  120. success: function(res) {
  121. console.log(res)
  122. }
  123. })
  124. //_this.Scancodedate('res')
  125. },
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. .content-box {
  131. height: 100vh;
  132. overflow: hidden;
  133. display: flex;
  134. flex-direction: column;
  135. background-color: $page-bg;
  136. }
  137. .tab_box {
  138. width: 100%;
  139. height: 68rpx;
  140. background: #fff;
  141. .tab_item {
  142. height: 68rpx;
  143. line-height: 68rpx;
  144. padding: 0 20rpx;
  145. font-size: 32rpx;
  146. color: #979C9E;
  147. }
  148. .active {
  149. box-sizing: border-box;
  150. border-bottom: 6rpx solid $theme-color;
  151. color: $theme-color;
  152. }
  153. }
  154. .nav_box {
  155. padding: 6rpx 32rpx;
  156. .nav_item {
  157. font-size: 28rpx;
  158. font-weight: 400;
  159. color: $theme-color;
  160. background: #F0F8F2;
  161. margin-right: 16rpx;
  162. padding: 4rpx 16rpx;
  163. border-radius: 8rpx;
  164. border: 2rpx solid #ACD4B5;
  165. }
  166. .active {
  167. background: $theme-color;
  168. border: 2rpx solid $theme-color;
  169. color: #FFF;
  170. }
  171. }
  172. .list_box {
  173. flex: 1;
  174. overflow: hidden;
  175. padding: 4rpx 0;
  176. .u-list {
  177. height: 100% !important;
  178. }
  179. }
  180. .bottom-wrapper {
  181. height: 80rpx;
  182. background: #fff;
  183. padding: 0 32rpx;
  184. /deep/ .uni-checkbox-input-checked {
  185. background-color: $theme-color !important;
  186. border-color: $theme-color !important;
  187. }
  188. }
  189. </style>