diff --git a/src/api/module/flow.ts b/src/api/module/flow.ts
index 3f2c05e..be01d7a 100644
--- a/src/api/module/flow.ts
+++ b/src/api/module/flow.ts
@@ -124,6 +124,10 @@ class FlowApi {
mapLookupUser(userId: number) {
return get(`${ROOT}/admin/map/lookupUser`, { userId });
}
+ /** 选人组件数据源:学校组树(组→组内用户叶子) */
+ adminUserTree() {
+ return get(`${ROOT}/admin/user/tree`);
+ }
/** 一键拉取教师组·预览(学校子树教师组容器 → 科室+组内成员) */
mapGroupPreview() {
return get(`${ROOT}/admin/map/groupPreview`);
diff --git a/src/components/UserCheckInput.vue b/src/components/UserCheckInput.vue
deleted file mode 100644
index 2ec7f83..0000000
--- a/src/components/UserCheckInput.vue
+++ /dev/null
@@ -1,165 +0,0 @@
-
-
-
-
-
- {{ isEdit ? "现有" : "全部" }}用户
- 指定用户
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/UserCheckModal.vue b/src/components/UserCheckModal.vue
index 49e6a31..448c71a 100644
--- a/src/components/UserCheckModal.vue
+++ b/src/components/UserCheckModal.vue
@@ -51,27 +51,37 @@
-
-
全选
-
{{ tempUserList.length }}
-
删除选中
-
-
- -
- {{ item.name }}
- {{ item.group }}
-
-
+
+
+
全选
+
{{ tempUserList.length }}
+
删除选中
+
+
+ -
+ {{ item.name }}
+ {{ item.group }}
+
+
+
+
+ 已选择
+
+ {{ selectedUser.name }}
+ {{ selectedUser.group }}
+
+ 在左侧树中点击选中一名用户
+
@@ -112,6 +122,11 @@ export default {
type: Boolean,
default: false,
},
+ /** 单选模式:树上点击叶子即选定(flow-center 办理人映射等单选场景);默认多选与 Notice 口径一致 */
+ multiple: {
+ type: Boolean,
+ default: true,
+ },
},
emits: ["update:userids", "on-submit"],
data() {
@@ -119,6 +134,9 @@ export default {
ztreeDomId: "user_check_tree_" + Math.floor(Math.random() * 1e8),
modal: false,
tabIndex: 0,
+ /** 单选模式当前选中(每次打开重置) */
+ selectedUser: null as any,
+ tabIndex: 0,
/** 每次打开弹窗自增,强制重建 Tabs,避免上次 tab 高亮残留与数据错位 */
tabKey: 0,
/** 树加载序号:tab 快速切换时只渲染最后一次请求的结果 */
@@ -146,6 +164,7 @@ export default {
methods: {
show() {
this.modal = true;
+ this.selectedUser = null;
// 重置到第一个 tab:显式赋值 + key 重建 Tabs,保证高亮与数据一致
this.tabIndex = 0;
this.tabKey++;
@@ -175,9 +194,19 @@ export default {
},
handleSelect(query: string) {
if (query.indexOf(",") != -1) query = query.split(",")[0];
- var treeObj = ($.fn as any).zTree.getZTreeObj(this.ztreeDomId);
- var node = treeObj.getNodeByParam("name", query, null);
- if (!!node) treeObj.checkNode(node, true, true, true);
+ const findObj = this.currentTreeFlatten.find(
+ (x: any) => x.type == 2 && x.name == query.split(",")[0]
+ );
+ if (!findObj) return;
+ if (this.multiple) {
+ var treeObj = ($.fn as any).zTree.getZTreeObj(this.ztreeDomId);
+ var node = treeObj.getNodeByParam("name", query, null);
+ if (!!node) treeObj.checkNode(node, true, true, true);
+ } else {
+ // 单选:搜索命中即选定并直接提交(提交后可再清空)
+ this.selectedUser = { ...findObj };
+ this.submit();
+ }
},
/**
* ztree 数据预处理:拼接 pid 保证同人多组时 id 可区分;叶子标记 type=2。
@@ -240,7 +269,7 @@ export default {
showIcon: true,
},
check: {
- enable: true,
+ enable: this.multiple,
chkboxType: { Y: "ps", N: "ps" },
},
callback: {},
@@ -283,8 +312,22 @@ export default {
}
}
treeSetting.callback.onClick = (event: any, treeId: string, treeNode: any) => {
- let check = treeNode.checked;
let treeObj = ($.fn as any).zTree.getZTreeObj(treeId);
+ if (!_this.multiple) {
+ // 单选:叶子节点点击即选定;组节点仅展开(关闭复选,无勾选语义)
+ if (treeNode.type == 2) {
+ treeObj.selectNode(treeNode, false, false);
+ _this.selectedUser = {
+ id: _this.getSplitId(treeNode.id),
+ name: treeNode.name,
+ group: treeNode.group || "",
+ };
+ } else {
+ treeObj.expandNode(treeNode, !treeNode.open, false, false);
+ }
+ return;
+ }
+ let check = treeNode.checked;
treeObj.checkNode(treeNode, !check, true);
formatUser(treeNode, treeNode.checked);
};
@@ -333,6 +376,17 @@ export default {
},
submit() {
const _this = this;
+ if (!_this.multiple) {
+ if (!_this.selectedUser) {
+ Message.warning("请先选择用户");
+ return;
+ }
+ const u: any = { id: _this.selectedUser.id, name: _this.selectedUser.name, group: _this.selectedUser.group };
+ this.$emit("update:userids", [u.id]);
+ this.$emit("on-submit", [u]);
+ this.modal = false;
+ return;
+ }
let idsArr = this.tempUserList.map((x: any) => _this.getSplitId(x.id));
idsArr = Array.from(new Set(idsArr));
this.$emit("update:userids", idsArr);
@@ -412,6 +466,21 @@ export default {
background: #e4edf6;
}
}
+ .single-box {
+ padding: 12px;
+ line-height: 32px;
+ .info {
+ float: right;
+ margin-right: 12px;
+ font-size: 12px;
+ color: gray;
+ }
+ }
+ .single-empty {
+ padding: 12px;
+ font-size: 12px;
+ color: #c5c8ce;
+ }
}
.arrow-box {
width: 128px;
diff --git a/src/components/UserSelectInput.vue b/src/components/UserSelectInput.vue
new file mode 100644
index 0000000..10485dc
--- /dev/null
+++ b/src/components/UserSelectInput.vue
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/flow/admin/Maps.vue b/src/views/flow/admin/Maps.vue
index 9fb29b7..61f446d 100644
--- a/src/views/flow/admin/Maps.vue
+++ b/src/views/flow/admin/Maps.vue
@@ -1,7 +1,8 @@