From 570eec74ff687a9e630bd515c8f8b48cc5693e42 Mon Sep 17 00:00:00 2001 From: chenxing Date: Sat, 10 Oct 2026 14:34:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(def):=20=E6=B5=81=E7=A8=8B=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8C=89=E5=BA=94=E7=94=A8=E7=AD=9B=E9=80=89=E2=80=94?= =?UTF-8?q?=E2=80=94=E5=88=97=E8=A1=A8=E5=BA=94=E7=94=A8=E5=88=97+?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E4=B8=8B=E6=8B=89=E3=80=81=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E5=BD=92=E5=B1=9E=E5=BA=94=E7=94=A8=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Defs.vue:工具栏"按应用筛选"下拉(/def/appkeys 数据源,clearable/filterable)+ 应用列(空显示 -) - 编辑器:头部"应用"Select(clearable/filterable/allow-create,可手输新值),载入回显、保存透传 appKey - defList 支持 appKey 可选参数、新增 defAppKeys;新参数全部可选,与后端部署顺序无依赖 --- src/api/module/flow.ts | 10 ++++-- src/views/flow/admin/Defs.vue | 24 +++++++++++++-- src/views/flow/admin/def-editor/index.vue | 37 +++++++++++++++++++++++ 3 files changed, 66 insertions(+), 5 deletions(-) diff --git a/src/api/module/flow.ts b/src/api/module/flow.ts index 25511fe..f810b0f 100644 --- a/src/api/module/flow.ts +++ b/src/api/module/flow.ts @@ -119,13 +119,17 @@ class FlowApi { } // ==================== 管理面:流程定义 ==================== - defList() { - return get(`${ROOT}/admin/def/list`); + defList(params?: { status?: number; appKey?: string }) { + return get(`${ROOT}/admin/def/list`, params); + } + /** 应用清单("按应用筛选"下拉):本校 flw_def 已标注 ∪ 已注册回调的应用 */ + defAppKeys() { + return get(`${ROOT}/admin/def/appkeys`); } defGet(id: number | string) { return get(`${ROOT}/admin/def/get`, { id }); } - defSave(body: { id?: number; code: string; name: string; contentJson: string; baseGuid?: string }) { + defSave(body: { id?: number; code: string; name: string; contentJson: string; baseGuid?: string; appKey?: string }) { return post(`${ROOT}/admin/def/save`, body); } defPublish(id: number | string) { diff --git a/src/views/flow/admin/Defs.vue b/src/views/flow/admin/Defs.vue index cee1e0e..141c839 100644 --- a/src/views/flow/admin/Defs.vue +++ b/src/views/flow/admin/Defs.vue @@ -23,11 +23,15 @@ const sourceText = ref(""); const sourceTitle = ref(""); // 操作按钮区 + 表格,无搜索、无分页 const tableHeight = ref(Utils.useTableHeight({ isOperat: true })); +// 按应用筛选(flw_def.app_key,2026-10-10):下拉数据源来自 /def/appkeys +const appKeys = ref([]); +const filterApp = ref(""); const columns = [ { title: "序号", type: "index", width: 70, align: "center" }, { title: "流程", key: "name", minWidth: 180 }, { title: "编码", key: "code", width: 160 }, + { title: "应用", key: "appKey", width: 110, align: "center", render: (h: any, p: any) => h("span", p.row.appKey || "-") }, { title: "版本", key: "version", width: 70, align: "center" }, { title: "状态", width: 90, align: "center", render: (h: any, p: any) => { const c = p.row.status === 1 ? "green" : p.row.status === 0 ? "orange" : "gray"; @@ -58,12 +62,21 @@ const columns = [ async function load() { loading.value = true; try { - rows.value = (await flowApi.defList().send()) || []; + rows.value = (await flowApi.defList({ appKey: filterApp.value || undefined }).send()) || []; } finally { loading.value = false; } } +/** 应用清单(筛选下拉):flw_def 已标注 ∪ 已注册回调的应用,失败降级为空下拉 */ +async function loadAppKeys() { + try { + appKeys.value = (await flowApi.defAppKeys().send()) || []; + } catch { + appKeys.value = []; + } +} + /** 新建:编辑器空模板(默认含一个待配置审批节点) */ function onNew() { router.push({ path: "/admin/defs/editor" }); @@ -148,7 +161,10 @@ function onDiagram(row: any) { router.push({ path: "/diagram", query: { defId: row.id } }); } -onMounted(load); +onMounted(() => { + load(); + loadAppKeys(); +});