cluedata.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. {extend name="public/layout" /}
  2. {block name="title"}权限组管理{/block}
  3. {block name="body"}
  4. <style>
  5. html,body {
  6. background-color: #fff;
  7. }
  8. .layui-table thead tr,
  9. .layui-table-header {
  10. background-color: #D8E6F1 !important;
  11. }
  12. .layui-fluid {
  13. padding: 15px 30px;
  14. }
  15. .layui-card-body {
  16. padding: 0px;
  17. }
  18. </style>
  19. <body>
  20. <div class="layui-fluid">
  21. <div class="layui-card">
  22. <!-- <div class="layui-form layui-card-header layuiadmin-card-header-auto">
  23. <div class="layui-form-item">
  24. <div class="layui-inline">
  25. <label class="layui-form-label">素材线索数据</label>
  26. </div>
  27. </div>
  28. </div> -->
  29. <div class="layui-card-body">
  30. <div style="padding-bottom: 10px;">
  31. </div>
  32. <table id="LAY-material-list" lay-filter="LAY-material-list"></table>
  33. </div>
  34. </div>
  35. </div>
  36. {/block}
  37. {block name="js"}
  38. <script type="text/html" id="headimgTpl">
  39. <span><img src="{{d.headimgurl}}" alt="" width="30" height="30" style="border-radius: 50%"/></span>
  40. </script>
  41. <script type="text/html" id="stateTpl">
  42. {{# if(d.state == 1){ }}
  43. <span><i class="layui-icon layui-icon-circle-dot" style="color:#98c306"></i> 已建档</span>
  44. {{# } }}
  45. {{# if(d.state == 2){ }}
  46. <span>无效线索</span>
  47. {{# } }}
  48. {{# if(d.state == 0){ }}
  49. <span>未处理</span>
  50. {{# } }}
  51. </script>
  52. <script type="text/html" id="phoneTpl">
  53. {{# if(d.phone){ }}
  54. <span>{{d.phone}}</span>
  55. {{# }else{ }}
  56. <span style="color: #cccccc;">无</span>
  57. {{# } }}
  58. </script>
  59. <script>
  60. layui.config({
  61. base: '__LAYUI__/' //静态资源所在路径
  62. ,
  63. }).extend({
  64. index: 'lib/index' //主入口模块
  65. }).use(['index', 'table', 'form'], function () {
  66. var table = layui.table,
  67. $ = layui.jquery,
  68. form = layui.form;
  69. var clueUrl = '{:url("data/cluedata",["type"=>$type,"id"=>$id])}';
  70. table.render({
  71. elem : '#LAY-material-list',
  72. url : clueUrl,
  73. height: 'full-50',
  74. cols : [
  75. [{
  76. type : 'numbers',
  77. width: 80,
  78. title: '序号',
  79. sort : true
  80. }, {
  81. field : 'headimgurl',
  82. title : '头像',
  83. templet: '#headimgTpl'
  84. }, {
  85. field : 'nickname',
  86. title : '名称',
  87. },
  88. {
  89. field : 'phone',
  90. title : '电话',
  91. templet: '#phoneTpl'
  92. },
  93. {
  94. field : 'state',
  95. title : '状态',
  96. templet: '#stateTpl',
  97. }, {
  98. field : 'addtime',
  99. title : '浏览时间',
  100. }, {
  101. field : 'visit_due_time',
  102. title : '浏览时长(秒)',
  103. }]
  104. ],
  105. page : true,
  106. limit : 10,
  107. limits: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
  108. text : '对不起,加载出现异常!'
  109. });
  110. //事件
  111. var active = {
  112. // add: function() {
  113. // location.href = '{:url("grant/add")}';
  114. // }
  115. }
  116. $('.layui-btn.layuiadmin-btn-admin').on('click', function() {
  117. var type = $(this).data('type');
  118. active[type] ? active[type].call(this) : '';
  119. });
  120. //////
  121. table.on('tool(LAY-grant-list)', function(obj) {
  122. var data = obj.data;
  123. console.log(data.id);
  124. if(obj.event === 'edit') {
  125. // location.href = '{:url("grant/edit")}?grant_id='+data.id;
  126. }
  127. });
  128. });
  129. </script>
  130. </body>
  131. {/block}