<template>
  <div class="print-realtime-record">
    <navigation-name :msg="navName"/>
    <div class="content">
      <div class="content-wrapper">
        <el-radio-group v-model="radio">
          <el-radio :label="3">
            <div style="margin-right: 8px">最近时间</div>
            <el-input v-model="sizeForm.recently">
              <template slot="append">分钟</template>
            </el-input>
          </el-radio>
          <el-radio :label="6">
            <div style="margin-right: 8px">固定时间</div>
            <el-select
              v-model="sizeForm.time"
              placeholder="请选择时间"
              popper-class="jg-select"
              :popper-append-to-body="false"
            >
              <el-option label="当天" value="today"/>
              <el-option label="当月" value="currentMonth"/>
              <el-option label="上一月" value="lastMonth"/>
            </el-select>
            <div style="margin: 0 8px 0 16px">天的分割时间</div>
            <el-input v-model="sizeForm.daySplitTime">
              <template slot="append">时</template>
            </el-input>
          </el-radio>
          <el-radio :label="9">
            <div style="margin-right: 8px">指定范围</div>
            <el-date-picker
              v-model="sizeForm.dateRange"
              type="datetimerange"
              align="right"
              unlink-panels
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              popper-class="jg-date-picker"
              :append-to-body="false"
              :picker-options="pickerOptions">
            </el-date-picker>
          </el-radio>
        </el-radio-group>
        <div style="margin-top: 80px;float: right">
          <el-button @click="onSubmit">确定</el-button>
          <el-button style="margin-left: 10px">重置</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import NavigationName from '@/components/NavigationName'

export default {
  name: 'PrintRealtimeRecord',
  components: { NavigationName },
  data() {
    return {
      navName: '打印瞬时数据报表',
      pickerOptions: {
        shortcuts: [{
          text: '最近一周',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '最近三个月',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
            picker.$emit('pick', [start, end])
          }
        }]
      },
      sizeForm: {
        recently: 60,
        time: 'today',
        daySplitTime: 8,
        dateRange: [],
      },
      radio: 6,
    }
  },
  methods: {
    onSubmit () {
      console.log('submit!')
    }
  },
}
</script>

<style lang="less" scoped>
.print-realtime-record {
  padding: 0 40px;
  font-size: 16px;
  display: flex;
  flex-direction: column;

  .content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 80px;

    .content-wrapper {
      width: 50%;
    }
  }

  .el-radio-group {
    display: flex;
    flex-direction: column;
    font-size: 0;

    .el-radio {
      color: #606266;
      font-weight: 500;
      cursor: pointer;
      display: flex;
      align-items: center;
      margin: 24px 0;
    }

    /deep/ .el-radio__label {
      font-size: 14px;
      padding-left: 10px;
      display: flex;
      align-items: center;
    }

    /deep/ .el-radio__inner {
      border: none;
      border-radius: 50%;
      width: 24px;
      height: 24px;
      cursor: pointer;
      box-sizing: border-box;
      background-color: #EBEBEB;
      box-shadow: inset 0.1rem 0.1rem 0.1rem #aaa7a7, inset -0.1rem -0.1rem 0.1rem #FFFFFF;
    }

    /deep/ .el-radio__input.is-checked .el-radio__inner {
      border: none;
    }

    /deep/ .el-radio__inner::after {
      width: 12px;
      height: 12px;
      border-radius: 100%;
      background-color: #666666;
    }

    /deep/ .el-radio__input.is-checked+.el-radio__label {
      color: inherit;
    }
  }

  /deep/ .el-input__inner {
    background-color: #ebebeb;
    box-shadow: inset 0.1rem 0.1rem 0.1rem #AAA7A7, inset -0.1rem -0.1rem 0.1rem #FFFFFF;
    border: none;
    font-size: 16px;
    color: #333333;
  }

  /deep/ .el-input-group__append, .el-input-group__prepend {
    background-color: transparent;
    font-size: 14px;
    box-shadow: 0.1rem 0.1rem 0.1rem #aaa7a7, -0.05rem -0.05rem 0.05rem #FFFFFF;
    color: #333333;
    border: none;
    border-radius: 4px;
    padding: 0 10px;
    width: 1px;
    white-space: nowrap;
  }

  /deep/ .jg-select {
    padding: 10px;
    background-color: #ebebeb;
    box-shadow: 0.1rem 0.1rem 0.1rem #AAA7A7, -0.1rem -0.1rem 0.1rem #FFFFFF;

    .el-select-dropdown__item {
      box-shadow: 0.1rem 0.1rem 0.1rem #AAA7A7, -0.1rem -0.1rem 0.1rem #FFFFFF;
      margin: 8px 3px;
      border-radius: 5px;
    }
  }

  /deep/ .el-select-dropdown__item.selected {
    font-weight: normal;
    color: #FFFFFF;
    background-color: #A20D13;
    border-radius: 5px;
    box-shadow: inset 0.2rem 0.2rem 0.5rem #6E090C, inset -0.2rem -0.2rem 0.5rem #C71016;
  }

  /deep/ .popper__arrow {
    display: none;
  }

  /deep/ .el-range-editor .el-range-input {
    line-height: 1;
    background-color: transparent;
  }

  /deep/ .el-date-editor .el-range__icon {
    color: inherit;
  }

  /deep/ .jg-date-picker {
    background-color: #EBEBEB;
    box-shadow: 0.05rem 0.05rem 0.1rem #AAA7A7, -0.05rem -0.05rem 0.1rem #FFFFFF;

    .el-picker-panel__sidebar {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 110px;
      border-right: 1px solid #e4e4e4;
      box-sizing: border-box;
      padding-top: 6px;
      background-color: transparent;
      overflow: auto;
    }

    .today {
      div {
        span {
          color: #A20D13;
          font-weight: bolder;
        }
      }
    }

    .start-date, .end-date {
      div {
        span {
          color: #A20D13;
          font-weight: bolder;
          background-color: #EBEBEB;
          box-shadow: 0.05rem 0.05rem 0.1rem #AAA7A7, -0.05rem -0.05rem 0.1rem #FFFFFF;
        }
      }
    }

    .el-picker-panel__footer {
      border-top: 1px solid #e4e4e4;
      padding: 4px;
      text-align: right;
      background-color: #ebebeb;
      position: relative;
      font-size: 0;
    }

    .el-picker-panel__shortcut {
      display: block;
      width: 90%;
      border: 0;
      border-radius: 5px;
      background-color: transparent;
      line-height: 28px;
      font-size: 14px;
      color: #606266;
      padding-left: 12px;
      text-align: left;
      outline: 0;
      cursor: pointer;
      margin: 8px 5px;
      box-shadow: 0.1rem 0.1rem 0.1rem #aaa7a7, -0.1rem -0.1rem 0.1rem #ffffff;
    }

    .el-button--text {
      color: #A20D13;
    }

    .el-button--default {
      color: #FFF;
      background-color: #A20D13;
    }

    .el-button.is-plain:focus, .el-button.is-plain:hover {
      border-color: transparent;
      color: #FFF;
    }
  }

  .el-button {
    border: none;
    background-color: #EBEBEB;
    box-shadow: 0.05rem 0.1rem 0.1rem #AAA7A7, -0.05rem -0.1rem 0.1rem #FFFFFF;
  }

  .el-button:active {
    border: none;
    background-color: #A20D13;
    box-shadow: inset 0.1rem 0.1rem 0.2rem #6E090C, inset -0.1rem -0.1rem 0.2rem #c7494d;
  }

  .el-button:focus, .el-button:hover {
    color: #FFF;
    border-color: transparent;
    background-color: #A20D13;
  }
}
</style>
