index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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. if(option.feedStatus == 0 | option.feedStatus == 1) {
  122. this.page = 1
  123. this.dataList = []
  124. }
  125. this.getList()
  126. this.produceFn()
  127. },
  128. onShow() {
  129. this.getpickTics()
  130. },
  131. methods: {
  132. search() {
  133. this.page = 1
  134. this.getList()
  135. this.searchShow = false
  136. },
  137. async getList() {
  138. let params = {
  139. pageNum: this.page,
  140. size: this.size,
  141. feedStatus: this.feedStatus,
  142. produceRoutingId: this.formData.produceRoutingId
  143. }
  144. isEnd = false
  145. const res = await workorderPage(params)
  146. if (params.page === 1) {
  147. this.dataList = []
  148. }
  149. let _list = res.list.map(m => {
  150. return {
  151. checked: false,
  152. ...m
  153. }
  154. })
  155. this.dataList.push(..._list)
  156. isEnd = this.dataList.length >= res.count
  157. },
  158. getpickTics() {
  159. pickStatistics({ type: 'feedStatus'}).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. let _this = this
  212. uni.scanCode({
  213. success: function(res) {
  214. console.log(res)
  215. }
  216. })
  217. //_this.Scancodedate('res')
  218. },
  219. handleSearch() {
  220. this.searchShow = true
  221. },
  222. searchCancel() {
  223. this.formData.produceRoutingId = ''
  224. this.page = 1
  225. this.getList()
  226. this.searchShow = false
  227. },
  228. // 工艺路线
  229. produceFn() {
  230. let param = {
  231. pageNum: 1,
  232. size: -1
  233. }
  234. producerouting(param).then(res => {
  235. this.produceList = res.list
  236. })
  237. },
  238. }
  239. }
  240. </script>
  241. <style lang="scss" scoped>
  242. .content-box {
  243. height: 100vh;
  244. overflow: hidden;
  245. display: flex;
  246. flex-direction: column;
  247. background-color: $page-bg;
  248. }
  249. .tab_box {
  250. width: 100%;
  251. height: 68rpx;
  252. background: #fff;
  253. .tab_item {
  254. height: 68rpx;
  255. line-height: 68rpx;
  256. padding: 0 20rpx;
  257. font-size: 32rpx;
  258. color: #979C9E;
  259. }
  260. .active {
  261. box-sizing: border-box;
  262. border-bottom: 6rpx solid $theme-color;
  263. color: $theme-color;
  264. }
  265. }
  266. .nav_box {
  267. padding: 6rpx 32rpx;
  268. position: relative;
  269. .nav_item {
  270. font-size: 28rpx;
  271. font-weight: 400;
  272. color: $theme-color;
  273. background: #F0F8F2;
  274. margin-right: 16rpx;
  275. padding: 4rpx 16rpx;
  276. border-radius: 8rpx;
  277. border: 2rpx solid #ACD4B5;
  278. }
  279. .menu_box {
  280. position: absolute;
  281. right: 20rpx;
  282. top: 10rpx;
  283. .menu_icon {
  284. width: 44rpx;
  285. height: 44rpx;
  286. }
  287. }
  288. .active {
  289. background: $theme-color;
  290. border: 2rpx solid $theme-color;
  291. color: #FFF;
  292. }
  293. }
  294. .list_box {
  295. flex: 1;
  296. overflow: hidden;
  297. padding: 4rpx 0;
  298. .u-list {
  299. height: 100% !important;
  300. }
  301. }
  302. .bottom-wrapper {
  303. height: 80rpx;
  304. background: #fff;
  305. padding: 0 32rpx;
  306. /deep/ .uni-checkbox-input-checked {
  307. background-color: $theme-color !important;
  308. border-color: $theme-color !important;
  309. }
  310. }
  311. .search_list{
  312. min-height: 100rpx;
  313. /deep/ .baseForm{
  314. padding: 0 20rpx;
  315. }
  316. }
  317. .operate_box{
  318. padding: 10rpx 32rpx;
  319. /deep/ .u-button{
  320. width: 40%;
  321. }
  322. }
  323. </style>