packingBom.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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' src='@/static/check.png'>
  54. </image>
  55. <image class="check" v-if=' !it.check' 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"></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)
  256. this.temporaryList = []
  257. this.temporaryList = this.splitList.filter(e => {
  258. return e.check
  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. getPackingDetailsTwo() {
  270. let param = {
  271. totalQuantity: this.objData.formedNumLast,
  272. quantity: this.quantity,
  273. unit: this.unit,
  274. workOrderId: this.workOrderId,
  275. taskId: this.taskId,
  276. tier: 2,
  277. }
  278. getPackingReportRepeat(param).then(res => {
  279. this.packTwoList = res.detailList
  280. })
  281. },
  282. handlePack() {
  283. let param = {
  284. detailList: this.temporaryList,
  285. quantity: this.temporaryCount,
  286. totalQuantity: this.formedNumLast,
  287. unit: this.packUnit,
  288. taskId: this.taskId,
  289. workOrderId: this.workOrderId,
  290. tier: 2
  291. }
  292. packingReportRepeat(param).then(res => {
  293. this.temporaryList = []
  294. this.getPackingDetails()
  295. this.getPackingDetailsTwo()
  296. })
  297. },
  298. scrolltolower() {
  299. },
  300. getData() {
  301. let _packingReportMarginList = []
  302. _packingReportMarginList = this.splitList.filter(e => {
  303. return !e.parentId
  304. })
  305. let packInfo = {
  306. packingReportList: this.packTwoList,
  307. packingReportMarginList: _packingReportMarginList,
  308. formedNumLast: this.formedNumLast
  309. }
  310. return packInfo
  311. },
  312. },
  313. }
  314. </script>
  315. <style lang="scss" scoped>
  316. .title_box {
  317. margin-top: 20rpx;
  318. .name {
  319. font-size: 28rpx;
  320. font-style: normal;
  321. font-weight: 400;
  322. color: $theme-color;
  323. padding-left: 20rpx;
  324. position: relative;
  325. &:before {
  326. position: absolute;
  327. content: '';
  328. left: 0rpx;
  329. top: 0rpx;
  330. bottom: 0rpx;
  331. width: 4rpx;
  332. height: 28rpx;
  333. background: $theme-color;
  334. margin: auto;
  335. }
  336. }
  337. }
  338. .material {
  339. margin-top: 10rpx;
  340. .content_table {
  341. width: 100%;
  342. border: 2rpx solid $border-color;
  343. .item {
  344. display: flex;
  345. border-bottom: 2rpx solid $border-color;
  346. .lable {
  347. width: 132rpx;
  348. text-align: center;
  349. background-color: #F7F9FA;
  350. font-size: 26rpx;
  351. border-right: 2rpx solid $border-color;
  352. flex-shrink: 0;
  353. }
  354. .lable220 {
  355. width: 220rpx !important;
  356. font-size: 24rpx;
  357. }
  358. .lable150 {
  359. width: 156rpx !important;
  360. font-size: 24rpx;
  361. }
  362. .ww80 {
  363. width: 80rpx;
  364. }
  365. .content {
  366. width: 518rpx;
  367. min-height: 64rpx;
  368. font-size: 28rpx;
  369. line-height: 28rpx;
  370. font-style: normal;
  371. font-weight: 400;
  372. // padding: 18rpx 8rpx;
  373. box-sizing: border-box;
  374. word-wrap: break-word;
  375. flex-grow: 1 !important;
  376. .unit {
  377. padding: 0 4rpx;
  378. font-size: 24rpx;
  379. color: #404446;
  380. }
  381. }
  382. &:last-child {
  383. border-bottom: none;
  384. }
  385. }
  386. .ww55 {
  387. width: 55%;
  388. }
  389. .ww45 {
  390. width: 45%;
  391. }
  392. }
  393. }
  394. .content_table2 {
  395. width: 100%;
  396. margin-top: 16rpx;
  397. .row {
  398. width: 100%;
  399. .item {
  400. color: #404446;
  401. font-size: 28rpx;
  402. padding-left: 12rpx;
  403. }
  404. .color157 {
  405. color: $theme-color;
  406. }
  407. .ww30 {
  408. width: 30%;
  409. }
  410. .ww50 {
  411. width: 50%;
  412. }
  413. .ww90 {
  414. width: 90%;
  415. }
  416. .ww15 {
  417. width: 15%;
  418. }
  419. .ww10 {
  420. width: 10%;
  421. }
  422. .ww30 {
  423. width: 30%;
  424. }
  425. }
  426. .head {
  427. height: 64rpx;
  428. background: #F7F9FA;
  429. border-top: 2rpx solid #E3E5E5;
  430. border-left: 2rpx solid #E3E5E5;
  431. .item {
  432. height: 64rpx;
  433. line-height: 64rpx;
  434. border-right: 2rpx solid #E3E5E5;
  435. box-sizing: border-box;
  436. }
  437. }
  438. .tr {
  439. border-top: 2rpx solid #E3E5E5;
  440. border-left: 2rpx solid #E3E5E5;
  441. .item {
  442. font-size: 24rpx;
  443. min-height: 64rpx;
  444. display: flex;
  445. align-items: center;
  446. border-right: 2rpx solid #E3E5E5;
  447. box-sizing: border-box;
  448. white-space: normal;
  449. word-break: break-all;
  450. }
  451. &:last-child {
  452. border-bottom: 2rpx solid #E3E5E5;
  453. }
  454. }
  455. }
  456. .content_num {
  457. display: flex;
  458. align-items: center;
  459. padding: 0 4rpx;
  460. /deep/ .uni-input-input {
  461. border: 2rpx solid #F0F8F2;
  462. background: #F0F8F2;
  463. color: $theme-color;
  464. }
  465. }
  466. .penalize {
  467. width: 86rpx;
  468. line-height: 60rpx;
  469. background: $theme-color;
  470. font-size: 24rpx;
  471. text-align: center;
  472. color: #fff;
  473. }
  474. .check {
  475. width: 30rpx;
  476. height: 30rpx;
  477. }
  478. .z_list {
  479. max-height: 500rpx;
  480. }
  481. </style>