hlist.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <div class="wrapper wrapper-content animated fadeInRight">
  2. <div class="row">
  3. <div class="col-lg-12">
  4. <div class="ibox float-e-margins">
  5. <div class="ibox-title">
  6. <h5 langtag="page-hostlist"></h5>
  7. <div class="ibox-tools">
  8. <a class="collapse-link">
  9. <i class="fa fa-chevron-up"></i>
  10. </a>
  11. <a class="close-link">
  12. <i class="fa fa-times"></i>
  13. </a>
  14. </div>
  15. </div>
  16. <div class="content">
  17. <div class="table-responsive">
  18. <div id="toolbar">
  19. <a href="{{.web_base_url}}/index/addhost?vkey={{.task_id}}&client_id={{.client_id}}" class="btn btn-primary dim">
  20. <i class="fa fa-fw fa-lg fa-plus"></i> <span langtag="word-add"></span></a>
  21. </div>
  22. <table id="taskList_table" class="table-striped table-hover"
  23. data-mobile-responsive="true"></table>
  24. </div>
  25. </div>
  26. <div class="ibox-content">
  27. <table id="table"></table>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <script>
  34. /*bootstrap table*/
  35. $('#table').bootstrapTable({
  36. toolbar: "#toolbar",
  37. method: 'post', // 服务器数据的请求方式 get or post
  38. url: window.location, // 服务器数据的加载地址
  39. queryParams: function (params) {
  40. return {
  41. "offset": params.offset,
  42. "limit": params.limit,
  43. "search": params.search
  44. }
  45. },
  46. search: true,
  47. contentType: "application/x-www-form-urlencoded",
  48. striped: true, // 设置为true会有隔行变色效果
  49. showHeader: true,
  50. showColumns: true,
  51. showRefresh: true,
  52. pagination: true,//分页
  53. sidePagination: 'server',//服务器端分页
  54. pageNumber: 1,
  55. pageList: [5, 10, 20, 50],//分页步进值
  56. detailView: true,
  57. smartDisplay: true, // 智能显示 pagination 和 cardview 等
  58. onExpandRow: function () {$('body').setLang ('.detail-view');},
  59. onPostBody: function (data) { if ($(this)[0].locale != undefined ) $('body').setLang ('#table'); },
  60. detailFormatter: function (index, row, element) {
  61. return '<b langtag="word-exportflow"></b>: ' + changeunit(row.Flow.ExportFlow) + '&emsp;'
  62. + '<b langtag="word-inletflow"></b>: ' + changeunit(row.Flow.InletFlow) + '&emsp;'
  63. + '<b langtag="word-crypt"></b>: ' + row.Client.Cnf.Crypt + '&emsp;'
  64. + '<b langtag="word-compress"></b>: ' + row.Client.Cnf.Compress + '&emsp;'
  65. + '<b langtag="word-basicusername"></b>: ' + row.Client.Cnf.U + '&emsp;'
  66. + '<b langtag="word-basicpassword"></b>: ' + row.Client.Cnf.P + '&emsp;<br/><br>'
  67. + '<b langtag="word-httpscert"></b>: ' + row.CertFilePath + '&emsp;'
  68. + '<b langtag="word-httpskey"></b>: ' + row.KeyFilePath + '&emsp;<br/><br>'
  69. + '<b langtag="word-requestheader"></b>: ' + row.HeaderChange + '&emsp;<br/><br>'
  70. + '<b langtag="word-requesthost"></b>: ' + row.HostChange + '&emsp;'
  71. },
  72. //表格的列
  73. columns: [
  74. {
  75. field: 'Id',//域值
  76. title: '<span langtag="word-id"></span>',//标题
  77. halign: 'center',
  78. visible: true//false表示不显示
  79. },
  80. {
  81. field: 'Id',//域值
  82. title: '<span langtag="word-clientid"></span>',//标题
  83. halign: 'center',
  84. visible: true,//false表示不显示
  85. formatter: function (value, row, index) {
  86. return row.Client.Id
  87. }
  88. },
  89. {
  90. field: 'Remark',//域值
  91. title: '<span langtag="word-remark"></span>',//标题
  92. halign: 'center',
  93. visible: true//false表示不显示
  94. },
  95. {
  96. field: 'Host',//域值
  97. title: '<span langtag="word-host"></span>',//标题
  98. halign: 'center',
  99. visible: true//false表示不显示
  100. },
  101. {
  102. field: 'Scheme',//域值
  103. title: '<span langtag="word-scheme"></span>',//标题
  104. halign: 'center',
  105. visible: true,//false表示不显示
  106. formatter: function (value, row, index) {
  107. return '<span langtag="word-' +value+ '"></span>'
  108. }
  109. },
  110. {
  111. field: 'Target',//域值
  112. title: '<span langtag="word-target"></span>',//标题
  113. halign: 'center',
  114. visible: true,//false表示不显示
  115. formatter: function (value, row, index) {
  116. return row.Target.TargetStr
  117. }
  118. },
  119. {
  120. field: 'Location',//域值
  121. title: '<span langtag="word-location"></span>',//标题
  122. halign: 'center',
  123. visible: true//false表示不显示
  124. },
  125. {
  126. field: '',//域值
  127. title: '<span langtag="word-clientstatus"></span>',//内容
  128. align: 'center',
  129. halign: 'center',
  130. visible: true,//false表示不显示
  131. formatter: function (value, row, index) {
  132. hosturl = ((row.Scheme == 'http' ) ? 'http://' : 'https://') + row.Host + row.Location
  133. if (row.Client.IsConnect) {
  134. return '<a href="' + hosturl + '" target="_blank"><span class="badge badge-primary" langtag="word-online"></span></a>'
  135. } else {
  136. return '<span class="badge badge-badge" langtag="word-offline"></span>'
  137. }
  138. }
  139. },
  140. {
  141. field: 'option',//域值
  142. title: '<span langtag="word-option"></span>',//内容
  143. align: 'center',
  144. halign: 'center',
  145. visible: true,//false表示不显示
  146. formatter: function (value, row, index) {
  147. btn_group = '<div class="btn-group">'
  148. btn_group += "<a onclick=\"submitform('delete', '{{.web_base_url}}/index/delhost', {'id':" + row.Id
  149. btn_group += '})" class="btn btn-outline btn-danger"><i class="fa fa-trash"></i></a>'
  150. btn_group += '<a href="{{.web_base_url}}/index/edithost?id=' + row.Id
  151. btn_group += '" class="btn btn-outline btn-success"><i class="fa fa-edit"></i></a></div>'
  152. return btn_group
  153. }
  154. }
  155. ]
  156. });
  157. </script>