/*  @description: 踏勘时间规则
  @Modifier: haofengxian
  @routerPath:
  @date: 2020-10-20-11:34*/
export const explorationTimeRule = {
  methods: {
    // 踏勘时间规则
    explorationTimeRule(timeRuleInfo) {
      let isTimeRule = true
      // 踏勘现场截止时间
      isTimeRule = this.changeExplorationSceneEndTime(timeRuleInfo)
      // 集合时间
      if (isTimeRule) { isTimeRule = this.changeGatherTime(timeRuleInfo) }
      // 答疑会时间
      if (isTimeRule) { isTimeRule = this.changeMeetTime(timeRuleInfo) }
      // 返回数据
      return isTimeRule
    },
    // 踏勘现场截止时间
    changeExplorationSceneEndTime(timeRuleInfo) {
      let isTimeRule = true
      if (timeRuleInfo.gatherTime && timeRuleInfo.explorationSceneEndTime) {
        isTimeRule = this.transformTime1(timeRuleInfo)
      }
      if (timeRuleInfo.meetTime && timeRuleInfo.explorationSceneEndTime) {
        isTimeRule = this.transformTime2(timeRuleInfo)
      }
      return isTimeRule
    },
    // 集合时间
    changeGatherTime(timeRuleInfo) {
      let isTimeRule = true
      if (timeRuleInfo.gatherTime && timeRuleInfo.explorationSceneEndTime) {
        isTimeRule = this.transformTime1(timeRuleInfo)
      }
      return isTimeRule
    },
    // 答疑会时间
    changeMeetTime(timeRuleInfo) {
      let isTimeRule = true
      if (timeRuleInfo.meetTime && timeRuleInfo.explorationSceneEndTime) {
        isTimeRule = this.transformTime2(timeRuleInfo)
      }
      return isTimeRule
    },
    transformTime1(timeRuleInfo) {
      return this.computationTime(
        timeRuleInfo.gatherTime, // 集合时间
        timeRuleInfo.explorationSceneEndTime, // 踏勘现场截止时间
        '【踏勘现场截止时间】应大于【集合时间】'// 提示文案
      )
    },
    transformTime2(timeRuleInfo) {
      return this.computationTime(
        timeRuleInfo.meetTime, // 答疑会时间
        timeRuleInfo.explorationSceneEndTime, // 踏勘现场截止时间
        '【踏勘现场截止时间】应大于【答疑会时间】'// 提示文案
      )
    }
  }
}
