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

export default function Rules(props: any) {
    const { rules } = props;
    const getImgCode = (name: string) => {
        let code = 'ss';
        switch (name) {
            case '洒水':
                code = 'ss';
                break;
            case '机扫':
                code = 'js';
                break;
            case '洗扫':
                code = 'xs';
                break;
            case '雾炮':
                code = 'wp';
                break;
            default:
                code = 'ss';
                break;
        }
        return code;
    };
    return (
        <div className="workRules">
            <SubTitle title="作业规则" />
            {Array.isArray(rules) ? (
                rules.map((ele, index) => {
                    return (
                        <div className="workRules-item" key={index}>
                            <div
                                className={`workRules-item--name ${getImgCode(
                                    ele?.workTypeName || '',
                                )}`}
                            >
                                {ele?.workTypeName || '--'}
                            </div>
                            <div className="workRules-item--content">
                                <span>作业趟数：</span>
                                {ele?.workCount || '--'}
                            </div>
                            <div className="workRules-item--content">
                                <span>作业时段：</span>
                                {`${ele?.workStartTime}-${ele?.workEndTime}`}
                            </div>
                        </div>
                    );
                })
            ) : (
                <NoData />
            )}
        </div>
    );
}
