niexiting
11 months ago
14 changed files with 344 additions and 110 deletions
@ -1,77 +1,79 @@ |
|||||
import { calc } from '@/common/calc' |
import { |
||||
export function getDataSource(subList) { |
calc |
||||
let items = []; |
} from '@/common/calc' |
||||
subList.forEach(detail => { |
export function getDataSource(subList) { |
||||
var item = items.find(r => |
let items = []; |
||||
r.itemCode == detail.itemCode) |
subList.forEach(detail => { |
||||
if (item == undefined) { |
var item = items.find(r => |
||||
item = createItemInfo(detail); |
r.itemCode == detail.itemCode) |
||||
let newDetail = createDetailInfo(detail); //
|
if (item == undefined) { |
||||
item.subList.push(newDetail); |
item = createItemInfo(detail); |
||||
items.push(item) |
let newDetail = createDetailInfo(detail); //
|
||||
} else { |
item.subList.push(newDetail); |
||||
item.qty = calc.add(item.qty,detail.qty) |
items.push(item) |
||||
let newDetail = createDetailInfo(detail); //
|
} else { |
||||
item.subList.push(newDetail); |
item.qty = calc.add(item.qty, detail.qty) |
||||
} |
let newDetail = createDetailInfo(detail); //
|
||||
}) |
item.subList.push(newDetail); |
||||
return items; |
} |
||||
} |
}) |
||||
|
return items; |
||||
|
} |
||||
|
|
||||
export function createItemInfo(detail) { |
export function createItemInfo(detail) { |
||||
let item = { |
let item = { |
||||
itemCode: detail.itemCode, |
itemCode: detail.itemCode, |
||||
itemName: detail.itemName, |
itemName: detail.itemName, |
||||
stdPackQty: Number(detail.stdPackQty)||undefined, |
stdPackQty: Number(detail.stdPackQty) || undefined, |
||||
stdPackUnit: detail.stdPackUnit, |
stdPackUnit: detail.stdPackUnit, |
||||
qty: Number(detail.qty), |
qty: Number(detail.qty), |
||||
handleQty: 0, |
handleQty: 0, |
||||
uom: detail.uom, |
uom: detail.uom, |
||||
subList: [] |
subList: [] |
||||
|
} |
||||
|
return item; |
||||
} |
} |
||||
return item; |
|
||||
} |
|
||||
|
|
||||
export function createDetailInfo(data) { |
export function createDetailInfo(data) { |
||||
data.scaned = false; |
data.scaned = false; |
||||
// data.record = {};
|
// data.record = {};
|
||||
let detail = data; |
let detail = data; |
||||
return detail; |
return detail; |
||||
} |
} |
||||
|
|
||||
//根据明细创建记录
|
//根据明细创建记录
|
||||
export function createRecordInfo(detail, balance) { |
export function createRecordInfo(detail, balance) { |
||||
var record = {} |
var record = {} |
||||
// let record = JSON.parse(JSON.stringify(detail));
|
// let record = JSON.parse(JSON.stringify(detail));
|
||||
//克隆对象,深度克隆,防止双向绑定同一个变量
|
//克隆对象,深度克隆,防止双向绑定同一个变量
|
||||
Object.assign(record, detail) |
Object.assign(record, detail) |
||||
detail.scaned = true; |
detail.scaned = true; |
||||
detail.balance = balance; |
detail.balance = balance; |
||||
detail.recommendInventoryStatus = detail.inventoryStatus; |
detail.recommendInventoryStatus = detail.inventoryStatus; |
||||
detail.inventoryStatus = balance.inventoryStatus; |
detail.inventoryStatus = balance.inventoryStatus; |
||||
record.qty = Number(balance.qty); |
record.qty = Number(balance.qty); |
||||
return record; |
return record; |
||||
} |
} |
||||
|
|
||||
//计算实际数量
|
//计算实际数量
|
||||
export function calcHandleQty(detailSource) { |
export function calcHandleQty(detailSource) { |
||||
for (let item of detailSource) { |
for (let item of detailSource) { |
||||
item.handleQty = 0; |
item.handleQty = 0; |
||||
for (let detail of item.subList) { |
for (let detail of item.subList) { |
||||
if (detail != undefined && detail.scaned) { |
if (detail != undefined && detail.scaned) { |
||||
item.handleQty = calc.add(item.handleQty,detail.handleQty) |
item.handleQty = calc.add(item.handleQty, detail.handleQty) |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
} |
|
||||
|
|
||||
|
|
||||
export function getScanCount(subList) { |
export function getScanCount(subList) { |
||||
let items = subList.filter(r => { |
let items = subList.filter(r => { |
||||
if (r.scaned) { |
if (r.scaned) { |
||||
return r; |
return r; |
||||
} |
} |
||||
}) |
}) |
||||
let scanCount = items != null ? items.length : 0; |
let scanCount = items != null ? items.length : 0; |
||||
return scanCount; |
return scanCount; |
||||
} |
} |
||||
|
@ -0,0 +1,148 @@ |
|||||
|
<template> |
||||
|
<view class="" style="background-color: #fff;"> |
||||
|
<uni-collapse ref="collapse1" @change=""> |
||||
|
<uni-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" :showItemQty ="false"></item-qty> |
||||
|
</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)" |
||||
|
:right-options="item.scaned?scanOptions:detailOptions"> |
||||
|
<recommend :detail="item" :isShowFromLocation="false" :isShowToLocation="true"> |
||||
|
</recommend> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
<u-line color="#D8D8D8"></u-line> |
||||
|
</view> |
||||
|
</uni-collapse-item> |
||||
|
</uni-collapse> |
||||
|
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" |
||||
|
@confirm="confirm"> |
||||
|
</recommend-qty-edit> |
||||
|
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation' |
||||
|
:locationTypeList="locationTypeList"></win-scan-location> |
||||
|
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
||||
|
<comMessage ref="message"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
||||
|
import recommend from '@/mycomponents/recommend/recommend.vue' |
||||
|
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' |
||||
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
||||
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
||||
|
import detailInfoPopup from '@/pages/unPlanned/coms/detailInfoPopup.vue' |
||||
|
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getPurchaseReceiptOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
itemQty, |
||||
|
recommend, |
||||
|
recommendQtyEdit, |
||||
|
detailInfoPopup, |
||||
|
comMessage, |
||||
|
winScanLocation |
||||
|
}, |
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
settingParam: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
isShowLocation: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
locationTypeList: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
showItem: {}, |
||||
|
editItem: { |
||||
|
record: { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
detailOptions: [], |
||||
|
scanOptions: [] |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
if (this.detailOptions.length == 0) { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
} |
||||
|
if (this.scanOptions.length == 0) { |
||||
|
this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty,this.settingParam.allowModifyLocation) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
swipeClick(e, item) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.detail(item) |
||||
|
} else if (e.content.text == "编辑") { |
||||
|
this.edit(item) |
||||
|
} else if (e.content.text == "库位") { |
||||
|
this.showLocation(item) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(item) |
||||
|
} |
||||
|
}, |
||||
|
edit(item) { |
||||
|
this.editItem = item; |
||||
|
this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty,item.labelQty); |
||||
|
}, |
||||
|
showLocation(item) { |
||||
|
this.locatonItem =item; |
||||
|
this.$refs.scanLocationCode.openScanPopup(); |
||||
|
}, |
||||
|
//扫描源库位 |
||||
|
getLocation(location, code) { |
||||
|
this.locatonItem.toLocationCode =code; |
||||
|
this.$emit('updateData') |
||||
|
}, |
||||
|
|
||||
|
detail(item) { |
||||
|
this.showItem = item; |
||||
|
this.$refs.detailInfoPopup.openPopup(item) |
||||
|
}, |
||||
|
remove(item) { |
||||
|
this.$refs.message.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
item.scaned = false |
||||
|
item.handleQty = null |
||||
|
this.$forceUpdate() |
||||
|
this.$emit('remove', item) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
confirm(qty) { |
||||
|
this.editItem.handleQty = qty; |
||||
|
this.$emit('updateData') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
Loading…
Reference in new issue