camera_list.blade.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <link rel="stylesheet" href="/static/css/font-awesome.min.css">
  2. <link rel="stylesheet" href="/static/css/css.css">
  3. <link rel="stylesheet" href="/static/css/ace.min.css">
  4. <style>
  5. body,html{
  6. background:white;
  7. overflow-y:hidden;
  8. }
  9. .pagination{
  10. margin-left:190px;
  11. padding-top:10px;
  12. }
  13. #mine_list{
  14. overflow:hidden;
  15. overflow-y:scroll;
  16. }
  17. #mine_list::-webkit-scrollbar{
  18. display:none;
  19. }
  20. #camera_table{
  21. overflow:hidden;
  22. overflow-y:scroll;
  23. }
  24. #camera_table::-webkit-scrollbar{
  25. display:none;
  26. }
  27. </style>
  28. <div @if(request()->ajax()) style="max-height: 600px;overflow-y: auto;" @endif>
  29. @if(count($searchs) > 0)
  30. <div style="width:200px;max-height:615px;position:absolute;" id="mine_list">
  31. <div class="row">
  32. <div class="col-sm-6">
  33. <div class="widget-box" style="margin-top:0;">
  34. <div class="widget-header header-color-blue2" style="background:#009688;">
  35. <h4 class="lighter smaller">区域列表</h4>
  36. </div>
  37. <div class="widget-body" style="border:0px solid #009688;">
  38. <div class="widget-main padding-8">
  39. <div id="tree1" class="tree tree-selectable">
  40. <div class="tree-folder" style="display:none;">
  41. <div class="tree-folder-header">
  42. <i class="icon-plus"></i>
  43. <div class="tree-folder-name"></div>
  44. </div>
  45. <div class="tree-folder-content"></div>
  46. <div class="tree-loader" style="display: none;"></div>
  47. </div>
  48. <div class="tree-item" style="display:none;">
  49. <i class="icon-remove"></i>
  50. <div class="tree-item-name"></div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="layui-row" style="margin-left:210px;">
  60. <form class="layui-form" method="get" action="/admin/{{ $path }}" style="margin-bottom: 10px;" id="search_form">
  61. @csrf
  62. @if(request()->has('id'))
  63. <input type="hidden" name="id" value="{{ request()->input('id') }}">
  64. @endif
  65. <input type="hidden" name="mine_id" id="mine_id" value="">
  66. @foreach($searchs as $var => $search)
  67. @if($search['type'] == 'input')
  68. <div class="layui-input-inline">
  69. <input class="layui-input" type="text"
  70. placeholder="{{ $search['label'] }}"
  71. name="{{ $var }}"
  72. value="{{ ${$var} ?? '' }}">
  73. </div>
  74. @endif
  75. @if($search['type'] == 'select')
  76. <div class="layui-input-inline">
  77. <select name="{{ $var }}">
  78. <option value="0"
  79. @if(!isset($search['assist'])) selected @endif>{{ $search['label'] }}
  80. </option>
  81. @if(count($search['assist']) > 0)
  82. @foreach($search['assist'] as $k => $col)
  83. <option value="{{ $k }}"
  84. @if(isset(${$var}) && ${$var} == $k) selected @endif>{{ $col }}
  85. </option>
  86. @endforeach
  87. @endif
  88. </select>
  89. </div>
  90. @endif
  91. @if($search['type'] == 'tree_select')
  92. <div class="layui-input-inline">
  93. <select name="{{ $var }}">
  94. <option value="0"
  95. @if(!isset($search['assist'])) selected @endif>{{ $search['label'] }}
  96. </option>
  97. @if(count($search['assist']) > 0)
  98. @include('admin::component.multi_select_option', ['selects' => $search['assist'], 'selectPid' => request($var) ?? ''])
  99. @endif
  100. </select>
  101. </div>
  102. @endif
  103. @if($search['type'] == 'date')
  104. <div class="layui-input-inline">
  105. <input class="layui-input date-{{ $var }}" type="text"
  106. placeholder="{{ $search['label'] ?? '日期' }}"
  107. name="{{ $var }}" autocomplete="off" readonly
  108. disableautocomplete value="{{ $search['assist'][0] ?? '' }}"
  109. >
  110. </div>
  111. <script>
  112. $('.date-{{ $var }}').datepicker({
  113. language: 'zh-CN',
  114. format: 'yyyy-mm-dd',
  115. date: '{{ $search['assist'][0] ?? null }}',
  116. });
  117. </script>
  118. @endif
  119. @if($search['type'] == 'date_time')
  120. <div class="layui-input-inline">
  121. <input class="layui-input star-{{ $var }}" type="text"
  122. placeholder="{{ $search['label'][0] ?? '起始日期' }}"
  123. name="star_{{ $var }}" autocomplete="off" readonly
  124. disableautocomplete value="{{ $search['assist'][0] ?? '' }}">
  125. </div> -
  126. <div class="layui-input-inline">
  127. <input class="layui-input end-{{ $var }}" type="text"
  128. placeholder="{{ $search['label'][1] ?? '结束日期' }}"
  129. name="end_{{ $var }}" autocomplete="off" readonly
  130. disableautocomplete value="{{ $search['assist'][1] ?? '' }}">
  131. </div>
  132. <script>
  133. $('.star-{{ $var }}').datepicker({
  134. language: 'zh-CN',
  135. format: 'yyyy-mm-dd',
  136. date: '{{ $search['assist'][0] ?? null }}',
  137. pick: function (rtime) {
  138. $('.end-{{ $var }}').datepicker('setStartDate', rtime.date);
  139. }
  140. });
  141. $('.end-{{ $var }}').datepicker({
  142. language: 'zh-CN',
  143. format: 'yyyy-mm-dd',
  144. date: '{{ $search['assist'][0] ?? null }}'
  145. });
  146. </script>
  147. @endif
  148. @endforeach
  149. <button class="layui-btn" type="submit"><i class="layui-icon">&#xe615;</i></button>
  150. </form>
  151. </div>
  152. @endif
  153. @if(count($topActions) > 0 || (isset($topActionOthers) && count($topActionOthers)) > 0)
  154. <div class="weadmin-block layui-clear" style="margin-left:210px;">
  155. @if(in_array('goback', $topActions))
  156. @if(isset($topActions['href']))
  157. <a class="layui-btn layui-btn-primary layui-layer-close" style="position:relative;"
  158. href="{{ $topActions['href'] }}">返回
  159. </a>
  160. @else
  161. <button class="layui-btn layui-btn-primary layui-layer-close" style="position:relative;" type="button"
  162. onclick="javascript:history.go(-1);">返回
  163. </button>
  164. @endif
  165. @endif
  166. @if(checkBtn('/admin/'.$path.'/add', $permissionsList))
  167. @if(in_array('add', $topActions))
  168. @if(isset($topActions['add_params']))
  169. <a href="/admin/{{ $path }}/add?{{ $topActions['add_params']}} " class="layui-btn">添加</a>
  170. @else
  171. <a href="/admin/{{ $path }}/add" class="layui-btn">添加</a>
  172. @endif
  173. @endif
  174. @endif
  175. @if(checkBtn('/admin/'.$path.'/export', $permissionsList))
  176. @if(in_array('export', $topActions))
  177. <a href="/admin/{{ $path }}/export?{{ http_build_query(request()->except('_token')) }}"
  178. class="layui-btn">Excel导出当前页</a>
  179. <a href="/admin/{{ $path }}/export?type=all&{{ http_build_query(request()->except('_token')) }}"
  180. class="layui-btn">Excel导出全部</a>
  181. @endif
  182. @endif
  183. @if(checkBtn('/admin/'.$path.'/importTemplate', $permissionsList))
  184. @if(in_array('importTemplate', $topActions))
  185. <a href="/admin/{{ $path }}/importTemplate" class="layui-btn">下载导入模板</a>
  186. @endif
  187. @endif
  188. @if(checkBtn('/admin/'.$path.'/import', $permissionsList))
  189. @if(in_array('import', $topActions))
  190. <button type="button" class="layui-btn" id="import">
  191. <i class="layui-icon">&#xe67c;</i>Excel导入
  192. </button>
  193. @endif
  194. @endif
  195. <div style="float: right;">
  196. @if(isset($topActionOthers) && count($topActionOthers) > 0)
  197. @foreach($topActionOthers as $topActionOther)
  198. @if(checkBtn('/admin/'.$topActionOther['path'], $permissionsList))
  199. @if(isset($topActionOther['isShow']))
  200. @if(isset($topActionOther['isJump']))
  201. <button class="layui-btn {{ $topActionOther['class'] }}"
  202. onclick="jumpBtn(this)"
  203. data-jumptype="{{ $topActionOther['isJump'] }}"
  204. data-href="{{ $topActionOther['path'] }}">{{ $topActionOther['name'] }}
  205. </button>
  206. @else
  207. <a href="/admin/{{ $topActionOther['path'] }}"
  208. class="layui-btn {{ $topActionOther['class'] }}">{{ $topActionOther['name'] }}</a>
  209. @endif
  210. @endif
  211. @endif
  212. @endforeach
  213. @endif
  214. </div>
  215. </div>
  216. @endif
  217. <div style="margin-left:210px;max-height:454px;" id="camera_table">
  218. <table class="layui-table" style="">
  219. <thead>
  220. <tr>
  221. @foreach($columns as $column)
  222. <th style="width:11%;">{{ $column['name'] }}</th>
  223. @endforeach
  224. @if((isset($displayActionOthers) && count($displayActionOthers) > 0) || count($actionBtns) > 0)
  225. <th style="width:15%;">操作</th>
  226. @endif
  227. </tr>
  228. </thead>
  229. <tbody>
  230. @if(count($items) > 0)
  231. @foreach($items as $item)
  232. <tr>
  233. @foreach($columns as $varName => $column)
  234. <td>{!! isset($column['value']) ? $column['value']($item->$varName, $item) : $item->$varName !!}</td>
  235. @endforeach
  236. @if((isset($displayActionOthers) && count($displayActionOthers) > 0) || count($actionBtns) > 0)
  237. <td>
  238. @if(isset($displayActionOthers) && count($displayActionOthers) > 0)
  239. @foreach($displayActionOthers as $displayActionOther)
  240. @if(checkBtn('/admin/'.$displayActionOther['path'], $permissionsList))
  241. @if(isset($displayActionOther['isShow']) ? $displayActionOther['isShow']($item) : 1)
  242. @if(isset($displayActionOther['isJump']))
  243. <button
  244. class="layui-btn layui-btn-xs {{ $displayActionOther['class'] }} @if($displayActionOther['isJump'] == 'uploadimg') uploadimg @endif"
  245. onclick="jumpBtn(this)"
  246. data-title="{{ $displayActionOther['title'] ?? '' }}"
  247. data-jumptype="{{ $displayActionOther['isJump'] }}"
  248. data-href="{{ substr($displayActionOther['path'],-1) == '&' ? $displayActionOther['path']:$displayActionOther['path'].'?' }}{{ $primaryKey }}={{ $item->$primaryKey }}">{{ $displayActionOther['name'] }}
  249. </button>
  250. @else
  251. <a href="/admin/{{ substr($displayActionOther['path'],-1) == '&' ? $displayActionOther['path']:$displayActionOther['path'].'?' }}{{ $primaryKey }}={{ $item->$primaryKey }}"
  252. class="layui-btn layui-btn-xs {{ $displayActionOther['class'] }}"
  253. @if(isset($displayActionOther['fullWin'])) target="_blank" @endif>{{ $displayActionOther['name'] }}</a>
  254. @endif
  255. @endif
  256. @endif
  257. @endforeach
  258. @endif
  259. @if(!is_array($item) || !in_array($item[$displayActions['name']], $displayActions['value']))
  260. @if(checkBtn('/admin/'.$path.'/view', $permissionsList))
  261. @if(in_array('view', $actionBtns))
  262. <a href="/admin/{{ $path }}/view?{{ $primaryKey }}={{ $item->$primaryKey }}"
  263. class="layui-btn layui-btn-normal layui-btn-xs" {{ $actionBtnsAttribute['view'] ?? '' }} >查看</a>
  264. @endif
  265. @endif
  266. @if(checkBtn('/admin/'.$path.'/edit', $permissionsList))
  267. @if(in_array('edit', $actionBtns))
  268. <a href="/admin/{{ $path }}/edit?{{ $primaryKey }}={{ $item->$primaryKey }}"
  269. class="layui-btn layui-btn-xs" {{ $actionBtnsAttribute['edit'] ?? '' }}>编辑</a>
  270. @endif
  271. @endif
  272. @if(checkBtn('/admin/'.$path.'/del', $permissionsList))
  273. @if(in_array('del', $actionBtns))
  274. <button class="layui-btn layui-btn-xs layui-btn-danger delItem"
  275. data-itemid="{{ $item->$primaryKey }}" {{ $actionBtnsAttribute['del'] ?? '' }}>
  276. 删除
  277. </button>
  278. @endif
  279. @endif
  280. @endif
  281. </td>
  282. @endif
  283. </tr>
  284. @endforeach
  285. @else
  286. <tr>
  287. <td colspan="{{ count($columns) + 1 }}">暂无数据</td>
  288. </tr>
  289. @endif
  290. </tbody>
  291. </table>
  292. </div>
  293. </div>
  294. @if(method_exists($items, 'links'))
  295. {{ $items->appends(request()->except('_token'))->links() }}
  296. @endif
  297. <script>
  298. $(function () {
  299. $('.delItem').on('click', function () {
  300. var self = $(this);
  301. layer.confirm('你确定删除?', function () {
  302. layer.closeAll();
  303. $.post('/admin/{{ $path }}/del', {"{{ $primaryKey }}": self.data('itemid')}, function (res) {
  304. if (res.code === 0) {
  305. layer.msg('成功!', {anim: 0}, function () {
  306. location.reload();
  307. });
  308. } else {
  309. layer.msg(res.message);
  310. }
  311. });
  312. });
  313. })
  314. });
  315. function jumpBtn(el) {
  316. var self = $(el);
  317. var path = self.data('href');
  318. var type = self.data('jumptype');
  319. var jvalue = self.data('value') || '';
  320. var title = self.data('title') || '';
  321. var text = self.text();
  322. if (type === 'confirm') {
  323. layer.confirm('确定' + text + '?', function (index) {
  324. layer.close(index);
  325. $.get('/admin/' + path, function (res) {
  326. if (res.code === 0) {
  327. layer.msg('成功!', {anim: 0}, function () {
  328. location.reload();
  329. });
  330. } else {
  331. layer.msg('失败:' + res.message);
  332. }
  333. });
  334. });
  335. } else if (type === 'uploadimg') {
  336. } else if (type === 'prompt') {
  337. layer.prompt({
  338. value: jvalue,
  339. title: title,
  340. }, function (value, index, elem) {
  341. layer.close(index);
  342. $.get('/admin/' + path, {newValue: value}, function (res) {
  343. if (res.code === 0) {
  344. layer.msg('成功!', {anim: 0, time: 1000}, function () {
  345. self.text(value).data('value', value);
  346. location.reload();
  347. });
  348. } else {
  349. layer.msg('失败:' + res.message);
  350. }
  351. });
  352. });
  353. } else {
  354. $.get('/admin/' + path, function (res) {
  355. layer.open({
  356. type: 1,
  357. area: '700px',
  358. offset: '150px',
  359. title: false,
  360. content: res
  361. });
  362. });
  363. }
  364. }
  365. layui.use(['upload', 'form'], function () {
  366. var upload = layui.upload, form = layui.form;
  367. form.on('switch', function (data) {
  368. var self = $(data.elem);
  369. var path = self.data('href');
  370. $.get('/admin/' + path, function (res) {
  371. console.log(res);
  372. if (res.code === 0) {
  373. } else {
  374. layer.msg('失败:' + res.message);
  375. }
  376. });
  377. });
  378. //执行实例
  379. var uploadInst = upload.render({
  380. elem: '#import' //绑定元素
  381. , field: 'excel'
  382. , exts: 'xls|xlsx|csv'
  383. , url: '/admin/{{ $path }}/import' //上传接口
  384. , done: function (res) {
  385. if (res.code === 0) {
  386. layer.msg('导入成功,加载请稍等待!', {anim: 0}, function () {
  387. location.reload();
  388. });
  389. } else {
  390. layer.msg('导入失败,即将跳转到错误信息页。', {anim: 0}, function () {
  391. location.href = '/admin/errorPage';
  392. });
  393. }
  394. }
  395. , error: function (res) {
  396. layer.msg(res.message);
  397. }
  398. });
  399. //执行实例
  400. $('.uploadimg').each(function (index, elem) {
  401. upload.render({
  402. elem: elem //绑定元素
  403. , field: 'img'
  404. , url: '/admin/' + $(elem).data('href') //上传接口
  405. , done: function (res) {
  406. if (res.code === 0) {
  407. layer.msg('上传成功', {anim: 0}, function () {
  408. location.reload();
  409. });
  410. } else {
  411. layer.msg(res.message);
  412. }
  413. }
  414. , error: function (res) {
  415. layer.msg(res.message);
  416. }
  417. });
  418. });
  419. });
  420. </script>
  421. <script src="/static/js/jquery.min.js"></script>
  422. <script src="/static/js/bootstrap.min.js"></script>
  423. <script src="/static/js/fuelux.tree-sampledata.js"></script>
  424. <script src="/static/js/fuelux.tree.min.js"></script>
  425. <script src="/static/js/ace-elements.min.js"></script>
  426. <script src="/static/js/ace.min.js"></script>
  427. <script type="text/javascript">
  428. var tree_data = <?php echo json_encode($tree_data);?>;
  429. var treeDataSource = new DataSourceTree({data: tree_data});
  430. jQuery(function($){
  431. $('#tree1').ace_tree({
  432. dataSource: treeDataSource ,
  433. multiSelect:true,
  434. loadingHTML:'<div class="tree-loading"><i class="icon-refresh icon-spin blue"></i></div>',
  435. 'open-icon' : 'icon-minus',
  436. 'close-icon' : 'icon-plus',
  437. 'selectable' : true,
  438. // 'selected-icon' : 'icon-ok',
  439. // 'unselected-icon' : 'icon-remove'
  440. });
  441. });
  442. </script>