<template>
    <div class="page_summary">
        <div class="cell clearfix" style="margin-top:10px;">
            <!-- <label class="title">
                <span class="name">治疗日期</span> :
            </label>
            <div class="time">
                <ul class>
                <li
                    :class="item.state == dayType ? 'active' : ''"
                    @click="chooseDay(item.state)"
                    v-for="item in day"
                    :key="item.value"
                >{{ item.label }}</li>
                </ul>
            </div>
            <el-date-picker
                v-model="time"
                prefix-icon="el-icon-date"
                @change="changeTime"
                :editable="false"
                style="width: 150px;"
                type="date"
                placeholder="选择日期时间"
                align="right"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
            ></el-date-picker> -->
            <label class="title" style="margin-left:10px;">
                <span class="name">患者信息</span> :
            </label>
            <div class="infoBox">
                <span>姓名：{{ patient.name }}</span>&nbsp;|&nbsp;<span>透析编号：{{ patient.dialysis_no }}</span>
            </div>
        </div>
        <div>
            <el-input type="textarea" :disabled="true" :rows="4" placeholder="请输入内容" v-model="dialysis_summary"></el-input>
            <el-button type="primary" v-clipboard:copy="dialysis_summary" v-clipboard:success="onCopy" v-clipboard:error="onError" style="margin-top:10px;float:right;">复制</el-button>
        </div>
    </div>
</template>

<script>
export default {
    props:{
        treatment_summary:Object,
        patient:Object
    },
    data(){
      return{
        day: [
            { value: 0, label: "今天", state: 0 },
            { value: 1, label: "昨天", state: 1 },
            { value: 2, label: "前天", state: 2 },
        ],
        dayType: 0,
        time:'',
        dialysis_summary:''
      }
    },
    created(){
        this.dialysis_summary = this.treatment_summary.dialysis_summary
    },
    methods:{
        chooseDay(day) {
            this.dayType = day;
        },
        onCopy() {
            this.$message.success("复制成功");
        },
        onError() {
            this.$message.success("复制失败,请重试");
        }
    },
    watch:{
        treatment_summary:{
            handler:function(val) {
                this.dialysis_summary = this.treatment_summary.dialysis_summary
            }
        },
        patient:{
            handler:function(val) {
            }
        },
        deep:true,
    }
}
</script>

<style lang="scss" scoped>
.tableTitle {
    font-size: 16px;
    color: #000;
    font-weight: bold;
    line-height: 40px;
}
.page_summary{
    width: 100%;
    padding-right: 10px;
    .infoBox{
        padding: 10px 20px;
        border-radius: 20px;
        border:1px solid #DCDFE6;
        font-size: 14px;
        color: #606266;
        display: flex;
        align-items: center;
    }
}
</style>
