create.blade.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <div style="margin-top: 10px;" id="permissions-app">
  2. <div style="text-align: center;margin-top: 5px;margin-bottom: 10px;font-size: 20px;">
  3. 管理 - 权限
  4. </div>
  5. <el-form action="{{route('admin.permission.save')}}" method="post" id="form-create">
  6. {{--<ui-checkbox label="添加权限:" :params="params" tips="勾选增加权限"></ui-checkbox>--}}
  7. <input type="hidden" name="role_id" value="{{$role_id}}">
  8. <input type="hidden" name="ids" id="ids" value="{{implode(',',$select_ids)}}">
  9. <ui-tree @set-keys="getSelectKeys" :list="list" :select_ids="select_ids"></ui-tree>
  10. <ui-submit></ui-submit>
  11. </el-form>
  12. </div>
  13. <script type="application/javascript">
  14. $(function () {
  15. // 注意:Vue组件一定放在jQuery.validator前面验证
  16. new Vue({
  17. el: '#permissions-app',
  18. data :function () {
  19. return {
  20. 'list':<?php echo $list?>,
  21. 'select_ids':<?php echo json_encode($select_ids)?>,
  22. };
  23. },
  24. methods:{
  25. getSelectKeys:function (select_keys) {
  26. console.log('开始接收参数');
  27. console.log(select_keys);
  28. $('#ids').val(select_keys.join(','));
  29. }
  30. }
  31. });
  32. jQuery.validator.setDefaults({
  33. debug: false, // 调试模式true不会提交,false允许提交
  34. success: "success", // 匹配成功的class样式名称
  35. errorElement: 'div' // 兼容el标签时使用(兼容el Vue组件label.error标签问题)
  36. });
  37. // 前台数据验证 验证需要设置window.form全局变量
  38. window.form = $('#form-create').validate({
  39. rules: {
  40. }
  41. });
  42. });
  43. </script>
  44. @include('layouts.admin.form_script')