From 8561ad274017ffe68f9d036e5eeea79f5d9dd8c4 Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Thu, 4 Jul 2024 17:04:52 +0800 Subject: [PATCH] bug --- .../demandforecastingMain/index.vue | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue b/src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue index aaea984b8..864c3eae6 100644 --- a/src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue @@ -58,21 +58,8 @@ const tableColumns = ref(DemandforecastingMain.allSchemas.tableColumns) const updataTableColumns = (val) => { orginTableColumns.value = val } -const updateDateTableColumns = ()=>{ - console.log('tableObjectHead',tableObjectHead) - let dateColumns = [] - tableObjectHead.tableList.forEach(item=>{ - dateColumns.push({ - field: item, - label: item, - table:{ - width: 120 - } - }) - }) - tableColumns.value = [...orginTableColumns.value,...dateColumns] - console.log('tableColumns',tableColumns.value) -} + + // 查询页面返回 const searchQueryTableSuccess = (formField, searchField, val, formRef, type, row ) => { @@ -102,6 +89,24 @@ const { tableObject:tableObjectHead, tableMethods:tableMethodsHead } = useTable( // 获得表格的各种操作 const { getList:getListHead, setSearchParams:setSearchParamsHead } = tableMethodsHead +watch(()=>tableObjectHead.tableList,()=>{ + updateDateTableColumns() +},{deep:true}) +const updateDateTableColumns = ()=>{ + console.log('tableObjectHead',tableObjectHead) + let dateColumns = [] + tableObjectHead.tableList.forEach(item=>{ + dateColumns.push({ + field: item, + label: item, + table:{ + width: 120 + } + }) + }) + tableColumns.value = [...orginTableColumns.value,...dateColumns] + console.log('tableColumns',tableColumns.value) +} const { tableObject, tableMethods } = useTable({ getListApi: DemandforecastingDetailApi.getDemandforecastingDetailPage // 分页接口 }) @@ -128,7 +133,7 @@ const buttonBaseClick = async (val, item) => { }) } else { await getListHead() - updateDateTableColumns() + // updateDateTableColumns() getList() } @@ -143,7 +148,7 @@ const buttonBaseClick = async (val, item) => { const searchClick = async (data)=>{ console.log('searchClick',data) await setSearchParamsHead(data) - updateDateTableColumns() + // updateDateTableColumns() setSearchParams(data) } /** 导出按钮操作 */ @@ -181,7 +186,7 @@ const searchFormClick = (searchData) => { /** 初始化 **/ onMounted(async () => { await getListHead() - updateDateTableColumns() + // updateDateTableColumns() getList() importTemplateData.templateUrl = await DemandforecastingMainApi.importTemplate() })