index.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. use yii\widgets\ActiveForm;
  3. use common\helpers\Html;
  4. $this->title = '数据迁移生成';
  5. $this->params['breadcrumbs'][] = ['label' => $this->title];
  6. ?>
  7. <style>
  8. label {
  9. width: 33%;
  10. }
  11. </style>
  12. <div class="row">
  13. <div class="col-lg-12">
  14. <div class="box">
  15. <div class="box-header with-border">
  16. <h3 class="box-title"><?= Html::encode($this->title) ?></h3>
  17. </div>
  18. <?php $form = ActiveForm::begin([]); ?>
  19. <div class="box-body">
  20. <div class="col-sm-12">
  21. <?= $form->field($model, 'addon')->dropDownList($addonList)->hint('默认在 根目录/console/migrations/, 选择插件则生成的数据迁移文件在 插件/console/migrations/'); ?>
  22. <div class="form-group">
  23. <label class="control-label" for="migrateform-addon">批量选中</label>
  24. <div class="input-group m-b">
  25. <input type="text" class="form-control prefix" name="prefix" placeholder="表名前缀" value="">
  26. <span class="input-group-btn select"><span class="btn btn-white"> 选中</span></span>
  27. <span class="input-group-btn cancel"><span class="btn btn-white"> 全部取消选中</span></span>
  28. </div>
  29. <div class="help-block"></div>
  30. </div>
  31. <?= $form->field($model, 'tables')->checkboxList($tableList); ?>
  32. </div>
  33. </div>
  34. <div class="box-footer text-center">
  35. <button class="btn btn-primary" type="submit">立即创建</button>
  36. </div>
  37. <?php ActiveForm::end(); ?>
  38. </div>
  39. </div>
  40. </div>
  41. <script>
  42. $('.select').click(function () {
  43. var prefix = $('.prefix').val();
  44. if (prefix.length > 0) {
  45. $('#migrateform-tables').find('input').each(function (i, data) {
  46. if($(data).val().substr(0, prefix.length) == prefix){
  47. $(data).prop("checked", true);
  48. }
  49. })
  50. }
  51. })
  52. $('.cancel').click(function () {
  53. $('#migrateform-tables').find('input').each(function (i, data) {
  54. $(data).prop("checked", false);
  55. })
  56. })
  57. </script>
粤ICP备19079148号