|
|
|
|
@ -15,6 +15,10 @@
|
|
|
|
|
<el-form-item label="出库单号" prop="outstockCode">
|
|
|
|
|
<el-input v-model="queryForm.outstockCode" placeholder="请输入出库单号" clearable/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
@ -44,8 +48,7 @@
|
|
|
|
|
@current-change="parentTableCellClick"
|
|
|
|
|
@selection-change="selectionChange" ref="parentTableRef">
|
|
|
|
|
<el-table-column type="selection" width="55"/>
|
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
<el-table-column label="仓库" align="center" prop="warehouseCode"/>
|
|
|
|
|
<el-table-column label="仓库" align="center" prop="warehouseName"/>
|
|
|
|
|
<el-table-column label="出库单号" align="center" prop="outstockCode"/>
|
|
|
|
|
<el-table-column label="出库类型" align="center" prop="outstockType">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
@ -144,7 +147,7 @@
|
|
|
|
|
|
|
|
|
|
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="80%">
|
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<el-form :model="dialogForm" :inline="true" label-width="120px" :disabled="isView">
|
|
|
|
|
<el-form :model="dialogForm" :inline="true" label-width="120px" :disabled="isView" ref="dialogFormRef">
|
|
|
|
|
<el-form-item label="仓库" prop="warehouseId">
|
|
|
|
|
<el-select v-model="dialogForm.warehouseId" placeholder="请选择所属仓库">
|
|
|
|
|
<el-option
|
|
|
|
|
@ -194,7 +197,7 @@
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- </el-select>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label="销售客户" prop="customerId" v-if ="dialogForm.outstockType === '1' ">
|
|
|
|
|
<el-form-item label="销售客户" prop="customerId" v-if =" dialogForm.outstockType === '1' ">
|
|
|
|
|
<el-select v-model="dialogForm.customerId" placeholder="请选择客户">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in baseCustomerList"
|
|
|
|
|
@ -214,7 +217,7 @@
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-table :data="dialogtable" style="width: 100%">
|
|
|
|
|
<el-table-column label="物料大类" prop="materialCategoryId">
|
|
|
|
|
<!-- <el-table-column label="物料大类" prop="materialCategoryId">
|
|
|
|
|
<el-select v-model="dialogForm.materialCategoryId" placeholder="" :disabled="true">
|
|
|
|
|
<el-option v-for="item in mategoryOptions"
|
|
|
|
|
:key="item.materialCategoryId"
|
|
|
|
|
@ -222,7 +225,7 @@
|
|
|
|
|
:value="item.materialCategoryId"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table-column>-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-table-column label="物料编码" prop="materialCode">
|
|
|
|
|
@ -392,8 +395,8 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="销售客户" prop="customerId">
|
|
|
|
|
<el-select v-model="parentTableInfoForm.customerId" placeholder="请选择客户" v-if="parentTableInfoForm.outstockType == 1">
|
|
|
|
|
<el-form-item label="销售客户" prop="customerId" v-if="parentTableInfoForm.outstockType === '1'">
|
|
|
|
|
<el-select v-model="parentTableInfoForm.customerId" placeholder="请选择客户" >
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in baseCustomerList"
|
|
|
|
|
:key="item.customerId"
|
|
|
|
|
@ -575,6 +578,7 @@ const childrenTableInfoVisible = ref(false)
|
|
|
|
|
// 审批
|
|
|
|
|
const approveDialogVisible = ref(false)
|
|
|
|
|
const approveForm = ref<Partial<OutstockOrderForm>>({ outstockId: undefined, auditStatus: '', auditComments: '' })
|
|
|
|
|
const dialogFormRef = ref()
|
|
|
|
|
// const childrenTableInfoSubmit = ref(false)
|
|
|
|
|
const updateDialog = ref(false)
|
|
|
|
|
const dialogTitle = ref('添加')
|
|
|
|
|
@ -795,24 +799,55 @@ const addDialogTableCell = () => {
|
|
|
|
|
dialogtable.value.push({})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新增提交
|
|
|
|
|
const dialogSubmit = () => {
|
|
|
|
|
const dialogSubmit = async () => {
|
|
|
|
|
// 首先进行表单验证
|
|
|
|
|
if (!dialogFormRef.value) {
|
|
|
|
|
ElMessage.error('表单引用未找到');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addOutstockOrder(dialogForm.value).then(e => {
|
|
|
|
|
// addOutstockDetail(dialogtable.value.map(item => {
|
|
|
|
|
// return {...item, outstockCode: e.data.outstockCode,outstockId: e.data.outstockId, materialCategoryId: e.data.materialCategoryId}
|
|
|
|
|
// }
|
|
|
|
|
// )
|
|
|
|
|
Promise.all(dialogtable.value.map(async (item) => {
|
|
|
|
|
const detail = {...item, outstockCode: e.data.outstockCode, outstockId: e.data.outstockId, materialCategoryId: e.data.materialCategoryId};
|
|
|
|
|
return addOutstockDetail(detail);
|
|
|
|
|
})
|
|
|
|
|
).then(v => {
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
getParentTable()
|
|
|
|
|
})
|
|
|
|
|
try {
|
|
|
|
|
await dialogFormRef.value.validate();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
ElMessage.error('请填写完整的表单信息');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
console.log(dialogtable.value)
|
|
|
|
|
// 将前端行映射为后端明细字段,并进行基本校验与过滤
|
|
|
|
|
const detailList = (dialogtable.value || [])
|
|
|
|
|
.map((item: any) => ({
|
|
|
|
|
materialId: item.materialId,
|
|
|
|
|
materialCode: item.materialCode,
|
|
|
|
|
materialName: item.materialName,
|
|
|
|
|
materialSpe: item.materialSpe || item.materialSpec, // 前端 materialSpec -> 后端 materialSpe
|
|
|
|
|
unitName: item.materialUnit, // 前端 materialUnit -> 后端 unitName
|
|
|
|
|
outstockQty: Number(item.outstockQty || 0),
|
|
|
|
|
materialCategoryId: dialogForm.value.materialCategoryId
|
|
|
|
|
}))
|
|
|
|
|
.filter(d => d.materialCode && Number(d.outstockQty) > 0);
|
|
|
|
|
|
|
|
|
|
console.log(detailList)
|
|
|
|
|
if (!detailList.length) {
|
|
|
|
|
ElMessage.error('请添加至少一条物料且数量>0');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(detailList, dialogtable.value);
|
|
|
|
|
|
|
|
|
|
const payload: OutstockOrderForm = {
|
|
|
|
|
...dialogForm.value,
|
|
|
|
|
detailList: detailList
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
console.log(payload)
|
|
|
|
|
addOutstockOrder(payload).then(() => {
|
|
|
|
|
ElMessage.success('保存成功');
|
|
|
|
|
dialogVisible.value = false;
|
|
|
|
|
getParentTable();
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
ElMessage.error('新增失败,请重试');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const parentTableInfoSubmit = () =>{
|
|
|
|
|
@ -977,6 +1012,18 @@ let baseCustomerList = ref([]);
|
|
|
|
|
baseCustomerList.value = res.data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
queryForm.value.pageNum = 1;
|
|
|
|
|
getParentTable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
const resetQuery = () => {
|
|
|
|
|
reset();
|
|
|
|
|
handleQuery();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
|