<!--场景库管理，包括自然驾驶、标准法规仿真、交通事故仿真、泛化四个场景库-->
<template>
    <div>
        <toolbarTab
            :isConnect="true"
            position="top"
            :subPageActiveName="subPageActiveName"
            :toolbarItem="subPageList"
            @toolbarClick="toolsControl"
        >
        </toolbarTab>
        <traffic-accident-simulation-scene
            v-show="subPageActiveName === 1"
            :selfDrivingList="selfDrivingList"
            :targetDrivingList="targetDrivingList"
            :selfReactionList="selfReactionList"
            :conflictBehaviorList="conflictBehaviorList"
            :conflictTypeList="conflictTypeList"
        >
        </traffic-accident-simulation-scene>
        <natural-driving-scene
            v-show="subPageActiveName === 2"
            :roadList="roadList"
            :infrastructureList="infrastructureList"
            :trafficConditionList="trafficConditionList"
            :selfBehaviorList="selfBehaviorList"
            :targetBehaviorList="targetBehaviorList"
            :naturalEnvironmentList="naturalEnvironmentList"
            :temporaryOperationList="temporaryOperationList"
        >
        </natural-driving-scene>
        <standard-regulation-simulation-scene
            v-show="subPageActiveName === 3"
            :regulationTypeList="regulationTypeList"
        >
        </standard-regulation-simulation-scene>
        <generalization-scene
            v-show="subPageActiveName === 4"
            :scenarioWeatherList="scenarioWeatherList"
        ></generalization-scene>
    </div>
</template>

<script>
import toolbarTab from "@/components/toolbar/toolbarTab";
import trafficAccidentSimulationScene from "./trafficAccidentSimulationScene";
import naturalDrivingScene from "./naturalDrivingScene";
import standardRegulationSimulationScene from "./standardRegulationSimulationScene";
import generalizationScene from "./generalizationScene";

export default {
    name: "sceneLibraryManagement", // 场景库管理
    components: {
        toolbarTab,
        naturalDrivingScene,
        standardRegulationSimulationScene,
        trafficAccidentSimulationScene,
        generalizationScene,
    },
    data() {
        return {
            subPageActiveName: 1,
            selfDrivingList: [],
            targetDrivingList: [],
            selfReactionList: [],
            conflictBehaviorList: [],
            conflictTypeList: [],
            roadList: [],
            infrastructureList: [],
            trafficConditionList: [],
            selfBehaviorList: [],
            targetBehaviorList: [],
            naturalEnvironmentList: [],
            temporaryOperationList: [],
            regulationTypeList: [],
            fileNameList: [],
            scenarioWeatherList: [],
        };
    },
    computed: {
        subPageList() {
            return [
                {
                    type: "primary",
                    plain: true,
                    title: "交通事故仿真场景",
                    disabled: false,
                    api: "",
                    fromId: 1,
                },
                {
                    type: "primary",
                    plain: true,
                    title: "自然驾驶场景",
                    disabled: false,
                    api: "",
                    fromId: 2,
                },
                {
                    type: "primary",
                    plain: true,
                    title: "标准法规仿真场景",
                    disabled: false,
                    api: "",
                    fromId: 3,
                },
                {
                    type: "primary",
                    plain: true,
                    title: "泛化场景模板",
                    disabled: false,
                    api: "",
                    fromId: 4,
                },
            ];
        },
    },
    methods: {
        toolsControl(item) {
            this.subPageActiveName = item.fromId;
        },
    },
    async mounted() {
        await this.$dicsListsInit({
            selfDrivingList: "selfDriving",
            targetDrivingList: "targetDriving",
            selfReactionList: "selfReaction",
            conflictBehaviorList: "conflictBehavior",
            conflictTypeList: "conflictType",
            regulationTypeList: "regulationType",
            scenarioWeatherList: "scenarioWeather",
        });

        await this.$dicsTreesInit({
            roadList: "road",
            infrastructureList: "infrastructure",
            trafficConditionList: "trafficCondition",
            selfBehaviorList: "selfBehavior",
            targetBehaviorList: "targetBehavior",
            naturalEnvironmentList: "naturalEnvironment",
            temporaryOperationList: "temporaryOperation",
        });
    },
};
</script>

<style scoped lang="less">
.tabsBox {
    position: relative;
    overflow: hidden;

    .el-button {
        position: absolute;
        right: 40px;
        top: 45px;
    }
}
.myTabsBox {
    min-height: 99px;
}
/deep/ .el-tabs__nav .el-tabs__item {
    width: auto;
    padding: 0 10px;
}
</style>