index.vue 7.5 KB

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