<template>
  <div id="sub-main">
    <el-calendar>
      <!-- 这里使用的是 2.5 slot 语法，对于新项目请使用 2.6 slot 语法-->
      <template slot="dateCell" slot-scope="{ date, data }">
        <div class="content isOk" @click="openCalendar">
          <span>{{ Number(data.day.split("-").slice(2)[0]) }}</span>
          <p>已巡查</p>
          <div class="mask"></div>
        </div>
      </template>
    </el-calendar>

    <BigChart
      class="du-xun"
      :show="dialogShow"
      @close-dialog="closeDialog"
      title="供水"
    >
      <div class="dialog-main">
        <iframe
          src="https://jzfile.cnjsjd.net/upload/100012/S3/reservoir/inspectfile/b20d92ab375824b09e441c3d53f514b2.pdf"
          frameborder="0"
        ></iframe>
      </div>
    </BigChart>

    <BigChart
      :show="calendarShow"
      @close-dialog="closeCalendar"
      title="巡查详情"
      class="calendar-dialog"
    >
      <div class="dialog-main">
        <div class="left-dialog-main">
          <div class="panel">
            <div class="panel-top">
              <div class="title">
                <div class="icon"></div>
                <span>王双燕(13858968551)</span>
              </div>
              <div class="txt">
                <p>开始：2021-09-12 13:23</p>
                <p>结束：2021-09-12 13:23</p>
                <p>路线：库区巡检</p>
              </div>
            </div>
            <div class="panel-bottom">
              <div class="box">
                <p>巡查记录<span>6</span></p>
                <div class="line"></div>
                <p>发现隐患<span>0</span></p>
              </div>
            </div>
          </div>
        </div>

        <div class="right-dialog-main">
          <div class="title">
            <div class="t-l"></div>
            <p>巡查记录</p>
            <div class="t-r"></div>
          </div>
          <div class="panel-item">
            <div class="panel">
              <p>
                巡查人员：
                <input
                  type="text"
                  :class="{ readonly: messObj.readonly }"
                  v-model="messObj.name"
                />
                <span>
                  <i @click="changeMess" class="el-icon-edit-outline"></i>
                  <i @click="delMess" class="el-icon-delete"></i>
                </span>
              </p>
              <p>
                巡查点位：
                <input
                  type="text"
                  :class="{ readonly: messObj.readonly }"
                  v-model="messObj.drop"
                />
              </p>
              <p>
                巡查结果：
                <input
                  class="text-red"
                  type="text"
                  v-model="messObj.res1"
                  :class="{ readonly: messObj.readonly }"
                />
              </p>
              <p>
                巡查时间：
                <input
                  type="text"
                  :class="{ readonly: messObj.readonly }"
                  v-model="messObj.date"
                />
              </p>
              <p>
                巡查情况：
                <input
                  type="text"
                  :class="{ readonly: messObj.readonly }"
                  v-model="messObj.res2"
                />
              </p>
            </div>
            <!-- <div class="panel">
              <p>
                巡查人员：
                <input type="text" value="王双燕" :readonly="messObj.readonly" />
                <span>
                  <i class="el-icon-edit-outline"></i>
                  <i class="el-icon-delete"></i>
                </span>
              </p>
              <p>
                巡查点位：
                <input type="text" value="大坝坝区" :readonly="messObj.readonly" />
              </p>
              <p>
                巡查结果：
                <input
                  class="text-blue"
                  type="text"
                  value="无异常"
                  :readonly="messObj.readonly"
                />
              </p>
              <p>
                巡查时间：
                <input
                  type="text"
                  value="2021-09-12 13:23"
                  :readonly="messObj.readonly"
                />
              </p>
              <p>
                巡查情况：
                <input type="text" value="无异常" :readonly="messObj.readonly" />
              </p>
            </div> -->
          </div>
        </div>
      </div>
    </BigChart>
  </div>
</template>

<script>
export default {
  data () {
    return {
      dialogShow: false,
      dateArr: ['08-02', '08-05'],
      messObj: {
        readonly: false,
        name: '王双燕',
        drop: '大坝坝区',
        date: '2021-09-12 13:23',
        res1: '有异常',
        res2: '无异常'
      },
      // 日历显示
      dayDialog: false,
      // 日历详情显示
      calendarShow: false
    }
  },
  methods: {
    showDialog (flag) {
      if (!flag) {
        this.dialogShow = true
      }
    },
    closeDialog () {
      this.dialogShow = false
    },
    // 关闭日历详情
    closeCalendar () {
      this.calendarShow = false
    },
    // 打开日历详情
    openCalendar () {
      this.calendarShow = true
    },
    changeMess () {
      // this.readonly = false
    },
    delMess () {

    }
  }
}
</script>

<style lang="scss" scoped>
$pry: #00ffff; // rgba(0, 255, 255, 1)
$pry2: #2792a0; // rgba(39, 146, 160, 1)
#sub-main {
  padding: 10px !important;
}
.el-calendar ::v-deep {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background-color: #0c3061;
  .el-calendar__header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 40px;
    margin-bottom: 10px;
    padding: 0 20px;
    background-color: #103b69;
    border: 1px solid #304d74;
    .el-calendar__title {
      color: #fff;
      font-size: 18px;
    }
    .el-calendar__button-group {
      position: absolute;
      right: 10px;
      top: 50%;
      transform: translateY(-50%);
      .el-button-group {
        .el-button {
          color: #fff;
          background-color: rgba(39, 146, 160, 0.7);
          &:hover {
            background-color: $pry2;
            border-color: rgba(0, 255, 255, 0.3);
          }
          &:active {
            border-color: $pry;
          }
        }
      }
    }
  }
  .el-calendar__body {
    width: 100%;
    flex: 1;
    padding: 0;
    .el-calendar-table {
      display: flex;
      flex-direction: column;
      width: 100%;
      height: 100%;
      thead {
        display: flex;
        justify-content: space-between;
        width: 100%;
        height: 40px;
        margin-bottom: 10px;
        background-color: #103b69;
        border: 1px solid #304d74;
        th {
          width: 230px;
          height: 100%;
          color: #fff;
          font-size: 18px;
        }
      }
      tbody {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 100%;
        flex: 1;
        tr {
          display: flex;
          justify-content: space-between;
          width: 100%;
          height: 120px;
          td {
            width: 230px;
            height: 100%;
            background-color: transparent;
            border: 0;
            .el-calendar-day {
              width: 100%;
              height: 100%;
              padding: 0 !important;
              background-color: #154570;
              border: 1px solid #304d74;
              .content {
                position: relative;
                width: 100%;
                height: 100%;
                padding: 20px 18px;
                color: rgba(255, 255, 255, 0.8);
                font-size: 18px;
                &.isOk {
                  background: url("~@/assets/images/maintain/ok_bg.png")
                    no-repeat center / 100% 100%;
                  color: $pry;
                  p {
                    position: absolute;
                    top: 50%;
                    left: 50%;
                    transform: translate(-50%, -50%);
                  }
                }
                .mask {
                  position: absolute;
                  top: 0;
                  left: 0;
                  width: 100%;
                  height: 100%;
                  &:hover {
                    background: url("~@/assets/images/maintain/mask_bg.png")
                      no-repeat center / 100% 100%;
                  }
                }
              }
            }
            &.is-selected .el-calendar-day .content .mask {
              background: url("~@/assets/images/maintain/mask_bg.png") no-repeat
                center / 100% 100%;
              color: $pry;
            }
            &.is-today .el-calendar-day .content {
              color: $pry;
              span {
                font-size: 24px;
                font-weight: 700;
              }
            }
            &.next,
            &.prev {
              .el-calendar-day {
                background-color: #103b69;
                .content {
                  color: #606266;
                  background: transparent;
                }
              }
            }
          }
        }
      }
    }
  }
}
.dialog-main {
  width: 100%;
  height: 100%;
  overflow: auto;
  iframe {
    width: 100%;
    height: 100%;
  }
}
.calendar-dialog ::v-deep {
  .el-dialog__body {
    padding: 10px;
    .dialog-main {
      position: relative;
      width: 100%;
      height: 100%;
      padding: 10px;
      background-color: #fff;
      .left-dialog-main {
        position: absolute;
        left: 10px;
        top: 10px;
        width: 240px;
        height: 640px;
        overflow: auto;
        .panel {
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          width: 240px;
          height: 166px;
          margin-bottom: 10px;
          background: rgba(3, 35, 79, 0.6) no-repeat;
          color: #d2d2d2;
          font-size: 14px;
          .panel-top {
            width: 100%;
            flex: 1;
            padding: 10px 0 0 10px;
            .title {
              display: flex;
              align-items: center;
              margin-bottom: 8px;
              .icon {
                width: 26px;
                height: 26px;
                background: url("~@/assets/images/maintain/user_icon.png")
                  no-repeat center / 100% 100%;
              }
              span {
                color: #76eff2;
                font-size: 18px;
                margin-left: 6px;
              }
            }
            .txt {
              margin-left: 32px;
              p {
                line-height: 24px;
                font-size: 14px;
              }
            }
          }
          .panel-bottom {
            display: flex;
            align-items: center;
            width: 100%;
            height: 41px;
            border-top: 1px solid rgba(125, 251, 253, 0.35);
            .box {
              display: flex;
              align-items: center;
              width: 100%;
              height: 24px;
              p {
                display: flex;
                align-items: center;
                flex: 1;
                padding-left: 20px;
                span {
                  margin-left: 7px;
                  margin-bottom: 2px;
                  color: #e88231;
                  font-size: 20px;
                }
              }
              .line {
                width: 1px;
                height: 100%;
                background-color: rgba(122, 246, 249, 0.4);
              }
            }
          }
        }
      }
      .right-dialog-main {
        display: flex;
        flex-direction: column;
        position: absolute;
        right: 10px;
        top: 10px;
        width: 240px;
        height: 640px;
        overflow: auto;
        .title {
          display: flex;
          justify-content: center;
          align-items: center;
          width: 240px;
          height: 40px;
          margin-bottom: 4px;
          background-color: rgba(3, 35, 79, 0.8);
          .t-l,
          .t-r {
            width: 24px;
            height: 16px;
            background-size: 100% 150%;
          }
          .t-l {
            background: url("~@/assets/images/common/title_left.png") no-repeat
              left center;
          }
          .t-r {
            background: url("~@/assets/images/common/title_right.png") no-repeat
              right center;
          }
          p {
            margin: 0 15px;
            font-size: 16px;
          }
        }
        .panel-item {
          flex: 1;
          overflow: auto;
          background-color: pink;
          .panel {
            display: flex;
            height: 145px;
            flex-direction: column;
            justify-content: space-between;
            padding: 15px 0 15px 15px;
            background: rgba(3, 35, 79, 0.6);
            color: #d2d2d2;
            font-size: 14px;
            margin-bottom: 10px;
            p {
              display: flex;
              align-items: center;
              input {
                width: 150px;
                color: #fff;
                background-color: transparent;
                &.readonly {
                  background-color: red;
                }
              }
              i {
                cursor: pointer;
                &::before {
                  width: 16px;
                  height: 16px;
                  padding: 0 4px;
                }
              }
            }
            p:first-child input {
              width: 106px;
            }
            .text-red {
              color: #ff4d4d !important;
            }
            .text-blue {
              color: #00ffff !important;
            }
          }
        }
      }
    }
  }
}
</style>
