king
2025-05-14 e8ef7263819e847d55cd35e006aa02635fd7b82e
src/utils/utils-custom.js
@@ -2431,6 +2431,8 @@
 * @description 获取语言转换信息
 */
export function getLangTrans (config) {
  if (sessionStorage.getItem('lang') !== 'zh-CN') return ''
  let langList = sessionStorage.getItem('langList')
  let appType = sessionStorage.getItem('appType')
@@ -2438,18 +2440,19 @@
    langList = sessionStorage.getItem('applangList')
  }
  
  if (!langList) return
  let defLang = ''
  if (!langList) return ''
  try {
    langList = JSON.parse(langList)
    defLang = langList[0]
  } catch (e) {
    defLang = ''
    langList = ''
  }
  if (!defLang) return ''
  if (!langList) return ''
  langList = langList.filter(n => n !== 'zh-CN')
  if (langList.length === 0) return ''
  let sql = []
  let btn = []
@@ -2759,7 +2762,20 @@
  text = text.filter(Boolean)
  menu = menu.filter(Boolean)
  sql = sql.map(n => n.replace(/(:|:)$/g, ''))
  sql = sql.map(n => n.replace(/^\s+|\s+$/g, '').replace(/(:|:)$/g, ''))
  btn = btn.map(n => n.replace(/^\s+|\s+$/g, ''))
  ops = ops.map(n => n.replace(/^\s+|\s+$/g, ''))
  menu = menu.map(n => n.replace(/^\s+|\s+$/g, ''))
  sql = sql.filter((n) => {
    if (!n) return false
    if (/^[a-zA-Z_]+$/.test(n)) return false
    return true
  })
  btn = btn.filter(Boolean)
  ops = ops.filter(Boolean)
  menu = menu.filter(Boolean)
  sql = Array.from(new Set(sql))
  btn = Array.from(new Set(btn))
@@ -2778,8 +2794,6 @@
  let result = []
  langList.forEach(lan => {
    if (lan === defLang) return
    list.forEach(n => {
      result.push(`'${lan}',${n}`)
    })
@@ -2809,6 +2823,21 @@
  }
  let replaceTitle = (val) => {
    let s = ''
    let e = ''
    if (/^\s+/g) {
      val = val.replace(/^\s+/g, (w) => {
        s = w
        return ''
      })
    }
    if (/\s+$/g) {
      val = val.replace(/\s+$/g, (w) => {
        e = w
        return ''
      })
    }
    if (/(:|:)$/g.test(val)) {
      let _val = val.replace(/(:|:)$/g, '')
      if (titDict[_val]) {
@@ -2819,6 +2848,83 @@
    } else if (titDict[val]) {
      val = titDict[val]
    }
    val = s + val + e
    return val
  }
  let replaceBtn = (val) => {
    let s = ''
    let e = ''
    if (/^\s+/g) {
      val = val.replace(/^\s+/g, (w) => {
        s = w
        return ''
      })
    }
    if (/\s+$/g) {
      val = val.replace(/\s+$/g, (w) => {
        e = w
        return ''
      })
    }
    if (btnDict[val]) {
      val = btnDict[val]
    }
    val = s + val + e
    return val
  }
  let replaceList = (val) => {
    let s = ''
    let e = ''
    if (/^\s+/g) {
      val = val.replace(/^\s+/g, (w) => {
        s = w
        return ''
      })
    }
    if (/\s+$/g) {
      val = val.replace(/\s+$/g, (w) => {
        e = w
        return ''
      })
    }
    if (lisDict[val]) {
      val = lisDict[val]
    }
    val = s + val + e
    return val
  }
  let replaceMenu = (val) => {
    let s = ''
    let e = ''
    if (/^\s+/g) {
      val = val.replace(/^\s+/g, (w) => {
        s = w
        return ''
      })
    }
    if (/\s+$/g) {
      val = val.replace(/\s+$/g, (w) => {
        e = w
        return ''
      })
    }
    if (menuDict[val]) {
      val = menuDict[val]
    }
    val = s + val + e
    return val
  }
@@ -2855,8 +2961,8 @@
  }
  let filterBtn = (btn) => {
    if (btn.label && btnDict[btn.label]) {
      btn.label = btnDict[btn.label]
    if (btn.label) {
      btn.label = replaceBtn(btn.label)
    }
    if (btn.OpenType === 'tab' && btn.linkmenu) {
@@ -2955,8 +3061,8 @@
      n.dataSource = filterSql(n.dataSource)
    } else if (n.options) {
      n.options.forEach(o => {
        if (o.Text && lisDict[o.Text]) {
          o.Text = lisDict[o.Text]
        if (o.Text) {
          o.Text = replaceList(o.Text)
        }
      })
    }
@@ -3096,8 +3202,8 @@
          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.name) {
              cell.setting.name = replaceMenu(cell.setting.name)
            }
            if (cell.setting.type === 'linkmenu') {
              cell.setting.linkMenuId = cell.setting.linkMenuId.slice(0, 24) + tail
@@ -3245,6 +3351,20 @@
  }
  let replaceTitle = (val) => {
    let s = ''
    let e = ''
    if (/^\s+/g) {
      val = val.replace(/^\s+/g, (w) => {
        s = w
        return ''
      })
    }
    if (/\s+$/g) {
      val = val.replace(/\s+$/g, (w) => {
        e = w
        return ''
      })
    }
    if (/(:|:)$/g.test(val)) {
      let _val = val.replace(/(:|:)$/g, '')
      if (titDict[_val]) {
@@ -3255,6 +3375,83 @@
    } else if (titDict[val]) {
      val = titDict[val]
    }
    val = s + val + e
    return val
  }
  let replaceBtn = (val) => {
    let s = ''
    let e = ''
    if (/^\s+/g) {
      val = val.replace(/^\s+/g, (w) => {
        s = w
        return ''
      })
    }
    if (/\s+$/g) {
      val = val.replace(/\s+$/g, (w) => {
        e = w
        return ''
      })
    }
    if (btnDict[val]) {
      val = btnDict[val]
    }
    val = s + val + e
    return val
  }
  let replaceList = (val) => {
    let s = ''
    let e = ''
    if (/^\s+/g) {
      val = val.replace(/^\s+/g, (w) => {
        s = w
        return ''
      })
    }
    if (/\s+$/g) {
      val = val.replace(/\s+$/g, (w) => {
        e = w
        return ''
      })
    }
    if (lisDict[val]) {
      val = lisDict[val]
    }
    val = s + val + e
    return val
  }
  let replaceMenu = (val) => {
    let s = ''
    let e = ''
    if (/^\s+/g) {
      val = val.replace(/^\s+/g, (w) => {
        s = w
        return ''
      })
    }
    if (/\s+$/g) {
      val = val.replace(/\s+$/g, (w) => {
        e = w
        return ''
      })
    }
    if (menuDict[val]) {
      val = menuDict[val]
    }
    val = s + val + e
    return val
  }
@@ -3291,8 +3488,8 @@
  }
  let filterBtn = (btn) => {
    if (btn.label && btnDict[btn.label]) {
      btn.label = btnDict[btn.label]
    if (btn.label) {
      btn.label = replaceBtn(btn.label)
    }
    if (!btn.verify) return
@@ -3340,8 +3537,8 @@
      n.dataSource = filterSql(n.dataSource)
    } else if (n.options) {
      n.options.forEach(o => {
        if (o.Text && lisDict[o.Text]) {
          o.Text = lisDict[o.Text]
        if (o.Text) {
          o.Text = replaceList(o.Text)
        }
      })
    }
@@ -3422,8 +3619,8 @@
        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.name) {
              cell.setting.name = replaceMenu(cell.setting.name)
            }
            return cell
          })