index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  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="nav_box">
  8. <view class="nav_inner">
  9. <view class="nav_item" :class="{active: feedStatus == 0}" @click="handNav(0)">
  10. 未投料({{navObj.unclaimedQuantity}})
  11. </view>
  12. <view class="nav_item" :class="{active: feedStatus == 1}" @click="handNav(1)">
  13. 已投料({{navObj.claimedQuantity}})
  14. </view>
  15. </view>
  16. <view class="menu_box" @click="handleSearch">
  17. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="list_box">
  22. <u-list @scrolltolower="scrolltolower">
  23. <feedCard v-if='dataList.length' :list="dataList"> </feedCard>
  24. <view v-else class="empty-wrapper">
  25. <u-empty iconSize='150' textSize='32' text='暂无工单'>
  26. </u-empty>
  27. </view>
  28. </u-list>
  29. </view>
  30. <view class="bottom-wrapper" v-if='feedStatus == 0'>
  31. <view class="bottom-inner">
  32. <view class="check-area">
  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 class="btn-area">
  38. <u-button type="success" size="small" class="u-reset-button submit-btn" :disabled="!checkListLen"
  39. @click="jumpAdd">
  40. <view> 选择( {{ checkListLen }} ) </view>
  41. </u-button>
  42. </view>
  43. </view>
  44. </view>
  45. <SearchPopup mode="top" v-if='searchShow'>
  46. <template v-slot:list>
  47. <view class="search_list">
  48. <u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
  49. <u-form-item label="工艺路线:" class="required-form" borderBottom prop="assetType">
  50. <zxz-uni-data-select :localdata="produceList" v-model="formData.produceRoutingId"
  51. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  52. </u-form-item>
  53. </u-form>
  54. </view>
  55. </template>
  56. <template v-slot:operate>
  57. <view class="operate_box">
  58. <u-button size="small" class="u-reset-button reset-btn" @click="searchCancel">
  59. 重置
  60. </u-button>
  61. <u-button type="success" size="small" class="u-reset-button confirm-btn" @click="search">
  62. 确定
  63. </u-button>
  64. </view>
  65. </template>
  66. </SearchPopup>
  67. </view>
  68. </template>
  69. <script>
  70. import feedCard from '../components/feedCard.vue'
  71. import {
  72. workorderPage,
  73. producerouting
  74. } from '@/api/pda/workOrder.js'
  75. import {
  76. pickStatistics
  77. } from '@/api/pda/picking.js'
  78. import SearchPopup from '../../components/searchPopup.vue'
  79. let [isEnd] = [false]
  80. export default {
  81. components: {
  82. feedCard,
  83. SearchPopup,
  84. },
  85. data() {
  86. return {
  87. tabType: 1,
  88. feedStatus: 0,
  89. formData: {
  90. produceRoutingId: ''
  91. },
  92. navObj: {
  93. unclaimedQuantity: 0,
  94. claimedQuantity: 0
  95. },
  96. page: 1,
  97. size: 10,
  98. dataList: [],
  99. produceList: [],
  100. seletedAll: false, //全选状态
  101. searchShow: false,
  102. }
  103. },
  104. //选择的列表长度
  105. computed: {
  106. checkListLen() {
  107. let _fitArr = this.dataList.filter(f => f.checked)
  108. return _fitArr.length
  109. }
  110. },
  111. onLoad(option) {
  112. this.feedStatus = option.feedStatus || 0
  113. if (option.feedStatus == 0 | option.feedStatus == 1) {
  114. this.page = 1
  115. this.dataList = []
  116. }
  117. this.getList()
  118. this.produceFn()
  119. },
  120. onShow() {
  121. this.getpickTics()
  122. },
  123. methods: {
  124. search() {
  125. this.page = 1
  126. this.getList()
  127. this.searchShow = false
  128. },
  129. async getList() {
  130. let params = {
  131. pageNum: this.page,
  132. size: this.size,
  133. feedStatus: this.feedStatus,
  134. customerClient: 2,
  135. workOrderType: 1,
  136. produceRoutingId: this.formData.produceRoutingId
  137. }
  138. isEnd = false
  139. const res = await workorderPage(params)
  140. if (params.pageNum === 1) {
  141. this.dataList = []
  142. }
  143. let _list = res.list.map(m => {
  144. return {
  145. checked: false,
  146. ...m
  147. }
  148. })
  149. this.dataList.push(..._list)
  150. isEnd = this.dataList.length >= res.count
  151. },
  152. getpickTics() {
  153. pickStatistics({
  154. type: 'feedStatus'
  155. }).then(res => {
  156. this.navObj = res
  157. })
  158. },
  159. handTab(type) {
  160. if (type != this.tabType) {
  161. this.tabType = type
  162. }
  163. },
  164. handNav(type) {
  165. if (type != this.feedStatus) {
  166. this.feedStatus = type
  167. this.page = 1
  168. this.dataList = []
  169. this.getList()
  170. }
  171. },
  172. scrolltolower() {
  173. if (isEnd) return
  174. this.page++
  175. this.getList()
  176. },
  177. _seletedAll() {
  178. if (!this.seletedAll) {
  179. this.seletedAll = true
  180. this.dataList.forEach(e => {
  181. e.checked = true
  182. })
  183. } else {
  184. this.seletedAll = false
  185. this.dataList.forEach(e => {
  186. e.checked = false
  187. })
  188. }
  189. },
  190. jumpAdd() {
  191. let url
  192. url = '/pages/pda/feeding/details'
  193. let arr = []
  194. this.dataList.forEach(e => {
  195. if (e.checked) {
  196. arr.push(e.id)
  197. }
  198. })
  199. let _arr = JSON.stringify(arr)
  200. url += `?arr=${encodeURIComponent(_arr)}`
  201. uni.navigateTo({
  202. url
  203. })
  204. },
  205. // 相机扫码
  206. HandlScanCode() {
  207. uni.scanCode({
  208. success: (res) => {
  209. console.log(res)
  210. }
  211. })
  212. //_this.Scancodedate('res')
  213. },
  214. handleSearch() {
  215. this.searchShow = true
  216. },
  217. searchCancel() {
  218. this.formData.produceRoutingId = ''
  219. this.page = 1
  220. this.getList()
  221. this.searchShow = false
  222. },
  223. // 工艺路线
  224. produceFn() {
  225. let param = {
  226. pageNum: 1,
  227. size: -1
  228. }
  229. producerouting(param).then(res => {
  230. this.produceList = res.list
  231. })
  232. },
  233. }
  234. }
  235. </script>
  236. <style lang="scss" scoped>
  237. .content-box {
  238. height: 100vh;
  239. overflow: hidden;
  240. display: flex;
  241. flex-direction: column;
  242. background-color: $page-bg;
  243. }
  244. .top-wrapper {
  245. flex-shrink: 0;
  246. background-color: #fff;
  247. box-shadow: 0 2rpx 16rpx rgba(0, 0, 0, 0.05);
  248. z-index: 10;
  249. }
  250. .tab_box {
  251. width: 100%;
  252. height: 88rpx;
  253. background: #fff;
  254. display: flex;
  255. flex-direction: row;
  256. align-items: center;
  257. .tab_item {
  258. height: 88rpx;
  259. line-height: 88rpx;
  260. padding: 0 36rpx;
  261. font-size: $uni-font-size-base;
  262. color: $uni-text-color-grey;
  263. position: relative;
  264. transition: color 0.3s;
  265. }
  266. .active {
  267. color: $theme-color;
  268. font-weight: 600;
  269. &::after {
  270. content: '';
  271. position: absolute;
  272. bottom: 0;
  273. left: 50%;
  274. transform: translateX(-50%);
  275. width: 56%;
  276. height: 6rpx;
  277. background-color: $theme-color;
  278. border-radius: 6rpx;
  279. }
  280. }
  281. }
  282. .nav_box {
  283. display: flex;
  284. flex-direction: row;
  285. align-items: center;
  286. justify-content: space-between;
  287. padding: 20rpx 24rpx;
  288. background-color: #fff;
  289. .nav_inner {
  290. display: flex;
  291. flex-direction: row;
  292. align-items: center;
  293. flex: 1;
  294. flex-wrap: wrap;
  295. gap: 16rpx;
  296. }
  297. .nav_item {
  298. font-size: $uni-font-size-sm;
  299. font-weight: 400;
  300. color: $theme-color;
  301. background: rgba(21, 122, 44, 0.06);
  302. padding: 12rpx 32rpx;
  303. border-radius: 36rpx;
  304. border: 2rpx solid rgba(21, 122, 44, 0.2);
  305. transition: all 0.25s ease;
  306. white-space: nowrap;
  307. }
  308. .active {
  309. background: $theme-color;
  310. border-color: $theme-color;
  311. color: #fff;
  312. font-weight: 500;
  313. box-shadow: 0 4rpx 16rpx rgba(21, 122, 44, 0.25);
  314. }
  315. .menu_box {
  316. flex-shrink: 0;
  317. display: flex;
  318. align-items: center;
  319. justify-content: center;
  320. width: 68rpx;
  321. height: 68rpx;
  322. border-radius: 50%;
  323. background-color: $page-bg;
  324. margin-left: 20rpx;
  325. &:active {
  326. opacity: 0.7;
  327. }
  328. .menu_icon {
  329. width: 36rpx;
  330. height: 36rpx;
  331. }
  332. }
  333. }
  334. .list_box {
  335. flex: 1;
  336. overflow: hidden;
  337. padding-top: 16rpx;
  338. .u-list {
  339. height: 100% !important;
  340. }
  341. }
  342. .empty-wrapper {
  343. display: flex;
  344. align-items: center;
  345. justify-content: center;
  346. padding-top: 25vh;
  347. }
  348. .bottom-wrapper {
  349. flex-shrink: 0;
  350. background: #fff;
  351. box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
  352. /* 适配底部安全区域(iPhone X 等机型) */
  353. padding-bottom: constant(safe-area-inset-bottom);
  354. padding-bottom: env(safe-area-inset-bottom);
  355. .bottom-inner {
  356. display: flex;
  357. flex-direction: row;
  358. align-items: center;
  359. justify-content: space-between;
  360. height: 110rpx;
  361. padding: 0 32rpx;
  362. }
  363. .check-area {
  364. display: flex;
  365. flex-direction: row;
  366. align-items: center;
  367. font-size: $uni-font-size-sm;
  368. color: $uni-text-color;
  369. }
  370. .btn-area {
  371. .submit-btn {
  372. min-width: 200rpx;
  373. height: 72rpx;
  374. border-radius: 36rpx;
  375. font-size: $uni-font-size-sm;
  376. }
  377. }
  378. /deep/ .uni-checkbox-input-checked {
  379. background-color: $theme-color !important;
  380. border-color: $theme-color !important;
  381. }
  382. }
  383. .search_list {
  384. min-height: 100rpx;
  385. padding: 24rpx 0;
  386. /deep/ .baseForm {
  387. padding: 0 32rpx;
  388. }
  389. }
  390. .operate_box {
  391. display: flex;
  392. flex-direction: row;
  393. align-items: center;
  394. justify-content: space-between;
  395. padding: 24rpx 32rpx 32rpx;
  396. gap: 24rpx;
  397. .reset-btn {
  398. flex: 1;
  399. height: 72rpx;
  400. border-radius: 36rpx;
  401. font-size: $uni-font-size-sm;
  402. }
  403. .confirm-btn {
  404. flex: 1;
  405. height: 72rpx;
  406. border-radius: 36rpx;
  407. font-size: $uni-font-size-sm;
  408. }
  409. }
  410. </style>