packingBom.vue 12 KB

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