验证中...
Languages: JavaScript
Categories: jQuery 插件
Latest update 2018-05-08 18:01
图幅号定位
Raw Copy
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463
/**
*综合查询
*
* @class ForeStar.App.testWidget
* @extends ForeStar.App.BizWidget
*/
Forestar.App.zhcxWidget = Forestar.Class(Forestar.App.BizWidget, {
result:null,//汇总统计数据集
zhcxWidget: null,
selectLayer: null,
map:null,
LING_ZU:null,
Q_SQ_D:null,
isDrawPolygon:false,
geometry:null,
drawTool : null,// 绘图工具
drawGeo : null,// 绘制图形
_drawLayer : null,// 高亮图层
polygonSymbol : null,// 高亮面符号
where:null,
isDrawPolygon : false, // 标记是否是线
isFullScreen:false,//表格是否全屏
fieldHtml:null,
valueHtml:null,
myHtml:null,
drawType:null,
codName_Edit:null,
isReg:false,
queryForm:null,
_highlighLayer:null,
/**
* 综合查询 的表头, 需要翻译的字段 等
*/
zhcx_page:{},
/**
* 回调函数optionFunc
*/
optionFunc : {},
/** 初始化 */
initialize: function() {
Forestar.App.BizWidget.prototype.initialize.apply(this,
arguments);
Forestar.App.zhcxWidget.instance = this;
/*var fieldHtml;
var valueHtml;
var myHtml;*/
var outlineSyml = new esri.symbol.SimpleLineSymbol(
esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([
255, 0, 0, 0.5
]), 2);
/*var outlineSyml = new esri.symbol.SimpleLineSymbol(
esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([255, 0, 0, 1]), 0.5);
this.polygonSymbol = new esri.symbol.SimpleFillSymbol(
esri.symbol.SimpleFillSymbol.STYLE_SOLID, outlineSyml,
new dojo.Color([255, 255, 0, 0.3]));*/
Forestar.App.zhcxWidget.instance.LineSymbol = outlineSyml;
Forestar.App.zhcxWidget.instance.polygonSymbol = new esri.symbol.SimpleFillSymbol(
esri.symbol.SimpleFillSymbol.STYLE_SOLID, outlineSyml,
new dojo.Color([255, 0, 0, 0.3]));
//控制弹框的显示隐藏
$("#add_zhcx_ .ibox-close").on("click",function(){
$("#add_zhcx_").hide();
})
$("#addCondition").on("click",function(){
Forestar.App.zhcxWidget.instance.addCond();
$("#add_zhcx_").show();
})
/*this.setHeight();
//加载地图
var test_map = Forestar.MapUtil.createMap("zhcx-map");
// Forestar.MapUtil.addNavigationTool("zhcx-map",test_map);
var obj={
S_URL:Config.layerCfg.BaseLayer[1].Service[0].S_URL,
S_VISIBILITY:Config.layerCfg.BaseLayer[1].Service[0].S_VISIBILITY,
S_OPACITY:1,
S_TYPE:"ESRI_TILE"
}
var _layer = this.getLayer(obj);
test_map.addLayer(_layer);
this.selectLayer = new esri.layers.GraphicsLayer();
test_map.addLayer(this.selectLayer);
Forestar.App.zhcxWidget.instance.map=test_map;*/
/* 绑定事件 传递this */
var onSuccessFn = Forestar.Function.bind(this._onRpcSuccess, this);
var onFaultFn = Forestar.Function.bind(this._onRpcFail, this);
// 回调方法
this.optionFunc = {
callback : onSuccessFn,
exceptionHandler : onFaultFn
}
this.initParams();
//查询时绑定事件
this.cxBind();
$("#fore-2d3d-side-zhcx-body #tubiao .map-table-control .max").click(function(){//全屏
Forestar.App.zhcxWidget.instance.fullScreenFun()
//重新加载 下滚动条的方法
$("#reportTable tbody").niceScroll({
cursorcolor: "#777",
cursorborder: "none",
cursorwidth:"8px",
});
});
$("#fore-2d3d-side-zhcx-body #tubiao .map-table-control .restore").click(function(){//还原
Forestar.App.zhcxWidget.instance.restoreFun()
$("#reportTable tbody").niceScroll({
cursorcolor: "#777",
cursorborder: "none",
cursorwidth:"8px"
});
});
$("#fore-2d3d-side-zhcx-body #tubiao .map-table-control .down").click(function(){//最小化
Forestar.App.zhcxWidget.instance.minimize()
});
$("#zhcxSmall_resetBtn i").click(function(){//全屏的单击事件
Forestar.App.zhcxWidget.instance.tableSmallFun()
});
$("#zhcxSmall_resetBtn b").click(function(){//全屏的单击事件
$("#zhcxSmall_resetBtn").hide();
$("#tubiao").hide();
$("#tubiao").css({height:'300px',opacity:'1'});
});
//考虑到 需要在三维下对二维地图做操作,先派发在取消
Forestar.App.zhcxWidget.instance.drawType="spPolygon";
Forestar.App.zhcxWidget.instance.drawStar("spPolygon",true);
// Forestar.App.zhcxWidget.instance.drawTool.deactivate();
$("#chartCont ul li").click(function(){//统计类型的切换方法
$(this).addClass("selected").siblings().removeClass("selected");
var id=$(this).attr("href");
id=id.substr(1,id.length-1);
$("#"+id).show().siblings().hide();
});
$("#chart_show .ztxz_close").click(function(){//弹框的关闭按钮关闭事件
$(this).parent().hide();
});
this.doReset();
//获取表头等 字段
this.getZhPage();
//图幅号查询
$("#zhcx_tfhdw_search").click(function(){//弹框的关闭按钮关闭事件
Forestar.App.zhcxWidget.instance.frameNumberQuery($('#mapNewNumber').val(),$('#mapOldNumber').val());
});
//图幅号查询
$("#zhcx_tfhdw_reset").click(function(){//弹框的关闭按钮关闭事件
document.getElementById("mapNewNumber").value="";
document.getElementById("mapOldNumber").value="";
});
},
//重置方法
doReset:function(){
$(".zhcx-reset").click(function(){
var table=$("#"+this.id).parent().parent().parent();
var select=$("#"+this.id).parent().parent().parent().find("select");
var input=$("#"+this.id).parent().parent().parent().find("input");
var temp;
for(var i=0;i<select.length;i++){
$(select[i]).val("");
}
for(var j=0;j<input.length;j++){
temp=$(input[j]).attr("field");
if(temp != undefined){
$(input[j]).val("");
}
}
});
},
//初始化地图配置
getLayerConfig: function(obj, type) {
var layerObj = {
"OBJECTID": obj.OBJECTID,
"S_VIEWTYPE": "2D",
"S_NAME": "资源详情地图",
"S_LAYERNAME": "资源详情地图",
"S_TYPE": type,
"S_URL": obj.S_URL,
"S_URL3D": "",
"S_TITLE": "资源详情地图",
"S_OPACITY": 1,
"S_VISIBILITY": true,
"S_WKID": Config.wkid,
"S_MINLEVEL": parseInt(Config.mapCfg),
"S_MAXLEVEL": parseInt(Config.mapCfg),
"S_MAXEXTENT": Config.mapCfg.fullExtent,
"S_SEARCHENABLE": false
};
return layerObj;
},
initParams : function() {
// 初始化绘制图层
this._drawLayer = new esri.layers.GraphicsLayer({
id : "draw_Layer_zh"
});
Forestar.App.combineMap._map2D.addLayers([this._drawLayer]);
this.drawTool = new Forestar.DrawTool(Forestar.App.combineMap,
this._drawLayer);
this.events = new Forestar.Events(this, null,
this.EVENT_TYPES);
var outlineSyml = new esri.symbol.SimpleLineSymbol(
esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([0, 0, 255, 0.5]), 2);
this.polygonSymbol = new esri.symbol.SimpleFillSymbol(
esri.symbol.SimpleFillSymbol.STYLE_SOLID, outlineSyml,
new dojo.Color([0, 0, 255, 0.4]));
AppEvent.addEventListener(AppEvent.CLEAN, this, this.cleanFn);
},
cleanFn : function() {
this._drawLayer.clear();
if (this.drawTool)
this.drawTool.deactivate();
},
getLayer : function(layerCfg)
{
var _layer = null;
switch (layerCfg.S_TYPE)
{
case "GEO_WMTS" : // GeoGlobe 切片
_layer = new esri.GeoTiledMapServiceLayer({
id : layerCfg.OBJECTID,
visible : layerCfg.S_VISIBILITY,
wkid : Config.wkid,
url : layerCfg.S_URL,
layerName:layerCfg.S_LAYERNAME
});
break;
case "MZ_IMAGE" : // Apache 切片服务
_layer = new esri.MapZoneTiledMapServiceLayer({
id : layerCfg.OBJECTID,
visible : layerCfg.S_VISIBILITY,
wkid : Config.wkid,
url : layerCfg.S_URL,
maxExtent : layerCfg.S_MAXEXTENT
})
break;
case "OGC_WMS" : // Arcgis WMS 服务
var layer_lqxb = new esri.layers.WMSLayerInfo({
name : "0",
title : "LQXB"
});
var resourceInfo = {
extent : this.extent,
layerInfos : [layer_lqxb]
};
_layer = new esri.layers.WMSLayer(layerCfg.S_URL, {
id : layerCfg.OBJECTID,
resourceInfo : resourceInfo,
visibleLayers : layerCfg.S_LAYERS,
visible : layerCfg.S_VISIBILITY
});
break;
case "ESRI_DYNAMIC_SERVICE" : // Arcgis 发布的 动态服务
_layer = new esri.layers.ArcGISDynamicMapServiceLayer(
layerCfg.S_URL, {
id : layerCfg.OBJECTID,
visible : layerCfg.S_VISIBILITY,
opacity : layerCfg.S_OPACITY
});
//设置图层的范围权限条件 韩敏修改
if(Config.layer_extent_DefinitionObj && Config.layer_extent_DefinitionObj[layerCfg.S_LAYERNAME])
{
_layer.setMap(Forestar.App.combineMap);
var layer = _layer.getInstance()._instance;
layer.setLayerDefinitions(Config.layer_extent_DefinitionObj[layerCfg.S_LAYERNAME]);
}
break;
case "ESRI_TILE" : // Arcgis Tile 瓦片服务
var ESRI_TILE_Option = {
id : layerCfg.OBJECTID,
visible : layerCfg.S_VISIBILITY,
opacity : layerCfg.S_OPACITY
};
_layer = new esri.layers.ArcGISTiledMapServiceLayer(
layerCfg.S_URL, ESRI_TILE_Option);
break;
}
return _layer;
},
hideLine:function(){
$("#test_content").hide();
},
cxBind:function(){
//绑定画图事件
$("#zhcx-spPolygon").off("click").on("click", function() {
Forestar.App.zhcxWidget.instance.isDrawPolygon = true;
Forestar.App.zhcxWidget.instance.drawType="spPolygon";
Forestar.App.zhcxWidget.instance.drawStar("spPolygon");
});
// 绘制线
$("#spPolyLine").off("click").on("click", function() {
Forestar.App.zhcxWidget.instance.isDrawPolygon = false;
Forestar.App.zhcxWidget.instance.drawType="spPolyLine";
Forestar.App.zhcxWidget.instance.drawStar("spPolyLine");
});
// 绘制点
$("#spPoint").off("click").on("click", function() {
Forestar.App.zhcxWidget.instance.isDrawPolygon = false;
Forestar.App.zhcxWidget.instance.drawType="spPoint";
Forestar.App.zhcxWidget.instance.drawStar("spPoint");
});
$("#zhcx-lz li a ").off("click").on("click",function(){
/*$("#zhcx-lz li a").each(function(){
if($(this).hasClass("zhcx-selected")){
$(this).removeClass("zhcx-selected");
};
});*/
if($(this).hasClass("zhcx-selected")){
$(this).removeClass("zhcx-selected");
}else{
$(this).addClass("zhcx-selected");
}
});
$("#zhcx-sqdj li a ").off("click").on("click",function(){
if($(this).hasClass("zhcx-selected")){
$(this).removeClass("zhcx-selected");
}else{
$(this).addClass("zhcx-selected");
}
});
$("#zhcx-query").off("click").on("click",this.getWhere);
//综合查询的 重置
$("#zhcx-reset").unbind().bind("click",function(){
//1.清除查询的条件
$(".condNameList .close").trigger("click");
//2.清除查询的绘画事件和绘画图
if(Forestar.App.zhcxWidget.instance.drawTool){
Forestar.App.zhcxWidget.instance.drawTool.deactivate();
AppEvent.removeEventListener("ondrawend", this,
this.onDrawEndHandler);
Forestar.App.zhcxWidget.instance._drawLayer.clear();
Forestar.App.zhcxWidget.instance.geometry=null;
}
//3.清除查询结果中的数据 只保留表头
if(Forestar.App.getTableData.instance.columns){
Forestar.App.getTableData.instance.initReport(Forestar.App.getTableData.instance.columns);
}
Forestar.App.zhcxWidget.instance.result=null;
});
},
//新版本查询
getWhere:function(){
Forestar.App.getTableData.instance.tableName="LDGX2_P";
var where="1=1";
//加 查询时的政区 过滤 by zzq 20170807
if(PageOnLoad.zqCode.length==6){
//县级用户
where+=" and XIAN='"+PageOnLoad.zqCode+"'";
}else if(PageOnLoad.zqCode.length==4){
//市级用户 小班表里无 SHI字段
where+=" and XIAN like'%"+PageOnLoad.zqCode+"%'";
}
var list = $(".condNameList").children();
/*if(list.length<1){
alert('条件为空,请选择条件之后查询!');
return;
}*/
//openAlert();
var userId = PageOnLoad.userId;//动态的用户Id
var arr = [];
for (var i = 0; i < list.length; i++) {
var t = $(list[i]).text();
t = t.replace('×', '')
arr.push("'"+t+"'");
}
if(arr.length>0){
var condNames = arr.toString();
//console.log(sql)
var queryFilter = {
whereString : "NAME in ("+condNames+") and USERNAME = '"+PageOnLoad.userName+"'"
};
FsService.getEntityList("ZHCX_GJCX_CXLB_TB",queryFilter,{callback:function(res){
for(var i =0;i<res.length;i++){
var resDatas = res[i].originalObjects;
var cxSql = resDatas.CX_SQL;//sql语句
where +=" and ("+cxSql+")";
//保存次数
var countNum = resDatas.COUNTID+1;
/*var name = resDatas.NAME;
var userID = resDatas.USERID;*/
var pkId = resDatas.ID;
var updateFilter = {whereString:"ID = "+pkId,setFields:"COUNTID = "+countNum};
FsService.update("ZHCX_GJCX_CXLB_TB",updateFilter ,{callback:function(e){},exceptionHandler:function(evt){
alert("更新失败("+msg+")");
}});
}
var whereString={where:where+"",geometry:null};
if(Forestar.App.zhcxWidget.instance.geometry){
whereString.geometry=Forestar.App.zhcxWidget.instance.geometry;
}
openAlert();
Forestar.App.zhcxWidget.instance.doQuery(whereString);
},exceptionHandler:function(evt){
alert("查找数据出错("+msg+")");
}});
}else{
// var where = "1=1";
var whereString={where:where+"",geometry:null};
if(Forestar.App.zhcxWidget.instance.geometry){
whereString.geometry=Forestar.App.zhcxWidget.instance.geometry;
}
if(whereString.geometry==null){
alert('条件为空,请选择条件之后查询!');
return;
}
openAlert();
Forestar.App.zhcxWidget.instance.doQuery(whereString);
}
//初始化汇总列表
//new Forestar.App.setChartWidget();
},
//老版本的查询
/*getWhere:function(){
var where="1=1";
$("#zhcx-lz a").each(function(){
if($(this).hasClass("selected")){
var value=$(this).attr("value");
where+=" and LING_ZU='"+value+"'";
};
});
$("#zhcx-sqdj a").each(function(){
if($(this).hasClass("selected")){
var value=$(this).attr("value");
where+=" and Q_SQ_D='"+value+"'";
};
});
//加政区
if(Config.zqdwObj){
var code=Config.zqdwObj.zqcode;
if(code.length==2){
where+=" and SHENG='"+code+"'";
}else if(code.length==4){
where+=" and XIAN like'%"+code+"%'";
}else if(code.length==6){
where+=" and XIAN='"+code+"'";
}else if(code.length==9){
where+=" and XIANG='"+code+"'";
}else if(code.length==12){
where+=" and CUN='"+code+"'";
}
}
var likeValue=$("#zhcx-search").val();
if(likeValue){
where +=" and ("+Config.likeField[0]+" like '%"+likeValue+"%'";
if(Config.likeField.length>1){
for(var i=1;i<Config.likeField.length;i++){
where+=" or "+Config.likeField[i]+" like '%"+likeValue+"%'";
}
}
where+=")"
}
var whereString={where:where,geometry:null};
if(Forestar.App.zhcxWidget.instance.geometry){
whereString.geometry=Forestar.App.zhcxWidget.instance.geometry;
}
Forestar.App.zhcxWidget.instance.doQuery(whereString);
},*/
doQuery:function(where){
// openAlert("正在查询,请稍后...",1000000);
var queryParam={};
queryParam.returnGeometry ="true";
queryParam.outFields = "*";
queryParam.where = where.where;
if (where.geometry) {
switch (where.geometry.type) {
case "point" :
queryParam.geometryType = "esriGeometryPoint";
break;
case "polyline" :
queryParam.geometryType = "esriGeometryPolyline";
break;
case "extent" :
queryParam.geometryType = "esriGeometryEnvelope";
break;
case "circle" :
queryParam.geometryType = "esriGeometryPolygon";
break;
case "polygon" :
queryParam.geometryType = "esriGeometryPolygon";
break;
}
queryParam.geometry = dojo.toJson(where.geometry, true);
}else{
Forestar.App.zhcxWidget.instance.where=where.where;
}
// 分页信息
var pageInfo = {};
pageInfo.pageIndex = 1;
pageInfo.pageSize = 1000;
queryParam.queryType = "QUERY";
queryParam.queryLayerId ="0";
/* if(!where.geometry){
where.where+=" and rownum<2001";
var qf={whereString:where.where,
addCaptionField:true};
Forestar.App.zhcxWidget.instance.where=qf.whereString;
FsService.getEntityList("LDGX2_P",qf,this.optionFunc);
}else{*/
Forestar.App.zhcxWidget.instance.queryForm=queryParam;
Forestar.App.getTableData.instance.queryForm=queryParam;
Forestar.App.pageTableData.instance.queryParam=queryParam;
Forestar.App.pageTableData.instance._onRpcSuccess(null,"reportTable");
/*FsService.query("LDGX2_P", queryParam,
null, pageInfo, true,
this.optionFunc);*/
/*}*/
},
drawStar : function(type,flag) {
// 激活绘图工具
/* if (Forestar.App.combineMap.currentView == "3D") {
AppEvent.dispatchEvent(AppEvent.SWITCH_VIEW, '');
}*/
AppEvent.dispatchEvent(AppEvent.CLEAN);
Forestar.App.CleanWidget.onClick();
this._drawLayer.clear();
if (this.drawTool){
this.drawTool.deactivate();
}
/*if(util.switchNum=="1"){
this.drawTool = new Forestar.DrawTool(Forestar.App.combineMap, this._drawLayer);
}else{
this.drawTool = new Forestar.DrawTool(Forestar.App.combineMap, this._drawLayer);
}*/
this.drawTool.wkid = Config.wkid;
this.drawTool.activate(Forestar.App.zhcxWidget.instance.drawType);
// this.drawTool._instance2D.fillSymbol=analysisWidget.polygonSymbol;
// this.drawTool._instance2D._instance.fillSymbol=analysisWidget.polygonSymbol//修改绘制图形后的图形样式
this.geometry = null;
AppEvent.removeEventListener("ondrawend", this,
this.onDrawEndHandler);
if(!flag){
AppEvent.addEventListener("ondrawend", this,
this.onDrawEndHandler);
}else{
this.drawTool.deactivate();
AppEvent.removeEventListener("ondrawend", this,
this.onDrawEndHandler);
}
},
onDrawEndHandler : function(drawEndEvt) {
this.drawTool.deactivate();
AppEvent.removeEventListener("ondrawend", this,
this.onDrawEndHandler);
// 绘制完毕
this.geometry = drawEndEvt.geometry;
},
_onRpcSuccess:function(result){
if($("#tubiao .map-table-control .down").attr('class').indexOf('hide')>0){
Forestar.App.zhcxWidget.instance.restoreFun();//显示查询结果
}
Forestar.App.zhcxWidget.instance.zhcx_result=result;
closeAlert();
if(!result||JSON.stringify(result) == "{}"){
if(Forestar.App.getTableData.instance.columns){
Forestar.App.getTableData.instance.initReport(Forestar.App.getTableData.instance.columns,[],'reportTable');
}else{
Forestar.App.getTableData.instance._onRpcSuccess();
}
closeAlert();
alert("查询结果为空!请重新设置查询条件!");
return;
}
var tjfxData =new Array;
for(var i=0;i<result.results.length;i++){
tjfxData.add(result.results[i].attributes);
}
Forestar.App.zhcxWidget.instance.result=tjfxData;
/*$(".zs-map-tables").addClass("on-map-max").removeClass("max hide").removeAttr("style");*/
$("#tubiao").show();
if(!result.results){
Forestar.App.getTableData.instance._onRpcSuccess(result);
}else{
Forestar.App.getTableData.instance._onRpcSuccess(result.results);
}
$("#setChart_btn").show();
$("#createChart").show();
},
_onRpcFail:function(result){
closeAlert();
alert("查询失败!");
},
/*fullScreenFun:function(){//表格的全屏方法
var height=$(window).height();
var width=$(window).width();
if(Forestar.App.getTableData.instance.isFullScreen){
$("#zhcxSmall_btn").show();
$("#setChart_btn").show();
Forestar.App.getTableData.instance.isFullScreen=false;
Forestar.App.getTableData.instance.tubHeight=292;
$("#tubiao").css({height:"300px",width:"100%",top:(height-290)+"px"});
$('#reportTable').bootstrapTable("load",Forestar.App.getTableData.instance.tubData);
}else{
Forestar.App.getTableData.instance.tubHeight=height;
$("#zhcxSmall_btn").hide();
$("#setChart_btn").hide();
$("#tubiao").css({height:height,width:width,top:"120px",left:0});
$('#reportTable').bootstrapTable("load",Forestar.App.getTableData.instance.tubData);
Forestar.App.getTableData.instance.isFullScreen=true;
}
},*/
fullScreenFun:function(){//表格的全屏方法
var height=$(window).height();
$("#fore-2d3d-side-zhcx-body #content").show();
$('#fore-2d3d-side-zhcx-body .fixed-table-container').css('height',height-195+'px');
$("#fore-2d3d-side-zhcx-body #tubiao").css('border','1px solid #487db8');
$('#fore-2d3d-side-zhcx-body #tubiao .map-table-control .max').addClass('hide');
$('#fore-2d3d-side-zhcx-body #tubiao .map-table-control .restore').removeClass('hide');
$('#fore-2d3d-side-zhcx-body #tubiao .map-table-control .down').removeClass('hide');
},
restoreFun : function(){//表格还原方法
$("#fore-2d3d-side-zhcx-body #content").show();
$('#fore-2d3d-side-zhcx-body .fixed-table-container').css('height','200px');
$("#fore-2d3d-side-zhcx-body #tubiao").css('border','1px solid #487db8');
$('#fore-2d3d-side-zhcx-body #tubiao .map-table-control .restore').addClass('hide');
$('#fore-2d3d-side-zhcx-body #tubiao .map-table-control .down').removeClass('hide');
$('#fore-2d3d-side-zhcx-body #tubiao .map-table-control .max').removeClass('hide');
},
minimize : function(){//表格最小化方法
$("#fore-2d3d-side-zhcx-body #content").css('display','none');
$("#fore-2d3d-side-zhcx-body #tubiao").css('border','0px solid #487db8');
$('#fore-2d3d-side-zhcx-body #tubiao .map-table-control .down').addClass('hide');
$('#fore-2d3d-side-zhcx-body #tubiao .map-table-control .restore').removeClass('hide');
$('#fore-2d3d-side-zhcx-body #tubiao .map-table-control .max').removeClass('hide');
},
/*isTableSmall:false,//表格最小化的判断值
tableSmallFun:function(){//表格的最小化方法
if(this.isTableSmall){
this.isTableSmall=false;
//var height=Forestar.App.getTableData.instance.tableBoxHeight-0+170;
$("#tubiao").animate({height:'300px',opacity:'1'},"slow");
$("#zhcxSmall_resetBtn").animate({opacity:'0'});
$("#zhcxSmall_resetBtn").hide();
}else{
//Forestar.App.getTableData.instance.tableBoxHeight=$("#tubiao").height();
this.isTableSmall=true;
$("#tubiao").animate({height:'0px',opacity:'0'},"slow");
$("#zhcxSmall_resetBtn").animate({opacity:'1'});
$("#zhcxSmall_resetBtn").show();
}
},*/
switchLonLat : function(e){
if(e == 'decimal'){
$(".decimal").show();
$('.LonLat').hide();
}else{
$('.LonLat').show();
$(".decimal").hide();
}
},
addCond: function(){
var a = '<div class="zs-data-table condition-table">'
+'<div class="toolbar">'
//添加政区的位置
+'<span id="zh_ZQ">市:'
+'<select class="zs-select" id="zh_shi" nextId="zh_xian" field="SHI">'
+'<option value="">--请选择--</option>'
+'</select>'
+'县:'
+'<select class="zs-select" id="zh_xian" nextId="zh_xiang" field="XIAN">'
+'<option value="">--请选择--</option>'
+'</select>'
+'乡镇:'
+'<select class="zs-select" id="zh_xiang" nextId="zh_cun" field="XIANG">'
+'<option value="">--请选择--</option>'
+'</select>'
+'村:'
+'<select class="zs-select" id="zh_cun" field="CUN">'
+'<option value="">--请选择--</option>'
+'</select>'
+'</span><br>'
//添加政区的位置
+'<span>查询字段</span>'
+'<select class="zs-select" name="zh_QueryFeild" id="zh_QueryFeild" onChange="Forestar.App.zhcxWidget.instance.optionEdit(this)" nextId="cxz" >';
var b =Forestar.App.zhcxWidget.instance.fieldHtml;
var c = '</select>'
+'<span>操作符</span>'
+'<select class="zs-select" name="czf" id="czf" onChange="Forestar.App.zhcxWidget.instance.czfOptionChange(this)">'
/*+'<option value="">-请选择-</option>'*/
+'<option value="=">等于</option>'
+'<option value="like">包含</option>'
+'</select>'
+'<span>查询值</span>'
+'<select class="zs-select" name="cxz" id="cxz" >';
var d = Forestar.App.zhcxWidget.instance.valueHtml;
var e = '</select>'
+'<input type="button" style="width:20px;height:20px" value="+" onClick="Forestar.App.zhcxWidget.instance.addCondition()"/>'
+ '</div>'
+ '<div class="container">'
+ '<table>'
+ '<thead>'
+ '<tr>'
+ '<th>查询字段</th>'
+ '<th>操作符</th>'
+ '<th>查询值</th>'
+ '<th>逻辑关系</th>'
+ '<th>操作</th>'
+ '</tr>'
+ '</thead>'
+ '<tbody id="conditionCenter" >'
+ '</tbody>'
+ '<tfoot>'
+ '<tr class="btn-line">'
+ '<td colspan="5">'
+ '<span id="con_Name" style="float:left;">'
+ '<span>条件名称</span>'
+ '<input type="text" class="zs-input" id="conditionName">'
+ '</span>'
+ '<span style="float:right;">'
+ '<input type="button" isadd="true" id="saveCondition" value="保存" class="zs-btn save-data" onClick="Forestar.App.zhcxWidget.instance.saveCondition()"/>'
+ '<input type="button" id="closeCondition" value="关闭" class="zs-btn reset ibox-close cancel-change" />'
+ '</span>'
+ '</td>'
+ '</tr>'
+ '</tfoot>'
+ '</table>'
+ '</div>'
+'</div>'
Forestar.App.zhcxWidget.instance.myHtml = a+b+c+d+e;
// $("#add_zhcx_ .my_Ibox_").empty();
// $("#add_zhcx_ .my_Ibox_").append(Forestar.App.zhcxWidget.instance.myHtml);
//绑定 市 县 乡 改变时 的事件
Forestar.App.dmcxWidget.instance.bindChange();
/* 初始化时加载市的数据*/
Forestar.App.dmcxWidget.instance.getShi();
$("#add_zhcx_ #closeCondition").on("click",function(){
$("#add_zhcx_").hide();
})
/*if(Config.loadCount<2){*/
/*$("#condTable #addCondition").iBox({
title: "条件设置",
requestType: "ajax",
overlay: false,
showMin:false,
isLocal:true,
myHtml:Forestar.App.zhcxWidget.instance.myHtml,
target: "./help/_add-condition.html"
})
$("#conditionDataBody .condEdit").iBox({
title: "条件设置",
requestType: "ajax",
overlay: false,
showMin:false,
isLocal:true,
myHtml:Forestar.App.zhcxWidget.instance.myHtml,
target: "./help/_add-condition.html"
})*/
/*}*/
},
//查询注册表获取字段,并给查询字段的option赋值
assignmentQuery:function(){
var queryFilter = {
whereString : "S_TABLEID='LDGX2_P' and S_CODETABLEPK is not null and S_CODETABLEPK != 'FL_SYS_ZQSJZD_QM_V'",
selectFields : "S_FIELDALIASNAME,S_FIELDNAME,S_CODETABLEPK,S_CODETABLEWHERE,I_FIELDID",
orderByString : "I_FIELDID"
};
Config.loadCount++;
FsService.getEntityList("FS_DATA_TABLEMETADATA",queryFilter,{callback:function(res){
var zh_QueryFeild = $("#zh_QueryFeild");
var html = '';
for(var i = 0;i<res.length;i++){
var resDataName = res[i].originalObjects.S_FIELDALIASNAME;//option的text值
var resDataValue = res[i].originalObjects.S_FIELDNAME;//option的value值
var resDataTableName = res[i].originalObjects.S_CODETABLEPK;//option的tableName值
var resDataWhereStr = res[i].originalObjects.S_CODETABLEWHERE;//option的翻译的条件值
if(resDataWhereStr.indexOf(">") >0){//说明whereStr中包含>符号
resDataWhereStr = resDataWhereStr.replace('>', '&g');
resDataWhereStr = '"'+resDataWhereStr+'"';
}
//var dataObject = {'resDataName':resDataName,'resDataValue':resDataValue,'resDataWhereStr':resDataWhereStr,'resDataTableName':resDataTableName};
//html += "<option value="+dataObject+">"+resDataName+"</option>";
html += "<option value="+resDataValue+" tableName="+resDataTableName+" whereString="+resDataWhereStr+">"+resDataName+"</option>"
}
Forestar.App.zhcxWidget.instance.fieldHtml=html;
zh_QueryFeild.append(html);//把查询结果放到option中
//设置查询值的默认(根据操作符的默认为'等于',则查询值的默认为等于的值)
var cxf_WhereString = res[0].originalObjects.S_CODETABLEWHERE;
/* var cxf_WhereString = res[0].originalObjects.S_CODETABLEWHERE+" AND L_JB=4";
*/ FsService.getEntityList(res[0].originalObjects.S_CODETABLEPK,{whereString:cxf_WhereString},{callback:function(res){
var cxz = $("#cxz");
cxz.empty();//清空option,重新赋值
var optionHtml = '';
for(var i = 0;i<res.length;i++){
var resDataName = res[i].originalObjects.C_NAME;//option的text值
var resDataValue = res[i].originalObjects.C_CODE;//option的value值
optionHtml += "<option value='"+resDataValue+"'>"+resDataName+"</option>";
}
Forestar.App.zhcxWidget.instance.valueHtml=optionHtml;
cxz.append(optionHtml);//把查询结果放到option中
Forestar.App.zhcxWidget.instance.addCond();
},exceptionHandler:function(evt){
alert("查找数据出错("+msg+")");
}})
},exceptionHandler:function(evt){
alert("查找数据出错("+msg+")");
}});
},
//当操作符发生变化时
czfOptionChange: function(e) {
//设置默认值
var selValue=e.value;
$(e).children("[value='"+selValue+"']").attr("selected","selected").siblings().removeAttr("selected")
//判断是哪里的操作符发生变化,true是列表中,false是上面条件的
if($(e).parent().attr('class')=="operation"){
var cxz = $(e).parent().parent().find("[name='cxz']");
var czf = e.value;
var selectData = $(e).parent().parent().find("[name='zh_QueryFeild']").children("[selected='selected']");
}else{
var cxz = $(e).siblings("[name='cxz']");
var czf = e.value;
if(!$(e).siblings("[name='zh_QueryFeild']").children("[selected='selected']").val()){
var selectData = $('#zh_QueryFeild option:selected');
}else{
var selectData = $(e).siblings("[name='zh_QueryFeild']").children("[selected='selected']");
}
}
var selectName = selectData.text(); //字段名
var selectValue = selectData.val(); //字段值
var selectTableName = selectData.attr('tableName'); //翻译表名
var selectWhereStr = selectData.attr('whereString'); //翻译条件
if (selectWhereStr.indexOf("&g") > 0) {
selectWhereStr = selectWhereStr.replace('&g', '>').replace('[', '').replace(']', '');
}
/*if (czf == "=") {
selectWhereStr += " AND L_JB=4";
} else if (czf == "like") {
selectWhereStr += " AND L_JB=2";
}*/
var selectQueryFilter = {
whereString: selectWhereStr
};
FsService.getEntityList(selectTableName, selectQueryFilter, {
callback: function(res) {
cxz.empty(); //清空option,重新赋值
var html = '';
if (selectTableName == "FL_SYS_ZQSJZD_QM_V") {
for (var i = 0; i < res.length; i++) {
var resDataName = res[i].originalObjects.C_ZQNAME; //option的text值
var resDataValue = res[i].originalObjects.C_ZQCODE; //option的value值
html += "<option value='" + resDataValue + "'>" + resDataName + "</option>";
}
cxz.append(html); //把查询结果放到option中
} else if (selectTableName == "FL_SYS_ZYSJZD") {
for (var i = 0; i < res.length; i++) {
var resDataName = res[i].originalObjects.C_NAME; //option的text值
var resDataValue = res[i].originalObjects.C_CODE; //option的value值
html += "<option value='" + resDataValue + "'>" + resDataName + "</option>";
}
cxz.append(html); //把查询结果放到option中
}
},
exceptionHandler: function(evt) {
alert("查找数据出错(" + msg + ")");
}
})
},
//当option查询字段值变化时:
optionEdit : function(e){
var selValue=e.value;
$(e).children("[value='"+selValue+"']").attr("selected","selected").siblings().removeAttr("selected");
var selectData = $(e).children("[selected='selected']");
var selectName = selectData.text();//字段名
var selectValue = selectData.val();//字段值
var selectTableName = selectData.attr('tableName');//翻译表名
var selectWhereStr = selectData.attr('whereString');//翻译条件
if(selectWhereStr.indexOf("&g") >0){
selectWhereStr = selectWhereStr.replace('&g', '>').replace('[', '').replace(']', '');
}
if($(e).parent().attr('class')=="queryZd"){
var cxz = $(e).parent().parent().find("[name='cxz']");
var czf = $(e).parent().parent().find("[name='czf']").val();
}else{
var cxz = $(e).siblings("[name='cxz']");
var czf = $(e).siblings("[name='czf']").val();
}
/*判断此时的操作符是什么符号*/
/*if (czf == "=") {
selectWhereStr += " AND L_JB=4";
} else if (czf == "like") {
selectWhereStr += " AND L_JB=2";
}*/
var selectQueryFilter = {
whereString : selectWhereStr
};
FsService.getEntityList(selectTableName,selectQueryFilter,{callback:function(res){
cxz.empty();//清空option,重新赋值
var html = '';
if(selectTableName == "FL_SYS_ZQSJZD_QM_V"){
for(var i = 0;i<res.length;i++){
var resDataName = res[i].originalObjects.C_ZQNAME;//option的text值
var resDataValue = res[i].originalObjects.C_ZQCODE;//option的value值
html += "<option value='"+resDataValue+"'>"+resDataName+"</option>";
}
cxz.append(html);//把查询结果放到option中
}else if(selectTableName == "FL_SYS_ZYSJZD"){
for(var i = 0;i<res.length;i++){
var resDataName = res[i].originalObjects.C_NAME;//option的text值
var resDataValue = res[i].originalObjects.C_CODE;//option的value值
html += "<option value='"+resDataValue+"'>"+resDataName+"</option>";
}
cxz.append(html);//把查询结果放到option中
}
},exceptionHandler:function(evt){
alert("查找数据出错("+msg+")");
}})
},
//新增条件时,拼接字符
addCondition :function(e){
var queryTjlen = $("#conditionCenter .queryTj").length;//查看列表中的数据量
var condition = $("#conditionCenter");//列表容器
var string = '<tr class="queryTj">';
var zdVal = $('#zh_QueryFeild').val();//查询字段值
var zdValDefault = zdVal+'" selected="selected'//查询字段值的默认值
var czfVal = $('#czf').val();//操作符
if(czfVal =="="){//如果操作符为等于时,则给=添加selected默认
var czfStr ='<option value="=" selected="selected">等于</option><option value="like">包含</option>'
}else if(czfVal =="like"){
var czfStr ='<option value="=">等于</option><option value="like" selected="selected">包含</option>'
}
var cxzVal = $('#cxz').val();//查询值
var cxzValDefault = cxzVal+'" selected="selected'//查询值的默认值
if(queryTjlen>0){//如果列表的条数大于1条时,给上一条的条件添加默认值(and)
var len = $("#conditionCenter .logicRelation").length-1;
$("#conditionCenter .logicRelation .sel")[len].value = 'and';
$("#conditionCenter .logicRelation .sel").children("[value='and']").attr("selected","selected").siblings().removeAttr("selected");
}
string +='<td class="queryZd">'
+'<select class="zs-select" name="zh_QueryFeild" onChange="Forestar.App.zhcxWidget.instance.optionEdit(this)" nextId="cxz" >'
+$("#zh_QueryFeild").html().replace(zdVal,zdValDefault)
+'</select>'
+'</td>'
+'<td class="operation">'
+'<select class="zs-select" name="czf" onChange="Forestar.App.zhcxWidget.instance.czfOptionChange(this)">'
+czfStr
+'</td>'
+'<td class="queryVal">'
+'<select class="zs-select" name="cxz" onChange="Forestar.App.zhcxWidget.instance.cxzOptionSelect(this)">'
+$("#cxz").html().replace(cxzVal,cxzValDefault)
+'</select>'
+'</td>'
+'<td class="logicRelation">'
+'<select name="gx" class="zs-select sel" onChange="Forestar.App.zhcxWidget.instance.cxzOptionSelect(this)">'
+'<option value="" >-请选择-</option>'
+'<option value="and" >并且</option>'
+'<option value="or">或</option>'
+'</select></td>'
+'<td class="del" class="del-icon icon cond_close" onClick="Forestar.App.zhcxWidget.instance.delCond(this)"></td>'
/* +'<td class="del" class="del-icon icon cond_close" onClick="Forestar.App.zhcxWidget.instance.delCond(this)">删除</td>'
*/ +'</tr>';
condition.append(string);
},
//用来处理更改列表中的查询值时,html的默认选中(用于编辑时的默认)
cxzOptionSelect:function(e){
var selValue=e.value;
$(e).children("[value='"+selValue+"']").attr("selected","selected").siblings().removeAttr("selected")
},
//保存条件
saveCondition : function(e){
var name = $("#conditionName").val();//条件名称
var isAdd = $("#saveCondition").attr('isadd');
var userId = PageOnLoad.userId;//需动态获取
var zqShiVal = $("#zh_shi").val();
var zqXianVal = $("#zh_xian").val();
var zqXiangVal = $("#zh_xiang").val();
var zqCunVal = $("#zh_cun").val();
if(!name){
alert('条件名称不能为空!');
return;
}
var queryTj = $("#conditionCenter .queryTj");//查看列表中的数据
if(queryTj.length>0){
var sql = '';
var codHtml = '';//需要存储的字符串
var zq_Sql = '';
if(zqShiVal){
zq_Sql+="XIAN like '%"+zqShiVal+"%'";//拼接sql语句
//设置当前选中的option为默认值,并删除其他的默认值
$("#zh_shi").children("[value='"+zqShiVal+"']").attr("selected","selected").siblings().removeAttr("selected")
}
if(zqXianVal){
zq_Sql+=" AND XIAN ='"+zqXianVal+"'";
$("#zh_xian").children("[value='"+zqXianVal+"']").attr("selected","selected").siblings().removeAttr("selected")
}
if(zqXiangVal){
zq_Sql+=" AND XIANG ='"+zqXiangVal.substring(zqXiangVal.length-3,zqXiangVal.length)+"'";
$("#zh_xiang").children("[value='"+zqXiangVal+"']").attr("selected","selected").siblings().removeAttr("selected")
}
if(zqCunVal){
zq_Sql+=" AND CUN ='"+zqCunVal.substring(zqCunVal.length-3,zqCunVal.length)+"'";
$("#zh_cun").children("[value='"+zqCunVal+"']").attr("selected","selected").siblings().removeAttr("selected")
}
var zqHtml = $("#zh_ZQ").html();
for(var i = 0;i<queryTj.length;i++){
if(queryTj.length>1){
if($(".queryTj .operation .zs-select")[i].value=="="){
sql += " "+$(".queryTj .queryZd .zs-select")[i].value+" "
+$(".queryTj .operation .zs-select")[i].value+" '"
+$(".queryTj .queryVal .zs-select")[i].value+"' "
+$(".queryTj .sel")[i].value;
}else if($(".queryTj .operation .zs-select")[i].value=="like"){
sql += " "+$(".queryTj .queryZd .zs-select")[i].value+" "
+$(".queryTj .operation .zs-select")[i].value+" '%"
+$(".queryTj .queryVal .zs-select")[i].value+"%' "
+$(".queryTj .sel")[i].value;
}
codHtml += queryTj[i].outerHTML;
}else{
if($(".queryTj .operation .zs-select")[i].value=="="){
sql += " "+$(".queryTj .queryZd .zs-select")[i].value+" "
+$(".queryTj .operation .zs-select")[i].value+" '"
+$(".queryTj .queryVal .zs-select")[i].value+"' "
}else if($(".queryTj .operation .zs-select")[i].value=="like"){
sql += " "+$(".queryTj .queryZd .zs-select")[i].value+" "
+$(".queryTj .operation .zs-select")[i].value+" '%"
+$(".queryTj .queryVal .zs-select")[i].value+"%' "
}
codHtml += queryTj[i].outerHTML;
}
}
//判断政区是否选择
if(zq_Sql != ''){
sql =zq_Sql+" AND "+sql;
}
if(isAdd =="true"){
FsService.getEntityList("FL_USER_QUERY_LIST",{whereString:"NAME = '"+name+"' and USERID = '"+userId+"'"},{callback:function(res){
if(res.length == 0){
var d = {};
d.NAME = name;//名称
d.CXSQL = sql;//sql语句
d.USERID = userId;//后期改成动态的用户名
d.COUNT = 0;//记录点击次数
d.CJSJ = Forestar.App.zhcxWidget.instance.getNowFormatDate();//创建时间
d.CODHTML = codHtml;//页面列表的html字符
d.ZQHTML =zqHtml;
var a = [null, d, null, null];
a = JSON.stringify(a);
FsService.save('FL_USER_QUERY_LIST',a,{callback:function(e){
alert('保存成功!');
//下面需要放到条件列表中(实时添加上的)
/*$("#tscx").toggle(1000);*/
$(".ibox-close").click()
var condList = $("#conditionDataBody");
var str = '';
str +='<tr><td class="condName" onClick="Forestar.App.zhcxWidget.instance.addQuery(this)">'
+e.currentObjects.NAME
+'</td><td class="right">'
+'<a href="javascript:;" class="edit-icon icon condEdit" onClick="Forestar.App.zhcxWidget.instance.editQuery(this)"></a>'
+'<a href="javascript:;" class="del-icon icon cond_close" onClick="Forestar.App.zhcxWidget.instance.delQuery(this)"></a>'
/*+'<input class="condEdit" type="button" name="OK" value="编辑" class="zs-btn" onClick="Forestar.App.zhcxWidget.instance.editQuery(this)"/>'
+'</td><td>'
+'<span class="cond_close" onClick="Forestar.App.zhcxWidget.instance.delQuery(this)">&times;</span>'
*/
+'</td></tr>'
condList.append(str);
$("#conditionDataBody .condEdit").iBox({
title: "条件设置",
requestType: "ajax",
overlay: false,
showMin:false,
isLocal:true,
myHtml:Forestar.App.zhcxWidget.instance.myHtml,
target: "./help/_add-condition.html"
})
},exceptionHandler:function(evt){
alert("保存数据出错("+msg+")");
}})
}else{
alert('该条件名称已存在,请修改!')
}
},exceptionHandler:function(evt){
alert("查找数据出错("+msg+")");
}
})
}else{//编辑时,查询数据库,得到主键,然后更新,不需要删除了,
FsService.getEntityList("FL_USER_QUERY_LIST",{whereString:"NAME = '"+Forestar.App.zhcxWidget.instance.codName_Edit+"' and USERID = '"+userId+"'"},{callback:function(res){
var countNum = res[0].originalObjects.COUNT;//获得次数
var o = {};
o.PK_UID = res[0].originalObjects.PK_UID;//主键
o.NAME = name;//名称
o.CXSQL = sql;//sql语句
o.USERID = userId;//后期改成动态的用户名
o.COUNT = countNum;//记录点击次数
o.CJSJ = Forestar.App.zhcxWidget.instance.getNowFormatDate();//创建时间
o.CODHTML = codHtml;//页面列表的html字符
o.ZQHTML = zqHtml;
var p = [null, o, null, null];
p = JSON.stringify(p);
FsService.del('FL_USER_QUERY_LIST',{whereString:"NAME = '"+Forestar.App.zhcxWidget.instance.codName_Edit+"' and USERID = '"+userId+"'"},{callback:function(e){},exceptionHandler:function(evt){
alert("删除数据出错("+msg+")");
}})
FsService.save('FL_USER_QUERY_LIST',p,{callback:function(e){
alert('保存成功!');
//下面需要放到条件列表中(实时添加上的)
/*$("#tscx").toggle(1000);*/
$(".ibox-close").click();
var condList = $("#conditionDataBody");
var str = '';
str +='<tr><td class="condName" onClick="Forestar.App.zhcxWidget.instance.addQuery(this)">'
+e.currentObjects.NAME
+'</td><td class="right">'
+'<a href="javascript:;" class="edit-icon icon condEdit" onClick="Forestar.App.zhcxWidget.instance.editQuery(this)"></a>'
+'<a href="javascript:;" class="del-icon icon cond_close" onClick="Forestar.App.zhcxWidget.instance.delQuery(this)"></a>'
/*+'<input class="condEdit" type="button" name="OK" value="编辑" class="zs-btn" onClick="Forestar.App.zhcxWidget.instance.editQuery(this)"/>'
+'</td><td>'
+'<span class="cond_close" onClick="Forestar.App.zhcxWidget.instance.delQuery(this)">&times;</span>'
*/
+'</td></tr>'
condList.append(str);
Forestar.App.zhcxWidget.instance.showCond();
/*$("#conditionDataBody .condEdit").iBox({
title: "条件设置",
requestType: "ajax",
overlay: false,
showMin:false,
isLocal:true,
myHtml:Forestar.App.zhcxWidget.instance.myHtml,
target: "./help/_add-condition.html"
})*/
},exceptionHandler:function(evt){
alert("保存数据出错("+msg+")");
}})
},exceptionHandler:function(evt){
alert("查找数据出错("+msg+")");
}})
}
}else{
alert('条件为空!');
return;
}
},
//条件列表中的编辑
//编辑时,可以存储一个html的字符串,直接取过来,填进去。
editQuery :function(e){
if($("#conditionCenter .queryTj").length>0){//清空原有的数据
$("#conditionCenter .queryTj").remove();
$("#conditionName").val('');
}
/*$("#tscx").toggle(1000);*/
Forestar.App.zhcxWidget.instance.codName_Edit = $(e.parentElement).prev().text();
var QueryFilter ={
whereString : "NAME = '"+Forestar.App.zhcxWidget.instance.codName_Edit+"' and USERID = '"+PageOnLoad.userId+"'",//USERID的值为动态获取
};
$.ajaxSetup({
async: true
});
FsService.getEntityList("FL_USER_QUERY_LIST",QueryFilter,{callback:function(res){
var codHtml = res[0].originalObjects.CODHTML;//获取html的字符串,然后向表格中添加
var zqHtml = res[0].originalObjects.ZQHTML;
$("#zh_ZQ").html(zqHtml);
var condition = $("#conditionCenter");
var codName = res[0].originalObjects.NAME;//赋值给条件名称
$("#conditionName").val(codName);
condition.append(codHtml);
$('#saveCondition').attr('isadd','false');//赋值为编辑
$("#add_zhcx_").show();
Forestar.App.dmcxWidget.instance.bindChange();
},exceptionHandler:function(evt){
alert("查找数据出错("+msg+")");
}})
$.ajaxSetup({
async: false
});
},
//切换综合查询的新增
switchQuery : function(e){
if($("#conditionCenter .queryTj").length>0){
$("#conditionCenter .queryTj").remove();
$("#conditionName").val('');
}
/*$("#tscx").toggle(1000);*/
$("#closeCondition").unbind("click").click(function(){
/*$("#tscx").toggle(1000);*/
});
$("#tscx .ztxz_close").unbind("click").click(function(){
/*$("#tscx").toggle(1000);*/
});
$('#saveCondition').attr('isadd','true');//赋值为新增
},
//删除元素
delCond : function(e){
if (!!window.ActiveXObject || "ActiveXObject" in window) {
e.parentElement.removeNode(true);
} else {
e.parentElement.remove();
}
},
//遍历列表,拼接字符串到条件列表中
showCond:function(){
var userId = PageOnLoad.userId;//需要动态的获取登录用户的ID
var filter = {
addCaptionField: true,
fillChild: "No",
orderByString: "COUNT DESC",
whereString: "USERID = '"+userId+"'"
};
FsService.getEntityList("FL_USER_QUERY_LIST",filter,{callback:function(e){
var str = '';
var condList = $("#conditionDataBody");
condList.empty();//先清空
var str = '';
for(var i = 0;i<e.length;i++){
var condData = e[i].originalObjects;
str +='<tr><td class="condName" onClick="Forestar.App.zhcxWidget.instance.addQuery(this)">'
+condData.NAME
+'</td><td class="right">'
+'<a href="javascript:;" codName="'+condData.NAME+'" class="edit-icon icon condEdit" onClick="Forestar.App.zhcxWidget.instance.editQuery(this)"></a>'
+'<a href="javascript:;" codName="'+condData.NAME+'" class="del-icon icon cond_close" onClick="Forestar.App.zhcxWidget.instance.delQuery(this)"></a>'
+'</td></tr>'
/*+'<input codName="'+condData.NAME+'" class="condEdit" type="button" name="OK" value="编辑" class="zs-btn" onClick="Forestar.App.zhcxWidget.instance.editQuery(this)"/>'
+'</td><td>'
+'<span class="cond_close" codName="'+condData.NAME+'" onClick="Forestar.App.zhcxWidget.instance.delQuery(this)">&times;</span>'
+'</td></tr>'*/
}
condList.append(str);
},exceptionHandler:function(evt){
alert("查找数据出错("+msg+")");
}});
},
//删除条件列表中的条件
delQuery : function(e){
var userId = PageOnLoad.userId;//USERID的值为动态获取
var codName = $(e).attr("codName");
var QueryFilter ={
whereString : "NAME = '"+codName+"' and USERID = '"+userId+"'",
};
FsService.del('FL_USER_QUERY_LIST',QueryFilter,{callback:function(res){
//Forestar.App.zhcxWidget.instance.showCond();
if (!!window.ActiveXObject || "ActiveXObject" in window) {
e.parentElement.parentElement.removeNode(true);
} else {
e.parentElement.parentElement.remove();
}
alert('删除成功!');
},exceptionHandler:function(evt){
alert("删除数据出错("+msg+")");
}})
},
//点击条件列表名称下跳,查询
addQuery : function(e){
var isSelect = ($(e).attr('class')).indexOf('select');
var condNameList = $(".condNameList");
if(isSelect<0){//不存在select,没有被选中时
$(e).addClass('select');//添加select的class,更改背景颜色
var condName = $(e).text();//获取条件名称
var str = '<a href="javascript:;">'
+'<span>'+condName+'</span>'
+'<i class="close" onClick="Forestar.App.zhcxWidget.instance.condNameDel(this)"></i>'
+'</a>'
/*var str = ' <a>' + condName + '<span class="cond_close" onClick="Forestar.App.zhcxWidget.instance.condNameDel(this)">&times;</span></a>';*/
/* var str = ' <a onmousemove="Forestar.App.zhcxWidget.instance.move(this)" onmouseout="Forestar.App.zhcxWidget.instance.remove(this)">' + condName
+ '<span class="cond_close" onClick="Forestar.App.zhcxWidget.instance.condNameDel(this)">&times;</span></a>';
*/ condNameList.append(str);
}
},
/*//鼠标移动到条件名称时
move : function(e){
$(e).children().show();
$(e).children().css("margin-left", "5px");
},
//鼠标移开时
remove : function(e){
$(e).children().hide();
},*/
//删除名称列表中的名字
condNameDel : function(e){
var r = $('.condName');
var t = ($(e.parentElement).text()).replace('×', '')
for (var i = 0; i < r.length; i++) {
if ($(r[i]).text() == t) {
$(r[i]).removeClass('select');
}
}
if (!!window.ActiveXObject || "ActiveXObject" in window) {
e.parentElement.removeNode(true);
} else {
e.parentElement.remove();
}
},
//获取当前时间
getNowFormatDate : function() {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + date.getHours() + seperator2 + date.getMinutes()
+ seperator2 + date.getSeconds();
return currentdate;
},
//根据度分秒坐标定位失去焦点时
zhcx_blur : function(e){
$(e).css('border','1px solid #cccccc');
},
//当地籍号失去焦点时
djh_blur : function(e){
var reg = /[0-9]{21}/;
var value = $("#xb_djh").val();
if(reg.test(value) == false){
Forestar.App.zhcxWidget.instance.isReg = false;
alert('请与所提醒的格式保持一致!');
}else{
Forestar.App.zhcxWidget.instance.isReg = true;
}
},
getZhPage:function(){
},
frameNumberQuery: function (mapNumberNew,mapNumberOld) {
var queryFilter = {
whereString : "MAPNO_NEW='"+mapNumberNew+"' or MAPNO_OLD = '"+mapNumberOld+"'",
selectFields: '*'
};
FsService.getEntityList("MAPINDEX_10K_V",queryFilter,{callback:function(res){
var results = res
var _extent;
var arcgisGeometry;
var center;
for (var i = 0; i < res.length; i++) {
var org = res[i].originalObjects
_extent = org.L_FULLEXTENT;
//将wktz转换为geometry
var temp = org.WKT.substring(12);
var temp1 = temp.substring(0,temp.length-2);
var wkt = temp1.replace(/, /g,",");
arcgisGeometry=GeometryUtils.getArcgisGeometry(wkt,"polygon", Config.wkid);
center = org.L_CENTER;
}
/*_highlighLayer = new esri.layers.GraphicsLayer();
var outlineSyml = new esri.symbol.SimpleLineSymbol(
esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([
255, 0, 0, 1]), 2);
var polygonSymbol = new esri.symbol.SimpleFillSymbol(
esri.symbol.SimpleFillSymbol.STYLE_SOLID,outlineSyml,
new dojo.Color([255, 0, 0 , 0]));
// 将geometry转换为graphic
var graphic=new esri.Graphic(arcgisGeometry,outlineSyml,null,null);
// 将graphic添加到高亮图层上
_highlighLayer.add(graphic);
// 将图层添加到地图上
Forestar.App.combineMap._map2D.addLayer(_highlighLayer);*/
//var arrayExtent = _extent.split(",");
var arrayCenter = center.split(",");
//var extent = {"type":"extent","xmin":arrayExtent[0],"ymin":arrayExtent[1],"xmax":arrayExtent[2],"ymax":arrayExtent[3],"wkid": Config.wkid, "latestWkid": Config.wkid}
// 缩放地图
//Forestar.App.combineMap.getCurrentMapObj().zoomToExtent(extent);
var map=Forestar.App.combineMap.getCurrentMapObj()
map.setCenter({x:arrayCenter[0],y:arrayCenter[1],wkid:Config.wkid})
map.setZoom(10)
//map.zoomToExtent(extent,10)
/*var map=Forestar.App.zhcxWidget.instance.tfdw_map;
var tfdwLayer = "";
//Forestar.App.combineMap.addLayer()
var mapHightWidgetObj = new Forestar.App.mapHightWidget();
//map.setExtent(_extent);
map.map2D.zoomToExtent(_extent);
mapHightWidgetObj.creatHighZQMap(Config.zqdwObj.zqcode,"zhcx");
// 定位
*/
AppEvent.dispatchEvent("clean");
var selectLayer = Forestar.App.MenuToolChange.prototype.selectLayer;
selectLayer.clear();
var geometry=arcgisGeometry[0];
//geometry.setSpatialReference(new esri.SpatialReference(Config.wkid));
//地图上高亮渲染图层
var LineSymbol = new esri.symbol.SimpleLineSymbol(
esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 255, 255, 0.5]), 3);
var selectGraphic = new esri.Graphic(geometry,LineSymbol);
selectLayer.add(selectGraphic);
//var graphic = features[i];
// 添加图形高亮
//this.highLight._highlighLayer.add(graphic);
/* 初始化高亮图层与样式
initLayerAndSymbol : function() {
if (!this._highlighLayer) {
this._highlighLayer = new esri.layers.GraphicsLayer();
this.selectLayer = new esri.layers.GraphicsLayer();
if (this.combineMap) {
this.combineMap.getCurrentMapObj().getInstance().addLayers([
this._highlighLayer, this.selectLayer]);
}
// 线样式
this.outlineSyml = new esri.symbol.SimpleLineSymbol(
esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([
this.defaultStyle.strokeColor.rgb.r,
this.defaultStyle.strokeColor.rgb.g,
this.defaultStyle.strokeColor.rgb.b,
this.defaultStyle.fillOpacity]),
this.defaultStyle.strokeWidth);
// 面默认和选中样式
this.defaultFillSyml = new esri.symbol.SimpleFillSymbol(
esri.symbol.SimpleFillSymbol.STYLE_SOLID, this.outlineSyml,
new dojo.Color([this.defaultStyle.fillColor.rgb.r,
this.defaultStyle.fillColor.rgb.g,
this.defaultStyle.fillColor.rgb.b,
this.defaultStyle.fillOpacity]));
this.selectFillSyml = new esri.symbol.SimpleFillSymbol(
esri.symbol.SimpleFillSymbol.STYLE_SOLID, this.outlineSyml,
new dojo.Color([this.selectStyle.fillColor.rgb.r,
this.selectStyle.fillColor.rgb.g,
this.selectStyle.fillColor.rgb.b,
this.selectStyle.fillOpacity]));
}
},
*/
},exceptionHandler:function(evt){
alert("查找数据出错("+msg+")");
}});
},
//动态获取字段值
CLASS_NAME: "Forestar.App.zhcxWidget"
});
Forestar.App.zhcxWidget.instance = null;

Comment list( 0 )

You need to Sign in for post a comment

10_float_left_people 10_float_left_close