turnoverBom.vue 8.6 KB

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