<template>
    <div class="tank_valves" :style="getTankBodyStyle">
        <!-- 三连罐  搅拌-->
        <VTypeTank :title="title" :iconWidth="iconWidth" :iconHeight="iconHeight" :iconSize="iconSize"
            :fanStatus="fanStatus"></VTypeTank>
        <div class="valve_progress">
            <!-- 上右 -->
            <ValveProgress :iconSize="valveIconSize" :title="valveNames[0]" :rotateAngle="270" :pipeLength="205"
                :pipeLeftOffset="-47" :valveStatusArr="initValveStatusArr" progressType="steam"
                :pipeStatus="initPipeStatus" :pipeReverse="true" class="valve_progress1 rotate_270" />
            <!-- 左下 -->
            <ValveProgress :iconSize="valveIconSize" :title="valveNames[1]" :pipeLength="200" :pipeLeftOffset="-60"
                :valveStatusArr="initValveStatusArr" progressType="steam" :pipeStatus="initPipeStatus"
                :pipeReverse="true" class="valve_progress2" />
        </div>
        <div class="pump_progress">
            <!-- 左下  -->
            <PumpProgress :title="pumpNames[0]" :pumpDataArr="[1, 10]" :iconSize="iconSize * 0.4" :showPipe="false"
                :pipeType="steam" pumpDirection="R" class="pump_progress1" />
        </div>
    </div>
</template>

<script setup>
import VTypeTank from '@/components/HnyzDcs/VTypeTankComponent.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,
    },
    fanStatus: {//风扇状态
        type: Boolean,
        default: undefined,
    },
})
//默认阀门名称数组
const defaultValveNames = new Array(2).fill('ACV_default')
//泵默认名称
const defaultPumpNames = new Array(1).fill('P_default')

// 阀门名称映射表
const valveNameArr = {
    'V6104': ['ACV6145', 'ACV6146'],
    'V6105': ['ACV6147', 'ACV6148'],
    'V6107': ['ACV6149', 'ACV6150'],
    'V6108': ['ACV6151', 'ACV6152'],
}
//泵名称映射表
const pumpNameArr = {
    'V6104': ['P6117'],
    'V6105': ['P6118'],
    'V6107': ['P6119'],
    'V6108': ['P6120'],
}

//阀门名称数组,根据罐名来匹配
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`,
    // fontSize: `${props.iconSize}px`,
}))


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

</script>

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

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

        .valve_progress2 {
            position: absolute;
            top: 62%;
            left: -6%;
        }

    }

    .pump_progress {
        .pump_progress1 {
            position: absolute;
            top: 77%;
            left: -57%;
            transform: translate(-50%, -50%);
            z-index: 100;
        }
    }
}
</style>