| | |
| | | */ |
| | | export function getLangTrans (config) { |
| | | let langList = sessionStorage.getItem('langList') |
| | | let appType = sessionStorage.getItem('appType') |
| | | |
| | | if (appType === 'mob' || appType === 'pc') { |
| | | langList = sessionStorage.getItem('applangList') |
| | | } |
| | | |
| | | if (!langList) return |
| | | |
| | |
| | | let btn = [] |
| | | let ops = [] |
| | | let text = [] |
| | | let menu = [] |
| | | |
| | | let filterElement = (card) => { |
| | | if (card.datatype === 'static' && card.eleType === 'text' && !/@.+@/g.test(card.value)) { |
| | |
| | | }) |
| | | } |
| | | if (item.search) { |
| | | item.search.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | if (item.type === 'topbar') { |
| | | if (item.search.fields) { |
| | | item.search.fields.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | } |
| | | if (item.search.groups) { |
| | | item.search.groups.forEach(group => { |
| | | if (group.fields) { |
| | | group.fields.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | item.search.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | } |
| | | } |
| | | if (item.action) { |
| | | item.action.forEach(cell => { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | if (item.type === 'navbar') { |
| | | if (item.menus) { |
| | | item.menus.forEach(first => { |
| | | menu.push(first.name) |
| | | if (first.sublist) { |
| | | first.sublist.forEach(sec => { |
| | | menu.push(sec.name) |
| | | if (sec.sublist) { |
| | | sec.sublist.forEach(thd => { |
| | | menu.push(thd.name) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } else if (item.type === 'menubar') { |
| | | item.subMenus.forEach(cell => { |
| | | if (cell.setting.name) { |
| | | menu.push(cell.setting.name) |
| | | } |
| | | }) |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards.forEach(card => { |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | |
| | | |
| | | traversal(config.components) |
| | | |
| | | sql = sql.filter(Boolean) |
| | | btn = btn.filter(Boolean) |
| | | ops = ops.filter(Boolean) |
| | | text = text.filter(Boolean) |
| | | |
| | | sql = Array.from(new Set(sql)) |
| | | btn = Array.from(new Set(btn)) |
| | | ops = Array.from(new Set(ops)) |
| | | text = Array.from(new Set(text)) |
| | | |
| | | sql = sql.map(l => `'${l}','title'`) |
| | | btn = btn.map(l => `'${l}','button'`) |
| | | ops = ops.map(l => `'${l}','list'`) |
| | | text = text.map(l => `'${l}','text'`) |
| | | |
| | | let list = [...btn, ...sql, ...ops, ...text] |
| | | |
| | | if (config.MenuName) { |
| | | list.unshift(`'${config.MenuName}','menu'`) |
| | | menu.push(config.MenuName) |
| | | } |
| | | |
| | | if (config.fstMenuId && config.parentId && config.fstMenuId !== 'BillPrintTemp') { |
| | |
| | | |
| | | menulist.forEach(item => { |
| | | if (item.MenuID !== config.fstMenuId) return |
| | | list.unshift(`'${item.MenuName}','menu'`) |
| | | menu.push(item.MenuName) |
| | | item.children.forEach(cell => { |
| | | if (cell.MenuID !== config.parentId) return |
| | | list.unshift(`'${cell.MenuName}','menu'`) |
| | | menu.push(cell.MenuName) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | sql = sql.filter(Boolean) |
| | | btn = btn.filter(Boolean) |
| | | ops = ops.filter(Boolean) |
| | | text = text.filter(Boolean) |
| | | menu = menu.filter(Boolean) |
| | | |
| | | sql = Array.from(new Set(sql)) |
| | | btn = Array.from(new Set(btn)) |
| | | ops = Array.from(new Set(ops)) |
| | | text = Array.from(new Set(text)) |
| | | menu = Array.from(new Set(menu)) |
| | | |
| | | sql = sql.map(l => `'${l}','title'`) |
| | | btn = btn.map(l => `'${l}','button'`) |
| | | ops = ops.map(l => `'${l}','list'`) |
| | | text = text.map(l => `'${l}','text'`) |
| | | menu = menu.map(l => `'${l}','menu'`) |
| | | |
| | | let list = [...menu, ...btn, ...sql, ...ops, ...text] |
| | | |
| | | let result = [] |
| | | |
| | |
| | | /** |
| | | * @description 语言转换 |
| | | */ |
| | | export function setLangTrans (config, btnDict, titDict, lisDict, regs, tail) { |
| | | export function setLangTrans (config, btnDict, titDict, lisDict, menuDict, regs, tail) { |
| | | let filterElement = (card) => { |
| | | if (card.datatype === 'static' && card.eleType === 'text' && !/@.+@/g.test(card.value)) { |
| | | if (card.value && titDict[card.value]) { |
| | |
| | | }) |
| | | } |
| | | if (item.search) { |
| | | item.search.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | if (item.type === 'topbar') { |
| | | if (item.search.fields) { |
| | | item.search.fields.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | } |
| | | if (item.search.groups) { |
| | | item.search.groups.forEach(group => { |
| | | if (group.fields) { |
| | | group.fields.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | item.search.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | } |
| | | } |
| | | if (item.action) { |
| | | item.action.forEach(cell => { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'menubar') { |
| | | if (item.type === 'navbar') { |
| | | item.uuid = item.uuid.slice(0, 24) + tail |
| | | } else if (item.type === 'login') { |
| | | item.wrap.linkmenu = item.wrap.linkmenu.slice(0, 24) + tail |
| | | } else if (item.type === 'menubar') { |
| | | item.subMenus = item.subMenus.map(cell => { |
| | | if (cell.setting.name && menuDict[cell.setting.name]) { |
| | | cell.setting.name = menuDict[cell.setting.name] |
| | | } |
| | | if (cell.setting.type === 'linkmenu') { |
| | | cell.setting.linkMenuId = cell.setting.linkMenuId.slice(0, 24) + tail |
| | | } |