`
收藏列表
标题 标签 来源
物业管理系统
一、 选题背景与意义

(为什么选这个题目?本选题的理论或应用价值是什么?)

        物业管理系统,是为了更好的在线上管理小区住户信息及物业相关资源, 也为了更好的为住户服务,所以需要有一套高效、快捷的物业管理系统。在当下“智慧城市”发展的驱动下, 在当下“互联网+”的推动下, 拥有一套符合本小区特点的物业管理系统是非常必要的。运用该系统能克服传统交流所带来的很多人力、物力及时间上的资源浪费和交流深度的限制,能极大的减轻物业工作人员的工作量和不必要的工作。通过本系统可以实现本小区内的房屋管理、设施管理、人员管理、报修管理、费用管理、公告管理等常规的物业管理需求。本系统设有三大类角色:超级管理员、物业工作人员、业主。物业工作人员依据自身职能又可以分为保安门岗、保洁绿化、综合维修、组织管理员、财务会计(保安队长/保洁队长/维修队长)这几类角色。系统管理员可以管理房屋和用户权限、发布公告等。业主可以在系统中提交工单申请及结果查询、查看公告、查询或缴纳各类费用。组织管理员对业主提交的工单申请进行分类并指排具体处理人员(保安/保结/维修)。处理人员接受到工单后,在规定时间内处理好后发起工单确认申请并由提交人(业主)评分+评价。组织管理员可以以年底根据业主的评分对物业基层工作人员进行绩效考核。

 

二、 研究内容

(本选题主要研究内容与研究框架)

研究内容:

     根据需求确定系统的角色权限、功能模块的划分、工作流的处理方式。

研究框架:

	JAVA EE

	oracle数据库

	HTML

	javascript

	bootstrap

	UML/visio

三、 时间进度安排

 	1.项目启动

		需求调研

		业务梳理

	2.需求阶段

		产品原型

		需求概要

		技术评估

		开发计划 / 任务分解

	3.设计阶段

		交互设计

		UI界面/设计规范

		概要设计/表结构设计

		架构方案设计

		接口文档定义

	4.开发阶段

		界面开发

		功能开发

		联调自测						

	5.测试阶段

		测试用例

		修改BUG

		测试报告

		用户手册

	6.系统上线 

		部署运行

		容灾备份

 

四、主要参考文献 

1] 田小波,陈蜀宇.  MVC设计模式在J2EE架构下的研究与应用[J]. 西华大学学报(自然科学版). 2007(02)

[2] 陶以政,吴志杰,唐定勇,席传裕,姜龙,李兴兰.  基于J2EE的应用框架技术研究[J]. 计算机工程与设计. 2007(04)

[3] 胡以谰,张立平.  J2EE开发模式的选择[J]. 计算机系统应用. 2002(08)

[4] 舒后,熊一帆,葛雪娇.  基于Bootstrap框架的响应式网页设计与实现[J]. 北京印刷学院学报. 2016(02)

[5] 张云苑. JavaScript在动态网页设计中的应用[J]. 科技信息,2007(05) 

[6] 王凤斌,段隆振,李向军,甘晟科. UML面向对象建模在管理信息系统中的应用[J]. 计算机与现代化,2005(02)
模拟请求数据
https://test-uc-txt.pingan.com.cn:11443/userplatforms/rest/custom/registlogin?param=eyJkYXRhIjp7ImN1c3RvbWlkIjoiZHh0ZXN0YXBwIiwiY3VzdG9tbmFtZSI6IiIsIm1vYmlsZXBo\nb25lIjoiIiwibmFtZSI6IiIsInNvdXJjZXN5cyI6IjIwMDAxIiwidGltZXN0YW1wIjoxNDAyMzk0\nNjc1MTY5fSwic2lnbiI6eyJ0b2tlbiI6Ij8/Xj8/UD9BPz4/Pz8ZPz8/Pz8FIiwidHlwZSI6IjAx\nIn19&deviceId=800012345&resource=andro

request headers:

Host: nts-tms-dmzstg1.pingan.com.cn
Proxy-Connection: keep-alive
Referer: http://211.95.76.89:9027/html5/reserve.html
Origin: http://211.95.76.89:9027
X-Requested-With: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded
Accept: application/json
User-Agent: Mozilla/5.0 (Linux; U; Android 4.2.1; zh-cn; M351 Build/JOP40D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
Accept-Encoding: gzip,deflate
Accept-Language: zh-CN, en-US
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
Cookie: BIGipServernts-tms_http_DMZ_Stg1pool=3078952108.41130.0000; JSESSIONID=DnTxTW3RpB9Gs6b1XVpfnk5N1QPlxDtqLJLs5k3gDr2v2hWgZQfJ!-557419990
Content-Length: 148

request body:

RMid=&id=T140276724&contactDate=2014-06-10&contactTime=0&contactWay=0&contactPlace=&expectedAmount=0&remark=&timeLimit=&timeLimitUint=&productYield=
天下通接口
"HTTPS接口:
URL:${domain}/userplatforms/rest/custom/registlogin?
Method:Post"						
			字段名称	是否必输(Y/N)	字段含义	
输入参数	param	sign	token	Y	验签token	"加签栏位为整个data参数.用data中的value值(属性key值按照字典排序后),
使用HMAC-SHA1生成的token(根据分配给第三方的key加密)
例如示例中参数按字典排序后顺序为customid,mobilephone,sourcesys,timestamp。
按顺序取对应属性的value,组成字符串:
aaa+12311111111+10002+1387339139461  (+只是说明把字符串加在一起)"
			type	Y	固定 01	
		data	customid	Y	业务系统用户ID	
			customname	Y	业务系统用户名	
			mobilephone	N	用户手机	
			sourcesys	Y	系统识别码	由天下通分配给第三方
			name	N	昵称	如果为空,则天下通按规则生成默认
			timestamp	Y	时间戳	"时间戳。时间为CST的long类型,
例如:2013-09-07 14:13:56的long类型为 1378534436389"
	deviceId		deviceId	N	设备号	用户生成持续登陆token,如果没有则不生产accesstoken
	resource		resource	N	客户端资源	iphone/android/web
输出	code		code	Y	返回码	
	message		message	Y	返回码说明	
	body		body	Y	包含accesstoken和username的JSON字符串	{"accesstoken":"122222","username":"123221121",jsession:"aa112211"}
"输入参数
示例说明"		"param=${param}
deviceId=""xxx""  
resource=""xxx""

${param}:将data和sign,即上面整个json字符串进行 Base64Encode 转码
{
  ""data"":{""customid"":""aaa"",""customname"":""xxx"",""mobilephone"":""12311111111"",""name"":""xxx"",""deviceId"":""xxx"",""resource"":""iphone"",
  ""sourcesys"":""10102"",""timestamp"":""1387339139461""},
  ""sign"":{""token"":""GEONBEccYJ9KSeVLJnpcG9LrEwQ="",""type"":""01""}
}
"				
返回信息:		"{
  ""body"":""xxx"",
  ""code"":""200"",
  ""message"":""操作成功""
}"				
						
备注:						
接口调用后会在cookie中存入用户登录session值。Cookie的Key:hm_sessionid   value:用户登录后的jsession						


根据持续登陆token获取新的logintoken
"HTTPS接口:
URL:${domain}/userplatforms/rest/customlogin/getLoginSession?
Method:Post"				
	字段名称	是否必输(Y/N)	字段含义	
输入参数	accesstoken	Y	持续登陆token	
	sourcesys	Y	系统识别码	由天下通分配给第三方
	resource	Y	客户端资源	iphone/android/web
	username	Y	天下通唯一标示	UserName
	deviceId	Y	设备号	用户生成持续登陆token
输出	code	Y	返回码	
	message	Y	返回码说明	
	body	Y	持续登陆token与jession的json串	{accesstoken:"aaxx",jsession:"aa112211"}
"输入参数
示例说明"	{"accesstoken":"xxx","resource":"iphone","deviceId":"xxx","sourcesys":"10102","openId":"ssa1122"}			
返回信息:	"{
  ""body"":""xxx"",
  ""code"":""200"",
  ""message"":""操作成功""
}"			


根据logintoken和deviceId获取持续登陆token
"HTTPS接口:
URL:${domain}/userplatforms/rest/persistlogin/getAccessToken?
Method:Post"				
	字段名称	是否必输(Y/N)	字段含义	
	sourcesys	Y	系统识别码	由天下通分配给第三方
	resource	Y	客户端资源	iphone/android/web
	deviceId	Y	设备号	用户生成持续登陆token
输出	code	Y	返回码	
	message	Y	返回码说明	
	body	Y	持续登陆token	accesstoken
"输入参数
示例说明"	{"resource":"iphone","deviceId":"xxx","sourcesys":"10102"}			
返回信息:	"{
  ""body"":""xxx"",
  ""code"":""200"",
  ""message"":""操作成功""
}"			

用户信息修改
"HTTPS接口:
URL:${domain}/userplatforms/rest/login/userEdit
Method:Post"					
输入参数	字段名称	类型	是否必输(Y/N)	字段含义	备注
data	loginsession	String	Y	用户登录session	用户登录session,安全校验
	v	String	Y	接口版本	接口版本
	username	String	Y	系统用户ID	用户唯一标示
	name	String	N	用户昵称	
	realname	String	N	真实姓名	
	heartid	String	N	天下通号	
	sex	String	N	性别	
	region	String	N	地区,省市	
	albumurl	String	N	头像	
	signature	String	N	个性签名	
输出	code	String	Y	状态码	
	message	String	Y	返回码说明	
	body	String	Y	报文体	
"输入参数示例说明
{""loginsession"":""xxx"",""v"":""xxx"",""username"":""xxx"",""name"":""xxx""} 
"					
"返回信息:
{
  ""body"":""{}"",
  ""code"":""200"",       
  ""message"":""操作成功""
}"					
					
返回码定义					
返回码	描述				
200	operate successfully				
602	param error				
601	operate failed				
614	The version number is empty or does not exist.				
productRecommendRM.js
/**
 * Created by YECHONGHAO on 14-4-9.
 */
(function () {
	/*window.onerror = function (sMessage, sUrl, sLine) {
	 alert(sMessage + '-' + sUrl + '-' + sLine);

	 };*/
	//本地存储的此次预约对象
	var apt = Native.data('appointment') || {},
	//弹出框类型zepto对象数组
		$popupsArr = [$('#popups'),$('#RMFilter'),$('#RMError')];

	var xhr = null; // ajax对象

	var nextPageIndex = 1,
		pageSize = 4;

    var $text=$('#text'),
		$comfirm = $('#comfirm');//确认按钮
	var $RMList = $('#RMList');
	var selectData = {
		page: nextPageIndex,
		pageSize: pageSize,
		name: '',
		city: '',
		sex: '',
		maxAge: '',
		minAge: '',
		position: ''
	};

	/*
	 * 设置标题
	 */
	Native.setTitle({
		text: TITLE.PRODUCT_RM_RECOMMEND,
		leftType: 'back',
		leftContent: '返回',
		leftCallback: function () {
			Native.data('RMList',null);
			Native.data('selectData', null);
			Native.back();
		},
		rightType: 'text',
		rightContent: '筛选',
		rightCallback: function () {
            $text.off('focus');
			selectData.page = nextPageIndex - 1;
			Native.data('selectData', selectData);
			Native.redirect({
				type: 'leftMenu'
			});
		}
	});


	/*
	 * 检测预约是否存在
	 */
	if (!apt) {
		//前页面数据出错或非正常调转到此页面则跳回到产品模块
		Native.tip('数据错误,请重新预约', 1500);
		Native.redirect({
			type: 'module',
			module: 'products',
			slide: 'left'
		});
	}

	/*
	 * 获取推荐RM列表,根据手机所在地排序显示
	 */
	var tempRMList = Native.data('RMList');
	if (tempRMList) {
		var listHtml = _.template($('#RMListTpl').html(), {
			RMList: tempRMList
		});
		$RMList.html(listHtml);
	} else {
		var tempData = Native.data('selectData');
		if(tempData){
			loadTemp();
		}else{
			getRMList(selectData);
		}
	}

	/**
	 * 加载缓存
	 */
	function loadTemp() {
		pageSize = selectData.pageSize;
		nextPageIndex = selectData.page;
		selectData = tempData;
		selectData.pageSize = selectData.page *  selectData.pageSize;
		selectData.page = 1;
		getRMList(selectData);
		selectData.page = nextPageIndex;
		selectData.pageSize = pageSize;
	}
	/**
	 * 点击加载更多
	 */
	var $btnMore = $('#btnMore');
	$btnMore.tap(function () {
		selectData.page = nextPageIndex;
		getRMList(selectData);
	});


	$RMList
		/*
		 * RM列表选择切换
		 */
		.on('tap.select', '.select, .select.check', function () {
			var $self = $(this);
			if (!$self.hasClass('check')) {
				$('.check').removeClass('check');
			}
			$self.toggleClass('check');
		})
		/*
		 * 显示RM详细信息
		 */
		.on('tap.alert', '.headPortrait, .data', function () {
			//获取RM的id
			var RMId = $(this).siblings('[hidden]').text();
			//getRMDetails(RMId);
			$popupsArr[0].hide();
			selectData.page = nextPageIndex - 1;
			Native.data('selectData', selectData);
			Native.redirect({
				type: 'url',
				url: 'RMDetail.html?RMId='+ RMId,
				title: TITLE.PRODUCT_RM_DETAIL,
				slide: 'left'
			});
		});

	//点筛选后进行搜索显示
	/**
	 * @example param=xxx¶m1=xxx
	 * @param data
	 */
	C.Api.onProductRMFilter = function (data) {
		if (data) {
			nextPageIndex = 1;
			var getData = C.queryStringToJSON(data);
			// 如果存在ajax请求对象,则先中止请求
			xhr && xhr.abort();
			//清空之前搜索框里面的内容
			if (getData['city'] || getData['sex'] || getData['maxAge'] || getData['minAge'] || getData['position']) {
				selectData = {
					page: nextPageIndex,
					pageSize: pageSize,
					name: '',
					city: getData['city'],
					sex: getData['sex'],
					maxAge: getData['maxAge'],
					minAge: getData['minAge'],
					position: getData['position']
				};
				$text.val('');
				getRMList(selectData);
			} else {
				var tempRMList = Native.data('RMList');
				if (tempRMList) {
					var listHtml = _.template($('#RMListTpl').html(), {
						RMList: tempRMList
					});
					$RMList.html(listHtml);
				} else {
					tempData = Native.data('selectData', selectData);
					loadTemp();
				}
			}
		}
	};

	/*
	 * 提交选的RM,完成此次预约
	 */
	$('#comfirm').on('tap', function () {
		var $select = $('.select');
		//有RM被选中
		if ($select.hasClass('check')) {
			apt.RMId = $select.filter('.check')
				.siblings('span')
				.text();
			var dateArr = apt.contactDate.split('-');
//			alert(JSON.stringify(dateArr));
			insertDatabase({
				RMId: apt.RMId,
				id: apt.id,
				contactDate: dateArr[0] + dateArr[1] + dateArr[2],
				contactTime: $.inArray(dateArr[3], [
					'8点~10点', '10点~12点','12点~14点','14点~16点','16点~18点','18点~20点','任意时段'
				]),
				contactWay: apt.contactWay,
				contactPlace: apt.contactPlace,
				expectedAmount: apt.expectedAmount,
				remark: apt.remark,
				timeLimit: apt.timeLimit || '',
				productYield: apt.productYield || ''
			});
		} else {
			showPopups(2);
			$('#RMErrorBtn').hide();
			$('#RMErrorContent').text('对不起!请先选择RM!');
			setTimeout(function () {
				$('#popups').hide();
			}, 1500);
		}
	});

	/**
	 *    写入数据库
	 * @param data :
	 *            RMId    RM的id
	 *            id    产品的id
	 *            contactDate    预约时间,”XXXX-XX-XX-上午”总共有5个时间段,早上,上午,中午,下午,晚上
	 *            contactWay    预约联系方式,暂定有电话和面谈两项
	 *            contactPlace    预约地点,如果contactWay为面谈,才有值
	 *            expectedAmount    预约金额
	 *            remark    预约备注信息
	 */
	function insertDatabase(data) {
//		alert(JSON.stringify(data));
		$.ajax({
			url: Service.COMMIT_APPOINTMENT_LIST,
			type: 'POST',
			data: data,
			dataType: 'json',
			success: function (res) {
				if (res.code == '1') {
					Native.data('RMList',null);
					Native.data('selectData', null);
					Native.data('appointment', null);
					Native.redirect({
						type: 'url',
						url: 'productSubscribSuccess.html',
						title: TITLE.PRODUCT_APPOINTMENT,
						slide: 'left'
					});
				} else {
					showPopups(2);
					$('#RMErrorBtn').hide();
					$('#RMErrorContent').text('对不起!信息错误,没有找到响应数据请重新操作或返回。');
					setTimeout(function () {
						$('#popups').hide();
					}, 1500);
				}
			}
		});
	}

	/**
	 * 显示弹出框
	 * @param style :
	 *            1 RM详情, 2 筛选, 3 错误信息提示
	 */
	function showPopups(style) {
		for (var i = 1, len = $popupsArr.length; i < len; i++) {
			$popupsArr[i].hide();
		}
		$popupsArr[0].show();
		$popupsArr[style].show();

	}

	/**
	 * 获取推荐RM列表
	 * @param options 请求参数:
	 *            page 查询页数
	 *            pageSize 每页显示条数,默认4条
	 *            name rm姓名进行搜索
	 *            city 查询该城市的RM列表, ”全部”或具体城市名
	 *            sex 查询该性别的RM列表,”全部””男””女”
	 *            maxAge 查询最大年龄的RM列表,需同minAge一起传递,若与minAge同为空则查询所有
	 *            minAge 查询最小年龄的RM列表, 需同maxAge一起传递, 若与maxAge同为空则查询所有
	 *            position 查询该职级的RM列表(‘全部’或其它具体项,其它具体列表项待添加)
	 */
	function getRMList(options) {
		options = options || {};
		var page = options.page || 1,
			pageSize = options.pageSize || 4,
			name = options.name || '',
			city = options.city || '',
			sex = options.sex || '',
			maxAge = options.maxAge || '',
			minAge = options.minAge || '',
			position = options.position || '';

		xhr = $.ajax({
			url: Service.GET_PRODUCT_RM_LIST,
			type: 'POST',
			data: {
				page: page,
				pageSize: pageSize,
				name: name,
				city: city,
				sex: sex,
				maxAge: maxAge,
				minAge: minAge,
				position: position
			},
			dataType: 'json',
			success: function (res) {
				if (res.code == '1' && res.data && res.data.RMList.length) {

					if (!(name || city || sex || maxAge || minAge || position))  {
						Native.data('RMList', res.data.RMList);
					} else {
						Native.data('RMList', null);
					}
					//var $RMList = $('#RMList');
					//获取模板
					var RMListTpl = $('#RMListTpl').html();
					//获取待添加html页面字符串
					var listHtml = _.template(RMListTpl, {
						RMList: res.data.RMList
					});
					if (page == 1) {
						//清除页面数据
						$RMList.html(listHtml);
					} else {
						//加载时往后添加
						$RMList.append(listHtml);
					}
					//alert(page + ',' + res.totalPage);
					if (page == res.data.totalPage){
						//所有数据加载完成后隐藏加载更多
						$btnMore.hide();
					} else {
						//若还有数据未加载完成,显示加载更多
						$btnMore.show();
					}
					nextPageIndex++;
					$comfirm.show();
				}else{
					if(!$RMList.html()){
						//当没有数据显示在页面上时,隐藏确认预约按钮以及加载更多
						$comfirm.hide();
						$btnMore.hide();
					}
					//没有搜索到的时候提示信息
					Native.tip('您好,没有搜索到对应的理财经理,请重新搜索!',2000);
				}
			}
		});
	}

	//输入姓名查找,显示从后台查询到的数据
    $text.keyup(function (event) {
		if (event.keyCode == 13) {
			//$('#RMList').html('');
			nextPageIndex = 1;
			selectData = {
				page: nextPageIndex,
				pageSize: pageSize,
				name: $('#text').val(),
				city: '',
				sex: '',
				maxAge: '',
				minAge: '',
				position: ''
			};
			getRMList(selectData);
		}
	});

})();
SVG折线图
(function( $ ){
var VectorCanvas = function(width, height) {
    this.mode = window.SVGAngle ? 'svg' : 'vml';
    this.createSvgNode = function(nodeName) {
        return document.createElementNS(this.svgns, nodeName);
    }
    this.canvas = this.createSvgNode('svg');
    this.setSize(width, height);
}

VectorCanvas.prototype = {
    svgns: "http://www.w3.org/2000/svg",
    mode: 'svg',
    width: 0,
    height: 0,
    canvas: null,

    setSize: function(width, height) {
        this.canvas.setAttribute('width', width);
        this.canvas.setAttribute('height', height);

        this.width = width;
        this.height = height;
    },

    createPath: function (pointArray, option) {
        var pointString = "M";
        for(var i=0;i<pointArray.length;i++){
            if(i==0){
                pointString = "M";
            }else{
                pointString += "L";
            }
            pointString += pointArray[i].join(" ")+" ";
        }
        pointString += "Z";
        option["d"] = pointString;
        return this.createElement("path", option);
    },
    createLine: function(option) {
        return this.createElement("line", option);
    },
    createCircle: function(option) {
        return this.createElement("circle", option);
    },
    createElement: function(tagName, option) {
        var node;
        node = this.createSvgNode(tagName);
        for(var op in option){
            node.setAttribute(op, option[op]);
        }
        return node;
    },
    createGroup: function(isRoot) {
        var node;
        node = this.createSvgNode('g');

        if (isRoot) {
            this.rootGroup = node;
        }
        return node;
    },
    createRect: function(option){
        return this.createElement("rect", option);
    },
    createText: function(text, option){
        var textNode = this.createElement("text", option);
        textNode.textContent = text;
        return textNode;
    },
    createPolyline: function(pointArray, option){
        var pointString = "";
        for(var i=0;i<pointArray.length;i++){
            pointString += pointArray[i].join(",")+" ";
        }
        option["points"] = pointString;
        return this.createElement("polyline", option);
    },
    createPolygon: function(option){
        return this.createElement("polygon", option);
    },
    applyTransformParams: function(scale, transX, transY) {
        if (this.mode == 'svg') {
            this.rootGroup.setAttribute('transform', 'scale('+scale+') translate('+transX+', '+transY+')');
        } else {
            this.rootGroup.coordorigin = (this.width-transX)+','+(this.height-transY);
            this.rootGroup.coordsize = this.width/scale+','+this.height/scale;
        }
    }
};

    $.fn.canvasSVG = function(options){

        var datas = {
            // 纵坐标标签
            axisY:["20%","10%","0%","-10%","-20%"],
            // 横坐标标签
            axisX:["1-3月","3-5月","5-7月","7-9月"],
            // 最大值
            maxVal:20,
            // 最小值
            minVal:-20,
            // 点的数据
            types:[
                {
                    text:"类别参数",
                    points:[30,5,20,15,-10,-20,20],
                    color:"#0cbde3"
                }
                /*,
                {
                    text:"类别参数1",
                    points:[1,80,30,90,20,70,60,10],
                    color:"#ffc000"
                },
                {
                    text:"类别参数2",
                    points:[80,60,55,70,36,10,50,40],
                    color:"#9694dd"
                },
                {
                    text:"沪升300参数",
                    points:[1,20,30,40,5,50,80,20,80,20],
                    color:"#ff6600"
                }
                */
            ]

        };
        options && options.datas && (datas = options.datas);
        // 画布宽度
        var canvasWidth = 620,canvasHeight = 500;
        // 画布
        var canvas = new VectorCanvas(canvasWidth,canvasHeight);
        // 根元素
        var rootGroup = canvas.createGroup(true);
        // 起点
        var startX = 0,startY = 20;
        // 标签间距
        var yTextPadding = 55, xTextPadding = 70;
        // 图表左侧padding
        var canvasLeftPadding = 60;
        // 左侧及下边框线条颜色
        var siderBorderColor = "#a6a6a6";
        // 图表区域宽度
        var tableWidth = 550, tableHeight = 238, tablePaddingTop = 10;
        // 根据值
        var getYPointByVal = function(val){
            if(val > datas.maxVal){
                val = datas.maxVal;
            }
            if(val < datas.minVal){
                val = datas.minVal;
            }
            if(val > 0){
                return tableHeight - (parseFloat(val)/ (datas.maxVal - datas.minVal)) * tableHeight - (tableHeight/2);
            }else if(val < 0){
                return ((Math.abs(val)/ Math.abs(datas.minVal))) * (tableHeight/2) + (tableHeight/2);
            }else{
                return tableHeight/2;
            }

        };
        /* 画底部图例
         * createBottomLabel({text:"test",x:100,Y:100,fillColor:"#f30"});
         */
        var createBottomLabel = function(option){

            var labelText = option.text, labelX = option.x, labelY = option.y, borderRadius = 6, fillColor = option.fillColor;
            var labelTextTop = 35, labelTextLeft = 8; // 图例文本上边距
            var group = canvas.createGroup();

            var rect = canvas.createRect({x: labelX, y: labelY, rx: borderRadius, yx: borderRadius, width:option.width , height:option.height,style: "fill:"+fillColor});
            var text = canvas.createText(labelText,{x:labelX+labelTextLeft,y:labelY+labelTextTop,style:"fill:#fff"});
            group.appendChild(rect);
            group.appendChild(text);
            return group;
        };

        // 画纵坐标
        $.each(datas.axisY,function(i, axisText){
            var text = canvas.createText(axisText,{x:startX,y:startY+(i*yTextPadding), style:"font-size:20px"});
            rootGroup.appendChild(text);
        });
        // 画左侧直线
        var leftSiderLine = canvas.createLine({x1:startX+canvasLeftPadding,y1:0,x2:startX+canvasLeftPadding,y2:tableHeight,style:"stroke:"+siderBorderColor+";stroke-width:1"});
        rootGroup.appendChild(leftSiderLine);
        // 画底部直线
        var pointArray = [[(startX+canvasLeftPadding),tableHeight],[(startX+canvasLeftPadding),tableHeight],[startX+canvasLeftPadding+tableWidth,tableHeight]];

        var botomSiderLine = canvas.createPath(pointArray, {style:"stroke:"+siderBorderColor+";stroke-width:1"});
        rootGroup.appendChild(botomSiderLine);
        // 画横线
        var axisYSize = datas.axisY.length-1;
        // 横向间距
        var stepHeight = tableHeight / axisYSize;
        // 折线图开始位置X坐标
        var tablePointX = startX+canvasLeftPadding;
        for(var i=0;i<axisYSize;i++){
            var dashLine = canvas.createLine({x1:tablePointX,y1:(stepHeight*i),x2:tablePointX+tableWidth,y2:(stepHeight*i),style:"stroke:"+siderBorderColor+";stroke-width:1;stroke-dasharray:8 5"});
            rootGroup.appendChild(dashLine);
        }
        // 画折线
        var dataTypes = datas.types;
        // 纵轴数量(取最大的数据长度)
        var xPointSize = 0, xPointArray = [];
        // 纵轴间距
        var xPointStepVal = 0;
        for(var i=0;i<dataTypes.length;i++){
            var pointArray = dataTypes[i].points;
            xPointArray.push(pointArray.length);
        }
        xPointSize = Math.max.apply(null,xPointArray);
        xPointStepVal =  (tableWidth / (xPointSize-1)).toFixed(2);
        // y粙坐标
        var bottomLabelStartX = 0;
        // 图例间距
        var bottomLabelPadding = 20;
        for(var i=0;i<dataTypes.length;i++){
            var innerArray = dataTypes[i].points;
            // X轴坐标点数组
            var pointXArray = [];
            for(var j=0;j<innerArray.length;j++){
                innerArray[j] = innerArray[j].replace(/\s/g,"");
                if(innerArray[j] != "NAN"){
                    var innerArrayVal = parseFloat(innerArray[j]) * 100;
                    if(j == 0){
                        innerArrayVal = 0;
                    }
                    // Y轴坐标
                    var pointY = getYPointByVal(innerArrayVal);
                    // X轴坐标
                    var pointX = tablePointX + (xPointStepVal*j);
                    pointXArray.push([pointX, pointY]);
                }
            }
            // 添加X轴折线
            var pointXLine = canvas.createPolyline(pointXArray, {id:"polyline"+i,style:"fill:rgba(0,0,0,0);stroke-width:2",stroke:dataTypes[i].color});
            rootGroup.appendChild(pointXLine);
            // 添加底部图例
            var bottomLabelTop = tableHeight + 80;
            var labelText = dataTypes[i].text;
            //var strLen = escape(labelText).match(/\%u\w{4}/g).length * 2;
            var strLen = labelText.length * 2;
            var labelHeight = 50, labelWidth = (strLen + labelText.length) * 10; // 图例高度
            /*
            var bottomLabelGroup = createBottomLabel({text:labelText,width: labelWidth, height: labelHeight, x:bottomLabelStartX,y:bottomLabelTop,fillColor:dataTypes[i].color});
            rootGroup.appendChild(bottomLabelGroup);
            $(bottomLabelGroup).tap((function(index){
                return function(){
                    if($(this).attr("hidden")){
                        $("#polyline"+index).attr("stroke",dataTypes[index].color);
                        $(this).removeAttr("hidden");
                    }else{
                        $(this).attr("hidden",true);
                        $("#polyline"+index).attr("stroke","rgba(0,0,0,0)");
                    }
                }
            })(i));
            */
            bottomLabelStartX += (bottomLabelPadding + labelWidth);
        }
        // 添加底部横轴小分隔线
        var axisXSize = datas.axisX.length, botHLineStep = tableWidth / axisXSize, botHlineHeight = 20;
        var axisXTextLeftPadding = 30; // X轴标签左侧偏移量

        for(var i=0;i<axisXSize;i++){
            if(i>0){
                // 画横线
                 var botHLine = canvas.createLine({x1:tablePointX + (botHLineStep*i),y1:0,x2:tablePointX + (botHLineStep*i),y2:tableHeight,style:"stroke:"+siderBorderColor+";stroke-width:1;stroke-dasharray:8 5"});
                 rootGroup.appendChild(botHLine);
            }
            // 画X轴标签
            var botHText = canvas.createText(datas.axisX[i],{x:tablePointX + (botHLineStep*i) + axisXTextLeftPadding,y:tableHeight+botHlineHeight*2});
            rootGroup.appendChild(botHText);

        }






        canvas.canvas.appendChild(rootGroup);
        $(this).empty().append(canvas.canvas);
    };

})(Zepto);
iframe高度自适应
function iFrameHeight() {
	var iframeId = 'mainIframe';
	var ifm= document.getElementById(iframeId);
	try{
		var subWeb = document.frames ? document.frames[iframeId].document : ifm.contentDocument;
		if(ifm != null && subWeb != null) {
			ifm.height = subWeb.body.scrollHeight;
		}
	}catch(e){}
} 
iFrameHeight()
获取jquery元素的绑定函数
jQuery._data($("#btnNext")[0]).events.click[0].handler()
kaoqing
2013/7/1	8:45	18:10
2013/7/2	8:40	18:40
2013/7/3	8:44	18:10
2013/7/4	8:50	20:50
2013/7/5	8:45	18:20
		
[加班]2013/7/7	8:50	19:00

2013/7/8	8:45	20:00
2013/7/9	8:50	21:00
2013/7/10	8:50	18:30
2013/7/11	8:50	18:30
2013/7/12	8:50	18:30
		
2013/7/15	8:50	19:50
window.closeIE下消除确认框
function CloseWebPage() {
		if (navigator.userAgent.indexOf("MSIE") > 0) {
			if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
				window.opener = null; window.close();
			}
			else {
				window.open('', '_top'); window.top.close();
			}
		}
		else if (navigator.userAgent.indexOf("Firefox") > 0) {
			window.location.href = 'about:blank ';
			//window.history.go(-2);
		}
		else {
			window.opener = null; 
			window.open('', '_self', '');
			window.close();
		}
	}
根据json生成树状节点
var datas = {
    item1 : {
        a : "this is a",
        b : "this is b"
    },
    item2 : {
        c : "this is c",
        c : "this is d"
    },
    item3 : "this is e",
    item4 : {
        f : {
            "first" : "this is f child"
        },
        g : "this is g"
    }
};
function create(el){
    return document.createElement(el);
}
function initTree(obj,id){
    var nodeObj = create("DIV");
    nodeObj.id = id;
    
    if(typeof obj == 'object'){
        for(var i in obj){
            nodeObj.appendChild(initTree(obj[i],i));
        }
    }else{
        nodeObj.setAttribute("value",obj);
        nodeObj.innerHTML = obj;
    }
    return nodeObj;
}
function init(){
    var frag = document.createDocumentFragment();
    for(var i in datas){
        frag.appendChild(initTree(datas[i],i));
    }
    document.body.appendChild(frag);
}
init();
dingp-JS
		var obj = document.getElementById("rand");

		var oldOnload = window.onload;
		var queryTime = null;
		var isPersonChecked = false;    
		var checkTime = null;

	function autoSelectPassenger() {
		var pp = ""
		var pseat = "O";//1:硬座,0:二等座
		if(isPersonChecked){
		  return ;
		}
		if (pp) {
			pp = pp.split("|");

			$.each(pp, function () {
				if (!this) return true;
				console.log("[INFO][自动选择乘客] 自动选定-" + this);
				var that = this;
				window.setTimeout(function(){
    				$("#" + that + "._checkbox_class").click().attr("checked", true);
				   // $("#" + this + "._checkbox_class").attr("checked", "checked");	//为啥设置两次?我也不知道,反正一次不对。
    				console.log("setTimeout click()");
    				isPersonChecked = true;
				},300);
				
				return true;
			});
			if (pseat) {
				$(".passenger_class").each(function () { $(this).find("select:eq(0)").val(pseat).change(); });
			}
		}
	};

	function autoCheckPerson(){
        if($("#简明1430621199112062712._checkbox_class").length>0){
            isPersonChecked = true; 
            autoSelectPassenger();
        }
        if(isPersonChecked){
            window.clearInterval(checkTime);
        }
        
	}

		window.onload = function () {
    	   
    	   checkTime = window.setInterval(function(){
    	       if(isPersonChecked){
    	           return false;
    	       }
    	       //console.log("timeout jm checkbox : "+$("#简明1###._checkbox_class").length);
    	       autoCheckPerson();  
    	   },100);
		   
		   $("#submitQuery").on("click",function(){

		      if(queryTime!=null){
		          window.clearInterval(queryTime);
		      }
		      queryTime = window.setInterval(function(){
		          var searchDone = false;
		          var btnEnabled = false;
		          var hasResult = false;

		          if($("#gridbox>*").length=="1"){
		              searchDone = true;
		              //console.log("searchDone...");
                      var btnList = $("#gridbox a.btn130_2"); 
		              if(btnList.length>0){
    		              //hasResult = true;
    		              //console.log("enBtn.lenght:"+enBtn.lenght);
                          
                          var ticketList = "G71";
  
    		              if(ticketList!=""){
    		                  btnList.each(function(obj,i){
    		                      if($.inArray($(this).parent().parent().find("span").text(),ticketList.split("/"))!="-1"){
    		                          //console.log("search ticket:"+$(this).parent().parent().find("span").text());
    		                          $(this).click();
    		                          return;
    		                      }else{
    		                          btnList[0].click();
    		                      }
    		                  });
    		              }else{
    		                  btnList[0].click();
    		              }
    		              
    		              window.clearInterval(queryTime);
    		              //console.log("clearInterval queryTime...");
    		              return;
		              }
		          }
		          if($("#submitQuery.search_u").length>0){
		              btnEnabled = true;
    		          
		          }
		          if(btnEnabled && !hasResult){
		              $("#submitQuery").click();
		          }
		          //console.log("sendFun:"+ typeof sendFun);//query function
		          //console.log("auto query 3.01 min.....");
		      },1000);
		   });
		
			if (oldOnload) oldOnload();
			$(window).ajaxComplete(function (e, xhr, s) {
        	    //console.log("ajaxComplete.....");
        		if (s.url.indexOf("getpassengerJson") != -1) {
        			console.log("[INFO][自动选择乘客] 系统联系人加载完成,正在检测预先选定");
        			autoSelectPassenger();
        		}
        	});
        	$("#rand").on("keydown",function(e){
        	   console.log("keydown:"+e.keyCode);
        	   if(e.keyCode == '13'){
        	       $(".tj_btn button:eq(2)").click();
        	   }
        	});
        	//如果已经加载完成,那么直接选定
        	if ($("#showPassengerFilter div").length>1) {
        		console.log("[INFO][自动选择乘客] OOPS,居然加载完成了?直接选定联系人");
        		autoSelectPassenger();
        	}
			console.log("window onload");
			console.log("len:" + $("#showPassengerFilter input").length);
			obj.select();
		};


js获取当前点击元素相对位置
function getTarget(event){
	var obj = (window.event) ? window.event.srcElement : event.target;
	return obj;
}
function caluctorTop(elem){
	return caluctor(elem,"top");
}
function caluctorLeft(elem){
	return caluctor(elem,"left");
}
function caluctor(elem,attr){
	var offsetVal = 0;
	if(attr == "top")
	{
		while(elem){
			offsetVal += elem.offsetTop;
			elem = elem.offsetParent;
		}
	}
	else
	{
		while(elem){
			offsetVal += elem.offsetLeft;
			elem = elem.offsetParent;
		}
	}
	return offsetVal;
}
判断终端类型,是手机还是PC端访问
                //判断是否是windows系统直接从IE上请求
		if (userAgent.indexOf("Windows") > 0)
		{
			window.location.href = pcUrl;
			return;
		}
		//判断是否是ANDROID手机
		else if(userAgent.indexOf("Android") > 0 || userAgent.indexOf("Adr") > 0 
				|| ("" != headerQua && "null" != headerQua && headerQua.indexOf("Android") > 0)
				|| (userAgent.indexOf("JUC") >= 0))
		{
	         location.href  = "<%=wapUrl%>";
			 return;
		}
		//判断是否是iPhone手机
		else if (userAgent.indexOf("iOS") > 0 || userAgent.indexOf("iPhone") > 0)
		{
	         location.href  = "<%=wapUrl%>";
			 return;
		}
		//判断是否是WindowsPhone手机
		else if (userAgent.indexOf("Windows Phone OS") > 0)
		{
			location.href  = "<%=wapUrl%>";
			 return;
		}
		//判断其它操作系统
		else
		{
			//如果为其他设备,则跳转到选择页面
			location.href = "<%=basePath%>chkIndex.jsp";
			return;
		}		
css兼容处理
IE6: _width:100px;
IE6/7: *width:100px;
IE9: color: #fff\9\0;
js总结
var Util = {};
Util.Event = {
	// 获取事件对象
	getEvent : function(e){
		return e || window.event;
	},
	// 获取目标对象
	getTarget : function(e){
		return e.target || e.srcElement;
	},
	// 停止冒泡事件
	stopPropagation : function(e){
		if(e.stopPropagation){
			e.stopPropagation();
		}else{
			e.cancelBubble = true;
		}
	},
	// 阻止默认事件
	preventDefault : function(e){
		if(e.preventDefault){
			e.preventDefault();
		}else{
			e.returnValue = false;
		}
	}
	// 停止事件
	stopEvent : function(e){
		// 停止冒泡
		this.stopPropagation(e);
		// 阻止默认事件
		this.preventDefault(e);
	}
};
//str.match(/\<button([^\>]+)\>([^\<]+)\<\/button\>/);
str.replace(/\<button([^\>]+)\>([^\<]+)\<\/button\>/gi,"<input$1 value='$2' />");

function trim(str){
    return str.replace(/(^\s*)|(\s*$)/g,"");
}
Global site tag (gtag.js) - Google Analytics