From 27c8277d717b34b55f3ea967027b53b067f77df3 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 20 八月 2026 16:58:49 +0800
Subject: [PATCH] feat 功能变更
---
src/views/mes/pd/ctc/index.vue | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 161 insertions(+), 0 deletions(-)
diff --git a/src/views/mes/pd/ctc/index.vue b/src/views/mes/pd/ctc/index.vue
new file mode 100644
index 0000000..d1d500e
--- /dev/null
+++ b/src/views/mes/pd/ctc/index.vue
@@ -0,0 +1,161 @@
+<script lang="ts" setup>
+ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+ import type { MesPdCtcApi } from '#/api/mes/pd/ctc';
+
+ import { ref } from 'vue';
+
+ import { Page, useVbenModal } from '@vben/common-ui';
+ import { $t } from '@vben/locales';
+ import { downloadFileFromBlobPart } from '@vben/utils';
+
+ import { Button, message } from 'ant-design-vue';
+
+ import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
+ import {
+ deleteCtc,
+ exportCtc,
+ getCtcPage,
+ } from '#/api/mes/pd/ctc';
+
+ import { useGridColumns, useGridFormSchema } from './data';
+ import Form from './modules/form.vue';
+
+ const [FormModal, formModalApi] = useVbenModal({
+ connectedComponent: Form,
+ destroyOnClose: true,
+ });
+
+ /** 鍒锋柊琛ㄦ牸 */
+ function handleRefresh() {
+ gridApi.query();
+ }
+
+ /** 鏂板 */
+ function handleCreate() {
+ formModalApi.setData({ formType: 'create' }).open();
+ }
+
+ /** 鏌ョ湅 */
+ function handleDetail(row: MesPdCtcApi.Ctc) {
+ formModalApi.setData({ id: row.id, formType: 'detail' }).open();
+ }
+
+ /** 缂栬緫 */
+ function handleEdit(row: MesPdCtcApi.Ctc) {
+ formModalApi.setData({ id: row.id, formType: 'update' }).open();
+ }
+
+ /** 鍒犻櫎 */
+ async function handleDelete(row: MesPdCtcApi.Ctc) {
+ const hideLoading = message.loading({
+ content: $t('ui.actionMessage.deleting', [row.orderSpec ?? '']),
+ duration: 0,
+ });
+ try {
+ await deleteCtc(row.id!);
+ message.success($t('ui.actionMessage.deleteSuccess', [row.orderSpec ?? '']));
+ handleRefresh();
+ } finally {
+ hideLoading();
+ }
+ }
+
+ /** 瀵煎嚭 */
+ async function handleExport() {
+ const data = await exportCtc(await gridApi.formApi.getValues());
+ downloadFileFromBlobPart({ fileName: '鎹綅瀵肩嚎鎶�鏈弬鏁�.xls', source: data });
+ }
+
+ const [Grid, gridApi] = useVbenVxeGrid({
+ formOptions: {
+ schema: useGridFormSchema(),
+ },
+ gridOptions: {
+ columns: useGridColumns(),
+ height: 'auto',
+ keepSource: true,
+ proxyConfig: {
+ ajax: {
+ query: async ({ page }, formValues) =>
+ await getCtcPage({
+ pageNo: page.currentPage,
+ pageSize: page.pageSize,
+ ...formValues,
+ }),
+ },
+ },
+ rowConfig: {
+ keyField: 'id',
+ isHover: true,
+ },
+ toolbarConfig: {
+ refresh: true,
+ search: true,
+ },
+ } as VxeTableGridOptions<MesPdCtcApi.Ctc>,
+ });
+</script>
+
+<template>
+ <Page auto-content-height>
+ <FormModal @success="handleRefresh" />
+ <Grid table-title="鎹綅瀵肩嚎鎶�鏈弬鏁板垪琛�">
+ <template #toolbar-tools>
+ <TableAction
+ :actions="[
+ {
+ label: $t('ui.actionTitle.create', ['鎹綅瀵肩嚎鎶�鏈弬鏁�']),
+ type: 'primary',
+ icon: ACTION_ICON.ADD,
+ auth: ['mes:pd-ctc:create'],
+ onClick: handleCreate,
+ },
+ {
+ label: $t('ui.actionTitle.export'),
+ type: 'primary',
+ icon: ACTION_ICON.DOWNLOAD,
+ auth: ['mes:pd-ctc:export'],
+ onClick: handleExport,
+ },
+ ]"
+ />
+ </template>
+ <template #orderSpec="{ row }">
+ <Button type="link" @click="handleDetail(row)">
+ {{ row.orderSpec || row.itemName }}
+ </Button>
+ </template>
+ <template #actions="{ row }">
+ <TableAction
+ :actions="[
+ {
+ label: $t('common.edit'),
+ type: 'link',
+ icon: ACTION_ICON.EDIT,
+ auth: ['mes:pd-ctc:update'],
+ onClick: handleEdit.bind(null, row),
+ },
+ {
+ label: $t('common.delete'),
+ type: 'link',
+ danger: true,
+ icon: ACTION_ICON.DELETE,
+ auth: ['mes:pd-ctc:delete'],
+ popConfirm: {
+ title: $t('ui.actionMessage.deleteConfirm', [row.orderSpec ?? '']),
+ confirm: handleDelete.bind(null, row),
+ },
+ },
+ {
+ label: $t('common.detail'),
+ type: 'link',
+ icon: ACTION_ICON.VIEW,
+ auth: ['mes:pd-ctc:query'],
+ onClick: handleDetail.bind(null, row),
+ },
+ ]"
+ />
+ </template>
+ </Grid>
+ </Page>
+</template>
--
Gitblit v1.9.3