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

生产发料修改

parent bf258b9d
...@@ -4,9 +4,17 @@ ...@@ -4,9 +4,17 @@
<NavBar title="生产发料"></NavBar> <NavBar title="生产发料"></NavBar>
<view class="headerTitle"> <view class="headerTitle">
<view class=""> <view class="">
<view class="items">领料申请:{{goodsList[0]&&goodsList[0].applyNo}}</view> <view class="items"
<view class="items">{{goodsList[0]&&goodsList[0].workstationCode}}/{{goodsList[0]&&goodsList[0].workstationName}}</view> >领料申请:{{ goodsList[0] && goodsList[0].applyNo }}</view
<view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view> >
<view class="items"
>{{ goodsList[0] && goodsList[0].workstationCode }}/{{
goodsList[0] && goodsList[0].workstationName
}}</view
>
<view class="items"
>计划日期:{{ goodsList[0] && goodsList[0].startTime }}</view
>
</view> </view>
<view class="checkedCase"> <view class="checkedCase">
<checkbox-group @change="checkedChange"> <checkbox-group @change="checkedChange">
...@@ -34,9 +42,9 @@ ...@@ -34,9 +42,9 @@
</view> </view>
</view> </view>
</StickyNavBar> </StickyNavBar>
<ContentLoadingMore class="cardbox" :list='goodsList'> <ContentLoadingMore class="cardbox" :list="goodsList">
<view class="cardContent" v-for="(item, index) in goodsList" :key="index"> <view class="cardContent" v-for="(item, index) in goodsList" :key="index">
<scanningList :item='item' :list='list'/> <scanningList :item="item" :list="item.details" />
</view> </view>
</ContentLoadingMore> </ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
...@@ -44,78 +52,79 @@ ...@@ -44,78 +52,79 @@
</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";
import scanningList from "./scanningList.vue" import scanningList from "./scanningList.vue";
export default { export default {
components: { components: {
StickyNavBar, StickyNavBar,
ContentLoadingMore, ContentLoadingMore,
BottomBtn, BottomBtn,
scanningList scanningList,
}, },
data() { data() {
return { return {
checkedBox: false, checkedBox: false,
r1:'', r1: "",
// totalNum: 0, // totalNum: 0,
number: 0, number: 0,
show: true, show: true,
nlpla: 'YD-02-02-3', nlpla: "YD-02-02-3",
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",
} },
], ],
goodsList: [], goodsList: [],
isFocus: true, isFocus: true,
isDisabled: false, isDisabled: false,
OrderNum: '', OrderNum: "",
list: [] list: [],
}; };
}, },
computed:{ computed: {
totalNum(){ totalNum() {
let num = 0 let num = 0;
let i=null,j=null let i = null,
const data = JSON.parse(JSON.stringify(this.list)) j = null;
const data = JSON.parse(JSON.stringify(this.list));
const result = data.filter((item, index, self) => { const result = data.filter((item, index, self) => {
return self.findIndex(t => t.itemCode === item.itemCode) === index; return self.findIndex((t) => t.itemCode === item.itemCode) === index;
}); });
for(i = 0; i < this.goodsList.length; i++){ for (i = 0; i < this.goodsList.length; i++) {
if(this.goodsList[i].itemCode === result[i].itemCode && result[i].vista){ if (
num++ this.goodsList[i].itemCode === result[i].itemCode &&
result[i].vista
) {
num++;
} }
} }
return num || 0 return num || 0;
}, },
}, },
onLoad(option) { onLoad(option) {
if(option && option.order){ if (option && option.order) {
this.OrderNum = option.order this.OrderNum = option.order;
this.getOrder(option.order) this.getOrder(option.order);
} }
}, },
watch: { watch: {},
created() {},
},
created() {
},
methods: { methods: {
reset(){ reset() {
setTimeout(() => { setTimeout(() => {
this.wxparams = ''; this.wxparams = "";
this.isFocus = true; this.isFocus = true;
this.isDisabled = false; this.isDisabled = false;
}, 1000); }, 1000);
...@@ -123,94 +132,111 @@ export default { ...@@ -123,94 +132,111 @@ export default {
getOrder(applyNo) { getOrder(applyNo) {
this.$u.api.mesApi this.$u.api.mesApi
.pdaMaterialcreate({ .pdaMaterialcreate({
pageNum:1, pageNum: 1,
pageSize:10, pageSize: 10,
applyNo applyNo,
}) })
.then((res) => { .then((res) => {
if (res && res.code - 200 === 0) { if (res && res.code - 200 === 0) {
// list 第二层显示 也是最后提交的数据(改动最小) // list 第二层显示 也是最后提交的数据(改动最小)
// goodsList 第一层显示 // goodsList 第一层显示
// 第二层显示的数据和第一层必须属于同一个物料 itemCode一样 // 第二层显示的数据和第一层必须属于同一个物料 itemCode一样
this.list = res.rows // this.list = res.rows
const data = res.rows this.goodsList = res.rows.reduce((pre, cur) => {
const result = data.filter((item, index, self) => { if (pre.length === 0) {
return self.findIndex(t => t.sapItemCode === item.sapItemCode) === index; pre.push({
...cur,
details: [{ ...cur, vista: 0 }],
}); });
this.goodsList = [...result] } else {
const item = pre.find((v) => v.sapItemCode == cur.sapItemCode);
if (item) {
item.details.push({ ...cur, vista: 0 });
} else {
pre.push({
...cur,
details: [{ ...cur, vista: 0 }],
});
}
}
return pre;
}, []);
console.log("----goodsList----", this.goodsList);
// const data = res.rows
// const result = data.filter((item, index, self) => {
// return self.findIndex(t => t.sapItemCode === item.sapItemCode) === index;
// });
// this.goodsList = [...result]
} else { } else {
this.$u.toast(res.msg); this.$u.toast(res.msg);
} }
this.loading = false; this.loading = false;
}); });
}, },
checkedChange(){ checkedChange() {
this.checkedBox = !this.checkedBox this.checkedBox = !this.checkedBox;
}, },
getBtnHandle(row) { getBtnHandle(row) {
this[row.way](); this[row.way]();
}, },
goBack() { goBack() {
console.log('进来') console.log("进来");
uni.navigateBack({ uni.navigateBack({
delta: 0 delta: 0,
}); });
}, },
goSubmit() { goSubmit() {
if (this.list.length === 0) { if (this.list.length === 0) {
return; return;
} }
let arr = this.list.filter(ele=>ele.vista) let arr = this.list.filter((ele) => ele.vista);
// "windCase": null,是否结案 Y是 N否 // "windCase": null,是否结案 Y是 N否
arr.forEach((ele,index) => { arr.forEach((ele, index) => {
ele.windCase = this.checkedBox ? 'Y': 'N' ele.windCase = this.checkedBox ? "Y" : "N";
ele.AUFNR = ele.workorderCode ele.AUFNR = ele.workorderCode;
ele.ERFMG = ele.vista ele.ERFMG = ele.vista;
ele.MTSNR = ele.applyNo ele.MTSNR = ele.applyNo;
ele.ZEILE = index+1 ele.ZEILE = index + 1;
ele.RSNUM = ele.requirementNumber ele.RSNUM = ele.requirementNumber;
ele.RSPOS = ele.requirementProjectNumber ele.RSPOS = ele.requirementProjectNumber;
}) });
const params = { const params = {
'zencode': 'A008', zencode: "A008",
'item': arr item: arr,
} };
this.$u.api.sapApi this.$u.api.sapApi.sapProiss(params).then((res) => {
.sapProiss(params)
.then((res) => {
this.loading = false; this.loading = false;
if(!Array.isArray(res)){ if (!Array.isArray(res)) {
return return;
} }
if (res.every((item) => item.TYPE === 'S')) { if (res.every((item) => item.TYPE === "S")) {
// this.$u.toast('提交成功'); // this.$u.toast('提交成功');
this.handleMes(arr,res[0].MESSAGE_V1) this.handleMes(arr, res[0].MESSAGE_V1);
} }
const foundObject = res.find(item => item.TYPE === 'E'); const foundObject = res.find((item) => item.TYPE === "E");
if(foundObject && foundObject.MESSAGE){ if (foundObject && foundObject.MESSAGE) {
this.$u.toast(foundObject.MESSAGE); this.$u.toast(foundObject.MESSAGE);
} }
}); });
}, },
handleMes(arr,num){ handleMes(arr, num) {
arr.forEach(ele => { arr.forEach((ele) => {
ele.batchCode = ele.CHARG ele.batchCode = ele.CHARG;
ele.quantityIssued = ele.vista ele.quantityIssued = ele.vista;
ele.issueCode = num ele.issueCode = num;
ele.issueType = ele.materialType ele.issueType = ele.materialType;
}); });
this.$u.api.mesApi this.$u.api.mesApi.pdaSapissuecreate(arr).then((res) => {
.pdaSapissuecreate(arr)
.then((res) => {
this.loading = false; this.loading = false;
console.log(res); console.log(res);
if(res && res.code == 200){ if (res && res.code == 200) {
this.$u.toast('提交成功'); this.$u.toast("提交成功");
setTimeout(() => { setTimeout(() => {
this.goBack() this.goBack();
}, 1000); }, 1000);
}else{ } else {
this.$u.toast(res.msg); this.$u.toast(res.msg);
} }
}); });
...@@ -220,44 +246,121 @@ export default { ...@@ -220,44 +246,121 @@ export default {
}, },
getPlnr(plnr) { getPlnr(plnr) {
this.isDisabled = true; this.isDisabled = true;
this.isFocus = false this.isFocus = false;
this.$u.api.sapApi this.$u.api.sapApi
.sapBlpl({ .sapBlpl({
plnr, plnr,
ztype: '002' ztype: "002",
}) })
.then((res) => { .then((res) => {
if (res && res.MSG[0].TYPE === 'S') { if (res && res.MSG[0].TYPE === "S") {
if (this.list.some((item) => item.PLNR === plnr)) { if (
this.reset() this.goodsList.some((item) =>
this.$u.toast('已经存在当前条码'); item.details.some((v) => v.PLNR == plnr)
return )
} ) {
this.factorial({...res.BLPL[0]},plnr,0) this.reset();
this.reset() this.$u.toast("已经存在当前条码");
return;
}
// this.factorial({...res.BLPL[0]},plnr,0)
this.handleDetails(res.BLPL, plnr);
this.reset();
} else { } else {
this.reset() this.reset();
this.$u.toast(res.MSG[0].MESSAGE); this.$u.toast(res.MSG[0].MESSAGE);
} }
this.loading = false; this.loading = false;
}); });
}, },
handleAddList(idx,vista,res){ handleDetails(data, plnr) {
data.forEach((ele) => {
let num = ele.PACMG;
// 相同的物料
const item = this.goodsList.find((v) => v.sapItemCode == ele.MATNR);
if (item) {
// 用于缓存新添加的 details
const map = new Map();
item.details.some((v, i) => {
// 如果没有数量了,终止分配
if (num <= 0) return true;
// 没有分配数量时
if (v.vista == 0) {
// 如果是最最后一项 直接分配所有的数量
if (i == item.details.length - 1) {
v.vista = num;
} else {
v.vista = num > v.applyNum ? v.applyNum : num;
}
num = +(num - v.vista).toFixed(3);
v.PLNR = plnr;
v.LGORT = ele.LGORT;
v.LGOBE = ele.LGOBE;
v.NLPLA = ele.NLPLA;
// 添加两个字段,使用数量和剩余数量
v.usedNum = v.vista;
v.remainNum = +(v.applyNum - v.usedNum).toFixed(3);
} else if (v.remainNum > 0) {
// 已经分配,但是未分配满的情况 需要创建一条新的申请
let vista = 0;
// 如果是最后一项,直接分配所有的数量
if (i == item.details.length - 1) {
vista = num;
} else {
// 如果下项的工单号于目前工单号一样跳过
if (v.workorderCode == item.details[i + 1].workorderCode) {
return false;
}
vista = num > v.remainNum ? v.remainNum : +num;
}
const reAddItem = {
...v,
PLNR: plnr,
LGORT: ele.LGORT,
LGOBE: ele.LGOBE,
NLPLA: ele.NLPLA,
usedNum: +(v.usedNum + vista).toFixed(3),
remainNum: +(v.remainNum - vista).toFixed(3),
vista,
};
map.set(i + 1, reAddItem);
num = +(num - vista).toFixed(3);
}
});
// 新增的申请插入到明细中
for (const [key, value] of map.entries()) {
item.details.splice(key, 0, value);
}
} else {
this.$u.toast("没有物料");
}
});
console.log("----goodsList--------", this.goodsList);
},
handleAddList(idx, vista, res) {
const newCard = { const newCard = {
...this.list[idx], ...this.list[idx],
vista, vista,
// vista : ((this.list[idx].applyNum - 0)-(this.list[idx].vista-0)).toFixed(3), // vista : ((this.list[idx].applyNum - 0)-(this.list[idx].vista-0)).toFixed(3),
add: '1', add: "1",
... res ...res,
} };
this.list.splice(idx+1, 0, newCard); this.list.splice(idx + 1, 0, newCard);
}, },
factorial(res,plnr,idx,num=0) { factorial(res, plnr, idx, num = 0) {
// 找出符合条件的数组长度 // 找出符合条件的数组长度
const count = this.list.filter(item => item.sapItemCode == res.MATNR).length const count = this.list.filter(
if(!count){ (item) => item.sapItemCode == res.MATNR
this.$u.toast('没有匹配到对应物料'); ).length;
return if (!count) {
this.$u.toast("没有匹配到对应物料");
return;
} }
// PACMG包装数量 applyNum申请数量 vista这一个工单分配了多少数量 // PACMG包装数量 applyNum申请数量 vista这一个工单分配了多少数量
// 总的来说逻辑是 // 总的来说逻辑是
...@@ -268,91 +371,141 @@ export default { ...@@ -268,91 +371,141 @@ export default {
// 2) // 2)
// 如果满足第一个工单applyNum申请数量 就要往下满足 直到分配完。 // 如果满足第一个工单applyNum申请数量 就要往下满足 直到分配完。
for (let m = 0; m < this.list.length; m++) { for (let m = 0; m < this.list.length; m++) {
if(this.list[m].sapItemCode == res.MATNR){ if (this.list[m].sapItemCode == res.MATNR) {
// 递归的方法 满足下一个 // 递归的方法 满足下一个
if(idx){ if (idx) {
if(this.list[idx]){ if (this.list[idx]) {
if(num > this.list[idx].applyNum){ if (num > this.list[idx].applyNum) {
this.$set(this.list,idx,{...this.list[idx],vista : this.list[idx].applyNum,... res}) this.$set(this.list, idx, {
this.factorial(res,plnr,idx+1,num-this.list[idx].applyNum) ...this.list[idx],
}else{ vista: this.list[idx].applyNum,
this.$set(this.list,idx,{...this.list[idx],vista : num,... res}) ...res,
this.factorial(res,plnr,idx+1,0) });
this.factorial(
res,
plnr,
idx + 1,
num - this.list[idx].applyNum
);
} else {
this.$set(this.list, idx, {
...this.list[idx],
vista: num,
...res,
});
this.factorial(res, plnr, idx + 1, 0);
} }
} }
return return;
} }
// 没有填入数据的 // 没有填入数据的
if(!this.list[m].vista){ if (!this.list[m].vista) {
// 上一位的数据是否满足 // 上一位的数据是否满足
if(this.list[m-1] && this.list[m-1].vista < this.list[m-1].applyNum){ if (
this.handleAddList(m,((this.list[m-1].applyNum-0) - (this.list[m-1].vista-0)),res) this.list[m - 1] &&
if( res.PACMG > (this.list[m-1].applyNum - this.list[m-1].vista)){ this.list[m - 1].vista < this.list[m - 1].applyNum
this.factorial(res,plnr, m+1, res.PACMG - (this.list[m-1].applyNum - this.list[m-1].vista)) ) {
this.handleAddList(
m,
this.list[m - 1].applyNum - 0 - (this.list[m - 1].vista - 0),
res
);
if (
res.PACMG >
this.list[m - 1].applyNum - this.list[m - 1].vista
) {
this.factorial(
res,
plnr,
m + 1,
res.PACMG -
(this.list[m - 1].applyNum - this.list[m - 1].vista)
);
} }
return return;
} }
// 只有一个 // 只有一个
// if(count === 1){ // if(count === 1){
// this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res}) // this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res})
// }else{ // }else{
// 包装数量大于申请数量 // 包装数量大于申请数量
if( res.PACMG > this.list[m].applyNum){ if (res.PACMG > this.list[m].applyNum) {
// 最后一个工单处理 // 最后一个工单处理
if(count === m){ if (count === m) {
this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res}) this.$set(this.list, m, {
return ...this.list[m],
vista: res.PACMG,
...res,
});
return;
} }
this.list[m].vista = this.list[m].applyNum this.list[m].vista = this.list[m].applyNum;
this.$set(this.list,m,{...this.list[m],vista : this.list[m].applyNum,... res}) this.$set(this.list, m, {
this.factorial(res,plnr,m+1,res.PACMG-this.list[m].applyNum) ...this.list[m],
vista: this.list[m].applyNum,
...res,
});
this.factorial(
res,
plnr,
m + 1,
res.PACMG - this.list[m].applyNum
);
return; return;
}else{ } else {
// 包装数量小于等于申请数量 // 包装数量小于等于申请数量
this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res}) this.$set(this.list, m, {
return ...this.list[m],
vista: res.PACMG,
...res,
});
return;
} }
// } // }
}else{ } else {
// 当前填入的数量小于申请数量 就把当前所有工单找出来 一个个的去检查是否满足 // 当前填入的数量小于申请数量 就把当前所有工单找出来 一个个的去检查是否满足
if(this.list[m].vista < this.list[m].applyNum){ if (this.list[m].vista < this.list[m].applyNum) {
let arr = [] let arr = [];
this.list.forEach(ele => { this.list.forEach((ele) => {
if(ele.workorderCode === this.list[m].workorderCode){ if (ele.workorderCode === this.list[m].workorderCode) {
arr.push(ele) arr.push(ele);
} }
}); });
// 工单申请数量 // 工单申请数量
let totalApplyNum = (arr[0].applyNum-0) let totalApplyNum = arr[0].applyNum - 0;
// 当前工单已经录入了总数量 vista是每一个录入数量 // 当前工单已经录入了总数量 vista是每一个录入数量
let totalVista =0 let totalVista = 0;
arr.forEach(ele => { arr.forEach((ele) => {
totalVista = totalVista + (ele.vista?(ele.vista-0):0) totalVista = totalVista + (ele.vista ? ele.vista - 0 : 0);
}); });
// 最终填入的数量 // 最终填入的数量
let endVista = 0 let endVista = 0;
endVista = ((this.list[m].applyNum - 0)-(this.list[m].vista-0)).toFixed(3) endVista = (
this.list[m].applyNum -
0 -
(this.list[m].vista - 0)
).toFixed(3);
// 处理最后一行 // 处理最后一行
if(m === this.list.length - 1){ if (m === this.list.length - 1) {
endVista = res.PACMG - 0 endVista = res.PACMG - 0;
} }
// 工单录入数量总和小于总的申请数量 那就要新增一行 // 工单录入数量总和小于总的申请数量 那就要新增一行
if(totalVista < totalApplyNum){ if (totalVista < totalApplyNum) {
this.handleAddList(m,endVista,res) this.handleAddList(m, endVista, res);
// 当前包装数量 大于(总的申请数量 减 工单录入数量总)就要往下一个分配 // 当前包装数量 大于(总的申请数量 减 工单录入数量总)就要往下一个分配
if((res.PACMG-0)-endVista >0){ if (res.PACMG - 0 - endVista > 0) {
this.factorial(res,plnr,m+2,(res.PACMG-0)-endVista) this.factorial(res, plnr, m + 2, res.PACMG - 0 - endVista);
}
return
}
}else{
this.$u.toast('暂无剩余物料');
} }
return;
} }
} else {
this.$u.toast("暂无剩余物料");
} }
} }
} }
} }
},
},
}; };
</script> </script>
...@@ -360,10 +513,10 @@ export default { ...@@ -360,10 +513,10 @@ export default {
page { page {
background: #f8f8f8; background: #f8f8f8;
} }
.headerTitle{ .headerTitle {
padding: 20rpx; padding: 20rpx;
font-weight: 600; font-weight: 600;
.items{ .items {
line-height: 40rpx; line-height: 40rpx;
} }
} }
...@@ -466,7 +619,7 @@ page { ...@@ -466,7 +619,7 @@ page {
top: 0 !important; top: 0 !important;
background: #fff; background: #fff;
} }
.checkedCase{ .checkedCase {
margin-top: 10rpx; margin-top: 10rpx;
} }
</style> </style>
...@@ -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