Commit 3c0a4a87 authored by 何远江's avatar 何远江

生产发料修改

parent bf258b9d
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
<view class="item">物料描述:{{ item.itemName }}</view> <view class="item">物料描述:{{ item.itemName }}</view>
</view> </view>
<view class="right"> <view class="right">
<text class="blue">{{totalVistaNum}}</text> <text class="blue">{{ totalVistaNum }}</text>
<text class="line">/</text> <text class="line">/</text>
<text class="">{{totalNum}}</text> <text class="">{{ totalNum }}</text>
</view> </view>
</view> </view>
<view class="listBottom"> <view class="listBottom">
...@@ -26,7 +26,11 @@ ...@@ -26,7 +26,11 @@
</view> </view>
</view> </view>
<view v-if="!show" class="bottomBox"> <view v-if="!show" class="bottomBox">
<view class="bottomItem" v-for="(ele, idx) in list" :key="ele.workorderCode+idx" v-if="ele.itemCode === item.itemCode"> <view
class="bottomItem"
v-for="(ele, idx) in details"
:key="ele.workorderCode"
>
<view class="proItem"> <view class="proItem">
<view class="items">生产单号:{{ ele.workorderCode }}</view> <view class="items">生产单号:{{ ele.workorderCode }}</view>
<view class="progress"> <view class="progress">
...@@ -34,16 +38,19 @@ ...@@ -34,16 +38,19 @@
<!-- <u-line-progress active-color="#2979ff" :percent="handleVista(ele)"></u-line-progress> --> <!-- <u-line-progress active-color="#2979ff" :percent="handleVista(ele)"></u-line-progress> -->
</view> </view>
</view> </view>
<view class="items">PL:{{ ele.PLNR }}</view>
<view class="items">库位:{{ ele.NLPLA }}</view>
<!-- <view class="items">{{ item.MATNR }}</view> -->
<view class="items inputItem"> <view class="items inputItem">
数量: 数量:
<!-- <uni-easyinput v-model="item.vista"></uni-easyinput> --> <!-- <uni-easyinput v-model="item.vista"></uni-easyinput> -->
{{ele.vista}} {{ handleUseVista(ele) }}
/ /
{{ ele.applyNum }} {{ ele.applyNum }}
</view> </view>
<template v-for="item in ele.details">
<view class="items">PL:{{ item.PLNR }}</view>
<view class="items">库位:{{ item.LGORT }} - {{ item.LGOBE }}</view>
<view class="items">仓位:{{ item.NLPLA }}</view>
<!-- <view class="items">{{ item.MATNR }}</view> -->
</template>
</view> </view>
</view> </view>
</view> </view>
...@@ -52,96 +59,117 @@ ...@@ -52,96 +59,117 @@
</template> </template>
<script> <script>
import StickyNavBar from '@/components/StickyNavBar/index.vue'; import StickyNavBar from "@/components/StickyNavBar/index.vue";
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue'; import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
import BottomBtn from '@/components/BottomBtn/index.vue'; import BottomBtn from "@/components/BottomBtn/index.vue";
export default { export default {
components: { components: {
StickyNavBar, StickyNavBar,
ContentLoadingMore, ContentLoadingMore,
BottomBtn BottomBtn,
}, },
props: { props: {
item: { item: {
type: Object, type: Object,
default: function () { default: function () {
return {}; return {};
} },
}, },
list: { list: {
type: Array, type: Array,
default: function () { default: function () {
return []; return [];
}
}
}, },
computed:{
totalNum(){
let num = 0
this.list.forEach(ele => {
if(ele.itemCode === this.item.itemCode && !ele.add){
num += ele.applyNum
}
});
return num
}, },
totalVistaNum(){ },
let num = 0 computed: {
this.list.forEach(ele => { details() {
if(ele.itemCode === this.item.itemCode){ return this.list.reduce((acc, cur) => {
num += (ele.vista-0) const item = acc.find((v) => v.workorderCode === cur.workorderCode);
if (item) {
item.details.push({ ...cur });
} else {
acc.push({ ...cur, details: [{ ...cur }] });
} }
}); return acc;
return num || '' }, []);
}, },
totalNum() {
const workCodes = [];
return this.list.reduce((acc, cur) => {
if (workCodes.includes(cur.workorderCode)) {
return acc;
} else {
workCodes.push(cur.workorderCode);
return acc + cur.applyNum;
}
}, 0);
}, },
// watch: { totalVistaNum() {
// goodsList: { // let num = 0
// handler: function(val, oldVal) { // this.list.forEach(ele => {
// this.goodsList = val // if(ele.itemCode === this.item.itemCode){
// }, // num += (ele.vista-0)
// immediate: true
// } // }
// }, // });
// return num || ''
return this.list.reduce((acc, cur) => {
return acc + cur.vista;
}, 0);
},
},
watch: {
details: {
handler: function (val, oldVal) {
console.log(val, "00-------");
},
immediate: true,
deep: true,
},
},
data() { data() {
return { return {
number: 0, number: 0,
nlpla: '', nlpla: "",
wxparams: '', wxparams: "",
btnArr: [ btnArr: [
{ {
style: '', style: "",
type: 'warning', type: "warning",
text: '返回', text: "返回",
way: 'goBack' way: "goBack",
}, },
{ {
style: '', style: "",
type: 'primary', type: "primary",
text: '提交', text: "提交",
way: 'goSubmit' way: "goSubmit",
} },
], ],
isFocus: false, isFocus: false,
show: true, show: true,
num1: 0 num1: 0,
}; };
}, },
created() { created() {},
},
methods: { methods: {
handleVista(items){ handleUseVista(items) {
let num = 0 return items.details.reduce((acc, cur) => cur.vista + acc, 0)
this.list.forEach(ele => { },
if(ele.workorderCode === items.workorderCode){ handleVista(items) {
console.log(`output->`,ele.vista,items.workorderCode) let num = 0;
num += ((ele.vista?ele.vista: 0)-0) this.list.forEach((ele) => {
if (ele.workorderCode === items.workorderCode) {
console.log(`output->`, ele.vista, items.workorderCode);
num += (ele.vista ? ele.vista : 0) - 0;
} }
}); });
console.log(`output->num`,num) console.log(`output->num`, num);
return ((num/items.applyNum).toFixed(2)*100-0)>100? 100 : (num/items.applyNum).toFixed(2)*100|| 0 return (num / items.applyNum).toFixed(2) * 100 - 0 > 100
} ? 100
} : (num / items.applyNum).toFixed(2) * 100 || 0;
},
},
}; };
</script> </script>
...@@ -237,11 +265,11 @@ page { ...@@ -237,11 +265,11 @@ page {
font-size: 24rpx; font-size: 24rpx;
line-height: 40rpx; line-height: 40rpx;
word-break: break-all; word-break: break-all;
/deep/ .uni-easyinput{ /deep/ .uni-easyinput {
width: 200rpx; width: 200rpx;
} }
} }
.inputItem{ .inputItem {
display: inline-flex; display: inline-flex;
// line-height: 76rpx; // line-height: 76rpx;
} }
...@@ -252,17 +280,17 @@ page { ...@@ -252,17 +280,17 @@ page {
top: 0 !important; top: 0 !important;
background: #fff; background: #fff;
} }
.progress{ .progress {
width: 45%; width: 45%;
margin-left: 20rpx; margin-left: 20rpx;
/deep/ .uni-progress-info{ /deep/ .uni-progress-info {
font-size: 24rpx; font-size: 24rpx;
} }
} }
/deep/ .uni-progress{ /deep/ .uni-progress {
line-height: 40rpx; line-height: 40rpx;
} }
.proItem{ .proItem {
display: flex; display: flex;
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment