gaoluyang
2026-10-16 268b3e77f3beaba03a1273d643d8aa4fa5db1c10
src/views/mes/tm/tool/type/index.vue
@@ -12,8 +12,12 @@
  deleteToolType,
  exportToolType,
  getToolTypePage,
  importToolType,
  importToolTypeTemplate,
} from '#/api/mes/tm/tool/type';
import { $t } from '#/locales';
import ImportModalComponent from '#/components/import-modal';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
@@ -23,9 +27,26 @@
  destroyOnClose: true,
});
const [ImportModal, importModalApi] = useVbenModal({
  connectedComponent: ImportModalComponent,
  destroyOnClose: true,
});
/** 刷新表格 */
function handleRefresh() {
  gridApi.query();
}
/** 导入工具类型 */
function handleImport() {
  importModalApi
    .setData({
      title: $t('ui.actionTitle.import', ['工具类型']),
      fileName: '工具类型导入模板.xls',
      importFn: importToolType,
      templateFn: importToolTypeTemplate,
    })
    .open();
}
/** 创建工具类型 */
@@ -96,6 +117,7 @@
<template>
  <Page auto-content-height><FormModal @success="handleRefresh" />
    <ImportModal @success="handleRefresh" />
    <Grid table-title="工具类型列表">
      <template #toolbar-tools>
        <TableAction
@@ -114,6 +136,13 @@
              auth: ['mes:tm-tool-type:export'],
              onClick: handleExport,
            },
            {
              label: $t('ui.actionTitle.import', ['工具类型']),
              type: 'primary',
              icon: ACTION_ICON.UPLOAD,
              auth: ['mes:tm-tool-type:import'],
              onClick: handleImport,
            },
          ]"
        />
      </template>