From ce636c15f41f0b0179ee3c93db8c07f60c54ef45 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Tue, 3 Nov 2026 03:43:35 +0800 Subject: [PATCH] =?UTF-8?q?style(frontend):=20=E5=88=97=E8=A1=A8=E9=A1=B5?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E7=89=88=E5=BC=8F=EF=BC=88=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=BA=95=E9=83=A8=EF=BC=89+=20=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E8=AE=B0=E5=BD=95=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 列表统一版式(对齐订单页): - 所有列表页卡片撑满可视高度(flex:1 + min-height:0),el-card__body 改为 flex 列并 overflow:hidden - 筛选区固定(flex:0 0 auto),表格区 flex:1 且 overflow:hidden,表格传 height="100%" 只在表体滚动 - 分页组件固定在底部,不再跟着表格滚走 - 涉及页面:商品、组合商品、主体管理、账号管理、外部打单平台 (导出任务、库存单据、库存流水、店铺、店铺商品、出入库单此前已统一) 操作记录面板: - 新增 components/OperationLogPanel.vue(分页表格:时间/操作/说明/操作人/来源)与 api/operationLog.ts - 店铺商品页:点击商品行在表格下方展开操作记录,再次点击或「收起」关闭 - 商品、组合商品页:行内新增「日志」按钮,弹窗展示操作记录 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- frontend/src/api/operationLog.ts | 53 ++++++ frontend/src/components/OperationLogPanel.vue | 178 ++++++++++++++++++ frontend/src/views/ComboProduct/Index.vue | 70 ++++++- .../src/views/ExternalPrintPlatform/Index.vue | 31 ++- frontend/src/views/Principal/Index.vue | 63 +++++-- frontend/src/views/PrincipalUser/Index.vue | 33 +++- frontend/src/views/Product/Index.vue | 70 ++++++- .../ProductAttributePanel.vue | 2 + frontend/src/views/ShopProduct/Index.vue | 84 ++++++++- 9 files changed, 544 insertions(+), 40 deletions(-) create mode 100644 frontend/src/api/operationLog.ts create mode 100644 frontend/src/components/OperationLogPanel.vue diff --git a/frontend/src/api/operationLog.ts b/frontend/src/api/operationLog.ts new file mode 100644 index 0000000..4967dd1 --- /dev/null +++ b/frontend/src/api/operationLog.ts @@ -0,0 +1,53 @@ +import { get } from '@/utils/request' + +/** 日志对象类型:店铺商品 / 系统商品 / 组合商品 */ +export type OperationLogTargetType = 'shop_product' | 'product' | 'combo_product' + +/** 一条操作记录 */ +export interface OperationLogItem { + id: number + principal_id: number + target_type: OperationLogTargetType + target_id: number + /** 动作码:create / update / bind / unbind / remove / offline / delete */ + action: string + /** 操作说明(已包含对象名称,可直接展示) */ + title: string + detail?: Record | null + /** ui 界面操作 / sync 自动同步 / system 系统任务 */ + source: string + operator_id: number | null + operator_name: string | null + created_at: string +} + +/** 动作码 → 中文标签 */ +export const ACTION_LABELS: Record = { + create: '新增', + update: '修改', + bind: '绑定', + unbind: '解绑', + remove: '移出', + offline: '下架', + delete: '删除', +} + +/** 来源 → 中文标签 */ +export const SOURCE_LABELS: Record = { + ui: '界面操作', + sync: '自动同步', + system: '系统任务', +} + +/** 分页查询某个对象的操作记录 */ +export function getOperationLogs(params: { + target_type: OperationLogTargetType + target_id: number + page?: number + pageSize?: number +}) { + return get<{ list: OperationLogItem[]; total: number; page: number; pageSize: number }>( + '/operation-logs', + params, + ) +} diff --git a/frontend/src/components/OperationLogPanel.vue b/frontend/src/components/OperationLogPanel.vue new file mode 100644 index 0000000..27de884 --- /dev/null +++ b/frontend/src/components/OperationLogPanel.vue @@ -0,0 +1,178 @@ + + + + + diff --git a/frontend/src/views/ComboProduct/Index.vue b/frontend/src/views/ComboProduct/Index.vue index c40db00..eaf0286 100644 --- a/frontend/src/views/ComboProduct/Index.vue +++ b/frontend/src/views/ComboProduct/Index.vue @@ -12,6 +12,7 @@ import { searchProducts, type ProductSearchItem } from '@/api/product' import DataTable from '@/components/DataTable.vue' import ExportButton from '@/components/ExportButton.vue' import ListPager from '@/components/ListPager.vue' +import OperationLogPanel from '@/components/OperationLogPanel.vue' import { DEFAULT_PAGE_SIZE, useListPage } from '@/composables/useListPage' const query = reactive({ @@ -220,11 +221,26 @@ async function handleDelete(row: ComboProductItem) { } } +/* -------------------- 操作记录 -------------------- */ +const logVisible = ref(false) +const logRow = ref(null) + +function openLog(row: ComboProductItem) { + logRow.value = row + logVisible.value = true +} + +const logTitle = computed(() => { + const row = logRow.value + if (!row) return '操作记录' + return `操作记录:${row.name || ''}(${row.code || ''})` +}) + onMounted(fetchList)