copy from src/views/mes/md/unitmeasure/index.vue
copy to src/views/mes/process-design/parameter/index.vue
| 文件从 src/views/mes/md/unitmeasure/index.vue 复制 |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesMdUnitMeasureApi } from '#/api/mes/md/unitmeasure'; |
| | | import type { MesPdParameterApi } from '#/api/mes/pro/processdesign/parameter'; |
| | | |
| | | import { Page, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { downloadFileFromBlobPart } from '../../../../packages/utils/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteUnitMeasure, |
| | | exportUnitMeasure, |
| | | getUnitMeasurePage, |
| | | } from '#/api/mes/md/unitmeasure'; |
| | | deleteParameter, |
| | | getParameterPage, |
| | | } from '#/api/mes/pro/processdesign/parameter'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** 瀵煎嚭琛ㄦ牸 */ |
| | | async function handleExport() { |
| | | const data = await exportUnitMeasure(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: '璁¢噺鍗曚綅.xls', source: data }); |
| | | } |
| | | |
| | | /** 鍒涘缓璁¢噺鍗曚綅 */ |
| | | /** 鍒涘缓宸ヨ壓鍙傛暟 */ |
| | | function handleCreate() { |
| | | formModalApi.setData(null).open(); |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** 缂栬緫璁¢噺鍗曚綅 */ |
| | | function handleEdit(row: MesMdUnitMeasureApi.UnitMeasure) { |
| | | formModalApi.setData(row).open(); |
| | | /** 缂栬緫宸ヨ壓鍙傛暟 */ |
| | | function handleEdit(row: MesPdParameterApi.Parameter) { |
| | | formModalApi.setData({ id: row.id, formType: 'update' }).open(); |
| | | } |
| | | |
| | | /** 鍒犻櫎璁¢噺鍗曚綅 */ |
| | | async function handleDelete(row: MesMdUnitMeasureApi.UnitMeasure) { |
| | | /** 鏌ョ湅宸ヨ壓鍙傛暟璇︽儏 */ |
| | | function handleDetail(row: MesPdParameterApi.Parameter) { |
| | | formModalApi.setData({ id: row.id, formType: 'detail' }).open(); |
| | | } |
| | | |
| | | /** 鍒犻櫎宸ヨ壓鍙傛暟 */ |
| | | async function handleDelete(row: MesPdParameterApi.Parameter) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.name]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteUnitMeasure(row.id!); |
| | | await deleteParameter(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.name])); |
| | | handleRefresh(); |
| | | } finally { |
| | |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getUnitMeasurePage({ |
| | | return await getParameterPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | keyField: 'id', |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesMdUnitMeasureApi.UnitMeasure>, |
| | | } as VxeTableGridOptions<MesPdParameterApi.Parameter>, |
| | | }); |
| | | </script> |
| | | |
| | | <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: ['mes:md-unit-measure:create'], |
| | | auth: ['mes:pd:parameter:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:md-unit-measure:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)">{{ row.code }}</Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:md-unit-measure:update'], |
| | | auth: ['mes:pd:parameter:update'], |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:md-unit-measure:delete'], |
| | | auth: ['mes:pd:parameter:delete'], |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.name]), |
| | | confirm: handleDelete.bind(null, row), |