/**
 * 收集点-总览信息-收运规则
 */
import React from 'react';
import NoData from '../../../vm-nodata';

export default function Rules(props: any) {
    const { rules } = props;
    const getImgCode = (name: string) => {
        let code = 'qt';
        switch (name) {
            case '其他垃圾':
                code = 'qt';
                break;
            case '厨余垃圾':
                code = 'cy';
                break;
            case '有害垃圾':
                code = 'yh';
                break;
            case '可回收物':
                code = 'khsw';
                break;
            default:
                code = 'qt';
                break;
        }
        return code;
    };
    return (
        <>
            {Array.isArray(rules) ? (
                rules.map((ele, index) => {
                    return (
                        <div className="syrules-item" key={index}>
                            <div
                                className={`syrules-item--name ${getImgCode(
                                    ele?.productTypeName || '',
                                )}`}
                            >
                                {ele?.productTypeName || '--'}
                            </div>
                            <div className="syrules-item--content">
                                <div>{ele?.ruleTypeStr || '--'}</div>
                                <div>{ele?.bucketNum || 0}个桶</div>
                                <div>{ele?.carCodes || '--'}</div>
                            </div>
                        </div>
                    );
                })
            ) : (
                <NoData />
            )}
        </>
    );
}
