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