index.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="layui-fluid">
  4. <div class="layui-row layui-col-space15" id="app">
  5. <div class="layui-col-md12">
  6. <div class="layui-card">
  7. <div class="layui-card-header">模板列表</div>
  8. <div class="layui-card-body">
  9. <table class="layui-hide" id="List" lay-filter="List"></table>
  10. <script type="text/html" id="status">
  11. {{# if(d.status == 1){ }}正常
  12. {{# }else{}}锁定
  13. {{# }; }}
  14. </script>
  15. <script type="text/html" id="type">
  16. {{# if(d.type == 1){ }}验证码
  17. {{# }else if(d.type == 2){ }}通知
  18. {{# }else if(d.type == 3){ }}推广
  19. {{# }; }}
  20. </script>
  21. <script type="text/html" id="is_have">
  22. {{# if(d.is_have === 1){ }}有
  23. {{# }else if(d.is_have === 0){ }}
  24. <button class="btn-xs btn btn-block" lay-event="status">添加</button>
  25. {{# }; }}
  26. </script>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  33. {/block}
  34. {block name="script"}
  35. <script>
  36. //实例化form
  37. layList.form.render();
  38. //加载列表
  39. layList.tableList('List',"{:Url('lst')}",function (){
  40. return [
  41. {field: 'id', title: 'ID', sort: true,event:'id',width:'4%',align:'center'},
  42. {field: 'templateid', title: '模板ID',align:'center',width:'6%'},
  43. {field: 'title', title: '模板名称',align:'center',width:'10%'},
  44. {field: 'content', title: '模板内容',align:'center'},
  45. {field: 'type', title: '模板类型',templet:'#type',align:'center',width:'6%'},
  46. {field: 'status', title: '模板状态',templet:'#status',align:'center',width:'6%'},
  47. {field: 'is_have', title: '是否拥有',templet:'#is_have',align:'center',width:'6%'}
  48. ];
  49. });
  50. //查询
  51. layList.search('search',function(where){
  52. layList.reload(where);
  53. });
  54. //点击事件绑定
  55. layList.tool(function (event,data,obj) {
  56. switch (event) {
  57. case 'status':
  58. var url = layList.U({c:'sms.smsPublicTemp',a:'status'});
  59. if(data.is_del) var code = {title:"操作提示",text:"确定恢复产品操作吗?",type:'info',confirm:'是的,恢复该产品'};
  60. else var code = {title:"操作提示",text:"确定申请添加" + data.templateid +"模板吗?",type:'info',confirm:'是的,我也添加'};
  61. $eb.$swal('delete',function(){
  62. $eb.axios.post(url, {id:data.id,tempId: data.templateid}).then(function(res){
  63. if(res.status == 200 && res.data.code == 200) {
  64. $eb.$swal('success',res.data.msg);
  65. }else
  66. return Promise.reject(res.data.msg || '添加失败')
  67. }).catch(function(err){
  68. $eb.$swal('error',err);
  69. });
  70. },code)
  71. break;
  72. }
  73. })
  74. </script>
  75. {/block}