瀏覽代碼

添加kkpage

温红权 9 年之前
父節點
當前提交
2100cf4be6

文件差異過大導致無法顯示
+ 7 - 0
VisualInspection/js/lib/kkpager.min.js


+ 114 - 0
VisualInspection/js/lib/kkpager_green.css

@@ -0,0 +1,114 @@
+#kkpager{
+	clear:both;
+	color:#999;
+	padding:5px 0px 5px 0px;
+	font-size:13px;
+}
+#kkpager a{
+	float: left;
+	border: 1px solid #ccc;
+	display: inline;
+	padding: 3px 10px 3px 10px;
+	margin-right: 5px;
+	border-radius: 3px;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	cursor: pointer;
+	background: #fff;
+	text-decoration:none;
+	color:#999;
+}
+
+#kkpager span.disabled{
+	float: left;
+	display: inline;
+	padding: 3px 10px 3px 10px;
+	margin-right: 5px;
+	border-radius: 3px;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border:1px solid #DFDFDF;
+	background-color:#FFF;
+	color:#DFDFDF;
+}
+#kkpager span.curr{
+	float: left;
+	border: 1px solid #3CC19F;
+	display: inline;
+	padding: 3px 10px 3px 10px;
+	margin-right: 5px;
+	border-radius: 3px;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	background: #F0FDFF;
+	color: #3CC19F;
+}
+#kkpager a:hover{
+	border:1px solid #3CC19F; 
+	background-color:#3CC19F; 
+	color:#fff;
+}
+#kkpager span.normalsize{
+}
+#kkpager_gopage_wrap{
+	position:relative;
+	left:0px;
+	top:0px;
+}
+#kkpager_btn_go {
+	width:44px;
+	height:18px;
+	border:0px;
+	overflow:hidden;
+	line-height:140%;
+	padding:0px;
+	margin:0px;
+	text-align:center;
+	cursor:pointer;
+	background-color:#3CC19F;
+	color:#FFF;
+	position:absolute;
+	left:0px;
+	top:-2px;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	display:none;
+}
+#kkpager_btn_go_input{
+	width:36px;
+	/* height:14px; */
+	color:#999;
+	text-align:center;
+	margin-left:1px;
+	margin-right:1px;
+	border:1px solid #DFDFDF;
+	position:relative;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	left:0px;
+	top:0px;
+	outline:none;
+}
+
+#kkpager_btn_go_input.focus{
+	border-color:#3CC19F;
+}
+
+#kkpager .pageBtnWrap{
+	float:left;
+}
+#kkpager .infoTextAndGoPageBtnWrap{
+	float:right;
+}
+#kkpager .spanDot{
+	float:left;
+	margin-right:5px;
+}
+
+#kkpager .currPageNum{
+	color:#3CC19F;
+}
+
+#kkpager .infoTextAndGoPageBtnWrap{
+	padding-top:5px;
+}

+ 141 - 0
VisualInspection/js/lib/news.js

@@ -0,0 +1,141 @@
+
+		/* var informationsMap = Object.create(MAP); */
+
+		function displayinformation(informations) {
+			var html = "";
+			for ( var i in informations) {
+				if (i == 0 && informations[i].weight == 0) {
+					html += "<li class='first_news' >"
+							+ "<table style='width:100%;height:100%;padding-bottom:40px;'><tr><td style='width:30%;background: url("
+							+ imageurl
+							+ informations[i].informationTime
+							+ "-1.jpg) no-repeat;background-size: contain;'></td><td style='padding-left:40px;'>"
+							+ "<p style='font-family: arial,\"Microsoft Yahei\",\"Hiragino Sans GB\",sans-serif;font-size: 22px;color: #000;'>"
+							+ informations[i].title
+							+ "</p>"
+							+ "<p style='font-family: arial,\"Microsoft Yahei\",\"Hiragino Sans GB\",sans-serif;font-size: 14px;color: #999;'>"
+							+ informations[i].informationTime
+							+ "</p>"
+							+ "<p style='font-family: arial,\"Microsoft Yahei\",\"Hiragino Sans GB\",sans-serif;font-size: 12px;color: #8c8c8c;line-height:24px;margin-bottom: 0;'>"
+							+ informations[i].subContent
+							+ "</p>"
+							+ "<p style='text-align: right;margin-top: 0;'><a href='javascript:void(0);' name="
+							+ informations[i].id
+							+ " id='news_more'>【详情】</a></p>"
+							+ "</td></tr></table>" + "</li>";
+					/* informationsMap.Set(informations[i].id,
+							informations[i].informationContent); */
+				} else {
+					html += "<li class='common_news' id="+informations[i].id+"><table style='width:100%;height:100%'><tr><td class='td_left'><span class='round'>•</span></td><td class='td_middle'>"
+							+ informations[i].title
+							+ "</td><td class='td_right'>"
+							+ informations[i].informationTime
+							+ "</td></tr></table></li>";
+					/* informationsMap.Set(informations[i].id,
+							informations[i].informationContent); */
+				}
+			}
+
+			$("#all_news").html(html);
+
+			$("#news_more").on("click", function() {
+				/* var html = informationsMap.Get(this.name);
+				html = html.replace(new RegExp(/(imageurl)/g), imageurl);
+				$("#company_dynamic").html(html); */
+				window.open(newsDetailUrl + this.name + ".html", '_blank');
+				// 防止事件冒泡
+				event.stopPropagation();
+			});
+
+			$(".common_news").on("click", function() {
+				/* var html = informationsMap.Get(this.id); */
+				/* html = html.replace(new RegExp(/(imageurl)/g), imageurl); */
+				window.open(newsDetailUrl + this.id + ".html", '_blank');
+				/* $("#company_dynamic").html(html); */
+			});
+
+		}
+
+		function getinformation(pagesize, nextpage) {
+			$.ajax({
+				type : "GET",
+				url : url + "informations/" + pagesize + "/" + nextpage
+						+ ".json",
+				dataType : "json",
+				contentType : "application/json",
+				success : function(data) {
+					if (data != null) {
+						totalPage = data.pageCount;
+						totalRecords = data.allrecodesCount;
+						setpage(data.currentPage);
+
+						//设置内容
+						displayinformation(data.informations);
+
+					}
+				}
+			});
+		}
+
+		var pagesize = 15;
+
+		if (pageNo == null || pageNo == "") {
+			getinformation(pagesize, 1);
+		} else {
+			getinformation(pagesize, pageNo);
+		}
+
+		var totalPage = 20;
+		var totalRecords = 390;
+		function setpage(currentpage) {
+			if (!pageNo) {
+				pageNo = currentpage;
+			}
+
+			//生成分页
+			//有些参数是可选的,比如lang,若不传有默认值
+			kkpager.generPageHtml({
+				pno : pageNo,
+				//总页码
+				total : totalPage,
+				//总数据条数
+				totalRecords : totalRecords,
+				mode : 'link',//默认值是link,可选link或者click
+
+				getLink : function(n) {
+
+					return "/about/news/" + n;
+				}
+			/* click : function(n) {
+				// do something
+				getinformation(pagesize, n);
+
+				//手动选中按钮
+				this.selectPage(n);
+				return false;
+			} */
+			/*
+			 ,lang				: {
+			 firstPageText			: '首页',
+			 firstPageTipText		: '首页',
+			 lastPageText			: '尾页',
+			 lastPageTipText			: '尾页',
+			 prePageText				: '上一页',
+			 prePageTipText			: '上一页',
+			 nextPageText			: '下一页',
+			 nextPageTipText			: '下一页',
+			 totalPageBeforeText		: '共',
+			 totalPageAfterText		: '页',
+			 currPageBeforeText		: '当前第',
+			 currPageAfterText		: '页',
+			 totalInfoSplitStr		: '/',
+			 totalRecordsBeforeText	: '共',
+			 totalRecordsAfterText	: '条数据',
+			 gopageBeforeText		: ' 转到',
+			 gopageButtonOkText		: '确定',
+			 gopageAfterText			: '页',
+			 buttonTipBeforeText		: '第',
+			 buttonTipAfterText		: '页'
+			 }*/
+			});
+		}

+ 8 - 0
VisualInspection/js/user/userManager.js

@@ -3,6 +3,14 @@ $(document).ready(function() {
     $("#main_content_title").html("用户管理")
 
     $('#dashboard').dashboard({ draggable: true });
+
+
+    DeptGetAll(function(data) {
+        console.log(data)
+    }, function(error) {
+
+    });
+
     var zTreeObj;
     // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
     var setting = {};

+ 5 - 1
VisualInspection/js/util/const.js

@@ -8,4 +8,8 @@ var UI_USER_LOGIN = "view/user/login"
 
 
 // 菜单
-var MENU_GET_ALL = "menu/get/all"
+var MENU_GET_ALL = "menu/get/all"
+
+
+// 部门
+var DEPT_GET_ALL = "dept/get/all"

+ 13 - 6
VisualInspection/js/util/service.js

@@ -17,14 +17,21 @@ function UserLogin(body, success, fail) {
 
 
 function MenuGetAll(success, fail) {
-    var user = $.zui.store.get("user")
-    if (user == undefined) {
-        fail("未登录");
-        return;
-    }
-
     var url = base_server_url + MENU_GET_ALL
+    ajaxGet(url, "", function(response) {
+        var data = response;
+        if (data.result_code == 0) {
+            success(data.result_data)
+        } else {
+            fail(data.result_desc);
+        }
+    }, function(error) {
+        fail("网络错误");
+    });
+}
 
+function DeptGetAll(success, fail) {
+    var url = base_server_url + DEPT_GET_ALL
     ajaxGet(url, "", function(response) {
         var data = response;
         if (data.result_code == 0) {

+ 4 - 1
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/Organ.java

@@ -1,5 +1,7 @@
 package com.xintong.visualinspection.bean;
 
+import java.util.List;
+
 import lombok.Data;
 
 /**
@@ -15,7 +17,7 @@ public class Organ {
     //备注
     private String remark;
     //父节点ID
-    private int parentid;
+    private Integer parentid;
     //班次类型  (1 两班 2 三班)'
     private String classtype;
     //机构编码
@@ -26,5 +28,6 @@ public class Organ {
     private String deptype;
     //0 正常 -1删除
     private Integer status;
+    private List<Organ> childs;
 
 }

+ 3 - 4
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/DepartmentController.java

@@ -87,12 +87,11 @@ public class DepartmentController extends BaseController {
      * @param size
      * @return
      */
-    @RequestMapping(value = "/get/all/{page}/{size}",method=RequestMethod.GET,produces="application/json;charset=UTF-8")
-    public String getAllDept(@PathVariable Integer page,@PathVariable Integer size ){
+    @RequestMapping(value = "/get/all",method=RequestMethod.GET,produces="application/json;charset=UTF-8")
+    public String getAllDept(){
         try{
-        	PageHelper.startPage(page, size); 
         	List<Organ> organs= departmentService.getOrgans(new Organ());
-        	return returnResult(0, "获取成功", new PageInfo(organs));
+        	return returnResult(0, "获取成功", organs);
         }catch(Exception e){
         	throw new BusinessException(20001);
         }

+ 9 - 9
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/DepartmentMapper.xml

@@ -31,15 +31,15 @@
         id,organname,remark,parentid,classtype,organcode,isshow,deptype,status
          FROM t_sys_organ
          where 1=1
-         <if test="organname != null">and organname = #{organname}</if>
-         <if test="remark != null">and remark = #{remark}</if>
-         <if test="parentid != null and parentid!=0">and parentid = #{parentid}</if>
-         <if test="classtype != null">and classtype = #{classtype}</if>
-         <if test="organcode != null">and organcode = #{organcode}</if>
-         <if test="isshow != null">and isshow = #{isshow}</if>
-         <if test="deptype != null">and deptype = #{deptype}</if>
-         <if test="status != null">and status = #{status}</if>
-         <if test="id != null and id != 0">and id = #{id}</if>
+         <if test="organname != null">and organname = #{organname} </if>
+         <if test="remark != null">and remark = #{remark} </if>
+         <if test="parentid != null and parentid!=0">and parentid = #{parentid} </if>
+         <if test="classtype != null">and classtype = #{classtype} </if>
+         <if test="organcode != null">and organcode = #{organcode} </if>
+         <if test="isshow != null">and isshow = #{isshow} </if>
+         <if test="deptype != null">and deptype = #{deptype} </if>
+         <if test="status != null">and status = #{status} </if>
+         <if test="id != null and id != 0">and id = #{id} </if>
     </select>
     
 

+ 39 - 15
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/DepartmentServiceImpl.java

@@ -1,11 +1,15 @@
 package com.xintong.visualinspection.service.impl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.xintong.visualinspection.bean.Menu;
 import com.xintong.visualinspection.bean.Organ;
 import com.xintong.visualinspection.dao.cluster.DepartmentDao;
 import com.xintong.visualinspection.service.BaseService;
@@ -14,44 +18,64 @@ import com.xintong.visualinspection.service.DepartmentService;
 import lombok.Data;
 
 /**
- * 文件名:UserServiceImpl
- * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
+ * 文件名:UserServiceImpl 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017
+ * 版权所有.
  */
 @Service
 @Data
 public class DepartmentServiceImpl extends BaseService implements DepartmentService {
 
-    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(DepartmentService.class);
-
-
-    @Autowired
-    private DepartmentDao departmentDao;
+	private static final org.slf4j.Logger logger = LoggerFactory.getLogger(DepartmentService.class);
 
+	@Autowired
+	private DepartmentDao departmentDao;
 
 	@Override
 	public List<Organ> getOrgans(Organ organ) {
-		return departmentDao.getOrgan(organ);
-	}
 
+		List<Organ> organs = departmentDao.getOrgan(organ);
+		List<Organ> olist = new ArrayList<>();
+		Map<Integer, List<Organ>> map = new HashMap<>();
+		// 找出所有父
+		for (Organ o : organs) {
+			if (o.getParentid() != null && o.getParentid()!=0) {
+				List<Organ> organList = map.get(o.getParentid());
+				if (organList == null) {
+					organList = new ArrayList<>();
+				}
+				organList.add(o);
+				map.put(o.getParentid(), organList);
+			}
+		}
+		// 找出子
+		for (Integer oid : map.keySet()) {
+			for (Organ m2 : organs) {
+				if (m2.getId() == oid) {
+					m2.setChilds(map.get(oid));
+					if (m2.getParentid() == null || m2.getParentid()==0) {
+						olist.add(m2);
+					}
+				}
+			}
+		}
+
+		return olist;
+	}
 
 	@Override
 	public void insert(Organ organ) {
 		departmentDao.insert(organ);
-		
-	}
 
+	}
 
 	@Override
 	public void update(Organ organ) {
-		departmentDao.update(organ);		
+		departmentDao.update(organ);
 	}
 
-
 	@Override
 	public void delete(Integer id) {
 		departmentDao.delete(id);
 	}
 
- 
-
 }

部分文件因文件數量過多而無法顯示