<template>
    <div class="taskInfoPanel">
        <div class="panel boxA">
            <div class="titlePanel">
                <div class="titlePanelBor">基本信息</div>
            </div>
            <div class="contentBox">
                <div class="info">
                    <span>任务ID:</span>
                    <b>{{ info.taskId }}</b>
                </div>
                <div class="info">
                    <span>开始时间:</span>
                    <b>{{ info.runStartTime }}</b>
                </div>
                <div class="info">
                    <span>执行状态:</span>
                    <b>{{ info.runState }}</b>
                </div>
                <div class="info">
                    <span>场景描述:</span>
                    <b>{{ info.sceneDescribe }}</b>
                </div>
                <div class="info">
                    <span>场景名称:</span>
                    <b>{{ info.sceneName }}</b>
                </div>
                <div class="info">
                    <span>结束时间:</span>
                   <b>{{ info.runEndTime }}</b>
                </div>
                <div class="info">
                    <span>完成状态:</span>
                    <b>{{ info.finishState }}</b>
                </div>
            </div>
        </div>

        <div class="panel boxB">
            <div class="titlePanel">
                <div class="titlePanelBor">三维仿真动画</div>
            </div>
            <div class="contentBox">
                <div class="content">
                    <img
                        src="../../assets/common/image/others/3.png"
                        width="100%"
                    />
                </div>
            </div>
        </div>

        <div class="panel boxC">
            <div class="titlePanel">
                <div class="titlePanelBor">基本数据</div>
            </div>
            <div class="contentBox">
                <div class="info">
                    <span>里程(千米):</span>
                    <b>{{ info.mileage }}</b>
                </div>
                <div class="info">
                    <span>最大速度(千米/小时):</span>
                    <b>{{ info.maximunSpeed }}</b>
                </div>
                <div class="info">
                    <span>最大减速度(千米/小时):</span>
                    <b>{{ info.maximumDeceleration }}</b>
                </div>
                <div class="info">
                    <span>平均速度(千米/小时):</span>
                    <b>{{ info.averageVelocity }}</b>
                </div>
                <div class="info">
                    <span>最小速度(千米/小时):</span>
                    <b>{{ info.minimunVelocity }}</b>
                </div>
                <div class="info">
                    <span>最大摆角速度(弧度/秒):</span>
                    <b>{{ info.maximumSwingSpeed }}</b>
                </div>
            </div>
        </div>

        <div class="panel boxD">
            <div class="titlePanel">
                <div class="titlePanelBor">舒适性参数</div>
            </div>
            <div class="contentBox">
                <div class="content">
                    <div class="tip">
                        自车速度方差：{{info.speedVariance}}
                    </div>
                    <tableList
                        :columns="columns"
                        :getDataWay="getDataWay"
                        class="colorfulTable"
                    >
                    </tableList>
                </div>
                <div class="content">
                    <div class="tip">
                        自车横摆角速度均方根：{{info.swingSpeedMeanSquareRoot}}
                    </div>
                    <tableList
                        :columns="columnsA"
                        :getDataWay="getDataWayA"
                        class="colorfulTable"
                    >
                    </tableList>
                </div>
            </div>
        </div>

        <div class="panel boxE">
            <div class="titlePanel">
                <div class="titlePanelBor">变化曲线图</div>
            </div>
            <div class="contentBox">
                <div class="content">
                    <div class="chart">
                        <div class="title">变化曲线</div>
                        <line-chart id="lineA"></line-chart>
                    </div>
                    <div class="chart">
                        <div class="title">变化曲线</div>
                        <line-chart id="lineB"></line-chart>
                    </div>
                    <div class="chart">
                        <div class="title">变化曲线</div>
                        <line-chart id="lineC"></line-chart>
                    </div>
                    <div class="chart">
                        <div class="title">变化曲线</div>
                        <line-chart id="lineD"></line-chart>
                    </div>
                    <div class="chart">
                        <div class="title">变化曲线</div>
                        <line-chart id="lineE"></line-chart>
                    </div>
                    <div class="chart">
                        <div class="title">变化曲线</div>
                        <line-chart id="lineF"></line-chart>
                    </div>
                    <div class="chart">
                        <div class="title">变化曲线</div>
                        <line-chart id="lineG"></line-chart>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import tableList from "@/components/grid/TableList";
import lineChart from "@/components/echarts/lineChart";

export default {
    name: "taskInfo", // 任务详情
    components: { tableList, lineChart },
    data() {
        return {
            id: "",
            info: {},
            columns: [
                {
                    label: "方差范围",
                    prop: "id",
                },
                {
                    label: "舒适程度",
                    prop: "ktName",
                },
            ],
            getDataWay: {
                //加载表格数据
                dataType: "data",
                type: "post",
                firstRequest: false,
                data: [
                    {
                        id: "0<方差值<5",
                        ktName: "舒适",
                    },
                    {
                        id: "5<方差值<10",
                        ktName: "不舒适",
                    },
                    {
                        id: "方差值>10",
                        ktName: "极不舒适",
                    },
                ],
                param: {},
            },
            columnsA: [
                {
                    label: "均方根范围",
                    prop: "id",
                },
                {
                    label: "舒适程度",
                    prop: "ktName",
                },
            ],
            getDataWayA: {
                //加载表格数据
                dataType: "data",
                type: "post",
                firstRequest: false,
                data: [
                    {
                        id: "0<均方根值<0.02",
                        ktName: "舒适",
                    },
                    {
                        id: "0.02<均方根值<0.04",
                        ktName: "不舒适",
                    },
                    {
                        id: "均方根值>0.04",
                        ktName: "极不舒适",
                    },
                ],
                param: {},
            },
        };
    },

    computed: {},

    methods: {},

    mounted() {
        if (this.$route.query.id) {
            this.id = this.$route.query.id;

            if (this.id) {
                this.$axios({
                    method: "post",
                    url: this.$api.workManagement.selectProjectTaskById,
                    data: {
                        id: this.id,
                        taskId: "1",
                    },
                }).then((res) => {
                    if (res.code == 200 && res.info) {
                        this.info = res.info;
                    } else {
                        this.$message.error(res.message || "获取信息失败");
                    }
                });
            }
        }
    },
};
</script>

<style lang='less' scoped>
.taskInfoPanel {
    padding: 18px;

    .panel {
        border: 1px solid #dfdfdf;
        padding: 12px 24px;
        margin-bottom: 25px;
        box-shadow: 0 4px 9px #dcdcdc;
        border-radius: 3px;
    }

    .titlePanel {
        padding-bottom: 6px;
        border-bottom: 1px dotted @gray;
    }

    .boxA {
        .contentBox {
            display: flex;
            flex-wrap: wrap;
            padding: 18px 15px;
        }

        .info {
            display: flex;
            width: 300px;
            margin: 0 20px 22px 0;

            span {
                display: block;
                width: 75px;
                color: @gray;
            }

            b {
                flex: 1;
                font-weight: normal;
            }
        }
    }

    .boxB,
    .boxE {
        .contentBox {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 30px 0;
        }
    }

    .boxC {
        .contentBox {
            display: flex;
            flex-wrap: wrap;
            padding: 18px 15px;
        }

        .info {
            display: flex;
            width: 300px;
            margin: 0 20px 22px 0;

            span {
                display: block;
                width: 168px;
                padding-right: 10px;
                color: @gray;
            }

            b {
                flex: 1;
                font-weight: normal;
            }
        }
    }

    .boxD {
        .contentBox {
            display: flex;
            flex-wrap: wrap;
            padding: 18px 15px;
        }

        .content {
            width: 50%;

            /deep/ .el-table {
                width: 480px;

                .el-table_3_column_6 {
                    background-color: #a3e432;
                }
            }
        }

        .tip {
            padding: 20px 0 15px;
            margin: 0 10px;
        }

        .colorfulTable {
            /deep/ .el-table__body {
                .el-table__row:first-child {
                    td:last-child {
                        background-color: #a3e432;
                    }
                }

                .el-table__row:nth-child(2) {
                    td:last-child {
                        background-color: #f4e015;
                    }
                }

                .el-table__row:last-child {
                    td:last-child {
                        background-color: #f56c6c;
                    }
                }
            }
        }
    }

    .boxE {
        // .contentBox {
        //     flex-wrap: wrap;
        // }

        .content {
            display: flex;
            flex: 1;
            flex-wrap: wrap;
        }

        .chart {
            width: 33%;
            height: calc(25vh);
            margin-bottom: 60px;

            .title {
                text-align: center;
                color: @themeColor;
            }
        }
    }
}
</style>