列表统一版式(对齐订单页): - 所有列表页卡片撑满可视高度(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>
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
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<string, unknown> | null
|
||
/** ui 界面操作 / sync 自动同步 / system 系统任务 */
|
||
source: string
|
||
operator_id: number | null
|
||
operator_name: string | null
|
||
created_at: string
|
||
}
|
||
|
||
/** 动作码 → 中文标签 */
|
||
export const ACTION_LABELS: Record<string, string> = {
|
||
create: '新增',
|
||
update: '修改',
|
||
bind: '绑定',
|
||
unbind: '解绑',
|
||
remove: '移出',
|
||
offline: '下架',
|
||
delete: '删除',
|
||
}
|
||
|
||
/** 来源 → 中文标签 */
|
||
export const SOURCE_LABELS: Record<string, string> = {
|
||
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,
|
||
)
|
||
}
|