<template>
  <div>
    <div class="box-header">
      <div class="box-title boldtext">
        心电 <span style="margin-left: 14px">2024-08-06</span>
      </div>
      <div>
        <el-date-picker
          size="small"
          v-model="currentDatePicker"
          type="date"
          placeholder="选择日期"
          value-format="yyyy-MM-dd"
          @change="datePickerchange"
        >
        </el-date-picker>
      </div>
    </div>
    <div class="ecg-echarts">
      <div class="ecg-echarts-title">
        <div class="ecg-echarts-title-l">
          <span class="ecg-echarts-num">--</span>bpm
          <span class="ecg-echarts-num" style="margin-left: 32px">10</span>mm/mv
          <span class="ecg-echarts-num" style="margin-left: 10px">25</span>mm/s
        </div>
        <div class="ecg-echarts-num">--</div>
      </div>
      <div class="ecg-echarts-box">
        <img src="@/assets/images/watchApi/bigicon.png" @click="handleCharts" />
        <div class="ecg-echarts-boxcharts">
          <Cardiogram />
        </div>
      </div>
    </div>
    <el-dialog title="心电图" :visible.sync="dialogVisible" width="1000px" :close-on-click-modal="false">
      <div class="dialog-header">
        <div class="dialog-header-left">
            <span>姓名：kooriookami</span>
            <span>性别： 女</span>
            <span>年龄： 27</span>
        </div>
        <div class="dialog-header-right">
            <el-button type="primary" size="small">保存图片结果</el-button>
            <el-button type="primary" size="small">保存原始数据</el-button>
            <span>Qt：0ms</span>
            <span>Qtc：0ms</span>
            <span>P-R：0ms</span>
            <span>QRS：0ms</span>
        </div>
      </div>
      <div class="cardiogram-box"><Cardiogram /></div>
      <div class="cardiogram-box"><Cardiogram /></div>
      <div class="cardiogram-box"><Cardiogram /></div>
      <div class="cardiogram-box"><Cardiogram /></div>
      <div class="dialog-res">
        <div class="dialog-resbox">诊断结论：</div>
        <span>检查时间： --</span>
      </div>
      <div class="dialog-tips">
        注：以上诊断由人工智能诊断算法Cardiolearn给出，供参考，请以医院确诊结论为准。
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <div class="user-notes">
      <div class="user-notes-box">用户备注:</div>
    </div>
    <div class="ecg_result">
      <div class="ecg_result-box">
        <div class="ecg_result-title">诊断结论:</div>
        <div></div>
        <div class="ecg_result-tips">
          注：以上诊断由人工智能诊断算法Cardiolearn给出，供参考，请以医院确诊结论为准。
        </div>
      </div>
    </div>
    <div class="box-header">
      <div class="box-title boldtext">心电数据列表</div>
      <div class="box-header-right">
        <div :class="dayType == 0 ? 'active' : ''" @click="handleDayType(0)">
          今日
        </div>
        <div
          :class="dayType == 1 ? 'active line' : 'line'"
          @click="handleDayType(1)"
        >
          最近7天
        </div>
        <div :class="dayType == 2 ? 'active' : ''" @click="handleDayType(2)">
          最近30天
        </div>
      </div>
    </div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="time" label="测量时间" />
      <el-table-column prop="date" label="分析结果" />
      <el-table-column prop="date2" label="心率" />
      <el-table-column fixed="right" label="操作" width="120">
        <template slot-scope="scope">
          <el-button type="text" size="small">查看</el-button>
          <el-button type="text" size="small">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import Cardiogram from "@/components/DeviceInfo/Cardiogram.vue";
export default {
  components: {
    Cardiogram,
  },
  data() {
    return {
      dialogVisible: false,
      currentDate: this.parseTime(new Date(), "{y}-{m}-{d}"),
      currentDatePicker: "",
      dayType: 0,
      tableData: [],
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
    };
  },
  methods: {
    datePickerchange() {
      this.currentDate =
        this.currentDatePicker || this.parseTime(new Date(), "{y}-{m}-{d}");
    },
    getList() {},
    handleDayType(type) {
      this.dayType = type;
    },
    //
    handleCharts() {
      this.dialogVisible = true;
    },
  },
};
</script>

<style lang="scss" scoped>
@mixin u-flex($flexD, $alignI, $justifyC) {
  display: flex;
  flex-direction: $flexD;
  align-items: $alignI;
  justify-content: $justifyC;
}
.boldtext {
  font-size: 16px;
  color: #292929;
  line-height: 30px;
  font-weight: 700;
}
.box-header {
  padding: 0 15px;
  @include u-flex(row, center, space-between);
  height: 50px;
}
.box-title {
  color: #292929;
  font-size: 16px;
  font-family: PingFang SC-Medium;
  padding-left: 10px;
  border-left: 4px solid #2284ff;
  line-height: 13px;
}
.ecg-echarts {
  padding: 20px;
  &-title {
    width: 100%;
    @include u-flex(row, center, space-between);
    color: #727272;
    font-size: 14px;
    &-l {
      @include u-flex(row, center, flex-start);
    }
  }
  &-num {
    margin-right: 5px;
    color: #292929;
    font-weight: 700;
    font-size: 16px;
  }
  &-box {
    width: 100%;
    max-width: 1240px;
    min-height: 150px;
    position: relative;
    img {
      width: 30px;
      height: 30px;
      position: absolute;
      z-index: 99;
      right: 20px;
      bottom: 20px;
    }
  }
  &-boxcharts {
    width: 100%;
    overflow-y: auto;
  }
}
.user-notes {
  padding: 10px 20px;
  &-box {
    background-color: #fff9f5;
    color: #ff9b52;
    font-size: 12px;
    padding: 15px 20px;
  }
}
.ecg_result {
  padding: 0 20px 10px 20px;
  color: #505050;
  font-size: 14px;
  &-box {
    background-color: #ebeeee;
    padding: 15px 20px;
  }
  &-title {
    font-size: 13px;
    font-weight: 700;
    color: #454545;
    padding: 10px 0;
  }
  &-tips {
    color: #999;
    padding: 20px 0 50px 0;
    font-size: 12px;
  }
}
.box-header-right {
  @include u-flex(row, center, flex-start);
  div {
    width: 80px;
    height: 18px;
    font-size: 12px;
    text-align: center;
    color: #949494;
    cursor: pointer;
    &:hover {
      color: #2284ff;
    }
  }
  .line {
    position: relative;
    &::after {
      content: "";
      width: 2px;
      height: 11px;
      background-color: #c2c2c2;
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
    }
    &::before {
      content: "";
      width: 2px;
      height: 11px;
      background-color: #c2c2c2;
      position: absolute;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
    }
  }
  .active {
    color: #2284ff;
  }
}
.cardiogram-box {
    width: 100%;
    overflow-y: auto;
    margin: 20px 0;
}
.dialog{
    &-header {
        @include u-flex(row, center, space-between);
        &-left {
            flex: 1;
            span {
                margin-left: 10px;
            }
        }
        &-right {
            flex-shrink: 0;
            span {
                margin-left: 10px;
            }
        }
    }
    &-res {
        flex-shrink: 0;
        @include u-flex(row, center, space-between);
    }
    &-resbox {
        flex: 1;
        margin-left: 10px;
    }
    &-tips {
        margin-left: 10px;
        margin-top: 20px;
    }
}
</style>