data.blade.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
  2. <thead>
  3. <tr>
  4. <th class="sorting" data-sort="id"> ID</th>
  5. <th class="sorting" data-sort="company_name"> 企业名称</th>
  6. <th class="sorting" data-sort="reg_no"> 注册号</th>
  7. <th class="sorting" data-sort="legal_person"> 法人</th>
  8. <th class="sorting" data-sort="open_status"> 经营状态</th>
  9. <th class="sorting" data-sort="start_date"> 成立日期</th>
  10. <th class="sorting" data-sort="reg_capital"> 注册资本(万元)</th>
  11. {{--<th width="22%">相关操作</th>--}}
  12. </tr>
  13. </thead>
  14. <tbody>
  15. @if(isset($list))
  16. @foreach($list as $key => $item)
  17. <tr>
  18. <td>{{ $item->id }}</td>
  19. <td>
  20. <a href="{{ U('Company/Info/view',['id'=>$item->id])}}">{{ $item->company_name }}</a>
  21. <span onclick="showContacts(this,{{$item->id}})" class="pull-right text-info" style="cursor: pointer">展开</span>
  22. </td>
  23. <td>{{ $item->reg_no }}</td>
  24. <td>{{ $item->legal_person }}</td>
  25. <td>{{ $item->open_status }}</td>
  26. <td>{{ $item->start_date }}</td>
  27. <td>{{ $item->reg_capital }}</td>
  28. </tr>
  29. @if($item->contacts()->count())
  30. @foreach($item->contacts()->get() as $contact)
  31. <tr style="display: none" class="contact_{{$item->id}}">
  32. <td><input class="contactlist" name='contact_id[]' type="checkbox"
  33. value="{{ $contact->id }}" data-id="{{ $contact->id }}"></td>
  34. <td>联系人:{{ $contact->linkman }}</td>
  35. <td>电话: {{ $contact->phone }}</td>
  36. </tr>
  37. @endforeach
  38. @endif
  39. @endforeach
  40. @endif
  41. </tbody>
  42. </table>
  43. <div class="row">
  44. <div class="col-sm-6">
  45. <div class="dataTables_info" id="DataTables_Table_0_info"
  46. role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}
  47. 条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。
  48. </div>
  49. </div>
  50. <div class="col-sm-6">
  51. <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
  52. {!! $list->setPath('')->appends(Request::all())->render() !!}
  53. </div>
  54. </div>
  55. </div>
  56. <script type="text/javascript">
  57. /*显示联系人*/
  58. function showContacts(data,id) {
  59. if($('.contact_'+id).is(':hidden')){
  60. $('.contact_'+id).show()
  61. $(data).text('隐藏')
  62. $(data).removeClass('text-info')
  63. $(data).addClass('text-warning')
  64. }else {
  65. $('.contact_'+id).hide()
  66. $(data).text('显示')
  67. $(data).removeClass('text-warning')
  68. $(data).addClass('text-info')
  69. }
  70. }
  71. </script>