king
2024-05-16 b69b5f6329ca5f87932436b7a6c1ddfc3377e10f
src/menu/components/card/cardcomponent/options.jsx
@@ -1,26 +1,25 @@
/**
 * @description Setting表单配置信息
 */
export default function (setting, subtype, buttons = [], cardType, columns) {
export default function (setting, subtype, buttons = [], cardType, columns, menus = []) {
  let appType = sessionStorage.getItem('appType')
  let hasMenus = subtype === 'datacard' && cardType !== 'extendCard'
  let menulist = []
  let appmenulist = []
  if (appType) {
    appmenulist = sessionStorage.getItem('appMenus')
    if (appmenulist) {
    menulist = sessionStorage.getItem('appMenus')
    if (menulist) {
      try {
        appmenulist = JSON.parse(appmenulist)
        menulist = JSON.parse(menulist)
      } catch (e) {
        appmenulist = []
        menulist = []
      }
    } else {
      appmenulist = []
      menulist = []
    }
    if (appType === 'mob' && hasMenus) { // 数据卡可打开即时通信
      appmenulist.push({
    if (appType === 'mob' && (subtype === 'datacard' || subtype === 'propcard') && cardType !== 'extendCard') { // 数据卡可打开即时通信
      menulist.push({
        value: 'IM', label: '即时通信(系统页)'
      })
    }
@@ -41,6 +40,12 @@
  if (hasMenus) {
    ops = [{value: 'menus', label: '菜单组'}]
  }
  let adapters = sessionStorage.getItem('adapter') || ''
  if (adapters.indexOf('wxmini') > -1) {
    ops.push({value: 'miniprogram', label: '小程序'})
  } else if (setting.click === 'miniprogram') {
    setting.click = ''
  }
  const cardSettingForm = [
    {
@@ -56,6 +61,24 @@
    },
    {
      type: 'radio',
      field: 'cardRole',
      label: '卡片角色',
      initval: setting.cardRole || 'card',
      required: false,
      options: [
        {value: 'card', label: '属性卡'},
        {value: 'header', label: '表格头(可排序)'},
      ],
      controlFields: [
        {field: 'type', values: ['card']},
        {field: 'click', values: ['card']},
        {field: 'btnControl', values: ['card']},
      ],
      del: true,
      forbid: cardType !== 'extendCard'
    },
    {
      type: 'radio',
      field: 'type',
      label: '卡片类型',
      initval: setting.type || 'simple',
@@ -68,7 +91,7 @@
      controlFields: [
        {field: 'transform', values: ['multi']},
      ],
      forbid: appType === 'mob'
      forbid: appType === 'mob' || subtype === 'dualdatacard'
    },
    {
      type: 'select',
@@ -86,7 +109,8 @@
        {value: 'opacity', label: '透明度'},
        {value: 'rotateX', label: '纵向展开'},
        {value: 'rotateY', label: '横向展开'},
      ]
      ],
      forbid: appType === 'mob' || subtype === 'dualdatacard'
    },
    {
      type: 'text',
@@ -98,11 +122,21 @@
      forbid: subtype !== 'propcard'
    },
    {
      type: !hasMenus ? 'radio' : 'select',
      type: 'select',
      field: 'bgField',
      label: '背景图',
      initval: setting.bgField || '',
      tooltip: '动态背景,背景图片由字段值控制。请注意调整背景样式。',
      required: false,
      options: columns,
      forbid: cardType === 'extendCard'
    },
    {
      type: ops.length === 0 ? 'radio' : 'select',
      field: 'click',
      label: '点击事件',
      initval: setting.click || '',
      tooltip: '当绑定点击事件时,卡片的切换功能将失效。',
      // tooltip: '当绑定点击事件时,卡片的切换功能将失效。',
      required: false,
      options: [
        {value: '', label: '无'},
@@ -115,9 +149,13 @@
        {field: 'menu', values: ['menu']},
        {field: 'linkurl', values: ['link']},
        {field: 'open', values: ['menu', 'link', 'menus']},
        {field: 'joint', values: ['menu', 'link', 'menus']},
        {field: 'joint', values: ['miniprogram']},
        {field: 'linkbtn', values: ['button']},
        {field: 'clickType', values: ['button']},
        {field: 'menuType', values: ['menus']},
        {field: 'menus', values: ['menus']},
        {field: 'miniAppId', values: ['miniprogram']},
        {field: 'miniPath', values: ['miniprogram']},
      ]
    },
    {
@@ -133,17 +171,36 @@
      field: 'menu',
      label: '关联菜单',
      initval: setting.menu || (appType ? '' : []),
      tooltip: `行信息${appType ? '(字段集中前40个长度不超过256的字段)' : ''}将传递至此菜单,可在url变量、表单(关联主表)、静态属性卡、浮动卡中使用。`,
      required: true,
      options: appType ? appmenulist : menulist,
      extendName: 'MenuNo',
      options: menulist,
    },
    {
      type: 'textarea',
      field: 'linkurl',
      label: '链接',
      initval: setting.linkurl || '',
      tooltip: '在链接中以@***@形式拼接的字段(字段来源于字段集中,此外 id、appkey、userid、LoginUID 为系统字段),跳转时将替换为对应值,例如:http://sso.mk9h.cn/doc/index.html?appkey=@appkey@&LoginUID=@LoginUID@,其中appkey与LoginUID将被替换。',
      toolWidth: 350,
      required: true,
      options: [],
      span: 24
    },
    {
      type: 'text',
      field: 'miniAppId',
      label: '小程序AppID',
      initval: setting.miniAppId || '',
      required: true
    },
    {
      type: 'text',
      field: 'miniPath',
      label: '页面路径',
      initval: setting.miniPath || '',
      tooltip: '可指定跳转小程序页面,为空时打开首页,注:参数拼接在指定页面时有效。',
      required: false
    },
    {
      type: 'radio',
@@ -152,10 +209,10 @@
      initval: setting.open || 'blank',
      required: false,
      options: [
        {value: 'blank', label: '新窗口'},
        {value: 'self', label: '当前窗口'},
        {value: 'blank', label: appType !== 'mob' ? '新窗口' : '新页面'},
        {value: 'self', label: appType !== 'mob' ? '当前窗口' : '当前页面'},
      ],
      forbid: appType !== 'pc'
      forbid: appType !== 'pc' && appType !== 'mob'
    },
    {
      type: 'radio',
@@ -178,16 +235,83 @@
    },
    {
      type: 'radio',
      field: 'layout',
      label: '元素布局',
      initval: setting.layout || 'grid',
      required: false,
      options: [
        {value: 'grid', label: '栅格布局'},
        {value: 'flex', label: '弹性布局'},
      ]
    },
    {
      type: 'radio',
      field: 'clickType',
      label: '触发方式',
      initval: setting.clickType || 'normal',
      required: false,
      options: [
        {value: 'normal', label: '单击'},
        {value: 'multi', label: '双击'},
      ],
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      field: 'btnControl',
      label: '按钮控制',
      initval: setting.btnControl || 'show',
      tooltip: '可设置按钮显示规则,一直显示或鼠标悬浮时显示。',
      tooltip: '可设置按钮显示规则,始终显示或鼠标悬浮时显示。',
      required: false,
      options: [
        {value: 'show', label: '正常显示'},
        {value: 'hover', label: '悬浮显示'},
      ],
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      field: 'checkAll',
      label: '全选',
      initval: setting.checkAll || 'hidden',
      tooltip: '全选仅在数据卡可多选,且选中风格为勾选框时有效。',
      required: false,
      options: [
        {value: 'hidden', label: '隐藏'},
        {value: 'show', label: '显示'},
      ],
      forbid: cardType !== 'extendCard'
    },
    {
      type: 'table',
      field: 'menus',
      label: '菜单组',
      initval: menus,
      required: true,
      span: 24,
      actions: ['edit', 'del', 'add', 'move', 'view'],
      columns: [
        {
          title: '标识',
          dataIndex: 'sign',
          inputType: 'input',
          editable: true,
          unique: true,
          required: false,
          width: '30%'
        },
        {
          title: '菜单',
          dataIndex: 'menu',
          inputType: !appType ? 'cascader' : 'select',
          editable: true,
          required: true,
          extends: !appType ? 'Menu' : [{key: 'label', value: 'label'}],
          width: '40%',
          render: (text, record) => record.label,
          options: menulist
        }
      ]
    }
  ]