fix(bug):1.帮我检查一下平台中有多少处显示部门地方这种“e10-、、、、”字样拿掉不要显示
deploy-hxtesting / build-and-deploy (push) Successful in 1m28s
deploy-hxtesting / build-and-deploy (push) Successful in 1m28s
2.月培训计划发布时授课时间默认空着点击【发布】时提示先维护授课时间,(不要默认年培训计划) 3.授课地点默认“年度计划”所设置的授课地点,如果年培训计划没有维护发布时也要必填 4.点击【发布】时要校验参加人员不能为空!默认为所属部门下的人员~ 认真阅读相关代码~
This commit is contained in:
1 parent
6cdcc4f221
commit
858c352991
16 files changed
+421
-89
No files matched your search
@@ -0,0 +1,36 @@
|
||||
// 部门名展示清洗(2026-11 需求):企微同步经 Casdoor 落库时,上游未映射部门名的
|
||||
// 部门以「e10-<企微部门ID>」兜底形态存入 org_depts.name / users.dept_name,
|
||||
// 平台各处(下拉/列表/导出)直出时呈现为一串「e10-1115765553620631553」字样。
|
||||
// 展示侧一律剥离该字样;整体即该形态的「无名部门」不进入部门下拉。
|
||||
|
||||
const E10_DEPT_TOKEN_RE = /e10-\d+/gi
|
||||
|
||||
/** 剥离部门名中残留的「e10-数字」字样并去首尾空白(入参为空安全)。 */
|
||||
export function cleanDeptName(name: string | null | undefined): string {
|
||||
return (name || '').replace(E10_DEPT_TOKEN_RE, '').trim()
|
||||
}
|
||||
|
||||
/** 部门名剥离后是否为空(整段就是「e10-数字」的同步残留部门,展示层视为无部门名)。 */
|
||||
export function isSyntheticDeptName(name: string | null | undefined): boolean {
|
||||
return cleanDeptName(name) === ''
|
||||
}
|
||||
|
||||
/** 部门名展示值:剥掉「e10-数字」字样,空名由调用方回退 '-' 等占位符。 */
|
||||
export function displayDeptName(name: string | null | undefined): string {
|
||||
return cleanDeptName(name)
|
||||
}
|
||||
|
||||
/** 过滤掉整段即「e10-数字」的无名部门(部门下拉/部门表数据源统一走这里)。 */
|
||||
export function filterVisibleDepts<T extends { name?: string | null }>(depts: T[] | null | undefined): T[] {
|
||||
return (depts || []).filter((d) => !isSyntheticDeptName(d.name))
|
||||
}
|
||||
|
||||
/** 自由文本(适合人员/参加人员串等)清洗:按分隔符拆开逐段剥离「e10-数字」后重组,
|
||||
* 避免段中残留后出现悬空分隔符。 */
|
||||
export function cleanDeptNameText(text: string | null | undefined): string {
|
||||
return (text || '')
|
||||
.split(/[、,,;;]/)
|
||||
.map((part) => cleanDeptName(part))
|
||||
.filter(Boolean)
|
||||
.join('、')
|
||||
}
|
||||
Reference in new issue
Block a user