From 58d4209ac80ad56371c707edff8415d0b520e1bf Mon Sep 17 00:00:00 2001 From: yufei0306 <13417315+yufei0306@user.noreply.gitee.com> Date: Tue, 9 Apr 2024 11:27:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E9=80=80=E8=B4=A7=E7=94=B3?= =?UTF-8?q?=E8=AF=B7--=E6=96=B0=E5=A2=9E--=E6=B7=BB=E5=8A=A0=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SearchTable/src/SearchTable.vue | 12 +- .../purchasereturnRequestMain/index.vue | 134 ++++++++++++++---- 2 files changed, 116 insertions(+), 30 deletions(-) diff --git a/src/components/SearchTable/src/SearchTable.vue b/src/components/SearchTable/src/SearchTable.vue index 011ff68f4..cfee305e9 100644 --- a/src/components/SearchTable/src/SearchTable.vue +++ b/src/components/SearchTable/src/SearchTable.vue @@ -68,6 +68,16 @@ const rowRef = ref() const allSchemasRef = ref() const multipleBol = ref(false) const searchConditionRef = ref() + +const openData = (titleName: any, tableObject:any ,allSchemas: any,multiple: any) => { + dialogTitle.value = titleName + tableObjectRef.value = tableObject + searchDialogVisible.value = true + multipleBol.value = multiple + allSchemasRef.value = allSchemas + searchSchema.value = allSchemas.searchSchema + tableColumns.value = allSchemas.tableColumns +} const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any,multiple: any, type: any, row: any, searchCondition:any , isCountRequestRe:any ) => { searchDialogVisible.value = true formFieldRef.value = formField @@ -137,7 +147,7 @@ const searchFormClick = (searchData) => { getListRef.value() // 刷新当前列表 } -defineExpose({ open }) // 提供 open 方法,用于打开弹窗 +defineExpose({ open,openData }) // 提供 open 方法,用于打开弹窗 // Table 组件 ref const searchTableRef = ref() diff --git a/src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue b/src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue index 8fc36f93f..01f83181a 100644 --- a/src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue +++ b/src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue @@ -63,6 +63,8 @@ @searchTableSuccess="searchTableSuccess" @submitForm="submitForm" /> + + } else { const setV = {} if(formField == 'purchaseReceiptRecordNumber'){ - isShowButton.value = false + // isShowButton.value = false setV[formField] = val[0][searchField] setV['purchaseReceiptRecordNumber'] = val[0]['number'] setV['supplierCode'] = val[0]['supplierCode'] @@ -205,6 +207,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) => // item.fromLocationCode = item.fromLocationCode // item.fromLocationGroupCode = item.fromLocationGroupCode }) + originTableData.value = JSON.parse(JSON.stringify(tableData.value)) PurchasereturnRequestMain.allSchemas.formSchema.forEach((item) => { if (item.field == 'supplierCode') { @@ -422,6 +425,7 @@ const buttonTableClick = async (val, row) => { /** 添加/修改操作 */ const formRef = ref() const openForm = async (type: string, row?: number) => { + originTableData.value = [] // 重置明细数据 tableData.value = [] // 重置明细数据 isShowButton.value = true if(type == 'create'){ @@ -564,38 +568,110 @@ PurchasereturnRequestDetail.allSchemas.tableFormColumns.forEach((item) => { tableFormKeys[item.field] = item.default ? item.default : '' }) const tableData = ref([]) +const originTableData = ref([]) + +const searchTableRef = ref() // 添加明细 const handleAddTable = () => { - tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) - let purchaseReceiptRecordNumber = formRef.value.formRef.formModel.purchaseReceiptRecordNumber - PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => { - item.tableForm.disabled = true - if (item.field == 'remark') { - item.tableForm.disabled = false - } - if (item.field == 'reason') { - item.tableForm.disabled = false - } - if (item.field == 'qty') { - item.tableForm.disabled = false - } - if(purchaseReceiptRecordNumber == ''){ - if (item.field == 'itemCode') { - item.tableForm.isInpuFocusShow = true - } - if(item.field == 'poLine'){ - item.tableForm.isInpuFocusShow = false - } - }else{ - if (item.field == 'itemCode') { - item.tableForm.isInpuFocusShow = false - } - if(item.field == 'poLine'){ - item.tableForm.isInpuFocusShow = true - } - } + + const subTableDFata = originTableData.value.filter(item=> !tableData.value.find(item1=>item1.id == item.id)) + if(subTableDFata.length==0){ + message.warning('暂无可选择数据!') + return + } + + const tableObject = { + // 当前页 + currentPage: 1, + // 导出加载中 + exportLoading: false, + // 加载中 + loading: false, + // 页数 + pageSize: subTableDFata.length, + params:null, + // 排序 + sort: { + order: '', // 排序规则 + prop: '' // 排序字段 + }, + // 总条数 + total: subTableDFata.length, + // 表格数据 + tableList: subTableDFata, + currentRow:null + } + + const tableColumns = PurchasereturnRequestDetail.allSchemas.tableFormColumns + tableColumns.forEach((item) => { + item.width = item.table?.width || 150 }) + + searchTableRef.value.openData("采购收货记录单号",tableObject,{tableColumns},true) + // searchTableRef.value.open( + // ('供应商信息', + // // _searchTableAllSchemas, + // // _searchTablePage, // 接口 + // // formField, + // // searchField, + // true,//是否多选 + // // type, + // // row, + // _searchCondition + // ) + // ) + + + // console.log(subTableDFata) + // const {tableObject, tableMethods } = useTable({ + // getListApi: getPage.value // 分页接口 + // }) + // searchTableRef.value.open( + // ('供应商信息', + // // _searchTableAllSchemas, + // // _searchTablePage, // 接口 + // // formField, + // // searchField, + // true,//是否多选 + // // type, + // // row, + // _searchCondition + // ) + // ) + // tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) + // let purchaseReceiptRecordNumber = formRef.value.formRef.formModel.purchaseReceiptRecordNumber + // PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => { + // item.tableForm.disabled = true + // if (item.field == 'remark') { + // item.tableForm.disabled = false + // } + // if (item.field == 'reason') { + // item.tableForm.disabled = false + // } + // if (item.field == 'qty') { + // item.tableForm.disabled = false + // } + // if(purchaseReceiptRecordNumber == ''){ + // if (item.field == 'itemCode') { + // item.tableForm.isInpuFocusShow = true + // } + // if(item.field == 'poLine'){ + // item.tableForm.isInpuFocusShow = false + // } + // }else{ + // if (item.field == 'itemCode') { + // item.tableForm.isInpuFocusShow = false + // } + // if(item.field == 'poLine'){ + // item.tableForm.isInpuFocusShow = true + // } + // } + // }) +} +const searchTableSuccess1 = (formField, searchField, val, formRef, type, row) => { + console.log(val) + tableData.value = [...tableData.value,...val] } // 删除明细 const handleDeleteTable = (item, index, formRef) => {