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

生产发料修改

parent bf258b9d
......@@ -6,9 +6,9 @@
<view class="item">物料描述:{{ item.itemName }}</view>
</view>
<view class="right">
<text class="blue">{{totalVistaNum}}</text>
<text class="blue">{{ totalVistaNum }}</text>
<text class="line">/</text>
<text class="">{{totalNum}}</text>
<text class="">{{ totalNum }}</text>
</view>
</view>
<view class="listBottom">
......@@ -26,7 +26,11 @@
</view>
</view>
<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="items">生产单号:{{ ele.workorderCode }}</view>
<view class="progress">
......@@ -34,16 +38,19 @@
<!-- <u-line-progress active-color="#2979ff" :percent="handleVista(ele)"></u-line-progress> -->
</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">
数量:
<!-- <uni-easyinput v-model="item.vista"></uni-easyinput> -->
{{ele.vista}}
{{ handleUseVista(ele) }}
/
{{ ele.applyNum }}
</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>
......@@ -52,96 +59,117 @@
</template>
<script>
import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue';
import StickyNavBar from "@/components/StickyNavBar/index.vue";
import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
import BottomBtn from "@/components/BottomBtn/index.vue";
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn
BottomBtn,
},
props: {
item: {
type: Object,
default: function () {
return {};
}
},
},
list: {
type: Array,
default: function () {
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
this.list.forEach(ele => {
if(ele.itemCode === this.item.itemCode){
num += (ele.vista-0)
},
computed: {
details() {
return this.list.reduce((acc, cur) => {
const item = acc.find((v) => v.workorderCode === cur.workorderCode);
if (item) {
item.details.push({ ...cur });
} else {
acc.push({ ...cur, details: [{ ...cur }] });
}
});
return num || ''
return acc;
}, []);
},
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: {
// goodsList: {
// handler: function(val, oldVal) {
// this.goodsList = val
// },
// immediate: true
totalVistaNum() {
// let num = 0
// this.list.forEach(ele => {
// if(ele.itemCode === this.item.itemCode){
// num += (ele.vista-0)
// }
// },
// });
// 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() {
return {
number: 0,
nlpla: '',
wxparams: '',
nlpla: "",
wxparams: "",
btnArr: [
{
style: '',
type: 'warning',
text: '返回',
way: 'goBack'
style: "",
type: "warning",
text: "返回",
way: "goBack",
},
{
style: '',
type: 'primary',
text: '提交',
way: 'goSubmit'
}
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
isFocus: false,
show: true,
num1: 0
num1: 0,
};
},
created() {
},
created() {},
methods: {
handleVista(items){
let num = 0
this.list.forEach(ele => {
if(ele.workorderCode === items.workorderCode){
console.log(`output->`,ele.vista,items.workorderCode)
num += ((ele.vista?ele.vista: 0)-0)
handleUseVista(items) {
return items.details.reduce((acc, cur) => cur.vista + acc, 0)
},
handleVista(items) {
let num = 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)
return ((num/items.applyNum).toFixed(2)*100-0)>100? 100 : (num/items.applyNum).toFixed(2)*100|| 0
}
}
console.log(`output->num`, num);
return (num / items.applyNum).toFixed(2) * 100 - 0 > 100
? 100
: (num / items.applyNum).toFixed(2) * 100 || 0;
},
},
};
</script>
......@@ -237,11 +265,11 @@ page {
font-size: 24rpx;
line-height: 40rpx;
word-break: break-all;
/deep/ .uni-easyinput{
/deep/ .uni-easyinput {
width: 200rpx;
}
}
.inputItem{
.inputItem {
display: inline-flex;
// line-height: 76rpx;
}
......@@ -252,17 +280,17 @@ page {
top: 0 !important;
background: #fff;
}
.progress{
.progress {
width: 45%;
margin-left: 20rpx;
/deep/ .uni-progress-info{
/deep/ .uni-progress-info {
font-size: 24rpx;
}
}
/deep/ .uni-progress{
/deep/ .uni-progress {
line-height: 40rpx;
}
.proItem{
.proItem {
display: flex;
}
</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