package com.wd.workoffice.ui.adapter;


import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.mesBean.LogBean;
import com.wd.workoffice.bean.mesBean.ServiceStandardBean;

import java.util.List;

/**
 * Created by flexible on 2018/8/13.
 */

public class MesServiceStandardAdapter extends BaseQuickAdapter<ServiceStandardBean.ListBean, BaseViewHolder> {
    String type;

    public MesServiceStandardAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }

    public MesServiceStandardAdapter(int layoutResId, List data, String type) {
        super(layoutResId, data);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, ServiceStandardBean.ListBean item) {

        if (TextUtils.isEmpty(type)){
            helper.setText(R.id.tv_name, String.format("检查项目:%s", item.getCheckProject()));
            helper.setText(R.id.tv_status, TextUtils.equals(item.getStatus(), "1") ? "异常" : "正常");//1 异常 0正常
            helper.setText(R.id.tv_content1, item.getProcessStandard());
            helper.setText(R.id.tv_content2, item.getMeasurementUnit());
            helper.setText(R.id.tv_content3, item.getFailureCode());
        }else {
            helper.setText(R.id.tv_name, String.format("检查项目:%s", item.getInspoProDescription()));
            helper.setText(R.id.tv_status, TextUtils.equals(item.getStatus(), "1") ? "异常" : "正常");//1 异常 0正常
            helper.setText(R.id.tv_content1, item.getProcessStandard());
            helper.setText(R.id.tv_content2, item.getUint());
            helper.setText(R.id.tv_content3, item.getReportCode());
        }

    }
}

