group_assign.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. {extend name="public/layout"/} {block name="title"}添加{/block} {block name="body"}
  2. <style type="text/css">
  3. html,
  4. body {
  5. display: block;
  6. min-width: 100%;
  7. background-color: #fff;
  8. }
  9. .layui-fluid {
  10. display: block;
  11. border-radius: 5px;
  12. padding: 0;
  13. background-color: #ffffff;
  14. }
  15. .layui-tab {
  16. padding: 15px;
  17. height: 100%;
  18. }
  19. .layui-input-inline.input-longer-inline {
  20. width: 290px;
  21. }
  22. .layui-form-item .layui-input-inline {
  23. width: auto;
  24. }
  25. .layui-titlebox{
  26. position: relative;
  27. left: 0;
  28. height: 40px;
  29. white-space: nowrap;
  30. font-size: 0;
  31. border-bottom-width: 1px;
  32. border-bottom-style: solid;
  33. transition: all .2s;
  34. -webkit-transition: all .2s;
  35. border-color: #e6e6e6;
  36. color: #666;
  37. background-color: #f2f2f2;
  38. }
  39. .layui-titlebox li {
  40. display: inline-block;
  41. vertical-align: middle;
  42. font-size: 14px;
  43. transition: all .2s;
  44. -webkit-transition: all .2s;
  45. position: relative;
  46. line-height: 40px;
  47. width: 50%;
  48. text-align: center;
  49. cursor: pointer;
  50. box-sizing: border-box;
  51. }
  52. .layui-titlebox .layui-this {
  53. color: #000;
  54. border-bottom-color: transparent;
  55. background-color: #249EFB;
  56. color: #FFFFFF;
  57. }
  58. .layui-titlebox .layui-this:after {
  59. position: absolute;
  60. left: 0;
  61. top: 0;
  62. content: '';
  63. width: 100%;
  64. height: 41px;
  65. border-width: 1px;
  66. border-style: solid;
  67. border-color: #e6e6e6;
  68. border-bottom-color: #fff;
  69. border-radius: 2px 2px 0 0;
  70. box-sizing: border-box;
  71. pointer-events: none;
  72. }
  73. .saveBtn,.cancel,.cancel:hover,.saveBtn:hover {
  74. background-color: #fff;
  75. color: #249EFB;
  76. border: 1px solid #249EFB;
  77. }
  78. .layui-icon-add-circle::before {
  79. font-size: 30px;
  80. }
  81. .layui-border-btn,.layui-border-btn:hover {
  82. border: 1px solid #249EFB;
  83. background-color: #fff;
  84. color: #249EFB;
  85. }
  86. .layui-tab-content {
  87. padding: 0;
  88. }
  89. .plr20{
  90. padding: 0px 20px;
  91. }
  92. .layui-form-radio>i {
  93. font-size: 18px;
  94. }
  95. .layui-card-body{padding:15px;}
  96. .layui-table, .layui-table-view{margin:0;}
  97. .plr20{
  98. padding: 0px 20px;
  99. }
  100. .woverflow{overflow:hidden;}
  101. </style>
  102. <div class="layui-fluid">
  103. <div class="layui-table">
  104. <form class="layui-form">
  105. <div class="layui-tab-content">
  106. <div class="layui-tab-item layui-show">
  107. <div class="layui-card-body">
  108. <table id="datalist" lay-filter="datalist"></table>
  109. </div>
  110. <div class="woverflow">
  111. <button type="button" class="layui-btn layui-btn-normal" id="next_step" style="width:165px;height:38px;float:right;margin-right: 15px;">确定指派</button>
  112. </div>
  113. </div>
  114. </div>
  115. </form>
  116. </div>
  117. </div>
  118. {/block} {block name="js"}
  119. <script>
  120. layui.config({
  121. base: '__LAYUI__/',
  122. urlbase: '/sys'
  123. }).extend({
  124. index: 'lib/index'
  125. }).use(['index', 'table', 'form'], function() {
  126. var $ = layui.$,
  127. table = layui.table,
  128. form = layui.form;
  129. var id = '{$id}';
  130. var from = '{$from}';
  131. var root_id = '{$root_id}';
  132. if(from=='share'){
  133. $('#next_step').html('确定共享');
  134. }
  135. form.on('checkbox(checkboxs)', function(data){
  136. console.log(data);
  137. return false;
  138. var load = layer.load(1, {shade: [0.5, '#fff']});
  139. $.ajax({
  140. url: '{:url("train/group_assign")}?root_id='+data.value+'&id='+id+'&from='+from,
  141. type: 'post',
  142. dataType: 'json',
  143. processData: false,
  144. contentType: false,
  145. success: function (res) {
  146. if (res.code == 0) {
  147. layer.msg(res.msg, {
  148. icon: 1,
  149. time: 1000
  150. },function(){
  151. parent.location.reload();
  152. });
  153. } else {
  154. layer.msg(res.msg,{
  155. time: 1000
  156. },function(){
  157. location.reload();
  158. });
  159. }
  160. layer.close(load);
  161. }
  162. });
  163. });
  164. table.render({
  165. elem: '#datalist',
  166. url: "{:url('train/group_assign')}?from={:$from}&id={:$id}",
  167. page: true,
  168. // height: 'full-160',
  169. height: '460',
  170. cols: [
  171. [
  172. {
  173. type: 'checkbox',
  174. fixed: 'left',
  175. width: 50
  176. },
  177. {
  178. type: 'numbers',
  179. field: 'id',
  180. title: '序号',
  181. width: '6%',
  182. fixed: 'left'
  183. },
  184. {
  185. title: '店面名称',
  186. field: 'company_name',
  187. fixed: 'left'
  188. },
  189. ]
  190. ]
  191. });
  192. $('#next_step').click(function(){
  193. var index = parent.layer.getFrameIndex(window.name);
  194. var checkStatus = layui.table.checkStatus('datalist').data;
  195. console.log(checkStatus);
  196. var ids = [];
  197. for(var i=0;i<checkStatus.length;i++){
  198. ids.push(checkStatus[i].root_id)
  199. }
  200. if (ids.length==0) {
  201. return false;
  202. }
  203. ids = ids.join(',');//必须要写,不然后台获取不到数据
  204. var id = {$id};
  205. var from = "{$from}";
  206. $.ajax({
  207. url: '{:url("train/all_train_assign")}',
  208. type: 'post',
  209. data: {'ids':ids,id:id,from:from},
  210. dataType: 'json',
  211. success: function(res) {
  212. if(res.code === 0) {
  213. layer.msg(res.msg, {
  214. anim: 0
  215. ,time: 2000
  216. }, function() {
  217. parent.layui.table.reload('datalist'); //重载表格
  218. parent.layer.close(index); //再执行关闭
  219. });
  220. } else {
  221. layer.msg(res.msg, {
  222. anim: 6
  223. ,time: 2000
  224. });
  225. }
  226. }
  227. });
  228. })
  229. });
  230. </script>
  231. {/block}