package com.wd.workoffice.ui.adapter;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.DeviceBean;
import com.wd.workoffice.bean.SendApplyBean;
import com.wd.workoffice.bean.workEnum.PagePermissionType;
import com.wd.workoffice.util.WorkUtils;

import java.util.List;

import androidx.annotation.Nullable;

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

public class DeviceAdapter extends BaseQuickAdapter<DeviceBean.RecordsBean, BaseViewHolder> {
    public DeviceAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, DeviceBean.RecordsBean item) {
        helper.setText(R.id.tv_name, item.getTitle());
        helper.setText(R.id.tv_code, String.format("编号:%s",item.getAssetCode()));
        helper.setText(R.id.tv_rule,String.format("规格:%s",item.getSpecification()));
        helper.setText(R.id.tv_type, WorkUtils.getDeviceListStatus(item.getStatus()));
        helper.setGone(R.id.tv_component, WorkUtils.hasPermission(PagePermissionType.EQUIPMENT_LIST .getPermission()));
        helper.setGone(R.id.tv_spare_parts, WorkUtils.hasPermission(PagePermissionType.SPARE_PART_LIST.getPermission()));

        helper.addOnClickListener(R.id.tv_component);
        helper.addOnClickListener(R.id.tv_spare_parts);
    }

}

