出库问题修改

master
zhangdi 3 days ago
parent 45beafffa0
commit a64e391e8b
  1. 143
      src/views/firstOrder/components/outDialog.vue

@ -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>

Loading…
Cancel
Save