<template>
    <div class="tank_valves" :style="getTankBodyStyle">
        <!-- 换热器 泵-->
        <ETypeTank :title="title" :iconWidth="iconWidth" :iconHeight="iconHeight" :iconSize="iconSize"></ETypeTank>
        <!-- 阀门进度 -->
        <div class="valve_progress">
            <!-- 上  -->
            <ValveProgress :iconSize="valveIconSize" :title="valveNames[0]" :rotateAngle="90" :pipeLength="200"
                :pipeLeftOffset="-50" :valveStatusArr="initValveStatusArr" progressType="steam"
                :pipeStatus="initPipeStatus" class="valve_progress1 rotate_90" />
            <!-- 下  -->
            <ValveProgress :iconSize="valveIconSize" :title="valveNames[1]" :rotateAngle="90" :pipeLength="200"
                :pipeLeftOffset="-50" :valveStatusArr="initValveStatusArr" progressType="steam"
                :pipeStatus="initPipeStatus" :pipeReverse="true" class="valve_progress2 rotate_90" />
            <!-- 左  -->
            <ValveProgress :iconSize="valveIconSize" :title="valveNames[2]" :pipeLength="264" :pipeLeftOffset="-114"
                :valveStatusArr="initValveStatusArr" progressType="steam" :pipeStatus="initPipeStatus"
                :pipeReverse="true" class="valve_progress3" />
            <!-- 右  -->
            <ValveProgress :iconSize="valveIconSize" :title="valveNames[3]" :pipeLength="593" :pipeLeftOffset="-60"
                :valveStatusArr="initValveStatusArr" progressType="steam" :pipeStatus="initPipeStatus"
                :pipeReverse="true" class="valve_progress4" />
        </div>
        <!-- 泵进度 -->
        <div class="pump_progress">
            <PumpProgress :title="pumpNames[0]" :pumpDataArr="[1, 10]" :iconSize="pumpIconSize" :showPipe="true"
                :pipeType="steam" pumpDirection="R" class="pump_progress1" />
        </div>
    </div>
</template>

<script setup>
import ETypeTank from '@/components/HnyzDcs/ETypeTankComponent.vue';
import ValveProgress from '@/components/DCS/ValveProgressComponent.vue';
import PumpProgress from '@/components/DCS/PumpComponent.vue';
import { computed } from 'vue'
const initValveStatusArr = [true]
const initPipeStatus = true
const props = defineProps({
    iconSize: {//图标大小
        type: Number,
        default: 200,
    },
    title: {//罐名
        type: String,
    },
    iconWidth: {//图标宽度
        type: Number,
    },
    iconHeight: {//图标高度
        type: Number,
    },
})

//默认阀门名称数组
const defaultValveNames = new Array(4).fill('ACV_default')
//泵默认名称
const defaultPumpNames = new Array(1).fill('P_default')

// 阀门名称映射表
const valveNameArr = {
    'E2003': ['ACV2068', 'ACV2062', 'ACV2069', 'ACV2080'],
}
//泵名称映射表
const pumpNameArr = {
    'E2003': ['P2016'],
}

//阀门名称数组,根据罐名来匹配
const valveNames = computed(() => {
    return valveNameArr[props.title] || defaultValveNames
})
//泵名称
const pumpNames = computed(() => {
    return pumpNameArr[props.title] || defaultPumpNames
})

//罐体样式
const getTankBodyStyle = computed(() => ({
    width: `${props.iconWidth ?? props.iconSize}px`,
    height: `${props.iconHeight ?? props.iconSize}px`,
}))

//阀门icon大小（罐子200-阀门50）
const valveIconSize = computed(() => {
    return (props.iconWidth ?? props.iconSize) * 0.25;
});

//泵icon大小（罐子200-泵80）
const pumpIconSize = computed(() => {
    return (props.iconWidth ?? props.iconSize) * 0.4;
});

</script>

<style scoped lang="scss">
.tank_valves {
    position: relative;
    z-index: 10;

    .valve_progress {
        .valve_progress1 {
            position: absolute;
            top: -15%;
            left: 53%;
        }

        .valve_progress2 {
            position: absolute;
            top: 124%;
            left: 53%;
        }

        .valve_progress3 {
            position: absolute;
            top: 35%;
            left: -11%;
        }


        .valve_progress4 {
            position: absolute;
            top: 35%;
            left: 88%;
        }
    }

    .pump_progress {
        .pump_progress1 {
            position: absolute;
            top: 50.2%;
            left: -66%;
            transform: translate(-50%, -50%);
        }
    }

}
</style>