king
2025-01-24 0383744c6037f04495b1bb950c98644211fa0ad3
2025-01-24
7个文件已修改
2个文件已添加
415 ■■■■■ 已修改文件
src/assets/css/design.scss 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/lowerField/index.jsx 308 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/lowerField/index.scss 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/index.jsx 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/index.scss 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobdesign/index.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/pcdesign/index.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tabledesign/index.jsx 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tabledesign/index.scss 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/design.scss
@@ -153,3 +153,26 @@
    color: #f5222d;
  }
}
.mk-opeartion-dropdown-wrap {
  box-shadow: 0 0 2px #bcbcbc;
  background: #ffffff;
  min-width: 120px;
  button {
    display: block;
    width: 100%;
    height: 40px;
    line-height: 40px;
    border-radius: 0px;
    border: none;
    border-bottom: 1px solid #e8e8e8!important;
    color: rgba(0, 0, 0, 0.85);
    .anticon {
      display: none;
    }
  }
  button:hover {
    color: #1890ff;
  }
}
src/menu/lowerField/index.jsx
New file
@@ -0,0 +1,308 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { Modal, Button, notification } from 'antd'
import { VerticalRightOutlined } from '@ant-design/icons'
// import './index.scss'
const { confirm } = Modal
class LowerField extends Component {
  static propTpyes = {
    config: PropTypes.object,
    updateConfig: PropTypes.func
  }
  trigger = () => {
    const that = this
    confirm({
      content: `确定将字段转为小写吗?`,
      onOk() {
        that.exec()
      },
      onCancel() {}
    })
  }
  exec = () => {
    let config = fromJS(this.props.config).toJS()
    let resetElement = (m) => {
      if (m.datatype === 'dynamic' && m.field) {
        m.field = m.field.toLowerCase()
      }
      if (m.posterField) {
        m.posterField = m.posterField.toLowerCase()
      }
      if (m.bgImage) {
        m.bgImage = m.bgImage.toLowerCase()
      }
      if (m.linkurl && /^[a-zA-Z0-9_]+$/.test(m.linkurl)) {
        m.linkurl = m.linkurl.toLowerCase()
      }
      if (m.modal && m.modal.fields) {
        m.modal.fields = m.modal.fields.map(col => {
          if (col.field) {
            col.field = col.field.toLowerCase()
          }
          return col
        })
      }
      if (m.verify && m.verify.columns) {
        m.verify.columns = m.verify.columns.map(col => {
          if (col.Column) {
            col.Column = col.Column.toLowerCase()
          }
          return col
        })
      }
      if (m.config && m.config.components) {
        m.config.components = _replace(m.config.components)
      }
    }
    let _replace = (components) => {
      return components.map(item => {
        if (item.type === 'tabs') {
          item.subtabs.forEach(tab => {
            tab.components = _replace(tab.components)
          })
          return item
        } else if (item.type === 'group') {
          item.components = _replace(item.components)
          return item
        }
        if (item.columns) {
          item.columns = item.columns.map(col => {
            if (col.field) {
              col.field = col.field.toLowerCase()
            }
            return col
          })
        }
        if (item.setting && item.setting.primaryKey) {
          item.setting.primaryKey = item.setting.primaryKey.toLowerCase()
        }
        if (item.subColumns) {
          item.subColumns = item.subColumns.map(col => {
            if (col.field) {
              col.field = col.field.toLowerCase()
            }
            return col
          })
        }
        if (item.search) {
          if (item.type === 'topbar') {
            if (item.search.fields) {
              item.search.fields = item.search.fields.map(col => {
                if (col.field) {
                  col.field = col.field.toLowerCase()
                }
                return col
              })
            }
            if (item.search.groups) {
              item.search.groups = item.search.groups.map(group => {
                group.fields = group.fields.map(col => {
                  if (col.field) {
                    col.field = col.field.toLowerCase()
                  }
                  return col
                })
                return group
              })
            }
          } else if (Array.isArray(item.search)) {
            item.search = item.search.map(col => {
              if (col.field) {
                col.field = col.field.toLowerCase()
              }
              return col
            })
          }
        }
        if (item.action) {
          item.action.forEach(m => {
            if (m.modal && m.modal.fields) {
              m.modal.fields = m.modal.fields.map(col => {
                if (col.field) {
                  col.field = col.field.toLowerCase()
                }
                return col
              })
            }
            if (m.verify && m.verify.columns) {
              m.verify.columns = m.verify.columns.map(col => {
                if (col.Column) {
                  col.Column = col.Column.toLowerCase()
                }
                return col
              })
            }
            if (m.config && m.config.components) {
              m.config.components = _replace(m.config.components)
            }
          })
        }
        if (item.subcards) {
          item.subcards.forEach(card => {
            if (card.elements) {
              card.elements = card.elements.map(m => {
                resetElement(m)
                return m
              })
            }
            if (card.backElements) {
              card.backElements = card.backElements.map(m => {
                resetElement(m)
                return m
              })
            }
            if (card.fields) {
              card.fields = card.fields.map(m => {
                if (m.field) {
                  m.field = m.field.toLowerCase()
                }
                return m
              })
            }
          })
        }
        if (item.elements) {
          item.elements = item.elements.map(m => {
            resetElement(m)
            return m
          })
        }
        if (item.plot) {
          if (item.plot.Xaxis) {
            item.plot.Xaxis = item.plot.Xaxis.toLowerCase()
          }
          // 统计图
          if (item.plot.InfoValue) {
            item.plot.InfoValue = item.plot.InfoValue.toLowerCase()
          }
          if (item.plot.InfoType) {
            item.plot.InfoType = item.plot.InfoType.toLowerCase()
          }
          // 占比图
          if (item.plot.valueField) {
            item.plot.valueField = item.plot.valueField.toLowerCase()
          }
          if (item.plot.labelField) {
            item.plot.labelField = item.plot.labelField.toLowerCase()
          }
          // 饼图
          if (item.plot.type) {
            item.plot.type = item.plot.type.toLowerCase()
          }
          // 散点图
          if (item.plot.gender) {
            item.plot.gender = item.plot.gender.toLowerCase()
          }
          if (item.Yaxis) {
            if (Array.isArray(item.Yaxis)) {
              item.Yaxis = item.Yaxis.map(m => {
                if (m) return m.toLowerCase()
                return m
              })
            } else {
              if (item.Yaxis) {
                item.Yaxis = item.Yaxis.toLowerCase()
              }
            }
          }
        }
        if (item.cols) {
          let _update = (cols) => {
            return cols.map(col => {
              if (col.type === 'custom' && col.elements) {
                col.elements = col.elements.map(m => {
                  resetElement(m)
                  return m
                })
              } else if (col.type === 'colspan') {
                col.subcols = _update(col.subcols)
              } else if (col.field) {
                col.field = col.field.toLowerCase()
              }
              return col
            })
          }
          item.cols = _update(item.cols)
        }
        if (item.wrap) {
          if (item.wrap.tipField) {
            item.wrap.tipField = item.wrap.tipField.toLowerCase()
          }
          if (item.wrap.controlField) {
            item.wrap.controlField = item.wrap.controlField.toLowerCase()
          }
          if (item.wrap.valueField) {
            item.wrap.valueField = item.wrap.valueField.toLowerCase()
          }
          if (item.wrap.labelField) {
            item.wrap.labelField = item.wrap.labelField.toLowerCase()
          }
          if (item.wrap.parentField) {
            item.wrap.parentField = item.wrap.parentField.toLowerCase()
          }
          if (item.wrap.broadcast) {
            item.wrap.broadcast = item.wrap.broadcast.toLowerCase()
          }
          if (item.wrap.jumpField) {
            item.wrap.jumpField = item.wrap.jumpField.toLowerCase()
          }
          if (item.wrap.link) {
            item.wrap.link = item.wrap.link.toLowerCase()
          }
        }
        return item
      })
    }
    config.components = _replace(config.components)
    config.interfaces && config.interfaces.forEach(item => {
      if (item.columns) {
        item.columns = item.columns.map(col => {
          if (col.field) {
            col.field = col.field.toLowerCase()
          }
          return col
        })
      }
      if (item.setting && item.setting.primaryKey) {
        item.setting.primaryKey = item.setting.primaryKey.toLowerCase()
      }
    })
    notification.success({
      top: 92,
      message: '转换已完成。',
      duration: 3
    })
    this.props.updateConfig(config)
  }
  render() {
    return (
      <Button className="mk-border-purple" onClick={this.trigger}><VerticalRightOutlined style={{transform: 'rotate(270deg)'}}/> 字段转小写</Button>
    )
  }
}
export default LowerField
src/menu/lowerField/index.scss
src/views/menudesign/index.jsx
@@ -4,8 +4,8 @@
import { is, fromJS } from 'immutable'
import moment from 'moment'
import HTML5Backend from 'react-dnd-html5-backend'
import { notification, Modal, Collapse, Card, Switch, Button, Typography, Spin, message } from 'antd'
import { DoubleLeftOutlined, DoubleRightOutlined, EyeOutlined, EyeInvisibleOutlined, CopyOutlined } from '@ant-design/icons'
import { notification, Modal, Collapse, Card, Switch, Button, Typography, Spin, message, Dropdown } from 'antd'
import { DoubleLeftOutlined, DoubleRightOutlined, EyeOutlined, EyeInvisibleOutlined, CopyOutlined, DownOutlined } from '@ant-design/icons'
import html2canvas from 'html2canvas'
import md5 from 'md5'
@@ -35,6 +35,7 @@
const PasteController = asyncComponent(() => import('@/menu/pastecontroller'))
const StyleController = asyncComponent(() => import('@/menu/stylecontroller'))
const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
const LowerField = asyncComponent(() => import('@/menu/lowerField'))
const Debug = asyncComponent(() => import('@/menu/debug'))
const NormalCss = asyncComponent(() => import('@/menu/normalCss'))
const Versions = asyncComponent(() => import('@/menu/versions'))
@@ -1377,11 +1378,16 @@
                    <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 组件名</Button>
                    {config ? <Versions MenuId={MenuId} Template="CustomPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null}
                    <TableNodes config={config} />
                    <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                    <SysInterface config={config} updateConfig={this.updateConfig}/>
                    <PictureController/>
                    <StyleCombControlButton menu={config} />
                    <PasteController vType="admin" insert={this.insert} />
                    {config ? <Dropdown placement="bottomCenter" overlay={<div className="mk-opeartion-dropdown-wrap">
                      <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                      <LowerField config={config} updateConfig={this.resetConfig}/>
                      <PictureController/>
                    </div>} trigger={['hover']}>
                      <div className="mk-button-more">更多<DownOutlined/></div>
                    </Dropdown> : null}
                    {config ? <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                    <Button type="primary" id="save-config" disabled={!config} className={needUpdate ? 'update-tip' : ''} onClick={this.submitConfig} loading={menuloading}>保存</Button>
                    <Button type="default" disabled={menuloading} onClick={this.closeView}>关闭</Button>
src/views/menudesign/index.scss
@@ -199,8 +199,25 @@
            button {
              margin-left: 10px;
            }
            .mk-opeartion-list button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) {
              padding: 0px 10px;
            .mk-opeartion-list {
              button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) {
                padding: 0px 10px;
              }
              .mk-button-more {
                display: inline-block;
                height: 32px;
                border: 1px solid #26C281;
                color: #26C281;
                line-height: 32px;
                padding: 0 10px 0px 20px;
                border-radius: 4px;
                cursor: pointer;
                vertical-align: top;
                margin-left: 10px;
                .anticon-down {
                  margin-left: 3px;
                }
              }
            }
            .ant-switch.big {
              min-width: 60px;
@@ -253,17 +270,5 @@
  .ant-table-thead > tr > th {
    background: transparent!important;
    border-radius: 0!important;
  }
}
@media screen and (max-width: 1500px) {
  .mk-opeartion-list .ant-btn {
    min-width: 65px;
    .anticon {
      display: none;
    }
    .anticon + span {
      margin-left: 0px;
    }
  }
}
src/views/mobdesign/index.jsx
@@ -34,6 +34,7 @@
const TableNodes = asyncComponent(() => import('@/menu/tablenodes'))
const BgController = asyncComponent(() => import('@/pc/bgcontroller'))
const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
const LowerField = asyncComponent(() => import('@/menu/lowerField'))
const NormalCss = asyncComponent(() => import('@/menu/normalCss'))
const SysInterface = asyncComponent(() => import('@/menu/sysinterface'))
const Quotecomponent = asyncComponent(() => import('@/pc/quotecomponent'))
@@ -2316,6 +2317,7 @@
              <Button className="mk-border-green set-home" disabled={MenuId === appHomeId} data-title="当前菜单为应用首页" onClick={this.setHomeView}><HomeOutlined /> 设为首页</Button>
              <Button className="mk-border-purple" disabled={MenuId === appLoginId} data-title="当前菜单为应用登录页" onClick={this.setLoginView}><LoginOutlined /> 设为登录页</Button>
              <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
              <LowerField config={config} updateConfig={this.resetConfig}/>
              <Transfer MenuID={MenuId} />
              {config ? <Versions MenuId={MenuId} Template="webPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null}
              <Button type="default" onClick={this.closeView}>关闭</Button>
src/views/pcdesign/index.jsx
@@ -39,6 +39,7 @@
const PasteController = asyncComponent(() => import('@/menu/pastecontroller'))
const StyleController = asyncComponent(() => import('@/menu/stylecontroller'))
const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
const LowerField = asyncComponent(() => import('@/menu/lowerField'))
const NormalCss = asyncComponent(() => import('@/menu/normalCss'))
const SysInterface = asyncComponent(() => import('@/menu/sysinterface'))
const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent'))
@@ -1941,6 +1942,7 @@
                <Button className="mk-border-green" disabled={MenuId === appHomeId} data-title="当前菜单为应用首页" onClick={this.setHomeView}><HomeOutlined /> 设为首页</Button>
                <Button className="mk-border-purple" disabled={MenuId === appLoginId} data-title="当前菜单为应用登录页" onClick={this.setLoginView}><LoginOutlined/> 设为登录页</Button>
                <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                <LowerField config={config} updateConfig={this.resetConfig}/>
                <Transfer MenuID={MenuId} />
                {config ? <Versions MenuId={MenuId} Template="webPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null}
                <Button type="default" onClick={this.closeView}>关闭</Button>
src/views/tabledesign/index.jsx
@@ -4,8 +4,8 @@
import { is, fromJS } from 'immutable'
import moment from 'moment'
import HTML5Backend from 'react-dnd-html5-backend'
import { notification, Modal, Collapse, Card, Switch, Button, Typography, message } from 'antd'
import { DoubleLeftOutlined, DoubleRightOutlined, CopyOutlined } from '@ant-design/icons'
import { notification, Modal, Collapse, Card, Switch, Button, Typography, message, Dropdown } from 'antd'
import { DoubleLeftOutlined, DoubleRightOutlined, CopyOutlined, DownOutlined } from '@ant-design/icons'
import md5 from 'md5'
import Api from '@/api'
@@ -33,6 +33,7 @@
const BgController = asyncComponent(() => import('@/pc/bgcontroller'))
const StyleController = asyncComponent(() => import('@/menu/stylecontroller'))
const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
const LowerField = asyncComponent(() => import('@/menu/lowerField'))
const Debug = asyncComponent(() => import('@/menu/debug'))
const Versions = asyncComponent(() => import('@/menu/versions'))
const Transfer = asyncComponent(() => import('@/menu/transfer'))
@@ -1095,8 +1096,13 @@
                    {config ? <Unattended config={config} updateConfig={this.updateConfig}/> : null}
                    {config ? <Versions MenuId={MenuId} Template="BaseTable" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null}
                    <TableNodes config={config} />
                    <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                    <PasteBaseTable type="page" insert={this.insert}/>
                    {config ? <Dropdown placement="bottomCenter" overlay={<div className="mk-opeartion-dropdown-wrap">
                      <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                      <LowerField config={config} updateConfig={this.resetConfig}/>
                    </div>} trigger={['hover']}>
                      <div className="mk-button-more">更多<DownOutlined/></div>
                    </Dropdown> : null}
                    {config ? <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                    <Button type="primary" id="save-config" disabled={!config} onClick={this.submitConfig} loading={menuloading}>保存</Button>
                    <Button type="default" disabled={menuloading} onClick={this.closeView}>关闭</Button>
src/views/tabledesign/index.scss
@@ -151,8 +151,25 @@
            button {
              margin-left: 15px;
            }
            .mk-opeartion-list button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) {
              padding: 0px 10px;
            .mk-opeartion-list {
              button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) {
                padding: 0px 10px;
              }
              .mk-button-more {
                display: inline-block;
                height: 32px;
                border: 1px solid #26C281;
                color: #26C281;
                line-height: 32px;
                padding: 0 10px 0px 20px;
                border-radius: 4px;
                cursor: pointer;
                vertical-align: top;
                margin-left: 15px;
                .anticon-down {
                  margin-left: 3px;
                }
              }
            }
            .ant-switch.big {
              min-width: 60px;