index.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox">
  6. <div class="ibox-title">
  7. <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}')">添加模板消息</button>
  8. <button type="button" class="layui-btn btn btn-w-m btn-primary" onclick="syncTemplate()">一键同步</button>
  9. <div class="ibox-tools">
  10. </div>
  11. </div>
  12. <div class="ibox-content">
  13. <div class="row">
  14. <div class="m-b m-l">
  15. <form action="" class="form-inline">
  16. <select name="status" aria-controls="editable" class="form-control input-sm">
  17. <option value="">是否有效</option>
  18. <option value="1" {eq name="where.status" value="1"}selected="selected"{/eq}>开启</option>
  19. <option value="0" {eq name="where.status" value="0"}selected="selected"{/eq}>关闭</option>
  20. </select>
  21. <div class="input-group">
  22. <input type="text" name="name" value="{$where.name}" placeholder="请输入模板名" class="input-sm form-control"> <span class="input-group-btn">
  23. <button type="submit" class="btn btn-sm btn-primary"> <i class="fa fa-search" ></i>搜索</button> </span>
  24. </div>
  25. </form>
  26. </div>
  27. </div>
  28. <div class="table-responsive">
  29. <table class="table table-striped table-bordered">
  30. <thead>
  31. <tr>
  32. <th class="text-center">编号</th>
  33. <th class="text-center">模板编号</th>
  34. <th class="text-center">模板ID</th>
  35. <th class="text-center">模板名</th>
  36. <th class="text-center">回复内容</th>
  37. <th class="text-center">状态</th>
  38. <th class="text-center">添加时间</th>
  39. <th class="text-center">操作</th>
  40. </tr>
  41. </thead>
  42. <tbody class="">
  43. {volist name="list" id="vo"}
  44. <tr>
  45. <td class="text-center">
  46. {$vo.id}
  47. </td>
  48. <td class="text-center">
  49. {$vo.tempkey}
  50. </td>
  51. <td class="text-center">
  52. {$vo.tempid}
  53. </td>
  54. <td class="text-center">
  55. {$vo.name}
  56. </td>
  57. <td class="text-center">
  58. <pre>{$vo.content}</pre>
  59. </td>
  60. <td class="text-center">
  61. <i class="fa {eq name='vo.status' value='1'}fa-check text-navy{else/}fa-close text-danger{/eq}"></i>
  62. </td>
  63. <td class="text-center">
  64. {$vo.add_time|date='Y-m-d H:i:s'}
  65. </td>
  66. <td class="text-center">
  67. <button class="btn btn-info btn-xs" type="button" onclick="$eb.createModalFrame('编辑','{:Url('edit',array('id'=>$vo['id']))}',{h:400})"><i class="fa fa-edit"></i>编辑</button>
  68. <button class="btn btn-danger btn-xs" data-url="{:Url('delete',array('id'=>$vo['id']))}" type="button"><i class="fa fa-times"></i> 删除
  69. </button>
  70. </td>
  71. </tr>
  72. {/volist}
  73. </tbody>
  74. </table>
  75. </div>
  76. {include file="public/inner_page"}
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. {/block}
  82. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  83. {block name="script"}
  84. <script>
  85. $('.btn-danger').on('click',function(){
  86. window.t = $(this);
  87. var _this = $(this),url =_this.data('url');
  88. $eb.$swal('delete',function(){
  89. $eb.axios.get(url).then(function(res){
  90. console.log(res);
  91. if(res.status == 200 && res.data.code == 200) {
  92. $eb.$swal('success',res.data.msg);
  93. _this.parents('tr').remove();
  94. }else
  95. return Promise.reject(res.data.msg || '删除失败')
  96. }).catch(function(err){
  97. $eb.$swal('error',err);
  98. });
  99. });
  100. });
  101. function syncTemplate(){
  102. // var url = layList.U({c: 'routine.routine_template', a: 'syncSubscribe'});
  103. var url = "{:Url('routine.routine_template/syncSubscribe')}";
  104. // var url = "{__ADMIN_PATH}js/layuiList.js";
  105. console.log(url);
  106. $eb.axios.get(url).then(function (res) {
  107. if (res.status == 200 && res.data.code == 200) {
  108. $eb.$swal('success', res.data.msg);
  109. } else
  110. return Promise.reject(res.data.msg || '同步失败')
  111. }).catch(function (err) {
  112. $eb.$swal('error', err);
  113. });
  114. }
  115. // require(['vue'], function (Vue) {
  116. // new Vue({
  117. // el: "#app",
  118. // data:{},
  119. // methods: {
  120. // syncTemplate: function() {
  121. // console.log(layList.Url({c: 'routine.routine_template', a: 'syncSubscribe'}));
  122. // // layList.baseGet(layList.Url({c: 'routine.routine_template', a: 'syncSubscribe'}), function (rem) {
  123. // // if(res.status == 200) {
  124. // // $eb.$swal('success',res.data.msg);
  125. // // }else
  126. // // return Promise.reject(res.data.msg || '同步失败')
  127. // // });
  128. // }
  129. // },
  130. // mounted: function () {}
  131. // })
  132. // });
  133. </script>
  134. {/block}