king
2021-10-15 4d13944afeb0e095dfedaf820a192f844f5f541a
src/menu/components/share/actioncomponent/formconfig.jsx
@@ -13,6 +13,7 @@
 */
export function getActionForm (card, functip, config, usefulFields, type, menulist = [], modules = []) {
  let appType = sessionStorage.getItem('appType')
  let viewType = sessionStorage.getItem('editMenuType') // 弹窗 popview
  let setting = config.setting || {}
  let columns = config.columns || []
  let appMenus = []
@@ -47,6 +48,32 @@
    }
  ]
  let getTabs = (list) => {
    return list.filter(item => {
      if (item.type !== 'tabs') return false
      item.children = item.children.map(cell => {
        cell.children = getTabs(cell.children)
        return cell
      })
      return item
    })
  }
  if (type === 'editable') {
    opentypes = [
      {
        value: 'excelIn',
        text: Formdict['model.form.excelIn']
      }, {
        value: 'excelOut',
        text: Formdict['model.form.excelOut']
      }
    ]
  }
  let tabs = getTabs(JSON.parse(JSON.stringify(modules)))
  let pageTemps = [
    { value: 'billprint', text: '单据打印' },
    { value: 'pay', text: Formdict['model.pay'] },
@@ -61,16 +88,6 @@
  ]
  
  if (isApp) {
    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 {
@@ -87,10 +104,24 @@
      funTypes = [
        { value: 'mkBinding', text: '开通扫码登录' },
        { value: 'mkUnBinding', text: '用户解绑' },
        // { value: 'scan', text: '扫一扫' },
        { value: 'reAuth', text: '重新授权' },
        { value: 'goBack', text: '返回' },
      ]
      pageTemps = [
        { value: 'linkpage', text: '关联菜单' },
        // { value: 'pay', text: Formdict['model.pay'] },
        { value: 'custom', text: '链接' }
      ]
    } else {
      pageTemps = [
        { value: 'linkpage', text: '关联菜单' },
        { value: 'billprint', text: '单据打印' },
        { value: 'pay', text: Formdict['model.pay'] },
        { value: 'custom', text: '链接' }
      ]
      funTypes = [
        { value: 'changeuser', text: Formdict['header.form.func.changeuser'] },
      ]
      opentypes = opentypes.filter(item => item.value !== 'tab')
    }
  }
@@ -100,7 +131,7 @@
  }
  let refresh = []
  if (sessionStorage.getItem('editMenuType') === 'popview') { // 弹窗标签
  if (viewType === 'popview') { // 弹窗标签
    opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton')
    refresh.push({
      value: 'popclose',
@@ -338,15 +369,6 @@
      options: menulist
    },
    {
      type: 'cascader',
      key: 'refreshTab',
      label: '刷新标签',
      initVal: card.refreshTab || [],
      required: false,
      forbid: isApp,
      options: menulist
    },
    {
      type: 'select',
      key: 'execSuccess',
      label: Formdict['model.form.afterSuccess'],
@@ -362,6 +384,9 @@
      }, {
        value: 'mainline',
        text: '刷新上级组件 - 行'
      }, {
        value: !appType ? 'closetab' : 'goback',
        text: !appType ? '关闭标签' : '返回(上一个页面)'
      },
      ...refresh]
    },
@@ -529,12 +554,32 @@
      }]
    },
    {
      type: 'mcascader',
      type: 'cascader',
      key: 'syncComponent',
      label: '同步刷新',
      label: '刷新组件',
      initVal: card.syncComponent || [],
      tooltip: '执行成功后,需要同步刷新的组件',
      required: false,
      options: modules
    },
    {
      type: 'cascader',
      key: 'switchTab',
      label: '切换标签',
      initVal: card.switchTab || [],
      tooltip: '执行成功后,需要切换的标签页',
      required: false,
      options: tabs
    },
    {
      type: 'cascader',
      key: 'refreshTab',
      label: '刷新菜单',
      initVal: card.refreshTab || [],
      tooltip: '执行成功后或标签关闭时,需要同步刷新的菜单',
      required: false,
      forbid: isApp || viewType === 'popview',
      options: menulist
    },
    {
      type: 'select',
@@ -555,15 +600,24 @@
      required: false
    },
    {
      type: 'select',
      type: 'cascader',
      key: 'linkmenu',
      label: Formdict['model.form.linkmenu'],
      initVal: card.linkmenu || [],
      required: true,
      forbid: isApp,
      options: menulist
    },
    {
      type: !appType ? 'cascader' : 'select',
      key: 'openmenu',
      label: '打开菜单',
      tooltip: '执行成功后需要打开的菜单。',
      initVal: card.openmenu || '',
      forbid: appType !== 'pc' && appType !== 'mob',
      initVal: card.openmenu || (!appType ? [] : ''),
      required: false,
      allowClear: true,
      options: appType !== 'mob' ? appMenus : [...appMenus, {value: 'goback', text: '返回'}]
      options: appType === 'mob' ? [...appMenus, {value: 'goback', text: '返回'}] : (appType === 'pc' ? appMenus : menulist),
      forbid: viewType === 'popview'
    },
    {
      type: 'text',
@@ -571,8 +625,8 @@
      label: '返回值',
      tooltip: '执行成功后的返回值。',
      initVal: card.output || '',
      forbid: appType !== 'pc' && appType !== 'mob',
      required: false
      required: false,
      forbid: viewType === 'popview'
    },
    {
      type: 'radio',