const checkAssessResult = (rule, value, callback) => {
  if(value == null || (value == '' && value != 0)){
    callback(new Error('请填写结果值'))
  }else {
    var reg = /^(\d+)(\.\d+)?$/
    if (!reg.test(value)) {
      // 如果校验失败，则返回
      callback(new Error('请填写浮点数'))
    }
  }
  callback()
}
const checkForfeit = (rule, value, callback) => {
  if(value == null || (value == '' && value != 0)){
    callback(new Error('请填写罚款金额'))
  }else {
    var reg = /^(\d+)(\.\d+)?$/
    if (!reg.test(value)) {
      // 如果校验失败，则返回
      callback(new Error('请填写浮点数'))
    }
  }
  callback()
}
export const tableOption = {
  "border": true,
  "index": true,
  "indexLabel": "序号",
  "stripe": true,
  "menuAlign": "center",
  "align": "center",
  "searchMenuSpan": 6,
  menu: false,
  "column": [
    {
      "type": "select",
      "label": "场站名称",
      "prop": "stationCode",
      dicUrl: '/electricfield/all',
      rules: [{required: true, message: '请选择场站', trigger: 'blur'}]
    }
    , {
      "type": "select",
      "label": "预测厂家",
      "prop": "predictManufacturer",
      dicUrl: '/forecastmanufactor/allListById',
      rules: [{required: true, message: '请选择预测厂家', trigger: 'blur'}]
    }
    , {
      "type": "date",
      "label": "考核日期",
      "prop": "assessDay",
      rules: [{required: true, message: '请选择考核日期', trigger: 'blur'}]
    }
    , {
      "type": "input",
      "label": "输出结果值",
      "prop": "assessResult",
      labelWidth:110,
      rules:[{ required: true, trigger: "blur", validator: checkAssessResult }],
    }
    , {
      "type": "input",
      "label": "罚款金额",
      "prop": "forfeit",
      rules:[{ required: true, trigger: "blur", validator: checkForfeit }],
    }
    , {
      "type": "input",
      "label": "最后修改时间",
      "prop": "lastModifyTime",
      display:false
    }
  ]
}
