packingBom.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name">内包装</view>
  5. </view>
  6. <view class="material ">
  7. <view class="content_table">
  8. <view class="item">
  9. <view class="lable rx-cc">包装总数</view>
  10. <view class="content content_num">
  11. <input class="uni-input" v-model="formedNumLast" type='digit'></input>
  12. <view class="unit">{{objData.unit}}</view>
  13. </view>
  14. </view>
  15. <view class="item rx-sc">
  16. <view class="rx ww55 ">
  17. <view class="lable lable150 rx-cc ">内包装单元</view>
  18. <view class="content content_num">
  19. <input class="uni-input" v-model="quantity"></input>
  20. </view>
  21. </view>
  22. <view class="rx ww45">
  23. <view class="rx-cc ww80">
  24. <view style="max-width: 100rpx; font-size: 24rpx;">{{objData.unit}}</view>/
  25. </view>
  26. <view class="content rx-sc">
  27. <zxz-uni-data-select :localdata="unitList" v-model="unit" dataValue='Key' format='{Value}'
  28. dataKey="Key" filterable :clear='false'></zxz-uni-data-select>
  29. <view class="penalize" @click="handleSplit">确认</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="content_table2" v-if='splitList.length'>
  35. <view class="head row rx-sc">
  36. <view class="item ww10">序号</view>
  37. <view class="item ww30">数量</view>
  38. <view class="item ww50">条码</view>
  39. <view class="item ww10"></view>
  40. </view>
  41. <view class="table">
  42. <u-list @scrolltolower="scrolltolower" class="z_list">
  43. <view class="tr row rx-sc" v-for="(it, idx) in splitList" :key='idx'>
  44. <view class="item ww10 rx-cc ">{{ it.computeSize }}</view>
  45. <view class="item ww30 content_num rx-sc">
  46. <input class="uni-input" v-model="it.quantity" type="digit"></input>
  47. <view style="width: 260rpx; font-size: 22rpx;"> {{objData.unit}}/ {{it.unit}}</view>
  48. </view>
  49. <view class="item ww50">
  50. {{ it.code }}
  51. </view>
  52. <view class="item ww10 rx-cc" v-if="!it.parentId" @click="handleCheck( idx, it)">
  53. <image class="check" v-if='it.check == 1' src='@/static/check.png'>
  54. </image>
  55. <image class="check" v-if='it.check == 0 || it.check == null ' src='@/static/check_no.png'>
  56. </image>
  57. </view>
  58. </view>
  59. </u-list>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="material ">
  64. <view class="title_box rx-bc">
  65. <view class="name">外包装</view>
  66. </view>
  67. <view class="content_table2" v-if='temporaryList.length'>
  68. <view class="head row rx-sc">
  69. <view class="item ww10">序号</view>
  70. <view class="item ww30">数量</view>
  71. <view class="item ww50">条码</view>
  72. <view class="item ww10"></view>
  73. </view>
  74. <view class="table">
  75. <view class="tr row rx-sc" v-for="(it, idx) in temporaryList" :key='idx'>
  76. <view class="item ww10 rx-cc ">{{ idx + 1 }}</view>
  77. <view class="item ww30 content_num rx-sc">
  78. <input class="uni-input" v-model="it.quantity" disabled type="digit"></input>
  79. <view style="width: 260rpx; font-size: 22rpx;"> {{objData.unit}}/ {{it.unit}}</view>
  80. </view>
  81. <view class="item ww50">
  82. {{ it.code }}
  83. </view>
  84. <view class="item ww10 rx-cc">
  85. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20"
  86. color="#fa3534" @click="handclose(it)"></uni-icons>
  87. </view>
  88. </view>
  89. <view class="tr row rx-sc">
  90. <view class="item ww10 rx-cc ">合并</view>
  91. <view class="item ww90 rx-sc">
  92. 总共{{temporaryCount}} {{objData.unit}} / {{this.temporaryNum}} {{unit}}
  93. --打包成 1
  94. <zxz-uni-data-select :localdata="unitList" v-model="packUnit" dataValue='Key'
  95. format='{Value}' dataKey="Key" filterable :clear='false'></zxz-uni-data-select>
  96. <view class="penalize" @click="handlePack">打包</view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <!-- 外包装 列表-->
  102. <view class="content_table2" v-if='packTwoList.length > 0'>
  103. <view class="head row rx-sc">
  104. <view class="item ww10">序号</view>
  105. <view class="item ww30">数量</view>
  106. <view class="item ww50">条码</view>
  107. <view class="item ww10"></view>
  108. </view>
  109. <view class="table">
  110. <view class="tr row rx-sc " v-for="(it, idx) in packTwoList" :key='idx'>
  111. <view class="item ww10 rx-cc ">{{ idx + 1 }}</view>
  112. <view class="item ww30 content_num rx-sc">
  113. {{ it.quantity}} {{ objData.unit }} / {{it.unit}}
  114. </view>
  115. <view class="item ww50">
  116. {{ it.code }}
  117. </view>
  118. <view class="item ww10 rx-cc">
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </template>
  126. <script>
  127. import {
  128. getByCode
  129. } from '@/api/pda/common.js'
  130. import {
  131. packingReport,
  132. getPackingReport,
  133. packingReportRepeat,
  134. getPackingReportRepeat
  135. } from '@/api/pda/workOrder.js'
  136. export default {
  137. props: {
  138. objData: {
  139. type: Object,
  140. default: () => {}
  141. },
  142. taskId: {
  143. type: String,
  144. default: ''
  145. },
  146. workOrderId: {
  147. type: String,
  148. default: ''
  149. }
  150. },
  151. data() {
  152. return {
  153. formedNumLast: 0,
  154. quantity: '',
  155. unit: '',
  156. unitList: [],
  157. splitList: [],
  158. packUnit: null,
  159. temporaryNum: 0,
  160. temporaryCount: 0,
  161. temporaryList: [],
  162. packTwoList: []
  163. }
  164. },
  165. created() {
  166. this.formedNumLast = this.objData.formedNumLast
  167. this.byCode(),
  168. this.getPackingDetails()
  169. this.getPackingDetailsTwo()
  170. },
  171. methods: {
  172. byCode() {
  173. getByCode('packing_unit').then(res => {
  174. this.unitList = []
  175. res.forEach((obj, index) => {
  176. for (let key in obj) {
  177. if (obj.hasOwnProperty(key)) { // 确保key是对象自身的属性
  178. this.unitList.push({
  179. Key: `${key}`,
  180. Value: ` ${obj[key]}`
  181. })
  182. }
  183. }
  184. });
  185. })
  186. },
  187. getPackingDetails() {
  188. let param = {
  189. workOrderId: this.workOrderId,
  190. taskId: this.taskId,
  191. tier: 1
  192. }
  193. getPackingReport(param).then(res => {
  194. this.splitList = res.detailList
  195. this.formedNumLast = res.totalQuantity
  196. this.quantity = res.quantity
  197. this.unit = res.unit
  198. })
  199. },
  200. handleSplit() {
  201. if (this.splitList.length) {
  202. uni.showToast({
  203. title: '产品已分包',
  204. icon: 'none'
  205. })
  206. return false
  207. }
  208. if (!this.formedNumLast) {
  209. uni.showToast({
  210. title: '包装总数数量不能为空',
  211. icon: 'none'
  212. })
  213. return false
  214. }
  215. if (!this.quantity) {
  216. uni.showToast({
  217. title: '内包装单元数量不能为空',
  218. icon: 'none'
  219. })
  220. return false
  221. }
  222. if (!this.unit) {
  223. uni.showToast({
  224. title: '请选择包装单位',
  225. icon: 'none'
  226. })
  227. return false
  228. }
  229. let param = {
  230. totalQuantity: this.objData.formedNumLast,
  231. quantity: this.quantity,
  232. unit: this.unit,
  233. workOrderId: this.workOrderId,
  234. taskId: this.taskId,
  235. tier: 1
  236. }
  237. packingReport(param).then(res => {
  238. this.splitList = res.map(m => {
  239. return {
  240. check: false,
  241. ...m
  242. }
  243. })
  244. this.getPackingDetails()
  245. })
  246. },
  247. handleCheck(idx, it) {
  248. if (it.quantity <= 0) {
  249. uni.showToast({
  250. icon: 'none',
  251. title: '数量为空不能勾选'
  252. })
  253. return false
  254. }
  255. this.$set(this.splitList[idx], 'check', it.check ? 0 : 1)
  256. this.temporaryList = []
  257. this.temporaryList = this.splitList.filter(e => {
  258. return e.check == 1
  259. })
  260. this.temporaryNum = 0
  261. this.temporaryCount = 0
  262. if (this.temporaryList.length > 0) {
  263. this.temporaryList.forEach(e => {
  264. this.temporaryNum = this.temporaryNum + 1
  265. this.temporaryCount = this.temporaryCount + Number(e.quantity)
  266. })
  267. }
  268. },
  269. handclose(it) {
  270. this.splitList.forEach(f => {
  271. if(f.computeSize == it.computeSize) {
  272. f.check = 0
  273. }
  274. })
  275. this.temporaryList = []
  276. this.temporaryList = this.splitList.filter(e => {
  277. return e.check == 1
  278. })
  279. },
  280. getPackingDetailsTwo() {
  281. let param = {
  282. totalQuantity: this.objData.formedNumLast,
  283. quantity: this.quantity,
  284. unit: this.unit,
  285. workOrderId: this.workOrderId,
  286. taskId: this.taskId,
  287. tier: 2,
  288. }
  289. getPackingReportRepeat(param).then(res => {
  290. this.packTwoList = res.detailList
  291. })
  292. },
  293. handlePack() {
  294. let param = {
  295. detailList: this.temporaryList,
  296. quantity: this.temporaryCount,
  297. totalQuantity: this.formedNumLast,
  298. unit: this.packUnit,
  299. taskId: this.taskId,
  300. workOrderId: this.workOrderId,
  301. tier: 2
  302. }
  303. packingReportRepeat(param).then(res => {
  304. this.temporaryList = []
  305. this.getPackingDetails()
  306. this.getPackingDetailsTwo()
  307. })
  308. },
  309. scrolltolower() {
  310. },
  311. getData() {
  312. let _packingReportMarginList = []
  313. _packingReportMarginList = this.splitList.filter(e => {
  314. return !e.parentId
  315. })
  316. let packInfo = {
  317. packingReportList: this.packTwoList,
  318. packingReportMarginList: _packingReportMarginList,
  319. formedNumLast: this.formedNumLast
  320. }
  321. return packInfo
  322. },
  323. },
  324. }
  325. </script>
  326. <style lang="scss" scoped>
  327. .title_box {
  328. margin-top: 20rpx;
  329. .name {
  330. font-size: 28rpx;
  331. font-style: normal;
  332. font-weight: 400;
  333. color: $theme-color;
  334. padding-left: 20rpx;
  335. position: relative;
  336. &:before {
  337. position: absolute;
  338. content: '';
  339. left: 0rpx;
  340. top: 0rpx;
  341. bottom: 0rpx;
  342. width: 4rpx;
  343. height: 28rpx;
  344. background: $theme-color;
  345. margin: auto;
  346. }
  347. }
  348. }
  349. .material {
  350. margin-top: 10rpx;
  351. .content_table {
  352. width: 100%;
  353. border: 2rpx solid $border-color;
  354. .item {
  355. display: flex;
  356. border-bottom: 2rpx solid $border-color;
  357. .lable {
  358. width: 132rpx;
  359. text-align: center;
  360. background-color: #F7F9FA;
  361. font-size: 26rpx;
  362. border-right: 2rpx solid $border-color;
  363. flex-shrink: 0;
  364. }
  365. .lable220 {
  366. width: 220rpx !important;
  367. font-size: 24rpx;
  368. }
  369. .lable150 {
  370. width: 156rpx !important;
  371. font-size: 24rpx;
  372. }
  373. .ww80 {
  374. width: 80rpx;
  375. }
  376. .content {
  377. width: 518rpx;
  378. min-height: 64rpx;
  379. font-size: 28rpx;
  380. line-height: 28rpx;
  381. font-style: normal;
  382. font-weight: 400;
  383. // padding: 18rpx 8rpx;
  384. box-sizing: border-box;
  385. word-wrap: break-word;
  386. flex-grow: 1 !important;
  387. .unit {
  388. padding: 0 4rpx;
  389. font-size: 24rpx;
  390. color: #404446;
  391. }
  392. }
  393. &:last-child {
  394. border-bottom: none;
  395. }
  396. }
  397. .ww55 {
  398. width: 55%;
  399. }
  400. .ww45 {
  401. width: 45%;
  402. }
  403. }
  404. }
  405. .content_table2 {
  406. width: 100%;
  407. margin-top: 16rpx;
  408. .row {
  409. width: 100%;
  410. .item {
  411. color: #404446;
  412. font-size: 28rpx;
  413. padding-left: 12rpx;
  414. }
  415. .color157 {
  416. color: $theme-color;
  417. }
  418. .ww30 {
  419. width: 30%;
  420. }
  421. .ww50 {
  422. width: 50%;
  423. }
  424. .ww90 {
  425. width: 90%;
  426. }
  427. .ww15 {
  428. width: 15%;
  429. }
  430. .ww10 {
  431. width: 10%;
  432. }
  433. .ww30 {
  434. width: 30%;
  435. }
  436. }
  437. .head {
  438. height: 64rpx;
  439. background: #F7F9FA;
  440. border-top: 2rpx solid #E3E5E5;
  441. border-left: 2rpx solid #E3E5E5;
  442. .item {
  443. height: 64rpx;
  444. line-height: 64rpx;
  445. border-right: 2rpx solid #E3E5E5;
  446. box-sizing: border-box;
  447. }
  448. }
  449. .tr {
  450. border-top: 2rpx solid #E3E5E5;
  451. border-left: 2rpx solid #E3E5E5;
  452. .item {
  453. font-size: 24rpx;
  454. min-height: 64rpx;
  455. display: flex;
  456. align-items: center;
  457. border-right: 2rpx solid #E3E5E5;
  458. box-sizing: border-box;
  459. white-space: normal;
  460. word-break: break-all;
  461. }
  462. &:last-child {
  463. border-bottom: 2rpx solid #E3E5E5;
  464. }
  465. }
  466. }
  467. .content_num {
  468. display: flex;
  469. align-items: center;
  470. padding: 0 4rpx;
  471. /deep/ .uni-input-input {
  472. border: 2rpx solid #F0F8F2;
  473. background: #F0F8F2;
  474. color: $theme-color;
  475. }
  476. }
  477. .penalize {
  478. width: 86rpx;
  479. line-height: 60rpx;
  480. background: $theme-color;
  481. font-size: 24rpx;
  482. text-align: center;
  483. color: #fff;
  484. }
  485. .check {
  486. width: 30rpx;
  487. height: 30rpx;
  488. }
  489. .z_list {
  490. max-height: 500rpx;
  491. }
  492. </style>