/** Handsontable 列表操作列:统一图标按钮 HTML(配合 data-action 点击)
* 风格基准:/order/platformStoreOrder
*/
const ICON_STYLE = 'width:17px;height:17px;display:block;pointer-events:none'
const svg = (paths: string) =>
``
export const warehouseActionIcons = {
view: svg(
'',
),
edit: svg(
'',
),
delete: svg(
'',
),
relocate: svg(
'',
),
receive: svg(
'',
),
star: svg(
'',
),
pay: svg(
'',
),
track: svg(
'',
),
advisor: svg(
'',
),
history: svg(''),
auth: svg(
'',
),
match: svg(
'',
),
ship: svg(
'',
),
label: svg(
'',
),
suspend: svg(
'',
),
resume: svg(
'',
),
/** 审批通过 */
approve: svg(''),
/** 审批拒绝 / 关闭 */
reject: svg(''),
/** 分配角色 */
assignRoles: svg(
'',
),
/** 重置密码 */
resetPassword: svg(
'',
),
/** OMS 登录 / 外链进入 */
login: svg(
'',
),
/** 发布 */
publish: svg(
'',
),
/** 结束活动 */
end: svg(
'',
),
/** 重试 */
retry: svg(
'',
),
/** 取消任务 */
cancel: svg(''),
/** 改绑 */
rebind: svg(
'',
),
/** 已读确认 */
read: svg(''),
/** 打印面单 */
print: svg(
'',
),
/** 禁用账号 */
disable: svg(
'',
),
/** 启用账号 */
enable: svg(
'',
),
} as const
export type WarehouseActionVariant = keyof typeof warehouseActionIcons
/** @deprecated 使用 WarehouseActionVariant;保留别名便于列表页统一导入 */
export type ListActionVariant = WarehouseActionVariant
export function renderWarehouseActionBtn(
action: string,
title: string,
variant: WarehouseActionVariant = action as WarehouseActionVariant,
): string {
const icon = warehouseActionIcons[variant] || warehouseActionIcons.view
const safeTitle = String(title).replace(/"/g, '"')
return `${icon}`
}
export function wrapWarehouseActions(parts: string[], rowIndex?: number): string {
if (!parts.length) return ''
let html = `
${parts.join('')}
`
if (rowIndex != null && Number.isFinite(rowIndex)) {
html = html.replace(/data-action=/g, `data-row-index="${rowIndex}" data-action=`)
}
return html
}
/** 别名:列表页可统一从此导入 */
export const renderListActionBtn = renderWarehouseActionBtn
export const wrapListActions = wrapWarehouseActions