云
2 天以前 77e4c3d0201a83cf41b73d7bd7a79255759575f4
src/views/basicData/mdm/index.vue
@@ -4,16 +4,16 @@
import { ref } from 'vue';
import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { confirm, Page, useVbenModal } from '#/packages/effects/common-ui/src';
import { downloadFileFromBlobPart, isEmpty } from '#/packages/utils/src';
import { message, Tag } from 'ant-design-vue';
import { message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
  deleteItem,
  deleteItemList,
  exportItem,
  // exportItem,
  getItemPage,
  updateItemStatus,
} from '#/api/mdm/item';
@@ -35,22 +35,22 @@
}
/** 导出表格 */
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() {
  formModalApi.setData(null).open();
}
/** 编辑物料 */
/** 编辑品种 */
function handleEdit(row: MdmItemApi.Item) {
  formModalApi.setData(row).open();
}
/** 删除物料 */
/** 删除品种 */
async function handleDelete(row: MdmItemApi.Item) {
  const hideLoading = message.loading({
    content: $t('ui.actionMessage.deleting', [row.name]),
@@ -65,7 +65,7 @@
  }
}
/** 批量删除物料 */
/** 批量删除品种 */
async function handleDeleteBatch() {
  await confirm($t('ui.actionMessage.deleteBatchConfirm'));
  const hideLoading = message.loading({
@@ -145,24 +145,24 @@
<template>
  <Page auto-content-height>
    <FormModal @success="handleRefresh" />
    <Grid table-title="物料列表">
    <Grid table-title="品种列表">
      <template #toolbar-tools>
        <TableAction
          :actions="[
            {
              label: $t('ui.actionTitle.create', ['物料']),
              label: $t('ui.actionTitle.create', ['品种']),
              type: 'primary',
              icon: ACTION_ICON.ADD,
              auth: ['mdm:item:create'],
              onClick: handleCreate,
            },
            {
              label: $t('ui.actionTitle.export'),
              type: 'primary',
              icon: ACTION_ICON.DOWNLOAD,
              auth: ['mdm:item:export'],
              onClick: handleExport,
            },
            // {
            //   label: $t('ui.actionTitle.export'),
            //   type: 'primary',
            //   icon: ACTION_ICON.DOWNLOAD,
            //   auth: ['mdm:item:export'],
            //   onClick: handleExport,
            // },
            {
              label: $t('ui.actionTitle.deleteBatch'),
              type: 'primary',
@@ -175,10 +175,6 @@
          ]"
        />
      </template>
      <template #isBatchManaged="{ row }">
        <Tag v-if="row.isBatchManaged" color="success">是</Tag>
        <Tag v-else>否</Tag>
      </template>
      <template #actions="{ row }">
        <TableAction
          :actions="[
@@ -188,12 +184,6 @@
              icon: ACTION_ICON.EDIT,
              auth: ['mdm:item:update'],
              onClick: handleEdit.bind(null, row),
            },
            {
              label: row.status === 0 ? '停用' : '启用',
              type: 'link',
              auth: ['mdm:item:update'],
              onClick: handleStatusChange.bind(null, row, row.status === 0),
            },
            {
              label: $t('common.delete'),
@@ -211,4 +201,4 @@
      </template>
    </Grid>
  </Page>
</template>
</template>