king
2021-12-18 b223552a0c4bc787ad251add025a93d77527ffbe
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 = []
@@ -59,6 +60,18 @@
    })
  }
  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 = [
@@ -69,7 +82,7 @@
  const isApp = ['pc', 'mob'].includes(appType)
  let funTypes = [
    { value: 'changeuser', text: Formdict['header.form.func.changeuser'] },
    { value: 'changeuser', text: '切换用户' },
    { value: 'print', text: '标签打印' },
    { value: 'closetab', text: '标签关闭' },
  ]
@@ -89,9 +102,11 @@
    if (appType === 'mob') {
      opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value))
      funTypes = [
        { value: 'scan', text: '扫码' },
        { value: 'logout', text: '退出' },
        { value: 'mkBinding', text: '开通扫码登录' },
        { value: 'mkUnBinding', text: '用户解绑' },
        { value: 'reAuth', text: '重新授权' },
        { value: 'reAuth', text: '切换系统(清空缓存-小程序)' },
        { value: 'goBack', text: '返回' },
      ]
      pageTemps = [
@@ -107,7 +122,7 @@
        { value: 'custom', text: '链接' }
      ]
      funTypes = [
        { value: 'changeuser', text: Formdict['header.form.func.changeuser'] },
        { value: 'changeuser', text: '切换用户' },
      ]
      opentypes = opentypes.filter(item => item.value !== 'tab')
    }
@@ -118,12 +133,20 @@
  }
  let refresh = []
  if (sessionStorage.getItem('editMenuType') === 'popview') { // 弹窗标签
  if (viewType === 'popview') { // 弹窗标签
    opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton')
    refresh.push({
      value: 'popclose',
      text: '标签刷新'
      value: 'closepoptab', // 关闭弹窗标签
      text: '关闭弹窗'
    })
    refresh.push({
      value: 'popclose',  // 执行弹窗关闭时的刷新
      text: '刷新源组件'
    })
  }
  if (!card.control && card.controlField) {
    card.control = 'disabled'
  }
  let forms = [
@@ -138,7 +161,7 @@
    {
      type: 'select',
      key: 'funcType',
      label: Formdict['header.form.funcType'],
      label: '功能类型',
      initVal: card.funcType || '',
      required: true,
      options: funTypes
@@ -341,9 +364,8 @@
      type: 'select',
      key: 'Ot',
      label: Formdict['header.form.isRequired'],
      initVal: card.Ot || 'requiredSgl',
      initVal: card.Ot || (card.sqlType === 'insert' ? 'notRequired' : 'requiredSgl'),
      required: true,
      forbid: card.$type === 'tableButton',
      options: []
    },
    {
@@ -360,7 +382,7 @@
      key: 'execSuccess',
      label: Formdict['model.form.afterSuccess'],
      initVal: card.execSuccess || 'never',
      tooltip: refresh.length ? '执行标签刷新时,会同步刷新当前组件和上级组件-行。' : '刷新上级组件-行时,会同步刷新当前组件,注:上级组件在数据源中添加。',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。' : '刷新上级组件-行时,会同步刷新当前组件,注:上级组件在数据源中添加。',
      required: true,
      options: [{
        value: 'never',
@@ -369,11 +391,14 @@
        value: 'grid',
        text: '刷新当前组件'
      }, {
        value: 'line',
        text: '刷新行'
      }, {
        value: 'mainline',
        text: '刷新上级组件 - 行'
      }, {
        value: 'closetab',
        text: '关闭标签'
        value: !appType ? 'closetab' : 'goback',
        text: !appType ? '关闭标签' : '返回(上一个页面)'
      },
      ...refresh]
    },
@@ -382,7 +407,7 @@
      key: 'execError',
      label: Formdict['model.form.afterError'],
      initVal: card.execError || 'never',
      tooltip: refresh.length ? '执行标签关闭刷新时,会同步刷新当前组件和上级组件-行。' : '刷新上级组件-行时,会同步刷新当前组件,注:上级组件在数据源中添加。',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。' : '刷新上级组件-行时,会同步刷新当前组件,注:上级组件在数据源中添加。',
      required: true,
      options: [{
        value: 'never',
@@ -390,6 +415,9 @@
      }, {
        value: 'grid',
        text: '刷新当前组件'
      }, {
        value: 'line',
        text: '刷新行'
      }, {
        value: 'mainline',
        text: '刷新上级组件 - 行'
@@ -445,6 +473,7 @@
      label: '显示为',
      initVal: card.show || 'button',
      required: true,
      forbid: type === 'datacard' && appType === 'mob', // 移动端,滑动显示的按钮只显示文字
      options: [{
        value: 'icon',
        text: '图标'
@@ -460,13 +489,13 @@
      type: 'radio',
      key: 'swipe',
      label: "滑动显示",
      initVal: card.swipe || 'false',
      initVal: card.swipe === 'false' ? 'left' : (card.swipe || 'left'), // 移动端仅保留滑动显示按钮
      required: false,
      forbid: (type !== 'datacard' || appType !== 'mob'),
      options: [{
        value: 'false',
        text: '否'
      }, {
      //   value: 'false',
      //   text: '否'
      // }, {
        value: 'left',
        text: '左滑'
      }, {
@@ -480,6 +509,7 @@
      label: Formdict['model.icon'],
      initVal: card.icon,
      required: false,
      forbid: type === 'datacard' && appType === 'mob', // 移动端,滑动显示的按钮只显示文字
      options: []
    },
    {
@@ -489,7 +519,32 @@
      initVal: card.class,
      tooltip: '此颜色为按钮初始化颜色,可在样式调整中修改。',
      required: false,
      forbid: type === 'datacard' && appType === 'mob', // 移动端,滑动显示的按钮不设置通用颜色
      options: []
    },
    {
      type: 'radio',
      key: 'color',
      label: Formdict['model.form.color'],
      initVal: card.color || 'primary',
      required: false,
      forbid: (type !== 'datacard' || appType !== 'mob'), // 移动端,滑动显示的按钮只可设置固定颜色
      options: [{
        value: 'primary',
        text: '蓝'
      }, {
        value: 'danger',
        text: '红'
      }, {
        value: 'warning',
        text: '橙'
      }, {
        value: 'success',
        text: '绿'
      }, {
        value: 'light',
        text: '灰'
      }]
    },
    {
      type: 'radio',
@@ -515,7 +570,7 @@
    {
      type: 'radio',
      key: 'pagination',
      label: Formdict['header.form.pagination'],
      label: '分页',
      initVal: card.pagination || 'false',
      required: false,
      options: [{
@@ -545,7 +600,7 @@
      key: 'syncComponent',
      label: '刷新组件',
      initVal: card.syncComponent || [],
      tooltip: '执行成功后,需要同步刷新的组件',
      tooltip: '执行成功后(或弹窗标签关闭时),需要同步刷新的组件',
      required: false,
      options: modules
    },
@@ -563,39 +618,30 @@
      key: 'refreshTab',
      label: '刷新菜单',
      initVal: card.refreshTab || [],
      tooltip: '执行成功后或标签关闭时,需要同步刷新的菜单',
      tooltip: '执行成功后(或功能按钮中标签关闭类型),需要同步刷新的菜单',
      required: false,
      forbid: isApp || viewType === 'popview',
      options: menulist
    },
    {
      type: 'cascader',
      key: 'linkmenu',
      label: Formdict['model.form.linkmenu'],
      initVal: card.linkmenu || [],
      required: true,
      forbid: isApp,
      options: menulist
    },
    {
      type: 'select',
      key: 'controlField',
      label: '控制字段',
      tooltip: '禁用控制字段,可根据数据控制按钮是否禁用。',
      initVal: card.controlField || '',
      required: false,
      allowClear: true,
      options: columns
    },
    {
      type: 'text',
      key: 'controlVal',
      label: '控制值',
      tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会禁用,多个值用逗号分隔。',
      initVal: card.controlVal || '',
      required: false
    },
    {
      type: 'select',
      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',
@@ -603,8 +649,8 @@
      label: '返回值',
      tooltip: '执行成功后的返回值。',
      initVal: card.output || '',
      forbid: appType !== 'pc' && appType !== 'mob',
      required: false
      required: false,
      forbid: viewType === 'popview'
    },
    {
      type: 'radio',
@@ -667,6 +713,70 @@
        text: '下侧'
      }]
    },
    {
      type: 'radio',
      key: 'clickouter',
      label: '点击蒙层',
      initVal: card.clickouter || 'unclose',
      required: false,
      options: [{
        value: 'unclose',
        text: '不关闭'
      }, {
        value: 'close',
        text: '关闭'
      }]
    },
    {
      type: 'radio',
      key: 'reload',
      label: '返回后',
      initVal: card.reload || 'false',
      tooltip: '按钮成功后返回上一页面或使用功能按钮-返回功能时,返回后是否刷新数据。注:在明科云app中(应用模式为app)有效。',
      forbid: appType !== 'mob',
      options: [{
        value: 'false',
        text: '不刷新'
      }, {
        value: 'true',
        text: '刷新'
      }]
    },
    {
      type: 'radio',
      key: 'control',
      label: '按钮控制',
      initVal: card.control || (card.controlField ? 'disabled' : ''),
      required: false,
      options: [{
        value: '',
        text: '无'
      }, {
        value: 'disabled',
        text: '禁用'
      }, {
        value: 'hidden',
        text: '隐藏'
      }]
    },
    {
      type: 'select',
      key: 'controlField',
      label: '控制字段',
      tooltip: '控制字段,可根据数据控制按钮的隐藏或禁用。',
      initVal: card.controlField || '',
      required: true,
      allowClear: true,
      options: columns
    },
    {
      type: 'text',
      key: 'controlVal',
      label: '控制值',
      tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会隐藏或禁用,多个值用逗号分隔。',
      initVal: card.controlVal || '',
      required: false
    },
  ]
  return forms