|
|
@@ -1,7 +1,15 @@
|
|
|
<!-- FormCreate 自定义控件:部门选择(Fresh Mint · PC 树选 + 窄屏抽屉) -->
|
|
|
<template>
|
|
|
<div class="oa-dept-select">
|
|
|
- <template v-if="disabled">
|
|
|
+ <!-- 设计器 iframe 无 Pinia/鉴权,仅展示占位,避免拖入时打接口报错 -->
|
|
|
+ <template v-if="isDesignerHost">
|
|
|
+ <div class="oa-dept-select__preview">
|
|
|
+ <span class="oa-dept-select__placeholder">请选择部门</span>
|
|
|
+ <span class="oa-dept-select__chev">▾</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-else-if="disabled">
|
|
|
<span class="oa-dept-select__readonly">{{ displayText || '—' }}</span>
|
|
|
</template>
|
|
|
|
|
|
@@ -109,6 +117,17 @@
|
|
|
|
|
|
type TreeNode = { value: string; label: string; children?: TreeNode[] }
|
|
|
|
|
|
+ /** 表单设计器隔离宿主(无 Pinia / Token,禁止打业务 API) */
|
|
|
+ function detectDesignerHost() {
|
|
|
+ try {
|
|
|
+ return /oa-fc-host\.html/i.test(String(window.location?.pathname || ''))
|
|
|
+ } catch {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const isDesignerHost = detectDesignerHost()
|
|
|
+
|
|
|
const pathMap = ref(new Map<string, string>())
|
|
|
const treeSelectData = ref<TreeNode[]>([])
|
|
|
const isNarrow = ref(false)
|
|
|
@@ -227,6 +246,7 @@
|
|
|
})
|
|
|
|
|
|
async function loadTree() {
|
|
|
+ if (isDesignerHost) return
|
|
|
try {
|
|
|
const tree = (await fetchDeptTree()) || []
|
|
|
pathMap.value = buildPathLabelMapFromTreeRoots(tree, { nameKey: 'deptName' })
|
|
|
@@ -259,13 +279,7 @@
|
|
|
width: 100%;
|
|
|
}
|
|
|
|
|
|
- .oa-dept-select__readonly {
|
|
|
- color: var(--mint-text, #0f172a);
|
|
|
- font-size: 14px;
|
|
|
- line-height: 1.5;
|
|
|
- word-break: break-all;
|
|
|
- }
|
|
|
-
|
|
|
+ .oa-dept-select__preview,
|
|
|
.oa-dept-select__trigger {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
@@ -277,9 +291,19 @@
|
|
|
border-radius: 8px;
|
|
|
background: #fff;
|
|
|
text-align: left;
|
|
|
+ }
|
|
|
+
|
|
|
+ .oa-dept-select__trigger {
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
|
|
|
+ .oa-dept-select__readonly {
|
|
|
+ color: var(--mint-text, #0f172a);
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 1.5;
|
|
|
+ word-break: break-all;
|
|
|
+ }
|
|
|
+
|
|
|
.oa-dept-select__placeholder {
|
|
|
color: var(--mint-text-muted, #94a3b8);
|
|
|
}
|