|
|
|
@ -345,6 +345,12 @@ function buildMenuTree(menuList) { |
|
|
|
for (const topCatalog of topCatalogList) { |
|
|
|
buildMenuChildren(topCatalog, catalogAndMenuList); |
|
|
|
} |
|
|
|
|
|
|
|
// 3 动态为警务评议与问题处置业务菜单挂载状态折叠子菜单
|
|
|
|
for (const topCatalog of topCatalogList) { |
|
|
|
injectWorkflowSubMenus(topCatalog); |
|
|
|
} |
|
|
|
|
|
|
|
return topCatalogList; |
|
|
|
} |
|
|
|
|
|
|
|
@ -358,3 +364,66 @@ function buildMenuChildren(menu, allMenuList) { |
|
|
|
buildMenuChildren(item, allMenuList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// ---------------------------- 动态工单流转状态插拔装配 ----------------------------
|
|
|
|
export const statePool = { |
|
|
|
'all': { title: '全部工单', queryType: 'all' }, |
|
|
|
'to_handle': { title: '待办工单', queryType: 'to_handle' }, |
|
|
|
'transferred': { title: '已流转工单', queryType: 'transferred' }, |
|
|
|
'about_to_expire': { title: '即将超期工单', queryType: 'about_to_expire' }, |
|
|
|
'expired': { title: '已超期工单', queryType: 'expired' }, |
|
|
|
'completed': { title: '已办结工单', queryType: 'completed' }, |
|
|
|
'invalid': { title: '已作废工单', queryType: 'invalid' } |
|
|
|
}; |
|
|
|
|
|
|
|
export const businessWorkflowConfig = { |
|
|
|
default: ['all', 'to_handle', 'transferred', 'about_to_expire', 'expired', 'completed', 'invalid'] |
|
|
|
}; |
|
|
|
|
|
|
|
// 动态根据默认数组顺序生成索引映射,防止后续修改顺序时高亮乱蹦
|
|
|
|
export const stateIndexMap = {}; |
|
|
|
businessWorkflowConfig.default.forEach((key, index) => { |
|
|
|
stateIndexMap[key] = index + 1; |
|
|
|
}); |
|
|
|
|
|
|
|
function injectWorkflowSubMenus(menuNode) { |
|
|
|
if (menuNode.children && menuNode.children.length > 0) { |
|
|
|
for (const child of menuNode.children) { |
|
|
|
injectWorkflowSubMenus(child); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 检测组件路径是否为警务评议与问题处置的通用工单列表
|
|
|
|
if (menuNode.component && menuNode.component.includes('jwpy/flow/index')) { |
|
|
|
let states = businessWorkflowConfig.default; |
|
|
|
// 支持通过后端菜单的扩展字段配置该业务支持的状态,实现可插拔
|
|
|
|
if (menuNode.extendInfo) { |
|
|
|
try { |
|
|
|
const config = JSON.parse(menuNode.extendInfo); |
|
|
|
if (config.workflowStates && config.workflowStates.length > 0) { |
|
|
|
states = config.workflowStates; |
|
|
|
} |
|
|
|
} catch (e) { } |
|
|
|
} |
|
|
|
|
|
|
|
const sjlyNo = menuNode.path ? menuNode.path.split('/').pop() : menuNode.menuId.toString(); |
|
|
|
const children = []; |
|
|
|
states.forEach((stateKey, index) => { |
|
|
|
const stateObj = statePool[stateKey]; |
|
|
|
if (stateObj) { |
|
|
|
children.push({ |
|
|
|
menuId: menuNode.menuId * 100 + (index + 1), // 生成全局唯一数字 ID
|
|
|
|
parentId: menuNode.menuId, |
|
|
|
menuName: stateObj.title, |
|
|
|
path: `${menuNode.path}/${stateObj.queryType}`, |
|
|
|
component: menuNode.component, |
|
|
|
menuType: MENU_TYPE_ENUM.MENU.value, |
|
|
|
visibleFlag: true, |
|
|
|
disabledFlag: false |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
menuNode.children = [...(menuNode.children || []), ...children]; |
|
|
|
} |
|
|
|
} |
|
|
|
|