index.blade.php 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. @extends('layouts.app')
  2. @section('title')扫描设备监视器@endsection
  3. @section('content')
  4. <div class="d-none" id="list">
  5. <!-- 表格-->
  6. <table class="table table-striped table-bordered table-hover text-nowrap waybill-table td-min-width-80"
  7. style="background: #fff;" id="table">
  8. <tr v-for="(item,i) in details.data" :key="i">
  9. <td class="td-warm text-muted"><span>@{{ i+1 }}</span></td>
  10. <td class="td-warm text-muted"><span>@{{ item.name }}</span></td>
  11. <td class="td-warm text-muted">
  12. <span
  13. :class="item.active?'badge badge-pill badge-success':'badge badge-pill badge-danger'">
  14. @{{ item.active ? '正常':'掉线' }}
  15. </span>
  16. </td>
  17. <td class="td-warm text-muted"><span>@{{ item.macAddress }}</span></td>
  18. <td class="td-warm text-muted"><span>@{{ item.receiveTime }}</span></td>
  19. </tr>
  20. </table>
  21. </div>
  22. @endsection
  23. @section('lastScript')
  24. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  25. <script>
  26. let vue = new Vue({
  27. el: "#list",
  28. data: {
  29. selectTr: '',
  30. details: [],
  31. },
  32. created() {
  33. window.tempTip.show("功能关闭,移至SWMS系统进行操作");
  34. return
  35. let url = this.getBaseUrl();
  36. url += '/api/report/scanDeviceMonitor/list';
  37. axios.get(url, this.search).then(res => {
  38. this.details = res.data;
  39. });
  40. },
  41. mounted: function () {
  42. $('#list').removeClass('d-none');
  43. this.rendingHeader();
  44. },
  45. methods: {
  46. //根据环境获取不同的url
  47. getBaseUrl() {
  48. let url = '';
  49. let env = "{{ config('app.env') }}";
  50. if (env === 'local') {
  51. url = 'http://127.0.0.1:8111'
  52. } else if (env === 'production') {
  53. url = 'https://api-back.baoshi56.com'
  54. }
  55. return url;
  56. },
  57. rendingHeader() {
  58. let column = [
  59. {name: 'name', value: '名称', neglect: true, class: "td-cool"},
  60. {name: 'active', value: '状态', neglect: true, class: "td-warm"},
  61. {name: 'macAddress', value: 'macAddress', neglect: true, class: "td-warm"},
  62. {name: 'receiveTime', value: '最近一次上传时间', neglect: true, class: "td-warm"},
  63. ];
  64. new Header({
  65. el: "table",
  66. name: "details",
  67. column: column,
  68. data: this.details,
  69. restorationColumn: 'id',
  70. fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 2,
  71. }).init();
  72. },
  73. },
  74. });
  75. </script>
  76. @endsection