rock_menu.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php if(!defined('HOST'))die('not access');?>
  2. <script >
  3. $(document).ready(function(){
  4. var a = $('#menu_{rand}').bootstable({
  5. tablename:'menu',url:js.getajaxurl('data','{mode}','{dir}'),method:'get',loadtree:false,
  6. tree:true,celleditor:!ISDEMO,bodyStyle:'height:'+(viewheight-70)+'px;overflow:auto',
  7. columns:[{
  8. text:'菜单名称',dataIndex:'name',align:'left',editor:true,renderstyle:function(v,d){
  9. return 'min-width:220px';
  10. }
  11. },{
  12. text:'编号',dataIndex:'num' ,editor:true,renderstyle:function(v,d){
  13. return 'width:70px';
  14. }
  15. },{
  16. text:'URL',dataIndex:'url',editor:true,repEmpty:true,renderstyle:function(v,d){
  17. return 'word-wrap:break-word;word-break:break-all;white-space:normal;width:180px';
  18. }
  19. },{
  20. text:'PID',dataIndex:'pid',editor:true
  21. },{
  22. text:'图标',dataIndex:'icons',editor:true,renderstyle:function(v,d){
  23. return 'width:70px';
  24. }
  25. },{
  26. text:'启用',dataIndex:'status',type:'checkbox',editor:true
  27. },{
  28. text:'验证',dataIndex:'ispir',type:'checkbox',editor:true
  29. },{
  30. text:'显首',dataIndex:'ishs',type:'checkbox',editor:true
  31. },{
  32. text:'排序',dataIndex:'sort' ,editor:true
  33. },{
  34. text:'颜色',dataIndex:'color',editor:true
  35. },{
  36. text:'级别',dataIndex:'type',editor:true,renderer:function(v){
  37. var s='&nbsp;';
  38. if(v==1)s='系统';
  39. return s;
  40. },type:'select',store:[['0','普通'],['1','系统']]
  41. },{
  42. text:'ID',dataIndex:'id'
  43. }],
  44. itemclick:function(){
  45. btn(false);
  46. },
  47. load:function(d){
  48. if(d.pdata && d.pdata.length>0){
  49. var o1 = get('soupid_{rand}');
  50. js.setselectdata(o1,d.pdata,'id');
  51. $(o1).change(c.changed);
  52. }
  53. }
  54. });
  55. function btn(bo){
  56. get('del_{rand}').disabled = bo;
  57. get('edit_{rand}').disabled = bo;
  58. get('down_{rand}').disabled = bo;
  59. }
  60. var c = {
  61. changed:function(){
  62. a.setparams({pid:this.value},true);
  63. },
  64. del:function(){
  65. a.del({url:js.getajaxurl('delmenu','{mode}','{dir}')});
  66. },
  67. reload:function(){
  68. a.reload();
  69. },
  70. search:function(){
  71. var s=get('key_{rand}').value;
  72. a.setparams({key:s},true);
  73. },
  74. clickwin:function(o1,lx){
  75. if(ISDEMO){js.msg('success','演示站点禁止操作');return;}
  76. var h = $.bootsform({
  77. title:'菜单',height:500,width:400,
  78. tablename:'menu',isedit:lx,
  79. params:{int_filestype:'ispir,status,sort,pid,ishs'},
  80. submitfields:'num,name,url,icons,ispir,status,sort,pid,ishs,color',
  81. items:[{
  82. labelText:'编号',name:'num',repEmpty:true
  83. },{
  84. labelText:'菜单名称',name:'name',required:true
  85. },{
  86. labelText:'URL地址',name:'url',repEmpty:true
  87. },{
  88. labelText:'图标',name:'icons',repEmpty:true
  89. },{
  90. labelText:'上级ID',name:'pid',required:true,value:'0',type:'number'
  91. },{
  92. name:'status',labelBox:'启用',type:'checkbox',checked:true
  93. },{
  94. name:'ispir',labelBox:'验证(未√就是任何人可使用菜单)',type:'checkbox',checked:true
  95. },{
  96. name:'ishs',labelBox:'显示在首页',type:'checkbox'
  97. },{
  98. labelText:'颜色',name:'color',repEmpty:true
  99. },{
  100. labelText:'序号',name:'sort',type:'number',value:'0'
  101. }],
  102. success:function(){
  103. a.reload();
  104. }
  105. });
  106. if(lx==1)h.setValues(a.changedata);
  107. h.getField('name').focus();
  108. if(lx==2)h.setValue('pid', a.changedata.id);
  109. }
  110. };
  111. js.initbtn(c);
  112. });
  113. </script>
  114. <div>
  115. <table width="100%"><tr>
  116. <td nowrap>
  117. <button class="btn btn-primary" click="clickwin,0" type="button"><i class="icon-plus"></i> 新增顶级</button> &nbsp;
  118. <button class="btn btn-success" click="clickwin,2" id="down_{rand}" disabled type="button"><i class="icon-plus"></i> 新增下级</button>&nbsp;
  119. <button class="btn btn-default" click="reload" type="button">刷新</button>
  120. </td>
  121. <td style="padding-left:10px">
  122. <select class="form-control" style="width:150px" id="soupid_{rand}" >
  123. <option value="0">-所有的菜单-</option>
  124. </select>
  125. <!--
  126. <div class="input-group" style="width:100px">
  127. <input class="form-control" id="key_{rand}" placeholder="pid">
  128. <span class="input-group-btn">
  129. <button class="btn btn-default" click="search" type="button"><i class="icon-search"></i></button>
  130. </span>
  131. </div>-->
  132. </td>
  133. <td width="80%"></td>
  134. <td align="right" nowrap>
  135. <button class="btn btn-danger" id="del_{rand}" click="del" disabled type="button"><i class="icon-trash"></i> 删除</button> &nbsp;
  136. <button class="btn btn-info" id="edit_{rand}" click="clickwin,1" disabled type="button"><i class="icon-edit"></i> 编辑 </button>
  137. </td>
  138. </tr>
  139. </table>
  140. </div>
  141. <div class="blank10"></div>
  142. <div id="menu_{rand}"></div>
粤ICP备19079148号