From f10cf167372f2d8c4c0e14f42f361d7ab96d8347 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 03 七月 2026 13:59:00 +0800
Subject: [PATCH] Merge branch 'dev_pro2.0' of http://114.132.189.42:9002/r/mom-pro2-before into dev_pro2.0
---
src/views/mes/process-design/process/modules/content-list.vue | 132 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 132 insertions(+), 0 deletions(-)
diff --git a/src/views/mes/process-design/process/modules/content-list.vue b/src/views/mes/process-design/process/modules/content-list.vue
new file mode 100644
index 0000000..4ee6c92
--- /dev/null
+++ b/src/views/mes/process-design/process/modules/content-list.vue
@@ -0,0 +1,132 @@
+<script lang="ts" setup>
+import type { FormType } from '../data';
+
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { MesProProcessContentApi } from '#/api/mes/pro/process/content';
+
+import { ref, watch } from 'vue';
+
+import { useVbenModal } from '../../../../../packages/effects/common-ui/src';
+
+import { message } from 'ant-design-vue';
+
+import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
+import {
+ deleteProcessContent,
+ getProcessContentListByProcessId,
+} from '#/api/mes/pro/process/content';
+import { $t } from '#/locales';
+
+import { useContentGridColumns } from '../data';
+import ContentForm from './content-form.vue';
+
+const props = defineProps<{
+ formType: FormType;
+ processId: number;
+}>();
+
+const isEditable = ref(props.formType !== 'detail'); // 鏄惁鍙紪杈�
+const list = ref<MesProProcessContentApi.ProcessContent[]>([]);
+
+const [ContentFormModal, contentFormModalApi] = useVbenModal({
+ connectedComponent: ContentForm,
+ destroyOnClose: true,
+});
+
+const [Grid, gridApi] = useVbenVxeGrid({
+ gridOptions: {
+ autoResize: true,
+ border: true,
+ columns: useContentGridColumns(),
+ data: list.value,
+ minHeight: 240,
+ pagerConfig: { enabled: false },
+ rowConfig: {
+ isHover: true,
+ keyField: 'id',
+ },
+ showOverflow: true,
+ toolbarConfig: { enabled: false },
+ } as VxeTableGridOptions<MesProProcessContentApi.ProcessContent>,
+});
+
+/** 鍔犺浇宸ュ簭鍐呭鍒楄〃 */
+async function getList() {
+ gridApi.setLoading(true);
+ try {
+ list.value = await getProcessContentListByProcessId(props.processId);
+ gridApi.setGridOptions({ data: list.value });
+ } finally {
+ gridApi.setLoading(false);
+ }
+}
+
+/** 鏂板宸ュ簭姝ラ */
+function handleCreate() {
+ const maxSort = Math.max(0, ...list.value.map((item) => item.sort || 0));
+ contentFormModalApi.setData({ maxSort, processId: props.processId }).open();
+}
+
+/** 缂栬緫宸ュ簭姝ラ */
+function handleEdit(row: MesProProcessContentApi.ProcessContent) {
+ contentFormModalApi
+ .setData({ id: row.id, processId: props.processId })
+ .open();
+}
+
+/** 鍒犻櫎宸ュ簭姝ラ */
+async function handleDelete(row: MesProProcessContentApi.ProcessContent) {
+ await deleteProcessContent(row.id!);
+ message.success($t('ui.actionMessage.deleteSuccess', ['宸ュ簭姝ラ']));
+ await getList();
+}
+
+watch(
+ () => props.processId,
+ (value) => {
+ if (value) {
+ getList();
+ }
+ },
+ { immediate: true },
+);
+</script>
+
+<template>
+ <ContentFormModal @success="getList" />
+ <div v-if="isEditable" class="mb-3 flex items-center justify-start">
+ <TableAction
+ :actions="[
+ {
+ label: $t('ui.actionTitle.create', ['姝ラ']),
+ type: 'primary',
+ onClick: handleCreate,
+ },
+ ]"
+ />
+ </div>
+ <Grid class="w-full" table-title="宸ュ簭鎿嶄綔姝ラ">
+ <template #actions="{ row }">
+ <TableAction
+ :actions="[
+ {
+ label: $t('common.edit'),
+ type: 'link',
+ ifShow: () => isEditable,
+ onClick: handleEdit.bind(null, row),
+ },
+ {
+ label: $t('common.delete'),
+ type: 'link',
+ danger: true,
+ ifShow: () => isEditable,
+ popConfirm: {
+ title: $t('ui.actionMessage.deleteConfirm', ['宸ュ簭姝ラ']),
+ confirm: handleDelete.bind(null, row),
+ },
+ },
+ ]"
+ />
+ </template>
+ </Grid>
+</template>
--
Gitblit v1.9.3