zhou zhou
9 天以前 33bd4dd1f0e41131cd8e5bbf87204a1f0b72bb08
rsf-design/src/views/basic-info/bas-station/basStationTable.columns.js
@@ -1,6 +1,8 @@
import { h } from 'vue'
import { ElTag } from 'element-plus'
import ArtButtonMore from '@/components/core/forms/art-button-more/index.vue'
import { $t } from '@/locales'
import BasStationTagCell from './modules/bas-station-tag-cell.vue'
import {
  getBasStationUseStatusMeta,
  getBasStationStatusMeta,
@@ -9,41 +11,51 @@
export function createBasStationTableColumns({
  handleView,
  handleCopy,
  handleEdit,
  handleDelete,
  canEdit = true,
  canDelete = true
} = {}) {
  const operations = [{ key: 'view', label: '详情', icon: 'ri:eye-line' }]
  const operations = [{ key: 'view', label: $t('common.actions.detail'), icon: 'ri:eye-line' }]
  if (handleCopy) {
    operations.push({ key: 'copy', label: '复制初始化', icon: 'ri:file-copy-line' })
  }
  if (canEdit && handleEdit) {
    operations.push({ key: 'edit', label: '编辑', icon: 'ri:pencil-line' })
    operations.push({ key: 'edit', label: $t('common.actions.edit'), icon: 'ri:pencil-line' })
  }
  if (canDelete && handleDelete) {
    operations.push({ key: 'delete', label: '删除', icon: 'ri:delete-bin-5-line', color: 'var(--art-error)' })
    operations.push({
      key: 'delete',
      label: $t('common.actions.delete'),
      icon: 'ri:delete-bin-5-line',
      color: 'var(--art-error)'
    })
  }
  return [
    { type: 'selection', width: 48, align: 'center' },
    { type: 'globalIndex', label: '序号', width: 72, align: 'center' },
    { type: 'globalIndex', label: $t('table.index'), width: 72, align: 'center' },
    {
      prop: 'stationName',
      label: '站点编码',
      label: $t('pages.basicInfo.basStation.table.stationCode'),
      minWidth: 160,
      showOverflowTooltip: true,
      formatter: (row) => row.stationName || '--'
    },
    {
      prop: 'stationId',
      label: '站点名称',
      label: $t('pages.basicInfo.basStation.table.stationName'),
      minWidth: 170,
      showOverflowTooltip: true,
      formatter: (row) => row.stationId || '--'
    },
    {
      prop: 'typeText',
      label: '站点类型',
      label: $t('pages.basicInfo.basStation.table.type'),
      width: 110,
      align: 'center',
      formatter: (row) => {
@@ -53,7 +65,7 @@
    },
    {
      prop: 'useStatusText',
      label: '使用状态',
      label: $t('pages.basicInfo.basStation.table.useStatus'),
      width: 110,
      align: 'center',
      formatter: (row) => {
@@ -63,70 +75,76 @@
    },
    {
      prop: 'areaText',
      label: '所属库区',
      label: $t('pages.basicInfo.basStation.table.area'),
      minWidth: 150,
      showOverflowTooltip: true,
      formatter: (row) => row.areaText || row.area$ || '--'
    },
    {
      prop: 'crossZoneAreaText',
      label: '可跨区库区',
      prop: 'crossZoneAreaItems',
      label: $t('pages.basicInfo.basStation.table.crossZoneArea'),
      minWidth: 220,
      showOverflowTooltip: true,
      formatter: (row) => row.crossZoneAreaText || '--'
      formatter: (row) =>
        h(BasStationTagCell, {
          items: row.crossZoneAreaItems || [],
          title: '可跨区库区'
        })
    },
    {
      prop: 'containerTypesText',
      label: '可入容器类型',
      prop: 'containerTypeItems',
      label: $t('pages.basicInfo.basStation.table.containerTypes'),
      minWidth: 200,
      showOverflowTooltip: true,
      formatter: (row) => row.containerTypesText || '--'
      formatter: (row) =>
        h(BasStationTagCell, {
          items: row.containerTypeItems || [],
          title: '可入容器类型'
        })
    },
    {
      prop: 'barcode',
      label: '条码',
      label: $t('pages.basicInfo.basStation.table.barcode'),
      minWidth: 150,
      showOverflowTooltip: true,
      formatter: (row) => row.barcode || '--'
    },
    {
      prop: 'inAbleText',
      label: '可入',
      label: $t('pages.basicInfo.basStation.table.inAble'),
      width: 90,
      align: 'center',
      formatter: (row) => row.inAbleText || '--'
    },
    {
      prop: 'outAbleText',
      label: '可出',
      label: $t('pages.basicInfo.basStation.table.outAble'),
      width: 90,
      align: 'center',
      formatter: (row) => row.outAbleText || '--'
    },
    {
      prop: 'isCrossZoneText',
      label: '是否跨区',
      label: $t('pages.basicInfo.basStation.table.isCrossZone'),
      width: 100,
      align: 'center',
      formatter: (row) => row.isCrossZoneText || '--'
    },
    {
      prop: 'isWcsText',
      label: '是否WCS',
      label: $t('pages.basicInfo.basStation.table.isWcs'),
      width: 100,
      align: 'center',
      formatter: (row) => row.isWcsText || '--'
    },
    {
      prop: 'autoTransferText',
      label: '自动调拨',
      label: $t('pages.basicInfo.basStation.table.autoTransfer'),
      width: 100,
      align: 'center',
      formatter: (row) => row.autoTransferText || '--'
    },
    {
      prop: 'status',
      label: '状态',
      label: $t('table.status'),
      width: 100,
      align: 'center',
      formatter: (row) => {
@@ -136,35 +154,51 @@
    },
    {
      prop: 'updateByText',
      label: '更新人',
      label: $t('table.updateBy'),
      minWidth: 120,
      showOverflowTooltip: true,
      formatter: (row) => row.updateByText || row.updateBy$ || '--'
    },
    {
      prop: 'updateTimeText',
      label: '更新时间',
      label: $t('table.updateTime'),
      minWidth: 170,
      showOverflowTooltip: true,
      formatter: (row) => row.updateTimeText || row.updateTime$ || '--'
    },
    {
      prop: 'createByText',
      label: $t('table.createBy'),
      minWidth: 120,
      showOverflowTooltip: true,
      formatter: (row) => row.createByText || row.createBy$ || '--'
    },
    {
      prop: 'createTimeText',
      label: $t('table.createTime'),
      minWidth: 170,
      showOverflowTooltip: true,
      formatter: (row) => row.createTimeText || row.createTime$ || '--'
    },
    {
      prop: 'memo',
      label: '备注',
      label: $t('table.remark'),
      minWidth: 180,
      showOverflowTooltip: true,
      formatter: (row) => row.memo || '--'
    },
    {
      prop: 'operation',
      label: '操作',
      width: 160,
      align: 'right',
      label: $t('table.operation'),
      width: 120,
      align: 'center',
      fixed: 'right',
      formatter: (row) =>
        h(ArtButtonMore, {
          list: operations,
          onClick: (item) => {
            if (item.key === 'view') handleView?.(row)
            if (item.key === 'copy') handleCopy?.(row)
            if (item.key === 'edit') handleEdit?.(row)
            if (item.key === 'delete') handleDelete?.(row)
          }