king
2020-08-17 ed818fbca1a913065a6a3c2c767714efe5b18685
src/templates/calendarconfig/index.jsx
@@ -59,7 +59,6 @@
    pasteContent: null,      // 粘贴内容
    openEdition: '',         // 编辑版本标记,防止多人操作
    mockdata: [],            // 测试数据
    mockloading: false       // 数据加载中
  }
  /**
@@ -122,14 +121,14 @@
  getMockData = (year) => {
    let msgs = [
      {color: 'red', remark: '服务器异常,请联系运维人员!'},
      {color: 'orange', remark: '系统异常,请及时处理!'},
      {color: 'yellow', remark: '您的订单异常,请联系客服!'},
      {color: 'green', remark: '您的订单已完成。'},
      {color: 'red', remark: '您有一条新的消息!'},
      {color: 'orange', remark: '您有一条新的消息!'},
      {color: 'yellow', remark: '您有一条新的消息!'},
      {color: 'green', remark: '您有一条新的消息。'},
      {color: 'cyan', remark: '您有一条新的消息。'},
      {color: 'blue', remark: '任务未完成,请注意后续工作。'},
      {color: 'purple', remark: '您有新的任务等待处理!'},
      {color: 'gray', remark: '您有一封未读邮件。'}
      {color: 'blue', remark: '您有一条新的消息!'},
      {color: 'purple', remark: '您有一条新的消息。'},
      {color: 'gray', remark: '您有一条新的消息。'}
    ]
    let mockdata = []
@@ -693,15 +692,15 @@
   * @description 校验配置信息的合法性
   */
  verifyconfig = (config) => {
    let hasKey = false
    // let hasKey = false
    let cols = []
    config.columns.forEach(col => {
      if (col.field) {
        cols.push(col.field)
      }
      if (config.setting.primaryKey === col.field) {
        hasKey = true
      }
      // if (config.setting.primaryKey === col.field) {
      //   hasKey = true
      // }
    })
    let calvaild = true
@@ -717,10 +716,10 @@
    if (config.setting.interType === 'inner' && !config.setting.innerFunc && config.setting.default !== 'false' && !config.setting.dataresource) {
      return '菜单尚未设置数据源,不可启用!'
    } else if (!config.setting.primaryKey) {
      return '菜单尚未设置主键,不可启用!'
    } else if (!hasKey) {
      return '显示列中不存在主键字段,不可启用!'
    // } else if (!config.setting.primaryKey) {
    //   return '菜单尚未设置主键,不可启用!'
    // } else if (!hasKey) {
    //   return '显示列中不存在主键字段,不可启用!'
    } else if (!calvaild) {
      return '日历关联字段未设置,不可启用!'
    } else {
@@ -791,16 +790,13 @@
  // 年切换时重新生成数据
  changeDate = (year) => {
    this.setState({mockloading: true}, () => {
      this.setState({
        mockloading: false,
        mockdata: this.getMockData(year)
      })
    this.setState({
      mockdata: this.getMockData(year)
    })
  }
  render () {
    const { activeKey, config, tabviews, mockdata, mockloading } = this.state
    const { activeKey, config, tabviews, mockdata } = this.state
    return (
      <div className="model-calendar-board">
@@ -873,8 +869,8 @@
                <TabComponent config={config} updateConfig={this.updateconfig} tabviews={tabviews} setSubConfig={this.setSubConfig} />
                <CalComponent config={config} updateConfig={this.updateconfig} />
                <CalendarComponent calendar={{
                  levels: config.calendar.levels, startfield: 'start', endfield: 'end', colorfield: 'color', remarkfield: 'remark'
                }} loading={mockloading} data={mockdata} changeDate={this.changeDate}/>
                  levels: config.calendar.levels, startfield: 'start', endfield: 'end', colorfield: 'color', remarkfield: 'remark', refresh: config.calendar.refresh
                }} data={mockdata} changeDate={this.changeDate}/>
              </div>
            </Card>
          </div>