From cae8ed1ee3e1f57e1193fcc7d2d07dc32ead2e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com> Date: Mon, 13 Jan 2025 14:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=88=B6=E5=AD=90=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wms/linkage/index.ts | 22 +++ src/views/wms/linkage/index.vue | 295 +++++++++++++++++++++++--------- 2 files changed, 240 insertions(+), 77 deletions(-) diff --git a/src/api/wms/linkage/index.ts b/src/api/wms/linkage/index.ts index d077958..dee7c9e 100644 --- a/src/api/wms/linkage/index.ts +++ b/src/api/wms/linkage/index.ts @@ -17,6 +17,14 @@ export const allocateOrderDetailList = (query) => { }); }; +export const allocateOrderUpdate = (query) => { + return request({ + url: '/wms/allocateOrder', + method: 'put', + data: query + }); +}; + export const allocateOrder = (aoId) => { return request({ url: '/wms/allocateOrder/' + aoId, @@ -54,3 +62,17 @@ export const addAllocateOrderDetail = (data) => { data, }); }; + +export const viewAllocateOrderDetail = (aoId) => { + return request({ + url: '/wms/allocateOrderDetail/' + aoId, + method: 'get' + }); +}; + +export const delAllocateOrderDetail = (aoDId) => { + return request({ + url: '/wms/allocateOrderDetail/removeDetail/' + aoDId, + method: 'delete' + }); +}; diff --git a/src/views/wms/linkage/index.vue b/src/views/wms/linkage/index.vue index fa950b1..9fd6ed6 100644 --- a/src/views/wms/linkage/index.vue +++ b/src/views/wms/linkage/index.vue @@ -5,26 +5,9 @@ - - - - - - - - - 查询 + 重置 @@ -43,15 +26,15 @@ 删除 - - 导出 - + + + - @@ -99,9 +82,9 @@ @@ -296,7 +376,7 @@ import { viewAllocateOrder, addAllocateOrder, addAllocateOrderDetail, - getMaterialList + getMaterialList, viewAllocateOrderDetail, delAllocateOrderDetail, allocateOrderUpdate } from '@/api/wms/linkage' import {reactive} from 'vue' @@ -315,7 +395,6 @@ const { wms_allocate_way } = toRefs(proxy?.useDict('approve_status', 'material_mategories', 'mes_material_categories', 'wms_allocate_status', 'wms_allocate_create', 'wms_allocate_way')); -console.log(mes_material_categories.value) interface User { date: string @@ -325,8 +404,12 @@ interface User { const parentTableTotal = ref(0) const dialogVisible = ref(false) +const parentTableInfoVisible = ref(false) +const childrenTableInfoSubmit = ref(false) const dialogTitle = ref('添加') const dialogForm = ref({}) +const parentTableInfoForm = ref({}) +const childrenTableInfoForm = ref({}) const queryForm = ref({ allocateCode: '', @@ -344,6 +427,7 @@ const materialList = ref([]); const parentTableLoad = ref(false) const childrenTableLoad = ref(false) const isView = ref(false) +const partntTableSelectCell = ref({}) // 获取仓库 getBaseWarehouseList().then(e => { @@ -360,7 +444,12 @@ const getParentTable = async () => { parentTableLoad.value = false parentTableData.value = e.rows parentTableTotal.value = e.total - await getChildrenTable({query: e.rows[0].aoId}) + if (e.rows.length > 0) { + parentTableRef.value.setCurrentRow(e.rows[0]) + await getChildrenTable({allocateCode: e.rows[0].allocateOrderCode}) + } else { + childrenTableData.value = [] + } }) } @@ -376,24 +465,22 @@ const getChildrenTable = async (form) => { getParentTable() - -const handleEdit = (index: number, row: User) => { - console.log(index, row) -} -const handleDelete = (index: number, row: User) => { - console.log(index, row) -} // 查询 const query = async () => { - console.log(queryForm) ids.value = [] parentTableRef.value?.clearSelection() await getParentTable() } +const reset = () => { + queryForm.value = { + allocateOrderCode: '' + } +} // 父表格行点击 const parentTableCellClick = async (e) => { - await getChildrenTable({query: e.aoId}) + partntTableSelectCell.value = e + await getChildrenTable({allocateCode: e.allocateOrderCode}) } // 表格多选 @@ -412,9 +499,11 @@ const viewDetails = (e) => { // 父表格新增 const parentTableAdd = () => { dialogVisible.value = true + dialogForm.value = {} + dialogtable.value = [] } // 父表格修改 -const parentTableUpdate = (e) => { +const parentTableUpdate = async (e) => { let id = ref(null) if (e) { id.value = e.aoId @@ -422,7 +511,8 @@ const parentTableUpdate = (e) => { id.value = ids.value?.[0] } if (!id.value) return - dialogVisible.value = true + parentTableInfoForm.value = (await viewAllocateOrder(id.value)).data + parentTableInfoVisible.value = true } // 父表格删除 const parentTableDelete = async (e) => { @@ -459,6 +549,7 @@ const parentTableDelete = async (e) => { } +// 获取物料列表 const setMaterialList = (materialCategories) => { getMaterialList({materialCategories}).then(e => { materialList.value = e.data @@ -470,18 +561,68 @@ const addDialogTableCell = () => { dialogtable.value.push({}) } -// dialog提交 +// 新增提交 const dialogSubmit = () => { addAllocateOrder(dialogForm.value).then(e => { - console.log(e) - addAllocateOrderDetail({WmsAllocateOrderDetailBo: dialogtable.value.map(item=>{return {...item,allocateCode: e.msg, }})}).then(v => { + addAllocateOrderDetail(dialogtable.value.map(item => { + return {...item, allocateCode: e.msg,} + } + ) + ).then(v => { dialogVisible.value = false getParentTable() }) }) } + +const parentTableInfoSubmit = () =>{ + allocateOrderUpdate(parentTableInfoForm.value).then(e=>{ + ElMessage({ + type: 'success', + message: '修改完成', + }) + parentTableInfoVisible.value = false + getParentTable() + }) +} + +// 子表格修改 +const childrenTableUpdate = async (e) => { + childrenTableInfoForm.value = (await viewAllocateOrderDetail(e.aoDId)).data + childrenTableInfoVisible.value = true +} + + +// 子表格删除 +const childrenTableUDelete = (e) => { + + ElMessageBox.confirm( + '确定要删除这些数据吗?', + 'Warning', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + } + ) + .then(async () => { + await delAllocateOrderDetail(e.aoDId).then(async (e) => { + ElMessage({ + type: 'success', + message: '删除完成', + }) + await getChildrenTable({allocateCode: partntTableSelectCell.value.allocateOrderCode}) + }) + }) + .catch(() => { + ElMessage({ + type: 'info', + message: '取消', + }) + }) +}