king
2022-09-06 b8e1395f02c929eaa96b949cf6027ee2a43856a6
src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -8,7 +8,7 @@
 * @param {*} card
 * @param {*} type
 */
export function getCardCellForm (card, type, subtype, cardCell) {
export function getCardCellForm (card, type, subtype, cardCell, anchors) {
  let _options = [
    { value: 'text', text: '文本'},
    { value: 'number', text: '数值'},
@@ -43,15 +43,9 @@
    }
  }
  let dataTypes = [
    { value: 'dynamic', text: '动态' },
    { value: 'static', text: '静态' }
  ]
  let tooltip = ''
  if (cardCell.$cardType === 'extendCard') {
    card.datatype = 'static'
    dataTypes = [
      { value: 'static', text: '静态' }
    ]
    tooltip = '在扩展卡片中,动态数据显示值为获取到的第一行数据。'
  }
  let forms = [
@@ -75,8 +69,12 @@
      key: 'datatype',
      label: '数据类型',
      initVal: card.datatype || 'static',
      tooltip,
      required: true,
      options: dataTypes
      options: [
        { value: 'dynamic', text: '动态' },
        { value: 'static', text: '静态' }
      ]
    },
    {
      type: 'select',
@@ -92,13 +90,14 @@
      min: 0,
      label: '内容',
      initVal: card.value || '',
      tooltip: '文本类型,会替换内容中的@username@、@fullName@、@login_city@。',
      tooltip: '文本类型,会替换内容中的@username@、@fullName@、@mk_city@、@appname@、@bid@。',
      required: true
    },
    {
      type: 'file',
      key: 'url',
      label: '图片/文件',
      tooltip: '使用静态图片时,@icon@代表头像。',
      initVal: card.url || '',
      maxfile: 1,
      required: true
@@ -126,6 +125,52 @@
      ]
    },
    {
      type: 'number',
      key: 'startTime',
      precision: 0,
      label: '开始时间',
      initVal: card.startTime || 0,
      tooltip: '视频开始播放的时间,用于调整视频初始化展示的界面。',
      required: false
    },
    {
      type: 'radio',
      key: 'posterType',
      label: '预览图',
      initVal: card.posterType || '',
      required: false,
      options: [
        { value: '', text: '无' },
        { value: 'dynamic', text: '动态' },
        { value: 'static', text: '静态' }
      ]
    },
    {
      type: 'file',
      key: 'posterUrl',
      label: '预览地址',
      initVal: card.posterUrl || '',
      maxfile: 1,
      required: true
    },
    {
      type: 'select',
      key: 'posterField',
      label: '预览地址',
      initVal: card.posterField || '',
      required: true
    },
    {
      type: 'number',
      key: 'decimal',
      min: 0,
      max: 18,
      decimal: 0,
      label: '小数位',
      initVal: card.decimal === undefined ? '' : card.decimal,
      required: false
    },
    {
      type: 'select',
      key: 'format',
      label: '格式化',
@@ -137,7 +182,10 @@
        { value: 'percent', text: '百分数' },
        { value: 'thdSeparator', text: '千分位' },
        { value: 'abs', text: '绝对值' },
        { value: 'encryption', text: '加密'},
        { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' },
        { value: 'YYYY-MM-DD HH:mm', text: 'YYYY-MM-DD HH:mm' },
        { value: 'YYYY-MM-DD HH:mm:ss', text: 'YYYY-MM-DD HH:mm:ss' },
        { value: 'MM月DD日', text: 'MM月DD日' },
        { value: 'YYYY年MM月DD日', text: 'YYYY年MM月DD日' },
        { value: 'HH:mm', text: '时分(例:16:57)' },
@@ -298,9 +346,28 @@
      min: 1,
      max: 10,
      label: '高度(行)',
      initVal: card.height,
      tooltip: '内容显示行数,值为空时高度自适应,注:自适应高度仅在设置卡片高度后有效。',
      initVal: card.height !== undefined ? card.height : 1,
      tooltip: '内容显示行数,值为空时高度自适应。',
      required: false
    },
    {
      type: 'select',
      key: 'bgImage',
      label: '动态背景',
      initVal: card.bgImage || '',
      tooltip: '绑定数据源字段,可根据返回值改变背景图。',
      required: false,
      allowClear: true,
      options: []
    },
    {
      type: 'cascader',
      key: 'anchors',
      label: '跳转锚点',
      initVal: card.anchors || [],
      tooltip: sessionStorage.getItem('appType') === 'mob' ? '注:小程序中无效' : '',
      required: false,
      options: anchors
    },
    {
      type: 'number',
@@ -347,7 +414,8 @@
      min: 0,
      max: 50,
      label: '线宽',
      initVal: card.borderWidth || 1,
      initVal: card.borderWidth === undefined ? 1 : card.borderWidth,
      tooltip: '线宽为0时,为方便在开发时选中默认高度为10px,请注意调整内外边距。',
      required: true
    },
    {
@@ -383,6 +451,7 @@
      label: '最大宽度',
      initVal: card.maxWidth || '',
      tooltip: '图片宽度的最大值。',
      help: '注:此值存在时,左右外边距为0居中显示。',
      required: false,
    },
    {
@@ -403,7 +472,6 @@
      initVal: card.link || '',
      tooltip: '动态地址为绑定字段值。',
      required: false,
      // forbid: isApp,
      options: [
        { value: '', text: '无' },
        { value: 'dynamic', text: '动态' },
@@ -416,7 +484,6 @@
      label: '链接类型',
      initVal: card.linkType || 'other',
      required: false,
      // forbid: isApp,
      options: [
        { value: 'tel', text: '电话' },
        { value: 'email', text: '邮箱' },
@@ -454,15 +521,6 @@
    //     { value: 'blank', text: '新页面' },
    //     { value: 'self', text: '当前页面' }
    //   ]
    // },
    // {
    //   type: 'select',
    //   key: 'copyMenuId',
    //   label: '复制菜单',
    //   initVal: card.copyMenuId || '',
    //   required: false,
    //   forbid: !isApp,
    //   options: appMenus
    // },
    {
      type: 'select',
@@ -506,7 +564,7 @@
      key: 'formula',
      label: '公式',
      initVal: card.formula || '',
      tooltip: '执行时会使用查询到的数据替换相应的字段,展示获得的结果。可使用JS的一些语法,如:三元表达式 @field1@ > @field2@ ? 0 : 1;Math对象,取绝对值 Math.abs(@field@)、四舍五入 Math.round(@field@)等',
      tooltip: '执行时会使用查询到的数据替换相应的字段,展示获得的结果,在不使用解析时换行符或空格会替换为页面元素。可使用JS的一些语法,如:三元表达式 @field1@ > @field2@ ? 0 : 1;Math对象,取绝对值 Math.abs(@field@)、四舍五入 Math.round(@field@)等',
      placeholder: '例如:@price@ * @number@',
      required: true
    },
@@ -522,6 +580,68 @@
        { value: 'hide', text: '隐藏' }
      ]
    },
    {
      type: 'radio',
      key: 'fixStyle',
      label: '前后缀',
      initVal: card.fixStyle || '',
      tooltip: '前缀与后缀,使用与内容统一的样式还是独立样式。',
      required: false,
      options: [
        { value: '', text: '统一样式' },
        { value: 'alone', text: '独立样式' }
      ]
    },
    {
      type: 'radio',
      key: 'copyable',
      label: '可复制',
      initVal: card.copyable || 'false',
      tooltip: '元素是否可复制,复制内容不包括前缀与后缀。',
      required: false,
      options: [
        { value: 'true', text: '是' },
        { value: 'false', text: '否' }
      ]
    },
    {
      type: 'number',
      key: 'fixSize',
      min: 10,
      max: 300,
      label: '字体大小',
      initVal: card.fixSize || 14,
      tooltip: '前缀、后缀的字体大小。',
      required: true
    },
    {
      type: 'color',
      key: 'fixColor',
      label: '字体颜色',
      initVal: card.fixColor || 'rgba(0, 0, 0, 0.65)',
      tooltip: '前缀、后缀的字体颜色。',
      required: true
    },
    {
      type: 'number',
      key: 'fixLeft',
      min: 0,
      max: 1000,
      label: '左边距',
      initVal: card.fixLeft || 0,
      tooltip: '前缀、后缀的左边距。',
      required: false
    },
    {
      type: 'number',
      key: 'fixRight',
      min: 0,
      max: 1000,
      label: '右边距',
      initVal: card.fixRight || 0,
      tooltip: '前缀、后缀的右边距。',
      required: false
    },
  ]
  return forms