index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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">
  12. <view class="nav_item " :class="{active: pickStatus == 0}" @click="handNav(0)">
  13. 工单({{navObj.unclaimedQuantity || 0}})</view>
  14. <view class="nav_item" :class="{active: pickStatus == 1}" @click="handNav(1)">
  15. 领料单({{navObj.claimedQuantity || 0}})</view>
  16. <view class="nav_item" :class="{active: pickStatus == 2}" @click="handNav(2)">
  17. 出库单({{ navObj.outInQuantity || 0 }})</view>
  18. <view class="menu_box" @click="handleSearch">
  19. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="list_box">
  24. <u-list @scrolltolower="scrolltolower">
  25. <pickCard v-if='dataList.length' :list="dataList"> </pickCard>
  26. <view v-else style='margin-top: 20vh;'>
  27. <u-empty iconSize='150' textSize='32' text='暂无工单'>
  28. </u-empty>
  29. </view>
  30. </u-list>
  31. </view>
  32. <view class="bottom-wrapper rx-bc" v-if='pickStatus == 0'>
  33. <view>
  34. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  35. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  36. </checkbox>
  37. </view>
  38. <view>
  39. <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
  40. <view> 选择( {{ checkListLen }} ) </view>
  41. </u-button>
  42. </view>
  43. </view>
  44. <SearchPopup mode="top" v-if='searchShow'>
  45. <template v-slot:list>
  46. <view class="search_list">
  47. <u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
  48. <u-form-item label="工艺路线:" class="required-form" borderBottom prop="assetType">
  49. <zxz-uni-data-select :localdata="produceList" v-model="formData.produceRoutingId"
  50. dataValue='id' format='{name}' dataKey="name" filterable></zxz-uni-data-select>
  51. </u-form-item>
  52. </u-form>
  53. </view>
  54. </template>
  55. <template v-slot:operate>
  56. <view class="operate_box rx-bc">
  57. <u-button size="small" class="u-reset-button" @click="searchCancel">
  58. 重置
  59. </u-button>
  60. <u-button type="success" size="small" class="u-reset-button" @click="search">
  61. 确定
  62. </u-button>
  63. </view>
  64. </template>
  65. </SearchPopup>
  66. </view>
  67. </template>
  68. <script>
  69. import pickCard from '../components/pickCard.vue'
  70. import {
  71. workorderPage,
  72. producerouting
  73. } from '@/api/pda/workOrder.js'
  74. import {
  75. pickStatistics
  76. } from '@/api/pda/picking.js'
  77. import SearchPopup from '../../components/searchPopup.vue'
  78. let [isEnd] = [false]
  79. export default {
  80. components: {
  81. pickCard,
  82. SearchPopup
  83. },
  84. data() {
  85. return {
  86. tabType: 1,
  87. pickStatus: 0,
  88. formData: {
  89. produceRoutingId: ''
  90. },
  91. navObj: {
  92. unclaimedQuantity: 0,
  93. claimedQuantity: 0
  94. },
  95. page: 1,
  96. size: 10,
  97. dataList: [],
  98. produceList: [],
  99. seletedAll: false, //全选状态
  100. searchShow: false,
  101. }
  102. },
  103. //选择的列表长度
  104. computed: {
  105. checkListLen() {
  106. let _fitArr = this.dataList.filter(f => f.checked)
  107. return _fitArr.length
  108. }
  109. },
  110. onLoad(option) {
  111. this.pickStatus = option.pickStatus || 0
  112. this.produceFn()
  113. },
  114. onShow() {
  115. this.page = 1
  116. // this.dataList = []
  117. this.getList()
  118. this.getpickTics()
  119. },
  120. methods: {
  121. search() {
  122. this.page = 1
  123. this.getList()
  124. this.searchShow = false
  125. },
  126. async getList() {
  127. let params = {
  128. pageNum: this.page,
  129. size: this.size,
  130. pickStatus: this.pickStatus,
  131. customerClient: 2,
  132. workOrderType: 1,
  133. produceRoutingId: this.formData.produceRoutingId
  134. }
  135. isEnd = false
  136. const res = await workorderPage(params)
  137. if (params.pageNum === 1) {
  138. this.dataList = []
  139. }
  140. let _list = res.list.map(m => {
  141. return {
  142. checked: false,
  143. ...m
  144. }
  145. })
  146. this.dataList.push(..._list)
  147. isEnd = this.dataList.length >= res.count
  148. },
  149. getpickTics() {
  150. pickStatistics().then(res => {
  151. this.navObj = res
  152. })
  153. },
  154. handTab(type) {
  155. if (type != this.tabType) {
  156. this.tabType = type
  157. }
  158. },
  159. handNav(type) {
  160. if (type != this.pickStatus) {
  161. this.pickStatus = type
  162. this.page = 1
  163. this.dataList = []
  164. this.getList()
  165. }
  166. },
  167. scrolltolower() {
  168. if (isEnd) return
  169. this.page++
  170. this.getList()
  171. },
  172. _seletedAll() {
  173. if (!this.seletedAll) {
  174. this.seletedAll = true
  175. this.dataList.forEach(e => {
  176. e.checked = true
  177. })
  178. } else {
  179. this.seletedAll = false
  180. this.dataList.forEach(e => {
  181. e.checked = false
  182. })
  183. }
  184. },
  185. jumpAdd() {
  186. let url
  187. url = '/pages/pda/picking/details'
  188. let arr = []
  189. this.dataList.forEach(e => {
  190. if (e.checked) {
  191. arr.push(e.id)
  192. }
  193. })
  194. let _arr = JSON.stringify(arr)
  195. url += `?arr=${encodeURIComponent(_arr)}`
  196. uni.navigateTo({
  197. url
  198. })
  199. },
  200. // 相机扫码
  201. HandlScanCode() {
  202. uni.scanCode({
  203. success: (res) => {
  204. console.log(res)
  205. }
  206. })
  207. //_this.Scancodedate('res')
  208. },
  209. handleSearch() {
  210. this.searchShow = true
  211. },
  212. searchCancel() {
  213. this.formData.produceRoutingId = ''
  214. this.page = 1
  215. this.getList()
  216. this.searchShow = false
  217. },
  218. produceFn() {
  219. let param = {
  220. pageNum: 1,
  221. size: -1
  222. }
  223. producerouting(param).then(res => {
  224. this.produceList = res.list
  225. })
  226. },
  227. }
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. .content-box {
  232. height: 100vh;
  233. overflow: hidden;
  234. display: flex;
  235. flex-direction: column;
  236. background-color: $page-bg;
  237. }
  238. .tab_box {
  239. width: 100%;
  240. height: 68rpx;
  241. background: #fff;
  242. .tab_item {
  243. height: 68rpx;
  244. line-height: 68rpx;
  245. padding: 0 20rpx;
  246. font-size: 32rpx;
  247. color: #979C9E;
  248. }
  249. .active {
  250. box-sizing: border-box;
  251. border-bottom: 6rpx solid $theme-color;
  252. color: $theme-color;
  253. }
  254. }
  255. .nav_box {
  256. padding: 6rpx 32rpx;
  257. position: relative;
  258. .nav_item {
  259. font-size: 28rpx;
  260. font-weight: 400;
  261. color: $theme-color;
  262. background: #F0F8F2;
  263. margin-right: 16rpx;
  264. padding: 4rpx 16rpx;
  265. border-radius: 8rpx;
  266. border: 2rpx solid #ACD4B5;
  267. }
  268. .menu_box {
  269. position: absolute;
  270. right: 20rpx;
  271. top: 10rpx;
  272. .menu_icon {
  273. width: 44rpx;
  274. height: 44rpx;
  275. }
  276. }
  277. .active {
  278. background: $theme-color;
  279. border: 2rpx solid $theme-color;
  280. color: #FFF;
  281. }
  282. }
  283. .list_box {
  284. flex: 1;
  285. overflow: hidden;
  286. padding: 4rpx 0;
  287. .u-list {
  288. height: 100% !important;
  289. }
  290. }
  291. .bottom-wrapper {
  292. height: 80rpx;
  293. background: #fff;
  294. padding: 0 32rpx;
  295. /deep/ .uni-checkbox-input-checked {
  296. background-color: $theme-color !important;
  297. border-color: $theme-color !important;
  298. }
  299. }
  300. .search_list {
  301. min-height: 100rpx;
  302. /deep/ .baseForm {
  303. padding: 0 20rpx;
  304. }
  305. }
  306. .operate_box {
  307. padding: 10rpx 32rpx;
  308. /deep/ .u-button {
  309. width: 40%;
  310. }
  311. }
  312. </style>