zhou zhou
13 小时以前 50e95b985a72fcec4a93a2470e9efdfb2620148a
rsf-design/src/views/system/operation-record/operationRecordTable.columns.js
@@ -2,56 +2,59 @@
import { ElTag } from 'element-plus'
import ArtButtonTable from '@/components/core/forms/art-button-table/index.vue'
export function createOperationRecordTableColumns({ handleView, handleDelete }) {
export function createOperationRecordTableColumns({ t, handleView, handleDelete }) {
  return [
    {
      prop: 'namespace',
      label: '名称空间',
      label: t('pages.system.operationRecord.table.namespace'),
      minWidth: 180,
      showOverflowTooltip: true
    },
    {
      prop: 'url',
      label: '接口地址',
      label: t('pages.system.operationRecord.table.url'),
      minWidth: 240,
      showOverflowTooltip: true,
      formatter: (row) => row.url || '-'
    },
    {
      prop: 'userLabel',
      label: '操作用户',
      label: t('pages.system.operationRecord.table.user'),
      minWidth: 140,
      formatter: (row) => row.userLabel || '-'
    },
    {
      prop: 'clientIp',
      label: '客户端IP',
      label: t('pages.system.operationRecord.table.clientIp'),
      minWidth: 140,
      formatter: (row) => row.clientIp || '-'
    },
    {
      prop: 'spendTime',
      label: '耗时(ms)',
      label: t('pages.system.operationRecord.table.spendTime'),
      width: 110,
      formatter: (row) => row.spendTime ?? '-'
    },
    {
      prop: 'result',
      label: '结果',
      label: t('pages.system.operationRecord.table.result'),
      width: 100,
      formatter: (row) => h(ElTag, { type: row.resultType, effect: 'light' }, () => row.resultText || '-')
      formatter: (row) =>
        h(ElTag, { type: row.resultType, effect: 'light' }, () =>
          row.resultTextKey ? t(row.resultTextKey) : row.resultText || '-'
        )
    },
    {
      prop: 'timestampText',
      label: '操作时间',
      label: t('pages.system.operationRecord.table.timestamp'),
      minWidth: 180,
      formatter: (row) => row.timestampText || '-'
    },
    {
      prop: 'operation',
      label: '操作',
      label: t('table.operation'),
      width: handleDelete ? 120 : 70,
      align: 'right',
      align: 'center',
      formatter: (row) => {
        const buttons = [
          h(ArtButtonTable, {
@@ -69,7 +72,7 @@
          )
        }
        return h('div', { class: 'flex justify-end' }, buttons)
        return h('div', { class: 'flex justify-center' }, buttons)
      }
    }
  ]