<template>
    <div>
        <el-dialog title="修改开庭时间" :visible="timeVisable" @close="cancel" center :distroy-on-close="true">
            <el-descriptions title="案件内容" :column="2" border>
                <el-descriptions-item label="案件编号">{{ timeData.caseNum }}</el-descriptions-item>
                <el-descriptions-item label="申请人(机构)">{{ timeData.applicantName }}</el-descriptions-item>
                <el-descriptions-item label="案件标的">{{ timeData.caseSubjectAmount }}</el-descriptions-item>
                <el-descriptions-item label="案件状态">
                    <el-tag size="small">{{ timeData.caseStatusName }}</el-tag>
                </el-descriptions-item>
                <el-descriptions-item label="仲裁方式">{{ timeData.arbitratMethodName }}</el-descriptions-item>
                <el-descriptions-item label="开庭时间">
                    <el-date-picker v-model="loanStartDate" type="datetime" placeholder="开庭时间">
                    </el-date-picker>
                </el-descriptions-item>

            </el-descriptions>
            <div slot="footer" class="dialog-footer">
                <el-button @click="cancel" class="endbutton1"><span>取 消</span></el-button>
                <el-button @click="submitTime" class="endbutton1"><span>提 交</span></el-button>
            </div>
        </el-dialog>
    </div>
</template>
<!-- hearDate -->
<script>
import { updateHeardate } from '@/api/caseManagement/caseManagement'
import { getToken } from "@/utils/auth";
import moment from "moment";
export default {
    props: ["timeVisable", "timeData"],
    data() {
        return {
            loanStartDate: ""
        };
    },
    watch: {
        timeVisable(val) {
            if (val) {
                // this.getEvidenceList({ caseAppliId: this.timeData.id, annexTypeList: "2" })
                this.loanStartDate = this.timeData.hearDate
            }
        }
    },
    created() {

    },
    methods: {
        cancel() {
            this.$emit("cancelTime");
        },
        // 提交时间
        updateHeardateFn(data) {
            updateHeardate(data).then(res => {
                this.$modal.msgSuccess("修改成功");
                this.cancel();
                this.$emit("getcaseApply");
            })
        },
        submitTime() {
            this.loanStartDate = moment(
                this.loanStartDate
            ).format("YYYY-MM-DD HH:mm:ss");
            this.updateHeardateFn({
                id: this.timeData.id,
                hearDate: this.loanStartDate
            })
        }
    },
};
</script>
  
<style lang="scss" scoped>
.steps {
    display: flex;
    flex-wrap: wrap;
}
</style>