qualityTurnoverBom.vue 7.7 KB

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