<template>
    <div class="evaluationReportPanel">
        <h1>评价报告</h1>
        <div class="evaluationInfo">
            <div class="evaluationBox">
                <div class="box">
                    <span>算法名称:</span>
                    <b>{{ info.algorithmName }}</b>
                </div>
                <div class="box">
                    <span>算法得分:</span>
                    <b>{{ info.algorithmScore }}</b>
                </div>
                <div class="box">
                    <span>测试等级:</span>
                    <b>{{ info.evaluationLevel }}</b>
                </div>
            </div>
            <div class="desBox">
                <span>算法描述:</span>
                <b>{{ info.algorithmDescribe }}</b>
            </div>
            <div class="evaBox">
                <span>算法简评:</span>
                <b>{{ info.algorithmEvaluation }}</b>
            </div>
        </div>

        <div class="tableBox tableBoxA">
            <div class="title">测试得分表</div>
            <tableList :columns="columns" :getDataWay="getDataWay"> </tableList>
        </div>

        <div class="tableBox tableBoxB">
            <div class="title">评价等级</div>
            <tableList
                :columns="columnsA"
                :getDataWay="getDataWayA"
                class="colorfulTable"
            >
            </tableList>
        </div>

        <div class="tableBox tableBoxC">
            <div class="title">算法测试评分细则</div>
            <tableList :columns="columnsB" :getDataWay="getDataWayB">
            </tableList>
        </div>

        <div class="tableBox tableBoxD">
            <div class="title">详情得分情况</div>
            <tableList :columns="columnsC" :getDataWay="getDataWayC">
            </tableList>
        </div>
    </div>
</template>

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

export default {
    name: "evaluationReport", // 评价报告
    components: { tableList },
    data() {
        return {
            id: "",
            columns: [
                {
                    label: "测试项目",
                    prop: "projectName",
                },
                {
                    label: "场景数量",
                    prop: "sceneNum",
                },
                {
                    label: "测试权重",
                    prop: "weight",
                },
                {
                    label: "测试得分",
                    prop: "score",
                },
                {
                    label: "得分率",
                    prop: "scoreRatio",
                },
            ],
            pagination: {
                //分页使用
                currentPage: 1,
                pageSize: 10,
                position: "right",
                pageSizes: [10, 30, 50, 100, 200],
                layout: "sizes, total, prev, pager, next, jumper",
            },
            getDataWay: {
                //加载表格数据
                dataType: "data",
                type: "post",
                firstRequest: false,
                data: [],
                param: {},
            },
            columnsA: [
                {
                    label: "测试项目",
                    prop: "name",
                },
                {
                    label: "90<总分<100",
                    prop: "levelA",
                    // template: true,
                },
                {
                    label: "80<总分<90",
                    prop: "levelB",
                },
                {
                    label: "70<总分<80",
                    prop: "levelC",
                },
                {
                    label: "0<总分<70",
                    prop: "levelD",
                },
            ],
            getDataWayA: {
                //加载表格数据
                dataType: "data",
                type: "post",
                firstRequest: false,
                data: [
                    {
                        index: 1,
                        name: "评价等级",
                        levelA: "优秀(G)",
                        levelB: "良好(A)",
                        levelC: "一般(M)",
                        levelD: "较差(P)",
                    },
                    {
                        index: 2,
                        name: "评价等级",
                        levelA: "++++++",
                        levelB: "+++++",
                        levelC: "++++",
                        levelD: "+++",
                    },
                ],
                param: {},
            },
            columnsB: [],
            getDataWayB: {
                //加载表格数据
                dataType: "data",
                type: "post",
                data: [],
                param: {},
            },
            columnsC: [],
            getDataWayC: {
                //加载表格数据
                dataType: "data",
                type: "post",
                data: [],
                param: {},
            },
            info: {},
        };
    },

    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.selectProjectReportById,
                    data: {
                        id: this.id,
                    },
                }).then((res) => {
                    if (res.code == 200 && res.info) {
                        this.info = res.info;
                        this.getDataWay.data = res.info.algorithmScoreList;
                        this.columnsB = res.info.subListScoreLiTitle;
                        this.getDataWayB.data = res.info.subListScoreLi;
                        this.columnsC = res.info.sceneScoreLiTitle;
                        this.getDataWayC.data = res.info.sceneScoreLi;
                    } else {
                        this.$message.error(res.message || "获取信息失败");
                    }
                });
            }
        }
    },
};
</script>

<style lang='less' scoped>
.evaluationReportPanel {
    min-width: 900px;
    width: 60%;
    margin: 0 auto;

    h1 {
        padding: 40px 0 60px;
        font-size: 36px;
        color: @themeColor;
        text-align: center;
    }

    .evaluationInfo {
        font-size: 16px;

        span,
        b {
            display: block;
            font-weight: normal;
        }

        span {
            width: 80px;
            color: @gray;
        }

        b {
            flex: 1;
        }
    }

    .evaluationBox {
        display: flex;
        justify-content: space-between;

        .box {
            display: flex;
            width: 30%;

            span {
                padding-right: 10px;
                // color: @color;
            }

            b {
                padding-bottom: 3px;
                border-bottom: 1px solid @gray;
                text-align: center;
            }
        }
    }

    .desBox,
    .evaBox {
        display: flex;

        b {
            padding: 12px;
            border: 1px solid @gray;
        }
    }

    .desBox {
        padding: 40px 0;
    }

    .tableBox {
        padding: 60px 0;
        .title {
            padding-bottom: 20px;
            font-size: 18px;
            text-align: center;
            font-weight: bold;
        }
    }

    .tableBoxB,
    .tableBoxC,
    .tableBoxD {
        padding: 0 0 60px;
    }

    .colorfulTable {
        /deep/ .el-table__body .el-table__row:first-child {
            .el-table_2_column_7 {
                background-color: #c1db69;
            }
            .el-table_2_column_8 {
                background-color: #faf54a;
            }
            .el-table_2_column_9 {
                background-color: #ff9d33;
            }
            .el-table_2_column_10 {
                background-color: #f56c6c;
            }
        }
    }
}
</style>