areaList.js 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <script type="text/javascript">
  3. var $treeTable=null;
  4. $(document).ready(function() {
  5. $treeTable=$('#treeTable').treeTable({
  6. theme:'vsStyle',
  7. expandLevel : 2,
  8. column:0,
  9. checkbox: false,
  10. url:'${ctx}/sys/community/getChildren?parentId=',
  11. callback:function(item) {
  12. item.type = jp.getDictLabel(${fns:toJson(fns:getDictList('sys_area_type'))}, item.type);//字典转换
  13. var areaItemTpl = $("#areaItemTpl").html();
  14. var result = laytpl(areaItemTpl).render(item);
  15. return result;
  16. },
  17. beforeClick: function($treeTable, id) {
  18. //异步获取数据 这里模拟替换处理
  19. $treeTable.refreshPoint(id);
  20. },
  21. beforeExpand : function($treeTable, id) {
  22. },
  23. afterExpand : function($treeTable, id) {
  24. //layer.closeAll();
  25. },
  26. beforeClose : function($treeTable, id) {
  27. }
  28. });
  29. });
  30. function del(con,id){
  31. jp.confirm('确认要删除吗?', function(){
  32. jp.loading();
  33. $.get("${ctx}/sys/community/delete?id="+id, function(data){
  34. if(data.success){
  35. $treeTable.del(id);
  36. jp.success(data.msg);
  37. }else{
  38. jp.error(data.msg);
  39. }
  40. })
  41. });
  42. }
  43. function refresh(){//刷新
  44. var index = jp.loading("正在加载,请稍等...");
  45. $treeTable.refresh();
  46. jp.close(index);
  47. }
  48. </script>
  49. <script type="text/html" id="areaItemTpl">
  50. <td><a href="#" onclick="jp.openViewDialog('查看街道社区', '${ctx}/sys/community/form?id={{ d.id }}','800px', '500px')">{{ d.name }}</a></td>
  51. <td>{{ d.code === undefined? "" : d.code}}</td>
  52. <td>{{ d.type === undefined? "" : d.type}}</td>
  53. <td>{{ d.remarks === undefined? "" : d.remarks}}</td>
  54. <td>
  55. <div class="btn-group">
  56. <button type="button" class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown">
  57. <i class="fa fa-cog"></i>
  58. <span class="fa fa-chevron-down"></span>
  59. </button>
  60. <ul class="dropdown-menu" role="menu">
  61. <shiro:hasPermission name="sys:community:view">
  62. <li><a href="#" onclick="jp.openViewDialog('查看街道社区', '${ctx}/sys/community/form?id={{ d.id }}','800px', '500px')" ><i class="fa fa-search-plus"></i> 查看</a></li>
  63. </shiro:hasPermission>
  64. <shiro:hasPermission name="sys:community:edit">
  65. <li><a href="#" onclick="jp.openSaveDialog('修改街道社区', '${ctx}/sys/community/form?id={{ d.id }}','800px', '500px')" ><i class="fa fa-edit"></i> 修改</a></li>
  66. </shiro:hasPermission>
  67. <shiro:hasPermission name="sys:community:del">
  68. <li><a onclick="return del(this, '{{ d.id }}')"><i class="fa fa-trash"></i> 删除</a></li>
  69. </shiro:hasPermission>
  70. <shiro:hasPermission name="sys:community:add">
  71. <li><a href="#" onclick="jp.openSaveDialog('添加下级', '${ctx}/sys/community/form?parent.id={{ d.id }}','800px', '500px')"><i class="fa fa-plus"></i> 添加下级</a></li>
  72. </shiro:hasPermission>
  73. </ul>
  74. </div>
  75. </td>
  76. </script>