gaoluyang
2026-11-02 2fe330a44f9e8bdd8a1afd6124c57851f2a5b7ea
src/views/basicData/mdm/index.vue
@@ -14,7 +14,7 @@
import {
  deleteItem,
  deleteItemList,
  // exportItem,
  exportItem,
  getItemPage,
  updateItemStatus,
  updateItemSync,
@@ -81,11 +81,11 @@
  gridApi.query();
}
/** 导出表格 */
// async function handleExport() {
//   const data = await exportItem(await gridApi.formApi.getValues());
//   downloadFileFromBlobPart({ fileName: '物料.xls', source: data });
// }
/** 导出表格(按当前列表查询条件导出全部命中数据) */
async function handleExport() {
  const data = await exportItem(await gridApi.formApi.getValues());
  downloadFileFromBlobPart({ fileName: '物料数据.xls', source: data });
}
/** 创建物料 */
function handleCreate() {
@@ -96,6 +96,40 @@
function handleImport() {
  importModalApi.open();
}
/** 工具栏按钮 */
const toolbarActions = computed(() => [
  {
    label: $t('ui.actionTitle.create', ['物料']),
    type: 'primary' as const,
    icon: ACTION_ICON.ADD,
    auth: ['mdm:item:create'],
    onClick: handleCreate,
  },
  {
    label: $t('ui.actionTitle.import', ['物料']),
    type: 'primary' as const,
    icon: ACTION_ICON.UPLOAD,
    auth: ['mdm:item:import'],
    onClick: handleImport,
  },
  {
    label: $t('ui.actionTitle.export'),
    type: 'primary' as const,
    icon: ACTION_ICON.DOWNLOAD,
    auth: ['mdm:item:export'],
    onClick: handleExport,
  },
  {
    label: $t('ui.actionTitle.deleteBatch'),
    type: 'primary' as const,
    danger: true,
    icon: ACTION_ICON.DELETE,
    auth: ['mdm:item:delete'],
    disabled: isEmpty(checkedIds),
    onClick: handleDeleteBatch,
  },
]);
/** 编辑物料 */
function handleEdit(row: MdmItemApi.Item) {
@@ -225,40 +259,7 @@
    <ImportModal @success="handleRefresh" />
    <Grid table-title="物料列表">
      <template #toolbar-tools>
        <TableAction
          :actions="[
            {
              label: $t('ui.actionTitle.create', ['物料']),
              type: 'primary',
              icon: ACTION_ICON.ADD,
              auth: ['mdm:item:create'],
              onClick: handleCreate,
            },
            {
              label: $t('ui.actionTitle.import', ['物料']),
              type: 'primary',
              icon: ACTION_ICON.UPLOAD,
              auth: ['mdm:item:import'],
              onClick: handleImport,
            },
            // {
            //   label: $t('ui.actionTitle.export'),
            //   type: 'primary',
            //   icon: ACTION_ICON.DOWNLOAD,
            //   auth: ['mdm:item:export'],
            //   onClick: handleExport,
            // },
            {
              label: $t('ui.actionTitle.deleteBatch'),
              type: 'primary',
              danger: true,
              icon: ACTION_ICON.DELETE,
              auth: ['mdm:item:delete'],
              disabled: isEmpty(checkedIds),
              onClick: handleDeleteBatch,
            },
          ]"
        />
        <TableAction :actions="toolbarActions" />
      </template>
      <template #categoryName="{ row }">
        <Tag v-if="getCategoryColor(row.categoryId)" :color="getCategoryColor(row.categoryId)">{{ getCategoryName(row.categoryId) }}</Tag>