一级出库逻辑调整

master
zhangdi 2 months ago
parent 51ef9ee7f0
commit 55440b1fd9
  1. 3
      src/api/firstOrder/outbound.js
  2. 61
      src/views/firstOrder/components/outDialog.vue

@ -67,7 +67,6 @@ export const submitData = (sizeForm) => {
}) })
} }
export const getMaterialList = (optionType) => { export const getMaterialList = (optionType) => {
console.log('api中的数据', optionType)
return request({ return request({
url: '/smartpark/oneForm/getPutOneFormList', url: '/smartpark/oneForm/getPutOneFormList',
method: 'get', method: 'get',
@ -99,4 +98,4 @@ export const getPutPurchaseList = (current, size, params) => {
cryptoToken: false, cryptoToken: false,
cryptoData: false cryptoData: false
}) })
} }

@ -112,12 +112,10 @@
<el-table-column prop="materialName" label="物资名称"> <el-table-column prop="materialName" label="物资名称">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select <el-select
v-model="scope.row.materialitem" v-model="scope.row.materialId"
placeholder="请选择物资名称" placeholder="请选择物资名称"
style="width: 100%" style="width: 100%"
@change=" @change="handleMaterialChange(scope.row, scope.$index)"
handleMaterialChange(scope.row.materialitem, scope.$index)
"
v-if=" v-if="
outDialogType != 'details' && outDialogType != 'details' &&
sizeForm.options == 2 && sizeForm.options == 2 &&
@ -129,7 +127,7 @@
v-for="item in materials" v-for="item in materials"
:key="item.materialId" :key="item.materialId"
:label="item.materialName" :label="item.materialName"
:value="item" :value="item.materialId"
> >
</el-option> </el-option>
</el-select> </el-select>
@ -191,8 +189,6 @@
v-if="sizeForm.options == 1" v-if="sizeForm.options == 1"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <span v-if="outDialogType != 'details'">{{ scope.row.outboundQuantity || 0 }}</span>
<span v-else>{{ scope.row.outboundSumQuantity || 0 }}</span> -->
<span>{{ scope.row.outboundQuantity || 0 }}</span> <span>{{ scope.row.outboundQuantity || 0 }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -500,6 +496,7 @@ export default {
}, },
quarterYearMap: {}, quarterYearMap: {},
quarterQuarterMap: {}, quarterQuarterMap: {},
materials:[],//
}; };
}, },
computed: { computed: {
@ -565,7 +562,6 @@ export default {
const detail = this.sizeForm.inTableData.find( const detail = this.sizeForm.inTableData.find(
(item) => item.materialCode === stat.materialCode (item) => item.materialCode === stat.materialCode
); );
console.log("detail", detail, stat);
// //
if ( if (
(this.sizeForm.options == 1 && (this.sizeForm.options == 1 &&
@ -835,25 +831,30 @@ export default {
) { ) {
this.consumableVisible = true; this.consumableVisible = true;
} else { } else {
const res = await getMaterialList({ getMaterialList({
optionType: this.sizeForm.optionType, optionType: this.sizeForm.optionType,
}).then((res) => {
this.materials = res.data.result;
}); });
this.materials = res.data.result;
} }
} catch (error) { } catch (error) {
this.$message.error("获取数据来源失败,请重试"); this.$message.error("获取失败,请重试");
} finally { } finally {
this.loading = false; this.loading = false;
} }
}, },
// //
handleMaterialChange(row, index) { handleMaterialChange(row, index) {
this.sizeForm.inTableData[index].materialId = row.materialId; let select = this.materials.filter(
this.sizeForm.inTableData[index].model = row.model; (item) => item.materialId === row.materialId
this.sizeForm.inTableData[index].materialCode = row.materialCode; )[0];
this.sizeForm.inTableData[index].materialName = row.materialName;
this.sizeForm.inTableData[index].type = row.type; this.sizeForm.inTableData[index].materialId = select.materialId;
this.sizeForm.inTableData[index].unit = row.unit; this.sizeForm.inTableData[index].model = select.model;
this.sizeForm.inTableData[index].materialCode = select.materialCode;
this.sizeForm.inTableData[index].materialName = select.materialName;
this.sizeForm.inTableData[index].type = select.type;
this.sizeForm.inTableData[index].unit = select.unit;
this.getStatistics(); this.getStatistics();
}, },
// //
@ -895,7 +896,6 @@ export default {
); );
this.sizeForm.ldOneOutStorageDetailVOList = this.sizeForm.inTableData.map( this.sizeForm.ldOneOutStorageDetailVOList = this.sizeForm.inTableData.map(
(row) => { (row) => {
console.log(row, "row");
const deptId = row.department; const deptId = row.department;
const dept = this.list.find((item) => item.departmentId === deptId); const dept = this.list.find((item) => item.departmentId === deptId);
const oneFormId = row.id; const oneFormId = row.id;
@ -909,17 +909,14 @@ export default {
}; };
} }
); );
if(this.sizeForm.status == 1){ if (this.outDialogTiltle == "编辑") {
this.sizeForm.id = this.id this.sizeForm.id = this.id;
} }
console.log(this.sizeForm, "111");
// this.sizeForm.inTableData = [];
if (this.sizeForm.options === 1) { if (this.sizeForm.options === 1) {
this.sizeForm.optionType = this.inBatchForm.optionType; this.sizeForm.optionType = this.inBatchForm.optionType;
} }
try { try {
const res = await submitData(this.sizeForm); const res = await submitData(this.sizeForm);
console.log(this.sizeForm, "222");
if (res.data.success) { if (res.data.success) {
this.$message({ this.$message({
type: "success", type: "success",
@ -951,18 +948,12 @@ export default {
this.sizeForm.options = Number(ldOneOutStorage.options); this.sizeForm.options = Number(ldOneOutStorage.options);
this.sizeForm.optionType = ldOneOutStorage.optionType; this.sizeForm.optionType = ldOneOutStorage.optionType;
this.batchSelectionVisible = false; this.batchSelectionVisible = false;
console.log(
res.data.result.ldOneOutStorageDetails, if (this.sizeForm.options == 2 && this.sizeForm.optionType == "YH") {
"this.sizeForm.options"
); this.getMaterialList();
ldOneOutStorageDetails.foreach(item=>{ }
item.materialId = item.materialId+''; this.$set(this.sizeForm, "inTableData", ldOneOutStorageDetails);
})
this.$set(
this.sizeForm,
"inTableData",
ldOneOutStorageDetails
);
this.getStatistics(); this.getStatistics();
}); });
} }

Loading…
Cancel
Save