export const icons = [
    //排水管网监测终端
    {
        type: "8",
        state: "1",
        path: "psgw_1.png"
    }, {
        type: "8",
        state: "2",
        path: "psgw_2.png"
    }, {
        type: "8",
        state: "0",
        path: "psgw_0.png"
    },
    // 地表水监测终端
    {
        type: "9",
        state: "1",
        path: "dbs_1.png"
    },
    {
        type: "9",
        state: "2",
        path: "dbs_2.png"
    }, {
        type: "9",
        state: "0",
        path: "dbs_0.png"
    },
    // 水环境光谱智能遥感终端
    {
        type: "10",
        state: "1",
        path: "gp_1.png"
    },
    {
        type: "10",
        state: "2",
        path: "gp_2.png"
    }, {
        type: "10",
        state: "0",
        path: "gp_0.png"
    },
    // 液位计监测终端
    {
        type: "11",
        state: "1",
        path: "yw_1.png"
    },
    {
        type: "11",
        state: "2",
        path: "yw_2.png"
    }, {
        type: "11",
        state: "0",
        path: "yw_0.png"
    },
]

/**
 * 
 * @param deviceItem 站点数据
 * @param isWarning 是否显示报警状态（默认显示）
 * @returns 返回对应图标
 */
export function getSiteIcon(deviceItem, isWarning = true) {
    if (isWarning) {
        // siteState: 0停用，1正常 2 作废
        if (deviceItem.deviceType && deviceItem.siteState) {
            const icon = icons.find(item => {
                return item.type == deviceItem.deviceType && item.state == deviceItem.siteState;
            })
            if (icon && icon.path) return require(`@/views/spectrum/common/images/${icon.path}`);
            else return require("@/views/spectrum/common/images/location.png");
        } else {
            return require("@/views/spectrum/common/images/location.png");
        }
    } else {
        if (deviceItem.deviceType) {
            const icon = icons.find(item => {
                return item.type == deviceItem.deviceType && item.state == '1';
            })
            if (icon && icon.path) return require(`@/views/spectrum/common/images/${icon.path}`);
            else return require("@/views/spectrum/common/images/location.png");
        } else {
            return require("@/views/spectrum/common/images/location.png");
        }
    }

}