From 864ca910eb61d5baac259c4833cc58602c27b1e8 Mon Sep 17 00:00:00 2001 From: yin <3313488199@qq.com> Date: Fri, 20 Mar 2026 09:03:44 +0800 Subject: [PATCH] =?UTF-8?q?19=E5=8F=B7=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/storage/entry.ts | 28 ++ src/api/storage/receiving.ts | 15 + src/components/UpperTable/index.vue | 6 + src/permission.ts | 13 +- src/router/index.ts | 23 +- src/router/map.ts | 4 + src/utils/request.ts | 18 +- .../storage/entry/component/entrydetail.vue | 161 ++++++ .../storage/entry/component/entryoperate.vue | 167 +++++++ src/views/storage/entry/component/log.vue | 9 + src/views/storage/entry/entry-config.ts | 111 +++++ src/views/storage/entry/index.vue | 460 ++++++++++++++++++ .../storage/receiving/component/Product.vue | 308 +++++++----- src/views/storage/receiving/index.vue | 75 ++- .../storage/receiving/receiving-config.ts | 29 +- src/views/storage/stock/index.vue | 9 + 16 files changed, 1281 insertions(+), 155 deletions(-) create mode 100644 src/api/storage/entry.ts create mode 100644 src/views/storage/entry/component/entrydetail.vue create mode 100644 src/views/storage/entry/component/entryoperate.vue create mode 100644 src/views/storage/entry/component/log.vue create mode 100644 src/views/storage/entry/entry-config.ts create mode 100644 src/views/storage/entry/index.vue create mode 100644 src/views/storage/stock/index.vue diff --git a/src/api/storage/entry.ts b/src/api/storage/entry.ts new file mode 100644 index 00000000..2f7e04c9 --- /dev/null +++ b/src/api/storage/entry.ts @@ -0,0 +1,28 @@ +import request from '@/utils/request' +const v = "1.0" + +export function getEntryList(data:any): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.entry.getEntryList', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} + +export function getEntryDetail(data:any): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.entry.getEntryDetail', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} \ No newline at end of file diff --git a/src/api/storage/receiving.ts b/src/api/storage/receiving.ts index 6e1cc58d..c464ae59 100644 --- a/src/api/storage/receiving.ts +++ b/src/api/storage/receiving.ts @@ -14,6 +14,7 @@ export function getReceivingList(data: any): Promise { }) } + export function getReceivingDetail(data: any): Promise { return request({ url: '/system', @@ -27,6 +28,20 @@ export function getReceivingDetail(data: any): Promise { }) } +// 未使用,保留 +export function getReceivingProduct(data: any): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.receiving.getReceivingProduct', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} + export function batchCancelReceiving(data: any): Promise { return request({ url: '/system', diff --git a/src/components/UpperTable/index.vue b/src/components/UpperTable/index.vue index aecd914a..e9097cf1 100644 --- a/src/components/UpperTable/index.vue +++ b/src/components/UpperTable/index.vue @@ -11,6 +11,7 @@ :current-row-key="currentRowKey" @current-change="handleCurrentChange" @row-click="handleRowClick" + @row-contextmenu="handleRowContextMenu" @sort-change="handleSortChange" style="width: 100%" :size="tableSize" @@ -274,6 +275,7 @@ const emit = defineEmits([ 'current-change', 'selection-change', 'row-click', + 'row-contextmenu', 'sort-change', 'page-size-change', 'page-change', @@ -493,6 +495,10 @@ function handleRowClick(row: any, column: any, event: any) { } } +function handleRowContextMenu(row: any, column: any, event: any) { + emit('row-contextmenu', row, column, event) +} + function handleSortChange({ column, prop, order }: any) { emit('sort-change', { column, prop, order }) } diff --git a/src/permission.ts b/src/permission.ts index 6a8c1dcb..6fcbc4df 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -36,11 +36,22 @@ router.beforeEach(async (to, from) => { const permissionStore = usePermissionStore() // generate accessible routes based on menus const accessRoutes = await permissionStore.generateRoutes(user.menus || []) - // console.log("生成的路由表",accessRoutes); + + console.log('从后端获取并转换后的动态路由:', accessRoutes) + console.log('合并后的前端完整路由表 (添加前):', router.getRoutes()) + // dynamically add accessible routes accessRoutes.forEach(route => { router.addRoute(route) }) + + // 打印已添加的动态路由信息与添加后的完整路由表,便于调试 + try { + console.log('已添加的动态路由 paths:', accessRoutes.map(r => r.path)) + } catch (e) { + console.log('已添加的动态路由 (无法列出 paths):', accessRoutes) + } + console.log('合并后的前端完整路由表 (添加后):', router.getRoutes()) // hack method to ensure that addRoutes is complete // set the replace: true, so the navigation will not leave a history record diff --git a/src/router/index.ts b/src/router/index.ts index 942ae24f..4ba1aa1f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -191,14 +191,23 @@ export const transformMenusToRoutes = (menus: any[]) => { if (menu.component) { if (menu.component === 'Layout') { route.component = Layout - } else if (menu.component.startsWith('@/views/')) { - const componentPath = menu.component.replace('@/views/', '') - route.component = resolveComponent(componentPath) - } else if (menu.component.startsWith('@/')) { - const componentPath = menu.component.replace('@/', '') - route.component = () => import(`@/${componentPath}.vue`) + } else if (typeof menu.component === 'string') { + // 正常情况:字符串类型 + if (menu.component.startsWith('@/views/')) { + const componentPath = menu.component.replace('@/views/', '') + route.component = resolveComponent(componentPath) + } else if (menu.component.startsWith('@/')) { + const componentPath = menu.component.replace('@/', '') + route.component = () => import(`@/${componentPath}.vue`) + } else { + route.component = resolveComponent(menu.component) + } } else { - route.component = () => import(`@/views/${menu.component}.vue`) + // 如果后端传回的 component 是一个带有 __file 等不该出现的打包后的对象 + // 通过父子路径拼接去 map 里面找,或者直接截取 path + const fallbackPath = parentName ? `${parentName.toLowerCase()}/${menu.path}` : menu.path; + console.warn(`Invalid component format for path [${menu.path}]. Falling back to use componentMap key: ${fallbackPath}`); + route.component = resolveComponent(fallbackPath); } } else { if (!menu.children || menu.children.length === 0) { diff --git a/src/router/map.ts b/src/router/map.ts index cd36b82d..0b1f1e2e 100644 --- a/src/router/map.ts +++ b/src/router/map.ts @@ -11,6 +11,10 @@ export const componentMap: Record = { 'stock/storestock/index': () => import('@/views/stock/storestock/index.vue'), 'stock/combo_stock/index': () => import('@/views/stock/combo_stock/index.vue'), 'storage/receiving': () => import('@/views/storage/receiving/index.vue'), + 'storage/entry': () => import('@/views/storage/entry/index.vue'), + 'storage/entry/index': () => import('@/views/storage/entry/index.vue'), + 'storage/stock': () => import('@/views/storage/stock/index.vue'), + //'storage/stock/index': () => import('@/views/storage/stock/index.vue'), 'system/setting/printTemplate/index': () => import('@/views/system/setting/printTemplate/index.vue'), // 'system/setting/printStation/index': () => import('@/views/system/setting/printStation/index.vue'), 'system/print/station': () => import('@/views/system/setting/printStation/index.vue'), diff --git a/src/utils/request.ts b/src/utils/request.ts index c7010372..78bb293d 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -79,12 +79,22 @@ service.interceptors.request.use( // response interceptor service.interceptors.response.use( response => { + // 强制转换为小写键以进行不区分大小写的查找 const headers = response.headers const res = response.data - const authHeader = headers['authorization'] || headers['Authorization']; - if (authHeader && authHeader.startsWith('Bearer ')) { - const newToken = authHeader.substring(7) - setToken(newToken) + + // axios 的 headers 对象通常已经处理过大小写,但为了保险起见,检查多种可能的键名 + const newToken = headers['new-token'] || headers['new-authorization'] || headers['authorization'] || headers['Authorization']; + + if (newToken) { + // 提取 Bearer 之后的 token 字符串 + const tokenValue = newToken.startsWith('Bearer ') ? newToken.substring(7) : newToken + if (tokenValue && tokenValue !== getToken()) { + console.log('检测到新 Token,正在更新存储...'); + setToken(tokenValue) + // 同步更新当前实例的默认请求头,确保后续请求立即生效 + service.defaults.headers.common['Authorization'] = `Bearer ${tokenValue}` + } } // 检查业务状态码 diff --git a/src/views/storage/entry/component/entrydetail.vue b/src/views/storage/entry/component/entrydetail.vue new file mode 100644 index 00000000..7728f44d --- /dev/null +++ b/src/views/storage/entry/component/entrydetail.vue @@ -0,0 +1,161 @@ + + + + + diff --git a/src/views/storage/entry/component/entryoperate.vue b/src/views/storage/entry/component/entryoperate.vue new file mode 100644 index 00000000..ac02fabe --- /dev/null +++ b/src/views/storage/entry/component/entryoperate.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/src/views/storage/entry/component/log.vue b/src/views/storage/entry/component/log.vue new file mode 100644 index 00000000..cea42337 --- /dev/null +++ b/src/views/storage/entry/component/log.vue @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/src/views/storage/entry/entry-config.ts b/src/views/storage/entry/entry-config.ts new file mode 100644 index 00000000..79609a5c --- /dev/null +++ b/src/views/storage/entry/entry-config.ts @@ -0,0 +1,111 @@ +export const availableFields = [ + { label:'', value: '', type: 'input' }, + { label: '货主', value: 'store_id', type: 'select', options: [] }, + { label: '状态', value: 'status', type: 'select', options: [ + { label: '待入库', value: 'pending' }, + { label: '入库中', value: 'partial' }, + { label: '已完成', value: 'confirmed' }, + { label: '随机入库中',value: ''}, + { label: '随机入库完成',value: ''}, + { label: '',value: ''}, + { label: '',value: ''}, + { label: '已取消', value: 'cancelled' }, + { label: '',value: ''}, + { label: '',value: ''}, + { label: '',value: ''}, + { label: '',value: ''}, + { label: '',value: ''}, + { label: '',value: ''}, + ]}, + { label: '入库单类型', value: 'type', type: 'select', options: [ + { label: '采购入库单', value: 'purchase' }, + { label: '退货入库单', value: '' }, + { label: '其他入库单', value: 'other' }, + { label: '盘点入库单', value: '' }, + { label: '', value: '' }, + { label: '', value: '' }, + { label: '', value: '' }, + { label: '', value: '' }, + { label: '', value: '' }, + { label: '', value: '' }, + { label: '', value: '' }, + { label: '', value: '' }, + ]}, + { label: '是否同步', value: 'is_synced', type: 'select', options: [ + { label: '是', value: true }, + { label: '否', value: false }, + ]}, + { label: '费用是否记录',value: 'expense_record', type: 'select', options: [ + { label: '是', value: true }, + { label: '否', value: false }, + ]}, + { label: '批次',value: 'batch',type: 'text' }, + { label: '编号',value: 'number',type: 'text' }, + { label: '备注',value: 'remark',type: 'text' }, + { label: 'ERP备注',value: 'erp_remark',type: 'text' }, + { label: '操作员ID',value: 'operator_id',type: 'text' }, + { label: '申请起始日期',value: 'start_date',type: 'daterange' }, + { label: '申请结束日期',value: 'end_date',type: 'daterange' }, + { label: '',value: ''}, + { label: '',value: ''}, + { label: '',value: ''}, + { label: '',value: ''}, +] + +export const entryColums = [ + { prop: 'id',label:'ID',width:'50' }, + { prop: 'entry_order_code',label:'入库单号',width:'160',}, + { prop: 'store_name',label:'货主',width:'140', }, + { prop: 'order_type',label:'类型',width:'160' }, + + { prop: 'purchase_order_code',label:'单据编号 ',width:'160' }, + { prop: 'total_order_lines',label:'商品数',width:'160' }, + { prop: 'order_status',label:'订单状态',width:'160' }, + { prop: 'sync_status',label:'同步状态',width:'160' }, + { prop: 'supplier_code',label:'供应商编码',width:'160' }, + { prop: 'supplier_name',label:'供应商名称',width:'160' }, + { prop: '',label:'',width:'160' }, + { prop: 'express_code',label:'运单号',width:'160' }, + { prop: 'logistics_code',label:'物流公司编码',width:'160' }, + { prop: 'logistics_name',label:'物流公司名称',width:'160' }, + { prop: '',label:'',width:'160',fixed: 'left' }, + { prop: '',label:'',width:'160',fixed: 'left' }, + { prop: 'order_create_time',label:'单据创建时间',width:'160' }, + { prop: 'expect_start_time',label:'预计开始时间',width:'160' }, + { prop: 'expect_end_time',label:'预计结束时间',width:'160' }, + { prop: '',label:'',width:'160',fixed: 'left' }, + { prop: 'source_type',label:'数据来源',width:'160' }, + { prop: '',label:'',width:'160',fixed: 'left' }, + { prop: '',label:'',width:'160',fixed: 'left' }, +] + +export const entrydetail = [ + { prop: 'id', label: 'ID', width: '160' }, + { prop: 'out_biz_code', label: '外部业务编码', width: '160' }, + { prop: 'order_line_no', label: '订单行号', width: '160' }, + { prop: 'owner_code', label: '货主编码', width: '160' }, + { prop: 'item_code', label: '商品编码', width: '160' }, + { prop: 'item_id', label: '商品 ID', width: '160' }, + { prop: 'count', label: '应收数量', width: '160' }, + { prop: 'inventory_type', label: '库存类型', width: '160' }, + { prop: 'stock_id', label: '库存记录 ID', width: '160' }, + { prop: 'received_quantity', label: '实收数量', width: '160' }, + { prop: 'confirm_quantity', label: '确认数量', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, + { prop: '', label: '', width: '160' }, +] \ No newline at end of file diff --git a/src/views/storage/entry/index.vue b/src/views/storage/entry/index.vue new file mode 100644 index 00000000..4859e5b5 --- /dev/null +++ b/src/views/storage/entry/index.vue @@ -0,0 +1,460 @@ + + + + + diff --git a/src/views/storage/receiving/component/Product.vue b/src/views/storage/receiving/component/Product.vue index 46a84293..aa69571b 100644 --- a/src/views/storage/receiving/component/Product.vue +++ b/src/views/storage/receiving/component/Product.vue @@ -2,8 +2,9 @@
- 批量操作 - 导出 + 刷新 + 批量操作 + 导出
@@ -74,8 +75,8 @@
- 重置 - 保存 + 重置 + 保存
@@ -83,8 +84,8 @@