liuchen
10 months ago
147 changed files with 4023 additions and 2015 deletions
@ -1,77 +1,83 @@ |
|||
import { calc } from '@/common/calc' |
|||
export function getDataSource(subList) { |
|||
let items = []; |
|||
subList.forEach(detail => { |
|||
var item = items.find(r => |
|||
r.itemCode == detail.itemCode) |
|||
if (item == undefined) { |
|||
item = createItemInfo(detail); |
|||
let newDetail = createDetailInfo(detail); //
|
|||
item.subList.push(newDetail); |
|||
items.push(item) |
|||
} else { |
|||
item.qty = calc.add(item.qty,detail.qty) |
|||
let newDetail = createDetailInfo(detail); //
|
|||
item.subList.push(newDetail); |
|||
} |
|||
}) |
|||
return items; |
|||
} |
|||
import { |
|||
calc |
|||
} from '@/common/calc' |
|||
|
|||
export function createItemInfo(detail) { |
|||
let item = { |
|||
itemCode: detail.itemCode, |
|||
itemName: detail.itemName, |
|||
stdPackQty: Number(detail.stdPackQty)||undefined, |
|||
stdPackUnit: detail.stdPackUnit, |
|||
qty: Number(detail.qty), |
|||
handleQty: 0, |
|||
uom: detail.uom, |
|||
subList: [] |
|||
import { Decimal } from 'decimal.js';//引入
|
|||
export function getDataSource(subList) { |
|||
let items = []; |
|||
subList.forEach(detail => { |
|||
var item = items.find(r => |
|||
r.itemCode == detail.itemCode) |
|||
if (item == undefined) { |
|||
item = createItemInfo(detail); |
|||
let newDetail = createDetailInfo(detail); //
|
|||
item.subList.push(newDetail); |
|||
items.push(item) |
|||
} else { |
|||
item.qty = calc.add(item.qty, detail.qty) |
|||
let newDetail = createDetailInfo(detail); //
|
|||
item.subList.push(newDetail); |
|||
} |
|||
}) |
|||
return items; |
|||
} |
|||
|
|||
export function createItemInfo(detail) { |
|||
let item = { |
|||
itemCode: detail.itemCode, |
|||
itemName: detail.itemName, |
|||
stdPackQty: Number(detail.stdPackQty) || undefined, |
|||
stdPackUnit: detail.stdPackUnit, |
|||
qty: Number(detail.qty), |
|||
handleQty: 0, |
|||
uom: detail.uom, |
|||
subList: [] |
|||
} |
|||
return item; |
|||
} |
|||
return item; |
|||
} |
|||
|
|||
export function createDetailInfo(data) { |
|||
data.scaned = false; |
|||
// data.record = {};
|
|||
let detail = data; |
|||
return detail; |
|||
} |
|||
export function createDetailInfo(data) { |
|||
data.scaned = false; |
|||
// data.record = {};
|
|||
let detail = data; |
|||
return detail; |
|||
} |
|||
|
|||
//根据明细创建记录
|
|||
export function createRecordInfo(detail, balance) { |
|||
var record = {} |
|||
// let record = JSON.parse(JSON.stringify(detail));
|
|||
//克隆对象,深度克隆,防止双向绑定同一个变量
|
|||
Object.assign(record, detail) |
|||
detail.scaned = true; |
|||
detail.balance = balance; |
|||
detail.recommendInventoryStatus = detail.inventoryStatus; |
|||
detail.inventoryStatus = balance.inventoryStatus; |
|||
record.qty = Number(balance.qty); |
|||
return record; |
|||
} |
|||
//根据明细创建记录
|
|||
export function createRecordInfo(detail, balance) { |
|||
var record = {} |
|||
// let record = JSON.parse(JSON.stringify(detail));
|
|||
//克隆对象,深度克隆,防止双向绑定同一个变量
|
|||
Object.assign(record, detail) |
|||
detail.scaned = true; |
|||
detail.balance = balance; |
|||
detail.recommendInventoryStatus = detail.inventoryStatus; |
|||
detail.inventoryStatus = balance.inventoryStatus; |
|||
record.qty = Number(balance.qty); |
|||
return record; |
|||
} |
|||
|
|||
//计算实际数量
|
|||
export function calcHandleQty(detailSource) { |
|||
for (let item of detailSource) { |
|||
item.handleQty = 0; |
|||
for (let detail of item.subList) { |
|||
if (detail != undefined && detail.scaned) { |
|||
item.handleQty += Number(detail.handleQty) |
|||
//计算实际数量
|
|||
export function calcHandleQty(detailSource) { |
|||
for (let item of detailSource) { |
|||
item.handleQty = new Decimal(0).toNumber(); |
|||
item.qty = new Decimal(0).toNumber(); |
|||
for (let detail of item.subList) { |
|||
if (detail != undefined && detail.scaned) { |
|||
item.handleQty = calc.add(item.handleQty,detail.handleQty); |
|||
item.qty = calc.add(item.qty,detail.qty); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
export function getScanCount(subList) { |
|||
let items = subList.filter(r => { |
|||
if (r.scaned) { |
|||
return r; |
|||
} |
|||
}) |
|||
let scanCount = items != null ? items.length : 0; |
|||
return scanCount; |
|||
} |
|||
export function getScanCount(subList) { |
|||
let items = subList.filter(r => { |
|||
if (r.scaned) { |
|||
return r; |
|||
} |
|||
}) |
|||
let scanCount = items != null ? items.length : 0; |
|||
return scanCount; |
|||
} |
|||
|
@ -1,198 +0,0 @@ |
|||
<template> |
|||
<view class="" style="background-color: #fff;"> |
|||
<uni-collapse ref="collapse1" @change=""> |
|||
<uni-collapse-item :open="true"> |
|||
<template v-slot:title> |
|||
<uni-swipe-action ref="swipeAction"> |
|||
<uni-swipe-action-item @click="removeItem($event,dataContent)" :right-options="removeOptions"> |
|||
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" |
|||
:isShowBalance="true"></item-qty> |
|||
</uni-swipe-action-item> |
|||
</uni-swipe-action> |
|||
|
|||
</template> |
|||
<u-line /> |
|||
<view class="" v-for="(item,index) in dataContent.subList"> |
|||
<uni-swipe-action ref="swipeAction"> |
|||
<uni-swipe-action-item @click="swipeClick($event,item,index)" |
|||
:right-options="item.scaned?scanOptions:detailOptions"> |
|||
<!-- <balance :dataContent="item" :isShowStdPack="false" :isShowPack="true" |
|||
:isShowLocation="true"></balance> --> |
|||
<purchase-label :dataContent="item" :packageContent="item.package" :isShowStdPack="false"> |
|||
</purchase-label> |
|||
</uni-swipe-action-item> |
|||
</uni-swipe-action> |
|||
<u-line color="#D8D8D8"></u-line> |
|||
</view> |
|||
</uni-collapse-item> |
|||
</uni-collapse> |
|||
<balanceQtyEdit ref="balanceQtyEdit" @confirm="confirm"></balanceQtyEdit> |
|||
<job-detail-popup ref="winHint" :dataContent="showItem"></job-detail-popup> |
|||
<com-message ref="comMessage"></com-message> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import itemQty from '@/mycomponents/item/itemQty.vue' |
|||
import recommend from '@/mycomponents/recommend/recommend.vue' |
|||
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|||
import purchaseLabel from '@/mycomponents/balance/purchaseLabel.vue' |
|||
import record from '@/mycomponents/record/record.vue' |
|||
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
|||
import comMessage from '@/mycomponents/common/comMessage.vue' |
|||
import { |
|||
getDetailOption, |
|||
getDetailEditRemoveOption, |
|||
getClearOption |
|||
} from '@/common/array.js'; |
|||
export default { |
|||
components: { |
|||
itemQty, |
|||
recommend, |
|||
jobDetailPopup, |
|||
purchaseLabel, |
|||
balanceQtyEdit, |
|||
record, |
|||
comMessage |
|||
}, |
|||
props: { |
|||
dataContent: { |
|||
type: Object, |
|||
default: {} |
|||
}, |
|||
settingParam: { |
|||
type: Object, |
|||
default: {} |
|||
}, |
|||
fromInventoryStatus: { |
|||
type: String, |
|||
default: "" |
|||
}, |
|||
toInventoryStatus: { |
|||
type: String, |
|||
default: "" |
|||
}, |
|||
isShowStatus: { |
|||
type: Boolean, |
|||
default: false |
|||
} |
|||
}, |
|||
watch: { |
|||
dataContent: { |
|||
handler(newName, oldName) { |
|||
if (this.dataContent.subList.length > 0) { |
|||
if (this.$refs.collapse1 != undefined) { |
|||
this.$nextTick(res => { |
|||
this.$refs.collapse1.resize() |
|||
}) |
|||
} |
|||
} |
|||
}, |
|||
immediate: true, |
|||
deep: true |
|||
} |
|||
}, |
|||
|
|||
data() { |
|||
return { |
|||
option: [], |
|||
title: "推荐详情", |
|||
showItem: {}, |
|||
editItem: {}, |
|||
detailOptions: [], |
|||
scanOptions: [], |
|||
removeOptions: [], |
|||
dataList: [] |
|||
} |
|||
}, |
|||
|
|||
mounted() { |
|||
this.detailOptions = getDetailOption(); |
|||
this.scanOptions = getDetailEditRemoveOption(); |
|||
this.removeOptions = getClearOption(); |
|||
}, |
|||
|
|||
methods: { |
|||
removeItem(e, dataContent) { |
|||
if (e.content.text == "清空") { |
|||
this.$refs.comMessage.showQuestionMessage("确定清空零件及箱码信息?", |
|||
res => { |
|||
if (res) { |
|||
this.$emit('removeItem') |
|||
// this.$emit('removeItem', this.dataContent) |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
swipeClick(e, item, index) { |
|||
if (e.content.text == "详情") { |
|||
this.detail(item) |
|||
} else if (e.content.text == "编辑") { |
|||
this.edit(item) |
|||
} else if (e.content.text == "移除") { |
|||
this.remove(item, index) |
|||
} |
|||
}, |
|||
|
|||
edit(item) { |
|||
this.editItem = item; |
|||
this.$refs.balanceQtyEdit.openEditPopup(this.editItem, this.editItem.qty); |
|||
}, |
|||
|
|||
remove(item, index) { |
|||
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", |
|||
res => { |
|||
if (res) { |
|||
this.dataContent.subList.splice(index, 1) |
|||
this.$emit('updateData') |
|||
} |
|||
}); |
|||
}, |
|||
confirm(qty) { |
|||
this.editItem.qty = qty; |
|||
this.$emit('updateData') |
|||
}, |
|||
detail(item) { |
|||
this.showItem = item; |
|||
this.dataList = [{ |
|||
title: "箱码", |
|||
content: item.packingNumber |
|||
}, |
|||
{ |
|||
title: "批次", |
|||
content: item.batch |
|||
}, |
|||
{ |
|||
title: "库位", |
|||
content: item.locationCode |
|||
}, |
|||
{ |
|||
title: "数量", |
|||
content: item.qty |
|||
}, |
|||
{ |
|||
title: "单位", |
|||
content: item.uom |
|||
} |
|||
] |
|||
this.$refs.winHint.openScanPopup() |
|||
}, |
|||
remove(item, index) { |
|||
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", |
|||
res => { |
|||
if (res) { |
|||
this.dataContent.subList.splice(index, 1) |
|||
this.$emit('removePack') |
|||
} |
|||
}); |
|||
}, |
|||
confirm(qty) { |
|||
this.editItem.qty = qty; |
|||
this.$emit('updateData') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue