<table class="table table-striped table-sm table-hover" id="list">
    <tr class="text-center">
        <th>序号</th>
        <th>货主</th>
        <th>耗材编码</th>
        <th>尺寸</th>
        <th>特殊要求</th>
        <th>材质规格</th>
        <th>附件</th>
        <th>创建者</th>
        <th>创建时间</th>
        <th>操作</th>
    </tr>
    <tr class="text-center" v-for="(ownerMaterial,i) in ownerMaterials"  @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
        <td>@{{ i+1 }}</td>
        <td>
            <span v-if="ownerMaterial.owner">@{{ ownerMaterial.owner.name }}</span>
        </td>
        <td>@{{ ownerMaterial.material_code  }}</td>
        <td>@{{ ownerMaterial.size }}</td>
        <td>@{{ ownerMaterial.special }}</td>
        <td>@{{ ownerMaterial.specification }}</td>
        <td>
            <div class="align-center text-center" >
                @can('项目耗材-文件上传')
                    <span v-if="ownerMaterial.file">
                        <a target='_blank' :href="getDownFileUrl(ownerMaterial)" class="text-primary text-decoration is-hover"  style="cursor: default" >
                            <i class="fa fa-download"></i>&nbsp;@{{ ownerMaterial.file.file_name }}
                        </a>
                    </span>
                    <button v-else type="button" class="btn btn-sm btn-outline-dark"  @click="uploadModal(ownerMaterial,i)">文件上传</button>
                @endcan
            </div>
        </td>
        <td>
            <span v-if="ownerMaterial.initiator">@{{ ownerMaterial.initiator.name }}</span>
        </td>
        <td>@{{ ownerMaterial.created_at }}</td>
        <td>
            @can('项目耗材-编辑')
                <button type="button" class="btn btn-sm btn-outline-primary" @click="edit(ownerMaterial,i)">编辑</button>
            @endcan
            @can('项目耗材-删除')
                <button type="button" class="btn btn-sm btn-outline-danger" @click="destroy(ownerMaterial.id,i)">删除</button>
            @endcan
        </td>
    </tr>
</table>
{{$ownerMaterials->links()}}
