| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- var _menus;
- var obj = {};
- var arr = [];
- $(function() {
- alert(1);
- imbodyObj(arr);
- // $('#loading-mask').fadeOut();
- //setInterval('realSysTime()',1000);
- });
- function exit(){
- var hint = document.getElementById("hint").value;
- var exit_hint = document.getElementById("exit_hint").value;
- $.messager.confirm(hint, exit_hint, function(r) {
- if (r) {
- $.ajax({
- type:"POST",
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
- url:"exit",
- success:function (data){
- }
- });
- window.location.href = './';
- window.event.returnValue = false;
-
-
-
- }
- });
- }
- function realSysTime(){
- var now=new Date(); //创建Date对象
- var year=now.getFullYear(); //获取年份
- var month=now.getMonth(); //获取月份
- var date=now.getDate(); //获取日期
- var day=now.getDay(); //获取星期
- var hour=now.getHours(); //获取小时
- var minu=now.getMinutes(); //获取分钟
- var sec=now.getSeconds(); //获取秒钟
- //month=month+1;
- if (hour >= 0 && hour <= 9) {
- hour = "0" + hour;
- }
- if (minu >= 0 && minu <= 9) {
- minu = "0" + minu;
- }
- if (sec >= 0 && sec <= 9) {
- sec = "0" + sec;
- }
- //var arr_mon =new Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");
- var arr_mon =new Array("1","2","3","4","5","6","7","8","9","10","11","12");
- month = arr_mon[month];
- //var arr_week=new Array("周日","周一","周二","周三","周四","周五","周六");
- //var week=arr_week[day]; //获取中文的星期
-
- var time=date+"/"+month+"/"+year+" "+hour+":"+minu+":"+sec; //组合系统时间
- document.getElementById("clock").innerHTML = time;
- }
- function imbodyObj(arr){
- var stationm1={};
- stationm1.menuid ="56";
- stationm1.menuname =document.getElementById("price_curve").value;
- stationm1.icon ="icon-curve";
- stationm1.url ="curveJumppriceCurve";
-
- var stationm=[];
- stationm.push(stationm1);
-
- var stationman={};
- stationman.menuid ="56";
- stationman.menuname =document.getElementById("price_curve").value;
- stationman.icon ="icon-curve";
- stationman.menus =stationm;
- arr.push(stationman);
- obj.menus = arr;
- _menus = obj;
- initPage();
-
- }
-
- function initPage(){
- InitLeftMenu();
- tabClose();
- tabCloseEven();
- }
-
- var onlyOpenTitle="欢迎使用";//不允许关闭的标签的标题
-
- //初始化左侧
- function InitLeftMenu() {
- $("#nav").accordion({animate:false,fit:true,border:false});
- var selectedPanelname = '';
- $.each(_menus.menus, function(i, n) {
- var menulist ='';
- menulist +='<ul class="navlist">';
- $.each(n.menus, function(j, o) {
- menulist += '<li><div ><a ref="'+o.menuid+'" href="#" rel="' + o.url + '" ><span class="icon '+o.icon+'" > </span><span class="nav">' + o.menuname + '</span></a></div> ';
- if(o.child && o.child.length>0)
- {
- //li.find('div').addClass('icon-arrow');
- menulist += '<ul class="third_ul">';
- $.each(o.child,function(k,p){
- menulist += '<li><div><a ref="'+p.menuid+'" href="#" rel="' + p.url + '" ><span class="icon '+p.icon+'" > </span><span class="nav">' + p.menuname + '</span></a></div> </li>'
- });
- menulist += '</ul>';
- }
- menulist+='</li>';
- })
- menulist += '</ul>';
- $('#nav').accordion('add', {
- title: n.menuname,
- content: menulist,
- border:false,
- iconCls: 'icon ' + n.icon
- });
- if(i==0)
- selectedPanelname =n.menuname;
- });
- $('#nav').accordion('select',selectedPanelname);
- $('.navlist li a').click(function(){
- var tabTitle = $(this).children('.nav').text();
- var url = $(this).attr("rel");
- var menuid = $(this).attr("ref");
- var icon = $(this).find('.icon').attr('class');
- var third = find(menuid);
- if(third && third.child && third.child.length>0)
- {
- $('.third_ul').slideUp();
- var ul =$(this).parent().next();
- if(ul.is(":hidden"))
- ul.slideDown();
- else
- ul.slideUp();
- }
- else{
- addTab(tabTitle,url,icon);
- $('.navlist li div').removeClass("selected");
- $(this).parent().addClass("selected");
- }
- }).hover(function(){
- $(this).parent().addClass("hover");
- },function(){
- $(this).parent().removeClass("hover");
- });
- //选中第一个
- //var panels = $('#nav').accordion('panels');
- //var t = panels[0].panel('options').title;
- //$('#nav').accordion('select', t);
- }
-
- //获取左侧导航的图标
- function getIcon(menuid){
- var icon = 'icon ';
- $.each(_menus.menus, function(i, n) {
- $.each(n.menus, function(j, o) {
- if(o.menuid==menuid){
- icon += o.icon;
- }
- })
- })
- return icon;
- }
- function find(menuid){
- var obj=null;
- $.each(_menus.menus, function(i, n) {
- $.each(n.menus, function(j, o) {
- if(o.menuid==menuid){
- obj = o;
- }
- });
- });
- return obj;
- }
- function addTab(subtitle,url,icon){
- if(!$('#tabs').tabs('exists',subtitle)){
- $('#tabs').tabs('add',{
- title:subtitle,
- content:createFrame(url),
- closable:true,
- icon:icon
- });
- }else{
- $('#tabs').tabs('select',subtitle);
- $('#mm-tabupdate').click();
- }
- tabClose();
- }
- function createFrame(url)
- {
- var s = '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>';
- return s;
- }
- function tabClose()
- {
- /*双击关闭TAB选项卡*/
- $(".tabs-inner").dblclick(function(){
- var subtitle = $(this).children(".tabs-closable").text();
- $('#tabs').tabs('close',subtitle);
- })
- /*为选项卡绑定右键*/
- $(".tabs-inner").bind('contextmenu',function(e){
- $('#mm').menu('show', {
- left: e.pageX,
- top: e.pageY
- });
- var subtitle =$(this).children(".tabs-closable").text();
- $('#mm').data("currtab",subtitle);
- $('#tabs').tabs('select',subtitle);
- return false;
- });
- }
- //绑定右键菜单事件
- function tabCloseEven() {
- $('#mm').menu({
- onClick: function (item) {
- closeTab(item.id);
- }
- });
- return false;
- }
- function closeTab(action)
- {
- var alltabs = $('#tabs').tabs('tabs');
- var currentTab =$('#tabs').tabs('getSelected');
- var allTabtitle = [];
- $.each(alltabs,function(i,n){
- allTabtitle.push($(n).panel('options').title);
- })
- switch (action) {
- case "refresh":
- var iframe = $(currentTab.panel('options').content);
- var src = iframe.attr('src');
- $('#tabs').tabs('update', {
- tab: currentTab,
- options: {
- content: createFrame(src)
- }
- })
- break;
- case "close":
- var currtab_title = currentTab.panel('options').title;
- $('#tabs').tabs('close', currtab_title);
- break;
- case "closeall":
- $.each(allTabtitle, function (i, n) {
- if (n != onlyOpenTitle){
- $('#tabs').tabs('close', n);
- }
- });
- break;
- case "closeother":
- var currtab_title = currentTab.panel('options').title;
- $.each(allTabtitle, function (i, n) {
- if (n != currtab_title && n != onlyOpenTitle)
- {
- $('#tabs').tabs('close', n);
- }
- });
- break;
- case "closeright":
- var tabIndex = $('#tabs').tabs('getTabIndex', currentTab);
- if (tabIndex == alltabs.length - 1){
- alert('后边没有了 ^@^!!');
- return false;
- }
- $.each(allTabtitle, function (i, n) {
- if (i > tabIndex) {
- if (n != onlyOpenTitle){
- $('#tabs').tabs('close', n);
- }
- }
- });
- break;
- case "closeleft":
- var tabIndex = $('#tabs').tabs('getTabIndex', currentTab);
- if (tabIndex == 1) {
- alert('左边没有了 ^@^!!');
- return false;
- }
- $.each(allTabtitle, function (i, n) {
- if (i < tabIndex) {
- if (n != onlyOpenTitle){
- $('#tabs').tabs('close', n);
- }
- }
- });
- break;
- case "exit":
- $('#mm').menu('hide');
- break;
- }
- }
- //弹出信息窗口 title:标题 msgString:提示信息 msgType:信息类型 [error,info,question,warning]
- function msgShow(title, msgString, msgType) {
- $.messager.alert(title, msgString, msgType);
- }
- /**
- * EasyUI DataGrid根据字段动态合并单元格
- * 参数 tableID 要合并table的id
- * 参数 colList 要合并的列,用逗号分隔(例如:"name,department,office");
- */
- function mergeCellsByField(tableID, colList) {
- alert(2);
- var ColArray = colList.split(",");
- var tTable = $("#" + tableID);
- var TableRowCnts = tTable.datagrid("getRows").length;
- var tmpA;
- var tmpB;
- var PerTxt = "";
- var CurTxt = "";
- var buyprocode = "";
- var newbuyprocode = "";
- var alertStr = "";
- for (j = ColArray.length - 1; j >= 0; j--) {
- PerTxt = "";
- buyprocode = "";
- tmpA = 1;
- tmpB = 0;
- for (i = 0; i <= TableRowCnts; i++) {
- if (i == TableRowCnts) {
- CurTxt = "";
- newbuyprocode = "";
- }
- else {
- CurTxt = tTable.datagrid("getRows")[i][ColArray[j]];
- newbuyprocode = tTable.datagrid("getRows")[i]["buyprojectCode"];
- }
- if (PerTxt == CurTxt && buyprocode == newbuyprocode) {
- tmpA += 1;
- }
- else {
- tmpB += tmpA;
- tTable.datagrid("mergeCells", {
- index: i - tmpA,
- field: ColArray[j],//合并字段
- rowspan: tmpA,
- colspan: null
- });
- tTable.datagrid("mergeCells", { //根据ColArray[j]进行合并
- index: i - tmpA,
- field: "Ideparture",
- rowspan: tmpA,
- colspan: null
- });
- tmpA = 1;
- }
- PerTxt = CurTxt;
- buyprocode = newbuyprocode;
- }
- }
- }
|