packingBom.vue 11 KB

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