turnoverBom.vue 7.7 KB

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