From 1d95b134d85c3c60cf0e72739888c9741a0bb1ee Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期五, 10 四月 2026 13:20:39 +0800
Subject: [PATCH] #页面优化

---
 rsf-design/src/views/basic-info/wh-mat/whMatTable.columns.js |  118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 109 insertions(+), 9 deletions(-)

diff --git a/rsf-design/src/views/basic-info/wh-mat/whMatTable.columns.js b/rsf-design/src/views/basic-info/wh-mat/whMatTable.columns.js
index 9d4b6d4..12aba26 100644
--- a/rsf-design/src/views/basic-info/wh-mat/whMatTable.columns.js
+++ b/rsf-design/src/views/basic-info/wh-mat/whMatTable.columns.js
@@ -1,9 +1,67 @@
 import { h } from 'vue'
 import { ElTag } from 'element-plus'
 import { $t } from '@/locales'
+import ArtButtonMore from '@/components/core/forms/art-button-more/index.vue'
+import { getWhMatDynamicFieldKey } from './whMatPage.helpers'
 
-export function createWhMatTableColumns({ handleViewDetail, t = $t }) {
+export function createWhMatTableColumns({
+  handleViewDetail,
+  handleEdit,
+  handleDelete,
+  handlePrint,
+  enabledFields = [],
+  canEdit = true,
+  canDelete = true,
+  t = $t
+} = {}) {
+  const operations = [{ key: 'view', label: t('common.actions.detail'), icon: 'ri:eye-line' }]
+
+  if (canEdit && handleEdit) {
+    operations.push({ key: 'edit', label: t('common.actions.edit'), icon: 'ri:pencil-line' })
+  }
+
+  if (handlePrint) {
+    operations.push({ key: 'print', label: t('common.actions.print'), icon: 'ri:printer-line' })
+  }
+
+  if (canDelete && handleDelete) {
+    operations.push({
+      key: 'delete',
+      label: t('common.actions.delete'),
+      icon: 'ri:delete-bin-5-line',
+      color: 'var(--art-error)'
+    })
+  }
+
+  const dynamicColumns = Array.isArray(enabledFields)
+    ? enabledFields.map((field) => ({
+        prop: getWhMatDynamicFieldKey(field.fields),
+        label: field.fieldsAlise,
+        minWidth: 140,
+        showOverflowTooltip: true,
+        formatter: (row) => row[getWhMatDynamicFieldKey(field.fields)] || '--'
+      }))
+    : []
+
   return [
+    {
+      type: 'selection',
+      width: 48,
+      align: 'center'
+    },
+    {
+      type: 'globalIndex',
+      label: t('table.index'),
+      width: 72,
+      align: 'center'
+    },
+    {
+      prop: 'id',
+      label: t('table.id'),
+      width: 90,
+      align: 'center',
+      formatter: (row) => row.id ?? '--'
+    },
     {
       prop: 'code',
       label: t('pages.basicInfo.whMat.table.code'),
@@ -19,7 +77,7 @@
     {
       prop: 'groupName',
       label: t('pages.basicInfo.whMat.table.groupName'),
-      minWidth: 160,
+      minWidth: 180,
       showOverflowTooltip: true
     },
     {
@@ -31,15 +89,16 @@
     {
       prop: 'spec',
       label: t('pages.basicInfo.whMat.table.spec'),
-      minWidth: 150,
+      minWidth: 160,
       showOverflowTooltip: true
     },
     {
       prop: 'model',
       label: t('pages.basicInfo.whMat.table.model'),
-      minWidth: 150,
+      minWidth: 160,
       showOverflowTooltip: true
     },
+    ...dynamicColumns,
     {
       prop: 'unit',
       label: t('table.unit'),
@@ -51,7 +110,17 @@
       width: 100,
       align: 'center',
       formatter: (row) =>
-        h(ElTag, { type: row.statusType || 'info', effect: 'light' }, () => row.statusText || t('common.placeholder.empty'))
+        h(
+          ElTag,
+          { type: row.statusType || 'info', effect: 'light' },
+          () => row.statusText || t('common.placeholder.empty')
+        )
+    },
+    {
+      prop: 'updateByText',
+      label: t('table.updateBy'),
+      minWidth: 120,
+      showOverflowTooltip: true
     },
     {
       prop: 'updateTimeText',
@@ -60,12 +129,43 @@
       showOverflowTooltip: true
     },
     {
-      prop: 'action',
+      prop: 'createByText',
+      label: t('table.createBy'),
+      minWidth: 120,
+      showOverflowTooltip: true
+    },
+    {
+      prop: 'createTimeText',
+      label: t('table.createTime'),
+      minWidth: 180,
+      showOverflowTooltip: true
+    },
+    {
+      prop: 'memo',
+      label: t('table.memo'),
+      minWidth: 160,
+      showOverflowTooltip: true
+    },
+    {
+      prop: 'operation',
       label: t('table.operation'),
-      width: 100,
-      fixed: 'right',
+      width: 120,
       align: 'center',
-      useSlot: true
+      fixed: 'right',
+      formatter: (row) =>
+        h(
+          'div',
+          { class: 'flex justify-center' },
+          h(ArtButtonMore, {
+            list: operations,
+            onClick: (item) => {
+              if (item.key === 'view') handleViewDetail?.(row)
+              if (item.key === 'edit') handleEdit?.(row)
+              if (item.key === 'print') handlePrint?.(row)
+              if (item.key === 'delete') handleDelete?.(row)
+            }
+          })
+        )
     }
   ]
 }

--
Gitblit v1.9.1