- Defs.vue:工具栏"按应用筛选"下拉(/def/appkeys 数据源,clearable/filterable)+ 应用列(空显示 -) - 编辑器:头部"应用"Select(clearable/filterable/allow-create,可手输新值),载入回显、保存透传 appKey - defList 支持 appKey 可选参数、新增 defAppKeys;新参数全部可选,与后端部署顺序无依赖
This commit is contained in:
@@ -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