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