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
+13 -72
View File
@@ -1,5 +1,7 @@
<script setup lang="ts">
// 流程定义管理(M1:JSON 文本编辑模式;发布跑静态校验,把"任务无主"拦在发布期)
// 流程定义管理:列表 + 发布/停用/升版本/版本历史/图示。
// 新建与编辑走独立的全屏可视化编辑器(/admin/defs/editor,钉钉式卡片流,见《流程中心流程编辑器方案.md》);
// 本页不再直接编辑 JSON 文本(原 M1 textarea 已由编辑器取代,编辑器内置"源码"高级模式兜底)。
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { Message } from "view-ui-plus";
@@ -10,29 +12,9 @@ const DEF_STATUS: Record<number, string> = { 0: "草稿", 1: "已发布", 2: "
const loading = ref(false);
const rows = ref<any[]>([]);
const editVisible = ref(false);
const saving = ref(false);
const form = ref<any>({ id: null, code: "", name: "", contentJson: "" });
const versionVisible = ref(false);
const versions = ref<any[]>([]);
const SAMPLE_JSON = `{
"code": "sample_flow",
"name": "示例流程",
"start": "start",
"nodes": [
{"id": "start", "type": "START", "name": "开始"},
{"id": "n1", "type": "APPROVAL", "name": "科室审核",
"assignee": {"type": "DEPT_KEY", "deptKey": "ybb"}, "countersign": "ALL"},
{"id": "end", "type": "END"}
],
"edges": [
{"from": "start", "to": "n1"},
{"from": "n1", "to": "end"}
],
"settings": {"rejectPolicy": "END_REJECTED", "urge": {"enabled": true, "intervalHours": 24, "maxTimes": 3}}
}`;
const columns = [
{ title: "流程", key: "name", minWidth: 180 },
{ title: "编码", key: "code", width: 160 },
@@ -67,42 +49,20 @@ async function load() {
}
}
function onEdit(row: any) {
flowApi.defGet(row.id).send().then((d: any) => {
form.value = { id: d.id, code: d.code, name: d.name, contentJson: d.contentJson };
editVisible.value = true;
});
}
/** 新建:编辑器空模板(默认含一个待配置审批节点) */
function onNew() {
form.value = { id: null, code: "", name: "", contentJson: SAMPLE_JSON };
editVisible.value = true;
router.push({ path: "/admin/defs/editor" });
}
async function onNewVersion(row: any) {
// 升版本:以已发布内容为底稿建草稿(flowGuid 不变,version 自动 +1)
const d: any = await flowApi.defGet(row.id).send();
form.value = { id: null, code: row.code, name: row.name, contentJson: d.contentJson, baseGuid: row.flowGuid };
/** 编辑草稿:编辑器载入该草稿内容,保存直接改本行 */
function onEdit(row: any) {
router.push({ path: "/admin/defs/editor", query: { id: String(row.id) } });
}
/** 升版本:以已发布内容为底稿,保存时走 baseGuid 建新草稿版本(version 自动 +1,flowGuid 不变) */
function onNewVersion(row: any) {
Message.info("已载入当前版本内容,保存即创建新草稿版本");
editVisible.value = true;
}
async function onSave() {
saving.value = true;
try {
await flowApi.defSave({
id: form.value.id || undefined,
code: form.value.code,
name: form.value.name,
contentJson: form.value.contentJson,
baseGuid: form.value.baseGuid,
}).send();
Message.success("已保存");
editVisible.value = false;
load();
} finally {
saving.value = false;
}
router.push({ path: "/admin/defs/editor", query: { id: String(row.id), baseGuid: row.flowGuid } });
}
async function onPublish(row: any) {
@@ -140,25 +100,6 @@ onMounted(load);
</div>
<Table :columns="columns" :data="rows" :loading="loading" stripe />
<Modal v-model="editVisible" :title="form.id ? '编辑流程' : '新建流程'" width="760" :mask-closable="false">
<Form :label-width="80">
<FormItem label="编码">
<Input v-model="form.code" :disabled="!!form.id" placeholder="流程编码(内部管理键,发布后不可改)" />
</FormItem>
<FormItem label="名称">
<Input v-model="form.name" placeholder="流程名" />
</FormItem>
<FormItem label="定义 JSON">
<Input v-model="form.contentJson" type="textarea" :rows="16"
placeholder="§5.1 流程定义 JSON(START/END 唯一、无孤儿无环、DEPT_KEY 需先配好映射)" />
</FormItem>
</Form>
<template #footer>
<Button @click="editVisible = false">取消</Button>
<Button type="primary" :loading="saving" @click="onSave">保存(草稿)</Button>
</template>
</Modal>
<Modal v-model="versionVisible" title="版本历史" width="640">
<Table :columns="[
{ title: '版本', key: 'version', width: 80 },