king
2022-02-09 d59f518f466274b2caeb2e01c10c92deafe7c93b
src/mob/components/topbar/normal-navbar/options.jsx
@@ -1,8 +1,17 @@
import React from 'react'
import MkIcon from '@/components/mk-icon'
/**
 * @description Wrap表单配置信息
 */
export default function (wrap) {
  let menulist = sessionStorage.getItem('appMenus')
  let searchable = true
  window.GLOB.customMenu.components.forEach(item => {
    if (item.type === 'search') {
      searchable = false
    }
  })
  if (menulist) {
    try {
@@ -23,18 +32,16 @@
      required: false,
      options: [
        {value: 'navbar', label: '导航栏'},
        {value: 'search', label: '搜索栏'},
        {value: 'search', label: '搜索框', disabled: !searchable},
        {value: 'searchIcon', label: '搜索标', disabled: !searchable},
      ],
      controlFields: [
        {field: 'search', values: ['navbar']},
      ]
    },
    {
      type: 'text',
      field: 'title',
      label: '标题',
      initval: wrap.title || '',
      tooltip: '使用搜索栏时,标题用于搜索条件隐藏时显示。',
      tooltip: '使用搜索框时,标题用于搜索条件隐藏时(当启用黑名单,登录用户无权限时)显示。',
      required: false
    },
    {
@@ -46,19 +53,22 @@
      options: [
        {value: 'true', label: '显示'},
        {value: 'false', label: '隐藏'},
      ],
      controlFields: [
        {field: 'reload', values: ['true']},
      ]
    },
    {
      type: 'radio',
      field: 'search',
      label: '搜索',
      initval: wrap.search || 'false',
      required: false,
      options: [
        {value: 'true', label: '显示'},
        {value: 'false', label: '隐藏'},
      ]
    },
    // {
    //   type: 'radio',
    //   field: 'search',
    //   label: '搜索',
    //   initval: wrap.search || 'false',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '显示'},
    //     {value: 'false', label: '隐藏'},
    //   ]
    // },
    {
      type: 'radio',
      field: 'logout',
@@ -76,7 +86,7 @@
      field: 'scan',
      label: '扫一扫',
      initval: wrap.scan || 'false',
      tooltip: '系统功能:1、扫码登录,二维码信息以“login”开头,2、页面跳转,二维码信息以“url”开头',
      tooltip: '系统功能:1、扫码登录,二维码以“login”开头,2、页面跳转,二维码以“http”开头,3、菜单跳转,二维码以“mkbid”开头,且设置关联菜单',
      required: false,
      options: [
        {value: 'true', label: '显示'},
@@ -102,10 +112,55 @@
      field: 'linkmenu',
      label: '关联菜单',
      initval: wrap.linkmenu || '',
      tooltip: '使用扫码登录功能时的跳转页面,不使用扫码登录可忽略。',
      tooltip: '使用扫码登录功能或菜单跳转功能时,需选择跳转的菜单。',
      required: false,
      options: menulist
    },
    {
      type: 'radio',
      field: 'reload',
      label: '返回后',
      initval: wrap.reload || 'false',
      tooltip: '返回后是否刷新数据。注:在明科云APP中有效。',
      required: false,
      options: [{
        value: 'false',
        label: '不刷新'
      }, {
        value: 'true',
        label: '刷新'
      }]
    },
    {
      type: 'table',
      field: 'menus',
      label: '自定义菜单',
      initval: wrap.menus || [],
      required: false,
      span: 24,
      columns: [
        {
          title: '图标',
          dataIndex: 'icon',
          inputType: 'icon',
          editable: true,
          required: true,
          render: (text, record) => <MkIcon type={text}/>,
          width: '35%'
        },
        {
          title: '菜单',
          dataIndex: 'menu',
          inputType: 'select',
          editable: true,
          required: true,
          extends: [{key: 'label', value: 'label'}],
          width: '35%',
          render: (text, record) => record.label,
          options: menulist
        }
      ]
    }
  ]
  return topbarWrapForm