- Defs.vue:工具栏"按应用筛选"下拉(/def/appkeys 数据源,clearable/filterable)+ 应用列(空显示 -) - 编辑器:头部"应用"Select(clearable/filterable/allow-create,可手输新值),载入回显、保存透传 appKey - defList 支持 appKey 可选参数、新增 defAppKeys;新参数全部可选,与后端部署顺序无依赖
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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<string[]>([]);
|
||||
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();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -157,6 +173,10 @@ onMounted(load);
|
||||
<!-- 操作按钮区:主操作靠左(bsch应用页规范 §1) -->
|
||||
<div class="fix mb-12">
|
||||
<Button class="fl" type="primary" size="large" @click="onNew">新建流程</Button>
|
||||
<Select v-model="filterApp" clearable filterable placeholder="按应用筛选" class="fl"
|
||||
style="width: 200px; margin-left: 8px" @on-change="load">
|
||||
<Option v-for="k in appKeys" :key="k" :value="k">{{ k }}</Option>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<Table :columns="columns" :data="rows" :loading="loading" class="link-table table-bottom-box"
|
||||
|
||||
@@ -55,6 +55,10 @@ const baseGuid = ref("");
|
||||
/** 载入源定义的状态(已发布/停用版本进入编辑器时提示保存会新建草稿版本) */
|
||||
const sourceStatus = ref(0);
|
||||
const sourceVersion = ref(0);
|
||||
/** 归属应用(flw_def.app_key;按应用筛选维度,空=未分配) */
|
||||
const appKey = ref("");
|
||||
/** 应用清单下拉(本校已标注 ∪ 已注册回调),拉取失败降级为仅手输 */
|
||||
const appKeys = ref<string[]>([]);
|
||||
|
||||
const model = reactive<EditorModel>(createEmptyModel());
|
||||
/** 科室映射聚合(mapList):仅用于下拉选项与"无启用办理人"提示 */
|
||||
@@ -172,6 +176,11 @@ async function load(): Promise<void> {
|
||||
try {
|
||||
await loadDepts();
|
||||
await loadRouters();
|
||||
try {
|
||||
appKeys.value = ((await flowApi.defAppKeys().send()) as string[]) || [];
|
||||
} catch {
|
||||
appKeys.value = [];
|
||||
}
|
||||
|
||||
const queryId = route.query.id ? Number(route.query.id) : null;
|
||||
const queryGuid = (route.query.baseGuid as string) || "";
|
||||
@@ -190,6 +199,7 @@ async function load(): Promise<void> {
|
||||
sourceVersion.value = d?.version ?? 0;
|
||||
model.code = d?.code || "";
|
||||
model.name = d?.name || "";
|
||||
appKey.value = d?.appKey || "";
|
||||
try {
|
||||
applyParsed(fromContentJson(JSON.parse(d?.contentJson || "{}")));
|
||||
} catch (e: any) {
|
||||
@@ -354,6 +364,25 @@ async function onSave(): Promise<void> {
|
||||
Message.error(`校验未通过:${errors[0].text}`);
|
||||
return;
|
||||
}
|
||||
// 新建:同编码软提示(编码是分类标签,多条流程线可共用同一编码,这里只提醒不阻断)
|
||||
if (!editId.value && !baseGuid.value) {
|
||||
const rows: any[] = (await flowApi.defList().send()) || [];
|
||||
const sameCode = rows.filter((r) => r.code === model.code.trim()).length;
|
||||
if (sameCode > 0) {
|
||||
Modal.confirm({
|
||||
title: "存在同编码流程",
|
||||
content: `编码「${model.code.trim()}」已有 ${sameCode} 条流程,保存将新建一条独立流程线(版本从 v1 开始)。继续吗?`,
|
||||
okText: "继续保存",
|
||||
cancelText: "取消",
|
||||
onOk: () => void doSave(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
await doSave();
|
||||
}
|
||||
|
||||
async function doSave(): Promise<void> {
|
||||
const content = JSON.stringify(toContentJson(model));
|
||||
saving.value = true;
|
||||
try {
|
||||
@@ -364,6 +393,7 @@ async function onSave(): Promise<void> {
|
||||
name: model.name.trim(),
|
||||
contentJson: content,
|
||||
baseGuid: baseGuid.value || undefined,
|
||||
appKey: (appKey.value || "").trim() || undefined,
|
||||
}).send();
|
||||
savedSnapshot.value = currentSnapshot.value;
|
||||
Message.success("已保存草稿");
|
||||
@@ -446,6 +476,13 @@ onUnmounted(() => window.removeEventListener("beforeunload", onBeforeUnload));
|
||||
:maxlength="40"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
应用
|
||||
<Select v-model="appKey" placeholder="归属应用,可空" style="width: 150px"
|
||||
clearable filterable allow-create>
|
||||
<Option v-for="k in appKeys" :key="k" :value="k">{{ k }}</Option>
|
||||
</Select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="hd-right">
|
||||
<Button @click="settingsDrawer = true">流程设置</Button>
|
||||
|
||||
Reference in New Issue
Block a user