123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889 |
- var pm = null;
- var su = null;
- var mid = null;
- var role_ids=null;
- var mfdStr = "";
- var isVisiblePage = "0";
- $(function(){
- pm = new ResourceMenu();
- su = new SearchUtil();
- role_ids=su.resolveUrl().role_id;
- });
- $(function(){
- mid = su.resolveUrl().mid;
- var fids = su.resolveUrl().fid;
- if(su.isLegitimate(fids)){
- fridArr = fids.split(",");
- for(var i = 0; i < fridArr.length; i++){
- pm.setMfdStr(fridArr[i]);
- };
- }
- });
- $(document).ready(function() {
- if(su.isLegitimate(mid)){
- pm.initPageByMarkerId();
-
- }else{
- pm.initPage();
-
- };
- // var a = pm.addParamsByTime(hms,"CORRESPONDING_DATE");
- // alert(JSON.stringify(a))
- // var b = pm.sortParams(a,"sortTime");
- // alert(JSON.stringify(b))
- });
- function setMfd(fid){
- window.parent.window.setResourceIdBymid(mid, fid);
- pm.setMfdStr(fid);
- mfdStr = pm.getMfdStr();
- pm.initPageByMarkerId();
- $(".first").click();
- };
- /**
- * 分页回调函数
- * @param page
- */
- function callBackChangePage(page){
- var url = '/nwyj/ws/icingZmap/IcingZmapService/getRescueSchedule';
- var param = {list_num:5, page_num:page, visible:isVisiblePage};
- if(su.isLegitimate(mid)){
- url = '/nwyj/ws/icingZmap/IcingZmapService/getRescueScheduleBymid';
- param = {list_num:5, page_num:page, mid:mid, fd_ids:pm.getMfdStr(), visible:isVisiblePage};
- };
-
- $.post(url, param, function(data){
-
- if(data.state=="success"){
- var params = pm.sortParams(data.rows,"SORT");
- pm.infoLeft(params);
- };
-
- }, "json");
- };
- /**
- * 刷新
- */
- function loadRefresh(){
- if(su.isLegitimate(mid)){
- pm.initPageByMarkerId();
-
- }else{
- pm.initPage();
-
- };
- $(".first").click();
- };
- var ResourceMenu = function(){
- var _this = this;
- var mfdStrr = "";
- this.setMfdStr = function(mfd){ mfdStrr += "'"+mfd+"',"; };
- this.getMfdStr = function(){
- if(mfdStrr==""||mfdStrr==undefined||mfdStrr==null){ return ""; }
- else{ return mfdStrr.substring(0, mfdStrr.length-1); }
- };
-
- this.initPage = function(){
- $.post('/nwyj/ws/icingZmap/IcingZmapService/getRescueScheduleCountPage', {list_num:5, visible:isVisiblePage}, function(data){
- if(data.state=="success"){
- $('.pagination').jqPagination({
- link_string : '/?page={page_number}',
- max_page : data.count_page,
- paged : function(page) {
- /* $('.log').prepend('<li>' + page + '</li>'); */
- }
- });
- };
-
- }, "json");
- };
-
- this.initPageByMarkerId = function(){
- $.post('/nwyj/ws/icingZmap/IcingZmapService/getRescueScheduleCountPageBymid', {list_num:5, visible:isVisiblePage, mid:mid, fd_ids:_this.getMfdStr()}, function(data){
- if(data.state=="success"){
- if(data.count_list=="0"){
- $("#left_grid").empty().append(_this.getAddBtn());
- };
- $("#left_grid").empty().append(_this.getAddBtn());
- $('.pagination').jqPagination({
- link_string : '/?page={page_number}',
- max_page : data.count_page,
- paged : function(page) {
- /* $('.log').prepend('<li>' + page + '</li>'); */
- }
- });
- };
-
- }, "json");
- };
-
- /**
- * 初始化左边
- */
- this.infoLeft = function(params){
- var $left_table = document.createElement("table");
- $($left_table).addClass("table-title").attr("cellpadding",0).attr("cellspacing","0");
-
- var $ct_tr = document.createElement("tr");
- var $ct_cz_td = document.createElement("td");
- $($ct_cz_td).attr("width","30").html("操作");
- var $ct_dw_td = document.createElement("td");
- $($ct_dw_td).attr("width","40").html("单位");
- var $ct_sn_td = document.createElement("td");
- $($ct_sn_td).attr("width","40").html("施工名称");
- var $ct_sd_td = document.createElement("td");
- $($ct_sd_td).attr("width","40").html("施工单位");
- var $ct_em_td = document.createElement("td");
- $($ct_em_td).attr("width","20");
- $($ct_tr).append($ct_cz_td).append($ct_dw_td).append($ct_sn_td).append($ct_sd_td).append($ct_em_td);
-
- $($left_table).append($ct_tr);
-
- for(var i=0; i<params.length; i++){
- var $con_tr = document.createElement("tr");
- var $edit_td = document.createElement("td");
- $($edit_td).attr("rowspan","2").append(_this.getOperationDom(params[i]));
-
- var $comp_td = document.createElement("td");
- $($comp_td).attr("rowspan","2").attr("title",params[i].RESCUE_COMP_ID_SHOW).html(params[i].RESCUE_COMP_ID_SHOW);
-
- var $sgn_td = document.createElement("td");
- $($sgn_td).attr("rowspan","2").attr("title",params[i].CONSTRUCTION_NAME).html(params[i].CONSTRUCTION_NAME);
-
- var $sgc_td = document.createElement("td");
- $($sgc_td).attr("rowspan","2").attr("title",params[i].CONSTRUCTION_COMP).html(params[i].CONSTRUCTION_COMP);
-
- var $plan_td = document.createElement("td");
- $($plan_td).html("计划").css("background","#fdd5b5");
-
- $($con_tr).append($edit_td).append($comp_td).append($sgn_td).append($sgc_td).append($plan_td).data("data",params[i]);
-
- var $reality_tr = document.createElement("tr");
- var $reality_td = document.createElement("td");
- $($reality_td).html("实际").css("background","#93cddd");
- $($reality_tr).append($reality_td);
-
- $($left_table).append($con_tr).append($reality_tr);
- };
-
- $("#left_grid").empty().append(_this.getAddBtn()).append($left_table);
-
- // _this.infoRight(params);//一个月
- _this.infoRightMuti(params);//多个月
-
- $(".plan_con").on("dblclick", function(){
- var param = $(this).parent().data("data");
- var cd = $(this).attr("parallelism-date");
- var pd = {RESCUE_ID:param.FD_OBJECTID, IS_PLAN:0, CORRESPONDING_DATE:cd};
- var fid = "";
- if($(this).find("div").hasClass("has_characters_describe")){
- var param = $(this).find("div").eq(0).data("data");
- fid = param.FD_OBJECTID;
- };
- window.parent.window.openResourceInfoEdit(fid, pd);
- });
- $(".reality_con").on("dblclick", function(){
- var param = $(this).parent().data("data");
- var cd = $(this).attr("parallelism-date");
- var pd = {RESCUE_ID:param.FD_OBJECTID, IS_PLAN:1, CORRESPONDING_DATE:cd};
- var fid = "";
- if($(this).find("div").hasClass("has_characters_describe")){
- var param = $(this).find("div").eq(0).data("data");
- fid = param.FD_OBJECTID;
- };
- window.parent.window.openResourceInfoEdit(fid, pd);
- });
- };
-
- /**
- * 新增按钮
- */
- this.getAddBtn = function(){
- var $tool_btn_div = document.createElement("div");
- var $add_btn = document.createElement("div");
- $($add_btn).addClass("add_btn").html("新增 ").on("click",function(){
- window.parent.window.openResourceEdit("", mid);
- });
-
- var $visible_btn = document.createElement("div");
- $($visible_btn).attr("id", "visible_btn").addClass("add_btn visible_btn_active").html("可见 ").on("click",function(){
- $("#hidden_btn").removeClass("isvisible_btn_active");
- $(this).addClass("isvisible_btn_active");
-
- isVisiblePage = "0";
-
- if(su.isLegitimate(mid)){
- _this.initPageByMarkerId();
-
- }else{
- _this.initPage();
-
- };
-
- });
-
- var $hidden_btn = document.createElement("div");
- $($hidden_btn).attr("id", "hidden_btn").addClass("add_btn").html("隐藏 ").on("click",function(){
- $("#visible_btn").removeClass("isvisible_btn_active");
- $(this).addClass("isvisible_btn_active");
- isVisiblePage = "1";
-
- if(su.isLegitimate(mid)){
- _this.initPageByMarkerId();
-
- }else{
- _this.initPage();
-
- };
- });
- if(role_ids.indexOf("R002105430335")>-1){//指挥看板操作员权限控制
- $($tool_btn_div).addClass("tool_btn_box").append($add_btn).append($visible_btn).append($hidden_btn);
- }
- //$($tool_btn_div).addClass("tool_btn_box").append($add_btn).append($visible_btn).append($hidden_btn);
- return $tool_btn_div;
- };
-
- /**
- * 动态创建分页工具栏/暂时废弃
- */
- this.getPageTool = function(){
- var $page_box = document.createElement("div");
- var $first_page_a = document.createElement("a");
- var $prev_page_a = document.createElement("a");
- var $next_page_a = document.createElement("a");
- var $last_page_a = document.createElement("a");
- var $show_page_input = document.createElement("input");
-
- $($first_page_a).addClass("first").attr("data-action","first").html("«");
- $($prev_page_a).addClass("previous").attr("data-action","previous").html("‹");
- $($next_page_a).addClass("next").attr("data-action","next").html("›");
- $($last_page_a).addClass("last").attr("data-action","last").html("»");
- $($show_page_input).attr("type","text").attr("readonly","readonly");
- $($page_box).addClass("gigantic pagination").append($first_page_a).append($prev_page_a).append($show_page_input).append($next_page_a).append($last_page_a);
-
- return $page_box;
- };
-
- /**
- * 得到操作dom内容
- */
- this.getOperationDom = function(param){
- var $oper_div = document.createElement("div");
- var $edit = document.createElement("span");
- $($edit).addClass("img_edit hand").attr("title","修改").on("click",function(){
-
- var param = $(this).parent().data("data");
- window.parent.window.openResourceEdit(param.FD_OBJECTID);
- });
- var $del = document.createElement("span");
- $($del).addClass("img_delete hand").attr("title","删除").on("click",function(){
-
- var param = $(this).parent().data("data");
- var url = "/nwyj/ws/crud/CRUDService/delete/";
- var dp = { classid:"314", objectIDs:param.FD_OBJECTID };
- $.post(url, dp, function(data){
- if(data.Msg.sucsess){
- _this.initPage();
- $(".first").click();
- };
- }, "json");
-
- });
-
- var $hidden = document.createElement("span");
- $($hidden).addClass("img_delete hand").attr("title","隐藏").on("click",function(){
-
- var param = $(this).parent().data("data");
- var url = "/nwyj/ws/crud/CRUDService/delete/";
- var dp = { classid:"314", objectIDs:param.FD_OBJECTID };
- $.post(url, dp, function(data){
- if(data.Msg.sucsess){
- _this.initPage();
- $(".first").click();
- };
- }, "json");
-
- });
-
- $($oper_div).append($edit).append($hidden).append($del).data("data",param);
- return $oper_div;
- };
-
- /**
- * 排序
- */
- this.sortParams = function(params, sc){
- var resSort = params.sort(function(a,b){
- return a[sc] - b[sc];
- });
- return resSort;
- };
-
- /**
- * 时间转换
- */
- this.addParamsByTime = function(params, sc){
- for(var i=0; i < params.length; i++){
- var t = params[i][sc].replace(/-/g,"/");
- params[i]["sortTime"] = new Date(t).getTime() ;
- // params[i] = $(params[i]).attr("sortTime",new Date(params[i][sc]).getTime());
- };
- return params;
- };
-
- // /**
- // * 时间排序
- // */
- // this.sortParamsByTime = function(params, sc){
- // var resSort = params.sort(function(a,b){
- //
- // var o = new Date(a[sc]).getTime();
- // var t = new Date(a[sc]).getTime();
- // alert(o)1483452132000/1484316132000
- // if(o>t){
- // return a[sc];
- // }
- // return b[sc];
- // });
- // return resSort;
- // };
-
- /**
- * 得到显示的月份数组
- * @returns ["yyyy-MM"]
- */
- this.getDateArr = function(params){
- var dateArr = [];
- for(var i = 0; i < params.length; i++){
- dateArr.push(params[i].PLAY_START_TIME.substr(0,7));
- dateArr.push(params[i].PLAY_END_TIME.substr(0,7));
- dateArr.push(params[i].REALITY_START_TIME.substr(0,7));
- dateArr.push(params[i].REALITY_END_TIME.substr(0,7));
- };
- for(var i = 0 ;i<dateArr.length;i++){
- if(dateArr[i] == "" || typeof(dateArr[i]) == "undefined"){
- dateArr.splice(i,1);
- i= i-1;
- };
- };
- Array.prototype.clearRepeat = function(){
- var res = [];
- var json = {};
- for(var i = 0; i < this.length; i++){
- if(!json[this[i]]){
- res.push(this[i]);
- json[this[i]] = 1;
- };
- };
- return res;
- };
- return dateArr.clearRepeat();
- };
-
- /**
- * 初始化右边多个月
- */
- this.infoRightMuti = function(params){
- // var date = _this.allGetServerTime();
- var dates = _this.getDateArr(params);
-
- var $right_table = document.createElement("table");
- $($right_table).addClass("resource_crossing_chart");
- var $month_tr = document.createElement("tr");
- for(var i = 0; i < dates.length; i++){
-
- var dateJson = _this.getYearMonthByTest(dates[i]);
- var days = _this.getDaysOfMonth(dateJson.year,dateJson.month);
-
- var $month_td = document.createElement("td");
- $($month_td).addClass("crochar_title_month").html(dateJson.year+"年"+dateJson.month+"月");
- $($month_tr).append($month_td);
- };
-
- var $week_tr = document.createElement("tr");
- for(var j = 0; j < dates.length; j++){
- var dateJson = _this.getYearMonthByTest(dates[j]);
- var days = _this.getDaysOfMonth(dateJson.year,dateJson.month);
-
- for(var i = 1; i <= days; i++){
- var $week_td = document.createElement("td");
- var week = _this.getWeekShow(_this.getWeek(dateJson.year, dateJson.month, i));
- $($week_td).addClass("title_col").html(week);
- $($week_tr).append($week_td);
- };
- };
-
- var $day_tr = document.createElement("tr");
- for(var j = 0; j < dates.length; j++){
- var dateJson = _this.getYearMonthByTest(dates[j]);
- var days = _this.getDaysOfMonth(dateJson.year,dateJson.month);
-
- for(var i = 1; i <= days; i++){
- var $day_td = document.createElement("td");
- $($day_td).addClass("title_col").html(i);
- $($day_tr).append($day_td);
- };
- };
-
- $($right_table).append($month_tr).append($week_tr).append($day_tr);
-
- var fd_id_arr = [];
- for(var i = 0; i < params.length; i++){
- fd_id_arr.push(params[i].FD_OBJECTID);
- var $week_tr = document.createElement("tr");
-
- for(var j = 0; j < dates.length; j++){
- var dateJson = _this.getYearMonthByTest(dates[j]);
- var days = _this.getDaysOfMonth(dateJson.year,dateJson.month);
-
- for(var k = 1; k <= days; k++){
- var $week_td = document.createElement("td");
- var d = k < 10 ? "0"+k : k;
-
- $($week_td).addClass("title_col_con "+dateJson.year+"-"+dateJson.month+"-"+d+"_plan_con").attr("parallelism-date",dateJson.year+"-"+dateJson.month+"-"+d);
- if(_this.isLegitimate(params[i].PLAY_START_TIME) || _this.isLegitimate(params[i].PLAY_END_TIME)){
-
- var beginTime = params[i].PLAY_START_TIME;
- var endTime = params[i].PLAY_END_TIME;
- var nowTime = dateJson.year+"-"+dateJson.month+"-"+k;
-
-
- if(_this.date_range(beginTime, endTime, nowTime)){ $($week_td).addClass("plan_con"); };
-
- };
-
- $($week_tr).append($week_td).attr("FD_ID",params[i].FD_OBJECTID).addClass("plan_cell").data("data",params[i]);
- };
-
- };
- // $($week_tr).attr("FD_ID",params[i].FD_OBJECTID).addClass("plan_cell").data("data",params[i]);
-
- var $r_week_tr = document.createElement("tr");
- for(var j = 0; j < dates.length; j++){
- var dateJson = _this.getYearMonthByTest(dates[j]);
- var days = _this.getDaysOfMonth(dateJson.year,dateJson.month);
-
- for(var k = 1; k <= days; k++){
- var $week_td = document.createElement("td");
- var d = k < 10 ? "0"+k : k;
-
- $($week_td).addClass("title_col_con "+dateJson.year+"-"+dateJson.month+"-"+d+"_reality_con").attr("parallelism-date",dateJson.year+"-"+dateJson.month+"-"+d);
-
- if(_this.isLegitimate(params[i].REALITY_START_TIME) || _this.isLegitimate(params[i].REALITY_END_TIME)){
-
- var beginTime = params[i].REALITY_START_TIME;
- var endTime = params[i].REALITY_END_TIME;
- var nowTime = dateJson.year+"-"+dateJson.month+"-"+k;
-
- if(_this.date_range(beginTime, endTime, nowTime)){ $($week_td).addClass("reality_con"); };
-
- };
-
- $($r_week_tr).append($week_td).attr("FD_ID",params[i].FD_OBJECTID).addClass("reality_cell").data("data",params[i]);
- };
- $($right_table).append($week_tr).append($r_week_tr);
- };
- };
-
- $("#crossing_chart").empty().append($right_table);
-
- if(fd_id_arr.length>0){
- var fd_ids = "'"+fd_id_arr.join("','")+"'";
- var url = '/nwyj/ws/icingZmap/IcingZmapService/getRescueScheduleMessage' ;
- $.post(url, {fd_ids:fd_ids}, function(data){
- if(data.state=="success"){
- _this.appendMsg(data.rows);
- };
-
- },"json");
-
- };
-
-
- };
-
- /**
- * 添加日期备注
- */
- this.appendMsg = function(params){
- for(var i = 0; i < params.length; i++){
- var $char_desc_div = document.createElement("div");
-
- $($char_desc_div).addClass("has_characters_describe").data("data",params[i]);
- // var corr_date = param[i].CORRESPONDING_DATE.split(" ")[0];
- var corr_date = params[i].CORRESPONDING_DATE;
- var isp = params[i].IS_PLAN == "0" ? "plan_con":"reality_con";
- $("tr[fd_id='"+params[i].RESCUE_ID+"']").find("."+corr_date+"_"+isp).empty().eq(0).attr("title",params[i].RESCUE_MESSAGE).append($char_desc_div);
-
- };
- };
-
- /**
- * 初始化右边一个月
- */
- this.infoRight = function(params){
- var date = _this.allGetServerTime();
-
- var dateJson = _this.formatDateTimeByTest(date);
- var days = _this.getDaysOfMonth(dateJson.year,dateJson.month);
-
- var $right_table = document.createElement("table");
- $($right_table).addClass("resource_crossing_chart");
-
- var $month_tr = document.createElement("tr");
- var $month_td = document.createElement("td");
- $($month_td).addClass("crochar_title_month").html(dateJson.year+"年"+dateJson.month+"月");
- $($month_tr).append($month_td);
- $($right_table).append($month_tr).append(_this.getWeekColumns(days, dateJson)).append(_this.getDayColumns(days));
-
- for(var i = 0; i < params.length; i++){
- $($right_table).append(_this.getContentPlanCell(dateJson, days, params[i])).append(_this.getContentRealityCell(dateJson, days, params[i]));
- };
-
- $("#crossing_chart").empty().append($right_table);
-
- for(var i = 0; i < hms.length; i++){
- var $char_desc_div = document.createElement("div");
-
- $($char_desc_div).addClass("has_characters_describe");
- var corr_date = hms[i].CORRESPONDING_DATE.split(" ")[0];
- var isp = hms[i].IS_PLAN == "0" ? "plan_con":"reality_con";
- // alert(isp)
- $("tr[fd_id='"+hms[i].RESCUE_ID+"']").find("."+corr_date+"_"+isp).eq(0).attr("title",hms[i].RESCUE_MESSAGE).append($char_desc_div);
-
- };
-
- };
-
- /**
- * 得到星期表头
- * @param days 当月天数
- * @param dateJson 时间信息
- * @returns 星期表头$tr
- */
- this.getWeekColumns = function(days, dateJson){
- var $week_tr = document.createElement("tr");
- for(var i = 1; i <= days; i++){
- var $week_td = document.createElement("td");
- var week = _this.getWeekShow(_this.getWeek(dateJson.year, dateJson.month, i));
- $($week_td).addClass("title_col").html(week);
- $($week_tr).append($week_td);
- };
- return $week_tr;
- };
-
- /**
- * 得到日期表头
- * @param days 当月天数
- * @param dateJson 时间信息
- * @returns 日期表头$tr
- */
- this.getDayColumns = function(days, dateJson){
- var $week_tr = document.createElement("tr");
- for(var i = 1; i <= days; i++){
- var $week_td = document.createElement("td");
- $($week_td).addClass("title_col").html(i);
- $($week_tr).append($week_td);
- };
- return $week_tr;
- };
-
- /**
- * 得到计划详细表格
- * @param days 当月天数
- */
- this.getContentPlanCell = function(dateJson, days, params){
- var $week_tr = document.createElement("tr");
- for(var i = 1; i <= days; i++){
- var $week_td = document.createElement("td");
- var d = i < 10 ? "0"+i : i;
-
- $($week_td).addClass("title_col_con "+dateJson.year+"-"+dateJson.month+"-"+d+"_plan_con");
-
- if(_this.isLegitimate(params.PLAY_START_TIME) || _this.isLegitimate(params.PLAY_END_TIME)){
-
- var beginTime = params.PLAY_START_TIME.split(" ")[0];
- var endTime = params.PLAY_END_TIME.split(" ")[0];
- var nowTime = dateJson.year+"-"+dateJson.month+"-"+i;
-
- if(_this.date_range(beginTime, endTime, nowTime)){ $($week_td).addClass("plan_con"); };
-
- };
-
- $($week_tr).append($week_td).attr("FD_ID",params.FD_OBJECTID).addClass("plan_cell");
- };
- return $week_tr;
- };
-
- /**
- * 得到实际详细表格
- * @param days 当月天数
- */
- this.getContentRealityCell = function(dateJson, days, params){
- var $week_tr = document.createElement("tr");
- for(var i = 1; i <= days; i++){
- var $week_td = document.createElement("td");
- var d = i < 10 ? "0"+i : i;
-
- $($week_td).addClass("title_col_con "+dateJson.year+"-"+dateJson.month+"-"+d+"_reality_con");
-
- if(_this.isLegitimate(params.REALITY_START_TIME) || _this.isLegitimate(params.REALITY_END_TIME)){
-
- var beginTime = params.REALITY_START_TIME.split(" ")[0];
- var endTime = params.REALITY_END_TIME.split(" ")[0];
- var nowTime = dateJson.year+"-"+dateJson.month+"-"+i;
-
- if(_this.date_range(beginTime, endTime, nowTime)){ $($week_td).addClass("reality_con"); };
-
- };
-
- $($week_tr).append($week_td).attr("FD_ID",params.FD_OBJECTID).addClass("reality_cell");
- };
- return $week_tr;
- };
-
- /**
- * 判断参数是否合法
- * 如果是null/undefined/""/"null"/"undefined"返回false
- */
- this.isLegitimate = function(param){
- if(param==null || param==undefined || param=="" || param=="null" || param=="undefined"){
- return false;
- }else{
- return true;
- };
- };
-
- /**
- * 判断时间是否在某一时间区
- * @param beginTime 开始时间 yyyy-MM-dd
- * @param endTime 结束时间 yyyy-MM-dd
- * @param nowTime 要判断的时间 yyyy-MM-dd
- *
- */
- this.date_range = function (beginTime, endTime, nowTime) {
- var strb = beginTime.split ("-");
- if (strb.length != 3) { return false; };
- var stre = endTime.split ("-");
- if (stre.length != 3) { return false; };
- var strn = nowTime.split ("-");
- if (strn.length != 3) { return false; };
-
- var b = new Date ();
- var e = new Date ();
- var n = new Date ();
- b.setFullYear(strb[0]);
- b.setMonth (strb[1]);
- b.setDate (strb[2]);
- e.setFullYear (stre[0]);
- e.setMonth (stre[1]);
- e.setDate (stre[2]);
- n.setFullYear (strn[0]);
- n.setMonth (strn[1]);
- n.setDate (strn[2]);
- if (n.getTime () - b.getTime () >= 0 && n.getTime () - e.getTime () <= 0) {
- return true;
- } else {
- return false;
- };
- };
- // date_range ("2016-11-23", "2017-01-11", "2016-11-24");
-
- /**
- * 判断时间是否在某一时间区
- * @param beginTime 开始时间 hh:mm
- * @param endTime 结束时间 hh:mm
- * @param nowTime 要判断的时间 hh:mm
- *
- */
- this.time_range = function (beginTime, endTime, nowTime) {
- var strb = beginTime.split (":");
- if (strb.length != 2) {
- return false;
- }
- var stre = endTime.split (":");
- if (stre.length != 2) {
- return false;
- }
- var strn = nowTime.split (":");
- if (stre.length != 2) {
- return false;
- }
- var b = new Date ();
- var e = new Date ();
- var n = new Date ();
- b.setHours (strb[0]);
- b.setMinutes (strb[1]);
- e.setHours (stre[0]);
- e.setMinutes (stre[1]);
- n.setHours (strn[0]);
- n.setMinutes (strn[1]);
- if (n.getTime () - b.getTime () >= 0 && n.getTime () - e.getTime () <= 0) {
- return true;
- } else {
- return false;
- }
- };
-
- /**
- * 获取系统时间
- */
- this.allGetServerTime = function(){
- var nowTime = "";
- $.ajax({//后台获取系统当前时间
- url :'/nwyj/ws/response/responseService/getNowTime',
- type : 'post',
- dataType : 'text',
- async : false,
- timeout : 6000,
- success : function(result){
- nowTime=result;
- },error : function(e){
- //top.Dialog.alert("获取后台时间失败!");
- return new Date();
- }
- });
- // return nowTime.stringToDate();
- return nowTime;
- };
-
- /**
- * 得到日期类型时间{year:yyyy, md:mm/dd, hm:hh:mm, alltime:yyyy-mm-dd hh:mm:ss}
- * @param date 日期date
- * @returns {String}
- */
- this.getFormatDateTimeByMess = function(data){
- var month = data.getMonth() + 1 ;
- if(month<10)
- month = "0" + month ;
- var day = data.getDate() ;
- if(day<10)
- day = "0" + day ;
- var hour = data.getHours() ;
- if(hour<10)
- hour = "0" + hour ;
- var minute = data.getMinutes() ;
- if(minute<10)
- minute = "0" + minute ;
- var second = data.getSeconds() ;
- if(second<10)
- second = "0" + second ;
-
- return {year:data.getFullYear(), md: month + "/" + day, hm: hour + ":" + minute, alltime:data.getFullYear() + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second };
- };
-
- /**
- * 得到日期类型时间{year:yyyy, month:MM }
- * @param date 日期str
- * @returns {String}
- */
- this.getYearMonthByTest = function(data){
- // 2016-12
-
- var year = data.split("-")[0];
- var month = data.split("-")[1];
-
- return {year:year, month:month};
- };
-
- /**
- * 得到日期类型时间{year:yyyy, month:MM, day:dd, hh:hh, mm:mm, ss:ss, alltime:yyyy-mm-dd hh:mm:ss}
- * @param date 日期str
- * @returns {String}
- */
- this.formatDateTimeByTest = function(data){
- // 2016/12/19 13:44:05
- var a = data.split(" ");
-
- var year = a[0].split("-")[0];
- var month = a[0].split("-")[1];
- var day = a[0].split("-")[2];
-
- var hour = a[1].split(":")[0] ;
- var minute = a[1].split(":")[1] ;
- var second = a[1].split(":")[2] ;
-
- return {year:year, month:month, day:day, hour:hour, minute:minute, second:second, alltime:year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second };
- };
- /**
- * 获取当月天数
- * @param year 年str
- * @param month 月str
- * @returns {String}
- */
- this.getDaysOfMonth = function(year, month) {
- var d = new Date(year, month, 0);
- return d.getDate();
- };
- /**
- * 获取当天星期数
- * @param year 年str
- * @param month 月str
- * @param day 日str
- * @returns {String}
- */
- this.getWeek = function(year, month, day) {
- var d = new Date(year, month - 1, day);
- return d.getDay();
- };
- /**
- * 星期转换
- */
- this.getWeekShow = function(i) {
- switch (i) {
- case 0:
- return "日";
- case 1:
- return "一";
- case 2:
- return "二";
- case 3:
- return "三";
- case 4:
- return "四";
- case 5:
- return "五";
- case 6:
- return "六";
- }
- return "error";
- };
- };
|