diff --git a/src/api/wms/outstockOrder/types.ts b/src/api/wms/outstockOrder/types.ts
index 0689a8d..d9ec1e1 100644
--- a/src/api/wms/outstockOrder/types.ts
+++ b/src/api/wms/outstockOrder/types.ts
@@ -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;
+
/**
* 日期范围参数
*/
diff --git a/src/views/wms/outstockOrderCopy/index.vue b/src/views/wms/outstockOrderCopy/index.vue
index 2fdf5ed..3850049 100644
--- a/src/views/wms/outstockOrderCopy/index.vue
+++ b/src/views/wms/outstockOrderCopy/index.vue
@@ -15,6 +15,10 @@
+
+ 搜索
+ 重置
+
@@ -44,8 +48,7 @@
@current-change="parentTableCellClick"
@selection-change="selectionChange" ref="parentTableRef">
-
-
+
@@ -144,7 +147,7 @@
-
+
-->
-
+
-
+
@@ -392,8 +395,8 @@
-
-
+
+
>({ 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();
+}
+