turnoverBom.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <template>
  2. <view>
  3. <view>
  4. <view class="title_box rx-bc">
  5. <view class="name">周转车</view>
  6. </view>
  7. <view v-for="(item, index) in newList" :key='index'>
  8. <view class="title_box rx-bc">
  9. <view class="btn_box rx-bc" @click="handleTrade(index)" v-if='item.isOld == 1'>
  10. 工单换周转车
  11. </view>
  12. <view class='title_des' v-if='item.isOld == 0'>
  13. 转换后周转车
  14. </view>
  15. </view>
  16. <view class="content_table">
  17. <view class="item rx-sc">
  18. <view class="rx ww50 ">
  19. <view class="lable ww80 rx-cc ">编号</view>
  20. <view class="content rx-sc">
  21. <view>{{item.code}}</view>
  22. </view>
  23. </view>
  24. <view class="rx ww50">
  25. <view class="lable rx-cc ww80">名称</view>
  26. <view class="content rx-sc">
  27. <view>{{item.name}}</view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="content_table2">
  33. <view class="head row rx-sc">
  34. <view class="item ww10">货位</view>
  35. <view class="item ww30">工单编号</view>
  36. <view class="item ww30">产品编码</view>
  37. <view class="item ww15">数量</view>
  38. <view class="item ww15" style="color: #157A2C;" @click="turnoverSelect(index)">
  39. {{ isAllSelect ? '取消' : '全选' }}
  40. </view>
  41. </view>
  42. <view class="table">
  43. <u-list @scrolltolower="scrolltolower" class="z_list">
  44. <view class="tr row rx-sc" v-for="(it, idx) in item.extInfo.positionList" :key='idx'>
  45. <view class="item ww10">{{it.code}}</view>
  46. <view class="item ww30" :class="{'color157': it.workOrderCode === wordItem.code}">
  47. {{ it.workOrderCode }}
  48. </view>
  49. <view class="item ww30" :class="{'color157': it.categoryCode === wordItem.productCode}">
  50. {{it.categoryCode}}
  51. </view>
  52. <view class="item ww15 content_num ">
  53. <input class="uni-input" v-model="it.newQuantity" type="digit"></input>
  54. </view>
  55. <view class="item ww15 rx-cc " v-if='!it.isend ' @click="handleCheck(index, idx, it)">
  56. <image class="check" v-if='item.isOld != 0 && it.check' src='@/static/check.png'>
  57. </image>
  58. <image class="check" v-if='item.isOld != 0 && !it.check'
  59. src='@/static/check_no.png'></image>
  60. </view>
  61. </view>
  62. </u-list>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <turnoverPopup ref='turnoverRef' @saveTurn='saveTurn'></turnoverPopup>
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. transferVehicle,
  73. } from '@/api/pda/workOrder.js'
  74. import turnoverPopup from './turnoverPopup.vue'
  75. export default {
  76. components: {
  77. turnoverPopup
  78. },
  79. props: {
  80. list: {
  81. type: Array,
  82. default: () => []
  83. },
  84. wordItem: {
  85. type: Object,
  86. default: () => {}
  87. },
  88. newTurnover: {
  89. type: Array,
  90. default: () => []
  91. },
  92. },
  93. watch: {
  94. list: {
  95. immediate: true,
  96. deep: true,
  97. handler(newVal) {
  98. this.newList = newVal
  99. }
  100. }
  101. },
  102. data() {
  103. return {
  104. recycleQuantity: '',
  105. newList: [],
  106. isAllSelect: false,
  107. wordInfo: {
  108. workOrderCode: null,
  109. categoryCode: null,
  110. }
  111. }
  112. },
  113. methods: {
  114. scrolltolower() {},
  115. turnoverSelect(index) {
  116. this.newList[index].extInfo.positionList.forEach(f => {
  117. if (this.isAllSelect && Number(f.newQuantity) > 0) {
  118. f.check = false
  119. } else if (!this.isAllSelect && Number(f.newQuantity) > 0) {
  120. f.check = true
  121. }
  122. })
  123. this.isAllSelect =!this.isAllSelect
  124. },
  125. handleCheck(index, idx, it) {
  126. if (it.quantity <= 0) {
  127. uni.showToast({
  128. icon: 'none',
  129. title: '数量为空不能勾选'
  130. })
  131. return false
  132. }
  133. let arr = this.newList[index].extInfo.positionList.filter(e => {
  134. return e.check && !e.isend
  135. })
  136. let flag = arr.every((i) => {
  137. return i.workOrderCode == it.workOrderCode && i.categoryCode == it.categoryCode
  138. })
  139. if (flag) {
  140. this.$set(this.newList[index].extInfo.positionList[idx], 'check', !it.check)
  141. } else {
  142. uni.showToast({
  143. icon: 'none',
  144. title: '一次只能转移同一工单产品'
  145. })
  146. }
  147. },
  148. handleTrade(index) {
  149. let arr = this.newList[index].extInfo.positionList.filter(e => {
  150. return e.check
  151. })
  152. if (arr.length == 0) {
  153. uni.showToast({
  154. icon: 'none',
  155. title: '请先勾选需要转移的工单'
  156. })
  157. return false
  158. }
  159. this.wordInfo.workOrderCode = arr[0].workOrderCode
  160. this.wordInfo.categoryCode = arr[0].categoryCode
  161. // this.$refs.turnoverRef.open('w0300000003635004', this.wordInfo, this.newList, this.wordItem, index)
  162. // return false
  163. uni.scanCode({
  164. success: (res) => {
  165. this.$refs.turnoverRef.open(res.result, this.wordInfo, this.newList, this.wordItem,
  166. index)
  167. }
  168. })
  169. },
  170. saveTurn(index, newTurnover) {
  171. let arr = this.newList[index].extInfo.positionList.filter(e => {
  172. return e.check
  173. })
  174. arr.forEach(f => {
  175. f.isend = true
  176. f.quantity = 0
  177. })
  178. let turnoverArr = []
  179. newTurnover[0].isOld = 0 // 新的
  180. newTurnover[0].id = null
  181. this.newList[index].isOld = 1 // 老的
  182. turnoverArr = [this.newList[index], ...newTurnover]
  183. transferVehicle(turnoverArr).then(res => {
  184. this.$emit('refreshList')
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. .title_box {
  192. margin-top: 20rpx;
  193. .name {
  194. font-size: 28rpx;
  195. font-style: normal;
  196. font-weight: 400;
  197. color: $theme-color;
  198. padding-left: 20rpx;
  199. position: relative;
  200. &:before {
  201. position: absolute;
  202. content: '';
  203. left: 0rpx;
  204. top: 0rpx;
  205. bottom: 0rpx;
  206. width: 4rpx;
  207. height: 28rpx;
  208. background: $theme-color;
  209. margin: auto;
  210. }
  211. }
  212. .left {
  213. width: 40rpx;
  214. }
  215. .btn_box {
  216. padding: 0 18rpx;
  217. height: 60rpx;
  218. background: $theme-color;
  219. font-size: 26rpx;
  220. font-style: normal;
  221. font-weight: 400;
  222. font-size: 24rpx;
  223. color: #fff;
  224. border-radius: 4rpx;
  225. .scan {
  226. width: 34rpx;
  227. height: 34rpx;
  228. margin-right: 12rpx;
  229. }
  230. }
  231. }
  232. .content_table {
  233. margin-top: 8rpx;
  234. width: 100%;
  235. border: 2rpx solid $border-color;
  236. .item {
  237. display: flex;
  238. border-bottom: 2rpx solid $border-color;
  239. .lable {
  240. width: 132rpx;
  241. text-align: center;
  242. background-color: #F7F9FA;
  243. font-size: 26rpx;
  244. border-right: 2rpx solid $border-color;
  245. flex-shrink: 0;
  246. }
  247. .ww80 {
  248. width: 80rpx;
  249. }
  250. .ww50 {
  251. width: 50%;
  252. }
  253. .content {
  254. width: 518rpx;
  255. min-height: 64rpx;
  256. font-size: 28rpx;
  257. line-height: 28rpx;
  258. font-style: normal;
  259. font-weight: 400;
  260. padding: 2rpx 8rpx;
  261. box-sizing: border-box;
  262. word-wrap: break-word;
  263. flex-grow: 1 !important;
  264. font-size: 24rpx;
  265. }
  266. &:last-child {
  267. border-bottom: none;
  268. }
  269. }
  270. }
  271. .content_table2 {
  272. width: 100%;
  273. .row {
  274. width: 100%;
  275. .item {
  276. color: #404446;
  277. font-size: 28rpx;
  278. padding-left: 12rpx;
  279. }
  280. .color157 {
  281. color: $theme-color;
  282. }
  283. .ww20 {
  284. width: 20%;
  285. }
  286. .ww35 {
  287. width: 35%;
  288. }
  289. .ww15 {
  290. width: 15%;
  291. }
  292. .ww25 {
  293. width: 25%;
  294. }
  295. .ww30 {
  296. width: 30%;
  297. }
  298. .ww15 {
  299. width: 15%;
  300. }
  301. .ww10 {
  302. width: 10%;
  303. }
  304. }
  305. .head {
  306. height: 64rpx;
  307. background: #F7F9FA;
  308. border-top: 2rpx solid #E3E5E5;
  309. border-left: 2rpx solid #E3E5E5;
  310. .item {
  311. height: 64rpx;
  312. line-height: 64rpx;
  313. border-right: 2rpx solid #E3E5E5;
  314. box-sizing: border-box;
  315. }
  316. }
  317. .tr {
  318. border-top: 2rpx solid #E3E5E5;
  319. border-left: 2rpx solid #E3E5E5;
  320. .item {
  321. font-size: 24rpx;
  322. min-height: 64rpx;
  323. display: flex;
  324. align-items: center;
  325. border-right: 2rpx solid #E3E5E5;
  326. box-sizing: border-box;
  327. white-space: normal;
  328. word-break: break-all;
  329. }
  330. &:last-child {
  331. border-bottom: 2rpx solid #E3E5E5;
  332. }
  333. }
  334. }
  335. .content_num {
  336. display: flex;
  337. align-items: center;
  338. padding: 0 4rpx;
  339. /deep/ .uni-input-input {
  340. border: 2rpx solid #F0F8F2;
  341. background: #F0F8F2;
  342. color: $theme-color;
  343. }
  344. }
  345. .check {
  346. width: 30rpx;
  347. height: 30rpx;
  348. }
  349. .isend {
  350. text-decoration: line-through;
  351. }
  352. .title_des {
  353. font-size: 28rpx;
  354. color: #FFA929;
  355. }
  356. .z_list {
  357. max-height: 500rpx;
  358. }
  359. </style>