reuseTurnoverBom.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name">周转车 </view>
  5. </view>
  6. <view v-for="(item, index) in newList">
  7. <!-- <view class="title_box rx-bc">
  8. <view class="left rx-ss" @click="getDelete(index)">
  9. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
  10. </view>
  11. </view> -->
  12. <view class="content_table">
  13. <view class="item rx-sc">
  14. <view class="rx ww50 ">
  15. <view class="lable ww80 rx-cc ">编号</view>
  16. <view class="content rx-sc">
  17. <view>{{item.code}}</view>
  18. </view>
  19. </view>
  20. <view class="rx ww50">
  21. <view class="lable rx-cc ww80">名称</view>
  22. <view class="content rx-sc">
  23. <view>{{item.name}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="content_table2">
  29. <view class="head row rx-sc">
  30. <view class="item ww10">货位</view>
  31. <view class="item ww25">工单编号</view>
  32. <view class="item ww25">产品编码</view>
  33. <view class="item ww20">数量PCS</view>
  34. <view class="item ww20">回用PCS</view>
  35. </view>
  36. <view class="table">
  37. <u-list @scrolltolower="scrolltolower" class="z_list">
  38. <view class="tr row rx-sc" v-for="(it, idx) in item.extInfo.positionList" :key='idx'>
  39. <view class="item ww10">{{it.code}}</view>
  40. <view class="item ww25" :class="{'color157': it.workOrderCode === wordItem.code}">
  41. {{ it.workOrderCode }}
  42. </view>
  43. <view class="item ww25" :class="{'color157': it.categoryCode === wordItem.productCode}">
  44. {{it.categoryCode}}
  45. </view>
  46. <view class="item ww20 ">
  47. <!-- <text>{{Number(it.quantity) - Number(it.sampleNum) + Number((it.reuseNum || 0)) }}</text> -->
  48. <text>{{Number(it.quantity) - Number(it.sampleNum) }}</text>
  49. </view>
  50. <view class="item ww20">
  51. <input class="uni-input content_num" v-model="it.reuseNum" type="digit"
  52. @input="handleCompute"></input>
  53. </view>
  54. </view>
  55. </u-list>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. props: {
  64. list: {
  65. type: Array,
  66. default: () => []
  67. },
  68. wordItem: {
  69. type: Object,
  70. default: () => {}
  71. },
  72. sampleList: {
  73. type: Array,
  74. default: () => []
  75. },
  76. reuseNum: {
  77. type: [String, Number],
  78. default: ''
  79. }
  80. },
  81. watch: {
  82. list: {
  83. immediate: true,
  84. deep: true,
  85. handler(newVal) {
  86. this.$set(this.wordItem, 'reuseTurnover', newVal)
  87. this.newList = newVal
  88. }
  89. },
  90. reuseNum: {
  91. immediate: true,
  92. deep: true,
  93. handler(val) {
  94. this.newReuseNum = val
  95. this.$forceUpdate()
  96. }
  97. },
  98. wordItem: {
  99. immediate: true,
  100. deep: true,
  101. handler(val) {
  102. }
  103. },
  104. sampleList: {
  105. immediate: true,
  106. deep: true,
  107. handler(newList, oldList) {
  108. this.reuseTurn(newList)
  109. }
  110. }
  111. },
  112. data() {
  113. return {
  114. }
  115. },
  116. created() {
  117. },
  118. methods: {
  119. scrolltolower() {},
  120. handleCompute() {
  121. let _count = 0
  122. this.newList.forEach(f => {
  123. if (f.extInfo && f.extInfo.positionList && f.extInfo.positionList.length > 0) {
  124. f.extInfo.positionList.forEach(o => {
  125. if (Object.prototype.hasOwnProperty.call(o, 'reuseNum')) {
  126. _count = _count + Number(o.reuseNum)
  127. }
  128. })
  129. }
  130. })
  131. if (this.newReuseNum != _count) {
  132. uni.showToast({
  133. title: `还余 (${this.newReuseNum - _count})未回用`,
  134. icon: 'none'
  135. })
  136. }
  137. },
  138. reuseTurn(list) {
  139. let obj = list.reduce((accumulator, currentValue) => {
  140. // 如果当前 code 已经在 accumulator 中,则递增其计数
  141. // 否则,在 accumulator 中添加新的键值对
  142. if (currentValue.code in accumulator) {
  143. if (currentValue.selectType == 1) {
  144. accumulator[currentValue.code]++;
  145. }
  146. } else {
  147. if (currentValue.selectType == 1) {
  148. accumulator[currentValue.code] = 1;
  149. } else {
  150. accumulator[currentValue.code] = 0;
  151. }
  152. }
  153. return accumulator;
  154. }, {}); // 初始的 accumulator 是一个空对象
  155. this.newList.forEach(f => {
  156. if (f.extInfo && f.extInfo.positionList && f.extInfo.positionList.length > 0) {
  157. f.extInfo.positionList.forEach(o => {
  158. o.reuseNum = obj[o.code] || 0
  159. })
  160. }
  161. })
  162. },
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .popup_box {
  168. width: 88vw;
  169. padding: 32rpx;
  170. }
  171. .operate_box {
  172. margin-top: 32rpx;
  173. padding: 10rpx 100rpx;
  174. /deep/ .u-button {
  175. width: 160rpx;
  176. }
  177. }
  178. .title_box {
  179. margin-top: 20rpx;
  180. .name {
  181. font-size: 28rpx;
  182. font-style: normal;
  183. font-weight: 400;
  184. color: $theme-color;
  185. padding-left: 20rpx;
  186. position: relative;
  187. &:before {
  188. position: absolute;
  189. content: '';
  190. left: 0rpx;
  191. top: 0rpx;
  192. bottom: 0rpx;
  193. width: 4rpx;
  194. height: 28rpx;
  195. background: $theme-color;
  196. margin: auto;
  197. }
  198. }
  199. .left {
  200. width: 40rpx;
  201. }
  202. .btn_box {
  203. padding: 0 18rpx;
  204. height: 60rpx;
  205. background: $theme-color;
  206. font-size: 26rpx;
  207. font-style: normal;
  208. font-weight: 400;
  209. font-size: 24rpx;
  210. color: #fff;
  211. border-radius: 4rpx;
  212. .scan {
  213. width: 34rpx;
  214. height: 34rpx;
  215. margin-right: 12rpx;
  216. }
  217. }
  218. }
  219. .content_table {
  220. margin-top: 8rpx;
  221. width: 100%;
  222. border: 2rpx solid $border-color;
  223. .item {
  224. display: flex;
  225. border-bottom: 2rpx solid $border-color;
  226. .lable {
  227. width: 132rpx;
  228. text-align: center;
  229. background-color: #F7F9FA;
  230. font-size: 26rpx;
  231. border-right: 2rpx solid $border-color;
  232. flex-shrink: 0;
  233. }
  234. .ww80 {
  235. width: 80rpx;
  236. }
  237. .ww50 {
  238. width: 50%;
  239. }
  240. .content {
  241. width: 518rpx;
  242. min-height: 64rpx;
  243. font-size: 28rpx;
  244. line-height: 28rpx;
  245. font-style: normal;
  246. font-weight: 400;
  247. padding: 2rpx 8rpx;
  248. box-sizing: border-box;
  249. word-wrap: break-word;
  250. flex-grow: 1 !important;
  251. font-size: 24rpx;
  252. }
  253. &:last-child {
  254. border-bottom: none;
  255. }
  256. }
  257. }
  258. .content_table2 {
  259. width: 100%;
  260. .row {
  261. width: 100%;
  262. .item {
  263. color: #404446;
  264. font-size: 28rpx;
  265. padding-left: 12rpx;
  266. }
  267. .color157 {
  268. color: $theme-color;
  269. }
  270. .ww20 {
  271. width: 20%;
  272. }
  273. .ww25 {
  274. width: 25%;
  275. }
  276. .ww30 {
  277. width: 35%;
  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. font-size: 24;
  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. .z_list {
  328. max-height: 500rpx;
  329. }
  330. </style>