`

callbackData

阅读更多
道路小页面js
主页面中--打开小页面
function AddRoad(){
	art.dialog.data("road_data",{
		roads:group_road,
		callbackData:function(road){
				group_road.push(road);
				getSnowClearRoadList();
		}
	});
	art.dialog.open('page/basedata_manage/group_road_dialog.html', {
		title : '负责范围录入页面',
		lock : true,
		width : 500,
		height : 350
	});
	
}

小页面向主页面传值
var road_data;


function toSave(){
	var groupInfoRoad = $('#select_road').val();
	var startStake = $('#STAKE_START').val();
	var endStake = $('#STAKE_END').val();
	if(isNaN(startStake)){
		alert("起始桩号错误");
		return;
	}
	if(isNaN(endStake)){
		alert("终止桩号错误");
		return;
	}
	//add by guanhao 增加基本信息分组管理中设置分组范围起止桩号判断
	if(Number(startStake) >= Number(endStake)){
		alert("起始桩号不能小于终止桩号!");
		return;
	}
	if(groupInfoRoad==0||groupInfoRoad==""){
		alert("请选择道路名称!");
		return;
	}
	
	road_data.callbackData({
		groupAreaID:YMDHMS,
		//roadNumber:$("#groupInfoRoad").val(),
		deptID : $('#select_orgName').val(),
		orgName : $('#select_orgName').find("option:selected").text(),
		roadCode : $("#groupInfoRoadCode").val(),
		direction : $("#direction").val(),
		roadName: $("#select_road").find("option:selected").text(),
		startStake:$("#STAKE_START").val(),
		endStake:$("#STAKE_END").val(),
		main_mileage:$("#main_mileage").val(),//主线里程数
		ramp_mileage:$("#ramp_mileage").val(),//匝道里程数
		road_acreage:$("#road_acreage").val(),//路面面积
		lane:$("#lane").val()//车道数
	});
	art.dialog.close();
}


基本信息js(主页面)
小页面添加内容显示到主页面上成list
function getSnowClearRoadList(){
	var tab='<table style="width:100%;" cellpadding="0" cellspacing="0" class="table_two">';
	tab+= "<tbody>" +
	  	  "<tr>"+
		  "<th>序号</th>" +
		  "<th>管理处</th>" +
		  "<th>道路名称</th>" +
		  "<th>道路编号</th>" +
		  "<th>行驶方向</th>" +
		  "<th>起始桩号</th>" +
		  "<th>终止桩号</th>" +
		  "<th>主线里程数</th>" +
		  "<th>匝道里程数</th>" +
		  "<th>路面面积</th>" +
		  "<th>车道数</th>";
		  if(type!="query")
		  {
			  tab+="<th nowrap=\"nowrap\">";
			  //tab+="<input type=\"button\" value=\"添加\" onclick='AddRoad()' style=\"margin-right:5px;width:46px; height:24px\" class=\"table_butonstyle\">";
			  tab += "<span class='table1-a'><a href='#' style='margin-top:2px; float:right;' onclick='AddRoad()'><p><img src='../../images/ico1-4.png' width='16' height='16'/></p>添加</a></span>";
		  }
		  
		  "</th>" +
		  "</tr>";
		for(var i=0;i<group_road.length;i++){
			value = i+1;
			if(i%2 == 0){
				tab+="<tr class=\"table1-tr1 \" align=\"center\">";
			}else{
				tab+="<tr class=\"table1-tr2 \" align=\"center\">";
			}
			tab+="<td>"+value+"</td>";
			tab+="<td>"+group_road[i].orgName+"</td>";
			tab+="<td>"+group_road[i].roadName+"</td>";
			tab+="<td>"+group_road[i].roadCode+"</td>";
			var strdirection = group_road[i].direction;
			if(group_road[i].direction=="0")
				{
				strdirection = "上行";
				}
			else if(group_road[i].direction=="1")
				{
				strdirection = "下行";
				}
				else if(group_road[i].direction=="2")	
					{
					strdirection = "双向";
					}
			tab+="<td>"+strdirection+"</td>";
			tab+="<td>"+group_road[i].startStake+"</td>";
			tab+="<td>"+group_road[i].endStake+"</td>";
			tab+="<td>"+group_road[i].main_mileage+"</td>";
			tab+="<td>"+group_road[i].ramp_mileage+"</td>";
			tab+="<td>"+group_road[i].road_acreage+"</td>";
			tab+="<td>"+group_road[i].lane+"</td>";
			if(type!="query")
				{
				tab+="<td class='table1-a' width='80px' style='padding-left:0px;' nowrap=\"nowrap\">";
				tab+='<a href=\"#\" onclick=\"delRoad(\''+group_road[i].groupAreaID+'\');\"><p><img src=\"../../images/ico1-3.png\" width=\"16\" height=\"16\"/></p>删除</a>';
				//tab+="<input type=\"button\" value=\"删除\" style=\"margin-right:5px;width:46px; height:24px\" onclick='delRoad(\""+group_road[i].groupAreaID+"\");' class=\"table_butonstyle\">";	
				}
			
			tab+="</td>";
			tab+="</tr>";
		}

	tab+="</tbody>";
	tab+="</table>";
	$("#snowclearroadtable").html(tab);

}

主页面提交
var group_info;

function makeSure(){
	var groupleader = $("#GROUP_LEADER_ID").val();
//	var groupleadertel = $("#GROUP_LEADER_PHONE").val();
	var deputyleader = $("#deputyleader_id").val();
//	var deputyleadertel = $("#deputyleader_phone").val();
	var carleader = $("#carleader_id").val();
	var carleadertel = $("#carleader_phone").val();
	var bindingTel = $("#bindingTel").val();//绑定手机号
	var phoneName = $("#phoneName").val();//手机登录名
	var bindingCar = $("#bindingCar").val();//指挥车
	var CLEAR_CAR =$("#CLEAR_CAR").val();
	var FLAT_GROUND =$("#FLAT_GROUND").val();
	var DREDGE_MID =$("#DREDGE_MID").val();
	var ROLLING_BRUSH =$("#ROLLING_BRUSH").val();
	var DREDGE_DRAG =$("#DREDGE_DRAG").val();
	var LOAD_CAR =$("#LOAD_CAR").val();
	var DREDGE_LIQUID =$("#DREDGE_LIQUID").val();
	var THROW_SNOW_B =$("#THROW_SNOW_B").val();
	var groupName =$("#GROUP_NAME").val();
	if(groupName.length==0){
		alert("请输入组名!");
		return;
	}
	if(groupName.length > 2){
		alert("组名最多输入2个字,不能过长");
		return;
	}
	
	if(bindingTel == ""){
		alert("绑定手机号不能为空!");
		$("#bindingTel")[0].focus();
		return;
	}
	if(phoneName == ""){
		alert("手机登录名不能为空!");
		$("#phoneName")[0].focus();
		return;
	}
	if(bindingCar == ""){
		alert("指挥车牌号不能为空!");
		$("#bindingCar")[0].focus();
		return;
	}
	if(groupleader.length==0)
		{
		alert("请选择组长!");
		return;
		}
	if(group_person.length<1){
		alert("请添加组内成员");
		return;
	}
	/*if(group_car.length==0){
		alert("请添加车辆");
		return;
	}*/
	if(group_road.length==0){
		alert("请添加负责范围");
		return;
	}
	var groupType =$("#groupInfoType").val();
	if(groupType==0)
		{
		alert("请选择所属组!");
		return;
		}
	var clumpId =$("#select_clump_item_type_name").val();
	if(clumpId.length==0)
		{
		alert("请输入集合地!");
		return;
		}
	
	/*if(group_car==null||group_car.length==0)
		{
		alert("请添加除雪车辆!");
		return;
		}*/
	if(group_road==null||group_road.length==0)
		{
		alert("请添加负责范围!");
		return;
		}
/*	
	checkCommandCar();
	if(carNoflag!=true)
		{
		alert("未找到指挥车!");
		return false;
		}
	*/
	var personId=[];

	var bindingTel = $("#bindingTel").val();
	var phoneName = $("#phoneName").val();
	var bindingCar = $("#bindingCar").val();
	
	var year =$("#groupInfoYear").val();
	var groupLeaderId = "";
	var cmdStr=(type=="add"?"addGroupInfo":"updateGroupInfo");
	
	if(group_leader[0] != undefined){
		groupLeaderId = group_leader[0].personID;
	}else{
		groupLeaderId = groupleader_id;
	}
	if(type=="add")
		{
		var opts = {
				cmd : "addGroupInfo",
				groupInfo : {

					groupType : groupType,
					clumpID :	clumpId,
					groupName :	groupName,
					year :	year,
					deptID : $('#deptID', parent.parent.document).val(),//add by guanhao 增加默认管理处过滤
					bindingTel : bindingTel,
					bindingUser: phoneName,
//					groupLeaderTel : groupleadertel,
					deputyGroupLeaderID :deputygroupleaderid,
//					deputyGroupLeaderTel :deputyleadertel,
					CLEAR_CAR :CLEAR_CAR,
					FLAT_GROUND :FLAT_GROUND,
					DREDGE_MID :DREDGE_MID,
					ROLLING_BRUSH :ROLLING_BRUSH,
					DREDGE_DRAG :DREDGE_DRAG,
					LOAD_CAR :LOAD_CAR,
					DREDGE_LIQUID :DREDGE_LIQUID,
					THROW_SNOW_B :THROW_SNOW_B,
					leadingCadres :carleader,
					leadingCadresTel :carleadertel,
					commandCarNo : bindingCar,
					groupLeaderID :	groupLeaderId,//需追加判断,否则修改时该字段为非对象
					personList : [],
					/*carList : [],*/
					areaList : []
				}
		};
		}
	else{
		var opts = {
				cmd : "updateGroupInfo",
				groupInfo : {
					groupID : group_info.itemID,
					groupType : groupType,
					clumpID :	clumpId,
					groupName :	groupName,
					year :	year,
					deptID : $('#deptID', parent.parent.document).val(),//add by guanhao 增加默认管理处过滤
					bindingTel : bindingTel,
					bindingUser: phoneName,
					commandCarNo : bindingCar,
					groupLeaderID :	groupLeaderId,
//					groupLeaderTel : groupleadertel,
					deputyGroupLeaderID :deputygroupleaderid,
//					deputyGroupLeaderTel :deputyleadertel,
					CLEAR_CAR :CLEAR_CAR,
					FLAT_GROUND :FLAT_GROUND,
					DREDGE_MID :DREDGE_MID,
					ROLLING_BRUSH :ROLLING_BRUSH,
					DREDGE_DRAG :DREDGE_DRAG,
					LOAD_CAR :LOAD_CAR,
					DREDGE_LIQUID :DREDGE_LIQUID,
					THROW_SNOW_B :THROW_SNOW_B,
					leadingCadres :carleader,
					leadingCadresTel :carleadertel,
					commandCarNo : bindingCar,
					personList : [],
					/*carList : [],*/
					areaList : []
				}
		};
	}
	
	for(var i=0;i<group_person.length;i++){
		opts.groupInfo.personList.push({
			personID:group_person[i].personID
		});
	}
/*	for(var i=0;i<group_car.length;i++){
		opts.groupInfo.carList.push({
			carID:group_car[i].carID
		});
	}*/
	for(var i=0;i<group_road.length;i++){
		opts.groupInfo.areaList.push({
			groupAreaID:group_road[i].groupAreaID,
//			roadNumber:group_road[i].roadNumber,
			roadCode : group_road[i].roadCode,
			direction :group_road[i].direction,
			roadName:group_road[i].roadName,
			startStake:group_road[i].startStake,
			endStake:group_road[i].endStake,
			/**add by yuml start**/
			main_mileage:group_road[i].main_mileage,
			ramp_mileage:group_road[i].ramp_mileage,
			road_acreage:group_road[i].road_acreage,
			deptID:group_road[i].deptID,
			orgName:group_road[i].orgName,
			lane:group_road[i].lane
			/**add by yuml end**/
			
		});
	}
	$.ajax({
		url:"../../snowBasicinfo",
//		data: JSON.stringify(opts),
		data: $.toJSON(opts),
		type:"post",
		dataType:"json",
		success:function(data) {
			var result = data.result;
			var reason = data.reason;
			if("OK"==result){
			alert(type=="add"?"添加成功!":"修改成功!");
			
			group_info.flashList();
			art.dialog.close();
			
			}else{
				alert(reason);
				return;
			}
		},
		error:function(msg){
			alert(msg);
		}
	});
}

打开主页面的初始化 判断
var type;
var carNoflag = false;
function init(){
	//封装好的下拉框,自动查询YRPT_CODING自检表,参数(SCOPE,页面控件ID)
	type=art.dialog.data("type");
	if(type=="add"){
		initLoad("group_type","#groupInfoType");
		initLoad("year","#groupInfoYear");
		group_info=art.dialog.data("flashList");
		getGroupPersonList();//获得组内成员的list
		/*getSnowClearCarList();//获得除雪车辆的list
*/		getSnowClearRoadList();//获得负责范围的list
	}else if(type=="query"){
		initLoad("group_type","#groupInfoType");
		initLoad("year","#groupInfoYear");
		var groupId=art.dialog.data("itemID");
		getGroupId(groupId);
		$("#add").css("display","none");
		$("#cancel").css("display","none");
		$("#personadd").css("display","none");
		$("#selectleader").css("display","none");
		$("#selectleader2").css("display","none");
		$("#selectleader3").css("display","none");
		
		$("#groupInfoType").attr({disabled : "disabled"});
		$("#GROUP_NAME").attr({disabled : "disabled"});
		$("#select_clump_item_type_name").attr({disabled : "disabled"});
		$("#groupInfoYear").attr({disabled : "disabled"});
		$("#group_leader_txt").attr({disabled : "disabled"});
		$("#bindingTel").attr({disabled : "disabled"});
		$("#phoneName").attr({disabled : "disabled"});
		$("#bindingCar").attr({disabled : "disabled"});
		$("#GROUP_LEADER_PHONE").attr({disabled : "disabled"});
		$("#deputyleader_id").attr({disabled : "disabled"});
		$("#deputyleader_phone").attr({disabled : "disabled"});
		$("#carleader_id").attr({disabled : "disabled"});
		$("#carleader_phone").attr({disabled : "disabled"});
		$("#GROUP_LEADER_ID").attr({disabled : "disabled"});
		
		$("#CLEAR_CAR").attr({disabled : "disabled"});
		$("#FLAT_GROUND").attr({disabled : "disabled"});
		$("#DREDGE_MID").attr({disabled : "disabled"});
		$("#ROLLING_BRUSH").attr({disabled : "disabled"});
		$("#LOAD_CAR").attr({disabled : "disabled"});
		$("#DREDGE_DRAG").attr({disabled : "disabled"});
		$("#DREDGE_LIQUID").attr({disabled : "disabled"});
		$("#THROW_SNOW_B").attr({disabled : "disabled"});
		
	}
	else if(type=="update")
	{
		initLoad("group_type","#groupInfoType");
		initLoad("year","#groupInfoYear");
		group_info=art.dialog.data("flashList");
		var groupId=group_info.itemID;
		getGroupId(groupId);
	}
}

查询主页面
function getGroupId(groupId){
	var opts = {cmd : "queryGroupInfoNow",
			groupInfo : {
				groupID : groupId,
				pos:0
			}
	};
	
	$.ajax({
			url:"../../snowBasicinfo",
			data: $.toJSON(opts),
			type:"post",
			dataType:"json",
			success:function(data) {
				var result = data.result;
				var reason = data.reason;
				if("OK"==result){
					if(data.groupInfoList!=null){
						if(data.groupInfoList.length>0){
							group_person=data.groupInfoList[0].personList;
							group_car=data.groupInfoList[0].carList;
							group_road=data.groupInfoList[0].areaList;
							groupleader_id=data.groupInfoList[0].groupLeaderID;
							deputygroupleaderid=data.groupInfoList[0].deputyGroupLeaderID;
							leadingCadres=data.groupInfoList[0].leadingCadres;
							groupleader_name = data.groupInfoList[0].groupLeaderName;
							getGroupPersonList();//获得组内成员的list
							/*getSnowClearCarList();//获得除雪车辆的list
*/							getSnowClearRoadList();//获得负责范围的list
							$("#groupInfoType").val(data.groupInfoList[0].groupType);
							$("#GROUP_NAME").val(data.groupInfoList[0].groupName);
							$("#select_clump_item_type_name").val(data.groupInfoList[0].clumpName);
							$("#groupInfoYear").val(data.groupInfoList[0].year);
							$("#GROUP_LEADER_ID").val(data.groupInfoList[0].groupLeaderName);
//							$("#GROUP_LEADER_PHONE").val(data.groupInfoList[0].groupLeaderTel);
							$("#deputyleader_id").val(data.groupInfoList[0].deputyGroupLeaderName);
//							$("#deputyleader_phone").val(data.groupInfoList[0].deputyGroupLeaderTel);
							$("#carleader_id").val(data.groupInfoList[0].leadingCadres);
							$("#carleader_phone").val(data.groupInfoList[0].leadingCadresTel);
							$("#bindingTel").val(data.groupInfoList[0].bindingTel);
							$("#phoneName").val(data.groupInfoList[0].bindingUser);
							$("#bindingCar").val(data.groupInfoList[0].commandCarNo);
							
							$("#CLEAR_CAR").val(data.groupInfoList[0].CLEAR_CAR);
							$("#FLAT_GROUND").val(data.groupInfoList[0].FLAT_GROUND);
							$("#DREDGE_MID").val(data.groupInfoList[0].DREDGE_MID);
							$("#ROLLING_BRUSH").val(data.groupInfoList[0].ROLLING_BRUSH);
							$("#DREDGE_DRAG").val(data.groupInfoList[0].DREDGE_DRAG);
							$("#LOAD_CAR").val(data.groupInfoList[0].LOAD_CAR);
							$("#DREDGE_LIQUID").val(data.groupInfoList[0].DREDGE_LIQUID);
							$("#THROW_SNOW_B").val(data.groupInfoList[0].THROW_SNOW_B);
						}
					}	
				}else{
					alert(reason);
				}
			},
			
			error:function(msg){
				alert(msg);
			}
		});
}
分享到:
评论

相关推荐

    layui 弹出层回调获取弹出层数据的例子

    关键代码在于 `yes` 回调函数内部,通过 `window["layui-layer-iframe" + index].callbackdata()` 获取弹出层返回的数据。这里的 `callbackdata` 是弹出层内部定义的一个函数,它负责返回我们需要的数据。例如: ``...

    angluo-javascript-237653.pdf

    这里,`window["layui-layer-iframe" + index]` 指向弹出层内的iframe,而`callbackdata()` 是弹出层页面中定义的一个函数,用于返回所需的数据。`res` 变量则保存了这个函数的返回值。 弹出层中的JavaScript代码...

    LabCVI 的一个工具

    void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: QuitUserInterface (0); break; } return 0; } int CVICALLBACK GRAPHCallback (int panel, int control, ...

    layui 弹出层值回传解决方式

    如下所示: layer.open({ type: 2, title: "设置围栏", shadeClose: true, shade: 0.4, area: ['90%', '90%'], content: "/ElectronicFence/Map?id=" + id + "&shapeType=" + shapeType, ...

    SN_STATIONE

    void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: QuitUserInterface (0); break; } return 0; } int CVICALLBACK START_WRT (int panel, int ...

    Flash头像上传剪裁预览组件 v2.0.rar

    1.多增加js 回调函数参数 picUrl,callbackdata picUrl:后端图片路径 callbackdata:后端返回数据 2.新增加后端 保留图片路径 savePath (默认当前路径) 3.新增加后端 保存图片名称 savePicName(默认是时间戳) ...

    layer.open回调获取弹出层参数的实现方法

    如下所示: layer.open({ type : 2, title : '重命名', maxmin : true, ... area : [ '200px', '150px' ], content : getContext() + /node/torenamenode?.../callbackdata是弹出层的方法,返回参数 var node

    半透明万年历,丰富的窗体自定制功能,Delphi源码.rar

    Delphi编写的万年历,单就万年历来说,功能已经相当...其中 callback 为回调函数,以检查是否根据应用程序确定的条件停止绘图,callbackData 回调函数附加数据指针。程序作者:湖北省公安县统计局,毛泽发,于大连。

    C#-GDI+编程之基础篇.doc

    其中,thumbWidth 和 thumbHeight 分别是缩略图的宽度和高度,callback 是一个 Image.GetThumbnailImageAbort 委托,callbackData 是一个 IntPtr 类型的参数。 如果前两个参数(即宽度和高度)都为 0,那么,GDI+ ...

    labWindow 安全队列.docx

    `CmtInstallTSQCallback (CmtTSQHandle queueHandle, unsigned int event, int thresholdValue, CmtTSQCallbackPtr callback, void *callbackData)` 其中,`queueHandle` 是队列的句柄,`event` 是事件类型,`...

    XP下依然能实现界面透明

    base.DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit, imageAttr, callback, callbackData); } } } ``` 步骤三:动画处理 创建一个Timer控件,用于定时更新小鱼的位置,从而实现动态效果...

    springboot整合阿里云oss进行文件上传

    public Mono&lt;String&gt; uploadCallback(@RequestParam("callbackData") String callbackData) { // 这里可以实现自定义的回调逻辑,例如存储文件元数据到数据库 // ... return Mono.just("Callback received"); }...

    Cambricon-CNPAPI-Developer-Guide-CN-v1.11.0.pdf

    - cnpapi_CallbackData是回调函数的数据结构,用于传递事件或数据给用户定义的回调函数。 这些数据类型的定义使得开发者能够正确地构造和解析CNPAPI的调用,以获取所需的性能数据。 总之,寒武纪CNPAPI开发者指南...

    利用Labwindows调用VC++函数.docx

    int CVICALLBACK JISUAN (int panel, int control, int event,void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: SetCtrlVal(panelHandle, PANEL_NUMERIC, add(3, 5)...

    获取layer.open弹出层的返回值方法

    `window["layui-layer-iframe" + index]`是获取弹出层iframe的引用,`callbackdata()`则是调用弹出层内部定义的返回值函数。 在弹出层的HTML页面中,我们需要定义这个`callbackdata`函数,例如: ```html var ...

    Fasm大神分享的一些CVI代码.txt

    int CVICALLBACK MainProc(int panelHandle, int event, void* callbackData, int eventData1, int eventData2); HWND ExecProcess(const char* szProcessName, char* CommandLine, int ShowMode); ``` 这两个...

    android中的webview --实现java与js交互

    String callbackData = url.substring("javascript:".length()); // 这里处理数据,例如解析JSON等 return true; // 阻止默认处理 } else { // 其他URL处理,可能需要跳转到其他页面 return super....

    大神分享-Android Account 系统文档分析

    - `addAccount(String authTokenType, String accountType, boolean expectActivity, AccountAuthenticatorResponse response, Bundle options, Activity activity, Handler handler, Bundle callbackData, ...

Global site tag (gtag.js) - Google Analytics