123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617 |
- var conditionJson;
- var param={};
- var $dom=null;
- /**
- * 页面加载完成后执行
- */
- $(function() {
- init();
- });
- $(function(){
- $(".cs_win_item").on("click",function(){
- if($(this).hasClass("cs_win_item_active")){
- $(this).removeClass("cs_win_item_active");
- }else{
- $(".cs_win_item_active").removeClass("cs_win_item_active");
- $(this).addClass("cs_win_item_active");
- };
- });
- });
- /**
- * 初始化方法
- */
- function init(){
- conditionJson = resolveUrl();
- initLatout();
- loadMaticList();
- bindEventOnOkayAndCancle();
-
- };
- function initLatout(){
- $("#i_headtext").html(conditionJson.subject);
- };
- function getSubjectDate(data){
- var temData=data.rows.sort(function(item1,item2){
- if(parseInt(item1.rows[0]["SORT1"])>parseInt(item2.rows[0]["SORT1"])){
- return 1;
- }else if(parseInt(item1.rows[0]["SORT1"])<parseInt(item2.rows[0]["SORT1"])){
- return -1;
- }else{
- return 0;
- };
- });
- data.rows=temData;
- var synt = [];
- for(var index=0,len=data.rows.length;index<len;index++){
- param[data.rows[index].name]=data.rows[index].rows;
- synt = synt.concat(data.rows[index].rows);
- };
- param["组合展示"] = synt;
- initSubjectWinShow();
- getSubjectWinItem(param[conditionJson.subject]);
- };
- /* 初始化左侧窗口 */
- function initSubjectWinShow(){
- $("#das_bor"+conditionJson.wnum).removeClass("co_win_border").addClass("ct_win_border");
- if(conditionJson.subjectSubName1=="undefined" || conditionJson.subjectSubName1=="null" || conditionJson.subjectSubName1==undefined || conditionJson.subjectSubName1==null || conditionJson.subjectSubName1==""){
- getEmptyWinDom("subjectSubName1");
- };
- if(conditionJson.subjectSubName2=="undefined" || conditionJson.subjectSubName2=="null" || conditionJson.subjectSubName2==undefined || conditionJson.subjectSubName2==null || conditionJson.subjectSubName2==""){
- getEmptyWinDom("subjectSubName2");
- };
- if(conditionJson.subjectSubName3=="undefined" || conditionJson.subjectSubName3=="null" || conditionJson.subjectSubName3==undefined || conditionJson.subjectSubName3==null || conditionJson.subjectSubName3==""){
- getEmptyWinDom("subjectSubName3");
- };
- if(conditionJson.subjectSubName4=="undefined" || conditionJson.subjectSubName4=="null" || conditionJson.subjectSubName4==undefined || conditionJson.subjectSubName4==null || conditionJson.subjectSubName4==""){
- getEmptyWinDom("subjectSubName4");
- };
- for(var key in param[conditionJson.subject]){
- if(conditionJson.subjectSubName1==param[conditionJson.subject][key]["TM_NAME"]){
- getSubjectWinDom("subjectSubName1",param[conditionJson.subject][key]);
- }else if(conditionJson.subjectSubName2==param[conditionJson.subject][key]["TM_NAME"]){
- getSubjectWinDom("subjectSubName2",param[conditionJson.subject][key]);
- }else if(conditionJson.subjectSubName3==param[conditionJson.subject][key]["TM_NAME"]){
- getSubjectWinDom("subjectSubName3",param[conditionJson.subject][key]);
- }else if(conditionJson.subjectSubName4==param[conditionJson.subject][key]["TM_NAME"]){
- getSubjectWinDom("subjectSubName4",param[conditionJson.subject][key]);
- };
- };
- };
- function getEmptyWinDom(win_count_id){
- $("#"+win_count_id).empty();
- var $empty_win_div = document.createElement("div");
- $($empty_win_div).addClass("empty_win");
- $("#"+win_count_id).append($empty_win_div);
- };
- function getSubjectWinDom(win_count_id, win_param){
- var $details_win_div = document.createElement("div");
- var $subject_btn_span = document.createElement("span");
- $($subject_btn_span).addClass("subject_btn_span").attr("title",win_param.TM_NAME).html(win_param.TM_NAME);
- var $scdm_a = document.createElement("a");
- $($scdm_a).attr("title","从该窗口移出此图表").addClass("subject_char_details_more").attr("charurl",win_param.TM_URL).attr("charname",win_param.TM_NAME).html("-");
- $($scdm_a).on("click",function(){
- getEmptyWinDom($(this).parent().parent().attr("id"));
- });
-
- $($details_win_div).addClass("details_win").append($subject_btn_span).append($scdm_a);
-
- var $c_scdm_a = document.createElement("a");
- var $c_scdm_sub_img = document.createElement("img");
- $($c_scdm_sub_img).addClass("scdm_img subject_bg_img "+win_param.TM_IMGURL);
- $($c_scdm_a).addClass("subject_char_details_more").append($c_scdm_sub_img);
-
- $("#"+win_count_id).append($details_win_div).append($c_scdm_a).data("data",win_param);
- };
- /* 得到右侧专题选择列表 */
- function getSubjectWinItem(data){
- $("#i_right").empty();
- var $subject_list_char_ul = document.createElement("ul");
- $($subject_list_char_ul).attr("id","subject_char").addClass("subject_char group");
- for(var index = 0; index < data.length; index++){
-
- var last_area_name = "";
- var flag = false;
- if(index!=0){
- last_area_name = data[index-1].AREA_NAME;
- };
- if($("#i_headtext").html()=="组合展示"){
- flag = true;
- };
-
- if(flag && data[index].AREA_NAME=="组合展示"){break;};
-
- /*if(flag && last_area_name!=data[index].AREA_NAME){
- var $subject_group_title_left_box_div = document.createElement("div");
- $($subject_group_title_left_box_div).addClass("subject_left_group").html(data[index].AREA_NAME);
- $($subject_list_char_ul).append($subject_group_title_left_box_div);
- };*/
-
- var $subject_char_li = document.createElement("li");
- var $subject_char_details_div = document.createElement("div");
- $($subject_char_details_div).addClass("details");
- var $subject_char_details_span = document.createElement("span");
- $($subject_char_details_span).html(data[index].TM_NAME).addClass("subject_btn_span").attr("title",data[index].TM_NAME);
- /* var $subject_char_details_a = document.createElement("a");
- $($subject_char_details_a).html("+").attr("title","添加到快速查看").addClass("subject_char_details_more")
- .attr("charUrl",data[index].TM_URL).attr("charName",data[index].TM_NAME);
- $($subject_char_details_a).click(function(){
- //alert("添加到快速查看")
- var flg = true;
- var aid = null;
- var tid = null;
- $(".cbcc_btn").each(function(){
- if(flg){
- if($(this).attr("addBtn")=="1"){
- aid = $(this).attr("id");
- flg = false;
- };
- };
- if(!($(this).attr("thisAdd") == undefined)){
- tid = $(this).attr("id");
- $("#"+tid).removeAttr("thisAdd");
- };
- });
- if(tid!=null){ aid = tid; };
- if(aid==null){
- alert("快速添加按钮只能设置5个,如果想添加请移除快速按钮来替换!")
- }else{
- .attr("charUrl",data[index].TM_URL).attr("charName",data[index].TM_NAME);
- $("#"+aid).attr("addBtn","0").removeAttr("title").find("span").html($(this).attr("charName"))
- .attr("title",$(this).attr("charName"));
- $("#"+aid).find("a").attr("addBtn","0").attr("title","移除快速查看").html("-");
- };
- });
- $($subject_char_details_div).append($subject_char_details_span).append($subject_char_details_a);*/
- $($subject_char_details_div).append($subject_char_details_span);
- var $subject_char_show_a = document.createElement("a");
- $($subject_char_show_a).addClass("subject_char_details_more");
- var $subject_char_show_img = document.createElement("img");
- $($subject_char_show_img).addClass(data[index].TM_IMGURL+" subject_bg_img");
- $($subject_char_show_a).append($subject_char_show_img);
-
- if($("#i_headtext").html()=="组合展示"){
- if(data[index].IS_SYNTHESIZE!=0){
- $($subject_char_li).addClass("subject_acitve_left");
- };
- }else{
- if(data[index].TM_BEX!=0){
- $($subject_char_li).addClass("subject_acitve_left");
- };
- };
- $($subject_char_li).append($subject_char_details_div).append($subject_char_show_a)
- .attr("subject",data[index].TM_NAME).data("data",data[index]).addClass("subject_char_each");
- $($subject_char_li).click(function(e){
- var $dom=$(this);
- var dom_data = $dom.data("data");
- $(this).addClass("subject_acitve_left");
- var $fly_subject_item_div = document.createElement("div");
- $($fly_subject_item_div).addClass("fly_subject_item");
- var $fly_si_title_div = document.createElement("div");
- $($fly_si_title_div).addClass("fly_details");
- var $fly_sit_span = document.createElement("span");
- $($fly_sit_span).html(dom_data.TM_NAME).addClass("fly_subject_btn_span");
- $($fly_si_title_div).append($fly_sit_span);
- var $fly_si_img_a = document.createElement("a");
- $($fly_si_img_a).addClass("fly_subject_char_details_more");
- var $fly_si_img = document.createElement("img");
- $($fly_si_img).addClass(dom_data.TM_IMGURL+" subject_bg_img");
- $($fly_si_img_a).append($fly_si_img);
- $($fly_subject_item_div).append($fly_si_title_div).append($fly_si_img_a);
- $("#i_matic_content").append($fly_subject_item_div);
-
- var starOffset = $($dom).offset();
- var endOffset = $(".cs_win_item_active").offset();
- var fly_id ;
-
- if(endOffset==null || endOffset==undefined){
- fly_id = conditionJson.wnum;
- endOffset = $("#das_bor"+fly_id).offset();
- }else{
- fly_id = $(".cs_win_item_active").attr("winnum");
- };
-
- $($fly_subject_item_div).css({top:starOffset.top, left:starOffset.left});
- $($fly_subject_item_div).animate({top:endOffset.top, left:endOffset.left},300).fadeOut(300);
- setTimeout(function(){
- $($fly_subject_item_div).remove();
- $(".cs_win_item").each(function(){
- var thisOffset = $(this).offset();
-
- if(((endOffset.top+1)==thisOffset.top && (endOffset.left+1)==thisOffset.left)||
- (endOffset.top==thisOffset.top && endOffset.left==thisOffset.left)){
-
- if($(this).children(".empty_win").prop("outerHTML")==undefined){
- /*$(this).find(".details_win").eq(0).find(".subject_btn_span").eq(0)
- .attr("title",dom_data.TM_NAME).html(dom_data.TM_NAME).next()
- .attr("charurl",dom_data.TM_URL).attr("charname",dom_data.TM_NAME);
- var $new_img = document.createElement("img");
- $($new_img).addClass("scdm_img subject_bg_img "+dom_data.TM_IMGURL);
- $(this).find("a").eq(1).find("img").eq(0).remove();
- $(this).find("a").eq(1).append($new_img);*/
- var fd_id = $(this).data("data").FD_OBJECTID;
- var fd_id_old = dom_data.FD_OBJECTID;
- if(fd_id!=fd_id_old){
- $(".subject_char_each").each(function(){
- if(fd_id==$(this).data("data").FD_OBJECTID){
- $(this).removeClass("subject_acitve_left");
- };
- });
- $(this).empty();
- getSubjectWinDom($(this).attr("id"),dom_data);
- }
- }else{
- $(this).children(".empty_win").remove();
- getSubjectWinDom($(this).attr("id"),dom_data);
- };
- };
- });
-
- },300);
-
- //alert(JSON.stringify($dom.data("data")))
- });
- $($subject_list_char_ul).append($subject_char_li);
- };
- $("#i_right").append($subject_list_char_ul);
- };
- function flySubjectShowBox($fly_dom,starOffset,endOffset){
- $($fly_dom).css({top:starOffset.top, left:starOffset.left});
- $($fly_dom).animate({top:endOffset.top, left:endOffset.left},300).fadeOut(300);
- };
- /**
- *
- */
- function bindEventOnOkayAndCancle(){
- /**
- * 确定事件
- */
- $("#i_submit").on("click",function(){
- $(".cs_win_item").each(function(){
- var thisOffset = $(this).offset();
- if(thisOffset.top < 65 && thisOffset.left < 20){
- top.changeSite("i_index_content1",$(this).data("data"));
- }else if(thisOffset.top < 65 && thisOffset.left > 120){
- top.changeSite("i_index_content4",$(this).data("data"));
- }else if(thisOffset.top > 170 && thisOffset.left < 20){
- top.changeSite("i_index_content2",$(this).data("data"));
- }else if(thisOffset.top > 170 && thisOffset.left > 120){
- top.changeSite("i_index_content5",$(this).data("data"));
- };
-
- });
- top.destoryIframeContent("i_index_maticlist");
- });
- /**
- * 销毁本页面
- */
- $("#i_cancle").on("click",function(){
- top.destoryIframeContent("i_index_maticlist");
- });
- /**
- * 筛选功能的text获取焦点事件
- */
- $("#i_searchtext").on("focus",function(){
- $(this).attr("value","").css({color:"#000000",border:"none"});
- });
- $("#i_searchtext").on("keyup",function(e){
- if(e.keyCode==13){
- search();
- }
- });
- /**
- * 筛选功能绑定点击事件
- */
- $("#i_search_b").on("click",search);
- $(".c_ul_li_topdiv_p").each(function(){
- $(this).on("mouseenter",function(){
- $(this).css({color:"red","background-color": "yellow"});
- }).on("mouseleave",function(){
- $(this).css({color:"#000000","background-color": "#e5e5e7"});
-
- });
- });
-
- }
- /**
- * 筛选功能查询方法
- */
- function search(){
- if($("#i_searchtext").val()=="" || $("#i_searchtext").val()==null){
- function fn1(){
- alt.destory();
- return;
- }
- function fn2(){
- alt.destory();
- top.destoryMenu();
- }
- if($dom==null){
- var alt=new Alert({ok:fn1,cancle:fn2},
- {text:"请您输入查询条件!"});
- //创建节点
- alt.create("");
- }
- }else{
- postSearch({comId:conditionJson["dept_id"],name:$("#i_searchtext").val().trim()},createInfo);
-
- }
- }
- /**
- * 发送post请求,请求查询筛选的数据
- * @param param
- * @param callFunction
- */
- function postSearch(param,callFunction){
- $.post(path + "ws/MaticService/MaticService/getMaticMapInfoThroughLikeInfo",{like:param.name,comId:param.comId},function(result){
- callFunction(result.rows);
- bindEventOnMaticView();
- },"json");
- }
- /**
- * 加载页面数据
- */
- function loadMaticList() {
- var _this=arguments.callee;
- $.post(path + "ws/MaticService/MaticService/getMaticMapInfo", {comId:conditionJson["dept_id"]}, function(
- result) {
- $div = $("<div></div>");
- if (result.state == "SUCCESS") {
- //loadListItem(result);
- getSubjectDate(result);
- //accordionMenu($("#i_matic_content"), result.rows);
- } else {
- function fn1(){
- _this();
- return;
- }
- function fn2(){
- alt.destory();
-
- }
- if($dom==null){
- var alt=new Alert({ok:fn1,cancle:fn2},
- {text:"加载失败!是否需要继续加载?"});
- //创建节点
- alt.create("");
- }
- }
- }, "json");
- };
- /**
- * 加载左侧列表
- * @param data 后台查询的数据
- */
- function loadListItem(data){
- createList(data);
- for(var item in param){
- createInfo(param[item]);
- break;
- }
- /*createInfo(param[0]);*/
- bindEventOnMaticView();
- }
- /**
- * 加载左侧列表
- * @param data
- */
- function createList(data){
- var htmlStr="<ul class='c_item_list_ul'>";
- htmlStr+="<h2>全部<span class='c_amout'>("+data.total+")</span></h2>";
- var temData=data.rows.sort(function(item1,item2){
- if(parseInt(item1.rows[0]["SORT1"])>parseInt(item2.rows[0]["SORT1"])){
- return 1;
- }else if(parseInt(item1.rows[0]["SORT1"])<parseInt(item2.rows[0]["SORT1"])){
- return -1;
- }else{
- return 0;
- };
- });
- data.rows=temData;
- for(var index=0,len=data.rows.length;index<len;index++){
- param[data.rows[index].name]=data.rows[index].rows;
- if(data.rows[index].rows[0]["FD_OBJECTID"]!=0){
- htmlStr+="<li class='c_item_list_li' data="+data.rows[index].name+"><div>"+data.rows[index].name+"<span class='c_amout'>("+data.rows[index].rows.length+")</span></div></li>";
- }else{
- htmlStr+="<li class='c_item_list_li' data="+data.rows[index].name+"><div>"+data.rows[index].name+"<span class='c_amout'>(0)</span></div></li>";
- }
- }
- htmlStr+="</ul>";
- $("#i_left").append(htmlStr);
- htmlStr=null;
- bindItemEvent();
- }
- /**
- * 左侧列表绑定点击事件
- * 绑定列表事件
- */
- function bindItemEvent(){
- $("#i_left").find("ul").find("li").each(function(i,item){
- $(this).on("click",function(){
- createInfo(param[$(this).attr("data")]);
- bindEventOnMaticView();
- if($(this).siblings(".c_item_list_li_click").size()>0){
- $(this).siblings(".c_item_list_li_click").removeClass("c_item_list_li_click");
- }
- $(this).addClass("c_item_list_li_click");
- }).on("mouseenter",function(){
- /*var $dom=$(this).find("div");
- $dom.animate({"margin-top":"-30px"},200,"",function(){
- $dom.css({"margin-top":"-30px"}).animate({"margin-top":"0px"},200,"",function(){
- $dom.animate({"font-size":"20px"},200,"",function(){
- $dom.animate({"font-size":"12px"},200);
- $dom=null;
- });
- });
- });*/
- //_this=null;
- });
- });
-
- /* $("#i_left").find("ul").on("click","li",function(){
- alert("===");
- alert(JSON.stringify(param[$(this).attr("data")]));
- createInfo(param[$(this).attr("data")]);
- bindEventOnMaticView();
- }).on("mouseenter","li",function(){
- var $dom=$(this).find("div");
- $dom.animate({"margin-top":"-30px"},200,"",function(){
- $dom.css({"margin-top":"-30px"}).animate({"margin-top":"0px"},200,"",function(){
- $dom.animate({"font-size":"20px"},200,"",function(){
- $dom.animate({"font-size":"12px"},200);
- $dom=null;
- });
- });
- });
- //_this=null;
- });*/
- }
- /**
- * 创建视图详情
- * @param param
- * @returns {Boolean}
- */
- function createInfo(param){
- $("#i_content_info").empty();
- if(param[0]["FD_OBJECTID"]==0){
- $("#i_content_info").append("<div style='margin-top: 40px;text-align: center;color: #141414;'>暂未配置外部系统!</div>");
- return false;
- }
- $("#i_content_info").append("<ul class='c_ul'></ul>");
- for(var index=0,len=param.length;index<len;index++){
- $("#i_content_info").find("ul").append(
- "<li class='c_ul_li'><div class='c_ul_li_topdiv'><p class='c_ul_li_topdiv_p'>"
- + param[index]["TM_NAME"]
- + "</p></div><div class='"+param[index]["TM_IMGURL"]+" c_ul_li_bottomdiv _background_position' title='"
- + param[index]["TM_NAME"] + "'></div></li>");
- $("#i_content_info").find("ul").find("li").last().data("data", param[index]);
- }
- return false;
- }
- /**
- * 给单个选项绑定点击事件
- */
- function bindEventOnMaticView(){
- $("#i_content_info").find("ul").on("click","li",function(){
- $dom=$(this);
- }).on("mouseenter","li",function(){
- /* console.log("====");*/
- var $dom=$(this).on("click",function(){
- $(this).siblings(".c_has_click").removeClass("c_has_click");
- $(this).addClass("c_has_click");
- }).find(".c_ul_li_bottomdiv");
- $dom.animate({"background-size":"103px"},200,"",function(){
- $dom.animate({"background-size":"50px"},200,"",function(){
- $dom.animate({"background-size":"75px"},200);
- $dom=null;
- });
- });
- });
- }
- /******************************************无用代码************************************************************/
- /**
- *
- * @param $dom
- * @param data
- */
- function accordionMenu($dom, data) {
- var $divCon = $("<div class='_ul_count_content'></div>");
- if (data.length == 0)
- throw Error("accordionMenu($dom,data)中data的长度为0或者空");
- if ($dom == null || $dom == undefined)
- throw new Error("accordionMenu($dom,data)中容器节点不能为空");
- for ( var item in data) {
- if (data[item].rows.length == 0)
- continue;
- $div = $("<div class='_ul_content'></div>");
- menuItem($div, data[item]);
- $divCon.append($div);
- }
- ;
- $dom.append($divCon);
- $dom.append("<div class='_jsc_close'></div>");
- $dom.find("._jsc_close").on("click", function() {
- top.destoryMenu();
- }).on("mouseenter", function() {
- $(this).addClass("_jsc_close_changeImg");
- }).on("mouseleave", function() {
- $(this).removeClass("_jsc_close_changeImg");
- });
- }
- // 创建单个选择list
- function menuItem($dom, data) {
- $ul = $("<ul></ul>");
- $h2 = $("<div class='_ul_head'><div class='_view_list_line'></div><div class='_view_list'><h2>"
- + data.name + "</h2></div></div>");
- // 点击隐藏选择项
- $ul.append($h2);
- $dom.append($ul);
- for ( var item1 in data.rows) {
- $dom.find("ul").last().append(
- "<li class='_ul_li'><div class='_matic_title'><p >"
- + data.rows[item1]["TM_NAME"]
- + "</p></div><div class='_matic_img' title='"
- + data.rows[item1]["TM_NAME"] + "'><img src='"
- + (path + data.rows[item1]["TM_IMGURL"])
- + "'/></div></li>");
- $dom.find("ul").last().find("li").last().data("data", data.rows[item1]);
- inAndLeaveAndClick($dom.find("ul").last().find("li").last(), function(
- $dom) {
- top.changeSite(conditionJson["iframeId"], $dom.data("data"));
- top.destoryMenu();
- }, moveIn, moveOut);
- }
- $dom.find("._view_list").click(function() {
- $(this).parents("._ul_content").toggleClass("_ul_content_hide");
- });
- }
|