manage_range.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>管理范围</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport"
  9. content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  10. <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  11. <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
  12. <link rel="stylesheet" type="text/css" href="../../layuiadmin/style/formSelects-v4.css"/>
  13. </head>
  14. <body>
  15. <div class="layui-fluid">
  16. <div class="layui-row layui-col-space15">
  17. <div class="layui-col-md6">
  18. <div class="layui-card">
  19. <div class="layui-card-body">
  20. <form class="layui-form" action="" lay-filter="component-form-element">
  21. <div id="id_store" class="demo-tree"></div>
  22. <button class="layui-btn" id="id_save" lay-submit lay-filter="component-form-element"
  23. style="display: none">保存
  24. </button>
  25. </form>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <script src="../../layuiadmin/layui/layui.js"></script>
  32. <script>
  33. layui.config({
  34. base: '../../../layuiadmin/' //静态资源所在路径
  35. }).extend({
  36. index: 'lib/index' //主入口模块
  37. , formSelects: 'formSelects-v4'
  38. }).use(['index', 'form', 'tree', 'formSelects'], function () {
  39. var $ = layui.$
  40. , admin = layui.admin
  41. , form = layui.form
  42. , tree = layui.tree
  43. , formSelects = layui.formSelects;
  44. var id = layui.view.getParameterByName('id');
  45. admin.req({
  46. url: '/account/store/tree/?id=' + id
  47. , done: function (res) {
  48. tree.render({
  49. elem: '#id_store'
  50. , data: res.data
  51. , showCheckbox: true
  52. });
  53. }
  54. });
  55. form.on('submit(component-form-element)', function (data) {
  56. var sotres = []
  57. for (var key in data.field) {
  58. if (key.indexOf('store') > -1) {
  59. sotres.push(data.field[key])
  60. }
  61. }
  62. if (sotres.length === 0) {
  63. layer.msg('请选择门店');
  64. return false;
  65. }
  66. admin.req({
  67. url: '/account/employee/' + id + '/branch/'
  68. , data: {sotres:JSON.stringify(sotres)}
  69. , type: 'post'
  70. , done: function (res) {
  71. parent.layer.closeAll('iframe');
  72. parent.layui.table.reload('datagrid', {});
  73. }
  74. });
  75. return false;
  76. });
  77. parent.layui.submitChild = function () {
  78. $("#id_save").click();
  79. };
  80. });
  81. </script>
  82. </body>
  83. </html>