1
0

group_assign.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. form.on('checkbox(checkboxs)', function(data){
  131. console.log(data);
  132. return false;
  133. var load = layer.load(1, {shade: [0.5, '#fff']});
  134. $.ajax({
  135. url: '{:url("material/group_wechat_assign")}?root_id='+data.value+'&id='+id,
  136. type: 'post',
  137. dataType: 'json',
  138. processData: false,
  139. contentType: false,
  140. success: function (res) {
  141. if (res.code == 0) {
  142. layer.msg(res.msg, {
  143. icon: 1,
  144. time: 1000
  145. },function(){
  146. parent.location.reload();
  147. });
  148. } else {
  149. layer.msg(res.msg,{
  150. time: 1000
  151. },function(){
  152. location.reload();
  153. });
  154. }
  155. layer.close(load);
  156. }
  157. });
  158. });
  159. table.render({
  160. elem: '#datalist',
  161. url: "{:url('material/groupAssign')}?id={:$id}",
  162. page: true,
  163. // height: 'full-160',
  164. height: '460',
  165. cols: [
  166. [
  167. {
  168. type: 'checkbox',
  169. fixed: 'left',
  170. width: 50
  171. },
  172. {
  173. type: 'numbers',
  174. field: 'id',
  175. title: '序号',
  176. width: '6%',
  177. fixed: 'left'
  178. },
  179. {
  180. title: '店面名称',
  181. field: 'company_name',
  182. fixed: 'left'
  183. },
  184. ]
  185. ]
  186. });
  187. $('#next_step').click(function(){
  188. var index = parent.layer.getFrameIndex(window.name);
  189. var checkStatus = layui.table.checkStatus('datalist').data;
  190. var ids = [];
  191. for(var i=0;i<checkStatus.length;i++){
  192. ids.push(checkStatus[i].root_id)
  193. }
  194. if (ids.length==0) {
  195. return false;
  196. }
  197. ids = ids.join(',');//必须要写,不然后台获取不到数据
  198. var id = {$id};
  199. $.ajax({
  200. url: '{:url("material/group_wechat_assign")}',
  201. type: 'post',
  202. data: {'ids':ids,id:id},
  203. dataType: 'json',
  204. success: function(res) {
  205. if(res.code === 0) {
  206. layer.msg(res.msg, {
  207. anim: 0
  208. ,time: 2000
  209. }, function() {
  210. parent.layui.table.reload('wxshow-add-table'); //重载表格
  211. parent.layer.close(index); //再执行关闭
  212. });
  213. } else {
  214. layer.msg(res.msg, {
  215. anim: 6
  216. ,time: 2000
  217. });
  218. }
  219. }
  220. });
  221. })
  222. });
  223. </script>
  224. {/block}