king
2020-05-22 f25d46a5cfdc9cab3981e50255a5e82f72eba686
src/templates/subtableconfig/index.jsx
@@ -299,9 +299,9 @@
      let _config = {...config, tabName: res.MenuName, tabNo: res.MenuNo, Remark: res.Remark}
      // 未设置数据源或主键时,启用状态为false
      if (_config.setting.interType === 'inner' && !_config.setting.innerFunc && !_config.setting.dataresource) {
        _config.enabled = false
      } else if (!_config.setting.primaryKey) {
      let result = this.verifyconfig(_config)
      if (result !== true) {
        _config.enabled = false
      }
@@ -894,23 +894,43 @@
  onEnabledChange = () => {
    const { config } = this.state
    if (config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) {
    let _enabled = !config.enabled
    let result = this.verifyconfig(config)
    if (_enabled && result !== true) {
      notification.warning({
        top: 92,
        message: '尚未设置数据源,不可启用!',
        message: result,
        duration: 5
      })
    } else if (!config.setting.primaryKey) {
      notification.warning({
        top: 92,
        message: '尚未设置主键,不可启用!',
        duration: 5
      })
    } else {
      return
    }
      this.setState({
        config: {...config, enabled: !config.enabled}
      config: {...config, enabled: _enabled}
      })
    }
  /**
   * @description 校验配置信息的合法性
   */
  verifyconfig = (config) => {
    let charterr = ''
    config.charts.forEach(chart => {
      if (!charterr && ['line', 'bar', 'pie'].includes(chart.chartType) && !chart.Xaxis) {
        charterr = '图表' + (chart.title ? '《' + chart.title + '》' : '') + '坐标轴未设置,不可启用!'
      }
    })
    if (config.setting.interType === 'inner' && !config.setting.innerFunc && config.setting.default !== 'false' && !config.setting.dataresource) {
      return '菜单尚未设置数据源,不可启用!'
    } else if (!config.setting.primaryKey) {
      return '菜单尚未设置主键,不可启用!'
    } else if (charterr) {
      return charterr
    } else {
      return true
    }
  }
  /**