index.vue 9.2 KB

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