feat: 办理人映射页一键拉取教师组(预览确认+批量导入)+ 流程编辑器存量
build / build (push) Successful in 2m6s

- Maps.vue:一键拉取教师组按钮 + 预览弹窗(科室/成员明细)+ 确认导入
- flow.ts:mapGroupPreview/mapImportGroups API
- 含流程编辑器(def-editor)、路由 catch-all、示意图入口存量
This commit is contained in:
chenxing
2026-09-16 01:21:10 +08:00
parent 670988816c
commit 842a4cfb14
15 changed files with 2105 additions and 72 deletions
+51
View File
@@ -13,6 +13,45 @@ const saving = ref(false);
const form = ref<any>({ deptKey: "", deptName: "", userId: null, userName: "" });
const lookingUp = ref(false);
// 一键拉取教师组(预览确认后批量导入)
const groupVisible = ref(false);
const groupLoading = ref(false);
const groupImporting = ref(false);
const groupRows = ref<any[]>([]);
const groupColumns = [
{ title: "科室编码", key: "deptKey", width: 100 },
{ title: "科室名称", key: "deptName", width: 160 },
{ title: "成员数", key: "memberCount", width: 90, render: (h: any, p: any) => h("span", String(p.row.users?.length || 0)) },
{ title: "成员", key: "members", render: (h: any, p: any) => h("span", (p.row.users || []).map((u: any) => `${u.userName}(${u.userId})`).join("、") || "(空,导入后可手工补)") },
];
async function onGroupPreview() {
groupVisible.value = true;
groupLoading.value = true;
try {
groupRows.value = (await flowApi.mapGroupPreview().send()) || [];
} catch (e: any) {
Message.error(e?.message || "教师组拉取失败(UserBase 不可达?)");
groupVisible.value = false;
} finally {
groupLoading.value = false;
}
}
async function onGroupImport() {
groupImporting.value = true;
try {
const r: any = await flowApi.mapImportGroups().send();
Message.success(`导入完成:${r?.depts ?? 0} 个科室 / 新增 ${r?.users ?? 0} 条映射 / 跳过已存在 ${r?.skippedExisting ?? 0} 条`);
groupVisible.value = false;
load();
} catch (e: any) {
Message.error(e?.message || "导入失败");
} finally {
groupImporting.value = false;
}
}
const columns = [
{ title: "科室编码", key: "deptKey", width: 140 },
{ title: "科室名称", key: "deptName", width: 160, render: (h: any, p: any) => h("span", p.row.deptName || "-") },
@@ -92,6 +131,7 @@ onMounted(load);
<Input v-model="deptKeyFilter" placeholder="按科室编码筛选" style="width: 200px" clearable @on-enter="load" />
<Button @click="load">查询</Button>
<Button type="primary" @click="onAdd">新增映射</Button>
<Button type="info" :loading="groupLoading" @click="onGroupPreview">一键拉取教师组</Button>
</div>
<Table :columns="columns" :data="rows" :loading="loading" stripe />
@@ -116,6 +156,17 @@ onMounted(load);
<Button type="primary" :loading="saving" @click="onSave">保存</Button>
</template>
</Modal>
<Modal v-model="groupVisible" title="一键拉取教师组(UserBase 学校组树)" width="720" :mask-closable="false">
<p style="margin-bottom: 8px; color: #808695">
按学校组树中类型=教师组(type 7)的容器组取其子组作为科室(无子组时容器自身即科室),科室编码=UserBase 组 id,成员=组内用户。已存在且启用中的映射自动跳过。
</p>
<Table :columns="groupColumns" :data="groupRows" :loading="groupLoading" max-height="360" stripe />
<template #footer>
<Button @click="groupVisible = false">取消</Button>
<Button type="primary" :loading="groupImporting" :disabled="!groupRows.length" @click="onGroupImport">确认导入</Button>
</template>
</Modal>
</div>
</template>