From 5cec3e5e1778eaa90d137f8197f48a0c4861b3bd Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Thu, 6 Mar 2025 17:43:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=81=E8=B4=A7=E6=97=A5=E5=8E=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wms/supplierDeliMain/index.ts | 2 - .../deliveryCalendar/deliveryCalendar.data.ts | 23 +++++++--- .../supplierManage/deliveryCalendar/index.vue | 46 +++++++++++++++++-- 3 files changed, 60 insertions(+), 11 deletions(-) diff --git a/src/api/wms/supplierDeliMain/index.ts b/src/api/wms/supplierDeliMain/index.ts index a6afa73a2..8756b3308 100644 --- a/src/api/wms/supplierDeliMain/index.ts +++ b/src/api/wms/supplierDeliMain/index.ts @@ -57,7 +57,5 @@ const getPageParams = (params)=>{ } // 查询供应商便次配置列表 export const getPageTableHead = async (params) => { - // params = getPageParams(params) - console.log('params',params) return await request.get({ url: `/wms/supplier-deli-main/queryPageTableHead`, params }) } \ No newline at end of file diff --git a/src/views/wms/basicDataManage/supplierManage/deliveryCalendar/deliveryCalendar.data.ts b/src/views/wms/basicDataManage/supplierManage/deliveryCalendar/deliveryCalendar.data.ts index 7883de010..48078b0cc 100644 --- a/src/views/wms/basicDataManage/supplierManage/deliveryCalendar/deliveryCalendar.data.ts +++ b/src/views/wms/basicDataManage/supplierManage/deliveryCalendar/deliveryCalendar.data.ts @@ -2,6 +2,7 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as SupplierApi from '@/api/wms/supplier' import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' +import { formatDate } from '@/utils/formatTime' // 表单校验 export const DeliveryCalendarRules = reactive({ @@ -76,12 +77,22 @@ export const DeliveryCalendar = useCrudSchemas( sort: 'custom', isSearch: true }, - { - label: '日期', - field: 'day', - sort: 'custom', - isSearch: true - }, + { + label: '日期', + field: 'yearAndMonth', + sort: 'custom', + isTable: false, + isForm: false, + isSearch: true, + search: { + component: 'DatePicker', + value: formatDate(new Date(),'YYYYMM'), + componentProps: { + type: 'month', + valueFormat: 'YYYYMM', + } + } + }, { label: '操作', field: 'action', diff --git a/src/views/wms/basicDataManage/supplierManage/deliveryCalendar/index.vue b/src/views/wms/basicDataManage/supplierManage/deliveryCalendar/index.vue index 44051e688..83cd8377e 100644 --- a/src/views/wms/basicDataManage/supplierManage/deliveryCalendar/index.vue +++ b/src/views/wms/basicDataManage/supplierManage/deliveryCalendar/index.vue @@ -32,6 +32,10 @@ {{ row.code }} + @@ -65,6 +69,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons' import TableHead from '@/components/TableHead/src/TableHead.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import Detail from '@/components/Detail/src/Detail.vue' +import * as SupplierDeliMainApi from '@/api/wms/supplierDeliMain' defineOptions({ name: 'DeliveryCalendar' }) @@ -74,6 +79,7 @@ const { t } = useI18n() // 国际化 const route = useRoute() // 路由信息 const routeName = ref() routeName.value = route.name +const orginTableColumns = ref(DeliveryCalendar.allSchemas.tableColumns) const tableColumns = ref(DeliveryCalendar.allSchemas.tableColumns) // 查询页面返回 @@ -89,9 +95,9 @@ const searchTableSuccess = (formField, searchField, val, formRef) => { } // 字段设置 更新主列表字段 -const updataTableColumns = (val) => { - tableColumns.value = val -} +// const updataTableColumns = (val) => { +// tableColumns.value = val +// } const { tableObject, tableMethods } = useTable({ getListApi: DeliveryCalendarApi.getDeliveryCalendarPage // 分页接口 @@ -238,8 +244,42 @@ const searchFormClick = (searchData) => { getList() // 刷新当前列表 } +const { tableObject:tableObjectHead, tableMethods:tableMethodsHead } = useTable({ + getListApi: SupplierDeliMainApi.getPageTableHead // 分页接口 +}) + +// 获得表格的各种操作 +const { getList: getListHead, setSearchParams: setSearchParamsHead } = tableMethodsHead +const dateColumns = ref([]) +watch(()=>tableObjectHead.tableList,()=>{ + updateDateTableColumns() +},{deep:true}) +const updateDateTableColumns = ()=>{ + console.log('tableObjectHead', tableObjectHead) + dateColumns.value = [] + if(tableObjectHead.tableList.length>10){ + tableObjectHead.tableList.forEach(item=>{ + dateColumns.value.push({ + width:120, + field: item, + label: item + }) + }) + }else{ + tableObjectHead.tableList.forEach(item=>{ + dateColumns.value.push({ + field: item, + label: item + }) + }) + } + tableColumns.value = [...orginTableColumns.value,...dateColumns.value] + console.log('tableColumns',tableColumns.value) +} + /** 初始化 **/ onMounted(async () => { + getListHead() getList() importTemplateData.templateUrl = await DeliveryCalendarApi.importTemplate() })