feat(wms): 优化出库单创建功能

- 添加搜索和重置按钮
- 修改仓库名称显示
- 优化销售客户选择逻辑
- 移除物料大类选择
- 完善表单验证和提交逻辑
- 更新相关类型定义
master
zangch@mesnac.com 3 months ago
parent 055440eba1
commit a02069bb8c

@ -1,3 +1,5 @@
import type { OutstockDetailForm } from '@/api/wms/outstockDetail/types';
export interface OutstockOrderVO {
/**
*
@ -62,6 +64,12 @@ export interface OutstockOrderVO {
*/
customerId: string | number;
/**
*
*/
warehouseName: string;
}
export interface OutstockOrderForm extends BaseEntity {
@ -127,6 +135,16 @@ export interface OutstockOrderForm extends BaseEntity {
*/
customerId?: string | number;
/**
*
*/
warehouseName: string;
/**
*
*/
detailList?: OutstockDetailForm[];
}
export interface OutstockOrderQuery extends PageQuery {
@ -193,6 +211,11 @@ export interface OutstockOrderQuery extends PageQuery {
*/
customerId?: string | number;
/**
*
*/
warehouseName: string;
/**
*
*/

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

Loading…
Cancel
Save