king
2023-06-28 f07c42a322f41e14ef5b1bf8f2fd66fc5d338cdd
src/menu/components/share/actioncomponent/formconfig.jsx
@@ -1,8 +1,5 @@
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import { btnCustomClasses } from '@/utils/option.js'
import { btnClasses } from '@/utils/option.js'
const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
/**
 * @description 获取按钮表单配置信息
@@ -12,42 +9,53 @@
 * @param {*} usefulFields   存储过程可用的开始字段
 * @param {*} type           按钮类型,用于区分可选的打开方式
 */
export function getActionForm (card, functip, config, usefulFields, type, menulist = [], 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 = ''
  if (card.eleType === 'button') {
    type = 'card'
  } else if (config.subtype === 'datacard' || config.subtype === 'tablecard' || config.subtype === 'dualdatacard') {
    type = 'datacard'
  } else if (config.type === 'line' || config.type === 'bar' || config.type === 'scatter') {
    type = 'chart'
  }
  let opentypes = [
    {
      value: 'pop',
      text: Formdict['model.form.popform']
      text: '弹窗(表单)'
    }, {
      value: 'prompt',
      text: Formdict['model.form.prompt']
      text: '提示框'
    }, {
      value: 'exec',
      text: Formdict['model.form.exec']
      text: '直接执行'
    }, {
      value: 'excelIn',
      text: Formdict['model.form.excelIn']
      text: '导入Excel'
    }, {
      value: 'excelOut',
      text: Formdict['model.form.excelOut']
      text: '导出Excel'
    }, {
      value: 'popview',
      text: Formdict['model.form.popview']
      text: '弹窗(标签)'
    }, {
      value: 'tab',
      text: Formdict['model.form.tab']
      text: '标签页'
    }, {
      value: 'innerpage',
      text: Formdict['model.form.newpage']
      text: '新页面'
    }, {
      value: 'funcbutton',
      text: Formdict['model.form.funcbutton']
      text: '功能按钮'
    }
  ]
@@ -76,29 +84,18 @@
    return _list
  }
  // 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(window.GLOB.customMenu.components)))
  let pageTemps = [
    { value: 'billprint', text: '单据打印' },
    { value: 'pay', text: Formdict['model.pay'] },
    { value: 'custom', text: Formdict['header.form.custom'] }
    { value: 'pay', text: '支付' },
    { value: 'custom', text: '自定义' }
  ]
  const isApp = ['pc', 'mob'].includes(appType)
  let funTypes = [
    { value: 'changeuser', text: '切换用户' },
    { value: 'print', text: '标签打印' },
    { value: 'refund', text: '退款' },
    { value: 'closetab', text: '标签关闭' },
    { value: 'megvii', text: '旷视面板机' },
    { value: 'filezip', text: '文件压缩包' },
@@ -115,17 +112,32 @@
    } else {
      appMenus = []
    }
    appMenus.push({value: 'goback', text: '返回(上一页)'})
  } else {
    menulist = sessionStorage.getItem('fstMenuList')
    if (menulist) {
      try {
        menulist = JSON.parse(menulist)
      } catch (e) {
        menulist = []
      }
    } else {
      menulist = []
    }
  }
  if (appType === 'mob') {
    opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value))
    opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'excelOut', 'popview', 'innerpage', 'funcbutton'].includes(item.value))
    funTypes = [
      { value: 'print', text: '标签打印' },
      { value: 'scan', text: '扫码' },
      { value: 'pay', text: '支付' },
      { value: 'refund', text: '退款' },
      { value: 'resetPwd', text: '修改密码'},
      { value: 'mkBinding', text: '开通扫码登录' },
      { value: 'mkUnBinding', text: '用户解绑' },
      { value: 'mkUnsubscribe', text: '注销账户' },
      { value: 'reAuth', text: '切换系统(清空缓存-小程序)' },
      { value: 'clearCache', text: '清空本地配置' },
      { value: 'copyurl', text: '复制链接地址' },
      { value: 'logout', text: '退出' },
      { value: 'goBack', text: '返回' },
@@ -137,23 +149,49 @@
  } else if (appType === 'pc') {
    opentypes = opentypes.filter(item => item.value !== 'tab')
    funTypes = [
      { value: 'changeuser', text: '切换用户' },
      { value: 'print', text: '标签打印' },
    ]
    pageTemps = [
      { value: 'linkpage', text: '关联菜单' },
      { value: 'billprint', text: '单据打印' },
      { value: 'pay', text: Formdict['model.pay'] },
      { 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') {
    opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut')
    if (card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut') { // 拖拽添加类型转换
      card.OpenType = 'excelOut'
    }
  }
  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: '关闭弹窗'
@@ -167,8 +205,10 @@
  if (type === 'card') {
    opentypes.push({
      value: 'form',
      text: '表单(开关或勾选框)'
      text: '表单'
    })
  } else if (card.OpenType === 'form') { // 拖拽添加类型转换
    card.OpenType = 'pop'
  }
  if (!card.control && card.controlField) {
@@ -184,18 +224,28 @@
  }
  let closetab = []
  if (!appType) {
  if (!appType && viewType !== 'popview') {
    closetab = [{
      value: 'closetab',
      text: '关闭标签'
    }]
  }
  let formTypes = []
  if (appType === 'mob') {
    formTypes = [{
      value: 'scan',
      text: '扫描'
    }]
  } else if (card.formType === 'scan') {
    card.formType = 'switch'
  }
  let forms = [
    {
      type: 'select',
      key: 'OpenType',
      label: Formdict['header.form.openType'],
      label: '按钮类型',
      initVal: card.OpenType,
      required: true,
      options: opentypes
@@ -226,7 +276,7 @@
      ]
    },
    {
      type: 'radio',
      type: formTypes.length ? 'select' : 'radio',
      key: 'formType',
      label: '表单类型',
      initVal: card.formType || 'switch',
@@ -237,29 +287,36 @@
      }, {
        value: 'radio',
        text: '勾选框'
      }]
      }, {
        value: 'counter',
        text: '计数器'
      }, {
        value: 'count_line',
        text: '计数器(本地)'
      },
      ...formTypes]
    },
    {
      type: 'select',
      key: 'execMode',
      label: Formdict['model.form.execMode'],
      label: '执行方式',
      initVal: card.execMode || 'exec',
      required: true,
      options: [{
        value: 'exec',
        text: Formdict['model.form.exec']
        text: '直接执行'
      }, {
        value: 'prompt',
        text: Formdict['model.form.prompt']
        text: '提示框'
      }, {
        value: 'pop',
        text: Formdict['model.form.popform']
        text: '弹窗(表单)'
      }]
    },
    {
      type: 'radio',
      key: 'intertype',
      label: Formdict['header.form.intertype'],
      label: '接口类型',
      initVal: card.intertype || 'system',
      required: true,
      options: []
@@ -273,16 +330,17 @@
      options: [{
        value: 'wxpay',
        text: '微信'
      }, {
        value: 'alipay',
        text: '支付宝'
      // }, {
      //   value: 'alipay',
      //   text: '支付宝'
      }]
    },
    {
      type: 'radio',
      key: 'procMode',
      label: '参数处理',
      initVal: card.procMode || 'system',
      initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'),
      tooltip: '当返回值存在 mk_ex_invoke 且值为 false 时,不会调用外部接口。注:当选“无”时,按钮选行时会传递主键,存在表单时会传递表单字段,存在BID时会传BID字段。',
      required: true,
      options: [{
        value: 'system',
@@ -298,7 +356,7 @@
    {
      type: 'radio',
      key: 'sqlType',
      label: Formdict['header.form.action.type'],
      label: '操作类型',
      initVal: card.sqlType || '',
      required: true,
      options: []
@@ -306,14 +364,14 @@
    {
      type: 'text',
      key: 'sql',
      label: Formdict['model.form.tablename'],
      label: '表名',
      initVal: card.sql || setting.tableName || '',
      required: true
    },
    {
      type: 'text',
      key: 'innerFunc',
      label: Formdict['header.form.innerFunc'],
      label: '内部函数',
      initVal: card.innerFunc || '',
      tooltip: functip,
      fields: usefulFields,
@@ -331,7 +389,7 @@
    {
      type: 'select',
      key: 'pageTemplate',
      label: Formdict['model.form.newpage.type'],
      label: '页面类型',
      initVal: card.pageTemplate || '',
      required: true,
      options: pageTemps
@@ -354,30 +412,51 @@
      options: isApp ? appMenus : menulist
    },
    {
      type: 'text',
      key: 'prefix',
      label: '前缀',
      initVal: card.prefix || '',
      tooltip: '扫码信息将与前缀拼接后执行。注:跳转菜单需以mkbid开头。',
      required: false
    },
    {
      type: 'textarea',
      key: 'url',
      label: Formdict['model.pageUrl'],
      label: '页面地址',
      initVal: card.url || '',
      tooltip: appType === '' ? '地址格式为:http://******/admin/index.html#/iframe/menuId/loginuid/BID 会打开标签页。注:使用@loginuid@时自动替换为当前系统的loginuid;选择单行且拼接参数时会拼接BID。' : '',
      required: true
    },
    {
      type: 'textarea',
      key: 'proUrl',
      label: '正式地址',
      initVal: card.proUrl || '',
      tooltip: appType === '' ? '地址格式为:http://******/admin/index.html#/iframe/menuId/loginuid/BID 会打开标签页。注:使用@loginuid@时自动替换为当前系统的loginuid;选择单行且拼接参数时会拼接BID。' : '',
      required: false
    },
    {
      type: 'radio',
      key: 'sysInterface',
      label: Formdict['header.form.sysInterface'],
      label: '系统类型',
      initVal: card.sysInterface || 'false',
      tooltip: '业务系统指同一sso下的其他业务系统,外部系统指不同sso下的其他业务系统。',
      required: true,
      options: [{
        value: 'true',
        text: Formdict['model.true']
      }, {
        value: 'false',
        text: Formdict['model.false']
        text: '业务'
      }, {
        value: 'true',
        text: '单点'
      }, {
        value: 'external',
        text: '外部'
      }]
    },
    {
      type: 'text',
      key: 'outerFunc',
      label: Formdict['header.form.outerFunc'],
      label: '外部函数',
      initVal: card.outerFunc || '',
      required: false,
    },
@@ -398,39 +477,25 @@
      required: false
    },
    {
      type: 'radio',
      key: 'method',
      label: '请求方式',
      initVal: card.method || 'post',
      required: true,
      options: [{
        value: 'get',
        text: 'GET'
      }, {
        value: 'post',
        text: 'POST'
      }]
      type: 'keyinterface',
      key: 'exInterface',
      label: '测试地址',
      initVal: card.exInterface || '',
      required: true
    },
    {
      type: 'radio',
      key: 'cross',
      label: '跨域请求',
      initVal: card.cross || 'true',
      tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。',
      required: false,
      options: [{
        value: 'true',
        text: '支持'
      }, {
        value: 'false',
        text: '不支持'
      }]
      type: 'keyinterface',
      key: 'exProInterface',
      label: '正式地址',
      initVal: card.exProInterface || '',
      tooltip: '正式系统所使用的接口地址。',
      required: false
    },
    {
      type: 'radio',
      key: 'callbackType',
      label: '回调方式',
      initVal: card.callbackType || 'script',
      initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'),
      tooltip: '使用后台脚本执行时,需要配合计划任务。',
      required: true,
      options: [{
@@ -457,14 +522,60 @@
    {
      type: 'text',
      key: 'callbackFunc',
      label: Formdict['header.form.callbackFunc'],
      label: '回调函数',
      initVal: card.callbackFunc || '',
      required: true
    },
    {
      type: 'radio',
      key: 'method',
      label: '请求方式',
      initVal: card.method || 'post',
      required: true,
      options: [{
        value: 'get',
        text: 'GET'
      }, {
        value: 'post',
        text: 'POST'
      }]
    },
    {
      type: 'radio',
      key: 'cross',
      label: '接口跨域',
      initVal: card.cross || 'true',
      tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。',
      required: false,
      options: [{
        value: 'true',
        text: '支持'
      }, {
        value: 'false',
        text: '不支持'
      }]
    },
    {
      type: 'radio',
      key: 'stringify',
      label: '序列化',
      initVal: card.stringify || 'text',
      required: false,
      options: [{
        value: 'text',
        text: 'Text'
      }, {
        value: 'JSON',
        text: 'JSON'
      }, {
        value: 'qs',
        text: 'qs'
      }]
    },
    {
      type: 'select',
      key: 'Ot',
      label: Formdict['header.form.isRequired'],
      label: '行设置',
      initVal: card.Ot || (card.sqlType === 'insert' ? 'notRequired' : 'requiredSgl'),
      required: true,
      options: []
@@ -472,13 +583,13 @@
    {
      type: 'select',
      key: 'execSuccess',
      label: Formdict['model.form.afterSuccess'],
      label: '成功后',
      initVal: card.execSuccess || 'grid',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。',
      required: true,
      options: [{
        value: 'never',
        text: Formdict['header.form.refresh.never']
        text: '不刷新'
      }, {
        value: 'line',
        text: '刷新行'
@@ -495,13 +606,13 @@
    {
      type: 'select',
      key: 'execError',
      label: Formdict['model.form.afterError'],
      label: '失败后',
      initVal: card.execError || 'never',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。',
      required: true,
      options: [{
        value: 'never',
        text: Formdict['header.form.refresh.never']
        text: '不刷新'
      }, {
        value: 'line',
        text: '刷新行'
@@ -517,12 +628,12 @@
    {
      type: 'select',
      key: 'popClose',
      label: Formdict['header.form.popClose'],
      label: '关闭后',
      initVal: card.popClose || 'never',
      required: true,
      options: [{
        value: 'never',
        text: Formdict['header.form.refresh.never']
        text: '不刷新'
      }, {
        value: 'grid',
        text: '刷新当前组件'
@@ -596,7 +707,7 @@
    {
      type: 'icon',
      key: 'icon',
      label: Formdict['model.icon'],
      label: '图标',
      initVal: card.icon,
      required: false,
      forbid: type === 'datacard' && appType === 'mob', // 移动端,滑动显示的按钮只显示文字
@@ -605,17 +716,17 @@
    {
      type: 'select',
      key: 'class',
      label: Formdict['model.form.color'],
      label: '颜色',
      initVal: card.class,
      tooltip: '此颜色为按钮初始化颜色,可在样式调整中修改。',
      required: false,
      forbid: type === 'datacard' && appType === 'mob', // 移动端,滑动显示的按钮不设置通用颜色
      options: btnCustomClasses
      options: btnClasses
    },
    {
      type: 'radio',
      key: 'color',
      label: Formdict['model.form.color'],
      label: '颜色',
      initVal: card.color || 'primary',
      required: false,
      forbid: (type !== 'datacard' || appType !== 'mob'), // 移动端,滑动显示的按钮只可设置固定颜色
@@ -634,42 +745,56 @@
      }, {
        value: 'light',
        text: '灰'
      }, {
        value: 'system',
        text: '系统'
      }]
    },
    {
      type: 'radio',
      key: 'joint',
      label: Formdict['model.form.paramJoint'],
      label: '拼接参数',
      initVal: card.joint || 'true',
      required: false,
      options: [{
        value: 'true',
        text: Formdict['model.true']
        text: '是'
      }, {
        value: 'false',
        text: Formdict['model.false']
        text: '否'
      }]
    },
    {
      type: 'text',
      key: 'sheet',
      label: Formdict['model.form.tablename'],
      label: '表名',
      initVal: card.sheet || setting.tableName || '',
      required: true
    },
    {
      type: 'cascader',
      key: 'syncComponent',
      label: '刷新组件',
      initVal: card.syncComponent || [],
      tooltip: '执行成功后(或弹窗标签关闭时),需要同步刷新的组件。注:选择当前组件的上级组件无效,刷新上级组件请选择成功后“刷新上级组件 - 行”。',
      required: false,
      options: modules.length ? [...modules, {value: 'multiComponent', label: '多组件'}] : []
    },
    {
      type: 'radio',
      key: 'pagination',
      label: '分页',
      initVal: card.pagination || 'false',
      tooltip: '导出数据量较大时(1000+),可设置分页请求数据。',
      required: false,
      options: [{
        value: 'true',
        text: Formdict['model.true']
        text: '是'
      }, {
        value: 'false',
        text: Formdict['model.false']
      }]
        text: '否'
      }],
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
@@ -683,16 +808,8 @@
      }, {
        value: 'false',
        text: '非必填'
      }]
    },
    {
      type: 'cascader',
      key: 'syncComponent',
      label: '刷新组件',
      initVal: card.syncComponent || [],
      tooltip: '执行成功后(或弹窗标签关闭时),需要同步刷新的组件。注:选择当前组件的上级组件无效。',
      required: false,
      options: modules
      }],
      forbid: appType === 'mob'
    },
    {
      type: 'cascader',
@@ -729,16 +846,17 @@
      tooltip: '执行成功后需要打开的菜单。',
      initVal: card.openmenu || (!appType ? [] : ''),
      help: appType === 'mob' || appType === 'pc' ? '可返回上一页。' : null,
      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'
    },
    {
      type: 'text',
      key: 'output',
      label: '返回值',
      tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,如@id);自定义函数可指定返回字段(如id)。',
      tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,返回id时可使用@id@);自定义函数可指定返回字段(如id)。',
      initVal: card.output || '',
      required: false,
      forbid: viewType === 'popview'
@@ -766,6 +884,19 @@
    },
    {
      type: 'radio',
      key: 'openTab',
      label: '打开方式',
      initVal: card.openTab || 'newtab',
      tooltip: '菜单打开方式。',
      forbid: appType !== '',
      options: [
        {value: 'newtab', text: '标签页'},
        // {value: 'newpage', text: '新页面(标签页)'},
        {value: 'view', text: '新页面(全屏)'}
      ]
    },
    {
      type: 'radio',
      key: 'display',
      label: '显示方式',
      initVal: card.display || 'modal',
@@ -776,23 +907,13 @@
      }, {
        value: 'drawer',
        text: '抽屉'
      }]
    },
    {
      type: 'number',
      key: 'ratio',
      min: 1,
      max: 3000,
      precision: 0,
      label: '比例',
      initVal: card.ratio || 85,
      tooltip: '模态框或抽屉的宽度,小于100为窗口宽度(或高度)百分比,大于100为像素值。',
      required: true
      }],
      forbid: appType === 'mob',
    },
    {
      type: 'radio',
      key: 'placement',
      label: '抽屉方向',
      label: '弹出方向',
      initVal: card.placement || 'right',
      required: false,
      options: [{
@@ -810,6 +931,17 @@
      }]
    },
    {
      type: 'number',
      key: 'ratio',
      min: 1,
      max: 3000,
      precision: 0,
      label: '比例',
      initVal: card.ratio || 85,
      tooltip: '模态框或抽屉的宽度,小于100为窗口宽度(或高度)百分比,大于100为像素值。',
      required: true
    },
    {
      type: 'radio',
      key: 'clickouter',
      label: '点击蒙层',
@@ -822,6 +954,36 @@
        value: 'close',
        text: '关闭'
      }]
    },
    {
      type: 'radio',
      key: 'maskStyle',
      label: '蒙层样式',
      initVal: card.maskStyle || 'default',
      required: false,
      options: [{
        value: 'default',
        text: '默认'
      }, {
        value: 'transparent',
        text: '透明'
      }],
      forbid: appType !== 'mob'
    },
    {
      type: 'radio',
      key: 'closeButton',
      label: '关闭按钮',
      initVal: card.closeButton || 'false',
      required: false,
      options: [{
        value: 'false',
        text: '隐藏'
      }, {
        value: 'true',
        text: '显示'
      }],
      forbid: appType !== 'mob'
    },
    {
      type: 'radio',
@@ -855,6 +1017,15 @@
      }]
    },
    {
      type: 'text',
      key: 'preFunc',
      label: '前置函数',
      initVal: card.preFunc || '',
      tooltip: '前置函数执行完成后,结果会传入内部函数中,此时内部函数会异步执行;当前置函数返回中ErrCode等于-1时,将不再执行内部函数。',
      required: false,
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      key: 'control',
      label: '按钮控制',
@@ -882,7 +1053,10 @@
      initVal: card.controlField || '',
      required: true,
      allowClear: true,
      options: columns
      options: columns.map(item => ({
        value: item.field,
        text: `${item.label}(${item.field})`
      }))
    },
    {
      type: 'text',
@@ -899,6 +1073,21 @@
      required: false
    },
    {
      type: 'radio',
      key: 'hidden',
      label: '隐藏',
      initVal: card.hidden || 'false',
      tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。',
      required: false,
      options: [{
        value: 'false',
        text: '否'
      }, {
        value: 'true',
        text: '是'
      }]
    },
    {
      type: 'splitLine',
      key: 'title',
      label: '表单',
@@ -907,7 +1096,7 @@
    {
      type: 'text',
      key: 'field',
      label: Formdict['model.form.field'],
      label: '字段',
      initVal: card.field || '',
      required: true,
      readonly: false
@@ -915,7 +1104,7 @@
    {
      type: 'radio',
      key: 'size',
      label: '开关尺寸',
      label: '尺寸',
      initVal: card.size || 'default',
      options: [{
        value: 'large',
@@ -929,12 +1118,46 @@
      }]
    },
    {
      type: 'radio',
      key: 'checkType',
      label: '选框样式',
      initVal: card.checkType || 'circle',
      options: [{
        value: 'circle',
        text: '圆角'
      }, {
        value: 'square',
        text: '方角'
      }]
    },
    {
      type: 'text',
      key: 'openVal',
      label: '开启值',
      initVal: card.openVal === undefined ? '' : card.openVal + '',
      tooltip: '当开启与关闭值均为正整数时,默认转换为INT类型。',
      required: false
    },
    {
      type: 'number',
      key: 'min',
      label: '最小值',
      initVal: card.min,
      required: false
    },
    {
      type: 'number',
      key: 'max',
      label: '最大值',
      initVal: card.max,
      required: false
    },
    {
      type: 'number',
      key: 'decimal',
      label: '小数位',
      initVal: card.decimal || 0,
      required: true
    },
    {
      type: 'text',
@@ -960,17 +1183,17 @@
    },
    {
      type: 'radio',
      key: 'hidden',
      label: '隐藏',
      initVal: card.hidden || 'false',
      tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。',
      key: 'execType',
      label: '请求方式',
      initVal: card.execType || 'multi',
      tooltip: '选中多条数据时的请求方式,注:当选中数据超过20条时将逐条请求。',
      required: false,
      options: [{
        value: 'false',
        text: '否'
        value: 'multi',
        text: '批量请求'
      }, {
        value: 'true',
        text: '是'
        value: 'single',
        text: '逐条请求'
      }]
    },
    {
@@ -987,6 +1210,849 @@
        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
        }
      ]
    }
  ]
  return forms
}
/**
 * @description 获取按钮表单配置信息
 * @param {*} card           编辑按钮
 * @param {*} functip        生成存储过程提示
 * @param {*} setting        组件配置
 * @param {*} usefulFields   存储过程可用的开始字段
 */
export function getBaseTableActionForm (card, functip, config, usefulFields, modules) {
  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 opentypes = [
    {
      value: 'pop',
      text: '弹窗(表单)'
    }, {
      value: 'prompt',
      text: '提示框'
    }, {
      value: 'exec',
      text: '直接执行'
    }, {
      value: 'excelIn',
      text: '导入Excel'
    }, {
      value: 'excelOut',
      text: '导出Excel'
    }, {
      value: 'popview',
      text: '弹窗(标签)'
    }, {
      value: 'tab',
      text: '标签页'
    }, {
      value: 'innerpage',
      text: '新页面'
    }, {
      value: 'funcbutton',
      text: '功能按钮'
    }
  ]
  let pageTemps = [
    // { value: 'print', text: '标签打印模板' },
    // { value: 'billprintTemp', text: '单据打印模板' },
    { value: 'billprint', text: '单据打印' },
    { value: 'pay', text: '支付' },
    { 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: 'megvii', text: '旷视面板机' },
    { value: 'filezip', text: '文件压缩包' },
  ]
  if (card.funcType === 'changeuser') { // 原类型支持
    funTypes.unshift({ value: 'changeuser', text: '切换用户' })
  }
  let menulist = sessionStorage.getItem('fstMenuList')
  if (menulist) {
    try {
      menulist = JSON.parse(menulist)
    } catch (e) {
      menulist = []
    }
  } else {
    menulist = []
  }
  let refresh = []
  if (viewType === 'popview') { // 弹窗标签
    opentypes = opentypes.filter(item => item.value !== 'popview')
    funTypes = funTypes.filter(item => item.value !== 'print')
    refresh.push({
      value: 'closepoptab', // 关闭弹窗标签
      text: '关闭弹窗'
    })
  }
  if (card.OpenType === 'form') { // 拖拽添加类型转换
    card.OpenType = 'pop'
  }
  let forms = [
    {
      type: 'select',
      key: 'OpenType',
      label: '按钮类型',
      initVal: card.OpenType,
      required: true,
      options: opentypes
    },
    {
      type: 'text',
      key: 'label',
      label: '按钮名称',
      initVal: card.label,
      required: true,
    },
    {
      type: 'select',
      key: 'funcType',
      label: '功能类型',
      initVal: card.funcType || '',
      required: true,
      options: funTypes
    },
    {
      type: 'radio',
      key: 'subFunc',
      label: '接口名称',
      initVal: card.subFunc || 'addUser',
      required: true,
      options: [
        { value: 'addUser', text: '添加用户' },
      ]
    },
    {
      type: 'select',
      key: 'execMode',
      label: '执行方式',
      initVal: card.execMode || 'exec',
      required: true,
      options: [{
        value: 'exec',
        text: '直接执行'
      }, {
        value: 'prompt',
        text: '提示框'
      }, {
        value: 'pop',
        text: '弹窗(表单)'
      }]
    },
    {
      type: 'radio',
      key: 'intertype',
      label: '接口类型',
      initVal: card.intertype || 'system',
      required: true,
      options: []
    },
    {
      type: 'checkbox',
      key: 'payType',
      label: '支付方式',
      initVal: card.payType || [],
      required: true,
      options: [{
        value: 'wxpay',
        text: '微信'
      // }, {
      //   value: 'alipay',
      //   text: '支付宝'
      }]
    },
    {
      type: 'radio',
      key: 'procMode',
      label: '参数处理',
      initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'),
      tooltip: '当返回值存在 mk_ex_invoke 且值为 false 时,不会调用外部接口。注:当选“无”时,按钮选行时会传递主键,存在表单时会传递表单字段,存在BID时会传BID字段。',
      required: true,
      options: [{
        value: 'system',
        text: '系统函数'
      }, {
        value: 'inner',
        text: '内部函数'
      }, {
        value: 'none',
        text: '无'
      }]
    },
    {
      type: 'radio',
      key: 'sqlType',
      label: '操作类型',
      initVal: card.sqlType || '',
      required: true,
      options: []
    },
    {
      type: 'text',
      key: 'sql',
      label: '表名',
      initVal: card.sql || setting.tableName || '',
      required: true
    },
    {
      type: 'text',
      key: 'innerFunc',
      label: '内部函数',
      initVal: card.innerFunc || '',
      tooltip: functip,
      fields: usefulFields,
      required: false,
    },
    {
      type: 'text',
      key: 'urlkey',
      label: '地址字段',
      initVal: card.urlkey || '',
      tooltip: '图片(文件)链接的字段名。',
      required: false,
      readonly: false
    },
    {
      type: 'select',
      key: 'pageTemplate',
      label: '页面类型',
      initVal: card.pageTemplate || '',
      required: true,
      options: pageTemps
    },
    {
      type: 'select',
      key: 'printTemp',
      label: '打印模板',
      initVal: card.printTemp || '',
      required: true,
      options: printTemps
    },
    {
      type: 'cascader',
      key: 'linkmenu',
      label: '关联菜单',
      initVal: card.linkmenu || [],
      required: true,
      extendName: 'MenuNo',
      options: menulist
    },
    {
      type: 'textarea',
      key: 'url',
      label: '页面地址',
      initVal: card.url || '',
      tooltip: '地址格式为:http://******/admin/index.html#/iframe/menuId/loginuid/BID 会打开标签页。注:使用@loginuid@时自动替换为当前系统的loginuid;选择单行且拼接参数时会拼接BID。',
      required: true
    },
    {
      type: 'textarea',
      key: 'proUrl',
      label: '正式地址',
      initVal: card.proUrl || '',
      tooltip: '地址格式为:http://******/admin/index.html#/iframe/menuId/loginuid/BID 会打开标签页。注:使用@loginuid@时自动替换为当前系统的loginuid;选择单行且拼接参数时会拼接BID。',
      required: false
    },
    {
      type: 'radio',
      key: 'sysInterface',
      label: '系统类型',
      initVal: card.sysInterface || 'false',
      tooltip: '业务系统指同一sso下的其他业务系统,外部系统指不同sso下的其他业务系统。',
      required: true,
      options: [{
        value: 'false',
        text: '业务'
      }, {
        value: 'true',
        text: '单点'
      }, {
        value: 'external',
        text: '外部'
      }]
    },
    {
      type: 'text',
      key: 'outerFunc',
      label: '外部函数',
      initVal: card.outerFunc || '',
      required: false,
    },
    {
      type: 'textarea',
      key: 'interface',
      label: '测试地址',
      initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (card.interface || ''),
      required: true,
      readonly: card.sysInterface === 'true'
    },
    {
      type: 'textarea',
      key: 'proInterface',
      label: '正式地址',
      initVal: card.proInterface || '',
      tooltip: '正式系统所使用的接口地址。',
      required: false
    },
    {
      type: 'keyinterface',
      key: 'exInterface',
      label: '测试地址',
      initVal: card.exInterface || '',
      required: true
    },
    {
      type: 'keyinterface',
      key: 'exProInterface',
      label: '正式地址',
      initVal: card.exProInterface || '',
      tooltip: '正式系统所使用的接口地址。',
      required: false
    },
    {
      type: 'radio',
      key: 'callbackType',
      label: '回调方式',
      initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'),
      tooltip: '使用后台脚本执行时,需要配合计划任务。',
      required: true,
      options: [{
        value: 'script',
        text: '自定义脚本'
      }, {
        value: 'default',
        text: '后台脚本'
      }, {
        value: 'func',
        text: '回调函数'
      }, {
        value: 'none',
        text: '无'
      }]
    },
    {
      type: 'text',
      key: 'cbTable',
      label: '回调表名',
      initVal: card.cbTable || '',
      required: true
    },
    {
      type: 'text',
      key: 'callbackFunc',
      label: '回调函数',
      initVal: card.callbackFunc || '',
      required: true
    },
    {
      type: 'radio',
      key: 'method',
      label: '请求方式',
      initVal: card.method || 'post',
      required: true,
      options: [{
        value: 'get',
        text: 'GET'
      }, {
        value: 'post',
        text: 'POST'
      }]
    },
    {
      type: 'radio',
      key: 'cross',
      label: '接口跨域',
      initVal: card.cross || 'true',
      tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。',
      required: false,
      options: [{
        value: 'true',
        text: '支持'
      }, {
        value: 'false',
        text: '不支持'
      }]
    },
    {
      type: 'radio',
      key: 'stringify',
      label: '序列化',
      initVal: card.stringify || 'text',
      required: false,
      options: [{
        value: 'text',
        text: 'Text'
      }, {
        value: 'JSON',
        text: 'JSON'
      }, {
        value: 'qs',
        text: 'qs'
      }]
    },
    {
      type: 'select',
      key: 'Ot',
      label: '行设置',
      initVal: card.Ot || (card.sqlType === 'insert' ? 'notRequired' : 'requiredSgl'),
      required: true,
      options: []
    },
    {
      type: 'select',
      key: 'execSuccess',
      label: '成功后',
      initVal: card.execSuccess || 'grid',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。',
      required: true,
      options: [{
        value: 'never',
        text: '不刷新'
      }, {
        value: 'line',
        text: '刷新行'
      }, {
        value: 'grid',
        text: '刷新当前组件'
      }, {
        value: 'mainline',
        text: '刷新上级组件 - 行'
      },
      ...refresh]
    },
    {
      type: 'select',
      key: 'execError',
      label: '失败后',
      initVal: card.execError || 'never',
      tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新哪一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。',
      required: true,
      options: [{
        value: 'never',
        text: '不刷新'
      }, {
        value: 'line',
        text: '刷新行'
      }, {
        value: 'grid',
        text: '刷新当前组件'
      }, {
        value: 'mainline',
        text: '刷新上级组件 - 行'
      },
      ...refresh]
    },
    {
      type: 'select',
      key: 'popClose',
      label: '关闭后',
      initVal: card.popClose || 'never',
      required: true,
      options: [{
        value: 'never',
        text: '不刷新'
      }, {
        value: 'grid',
        text: '刷新当前组件'
      }, {
        value: 'mainline',
        text: '刷新上级组件 - 行'
      }]
    },
    {
      type: 'radio',
      key: 'resetPageIndex',
      label: '刷新时',
      initVal: card.resetPageIndex || 'true',
      required: false,
      options: [{
        value: 'true',
        text: '重置页码'
      }, {
        value: 'false',
        text: '不重置'
      }]
    },
    {
      type: 'number',
      key: 'width',
      min: 1,
      max: 24,
      precision: 0,
      label: '宽度',
      initVal: card.width || 12,
      tooltip: '栅格布局,每行等分为24列。',
      forbid: card.eleType !== 'button',
      required: true
    },
    {
      type: 'radio',
      key: 'show',
      label: '显示为',
      initVal: card.show || 'button',
      required: true,
      options: [{
        value: 'icon',
        text: '图标'
      }, {
        value: 'button',
        text: '图标+文字'
      }, {
        value: 'link',
        text: '文字+图标'
      }]
    },
    {
      type: 'icon',
      key: 'icon',
      label: '图标',
      initVal: card.icon,
      required: false,
      options: []
    },
    {
      type: 'select',
      key: 'class',
      label: '颜色',
      initVal: card.class,
      required: false,
      options: btnClasses
    },
    {
      type: 'radio',
      key: 'joint',
      label: '拼接参数',
      initVal: card.joint || 'true',
      required: false,
      options: [{
        value: 'true',
        text: '是'
      }, {
        value: 'false',
        text: '否'
      }]
    },
    {
      type: 'text',
      key: 'sheet',
      label: '表名',
      initVal: card.sheet || setting.tableName || '',
      required: true
    },
    {
      type: 'cascader',
      key: 'syncComponent',
      label: '刷新组件',
      initVal: card.syncComponent || [],
      tooltip: '执行成功后(或弹窗标签关闭时),需要同步刷新的组件。注:选择当前组件的上级组件无效,刷新上级组件请选择成功后“刷新上级组件 - 行”。',
      required: false,
      options: modules.length ? [...modules, {value: 'multiComponent', label: '多组件'}] : []
    },
    {
      type: 'radio',
      key: 'pagination',
      label: '分页',
      initVal: card.pagination || 'false',
      tooltip: '导出数据量较大时(1000+),可设置分页请求数据。',
      required: false,
      options: [{
        value: 'true',
        text: '是'
      }, {
        value: 'false',
        text: '否'
      }]
    },
    {
      type: 'radio',
      key: 'search',
      label: '搜索条件',
      initVal: card.search || 'false',
      required: false,
      options: [{
        value: 'true',
        text: '必填'
      }, {
        value: 'false',
        text: '非必填'
      }]
    },
    {
      type: 'cascader',
      key: 'refreshTab',
      label: '刷新菜单',
      initVal: card.refreshTab || [],
      tooltip: '执行成功后(或功能按钮中标签关闭类型),需要同步刷新的菜单',
      required: false,
      forbid: viewType === 'popview',
      options: menulist
    },
    {
      type: 'cascader',
      key: 'openmenu',
      label: '打开菜单',
      tooltip: '执行成功后需要打开的菜单。',
      initVal: card.openmenu || [],
      extendName: 'MenuNo',
      required: false,
      allowClear: true,
      options: menulist,
      forbid: viewType === 'popview'
    },
    {
      type: 'text',
      key: 'output',
      label: '返回值',
      tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,返回id时可使用@id@);自定义函数可指定返回字段(如id)。',
      initVal: card.output || '',
      required: false,
      forbid: viewType === 'popview'
    },
    {
      type: 'text',
      key: 'tipTitle',
      label: '确认提示',
      initVal: card.tipTitle || '',
      tooltip: '注:弹窗(表单)在显示为是否框时有效。',
      required: false
    },
    {
      type: 'radio',
      key: 'openTab',
      label: '打开方式',
      initVal: card.openTab || 'newtab',
      tooltip: '菜单打开方式。',
      options: [
        {value: 'newtab', text: '标签页'},
        // {value: 'newpage', text: '新页面(标签页)'},
        {value: 'view', text: '新页面(全屏)'}
      ]
    },
    {
      type: 'radio',
      key: 'display',
      label: '显示方式',
      initVal: card.display || 'modal',
      required: true,
      options: [{
        value: 'modal',
        text: '模态框'
      }, {
        value: 'drawer',
        text: '抽屉'
      }]
    },
    {
      type: 'number',
      key: 'ratio',
      min: 1,
      max: 3000,
      precision: 0,
      label: '比例',
      initVal: card.ratio || 85,
      tooltip: '模态框或抽屉的宽度,小于100为窗口宽度(或高度)百分比,大于100为像素值。',
      required: true
    },
    {
      type: 'radio',
      key: 'placement',
      label: '弹出方向',
      initVal: card.placement || 'right',
      required: false,
      options: [{
        value: 'right',
        text: '右侧'
      }, {
        value: 'left',
        text: '左侧'
      }, {
        value: 'top',
        text: '上侧'
      }, {
        value: 'bottom',
        text: '下侧'
      }]
    },
    {
      type: 'radio',
      key: 'clickouter',
      label: '点击蒙层',
      initVal: card.clickouter || 'unclose',
      required: false,
      options: [{
        value: 'unclose',
        text: '不关闭'
      }, {
        value: 'close',
        text: '关闭'
      }]
    },
    {
      type: 'text',
      key: 'preFunc',
      label: '前置函数',
      initVal: card.preFunc || '',
      tooltip: '前置函数执行完成后,结果会传入内部函数中,此时内部函数会异步执行;当前置函数返回中ErrCode等于-1时,将不再执行内部函数。',
      required: false
    },
    {
      type: 'radio',
      key: 'control',
      label: '按钮控制',
      initVal: card.control || (card.controlField ? 'disabled' : ''),
      tooltip: '当选择禁用或隐藏,且字段值与控制值相等时,按钮会隐藏或禁用。当选择上级,主表字段值与控制值相等或主表字段值不存在时,按钮会隐藏。注:多个值用逗号分隔',
      required: false,
      options: [{
        value: '',
        text: '无'
      }, {
        value: 'disabled',
        text: '禁用'
      }, {
        value: 'hidden',
        text: '隐藏'
      }, {
        value: 'parent',
        text: '上级'
      }]
    },
    {
      type: 'select',
      key: 'controlField',
      label: '控制字段',
      initVal: card.controlField || '',
      required: true,
      allowClear: true,
      options: columns.map(item => ({
        value: item.field,
        text: `${item.label}(${item.field})`
      }))
    },
    {
      type: 'text',
      key: 'controlVal',
      label: '控制值',
      initVal: card.controlVal || '',
      required: false
    },
    {
      type: 'text',
      key: 'reason',
      label: '禁用原因',
      initVal: card.reason || '',
      required: false
    },
    {
      type: 'radio',
      key: 'hidden',
      label: '隐藏',
      initVal: card.hidden || 'false',
      tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。',
      required: false,
      options: [{
        value: 'false',
        text: '否'
      }, {
        value: 'true',
        text: '是'
      }]
    },
    {
      type: 'radio',
      key: 'execType',
      label: '请求方式',
      initVal: card.execType || 'multi',
      tooltip: '选中多条数据时的请求方式,注:当选中数据超过20条时将逐条请求。',
      required: false,
      options: [{
        value: 'multi',
        text: '批量请求'
      }, {
        value: 'single',
        text: '逐条请求'
      }]
    },
    {
      type: 'radio',
      key: 'progress',
      label: '进度提示',
      initVal: card.progress || 'number',
      required: false,
      options: [{
        value: 'number',
        text: '剩余数'
      }, {
        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
        }
      ]
    }
  ]