index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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. produceRoutingId: this.formData.produceRoutingId
  142. }
  143. isEnd = false
  144. const res = await workorderPage(params)
  145. if (params.pageNum === 1) {
  146. this.dataList = []
  147. }
  148. let _list = res.list.map(m => {
  149. return {
  150. checked: false,
  151. ...m
  152. }
  153. })
  154. this.dataList.push(..._list)
  155. isEnd = this.dataList.length >= res.count
  156. },
  157. getpickTics() {
  158. pickStatistics().then(res => {
  159. this.navObj = res
  160. })
  161. },
  162. handTab(type) {
  163. if (type != this.tabType) {
  164. this.tabType = type
  165. }
  166. },
  167. handNav(type) {
  168. if (type != this.pickStatus) {
  169. this.pickStatus = type
  170. this.page = 1
  171. this.dataList = []
  172. this.getList()
  173. }
  174. },
  175. scrolltolower() {
  176. if (isEnd) return
  177. this.page++
  178. this.getList()
  179. },
  180. _seletedAll() {
  181. if (!this.seletedAll) {
  182. this.seletedAll = true
  183. this.dataList.forEach(e => {
  184. e.checked = true
  185. })
  186. } else {
  187. this.seletedAll = false
  188. this.dataList.forEach(e => {
  189. e.checked = false
  190. })
  191. }
  192. },
  193. jumpAdd() {
  194. let url
  195. url = '/pages/pda/picking/details'
  196. let arr = []
  197. this.dataList.forEach(e => {
  198. if (e.checked) {
  199. arr.push(e.id)
  200. }
  201. })
  202. let _arr = JSON.stringify(arr)
  203. url += `?arr=${encodeURIComponent(_arr)}`
  204. uni.navigateTo({
  205. url
  206. })
  207. },
  208. // 相机扫码
  209. HandlScanCode() {
  210. uni.scanCode({
  211. success: (res) => {
  212. console.log(res)
  213. }
  214. })
  215. //_this.Scancodedate('res')
  216. },
  217. handleSearch() {
  218. this.searchShow = true
  219. },
  220. searchCancel() {
  221. this.formData.produceRoutingId = ''
  222. this.page = 1
  223. this.getList()
  224. this.searchShow = false
  225. },
  226. produceFn() {
  227. let param = {
  228. pageNum: 1,
  229. size: -1
  230. }
  231. producerouting(param).then(res => {
  232. this.produceList = res.list
  233. })
  234. },
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. .content-box {
  240. height: 100vh;
  241. overflow: hidden;
  242. display: flex;
  243. flex-direction: column;
  244. background-color: $page-bg;
  245. }
  246. .tab_box {
  247. width: 100%;
  248. height: 68rpx;
  249. background: #fff;
  250. .tab_item {
  251. height: 68rpx;
  252. line-height: 68rpx;
  253. padding: 0 20rpx;
  254. font-size: 32rpx;
  255. color: #979C9E;
  256. }
  257. .active {
  258. box-sizing: border-box;
  259. border-bottom: 6rpx solid $theme-color;
  260. color: $theme-color;
  261. }
  262. }
  263. .nav_box {
  264. padding: 6rpx 32rpx;
  265. position: relative;
  266. .nav_item {
  267. font-size: 28rpx;
  268. font-weight: 400;
  269. color: $theme-color;
  270. background: #F0F8F2;
  271. margin-right: 16rpx;
  272. padding: 4rpx 16rpx;
  273. border-radius: 8rpx;
  274. border: 2rpx solid #ACD4B5;
  275. }
  276. .menu_box {
  277. position: absolute;
  278. right: 20rpx;
  279. top: 10rpx;
  280. .menu_icon {
  281. width: 44rpx;
  282. height: 44rpx;
  283. }
  284. }
  285. .active {
  286. background: $theme-color;
  287. border: 2rpx solid $theme-color;
  288. color: #FFF;
  289. }
  290. }
  291. .list_box {
  292. flex: 1;
  293. overflow: hidden;
  294. padding: 4rpx 0;
  295. .u-list {
  296. height: 100% !important;
  297. }
  298. }
  299. .bottom-wrapper {
  300. height: 80rpx;
  301. background: #fff;
  302. padding: 0 32rpx;
  303. /deep/ .uni-checkbox-input-checked {
  304. background-color: $theme-color !important;
  305. border-color: $theme-color !important;
  306. }
  307. }
  308. .search_list{
  309. min-height: 100rpx;
  310. /deep/ .baseForm{
  311. padding: 0 20rpx;
  312. }
  313. }
  314. .operate_box{
  315. padding: 10rpx 32rpx;
  316. /deep/ .u-button{
  317. width: 40%;
  318. }
  319. }
  320. </style>