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/route/modules/process-list.vue | 136 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 136 insertions(+), 0 deletions(-)
diff --git a/src/views/mes/process-design/route/modules/process-list.vue b/src/views/mes/process-design/route/modules/process-list.vue
new file mode 100644
index 0000000..70a992d
--- /dev/null
+++ b/src/views/mes/process-design/route/modules/process-list.vue
@@ -0,0 +1,136 @@
+<script lang="ts" setup>
+import type { FormType } from '../data';
+
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { MesProRouteProcessApi } from '#/api/mes/pro/route/process';
+
+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 {
+ deleteRouteProcess,
+ getRouteProcessListByRoute,
+} from '#/api/mes/pro/route/process';
+import { $t } from '#/locales';
+
+import { useRouteProcessGridColumns } from '../data';
+import ProcessForm from './process-form.vue';
+
+const props = defineProps<{
+ formType: FormType;
+ routeId: number;
+}>();
+
+const isEditable = ref(props.formType !== 'detail'); // 鏄惁鍙紪杈�
+const list = ref<MesProRouteProcessApi.RouteProcess[]>([]); // 宸ヨ壓璺嚎宸ュ簭鍒楄〃
+
+const [ProcessFormModal, processFormModalApi] = useVbenModal({
+ connectedComponent: ProcessForm,
+ destroyOnClose: true,
+});
+
+const [Grid, gridApi] = useVbenVxeGrid({
+ gridOptions: {
+ autoResize: true,
+ border: true,
+ columns: useRouteProcessGridColumns(),
+ data: list.value,
+ minHeight: 240,
+ pagerConfig: { enabled: false },
+ rowConfig: { isHover: true, keyField: 'id' },
+ showOverflow: true,
+ toolbarConfig: { enabled: false },
+ } as VxeTableGridOptions<MesProRouteProcessApi.RouteProcess>,
+});
+
+/** 鍔犺浇宸ヨ壓璺嚎宸ュ簭鍒楄〃 */
+async function getList() {
+ gridApi.setLoading(true);
+ try {
+ list.value = await getRouteProcessListByRoute(props.routeId);
+ gridApi.setGridOptions({ data: list.value });
+ } finally {
+ gridApi.setLoading(false);
+ }
+}
+
+/** 鏂板宸ヨ壓璺嚎宸ュ簭 */
+function handleCreate() {
+ const maxSort = Math.max(0, ...list.value.map((item) => item.sort || 0));
+ processFormModalApi.setData({ maxSort, routeId: props.routeId }).open();
+}
+
+/** 缂栬緫宸ヨ壓璺嚎宸ュ簭 */
+function handleEdit(row: MesProRouteProcessApi.RouteProcess) {
+ processFormModalApi.setData({ id: row.id, routeId: props.routeId }).open();
+}
+
+/** 鍒犻櫎宸ヨ壓璺嚎宸ュ簭 */
+async function handleDelete(row: MesProRouteProcessApi.RouteProcess) {
+ await deleteRouteProcess(row.id!);
+ message.success($t('ui.actionMessage.deleteSuccess', ['宸ヨ壓璺嚎宸ュ簭']));
+ await getList();
+}
+
+watch(
+ () => props.routeId,
+ (value) => {
+ if (value) {
+ getList();
+ }
+ },
+ { immediate: true },
+);
+</script>
+
+<template>
+ <ProcessFormModal @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 #colorCode="{ row }">
+ <div v-if="row.colorCode" class="flex items-center justify-center gap-1">
+ <div
+ class="h-4 w-4 rounded"
+ :style="{ backgroundColor: row.colorCode }"
+ ></div>
+ <span>{{ row.colorCode }}</span>
+ </div>
+ </template>
+ <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