diff --git a/package.json b/package.json index 0504fbe..c13ab54 100644 --- a/package.json +++ b/package.json @@ -20,12 +20,11 @@ "url": "https://gitee.com/" }, "dependencies": { - "@ag-grid-community/client-side-row-model": "^32.3.4", "@element-plus/icons-vue": "2.3.1", + "@handsontable/vue3": "^15.2.0", "@highlightjs/vue-plugin": "2.1.0", "@vueup/vue-quill": "1.2.0", "@vueuse/core": "11.3.0", - "ag-grid-vue3": "^32.3.4", "animate.css": "4.1.1", "await-to-js": "3.0.0", "axios": "1.7.8", @@ -36,6 +35,7 @@ "element-plus": "2.8.8", "file-saver": "2.0.5", "fuse.js": "7.0.0", + "handsontable": "^15.2.0", "highlight.js": "11.9.0", "image-conversion": "2.1.1", "js-cookie": "3.0.5", diff --git a/src/api/amz/logisticsQuote/index.ts b/src/api/amz/logisticsQuote/index.ts index a60529b..420ded8 100644 --- a/src/api/amz/logisticsQuote/index.ts +++ b/src/api/amz/logisticsQuote/index.ts @@ -42,6 +42,17 @@ export const getLogisticsQuote = (id: string | number): AxiosPromise { + return request({ + url: '/amz/logisticsQuote/today-quote-status', + method: 'get' + }); +}; + /** * 新增物流报价 * @param data diff --git a/src/utils/permission.ts b/src/utils/permission.ts index eb3838a..c0cd1e1 100644 --- a/src/utils/permission.ts +++ b/src/utils/permission.ts @@ -1,51 +1,56 @@ -import useUserStore from '@/store/modules/user'; +// src/utils/permission.ts +import { useUserStore } from '@/store/modules/user'; -/** - * 字符权限校验 - * @param {Array} value 校验值 - * @returns {Boolean} - */ -export const checkPermi = (value: any) => { - if (value && value instanceof Array && value.length > 0) { - const permissions = useUserStore().permissions; - const permissionDatas = value; - const all_permission = '*:*:*'; +// 权限校验方法(替代指令的核心逻辑) +export const checkPermi = (perms: string[]): boolean => { + const { permissions } = useUserStore(); - const hasPermission = permissions.some((permission) => { - return all_permission === permission || permissionDatas.includes(permission); - }); - - if (!hasPermission) { - return false; - } - return true; - } else { - console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`); - return false; + if (!Array.isArray(perms) || perms.length === 0) { + throw new Error("权限参数格式错误,示例: checkPermi(['sys:user:edit'])"); } + + return permissions.some((p) => p === '*:*:*' || perms.includes(p)); }; -/** - * 角色权限校验 - * @param {Array} value 校验值 - * @returns {Boolean} - */ -export const checkRole = (value: any): boolean => { - if (value && value instanceof Array && value.length > 0) { - const roles = useUserStore().roles; - const permissionRoles = value; - const super_admin = 'admin'; +// 角色校验方法 +export const checkRoles = (roles: string[]): boolean => { + const { roles: userRoles } = useUserStore(); - const hasRole = roles.some((role) => { - return super_admin === role || permissionRoles.includes(role); - }); - - if (!hasRole) { - return false; - } - return true; - } else { - console.error(`need roles! Like checkRole="['admin','editor']"`); - return false; + if (!Array.isArray(roles) || roles.length === 0) { + throw new Error("角色参数格式错误,示例: checkRoles(['admin'])"); } + + return userRoles.some((r) => r === 'superadmin' || r === 'admin' || roles.includes(r)); +}; + +// 操作列权限渲染器 +export const actionRenderer: Handsontable.renderers.Base = (instance, td, row, col, prop, value, cellProperties) => { + const rowData = instance.getDataAtRow(row); + const canEdit = checkPermi(['amz:logisticsOrderDetail:edit']); + const canDelete = checkPermi(['amz:logisticsOrderDetail:remove']); + + td.innerHTML = ` +
+ ${ + canEdit + ? ` + + ` + : '' + } + ${ + canDelete + ? ` + + ` + : '' + } +
+ `; + + return td; }; diff --git a/src/views/amz/inquiryRequest/index.vue b/src/views/amz/inquiryRequest/index.vue index 1405a24..3cf2e9f 100644 --- a/src/views/amz/inquiryRequest/index.vue +++ b/src/views/amz/inquiryRequest/index.vue @@ -109,7 +109,7 @@ - + @@ -320,6 +320,7 @@ const initFormData: InquiryRequestForm = { effectiveEndTime: undefined }; const initQuoteForm: LogisticsMostQuoteForm = { + id: undefined, userId: undefined, destination: undefined, transportChannel: undefined, @@ -468,6 +469,10 @@ const submitQuoteForm = async () => { console.log('submitQuoteForm', data.quoteForm); const res = await addMostLogisticsQuote(data.quoteForm); console.log('submitQuoteForm', res); + if (res.code === 200) { + ElMessage.success('提交成功'); + quoteDialog.visible = false; + } }; const saveQuoteForm = () => { @@ -492,6 +497,7 @@ const handleDelete = async (row?: InquiryRequestVO) => { const handleSubmit = async (row?: InquiryRequestVO) => { console.log('handleSubmit'); console.log(row.channelId); + data.quoteForm.id = row.id; data.quoteForm.destination = row.destination; data.quoteForm.transportChannel = row.transportChannel; data.quoteForm.channelId = row.channelId; diff --git a/src/views/amz/logisticsChannel/index.vue b/src/views/amz/logisticsChannel/index.vue index ad3d25b..c213986 100644 --- a/src/views/amz/logisticsChannel/index.vue +++ b/src/views/amz/logisticsChannel/index.vue @@ -75,9 +75,21 @@ - - - + + + + + + + + + + + + + + + + diff --git a/src/views/amz/logisticsQuote/index.vue b/src/views/amz/logisticsQuote/index.vue index 1f4cae9..609f866 100644 --- a/src/views/amz/logisticsQuote/index.vue +++ b/src/views/amz/logisticsQuote/index.vue @@ -32,7 +32,7 @@ - 搜索 + 搜索 重置 @@ -89,7 +89,6 @@ - @@ -101,19 +100,36 @@ {{ parseTime(scope.row.quoteDate, '{y}-{m}-{d}') }} - + + + - @@ -170,11 +186,20 @@