king
2024-05-16 b69b5f6329ca5f87932436b7a6c1ddfc3377e10f
src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -1,3 +1,4 @@
import React from 'react'
import MenuUtils from '@/utils/utils-custom.js'
/**
@@ -20,6 +21,7 @@
    { value: 'qrcode', text: '二维码'},
    { value: 'currentDate', text: '当前时间'},
    { value: 'formula', text: '公式'},
    { value: 'tag', text: '标签'},
    { value: 'color', text: '颜色'},
  ]
@@ -125,6 +127,17 @@
    appMenus.push({value: 'goback', text: '返回(上一页)'})
  }
  let fields = []
  let isStatic = (cards.subtype === 'propcard' || cards.type === 'balcony') && cards.wrap.datatype === 'static'
  if (isStatic) {
    if (cards.wrap.supModule && cards.wrap.supModule.length) {
      let cell = MenuUtils.getComponent(cards.wrap.supModule[cards.wrap.supModule.length - 1])
      if (cell && cell.columns) {
        fields = cell.columns.map(col => ({ value: col.field }))
      }
    }
  }
  let forms = [
    {
      type: 'select',
@@ -158,12 +171,17 @@
      ]
    },
    {
      type: 'select',
      type: isStatic ? 'text' : 'select',
      key: 'field',
      label: '字段',
      initVal: card.field || '',
      tooltip: isStatic ? '可绑定上级组件字段,不存在上级组件时可绑定url参数字段。' : '',
      required: true,
      options: []
      options: fields,
      rules: [{
        pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig,
        message: '字段名只允许包含数字、字母、汉字以及_-'
      }]
    },
    {
      type: 'icon',
@@ -178,7 +196,7 @@
      min: 0,
      label: '内容',
      initVal: card.value || '',
      tooltip: '文本类型,会替换内容中的@username@、@fullName@、@mk_city@、@appname@、@bid@、@month@、@week@、@day@',
      // tooltip: '文本类型,会替换内容中的@username@、@fullName@、@mk_city@、@appname@、@bid@、@month@、@week@、@day@',
      required: true
    },
    {
@@ -242,11 +260,12 @@
      required: true
    },
    {
      type: 'select',
      type: isStatic ? 'text' : 'select',
      key: 'posterField',
      label: '预览地址',
      initVal: card.posterField || '',
      required: true
      required: true,
      options: fields
    },
    {
      type: 'radio',
@@ -460,14 +479,14 @@
      required: false
    },
    {
      type: 'select',
      type: isStatic ? 'text' : 'select',
      key: 'bgImage',
      label: '动态背景',
      initVal: card.bgImage || '',
      tooltip: '绑定数据源字段,可根据返回值改变背景图。',
      required: false,
      allowClear: true,
      options: [],
      options: fields,
      forbid: isHeader
    },
    {
@@ -626,6 +645,7 @@
      key: 'linkmenu',
      label: '关联菜单',
      initVal: card.linkmenu || '',
      tooltip: '行信息(字段集中前40个长度不超过256的字段)将传递至此菜单,可在url变量、表单(关联主表)、静态属性卡、浮动卡中使用。',
      required: true,
      options: appMenus || [],
      forbid: !['pc', 'mob'].includes(appType)
@@ -635,18 +655,21 @@
      key: 'linkmenu',
      label: '关联菜单',
      initVal: card.linkmenu || [],
      tooltip: '行信息将传递至此菜单,可在url变量、表单(关联主表)、静态属性卡、浮动卡中使用。',
      required: true,
      options: menulist,
      forbid: ['pc', 'mob'].includes(appType)
    },
    {
      type: 'select',
      type: isStatic ? 'text' : 'select',
      defType: isStatic ? 'text' : 'select',
      key: 'linkurl',
      label: '链接地址',
      initVal: card.linkurl || '',
      tooltip: ['pc', 'mob'].includes(appType) ? '当链接类型为“其他”,且链接地址以@menuid@开头时,其后内容将被视为菜单ID。' : '',
      tooltip: '在链接中以@***@形式拼接的字段(字段来源于字段集中,此外 id、appkey、userid、LoginUID 为系统字段),跳转时将替换为对应值,例如:http://sso.mk9h.cn/doc/index.html?appkey=@appkey@&LoginUID=@LoginUID@,其中appkey与LoginUID将被替换。' + (['pc', 'mob'].includes(appType) ? '当链接类型为“其他”,且链接地址以@menuid@开头时,其后内容将被视为菜单ID。' : ''),
      toolWidth: 350,
      required: true,
      options: []
      options: fields
    },
    {
      type: 'radio',
@@ -662,25 +685,12 @@
      ]
    },
    {
      type: 'radio',
      key: 'joint',
      label: '拼接参数',
      initVal: card.joint || 'true',
      required: false,
      options: [{
        value: 'true',
        text: '是'
      }, {
        value: 'false',
        text: '否'
      }]
    },
    {
      type: 'codemirror',
      key: 'formula',
      label: '公式',
      initVal: card.formula || '',
      tooltip: '执行时会使用查询到的数据替换相应的字段,展示获得的结果,在不使用解析时换行符或空格会替换为页面元素。可使用JS的一些语法,如:三元表达式 @field1@ > @field2@ ? 0 : 1;Math对象,取绝对值 Math.abs(@field@)、四舍五入 Math.round(@field@)等。注:会替换公式中的@username@、@fullName@、@bid@。',
      toolWidth: 450,
      placeholder: '例如:@price@ * @number@',
      required: true
    },
@@ -796,6 +806,56 @@
      options: [],
      forbid: !isHeader
    },
    {
      type: 'table',
      key: 'signs',
      label: '标记',
      initVal: card.signs || [],
      tooltip: '可依据标签内容设置不同样式。',
      required: false,
      actions: ['edit', 'del', 'add', 'move'],
      columns: [
        {
          title: '值',
          dataIndex: 'value',
          inputType: 'text',
          editable: true,
          required: true,
          unique: true,
          width: '20%'
        },
        {
          title: '背景',
          dataIndex: 'background',
          inputType: 'color',
          className: 'mini-color',
          editable: true,
          required: true,
          width: '20%',
          render: (text) => <span className="mk-color-value" style={{background: text}}></span>,
        },
        {
          title: '文字',
          dataIndex: 'color',
          inputType: 'color',
          className: 'mini-color',
          editable: true,
          required: true,
          width: '20%',
          render: (text) => <span className="mk-color-value" style={{background: text}}></span>,
        },
        {
          title: '边框',
          dataIndex: 'border',
          inputType: 'color',
          className: 'mini-color',
          editable: true,
          required: true,
          width: '20%',
          render: (text) => <span className="mk-color-value" style={{background: text}}></span>,
        },
      ]
    },
  ]
  return forms