king
2024-06-21 2bccb9ec7bdefe23292a22bc153463cfa1479a49
src/utils/utils-custom.js
@@ -1799,23 +1799,31 @@
      if (!cell.modal || cell.modal.fields.length === 0) {
        errors.push({ level: 0, detail: `按钮“${cell.label}”中表单尚未添加`})
      }
    } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) {
      errors.push({ level: 0, detail: `按钮“${cell.label}”中导入列未设置!`})
    } else if (cell.OpenType === 'excelIn') {
      if (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0) {
        errors.push({ level: 0, detail: `按钮“${cell.label}”中导入列未设置!`})
      }
    } else if (cell.OpenType === 'excelOut') {
      if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) {
        errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列未设置!`})
      } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom' && card.$c_ds && columns.length > 0) {
        let cols = []
        cell.verify.columns.forEach(col => {
          if (col.output === 'false' || col.Column === '$Index') return
          if (!columns.includes(col.Column)) {
            cols.push(col.Column)
      } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom') {
        if (!card.setting || card.setting.interType !== 'system') {
          errors.push({ level: 0, detail: `按钮“${cell.label}”需自定义导出数据源!`})
        } else if (card.type === 'balcony' || card.subtype === 'propcard') {
          errors.push({ level: 0, detail: `按钮“${cell.label}”需自定义导出数据源!`})
        } else if (card.$c_ds && columns.length > 0) {
          let cols = []
          cell.verify.columns.forEach(col => {
            if (col.output === 'false' || col.Column === '$Index') return
            if (!columns.includes(col.Column)) {
              cols.push(col.Column)
            }
          })
          if (cols.length) {
            errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列(${cols.join('、')})在字段集中不存在!`})
          }
        })
        if (cols.length) {
          errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列(${cols.join('、')})在字段集中不存在!`})
        }
      }
      }
    }
    if (['pop', 'prompt', 'exec'].includes(cell.OpenType) && cell.verify && !cell.output) {
@@ -1823,6 +1831,32 @@
        errors.push({ level: 0, detail: `按钮“${cell.label}”未设置返回值短信发送无效!`})
      } else if (cell.verify.emailEnable === 'true') {
        errors.push({ level: 0, detail: `按钮“${cell.label}”未设置返回值邮件发送无效!`})
      }
    }
    if (['exec', 'prompt', 'pop', 'form', 'formSubmit'].includes(cell.OpenType)) {
      if (cell.OpenType === 'form' && cell.formType === 'count_line') return
      if (cell.intertype === 'system') {
        if (cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
          errors.push({ level: 0, detail: `按钮“${cell.label}”使用了创建凭证函数,需要选择行!`})
        }
      } else if (cell.intertype === 'custom' || cell.intertype === 'outer') {
        if (cell.callbackType === 'script' && (!cell.verify || !cell.verify.cbScripts || !cell.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) {
          errors.push({ level: 0, detail: `按钮“${cell.label}”使用了自定义脚本回调,回调脚本不可为空!`})
        } else if (cell.procMode === 'system' && cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
          errors.push({ level: 0, detail: `按钮“${cell.label}”使用了创建凭证函数,需要选择行!`})
        }
      }
    } else if (cell.OpenType === 'funcbutton' && cell.funcType === 'print') {
      if (!cell.verify || !cell.verify.printMode) {
        errors.push({ level: 0, detail: `按钮“${cell.label}”请完善验证信息!`})
      } else if (cell.intertype === 'system' && cell.verify.dataType === 'custom' && (!cell.verify.setting || cell.verify.columns.length === 0)) {
        errors.push({ level: 0, detail: `按钮“${cell.label}”使用了自定义打印数据,请设置数据源!`})
      }
    } else if (cell.OpenType === 'innerpage' || cell.OpenType === 'outerpage') {
      if (!cell.pageTemplate) {
        errors.push({ level: 0, detail: `按钮“${cell.label}”页面类型设置错误!`})
      }
    }
  }
@@ -2083,6 +2117,11 @@
 */
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
@@ -2101,6 +2140,7 @@
  let btn = []
  let ops = []
  let text = []
  let menu = []
  let filterElement = (card) => {
    if (card.datatype === 'static' && card.eleType === 'text' && !/@.+@/g.test(card.value)) {
@@ -2185,9 +2225,26 @@
          })
        }
        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 => {
@@ -2205,7 +2262,29 @@
          })
        }
        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') {
@@ -2319,25 +2398,8 @@
  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') {
@@ -2350,13 +2412,33 @@
    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 = []
@@ -2376,7 +2458,7 @@
/**
 * @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]) {
@@ -2553,13 +2635,13 @@
          if (item.wrap.click === 'menu') {
            resetMenu(item.wrap)
          } else if (item.wrap.click === 'menus') {
            resetMenus(config.wrap)
            resetMenus(item.wrap)
          }
        } else if (item.plot && (item.plot.click === 'menu' || item.plot.click === 'menus')) {
          if (item.plot.click === 'menu') {
            resetMenu(item.plot)
          } else if (item.plot.click === 'menus') {
            resetMenus(config.plot)
            resetMenus(item.plot)
          }
        }
        if (item.setting && (!item.wrap || !item.wrap.datatype || item.wrap.datatype === 'dynamic')) {
@@ -2579,9 +2661,26 @@
          })
        }
        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 => {
@@ -2598,8 +2697,15 @@
          })
        }
        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
            }