design.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2017/3/17 0017
  6. * Time: 上午 10:52
  7. */
  8. use yii\helpers\Url;
  9. use yii\widgets\LinkPager;
  10. ?>
  11. <div class="panel panel-default">
  12. <div class="panel-heading">
  13. <h3 class="panel-title"><?=$name ?></h3>
  14. </div>
  15. <div class="panel-body">
  16. <form id="search_form" action="<?=Url::toRoute(['offerdesign/design']);?>" method="get">
  17. <div class="row">
  18. <div class="form-group">
  19. <div class="col-sm-6">
  20. <input placeholder="开始日期" value="<?= $search['start']?>" name="start" class="form-control layer-date" id="start">
  21. <input placeholder="结束日期" value="<?= $search['end']?>" name="end" class="form-control layer-date" id="end">
  22. </div>
  23. <div class="col-sm-3">
  24. <div class="input-group">
  25. <button id="search_button" type="submit" class="btn btn-sm btn-primary search-button"> 搜索</button>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </form>
  31. </div>
  32. <table class="table">
  33. <tr>
  34. <th>姓名</th>
  35. <th>电话</th>
  36. <th>城市</th>
  37. <th>创建时间</th>
  38. <th>操作</th>
  39. </tr>
  40. <?php foreach ($models as $vo):?>
  41. <tr >
  42. <td><?=$vo->nickname;?></td>
  43. <td><?=$vo->tel;?></td>
  44. <td><?= isset($vo->city)?$vo->city->area:"" ?></td>
  45. <td><?=date('Y-m-d H:i',$vo->c_time);?></td>
  46. <td>
  47. <a data-id="<?=$vo->id?>" class="btn btn-danger btn-sm " href="javascript:void(0);" ><i class="fa fa-trash"></i> 删除</a>
  48. </td>
  49. </tr>
  50. <?php endforeach;?>
  51. </table>
  52. </div>
  53. <?=LinkPager::widget(['pagination' => $pages]); ?>
  54. <script type="text/javascript">
  55. var start = {
  56. elem: "#start",
  57. max: "<?=date('Y-m-d')?>",
  58. istoday: false,
  59. };
  60. var end = {
  61. elem: "#end",
  62. max: "<?=date('Y-m-d')?>",
  63. istoday: false,
  64. };
  65. laydate(start);
  66. laydate(end);
  67. $('.btn-danger').on('click',function(){
  68. var id = $(this).attr('data-id');
  69. var text = $(this);
  70. swal({
  71. title: "确定删除该记录?",
  72. type: "warning",
  73. showCancelButton: true,
  74. confirmButtonColor: "#DD6B55",
  75. confirmButtonText: "确定",
  76. cancelButtonText: "取消",
  77. closeOnConfirm: true,
  78. closeOnCancel: true },
  79. function(isConfirm){
  80. if (isConfirm) {
  81. $.ajax({
  82. url:'<?=Url::toRoute(['offerdesign/del-design']);?>',
  83. type:'POST',
  84. dataType:'json',
  85. data:{id:id,'<?=Yii::$app->request->csrfParam;?>':'<?=Yii::$app->request->csrfToken;?>'},
  86. success:function(data){
  87. if(data.sign==1){
  88. text.parents('tr').remove();
  89. toastr.success("", data.msg);
  90. }else{
  91. swal("", data.msg, "error");
  92. }
  93. }
  94. })
  95. }
  96. });
  97. });
  98. </script>