king
2021-03-08 75f3fd6e67851b9079e0b82c8cd94bf7649fe8bd
src/menu/components/share/actioncomponent/formconfig.jsx
@@ -12,6 +12,7 @@
 * @param {*} type           按钮类型,用于区分可选的打开方式
 */
export function getActionForm (card, functip, setting, usefulFields, type, menulist = [], modules = []) {
  let appMenus = []
  let opentypes = [
    {
      value: 'pop',
@@ -43,6 +44,43 @@
    }
  ]
  let pageTemps = [
    { value: 'billprint', text: '单据打印' },
    { value: 'pay', text: Formdict['model.pay'] },
    { value: 'custom', text: Formdict['header.form.custom'] }
  ]
  const isApp = sessionStorage.getItem('appType') === 'pc'
  let funTypes = [
    { value: 'changeuser', text: Formdict['header.form.func.changeuser'] },
    { value: 'print', text: '标签打印' }
  ]
  if (isApp) {
    opentypes = opentypes.filter(item => item.value !== 'tab')
    pageTemps = [
      { value: 'page', text: '菜单' },
      { value: 'linkpage', text: '关联菜单' },
      { value: 'billprint', text: '单据打印' },
      { value: 'pay', text: Formdict['model.pay'] },
      { value: 'custom', text: '链接' }
    ]
    funTypes = [
      { value: 'changeuser', text: Formdict['header.form.func.changeuser'] },
    ]
    appMenus = sessionStorage.getItem('appMenus')
    if (appMenus) {
      try {
        appMenus = JSON.parse(appMenus)
        appMenus = appMenus.map(item => ({value: item.MenuID, text: item.MenuName}))
      } catch {
        appMenus = []
      }
    } else {
      appMenus = []
    }
  }
  if (type === 'chart') {
    opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut')
  }
@@ -69,15 +107,9 @@
      type: 'radio',
      key: 'funcType',
      label: Formdict['header.form.funcType'],
      initVal: card.funcType || 'print',
      initVal: card.funcType || (isApp ? 'changeuser' : ''),
      required: true,
      options: [{
        value: 'changeuser',
        text: Formdict['header.form.func.changeuser']
      }, {
        value: 'print',
        text: '标签打印'
      }]
      options: funTypes
    },
    {
      type: 'select',
@@ -158,21 +190,43 @@
      label: Formdict['model.form.newpage.type'],
      initVal: card.pageTemplate || '',
      required: true,
      options: pageTemps
    },
    {
      type: 'radio',
      key: 'open',
      label: '链接方式',
      initVal: card.open || 'blank',
      required: true,
      forbid: !isApp,
      options: [{
        value: 'billprint',
        text: '单据打印'
        value: 'blank',
        text: '新窗口'
      }, {
        value: 'pay',
        text: Formdict['model.pay']
      }, {
        value: 'custom',
        text: Formdict['header.form.custom']
        value: 'self',
        text: '当前窗口'
      }]
    },
    {
      type: 'text',
      type: 'select',
      key: 'linkmenu',
      label: '关联菜单',
      initVal: card.linkmenu || '',
      required: true,
      options: appMenus
    },
    {
      type: 'select',
      key: 'copyMenuId',
      label: '复制菜单',
      initVal: card.copyMenuId || '',
      required: false,
      options: appMenus
    },
    {
      type: 'textarea',
      key: 'url',
      label: Formdict['model.form.newpage.url'],
      label: Formdict['model.pageUrl'],
      initVal: card.url || '',
      required: true
    },
@@ -273,6 +327,7 @@
      label: Formdict['model.form.linkmenu'],
      initVal: card.linkmenu || [],
      required: true,
      forbid: isApp,
      options: menulist
    },
    {