turnoverBom.vue 7.5 KB

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