admin-list.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @var yii\web\View $this
  4. */
  5. $this->title = '上线任务列表';
  6. use \app\models\Task;
  7. ?>
  8. <div class="box">
  9. <div class="box-header">
  10. <!-- <h3 class="box-title">Responsive Hover Table</h3>-->
  11. <form action="/logger/search" method="POST">
  12. <div class="box-tools">
  13. <div class="input-group" style="width: 150px;">
  14. <input type="text" name="kw" class="form-control input-sm pull-right" placeholder="Search" value="">
  15. <div class="input-group-btn">
  16. <input class="btn btn-sm btn-default" type="submit" value="搜索"><i class="fa fa-search"></i></input>
  17. </div>
  18. </div>
  19. </div>
  20. </form>
  21. </div><!-- /.box-header -->
  22. <div class="box-body table-responsive no-padding">
  23. <table class="table table-hover">
  24. <tbody><tr>
  25. <th>开发者</th>
  26. <th>任务名称</th>
  27. <th>上线commit号</th>
  28. <th>当前状态</th>
  29. <th>操作</th>
  30. </tr>
  31. <?php foreach ($list as $item) { ?>
  32. <tr>
  33. <td><?= $item['username'] ?></td>
  34. <td><?= $item['title'] ?></td>
  35. <td><?= $item['commit_id'] ?></td>
  36. <td><?= \Yii::t('status', 'task_status_' . $item['status']) ?></td>
  37. <td class="<?= \Yii::t('status', 'task_status_' . $item['status'] . '_color') ?>">
  38. <?php if (!in_array($item['status'],[Task::STATUS_DONE, Task::STATUS_FAILED])) { ?>
  39. <button class="btn btn-xs btn-success task-operation" data-id="<?= $item['id'] ?>" data-action="pass">通过</button>
  40. <button class="btn btn-xs btn-danger task-operation" data-id="<?= $item['id'] ?>" data-action="refuse">拒绝</button>
  41. <?php } else { ?>
  42. <?= \Yii::t('status', 'task_status_' . $item['status']) ?>
  43. <?php } ?>
  44. </td>
  45. </tr>
  46. <?php } ?>
  47. </tbody></table>
  48. </div><!-- /.box-body -->
  49. </div>
  50. <script type="text/javascript">
  51. $(function() {
  52. $('.task-operation').click(function() {
  53. $this = $(this);
  54. $.get("/walle/task-operation", {id: $(this).data('id'), operation: $(this).data('action')},
  55. function(data) {
  56. $this.parent().prev().text(data.data.status);
  57. }
  58. );
  59. })
  60. })
  61. </script>