diff --git a/package.json b/package.json index 0ffb576..0504fbe 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,12 @@ "url": "https://gitee.com/" }, "dependencies": { + "@ag-grid-community/client-side-row-model": "^32.3.4", "@element-plus/icons-vue": "2.3.1", "@highlightjs/vue-plugin": "2.1.0", "@vueup/vue-quill": "1.2.0", "@vueuse/core": "11.3.0", - "ag-grid-vue3": "^33.1.1", + "ag-grid-vue3": "^32.3.4", "animate.css": "4.1.1", "await-to-js": "3.0.0", "axios": "1.7.8", diff --git a/src/views/amz/logisticsOrderDetail/index.vue b/src/views/amz/logisticsOrderDetail/index.vue index 86ff0a9..a53eeab 100644 --- a/src/views/amz/logisticsOrderDetail/index.vue +++ b/src/views/amz/logisticsOrderDetail/index.vue @@ -108,54 +108,64 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -257,8 +267,91 @@ import { } from '@/api/amz/logisticsOrderDetail'; import { LogisticsOrderDetailVO, LogisticsOrderDetailQuery, LogisticsOrderDetailForm } from '@/api/amz/logisticsOrderDetail/types'; +import { AgGridVue } from 'ag-grid-vue3'; +import 'ag-grid-community/styles/ag-grid.css'; +import 'ag-grid-community/styles/ag-theme-alpine.css'; + +import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model'; +import { ModuleRegistry } from '@ag-grid-community/core'; +// 注册必需模块 +ModuleRegistry.registerModules([ClientSideRowModelModule]); + +// 如果使用其他功能,需要添加对应模块 +// import { RowGroupingModule } from '@ag-grid-enterprise/row-grouping'; +// import { ClipboardModule } from '@ag-grid-enterprise/clipboard'; + +// ModuleRegistry.registerModules([RowGroupingModule, ClipboardModule]); + const { proxy } = getCurrentInstance() as ComponentInternalInstance; +import { checkPermi } from '@/utils/permission'; + +const parseTimeGlobal = (value, format) => { + return proxy.$parseTime(value, format); +}; + +const loadingTemplate = '加载中...'; + +const columnDefs = ref([ + { + headerName: '', + field: 'selected', + checkboxSelection: true, + headerCheckboxSelection: true, + width: 55, + cellStyle: { 'text-align': 'center' } + }, + { headerName: '订单号', field: 'orderId', cellStyle: { 'text-align': 'center' } }, + { headerName: 'FBA货件编号', field: 'fbaShipmentId', cellStyle: { 'text-align': 'center' } }, + { headerName: 'FBA箱号', field: 'fbaBoxNumber', cellStyle: { 'text-align': 'center' } }, + // 其他普通列... + { + headerName: '预计签收日期', + field: 'estimatedDeliveryDate', + width: 180, + valueFormatter: (params) => (params.value ? parseTimeGlobal(params.value, '{y}-{m}-{d}') : ''), + cellStyle: { 'text-align': 'center' } + }, + // 实际签收日期列同理... + { + headerName: '操作', + cellStyle: { 'text-align': 'center' }, + cellRenderer: (params) => { + // 权限检查 + const canEdit = checkPermi(['amz:logisticsOrderDetail:edit']); + const canDelete = checkPermi(['amz:logisticsOrderDetail:remove']); + + // 动态生成 HTML + let buttons = ''; + if (canEdit) { + buttons += ` + + + + `; + } + if (canDelete) { + buttons += ` + + + + `; + } + return `
${buttons}
`; + } + } +]); + const logisticsOrderDetailList = ref([]); const buttonLoading = ref(false); const loading = ref(true);