qualityTurnoverPopup.vue 8.5 KB

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