道路小页面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);
}
});
}