rock_menu.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. if(get('editss_{rand}'))get('editss_{rand}').disabled = (this.value=='0')
  64. },
  65. del:function(){
  66. a.del({url:js.getajaxurl('delmenu','{mode}','{dir}')});
  67. },
  68. reload:function(){
  69. a.reload();
  70. },
  71. search:function(){
  72. var s=get('key_{rand}').value;
  73. a.setparams({key:s},true);
  74. },
  75. clickwin:function(o1,lx){
  76. if(ISDEMO){js.msg('success','演示站点禁止操作');return;}
  77. var h = $.bootsform({
  78. title:lang('菜单'),height:500,width:400,
  79. tablename:'menu',isedit:lx,
  80. params:{int_filestype:'ispir,status,sort,pid,ishs'},
  81. submitfields:'num,name,url,icons,ispir,status,sort,pid,ishs,color',
  82. items:[{
  83. labelText:lang('编号'),name:'num',repEmpty:true
  84. },{
  85. labelText:lang('菜单')+lang('名称'),name:'name',required:true
  86. },{
  87. labelText:'URL'+lang('地址')+'',name:'url',repEmpty:true
  88. },{
  89. labelText:lang('图标'),name:'icons',repEmpty:true
  90. },{
  91. labelText:''+lang('上级')+'ID',name:'pid',required:true,value:'0',type:'number'
  92. },{
  93. name:'status',labelBox:lang('启用'),type:'checkbox',checked:true
  94. },{
  95. name:'ispir',labelBox:'验证(未√就是任何人可使用菜单)',type:'checkbox',checked:true
  96. },{
  97. name:'ishs',labelBox:lang('显示在首页'),type:'checkbox'
  98. },{
  99. labelText:lang('颜色'),name:'color',repEmpty:true
  100. },{
  101. labelText:lang('排序'),name:'sort',type:'number',value:'0'
  102. }],
  103. success:function(){
  104. a.reload();
  105. }
  106. });
  107. if(lx==1)h.setValues(a.changedata);
  108. h.getField('name').focus();
  109. if(lx==2)h.setValue('pid', a.changedata.id);
  110. },
  111. createsql:function(){
  112. js.loading('创建中...');
  113. js.ajax(js.getajaxurl('createmenu','{mode}','{dir}'),{menuid:get('soupid_{rand}').value},function(){
  114. js.msgok('创建成功');
  115. });
  116. }
  117. };
  118. js.initbtn(c);
  119. });
  120. </script>
  121. <div>
  122. <table width="100%"><tr>
  123. <td nowrap>
  124. <button class="btn btn-primary" click="clickwin,0" type="button"><i class="icon-plus"></i> 新增顶级</button> &nbsp;
  125. <button class="btn btn-success" click="clickwin,2" id="down_{rand}" disabled type="button"><i class="icon-plus"></i> 新增下级</button>&nbsp;
  126. <button class="btn btn-default" click="reload" type="button"><?=lang('刷新')?></button>
  127. </td>
  128. <td style="padding-left:10px" nowrap>
  129. <select class="form-control" style="width:150px" id="soupid_{rand}" >
  130. <option value="0">-所有的菜单-</option>
  131. </select>
  132. <!--
  133. <div class="input-group" style="width:100px">
  134. <input class="form-control" id="key_{rand}" placeholder="pid">
  135. <span class="input-group-btn">
  136. <button class="btn btn-default" click="search" type="button"><i class="icon-search"></i></button>
  137. </span>
  138. </div>-->
  139. <?php
  140. if(getconfig('systype')=='dev')echo ' &nbsp; <button class="btn btn-default" id="editss_{rand}" click="createsql" disabled type="button">生成菜单文件</button>';
  141. ?>
  142. </td>
  143. <td width="80%"></td>
  144. <td align="right" nowrap>
  145. <button class="btn btn-danger" id="del_{rand}" click="del" disabled type="button"><i class="icon-trash"></i> <?=lang('删除')?></button> &nbsp;
  146. <button class="btn btn-info" id="edit_{rand}" click="clickwin,1" disabled type="button"><i class="icon-edit"></i> <?=lang('编辑')?> </button>
  147. </td>
  148. </tr>
  149. </table>
  150. </div>
  151. <div class="blank10"></div>
  152. <div id="menu_{rand}"></div>
粤ICP备19079148号