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 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. produceRoutingId: this.formData.produceRoutingId
  132. }
  133. isEnd = false
  134. const res = await workorderPage(params)
  135. if (params.pageNum === 1) {
  136. this.dataList = []
  137. }
  138. let _list = res.list.map(m => {
  139. return {
  140. checked: false,
  141. ...m
  142. }
  143. })
  144. this.dataList.push(..._list)
  145. isEnd = this.dataList.length >= res.count
  146. },
  147. getpickTics() {
  148. pickStatistics({
  149. type: 'feedStatus'
  150. }).then(res => {
  151. this.navObj = res
  152. })
  153. },
  154. handTab(type) {
  155. if (type != this.tabType) {
  156. this.tabType = type
  157. }
  158. },
  159. handNav(type) {
  160. if (type != this.feedStatus) {
  161. this.feedStatus = type
  162. this.page = 1
  163. this.dataList = []
  164. this.getList()
  165. }
  166. },
  167. scrolltolower() {
  168. if (isEnd) return
  169. this.page++
  170. this.getList()
  171. },
  172. _seletedAll() {
  173. if (!this.seletedAll) {
  174. this.seletedAll = true
  175. this.dataList.forEach(e => {
  176. e.checked = true
  177. })
  178. } else {
  179. this.seletedAll = false
  180. this.dataList.forEach(e => {
  181. e.checked = false
  182. })
  183. }
  184. },
  185. jumpAdd() {
  186. let url
  187. url = '/pages/pda/feeding/details'
  188. let arr = []
  189. this.dataList.forEach(e => {
  190. if (e.checked) {
  191. arr.push(e.id)
  192. }
  193. })
  194. let _arr = JSON.stringify(arr)
  195. url += `?arr=${encodeURIComponent(_arr)}`
  196. uni.navigateTo({
  197. url
  198. })
  199. },
  200. // 相机扫码
  201. HandlScanCode() {
  202. uni.scanCode({
  203. success: (res) => {
  204. console.log(res)
  205. }
  206. })
  207. //_this.Scancodedate('res')
  208. },
  209. handleSearch() {
  210. this.searchShow = true
  211. },
  212. searchCancel() {
  213. this.formData.produceRoutingId = ''
  214. this.page = 1
  215. this.getList()
  216. this.searchShow = false
  217. },
  218. // 工艺路线
  219. produceFn() {
  220. let param = {
  221. pageNum: 1,
  222. size: -1
  223. }
  224. producerouting(param).then(res => {
  225. this.produceList = res.list
  226. })
  227. },
  228. }
  229. }
  230. </script>
  231. <style lang="scss" scoped>
  232. .content-box {
  233. height: 100vh;
  234. overflow: hidden;
  235. display: flex;
  236. flex-direction: column;
  237. background-color: $page-bg;
  238. }
  239. .tab_box {
  240. width: 100%;
  241. height: 68rpx;
  242. background: #fff;
  243. .tab_item {
  244. height: 68rpx;
  245. line-height: 68rpx;
  246. padding: 0 20rpx;
  247. font-size: 32rpx;
  248. color: #979C9E;
  249. }
  250. .active {
  251. box-sizing: border-box;
  252. border-bottom: 6rpx solid $theme-color;
  253. color: $theme-color;
  254. }
  255. }
  256. .nav_box {
  257. padding: 6rpx 32rpx;
  258. position: relative;
  259. .nav_item {
  260. font-size: 28rpx;
  261. font-weight: 400;
  262. color: $theme-color;
  263. background: #F0F8F2;
  264. margin-right: 16rpx;
  265. padding: 4rpx 16rpx;
  266. border-radius: 8rpx;
  267. border: 2rpx solid #ACD4B5;
  268. }
  269. .menu_box {
  270. position: absolute;
  271. right: 20rpx;
  272. top: 10rpx;
  273. .menu_icon {
  274. width: 44rpx;
  275. height: 44rpx;
  276. }
  277. }
  278. .active {
  279. background: $theme-color;
  280. border: 2rpx solid $theme-color;
  281. color: #FFF;
  282. }
  283. }
  284. .list_box {
  285. flex: 1;
  286. overflow: hidden;
  287. padding: 4rpx 0;
  288. .u-list {
  289. height: 100% !important;
  290. }
  291. }
  292. .bottom-wrapper {
  293. height: 80rpx;
  294. background: #fff;
  295. padding: 0 32rpx;
  296. /deep/ .uni-checkbox-input-checked {
  297. background-color: $theme-color !important;
  298. border-color: $theme-color !important;
  299. }
  300. }
  301. .search_list {
  302. min-height: 100rpx;
  303. /deep/ .baseForm {
  304. padding: 0 20rpx;
  305. }
  306. }
  307. .operate_box {
  308. padding: 10rpx 32rpx;
  309. /deep/ .u-button {
  310. width: 40%;
  311. }
  312. }
  313. </style>