king
2023-06-14 08cce3334a2dc81d690b518136b0aaea64e48b0b
src/menu/components/share/actioncomponent/formconfig.jsx
@@ -1,4 +1,4 @@
import { btnCustomClasses, btnClasses } from '@/utils/option.js'
import { btnClasses } from '@/utils/option.js'
/**
@@ -9,13 +9,13 @@
 * @param {*} usefulFields   存储过程可用的开始字段
 * @param {*} type           按钮类型,用于区分可选的打开方式
 */
export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = []) {
export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = [], side) {
  let appType = sessionStorage.getItem('appType')
  let viewType = sessionStorage.getItem('editMenuType') // 弹窗 popview
  let printTemps = sessionStorage.getItem('printTemps')
  printTemps = printTemps ? JSON.parse(printTemps) : []
  let setting = config.setting || {}
  let columns = config.columns || []
  let columns = side === 'sub' && config.subColumns ? config.subColumns : (config.columns || [])
  let appMenus = []
  let menulist = []
  let type = ''
@@ -97,7 +97,6 @@
    { value: 'print', text: '标签打印' },
    { value: 'refund', text: '退款' },
    { value: 'closetab', text: '标签关闭' },
    { value: 'changeuser', text: '切换用户' },
    { value: 'megvii', text: '旷视面板机' },
    { value: 'filezip', text: '文件压缩包' },
  ]
@@ -113,6 +112,7 @@
    } else {
      appMenus = []
    }
    appMenus.push({value: 'goback', text: '返回(上一页)'})
  } else {
    menulist = sessionStorage.getItem('fstMenuList')
    if (menulist) {
@@ -150,7 +150,6 @@
    opentypes = opentypes.filter(item => item.value !== 'tab')
    funTypes = [
      { value: 'print', text: '标签打印' },
      { value: 'changeuser', text: '切换用户' },
    ]
    pageTemps = [
      { value: 'linkpage', text: '关联菜单' },
@@ -158,6 +157,25 @@
      { value: 'pay', text: '支付' },
      { value: 'custom', text: '链接' }
    ]
  } else {
    if (card.pageTemplate === 'print') { // 原类型支持
      pageTemps.unshift({ value: 'print', text: '标签打印模板' })
    } else if (card.pageTemplate === 'billprintTemp') { // 原类型支持
      pageTemps.unshift({ value: 'billprintTemp', text: '单据打印模板' })
    }
  }
  if (card.funcType === 'changeuser') { // 原类型支持
    funTypes.unshift({ value: 'changeuser', text: '切换用户' })
  }
  if (config.subtype === 'editable') { // 编辑表的添加、删除
    funTypes.push(
      { value: 'addline', text: '增加行(编辑表)' },
      { value: 'delline', text: '删除行(编辑表)' }
    )
  } else if (card.funcType === 'addline' || card.funcType === 'delline') {
    card.funcType = ''
  }
  
  if (type === 'chart' && appType !== 'mob') {
@@ -170,7 +188,10 @@
  let refresh = []
  if (viewType === 'popview') { // 弹窗标签
    opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton')
    opentypes = opentypes.filter(item => item.value !== 'popview')
    funTypes = funTypes.filter(item => item.value !== 'print')
    refresh.push({
      value: 'closepoptab', // 关闭弹窗标签
      text: '关闭弹窗'
@@ -535,7 +556,7 @@
      key: 'execSuccess',
      label: '成功后',
      initVal: card.execSuccess || 'grid',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。',
      required: true,
      options: [{
        value: 'never',
@@ -558,7 +579,7 @@
      key: 'execError',
      label: '失败后',
      initVal: card.execError || 'never',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。',
      required: true,
      options: [{
        value: 'never',
@@ -671,7 +692,7 @@
      tooltip: '此颜色为按钮初始化颜色,可在样式调整中修改。',
      required: false,
      forbid: type === 'datacard' && appType === 'mob', // 移动端,滑动显示的按钮不设置通用颜色
      options: btnCustomClasses
      options: btnClasses
    },
    {
      type: 'radio',
@@ -695,6 +716,9 @@
      }, {
        value: 'light',
        text: '灰'
      }, {
        value: 'system',
        text: '系统'
      }]
    },
    {
@@ -725,7 +749,7 @@
      initVal: card.syncComponent || [],
      tooltip: '执行成功后(或弹窗标签关闭时),需要同步刷新的组件。注:选择当前组件的上级组件无效,刷新上级组件请选择成功后“刷新上级组件 - 行”。',
      required: false,
      options: modules
      options: modules.length ? [...modules, {value: 'multiComponent', label: '多组件'}] : []
    },
    {
      type: 'radio',
@@ -796,7 +820,7 @@
      extendName: 'MenuNo',
      required: false,
      allowClear: true,
      options: appType === 'mob' || appType === 'pc' ? [...appMenus, {value: 'goback', text: '返回(上一页)'}] : menulist,
      options: appType === 'mob' || appType === 'pc' ? appMenus : menulist,
      forbid: viewType === 'popview'
    },
    {
@@ -949,6 +973,15 @@
        value: 'bottom',
        text: '底部'
      }]
    },
    {
      type: 'text',
      key: 'preFunc',
      label: '前置函数',
      initVal: card.preFunc || '',
      tooltip: '前置函数执行完成后,结果会传入内部函数中,此时内部函数会异步执行;当前置函数返回中ErrCode等于-1时,将不再执行内部函数。',
      required: false,
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
@@ -1135,6 +1168,27 @@
        value: 'progressbar',
        text: '进度条'
      }]
    },
    {
      type: 'table',
      key: 'syncComponents',
      label: '组件列表',
      initVal: card.syncComponents || [],
      required: true,
      actions: [],
      columns: [
        {
          title: '组件',
          dataIndex: 'syncComId',
          inputType: 'cascader',
          editable: true,
          required: true,
          extends: [{key: 'label', value: 'label'}],
          width: '70%',
          render: (text, record) => record.label,
          options: modules
        }
      ]
    }
  ]
@@ -1194,14 +1248,23 @@
    { value: 'custom', text: '自定义' }
  ]
  if (card.pageTemplate === 'print') { // 原类型支持
    pageTemps.unshift({ value: 'print', text: '标签打印模板' })
  } else if (card.pageTemplate === 'billprintTemp') { // 原类型支持
    pageTemps.unshift({ value: 'billprintTemp', text: '单据打印模板' })
  }
  let funTypes = [
    { value: 'print', text: '标签打印' },
    { value: 'refund', text: '退款' },
    { value: 'closetab', text: '标签关闭' },
    { value: 'changeuser', text: '切换用户' },
    { value: 'megvii', text: '旷视面板机' },
    { value: 'filezip', text: '文件压缩包' },
  ]
  if (card.funcType === 'changeuser') { // 原类型支持
    funTypes.unshift({ value: 'changeuser', text: '切换用户' })
  }
  let menulist = sessionStorage.getItem('fstMenuList')
  if (menulist) {
@@ -1216,7 +1279,10 @@
  let refresh = []
  if (viewType === 'popview') { // 弹窗标签
    opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton')
    opentypes = opentypes.filter(item => item.value !== 'popview')
    funTypes = funTypes.filter(item => item.value !== 'print')
    refresh.push({
      value: 'closepoptab', // 关闭弹窗标签
      text: '关闭弹窗'
@@ -1516,7 +1582,7 @@
      key: 'execSuccess',
      label: '成功后',
      initVal: card.execSuccess || 'grid',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。',
      required: true,
      options: [{
        value: 'never',
@@ -1538,7 +1604,7 @@
      key: 'execError',
      label: '失败后',
      initVal: card.execError || 'never',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新哪一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。',
      required: true,
      options: [{
        value: 'never',
@@ -1659,7 +1725,7 @@
      initVal: card.syncComponent || [],
      tooltip: '执行成功后(或弹窗标签关闭时),需要同步刷新的组件。注:选择当前组件的上级组件无效,刷新上级组件请选择成功后“刷新上级组件 - 行”。',
      required: false,
      options: modules
      options: modules.length ? [...modules, {value: 'multiComponent', label: '多组件'}] : []
    },
    {
      type: 'radio',
@@ -1789,6 +1855,14 @@
      }]
    },
    {
      type: 'text',
      key: 'preFunc',
      label: '前置函数',
      initVal: card.preFunc || '',
      tooltip: '前置函数执行完成后,结果会传入内部函数中,此时内部函数会异步执行;当前置函数返回中ErrCode等于-1时,将不再执行内部函数。',
      required: false
    },
    {
      type: 'radio',
      key: 'control',
      label: '按钮控制',
@@ -1878,6 +1952,27 @@
        value: 'progressbar',
        text: '进度条'
      }]
    },
    {
      type: 'table',
      key: 'syncComponents',
      label: '组件列表',
      initVal: card.syncComponents || [],
      required: true,
      actions: [],
      columns: [
        {
          title: '组件',
          dataIndex: 'syncComId',
          inputType: 'cascader',
          editable: true,
          required: true,
          extends: [{key: 'label', value: 'label'}],
          width: '70%',
          render: (text, record) => record.label,
          options: modules
        }
      ]
    }
  ]