|
|
|
|
@ -423,36 +423,41 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getStatistics() { |
|
|
|
|
let arr = JSON.parse(JSON.stringify(this.sizeForm.inTableData)); |
|
|
|
|
let arr = this.sizeForm.inTableData; |
|
|
|
|
|
|
|
|
|
arr.forEach((row) => { |
|
|
|
|
row.id = row.oneFormId; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
getStatistics(arr).then((res) => { |
|
|
|
|
this.statisticsList = res.data.result; |
|
|
|
|
this.statisticsList = this.statisticsList.map((stat) => { |
|
|
|
|
// this.statisticsList = res.data.result; |
|
|
|
|
let data_ = res.data.result |
|
|
|
|
// this.statisticsList = |
|
|
|
|
console.log('批量易耗品', this.sizeForm.inTableData, data_) |
|
|
|
|
data_.forEach((stat,index) => { |
|
|
|
|
const detail = this.sizeForm.inTableData.find( |
|
|
|
|
(item) => item.materialCode === stat.materialCode |
|
|
|
|
); |
|
|
|
|
// |
|
|
|
|
|
|
|
|
|
if (detail) { |
|
|
|
|
// console.log(99999,index, detail, stat.materialCode) |
|
|
|
|
if ( |
|
|
|
|
(this.sizeForm.options == 1 && |
|
|
|
|
this.inBatchForm.optionType == "NY") || |
|
|
|
|
(this.sizeForm.options == 2 && this.sizeForm.optionType == "NY") |
|
|
|
|
) { |
|
|
|
|
|
|
|
|
|
const detailList = this.sizeForm.inTableData.filter( |
|
|
|
|
(item) => |
|
|
|
|
item.materialCode === stat.materialCode && |
|
|
|
|
item.materialName === stat.materialName |
|
|
|
|
); |
|
|
|
|
console.log(8989898989, detailList) |
|
|
|
|
detail.theOutboundQuantity = detailList.reduce( |
|
|
|
|
(acc, cur) => acc + cur.theOutboundQuantity, |
|
|
|
|
(acc, cur) => cur.theOutboundQuantity, |
|
|
|
|
0 |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
this.statisticsList.push({ |
|
|
|
|
...stat, |
|
|
|
|
theOutboundQuantity: detail.theOutboundQuantity, //本次出库数量 |
|
|
|
|
unitPrice: detail.unitPrice, |
|
|
|
|
@ -461,17 +466,21 @@ export default { |
|
|
|
|
departmentName: |
|
|
|
|
detail.departmentName || |
|
|
|
|
this.getDepartmentName(detail.department), |
|
|
|
|
}; |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
console.log('detail', this.statisticsList) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
changeDepartment() { |
|
|
|
|
}, |
|
|
|
|
changeDepartment() { |
|
|
|
|
this.getStatistics(); |
|
|
|
|
}, |
|
|
|
|
batchclose() { |
|
|
|
|
}, |
|
|
|
|
batchclose() { |
|
|
|
|
this.batchSelectionVisible = false; |
|
|
|
|
}, |
|
|
|
|
selectionChange(row) { |
|
|
|
|
}, |
|
|
|
|
selectionChange(row) { |
|
|
|
|
this.batchSelectionVisible = false; |
|
|
|
|
row.forEach((item) => { |
|
|
|
|
item.outboundQuantity = 1; |
|
|
|
|
@ -481,8 +490,8 @@ export default { |
|
|
|
|
this.sizeForm.inTableData = row; |
|
|
|
|
|
|
|
|
|
this.getStatistics(); |
|
|
|
|
}, |
|
|
|
|
confirm(allSelectedList) { |
|
|
|
|
}, |
|
|
|
|
confirm(allSelectedList) { |
|
|
|
|
this.consumableVisible = false; |
|
|
|
|
allSelectedList.forEach((item) => { |
|
|
|
|
item.outboundQuantity = 1; |
|
|
|
|
@ -492,34 +501,34 @@ export default { |
|
|
|
|
|
|
|
|
|
this.sizeForm.inTableData = allSelectedList; |
|
|
|
|
this.getStatistics(); |
|
|
|
|
}, // 处理搜索 |
|
|
|
|
}, // 处理搜索 |
|
|
|
|
async handleSearch() { |
|
|
|
|
// 重置当前页 |
|
|
|
|
this.currentPage = 1; |
|
|
|
|
await this.loadGoodsList(); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 分页大小改变 |
|
|
|
|
handleSizeChange(val) { |
|
|
|
|
// 分页大小改变 |
|
|
|
|
handleSizeChange(val) { |
|
|
|
|
this.pageSize = val; |
|
|
|
|
this.currentPage = 1; |
|
|
|
|
this.loadGoodsList(); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 当前页改变 |
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
// 当前页改变 |
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
this.currentPage = val; |
|
|
|
|
this.loadGoodsList(); |
|
|
|
|
}, |
|
|
|
|
depchange(value) { |
|
|
|
|
}, |
|
|
|
|
depchange(value) { |
|
|
|
|
this.departmentList = this.departmentList; |
|
|
|
|
}, |
|
|
|
|
//关闭 |
|
|
|
|
handleBatchClose() { |
|
|
|
|
}, |
|
|
|
|
//关闭 |
|
|
|
|
handleBatchClose() { |
|
|
|
|
this.inBatchDialogVisible = false; |
|
|
|
|
}, |
|
|
|
|
// 添加出库数据 |
|
|
|
|
inTableAdd() { |
|
|
|
|
}, |
|
|
|
|
// 添加出库数据 |
|
|
|
|
inTableAdd() { |
|
|
|
|
const requiredFields = [ |
|
|
|
|
{ value: this.sizeForm.reason, message: "请填写事由" }, |
|
|
|
|
{ value: this.sizeForm.materialType, message: "请选择物资类型" }, |
|
|
|
|
@ -536,12 +545,12 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.sizeForm.inTableData.push({}); |
|
|
|
|
}, |
|
|
|
|
addInit() { |
|
|
|
|
}, |
|
|
|
|
addInit() { |
|
|
|
|
this.sizeForm.outDate = new Date(); //出库时间 |
|
|
|
|
}, |
|
|
|
|
//本次出库数量 |
|
|
|
|
syncInboundQuantity(row) { |
|
|
|
|
}, |
|
|
|
|
//本次出库数量 |
|
|
|
|
syncInboundQuantity(row) { |
|
|
|
|
row.theOutboundQuantity = Number(row.theOutboundQuantity); |
|
|
|
|
if (this.sizeForm.options === 1) { |
|
|
|
|
const maxAllowQuantity = |
|
|
|
|
@ -556,16 +565,16 @@ export default { |
|
|
|
|
row.outboundQuantity = 1; |
|
|
|
|
} |
|
|
|
|
this.getStatistics(); |
|
|
|
|
}, |
|
|
|
|
//关闭新增弹窗 |
|
|
|
|
handleCloseDetail() { |
|
|
|
|
}, |
|
|
|
|
//关闭新增弹窗 |
|
|
|
|
handleCloseDetail() { |
|
|
|
|
this.outDialogVisible = false; |
|
|
|
|
|
|
|
|
|
this.$emit("handleCloseDetail"); |
|
|
|
|
}, |
|
|
|
|
closeDialog() { |
|
|
|
|
}, |
|
|
|
|
closeDialog() { |
|
|
|
|
this.consumableVisible = false; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
// 获取批量需求单列表 |
|
|
|
|
async getQuarterList() { |
|
|
|
|
try { |
|
|
|
|
@ -583,7 +592,7 @@ export default { |
|
|
|
|
} catch (error) { |
|
|
|
|
this.$message.error("获取需求单列表失败"); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
// 批量需求单选择变化,获取部门列表 |
|
|
|
|
async onQuarterSelectChange(ids) { |
|
|
|
|
if (!ids) return; |
|
|
|
|
@ -607,7 +616,7 @@ export default { |
|
|
|
|
} else { |
|
|
|
|
this.departmentList = []; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
async batchSubmit() { |
|
|
|
|
if (!this.inBatchForm.batchType) { |
|
|
|
|
@ -638,7 +647,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (res.data && res.data.result) { |
|
|
|
|
this.sizeForm.inTableData = res.data.result; |
|
|
|
|
// this.sizeForm.inTableData = res.data.result; |
|
|
|
|
const selectedDept = this.departmentList.find( |
|
|
|
|
(dept) => dept.departmentId === this.inBatchForm.department |
|
|
|
|
); |
|
|
|
|
@ -648,6 +657,7 @@ export default { |
|
|
|
|
// 如果字段不存在,默认为 0 |
|
|
|
|
const appQty = Number(item.applicationQuantity || 0); |
|
|
|
|
const outQty = Number(item.outboundQuantity || 0); |
|
|
|
|
|
|
|
|
|
const defaultQty = appQty - outQty; |
|
|
|
|
if (this.inBatchForm.optionType === "YH") { |
|
|
|
|
item.department = selectedDept.departmentId |
|
|
|
|
@ -661,8 +671,9 @@ export default { |
|
|
|
|
theOutboundQuantity: defaultQty > 0 ? defaultQty : 0, |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
this.sizeForm.inTableData = processedData; |
|
|
|
|
|
|
|
|
|
this.sizeForm.inTableData = processedData; |
|
|
|
|
// |
|
|
|
|
// 关闭批量选择弹窗 |
|
|
|
|
this.inBatchDialogVisible = false; |
|
|
|
|
|
|
|
|
|
@ -697,14 +708,14 @@ export default { |
|
|
|
|
}数据失败:${error.message}` |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
//获取单条选择的部门名称列表 |
|
|
|
|
async getDetailedItems() { |
|
|
|
|
this.loading = true; |
|
|
|
|
try { |
|
|
|
|
// const res = await ; |
|
|
|
|
// this.list = res.data.result; |
|
|
|
|
getDetailedItems().then(res=>{ |
|
|
|
|
getDetailedItems().then(res => { |
|
|
|
|
this.list = res.data.result; |
|
|
|
|
}) |
|
|
|
|
} catch (error) { |
|
|
|
|
@ -712,13 +723,13 @@ export default { |
|
|
|
|
} finally { |
|
|
|
|
this.loading = false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getDepartmentName(departmentId) { |
|
|
|
|
}, |
|
|
|
|
getDepartmentName(departmentId) { |
|
|
|
|
const department = this.list.find( |
|
|
|
|
(item) => item.departmentId === departmentId |
|
|
|
|
); |
|
|
|
|
return department ? department.department : ""; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
//获取单条选择的物资名称列表 |
|
|
|
|
async getMaterialList() { |
|
|
|
|
this.loading = true; |
|
|
|
|
@ -741,9 +752,9 @@ export default { |
|
|
|
|
} finally { |
|
|
|
|
this.loading = false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 处理物资选择变化 |
|
|
|
|
handleMaterialChange(row, index) { |
|
|
|
|
}, |
|
|
|
|
// 处理物资选择变化 |
|
|
|
|
handleMaterialChange(row, index) { |
|
|
|
|
let select = this.materials.filter( |
|
|
|
|
(item) => item.materialId === row.materialId |
|
|
|
|
)[0]; |
|
|
|
|
@ -756,7 +767,7 @@ export default { |
|
|
|
|
this.sizeForm.inTableData[index].unit = select.unit; |
|
|
|
|
this.sizeForm.inTableData[index].num = select.num; |
|
|
|
|
this.getStatistics(); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
async submit(index) { |
|
|
|
|
if (!this.sizeForm.reason) { |
|
|
|
|
@ -852,7 +863,7 @@ export default { |
|
|
|
|
this.saveLoading = false; |
|
|
|
|
this.$message.error(error.message || "服务器错误"); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//编辑和详情 |
|
|
|
|
async inInit() { |
|
|
|
|
@ -879,10 +890,10 @@ export default { |
|
|
|
|
this.getStatistics(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 选项选择 |
|
|
|
|
radioChange() { |
|
|
|
|
// 选项选择 |
|
|
|
|
radioChange() { |
|
|
|
|
this.sizeForm.inTableData = []; |
|
|
|
|
this.statisticsList = []; |
|
|
|
|
this.sizeForm.optionType = ""; |
|
|
|
|
@ -902,15 +913,15 @@ export default { |
|
|
|
|
this.inBatchForm.optionType = ""; |
|
|
|
|
this.inBatchForm.optionType = ""; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 删除表格行数据 |
|
|
|
|
handleDelete(index, row) { |
|
|
|
|
}, |
|
|
|
|
// 删除表格行数据 |
|
|
|
|
handleDelete(index, row) { |
|
|
|
|
this.sizeForm.inTableData.splice(index, 1); |
|
|
|
|
this.$message.success("已成功删除该条记录"); |
|
|
|
|
this.getStatistics(); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
watch: { |
|
|
|
|
// 监听需求单选择变化 |
|
|
|
|
// "inBatchForm.batchType": function (newVal) { |
|
|
|
|
// (this.inBatchForm.department = ""), (this.inBatchForm.optionType = 1); |
|
|
|
|
@ -926,7 +937,7 @@ export default { |
|
|
|
|
// this.getMaterialList(); |
|
|
|
|
// } |
|
|
|
|
// }, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
|