index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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
  46. labelPosition="left"
  47. :model="formData"
  48. labelWidth="180"
  49. labelAlign="left"
  50. class="baseForm"
  51. >
  52. <u-form-item
  53. label="工艺路线:"
  54. class="required-form"
  55. borderBottom
  56. prop="assetType"
  57. >
  58. <zxz-uni-data-select :localdata="produceList" v-model="formData.produceRoutingId"
  59. dataValue='id' format='{name}' ></zxz-uni-data-select>
  60. </u-form-item>
  61. </u-form>
  62. </view>
  63. </template>
  64. <template v-slot:operate>
  65. <view class="operate_box rx-bc">
  66. <u-button size="small" class="u-reset-button" @click="searchCancel">
  67. 重置
  68. </u-button>
  69. <u-button type="success" size="small" class="u-reset-button" @click="search">
  70. 确定
  71. </u-button>
  72. </view>
  73. </template>
  74. </SearchPopup>
  75. </view>
  76. </template>
  77. <script>
  78. import feedCard from '../components/feedCard.vue'
  79. import {
  80. workorderPage,
  81. producerouting
  82. } from '@/api/pda/workOrder.js'
  83. import {
  84. pickStatistics
  85. } from '@/api/pda/picking.js'
  86. import SearchPopup from '../../components/searchPopup.vue'
  87. let [isEnd] = [false]
  88. export default {
  89. components: {
  90. feedCard,
  91. SearchPopup
  92. },
  93. data() {
  94. return {
  95. tabType: 1,
  96. feedStatus: 0,
  97. formData: {
  98. produceRoutingId: ''
  99. },
  100. navObj: {
  101. unclaimedQuantity: 0,
  102. claimedQuantity: 0
  103. },
  104. page: 1,
  105. size: 10,
  106. dataList: [],
  107. produceList: [],
  108. seletedAll: false, //全选状态
  109. searchShow: false,
  110. }
  111. },
  112. //选择的列表长度
  113. computed: {
  114. checkListLen() {
  115. let _fitArr = this.dataList.filter(f => f.checked)
  116. return _fitArr.length
  117. }
  118. },
  119. onLoad(option) {
  120. this.feedStatus = option.feedStatus || 0
  121. this.produceFn()
  122. },
  123. onShow() {
  124. this.page = 1
  125. // this.dataList = []
  126. this.getList()
  127. this.getpickTics()
  128. },
  129. methods: {
  130. search() {
  131. this.page = 1
  132. this.getList()
  133. this.searchShow = false
  134. },
  135. async getList() {
  136. let params = {
  137. pageNum: this.page,
  138. size: this.size,
  139. feedStatus: this.feedStatus,
  140. produceRoutingId: this.formData.produceRoutingId
  141. }
  142. isEnd = false
  143. const res = await workorderPage(params)
  144. if (params.page === 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({ type: 'feedStatus'}).then(res => {
  158. this.navObj = res
  159. })
  160. },
  161. handTab(type) {
  162. if (type != this.tabType) {
  163. this.tabType = type
  164. }
  165. },
  166. handNav(type) {
  167. if (type != this.feedStatus) {
  168. this.feedStatus = type
  169. this.page = 1
  170. this.dataList = []
  171. this.getList()
  172. }
  173. },
  174. scrolltolower() {
  175. if (isEnd) return
  176. this.page++
  177. this.getList()
  178. },
  179. _seletedAll() {
  180. if (!this.seletedAll) {
  181. this.seletedAll = true
  182. this.dataList.forEach(e => {
  183. e.checked = true
  184. })
  185. } else {
  186. this.seletedAll = false
  187. this.dataList.forEach(e => {
  188. e.checked = false
  189. })
  190. }
  191. },
  192. jumpAdd() {
  193. let url
  194. url = '/pages/pda/feeding/details'
  195. let arr = []
  196. this.dataList.forEach(e => {
  197. if (e.checked) {
  198. arr.push(e.id)
  199. }
  200. })
  201. let _arr = JSON.stringify(arr)
  202. url += `?arr=${encodeURIComponent(_arr)}`
  203. uni.navigateTo({
  204. url
  205. })
  206. },
  207. // 相机扫码
  208. HandlScanCode() {
  209. let _this = this
  210. uni.scanCode({
  211. success: function(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>