From 4a9c1b4daa5592bed523bf1e04739940d0d04e1b Mon Sep 17 00:00:00 2001 From: zhaoyiran Date: Tue, 4 Mar 2025 16:25:42 +0800 Subject: [PATCH] =?UTF-8?q?YT-1979=E3=80=8A=E4=BE=9B=E5=BA=94=E5=95=86?= =?UTF-8?q?=E4=BE=BF=E6=AC=A1=E9=85=8D=E7=BD=AE=E8=A1=A8=E3=80=8B=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wms/supplierDeliMain/index.ts | 25 ++++-- .../supplierManage/supplierDeliMain/index.vue | 84 +++++++++++++++---- .../supplierDeliMain/supplierDeliMain.data.ts | 18 ++++ 3 files changed, 102 insertions(+), 25 deletions(-) diff --git a/src/api/wms/supplierDeliMain/index.ts b/src/api/wms/supplierDeliMain/index.ts index af30d1239..a6afa73a2 100644 --- a/src/api/wms/supplierDeliMain/index.ts +++ b/src/api/wms/supplierDeliMain/index.ts @@ -17,38 +17,47 @@ export const getSupplierDeliMainPage = async (params) => { if (params.isSearch) { delete params.isSearch const data = {...params} - return await request.post({ url: '/basic/supplier-deli-main/senior', data }) + return await request.post({ url: '/wms/supplier-deli-main/senior', data }) } else { - return await request.get({ url: `/basic/supplier-deli-main/page`, params }) + return await request.get({ url: `/wms/supplier-deli-main/page`, params }) } } // 查询供应商便次配置主详情 export const getSupplierDeliMain = async (id: number) => { - return await request.get({ url: `/basic/supplier-deli-main/get?id=` + id }) + return await request.get({ url: `/wms/supplier-deli-main/get?id=` + id }) } // 新增供应商便次配置主 export const createSupplierDeliMain = async (data: SupplierDeliMainVO) => { - return await request.post({ url: `/basic/supplier-deli-main/create`, data }) + return await request.post({ url: `/wms/supplier-deli-main/create`, data }) } // 修改供应商便次配置主 export const updateSupplierDeliMain = async (data: SupplierDeliMainVO) => { - return await request.put({ url: `/basic/supplier-deli-main/update`, data }) + return await request.put({ url: `/wms/supplier-deli-main/update`, data }) } // 删除供应商便次配置主 export const deleteSupplierDeliMain = async (id: number) => { - return await request.delete({ url: `/basic/supplier-deli-main/delete?id=` + id }) + return await request.delete({ url: `/wms/supplier-deli-main/delete?id=` + id }) } // 导出供应商便次配置主 Excel export const exportSupplierDeliMain = async (params) => { - return await request.download({ url: `/basic/supplier-deli-main/export-excel`, params }) + return await request.download({ url: `/wms/supplier-deli-main/export-excel`, params }) } // 下载用户导入模板 export const importTemplate = () => { - return request.download({ url: '/basic/supplier-deli-main/get-import-template' }) + return request.download({ url: '/wms/supplier-deli-main/get-import-template' }) +} + +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/supplierManage/supplierDeliMain/index.vue b/src/views/wms/supplierManage/supplierDeliMain/index.vue index c94bdbf9b..e2cdf87e2 100644 --- a/src/views/wms/supplierManage/supplierDeliMain/index.vue +++ b/src/views/wms/supplierManage/supplierDeliMain/index.vue @@ -35,10 +35,6 @@ - - @@ -72,16 +68,70 @@ import Detail from '@/components/Detail/src/Detail.vue' defineOptions({ name: 'SupplierDeliMain' }) +// const array = [{ +// field: "code1", +// isForm: false, +// isTable: true, +// isSearch: true, +// label: "编码1", +// sort: "custom", +// sortTableDefault: 999, +// width: 150, +// table:{ +// width: 150, +// } +// }] + +const orginTableColumns = ref(SupplierDeliMain.allSchemas.tableColumns) +const tableColumns = ref(SupplierDeliMain.allSchemas.tableColumns) +// 字段设置 更新主列表字段 +const updataTableColumns = (val: { [x: string]: any; field: string; label?: string | undefined; width?: string | number | undefined; fixed?: "left" | "right" | undefined; children?: any[] | undefined }[]) => { + orginTableColumns.value = val +} + +const { tableObject:tableObjectHead, tableMethods:tableMethodsHead } = useTable({ + getListApi: SupplierDeliMainApi.getPageTableHead // 分页接口 +}) + +// 获得表格的各种操作 +const { getList:getListHead, setSearchParams:setSearchParamsHead } = tableMethodsHead + +watch(()=>tableObjectHead.tableList,()=>{ + updateDateTableColumns() +},{deep:true}) +const updateDateTableColumns = ()=>{ + console.log('tableObjectHead',tableObjectHead) + let dateColumns = [] + if(tableObjectHead.tableList.length>10){ + tableObjectHead.tableList.forEach(item=>{ + dateColumns.push({ + width:120, + field: item, + label: item + }) + }) + }else{ + tableObjectHead.tableList.forEach(item=>{ + dateColumns.push({ + field: item, + label: item + }) + }) + } + tableColumns.value = [...orginTableColumns.value,...dateColumns] + console.log('tableColumns',tableColumns.value) +} + const message = useMessage() // 消息弹窗 const { t } = useI18n() // 国际化 const route = useRoute() // 路由信息 const routeName = ref() routeName.value = route.name -const tableColumns = ref(SupplierDeliMain.allSchemas.tableColumns) +// const tableColumns = ref(SupplierDeliMain.allSchemas.tableColumns) // 查询页面返回 -const searchTableSuccess = (formField, searchField, val, formRef) => { +const searchTableSuccess = (formField: string | number, searchField: string | number, val: { [x: string]: any }[], formRef: { setValues: (arg0: {}) => void }) => { nextTick(() => { const setV = {} setV[formField] = val[0][searchField] @@ -90,9 +140,9 @@ const searchTableSuccess = (formField, searchField, val, formRef) => { } // 字段设置 更新主列表字段 -const updataTableColumns = (val) => { - tableColumns.value = val -} +// const updataTableColumns = (val) => { +// tableColumns.value = val +// } const { tableObject, tableMethods } = useTable({ getListApi: SupplierDeliMainApi.getSupplierDeliMainPage // 分页接口 @@ -105,7 +155,7 @@ const { getList, setSearchParams } = tableMethods const HeadButttondata = [ // defaultButtons.defaultAddBtn({hasPermi:'wms:supplierDeliMain:create'}), // 新增 // defaultButtons.defaultImportBtn({hasPermi:'wms:supplierDeliMain:import'}), // 导入 - defaultButtons.defaultExportBtn({hasPermi:'basic:supplier-deli-main:export'}), // 导出 + defaultButtons.defaultExportBtn(null), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 // defaultButtons.defaultFilterBtn(null), // 筛选 defaultButtons.defaultSetBtn(null), // 设置 @@ -120,7 +170,7 @@ const HeadButttondata = [ ] // 头部按钮事件 -const buttonBaseClick = (val, item) => { +const buttonBaseClick = (val: string, item: any) => { if (val == 'add') { // 新增 openForm('create') } else if (val == 'import') { // 导入 @@ -128,6 +178,7 @@ const buttonBaseClick = (val, item) => { } else if (val == 'export') { // 导出 handleExport() } else if (val == 'refresh') { // 刷新 + getListHead() getList() } else if (val == 'filtrate') { // 筛选 } else { // 其他按钮 @@ -142,7 +193,7 @@ const butttondata = [ ] // 列表-操作按钮事件 -const buttonTableClick = async (val, row) => { +const buttonTableClick = async (val: string, row: { id: number }) => { if (val == 'edit') { // 编辑 openForm('update', row) } else if (val == 'delete') { // 删除 @@ -157,7 +208,7 @@ const openForm = (type: string, row?: any) => { } // form表单提交 -const formsSuccess = async (formType,data) => { +const formsSuccess = async (formType: string,data: SupplierDeliMainApi.SupplierDeliMainVO) => { var isHave =SupplierDeliMain.allSchemas.formSchema.some(function (item) { return item.field === 'activeTime' || item.field === 'expireTime'; }); @@ -231,7 +282,7 @@ const importSuccess = () => { } // 筛选提交 -const searchFormClick = (searchData) => { +const searchFormClick = (searchData: { filters: any }) => { tableObject.params = { isSearch: true, filters: searchData.filters @@ -241,9 +292,8 @@ const searchFormClick = (searchData) => { /** 初始化 **/ onMounted(async () => { - tableObject.params = { - isSearch: true - } + getListHead() + getList() importTemplateData.templateUrl = await SupplierDeliMainApi.importTemplate() }) diff --git a/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts b/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts index 1951c66cd..ec2743cf2 100644 --- a/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts +++ b/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts @@ -13,18 +13,36 @@ export const SupplierDeliMain = useCrudSchemas(reactive([ field: 'supplierCode', sort: 'custom', isSearch: true, + table:{ + width : 180 + } }, { label: '供应商地点', field: 'supplierAddress', sort: 'custom', isSearch: true, + table:{ + width : 180 + } }, { label: '受入号', field: 'model', sort: 'custom', isSearch: true, + table:{ + width : 180 + } + }, + { + label: '延迟便次', + field: 'delayDeli', + sort: 'custom', + isSearch: false, + table:{ + width : 180 + } }, { label: '年月',