| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847 |
- <template>
- <view>
- <view class="title_box rx-bc">
- <view class="name">内包装</view>
- <view class="btn_box rx-bc" @click="handCancelPacking">
- 重置打包
- </view>
- </view>
- <view class="material ">
- <view class="content_table">
- <view class="item">
- <view class="lable rx-cc">包装总数 </view>
- <view class="content content_num">
- <input class="uni-input" v-model="formedNumLast" type='digit'></input>
- <view class="unit">{{objData.unit}}</view>
- </view>
- </view>
- <view class="item rx-sc">
- <view class="rx ww55 ">
- <view class="lable lable150 rx-cc ">内包装单元</view>
- <view class="content content_num">
- <input class="uni-input" v-model="quantity"></input>
- </view>
- </view>
- <view class="rx ww45">
- <view class="rx-cc ww80">
- <view style="max-width: 100rpx; font-size: 24rpx;">{{objData.unit}}</view>/
- </view>
- <view class="content rx-sc">
- <zxz-uni-data-select :localdata="unitList" v-model="unit" dataValue='Key' format='{Value}'
- dataKey="Key" filterable :clear='false'></zxz-uni-data-select>
- <view class="penalize" @click="handleSplit">确认</view>
- </view>
- </view>
- </view>
- </view>
- <view class="content_table2" v-if='splitList.length'>
- <view class="head row rx-sc">
- <view class="item ww10">序号</view>
- <view class="item ww30">数量</view>
- <view class="item ww50">条码</view>
- <view class="item ww10 jsColor" @click="calculation()" v-if="clientEnvironmentId != 3">计算</view>
- <view class="item ww10" v-if="clientEnvironmentId == 3"></view>
- </view>
- <view class="table">
- <u-list @scrolltolower="scrolltolower" class="z_list" style="height: 100% !important;">
- <view class="tr row rx-sc" v-for="(it, idx) in splitList" :key='idx'>
- <view class="item ww10 rx-cc ">{{ it.computeSize }}</view>
- <view class="item ww30 content_num rx-sc">
- <input class="uni-input" v-model="it.quantity" type="digit"></input>
- <view style="width: 260rpx; font-size: 22rpx;"> {{objData.unit}}/ {{it.unit}}</view>
- </view>
- <view class="item ww50">
- {{ it.code }}
- </view>
- <view class="item ww10 rx-cc" v-if="!it.parentId" @click="handleCheck( idx, it)">
- <image class="check" v-if='it.check == 1' src='@/static/check.png'>
- </image>
- <image class="check" v-if='it.check == 0 || it.check == null '
- src='@/static/check_no.png'>
- </image>
- </view>
- </view>
- </u-list>
- </view>
- </view>
- </view>
- <view class="material ">
- <view class="title_box rx-bc">
- <view class="name">外包装</view>
- </view>
- <view class="content_table2" v-if='temporaryList.length'>
- <view class="head row rx-sc">
- <view class="item ww10">序号</view>
- <view class="item ww30">数量</view>
- <view class="item ww50">条码</view>
- <view class="item ww10"></view>
- </view>
- <view class="table">
- <view class="tr row rx-sc" v-for="(it, idx) in temporaryList" :key='idx'>
- <view class="item ww10 rx-cc ">{{ idx + 1 }}</view>
- <view class="item ww30 content_num rx-sc">
- <input class="uni-input" v-model="it.quantity" disabled type="digit"></input>
- <view style="width: 260rpx; font-size: 22rpx;"> {{objData.unit}}/ {{it.unit}}</view>
- </view>
- <view class="item ww50">
- {{ it.code }}
- </view>
- <view class="item ww10 rx-cc">
- <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"
- @click="handclose(it)"></uni-icons>
- </view>
- </view>
- <view class="tr row rx-sc">
- <view class="item ww10 rx-cc ">合并</view>
- <view class="item ww90 rx-sc">
- 总共{{temporaryCount}} {{objData.unit}} / {{this.temporaryNum}} {{unit}}
- --打包成 1
- <zxz-uni-data-select :localdata="unitList" v-model="packUnit" dataValue='Key'
- format='{Value}' dataKey="Key" :clear='false'></zxz-uni-data-select>
- <view class="penalize" @click="handlePack">打包</view>
- </view>
- </view>
- </view>
- </view>
- <!-- 外包装 列表-->
- <view class="content_table2" v-if='packTwoList.length > 0'>
- <view class="head row rx-sc">
- <view class="item ww10">序号</view>
- <view class="item ww30">数量</view>
- <view class="item ww50">条码</view>
- <view class="item ww10"></view>
- </view>
- <view class="table">
- <view class="tr row rx-sc " v-for="(it, idx) in packTwoList" :key='idx'>
- <view class="item ww10 rx-cc ">{{ idx + 1 }}</view>
- <view class="item ww30 content_num rx-sc">
- {{ it.quantity}} {{ objData.unit }} / {{it.unit}}
- </view>
- <view class="item ww50">
- {{ it.code }}
- </view>
- <view class="item ww10 rx-cc">
- </view>
- </view>
- </view>
- </view>
- </view>
- <SearchPopup mode="center" v-if='show'>
- <template v-slot:list>
- <view class="search_list">
- <u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
- <u-form-item label="外包装数:" class="required-form" borderBottom prop="assetType">
- <input class="uni-input" v-model="formData.wPackNum" style="width: 280rpx;"
- placeholder="外包装数"></input> / {{splitList[0].unit}}
- </u-form-item>
- </u-form>
- </view>
- </template>
- <template v-slot:operate>
- <view class="operate_box rx-bc">
- <u-button size="small" class="u-reset-button" @click="calculationClose()">
- 取消
- </u-button>
- <u-button type="success" size="small" class="u-reset-button" @click="calculationReset()">
- 重置
- </u-button>
- <u-button type="success" size="small" class="u-reset-button" @click="calculationSave()">
- 确定
- </u-button>
- </view>
- </template>
- </SearchPopup>
- </view>
- </template>
- <script>
- import {
- getByCode
- } from '@/api/pda/common.js'
- import {
- cancelPacking,
- packingReport,
- getPackingReport,
- packingReportRepeat,
- getPackingReportRepeat
- } from '@/api/pda/workOrder.js'
- import SearchPopup from '../../components/searchPopup.vue'
- export default {
- components: {
- SearchPopup
- },
- props: {
- objData: {
- type: Object,
- default: () => {}
- },
- taskId: {
- type: String,
- default: ''
- },
- workOrderId: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- formedNumLast: 0,
- quantity: '',
- unit: '',
- unitList: [],
- splitList: [],
- packUnit: null,
- temporaryNum: 0,
- temporaryCount: 0,
- temporaryList: [],
- packTwoList: [],
- show: false,
- formData: {
- wPackNum: null,
- },
- clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo").clientEnvironmentId,
- }
- },
- created() {
- this.formedNumLast = this.objData.formedNumLast
- this.byCode(),
- this.getPackingDetails()
- this.getPackingDetailsTwo()
- },
- methods: {
- byCode() {
- getByCode('packing_unit').then(res => {
- this.unitList = []
- res.forEach((obj, index) => {
- for (let key in obj) {
- if (obj.hasOwnProperty(key)) { // 确保key是对象自身的属性
- this.unitList.push({
- Key: `${key}`,
- Value: ` ${obj[key]}`
- })
- }
- }
- });
- })
- },
- getPackingDetails() {
- let param = {
- workOrderId: this.workOrderId,
- taskId: this.taskId,
- tier: 1
- }
- getPackingReport(param).then(res => {
- this.splitList = res.detailList
- this.formedNumLast = res.totalQuantity
- this.quantity = res.quantity
- this.unit = res.unit
- })
- },
- handCancelPacking() {
- uni.showModal({
- title: `是否清空包装?`,
- content: "",
- confirmText: "确认",
- success: () => {
- let param = {
- workOrderId: this.workOrderId,
- taskId: this.taskId,
- }
- cancelPacking(param).then(res => {
- this.getPackingDetails()
- this.getPackingDetailsTwo()
- })
- },
- })
- },
- handleSplit() {
- if (this.splitList.length) {
- uni.showToast({
- title: '产品已分包',
- icon: 'none'
- })
- return false
- }
- if (!this.formedNumLast) {
- uni.showToast({
- title: '包装总数数量不能为空',
- icon: 'none'
- })
- return false
- }
- if (!this.quantity) {
- uni.showToast({
- title: '内包装单元数量不能为空',
- icon: 'none'
- })
- return false
- }
- if (!this.unit) {
- uni.showToast({
- title: '请选择包装单位',
- icon: 'none'
- })
- return false
- }
- let param = {
- totalQuantity: this.formedNumLast,
- quantity: this.quantity,
- unit: this.unit,
- workOrderId: this.workOrderId,
- taskId: this.taskId,
- tier: 1
- }
- packingReport(param).then(res => {
- this.splitList = res.map(m => {
- return {
- check: false,
- ...m
- }
- })
- this.getPackingDetails()
- })
- },
- handleCheck(idx, it) {
- if (it.quantity <= 0) {
- uni.showToast({
- icon: 'none',
- title: '数量为空不能勾选'
- })
- return false
- }
- this.$set(this.splitList[idx], 'check', it.check ? 0 : 1)
- this.temporaryList = []
- this.temporaryList = this.splitList.filter(e => {
- return e.check == 1
- })
- this.temporaryNum = 0
- this.temporaryCount = 0
- if (this.temporaryList.length > 0) {
- this.temporaryList.forEach(e => {
- this.temporaryNum = this.temporaryNum + 1
- this.temporaryCount = this.temporaryCount + Number(e.quantity)
- })
- }
- },
- handclose(it) {
- this.splitList.forEach(f => {
- if (f.computeSize == it.computeSize) {
- f.check = 0
- }
- })
- this.temporaryList = []
- this.temporaryList = this.splitList.filter(e => {
- return e.check == 1
- })
- },
- getPackingDetailsTwo() {
- let param = {
- totalQuantity: this.formedNumLast,
- quantity: this.quantity,
- unit: this.unit,
- workOrderId: this.workOrderId,
- taskId: this.taskId,
- tier: 2,
- }
- getPackingReportRepeat(param).then(res => {
- this.packTwoList = res.detailList
- })
- },
- handlePack() {
- let _arr = []
- _arr = this.temporaryList.map(m => {
- return {
- ...m,
- isChecked: 1
- }
- })
- let param = {
- detailList: _arr,
- quantity: this.temporaryCount,
- totalQuantity: this.formedNumLast,
- unit: this.packUnit,
- taskId: this.taskId,
- workOrderId: this.workOrderId,
- tier: 2
- }
- packingReportRepeat(param).then(res => {
- this.temporaryList = []
- this.getPackingDetails()
- this.getPackingDetailsTwo()
- })
- },
- scrolltolower() {
- },
- getData() {
- let _packingReportMarginList = []
- _packingReportMarginList = this.splitList.filter(e => {
- return !e.parentId
- })
- let packInfo = {
- packingReportList: this.packTwoList,
- packingReportMarginList: _packingReportMarginList,
- formedNumLast: this.formedNumLast
- }
- return packInfo
- },
- calculation() {
- this.show = true
- },
- calculationSave() {
- let count = this.splitList.filter(item => item.isChecked != 1).length;
- if (this.formData.wPackNum <= count && count != 0) {
- for (let i = 0; i < this.formData.wPackNum; i++) {
- this.splitList[i].check = 1
- }
- this.handleCheck(0, 0)
- this.calculationClose()
- } else {
- if (count != 0) {
- for (let i = 0; i < count; i++) {
- this.splitList[i].check = 1
- }
- this.handleCheck(0, 0)
- this.calculationClose()
- }
- uni.showToast({
- icon: 'none',
- title: '外包装数超出内包装条数'
- })
- }
- },
- calculationClose() {
- this.show = false
- },
- calculationReset() {
- this.formData.wPackNum = null
- this.splitList.forEach(f => {
- f.check = null
- })
- this.temporaryList = []
- this.show = false
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .title_box {
- margin-top: 20rpx;
- .name {
- font-size: 28rpx;
- font-style: normal;
- font-weight: 400;
- color: $theme-color;
- padding-left: 20rpx;
- position: relative;
- &:before {
- position: absolute;
- content: '';
- left: 0rpx;
- top: 0rpx;
- bottom: 0rpx;
- width: 4rpx;
- height: 28rpx;
- background: $theme-color;
- margin: auto;
- }
- }
- .btn_box {
- color: $theme-color;
- }
- }
- .material {
- margin-top: 10rpx;
- .content_table {
- width: 100%;
- border: 2rpx solid $border-color;
- .item {
- display: flex;
- border-bottom: 2rpx solid $border-color;
- .lable {
- width: 132rpx;
- text-align: center;
- background-color: #F7F9FA;
- font-size: 26rpx;
- border-right: 2rpx solid $border-color;
- flex-shrink: 0;
- }
- .lable220 {
- width: 220rpx !important;
- font-size: 24rpx;
- }
- .lable150 {
- width: 156rpx !important;
- font-size: 24rpx;
- }
- .ww80 {
- width: 80rpx;
- }
- .content {
- width: 518rpx;
- min-height: 64rpx;
- font-size: 28rpx;
- line-height: 28rpx;
- font-style: normal;
- font-weight: 400;
- // padding: 18rpx 8rpx;
- box-sizing: border-box;
- word-wrap: break-word;
- flex-grow: 1 !important;
- .unit {
- padding: 0 4rpx;
- font-size: 24rpx;
- color: #404446;
- }
- }
- &:last-child {
- border-bottom: none;
- }
- }
- .ww55 {
- width: 55%;
- }
- .ww45 {
- width: 45%;
- }
- }
- }
- .content_table2 {
- width: 100%;
- margin-top: 16rpx;
- .row {
- width: 100%;
- .item {
- color: #404446;
- font-size: 28rpx;
- padding-left: 12rpx;
- }
- .color157 {
- color: $theme-color;
- }
- .ww30 {
- width: 30%;
- }
- .ww50 {
- width: 50%;
- }
- .ww90 {
- width: 90%;
- }
- .ww15 {
- width: 15%;
- }
- .ww10 {
- width: 10%;
- }
- .ww30 {
- width: 30%;
- }
- .jsColor {
- color: $theme-color;
- font-size: 20rpx;
- }
- }
- .head {
- height: 64rpx;
- background: #F7F9FA;
- border-top: 2rpx solid #E3E5E5;
- border-left: 2rpx solid #E3E5E5;
- .item {
- height: 64rpx;
- line-height: 64rpx;
- border-right: 2rpx solid #E3E5E5;
- box-sizing: border-box;
- }
- }
- .tr {
- border-top: 2rpx solid #E3E5E5;
- border-left: 2rpx solid #E3E5E5;
- .item {
- font-size: 24rpx;
- min-height: 64rpx;
- display: flex;
- align-items: center;
- border-right: 2rpx solid #E3E5E5;
- box-sizing: border-box;
- white-space: normal;
- word-break: break-all;
- }
- &:last-child {
- border-bottom: 2rpx solid #E3E5E5;
- }
- }
- }
- .content_num {
- display: flex;
- align-items: center;
- padding: 0 4rpx;
- /deep/ .uni-input-input {
- border: 2rpx solid #F0F8F2;
- background: #F0F8F2;
- color: $theme-color;
- }
- }
- .penalize {
- width: 86rpx;
- line-height: 60rpx;
- background: $theme-color;
- font-size: 24rpx;
- text-align: center;
- color: #fff;
- }
- .check {
- width: 30rpx;
- height: 30rpx;
- }
- .z_list {
- max-height: 500rpx;
- }
- .search_list {
- min-height: 100rpx;
- width: 80vw;
- /deep/ .baseForm {
- padding: 0 20rpx;
- }
- }
- .operate_box {
- padding: 10rpx 32rpx;
- /deep/ .u-button {
- width: 30%;
- }
- }
- </style>
|