king
2020-08-06 b77c5e22f1ff192d9b09dda8d2376ba40641451c
2020-08-06
12个文件已修改
157 ■■■■■ 已修改文件
src/components/header/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/datasource/verifycard/settingform/index.jsx 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/datasource/verifycard/settingform/index.scss 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/dategroup/index.jsx 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/dategroup/quarterpicker/index.jsx 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/dategroup/quarterpicker/index.scss 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/dategroup/yearpicker/index.jsx 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/dategroup/yearpicker/index.scss 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/topSearch/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/codemirror/index.jsx 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/codemirror/index.scss 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils.js 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/header/index.jsx
@@ -574,10 +574,12 @@
        if (result.UserRoles) {
          let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt']
          let menukeys = []
          result.UserRoles.forEach(role => {
            role.RoleMenu.forEach(menu => {
              if (!menu.MenuID) return
              if (menukeys.includes(menu.MenuID)) return
              _permMenus[menu.MenuID] = true
              let _type = ''
@@ -601,6 +603,8 @@
                _type = pageParam.Template || _type
              }
              menukeys.push(menu.MenuID)
              menulist.push({
                MenuID: menu.MenuID,
                MenuName: menu.MenuName,
src/mob/datasource/verifycard/settingform/index.jsx
@@ -3,21 +3,12 @@
// import { fromJS } from 'immutable'
import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon, notification } from 'antd'
import moment from 'moment'
// import CodeMirror from '@uiw/react-codemirror'
// import 'codemirror/theme/monokai.css'
// import 'codemirror/theme/eclipse.css'
// import 'codemirror/addon/selection/active-line'
// import 'codemirror/addon/hint/javascript-hint'
// import 'codemirror/addon/hint/show-hint'
// import 'codemirror/addon/hint/show-hint.css'
import Api from '@/api'
import Utils from '@/utils/utils.js'
// import SettingUtils from './utils.jsx'
import CodeMirror from '@/templates/zshare/codemirror'
import './index.scss'
const { TextArea } = Input
class SettingForm extends Component {
  static propTpyes = {
@@ -258,17 +249,7 @@
              }>
                {getFieldDecorator('dataresource', {
                  initialValue: setting.dataresource || ''
                })(<TextArea rows={4} />)}
                {/* <CodeMirror
                  value={'code'}
                  options={{
                    theme: 'eclipse',
                    lineNumbers: false,
                    mode: 'SQL',
                    extraKeys: {"Ctrl": "autocomplete"},
                    styleActiveLine: true
                  }}
                /> */}
                })(<CodeMirror />)}
              </Form.Item>
            </Col> : null}
            {interType === 'inner' ? <Col span={8}>
src/mob/datasource/verifycard/settingform/index.scss
@@ -9,6 +9,9 @@
      .ant-form-item-control-wrapper {
        width: 89%;
      }
      .CodeMirror {
        height: 150px;
      }
    }
    .anticon-question-circle {
      color: #c49f47;
src/tabviews/zshare/dategroup/index.jsx
@@ -13,6 +13,7 @@
class DateGroup extends Component {
  static propTpyes = {
    card: PropTypes.object,         // 搜索条件
    position: PropTypes.number,     // 索引,用于控制季度和年的展开方向
    onGroupChange: PropTypes.func   // 搜索内容切换
  }
@@ -22,7 +23,8 @@
    yearId: Utils.getuuid(),
    dateRange: '',
    initDateRange: '',
    initType: ''
    initType: '',
    placement: this.props.position % 4 !== 3 ? 'bottomLeft' : 'bottomRight'
  }
  UNSAFE_componentWillMount() {
@@ -63,7 +65,6 @@
            break
          default:
        }
        _dateRange = [moment().subtract(_pdiffer + _val * 3, 'month').startOf('month').format('YYYY-MM-DD'),
          moment().subtract(_ndiffer + _val * 3, 'month').endOf('month').format('YYYY-MM-DD')]
      } else if (_type === 'year') {
@@ -162,7 +163,7 @@
  render() {
    const { card } = this.props
    const { active, quarterId, yearId, dateRange } = this.state
    const { active, quarterId, yearId, dateRange, placement } = this.state
    let tabs = {day: '日', week: '周', month: '月', quarter: '季', year: '年', customized: '自定义'}
    return (
@@ -185,9 +186,9 @@
            </span>)
          } else if (tab === 'quarter') {
            return (
              <Tooltip key={tab} placement="bottomLeft" overlayClassName="quarter-picker-tooltip" trigger="click" title={
              <Tooltip key={tab} placement={placement} overlayClassName={'quarter-picker-tooltip ' + placement} trigger="click" title={
                <div>
                  <QuarterPicker onChange={(date) => this.onChange(date, tab)}/>
                  <QuarterPicker card={card} onChange={(date) => this.onChange(date, tab)}/>
                </div>
              }>
                <span id={quarterId} className={'ant-tag ant-tag-quarter ant-tag-checkable ' + (active === tab ? 'ant-tag-checkable-checked' : '')} >
@@ -197,9 +198,9 @@
            )
          } else if (tab === 'year') {
            return (
              <Tooltip key={tab} placement="bottomLeft" overlayClassName="year-picker-tooltip" trigger="click" title={
              <Tooltip key={tab} placement={placement} overlayClassName={'year-picker-tooltip ' + placement} trigger="click" title={
                <div>
                  <YearPicker onChange={(date) => this.onChange(date, tab)}/>
                  <YearPicker card={card} onChange={(date) => this.onChange(date, tab)}/>
                </div>
              }>
                <span id={yearId} className={'ant-tag ant-tag-quarter ant-tag-checkable ' + (active === tab ? 'ant-tag-checkable-checked' : '')} >
src/tabviews/zshare/dategroup/quarterpicker/index.jsx
@@ -7,12 +7,27 @@
class QuarterPicker extends Component {
  static propTpyes = {
    dict: PropTypes.object,    // 字典项
    card: PropTypes.object,    // 搜索配置
    onChange: PropTypes.func
  }
  state = {
    year: moment().format('YYYY'),
    selectQuarter: Math.ceil(moment().format('MM') / 4)
    selectQuarter: Math.ceil(moment().format('MM') / 3)
  }
  UNSAFE_componentWillMount () {
    const { selectQuarter } = this.state
    const { card } = this.props
    if (card.initval && card.initval[0]) {
      let _type = card.initval[0]
      let _val = parseInt(card.initval[1])
      if (_type === 'quarter' && _val) {
        this.setState({selectQuarter: selectQuarter - _val})
      }
    }
  }
  changeYear = (type) => {
src/tabviews/zshare/dategroup/quarterpicker/index.scss
@@ -25,7 +25,12 @@
    background: #bae7ff!important;
  }
}
.quarter-picker-tooltip.bottomRight {
  .ant-calendar-quarter-picker {
    left: auto;
    right: 0;
  }
}
.quarter-picker-tooltip {
  .ant-tooltip-arrow {
    display: none;
src/tabviews/zshare/dategroup/yearpicker/index.jsx
@@ -7,6 +7,7 @@
class QuarterPicker extends Component {
  static propTpyes = {
    dict: PropTypes.object,    // 字典项
    card: PropTypes.object,    // 搜索配置
    onChange: PropTypes.func
  }
@@ -16,7 +17,19 @@
  }
  UNSAFE_componentWillMount () {
    const { year } = this.state
    const { card } = this.props
    const { selectYear } = this.state
    let year = this.state.year
    if (card.initval && card.initval[0]) {
      let _type = card.initval[0]
      let _val = parseInt(card.initval[1])
      if (_type === 'year' && _val) {
        this.setState({selectYear: selectYear - _val})
        year = Math.floor((selectYear - _val) / 10) * 10
      }
    }
    this.setState({
      yearlist: [
@@ -24,7 +37,8 @@
        [{value: year + 2, type: ''}, {value: year + 3, type: ''}, {value: year + 4, type: ''}],
        [{value: year + 5, type: ''}, {value: year + 6, type: ''}, {value: year + 7, type: ''}],
        [{value: year + 8, type: ''}, {value: year + 9, type: ''}, {value: year + 10, type: 'down'}],
      ]
      ],
      year
    })
  }
src/tabviews/zshare/dategroup/yearpicker/index.scss
@@ -32,6 +32,12 @@
  }
}
.year-picker-tooltip.bottomRight {
  .ant-calendar-year-picker {
    left: auto;
    right: 0;
  }
}
.year-picker-tooltip {
  .ant-tooltip-arrow {
    display: none;
src/tabviews/zshare/topSearch/index.jsx
@@ -459,7 +459,7 @@
        fields.push(
          <Col span={item.ratio || 6} key={index}>
            <Form.Item label={item.label} className={item.required === 'true' ? 'group-required' : ''}>
              <DateGroup ref={item.uuid} card={item} onGroupChange={this.searchChange} />
              <DateGroup ref={item.uuid} position={index} card={item} onGroupChange={this.searchChange} />
            </Form.Item>
          </Col>
        )
@@ -506,7 +506,7 @@
              value = ''
            }
          }
        } else {
        } else if (item.type !== 'group') {
          value = item.initval
        }
src/templates/zshare/codemirror/index.jsx
@@ -28,7 +28,8 @@
    value: '',      // 实时内容
    options: null,  // mode : text/javascript、text/x-mysql ; theme : cobalt - 黑底
    fullScreen: false,
    style: null
    style: null,
    display: true
  }
  UNSAFE_componentWillMount () {
@@ -78,35 +79,49 @@
    this.setState({options: {...options, fullScreen: !fullScreen}, fullScreen: !fullScreen})
  }
  changeSize = () => {
  changeSize = (size) => {
    let _style = null
    if (size === 14) {
      _style = {fontSize: '14px', lineHeight: '25px'}
    } else if (size === 16) {
      _style = {fontSize: '16px', lineHeight: '28px'}
    } else if (size === 18) {
      _style = {fontSize: '18px', lineHeight: '32px'}
    } else if (size === 20) {
      _style = {fontSize: '20px', lineHeight: '34px'}
    }
    // 切换字体大小,刷新编辑器窗口,解决调整后的选择区域错乱问题
    this.setState({style: _style, display: false, editor: null, defaultVal: this.state.value}, () => {
      this.setState({display: true})
    })
  }
  render() {
    const { defaultVal, options, fullScreen, style } = this.state
    const { defaultVal, options, fullScreen, style, display } = this.state
    const menu = (
      <Menu>
        <Menu.Item
          style={!style || style.fontSize === '14px' ? {backgroundColor: '#bae7ff'} : ''}
          onClick={() => {this.setState({style: {fontSize: '14px', lineHeight: '25px'}})}}
          onClick={() => {this.changeSize(14)}}
        >
          <span style={{padding: '0 10px 0px 5px'}}>14px</span>
        </Menu.Item>
        <Menu.Item
          style={style && style.fontSize === '16px' ? {backgroundColor: '#bae7ff'} : ''}
          onClick={() => {this.setState({style: {fontSize: '16px', lineHeight: '28px'}})}}
          onClick={() => {this.changeSize(16)}}
        >
          <span style={{padding: '0 10px 0px 5px'}}>16px</span>
        </Menu.Item>
        <Menu.Item
          style={style && style.fontSize === '18px' ? {backgroundColor: '#bae7ff'} : ''}
          onClick={() => {this.setState({style: {fontSize: '18px', lineHeight: '32px'}})}}
          onClick={() => {this.changeSize(18)}}
        >
          <span style={{padding: '0 10px 0px 5px'}}>18px</span>
        </Menu.Item>
        <Menu.Item
          style={style && style.fontSize === '20px' ? {backgroundColor: '#bae7ff'} : ''}
          onClick={() => {this.setState({style: {fontSize: '20px', lineHeight: '34px'}})}}
          onClick={() => {this.changeSize(20)}}
        >
          <span style={{padding: '0 10px 0px 5px'}}>20px</span>
        </Menu.Item>
@@ -120,7 +135,7 @@
        {fullScreen ? <Dropdown overlay={menu} placement="bottomRight">
          <Icon type="font-size" />
        </Dropdown> : null}
        <CodeMirror
        {display ? <CodeMirror
          className="code-mirror-area"
          value={defaultVal}
          options={options}
@@ -128,7 +143,7 @@
            this.setState({editor, value})
            this.props.onChange(value)
          }}
        />
        /> : null}
      </div>
    )
  }
src/templates/zshare/codemirror/index.scss
@@ -56,6 +56,9 @@
      position: fixed;
      z-index: 10;
    }
    .CodeMirror-linenumber {
      font-size: 14px;
    }
  
    // 重置模态框滚动条
    .CodeMirror-vscrollbar::-webkit-scrollbar {
src/utils/utils.js
@@ -815,7 +815,10 @@
            if (val > 2958465 || val <= 0) {                 // 时间过大或小于等于0
              errors.push(_position + dict['main.excel.content.date.over'])
            } else {                                         // 时间格式化
              val = this.formatExcelDate(val)
              if (val < 60) {                                // 1900-2-29,excel中存在,实际不存在
                val++
              }
              val = moment('19000101', 'YYYYMMDD').add(Math.floor(val - 2), 'days').format('YYYY-MM-DD')
            }
          } else if (typeof(val) === 'string') {
            val = val.replace(/(^\s*$)|\t*|\v*/ig, '')
@@ -980,25 +983,6 @@
      bottom: _sqlBottom,
      errors: errors.join('; ')
    }
  }
  /**
   * @description 格式化excel中的date值
   * @param {Number} number 时间值
   */
  static formatExcelDate(number) {
    if (number < 60) { // 1900-2-29,excel中存在,实际不存在
      number++
    }
    return moment('19000101', 'YYYYMMDD').add(number - 2, 'days').format('YYYY-MM-DD')
    // const time = new Date((number - 25569) * 24 * 3600000)
    // time.setYear(time.getFullYear() - 70)
    // const year = time.getFullYear()
    // const month = time.getMonth() + 1
    // const date = time.getDate() - 1
    // return `${year}-${(month < 10 ? '0' + month : month)}-${(date < 10 ? '0' + date : date)}`
  }
  /**