turnoverBom.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  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. let _this = this
  149. uni.scanCode({
  150. success: function(res) {
  151. _this.$refs.turnoverRef.open(res.result, this.wordInfo, this.newList, this.wordItem,
  152. index)
  153. }
  154. })
  155. },
  156. saveTurn(index, newTurnover) {
  157. let arr = this.newList[index].extInfo.positionList.filter(e => {
  158. return e.check
  159. })
  160. arr.forEach(f => {
  161. f.isend = true
  162. f.quantity = 0
  163. })
  164. let turnoverArr = []
  165. newTurnover[0].isOld = 0 // 新的
  166. newTurnover[0].id = null
  167. this.newList[index].isOld = 1 // 老的
  168. turnoverArr = [this.newList[index], ...newTurnover]
  169. transferVehicle(turnoverArr).then(res => {
  170. this.$emit('refreshList')
  171. })
  172. }
  173. }
  174. }
  175. </script>
  176. <style lang="scss" scoped>
  177. .title_box {
  178. margin-top: 20rpx;
  179. .name {
  180. font-size: 28rpx;
  181. font-style: normal;
  182. font-weight: 400;
  183. color: $theme-color;
  184. padding-left: 20rpx;
  185. position: relative;
  186. &:before {
  187. position: absolute;
  188. content: '';
  189. left: 0rpx;
  190. top: 0rpx;
  191. bottom: 0rpx;
  192. width: 4rpx;
  193. height: 28rpx;
  194. background: $theme-color;
  195. margin: auto;
  196. }
  197. }
  198. .left {
  199. width: 40rpx;
  200. }
  201. .btn_box {
  202. padding: 0 18rpx;
  203. height: 60rpx;
  204. background: $theme-color;
  205. font-size: 26rpx;
  206. font-style: normal;
  207. font-weight: 400;
  208. font-size: 24rpx;
  209. color: #fff;
  210. border-radius: 4rpx;
  211. .scan {
  212. width: 34rpx;
  213. height: 34rpx;
  214. margin-right: 12rpx;
  215. }
  216. }
  217. }
  218. .content_table {
  219. margin-top: 8rpx;
  220. width: 100%;
  221. border: 2rpx solid $border-color;
  222. .item {
  223. display: flex;
  224. border-bottom: 2rpx solid $border-color;
  225. .lable {
  226. width: 132rpx;
  227. text-align: center;
  228. background-color: #F7F9FA;
  229. font-size: 26rpx;
  230. border-right: 2rpx solid $border-color;
  231. flex-shrink: 0;
  232. }
  233. .ww80 {
  234. width: 80rpx;
  235. }
  236. .ww50 {
  237. width: 50%;
  238. }
  239. .content {
  240. width: 518rpx;
  241. min-height: 64rpx;
  242. font-size: 28rpx;
  243. line-height: 28rpx;
  244. font-style: normal;
  245. font-weight: 400;
  246. padding: 2rpx 8rpx;
  247. box-sizing: border-box;
  248. word-wrap: break-word;
  249. flex-grow: 1 !important;
  250. font-size: 24rpx;
  251. }
  252. &:last-child {
  253. border-bottom: none;
  254. }
  255. }
  256. }
  257. .content_table2 {
  258. width: 100%;
  259. .row {
  260. width: 100%;
  261. .item {
  262. color: #404446;
  263. font-size: 28rpx;
  264. padding-left: 12rpx;
  265. }
  266. .color157 {
  267. color: $theme-color;
  268. }
  269. .ww20 {
  270. width: 20%;
  271. }
  272. .ww35 {
  273. width: 35%;
  274. }
  275. .ww15 {
  276. width: 15%;
  277. }
  278. .ww25 {
  279. width: 25%;
  280. }
  281. .ww30 {
  282. width: 30%;
  283. }
  284. .ww15 {
  285. width: 15%;
  286. }
  287. .ww10 {
  288. width: 10%;
  289. }
  290. }
  291. .head {
  292. height: 64rpx;
  293. background: #F7F9FA;
  294. border-top: 2rpx solid #E3E5E5;
  295. border-left: 2rpx solid #E3E5E5;
  296. .item {
  297. height: 64rpx;
  298. line-height: 64rpx;
  299. border-right: 2rpx solid #E3E5E5;
  300. box-sizing: border-box;
  301. }
  302. }
  303. .tr {
  304. border-top: 2rpx solid #E3E5E5;
  305. border-left: 2rpx solid #E3E5E5;
  306. .item {
  307. font-size: 24rpx;
  308. min-height: 64rpx;
  309. display: flex;
  310. align-items: center;
  311. border-right: 2rpx solid #E3E5E5;
  312. box-sizing: border-box;
  313. white-space: normal;
  314. word-break: break-all;
  315. }
  316. &:last-child {
  317. border-bottom: 2rpx solid #E3E5E5;
  318. }
  319. }
  320. }
  321. .content_num {
  322. display: flex;
  323. align-items: center;
  324. padding: 0 4rpx;
  325. /deep/ .uni-input-input {
  326. border: 2rpx solid #F0F8F2;
  327. background: #F0F8F2;
  328. color: $theme-color;
  329. }
  330. }
  331. .check {
  332. width: 30rpx;
  333. height: 30rpx;
  334. }
  335. .isend {
  336. text-decoration: line-through;
  337. }
  338. .title_des{
  339. font-size: 28rpx;
  340. color: #FFA929;
  341. }
  342. .z_list{
  343. max-height: 500rpx;
  344. }
  345. </style>