king
2023-06-14 08cce3334a2dc81d690b518136b0aaea64e48b0b
src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -43,6 +43,71 @@
    tooltip = '在扩展卡片中,动态数据显示值为获取到的第一行数据。'
  }
  let isHeader = false
  if (cardCell.$cardType === 'extendCard' && cardCell.setting.cardRole === 'header') {
    isHeader = true
    anchors = null
    card.link = ''
    _options = [{ value: 'text', text: '文本'}]
  }
  let width = card.width || 12
  if (/x/.test(card.width)) {
    width = +width.replace(/x/, '.5')
  }
  let linkTypes = [
    { value: 'tel', text: '电话' },
    { value: 'email', text: '邮箱' },
    { value: 'other', text: '其他' }
  ]
  if (appType === 'mob') {
    linkTypes = [
      { value: 'tel', text: '电话' },
      { value: 'email', text: '邮箱' },
      { value: 'qywx', text: '企业微信' },
      { value: 'linkmenu', text: '关联菜单' },
      { value: 'other', text: '其他' }
    ]
  } else if (appType === 'pc') {
    linkTypes = [
      { value: 'tel', text: '电话' },
      { value: 'email', text: '邮箱' },
      { value: 'linkmenu', text: '关联菜单' },
      { value: 'other', text: '其他' }
    ]
  }
  if (card.linkType === 'qywx') {
    if (appType !== 'mob') {
      card.link = ''
      card.linkType = ''
      card.linkurl = ''
    }
  } else if (card.linkType === 'linkmenu') {
    if (appType !== 'mob' && appType !== 'pc') {
      card.link = ''
      card.linkType = ''
      card.linkurl = ''
      card.linkmenu = ''
    }
  }
  let appMenus = sessionStorage.getItem('appMenus')
  if (['pc', 'mob'].includes(appType)) {
    if (appMenus) {
      try {
        appMenus = JSON.parse(appMenus)
      } catch (e) {
        appMenus = []
      }
    } else {
      appMenus = []
    }
    appMenus.push({value: 'goback', text: '返回(上一页)'})
  }
  let forms = [
    {
      type: 'select',
@@ -85,7 +150,7 @@
      min: 0,
      label: '内容',
      initVal: card.value || '',
      tooltip: '文本类型,会替换内容中的@username@、@fullName@、@mk_city@、@appname@、@bid@。',
      tooltip: '文本类型,会替换内容中的@username@、@fullName@、@mk_city@、@appname@、@bid@、@month@、@week@、@day@',
      required: true
    },
    {
@@ -156,6 +221,21 @@
      required: true
    },
    {
      type: 'radio',
      key: 'eval',
      label: '解析',
      initVal: card.eval || 'false',
      tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。',
      required: false,
      options: [{
        value: 'true',
        text: '是'
      }, {
        value: 'false',
        text: '否'
      }]
    },
    {
      type: 'number',
      key: 'decimal',
      min: 0,
@@ -188,7 +268,8 @@
        { value: 'MM月DD日 ahh:mm', text: '自定义2(例:12月17日 上午10:57)' },
        { value: 'calendar1', text: '自定义3(例:今天 上午10:57)' },
        { value: 'calendar2', text: '自定义4(例:刚刚、昨天、5天前)' },
      ]
      ],
      forbid: isHeader
    },
    {
      type: 'select',
@@ -328,12 +409,12 @@
    {
      type: 'number',
      key: 'width',
      min: 1,
      min: 0.5,
      max: 24,
      precision: 0,
      precision: 1,
      label: '元素宽度',
      initVal: card.width || 12,
      tooltip: '栅格布局,每行等分为24列。',
      initVal: width,
      tooltip: '栅格布局,每行等分为24列,可设置半列即.5。',
      required: true
    },
    {
@@ -354,7 +435,8 @@
      tooltip: '绑定数据源字段,可根据返回值改变背景图。',
      required: false,
      allowClear: true,
      options: []
      options: [],
      forbid: isHeader
    },
    {
      type: 'cascader',
@@ -485,19 +567,16 @@
        { value: '', text: '无' },
        { value: 'dynamic', text: '动态' },
        { value: 'static', text: '静态' }
      ]
      ],
      forbid: isHeader
    },
    {
      type: 'radio',
      type: linkTypes.length > 4 ? 'select' : 'radio',
      key: 'linkType',
      label: '链接类型',
      initVal: card.linkType || 'other',
      required: false,
      options: [
        { value: 'tel', text: '电话' },
        { value: 'email', text: '邮箱' },
        { value: 'other', text: '其他' }
      ]
      options: linkTypes
    },
    {
      type: 'radio',
@@ -512,32 +591,40 @@
    },
    {
      type: 'select',
      key: 'linkmenu',
      label: '关联菜单',
      initVal: card.linkmenu || '',
      required: true,
      options: appMenus || [],
      forbid: !['pc', 'mob'].includes(appType)
    },
    {
      type: 'select',
      key: 'linkurl',
      label: '链接地址',
      initVal: card.linkurl || '',
      tooltip: ['pc', 'mob'].includes(appType) ? '当链接类型为“其他”,且链接地址以@menuid@开头时,其后内容将被视为菜单ID。' : '',
      required: true,
      options: []
    },
    {
      type: 'radio',
      key: 'open',
      label: '打开方式',
      initVal: card.open || 'blank',
      tooltip: '菜单打开方式,链接无效。',
      required: true,
      forbid: !['pc', 'mob'].includes(appType),
      options: [
        {value: 'blank', text: appType !== 'mob' ? '新窗口' : '新页面'},
        {value: 'self', text: appType !== 'mob' ? '当前窗口' : '当前页面'},
      ]
    },
    {
      type: 'radio',
      key: 'joint',
      label: '拼接参数',
      initVal: card.joint || 'true',
      required: false,
      options: [{
        value: 'true',
        text: '是'
      }, {
        value: 'false',
        text: '否'
      }]
    },
    {
      type: 'radio',
      key: 'eval',
      label: '解析',
      initVal: card.eval || 'true',
      tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。',
      required: false,
      options: [{
        value: 'true',
@@ -570,6 +657,20 @@
    },
    {
      type: 'radio',
      key: 'alignItems',
      label: '垂直对齐',
      initVal: card.alignItems || '',
      tooltip: '垂直方向的对齐方式。注:高度(行)大于1时有效。',
      required: false,
      options: [
        { value: '', text: '居上' },
        { value: 'center', text: '居中' },
        { value: 'end', text: '居下' }
      ],
      forbid: isHeader
    },
    {
      type: 'radio',
      key: 'fixStyle',
      label: '前后缀',
      initVal: card.fixStyle || '',
@@ -578,7 +679,8 @@
      options: [
        { value: '', text: '统一样式' },
        { value: 'alone', text: '独立样式' }
      ]
      ],
      forbid: isHeader
    },
    {
      type: 'radio',
@@ -590,7 +692,8 @@
      options: [
        { value: 'true', text: '是' },
        { value: 'false', text: '否' }
      ]
      ],
      forbid: isHeader
    },
    {
      type: 'number',
@@ -630,6 +733,16 @@
      tooltip: '前缀、后缀的右边距。',
      required: false
    },
    {
      type: 'select',
      key: 'sortField',
      label: '排序字段',
      initVal: card.sortField || '',
      required: false,
      allowClear: true,
      options: [],
      forbid: !isHeader
    },
  ]
  return forms