fc7216349b3dbfa43428438c40e0a0a3118ca6da.svn-base 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. var role_id= top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  2. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  3. //单位id
  4. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  5. //保存单位id
  6. var corpId = deptId;
  7. //部门id
  8. var compId = top.com.sinosoft.lz.system.user.LoginInfo.getDept_id();
  9. //班组人员
  10. var deptFlag = getThing($.pathname() + "/ws/getRepotDept/ReportDeptService/getDictionaryRole", {
  11. "corpId" : deptId,
  12. "deptId" : compId
  13. }, "text");
  14. var grid;
  15. var tbzt = "tbzt=";
  16. var thisparams = {};
  17. var plan_id_g = "";
  18. var comp_id_g = "";
  19. var _thisUrl = window.location.href;//请求路径地址
  20. var roleObj = {"R002105430210":"系统运行部",
  21. "R002105430211":"生产设备部",
  22. "R002105430213":"安全监管部",
  23. "R002105430212":"市场营销部",
  24. "R002105430205":"应急办成员",
  25. "R002105430222":"专业管理部门(抢修中心)",
  26. };
  27. $(function() {
  28. var role = getRSCRole(role_id);//没有判断公司等级
  29. if(role.length>1){
  30. var yqRoleId = getUserZyRole(role);
  31. showRole(userId,yqRoleId);
  32. $("#roleDiv").find(".roleDiv").show();
  33. $("#searchPanel").removeClass("box2");
  34. }
  35. $("#msgSend").on("click",function(){
  36. if(len===0){
  37. top.Dialog.alert("没有计划需要填报,无需催报");
  38. return;
  39. }
  40. var allData = grid.options.data["rows"];
  41. var roleId="";
  42. if(role.length===1){
  43. roleId = role[0];
  44. }else{
  45. roleId = $("#roleSel").val();
  46. }
  47. var wtData = getWtData(allData,roleId);
  48. var wtDeptData = wtData.split("_")[0];
  49. var wtTime = wtData.split("_")[1];
  50. if(wtDeptData==""){
  51. top.Dialog.alert("此时间节点内,没有需要催报的人员");
  52. return;
  53. }
  54. //班组人员角色 传入部门id
  55. if(deptFlag!="false"&&deptFlag.indexOf(role)>-1){
  56. deptId = compId;
  57. }else{
  58. deptId = corpId;
  59. }
  60. var data = getThing( $.pathname()
  61. + '/ws/bbjk/QueryReportProgrammeServiceForReport/getSendPeople',{roleId:roleId,corpId:deptId,wtData:wtDeptData});
  62. var mobile = "";
  63. var name = "";
  64. if(data.length>0){
  65. for(var i=0;i<data.length;i++){
  66. mobile += data[i]["MOBILE"]+";";
  67. name += data[i]["REAL_NAME"]+";";
  68. }
  69. mobile = mobile.substring(0, mobile.lastIndexOf(";"));
  70. name = name.substring(0, name.lastIndexOf(";"));
  71. }
  72. addMsg(name,mobile,'您好,计划'+nameText+'在填报时间段'+wtTime+"您还有没填写上报的报表,请您尽快登陆系统进行填写上报");
  73. });
  74. //****布局
  75. var layout = $("#layout1").layout({
  76. leftWidth : 250,
  77. space:10
  78. });
  79. function customHeightSet(contentHeight) {
  80. $(".layout_content").height(contentHeight - 30);
  81. }
  82. $("#layout1").layout({
  83. onEndResize : function() {
  84. grid.resetWidth();
  85. var wi = $(".layout_content").width();
  86. wi = wi*0.85;
  87. $("#singleNav span a").css("width",wi+"px");
  88. }
  89. });
  90. function customHeightSet(contentHeight) {
  91. $(".cusBoxContent").height(contentHeight - 20);
  92. }
  93. $(".l-layout-left").css("overflow","auto");
  94. //生成左边面板名称:用户所在部门名称(按需求应是单位名称,这里先用部门名称放着)
  95. if(_thisUrl.indexOf("?")>-1 && _thisUrl.split("?").length==5){//报表汇总查询进入
  96. var date = _thisUrl.split("?")[4];
  97. $("#riqi").val(date);
  98. //设置角色
  99. var unitFlag = _thisUrl.split("?")[1];
  100. var roleId = _thisUrl.split("?")[2];
  101. var data = unitFlag=="true"?{"list":[{"value":"R002105430205","key":roleObj["R002105430205"]}]}:{"list":[{"value":roleId,"key":roleObj[roleId]}]};
  102. $("#roleSel").data("data",data);
  103. $("#roleSel").attr("disabled",true);
  104. $("#roleSel").render();
  105. $(".l-layout-header-inner").text(roleObj[roleId]);
  106. var task_id = _thisUrl.split("?")[3];
  107. initShow(roleId,unitFlag,task_id);
  108. }else{
  109. initShow(role[0],"","");
  110. $(".l-layout-header-inner").text(roleObj[role[0]]);
  111. }
  112. if($("#riqi").val()==""){
  113. currtime = currtime.split(" ")[0];
  114. $("#beginTime").val(currtime);
  115. renderDate();
  116. $("#riqi").val(currtime);
  117. }
  118. //点击筛选已填报或未填报
  119. $("input[type=checkbox]").bind("click",function(){
  120. var tbzt1 = "tbzt=";
  121. if($("#yitian").attr("checked")=="checked"){
  122. tbzt1 += "0";
  123. }
  124. if($("#weitian").attr("checked")=="checked"){
  125. tbzt1 += "1";
  126. }
  127. thisparams.tbzt = tbzt1;
  128. setDeptDataByCondition(thisparams);
  129. });
  130. $("#roleSel").on("change",function(){
  131. $("#singleNav").empty();
  132. var roleId = $(this).val();
  133. $(".l-layout-header-inner").text(roleObj[roleId]);
  134. initShow(roleId,"","");
  135. });
  136. });
  137. function showDeptGrid() {
  138. var myCols = [{name : 'RESPONSIBLE_NAME_322', width : "30%",align : 'left',render :_addStatus,isSort:false,
  139. headerRender:function(rowdata, rowindex, value, column){
  140. return '<div class="padding_left2"><span class="icon_btn_down" id="openAllTreeDom" data_stat="open">报表</span></div>';
  141. }
  142. },
  143. {display : '计划时间',name : 'PROGRAMME_TIME_322',width : "20%",type : 'int',align : 'center',
  144. render:function(rowdata,rowindex, value, column){
  145. if(rowdata.IS_OVERTIME_322=="是"){
  146. value = "<div class='bg_red'>"+value+"</div>";
  147. }
  148. return value;
  149. }},
  150. {display : '填报时间',name : 'updateTime',width : "20%",showTitle:true,align : 'center'},
  151. {display : '填报人',name : 'WRITER_322',width : "10%",showTitle:true,align : 'center'},
  152. {display : '是否填报',name : 'WRITER_STATE_322',width : "10%",align : 'center',
  153. render : function(rowdata,rowindex, value, column) {
  154. return "未填报" == value ? "<font color=blue>"
  155. + value + "</font>"
  156. : value;
  157. }
  158. },
  159. {display : '是否超时',name : 'IS_OVERTIME_322',width : "10%",align : 'center',
  160. render : function(rowdata,rowindex, value, column) {
  161. return "是" == value ? "<font color=red>"
  162. + value + "</font>"
  163. : value;
  164. }
  165. }
  166. ];
  167. grid = $("#maingrid").quiGrid({
  168. columns:myCols,
  169. width : '100%',
  170. checkbox : false,
  171. usePager : false,
  172. data : "",
  173. groupColumnName: "deptName",
  174. groupColumnDisplay: "填报部门"
  175. });
  176. //收缩按钮
  177. $("#openAllTreeDom").on("click",function(){
  178. var status = $("#openAllTreeDom").attr("data_stat");
  179. if(status=="open"){
  180. $(".l-grid-group-togglebtn").each(function(){
  181. $(this).removeClass("l-grid-group-togglebtn-close");
  182. });
  183. $(".l-grid-group-togglebtn").click();
  184. $(this).attr("data_stat","close").attr("class","icon_btn_up");
  185. }else if(status=="close"){
  186. $(".l-grid-group-togglebtn").each(function(){
  187. $(this).addClass("l-grid-group-togglebtn-close");
  188. });
  189. $(".l-grid-group-togglebtn-close").click();
  190. $(this).attr("data_stat","open").attr("class","icon_btn_down");
  191. }
  192. });
  193. };
  194. //点击计划,加载该计划下所有部门
  195. var nameText = "";
  196. var currtime = getServerTime();
  197. function checkedCurrent(is_date) {
  198. var roleArr = getYqRole(role_id);
  199. var roleId = "";
  200. var _this ="";
  201. var obj = $("#singleNav .current");
  202. if(obj.length===0){
  203. return;
  204. }
  205. if(!is_date){
  206. _this = obj.eq(0);
  207. }else{
  208. _this = $(this);
  209. $(this).parent().parent().find(".current").removeClass("current");
  210. $(this).addClass("current");
  211. }
  212. if(roleArr.length==1){
  213. roleId = roleArr[0];
  214. }else{
  215. roleId = $("#roleSel").attr("relValue");
  216. }
  217. if(!_this.hasClass("current")){
  218. //设置该菜单选中
  219. _this.siblings().removeClass("current");
  220. _this.addClass("current");
  221. }
  222. nameText = _this.text();
  223. var tbzt = "tbzt=";
  224. if($("#yitian").attr("checked")=="checked"){
  225. tbzt += "0";
  226. }
  227. if($("#weitian").attr("checked")=="checked"){
  228. tbzt += "1";
  229. }
  230. var rowdata = _this.data("rowdata");
  231. if(!is_date){
  232. }else{
  233. currtime = currtime.split(" ")[0];
  234. var time = rowdata.START_TIME.split(" ")[0];
  235. $("#beginTime").val(time);
  236. renderDate();
  237. if(_thisUrl.indexOf("?")>-1 && _thisUrl.split("?").length==5){
  238. $("#riqi").val(_thisUrl.split("?")[4]);
  239. }else{
  240. $("#riqi").val(currtime);
  241. }
  242. }
  243. var selectDate = $("#riqi").val();
  244. var stat = _this.data("data-stat");
  245. thisparams = {
  246. "tbzt": tbzt,
  247. "planId" : rowdata.FD_OBJECTID,
  248. "EARLY_WARNING_ID" : rowdata.WARNING_NUMBER,
  249. "START_TIME" : rowdata.START_TIME,
  250. "CIRCLE_TIME" : rowdata.ROUND_TIME,
  251. "WRITE_DATE_TYPE" : rowdata.FILL_IN_SCHEDULE,
  252. "TEMPORARY_TIME" : rowdata.TEMPORARY_TIME,
  253. "WRITE_DEPT_ID" : rowdata.REPORT_DEPT,
  254. "REPORT_TYPE" : rowdata.REPORT_TYPE,
  255. "UPDATEDATE":rowdata.SEND_TIME,
  256. "corp_id":deptId,
  257. "role_id":roleId,
  258. "selectDate":selectDate
  259. };
  260. if(stat){
  261. thisparams["plan_stat"] = stat;
  262. }
  263. setDeptDataByCondition(thisparams);
  264. }
  265. //显示计划下所有部门填报情况
  266. function setDeptDataByCondition(params) {
  267. $("body").eq(0).showLoading();
  268. $.ajax({
  269. url : $.pathname()
  270. + '/ws/bbjk/QueryReportProgrammeServiceForReport/loadReportInputDetail',
  271. type : 'post',
  272. //timeout : 15000,
  273. data : params,
  274. dataType : 'json',
  275. async :false,
  276. success : function(data) {
  277. $("body").eq(0).hideLoading();
  278. // alert(JSON.stringify(data));
  279. grid.setOptions({
  280. "data" : data
  281. });
  282. //grid.loadData();
  283. setHt();
  284. },
  285. error : function(e) {
  286. $.messager.alert('访问服务失败!', 'error');
  287. }
  288. });
  289. }
  290. function _canDownload(rowdata,rowindex, value, column){
  291. var returndata = "<font class='nodownload'>下载</font>";
  292. var fd_id = rowdata.fd_object_id;
  293. var params ={
  294. listId : 110,
  295. condition : "is_Del = '0' and MainId ='"+ fd_id + "'"
  296. };
  297. var url1 = $.pathname() + "/ws/uploadForm/FileUpDownService/queryFiles";
  298. var url = "";
  299. $.ajax({
  300. url : url1,
  301. data : params,
  302. type : 'post',
  303. dataType : 'json',
  304. async :false,
  305. success : function(result){
  306. if(result.rows.length==0){
  307. }else if(result.rows.length==1){
  308. url = $.pathname() + '/page/common/getFileExc.jsp?objectID=' + result.rows[0].FD_OBJECTID110
  309. + "&filename=" + encodeURI(encodeURI(result.rows[0].SAVENAME_110))
  310. + "." + result.rows[0].FILEEXT_110 + "&downfilename=" + encodeURI(encodeURI(result.rows[0].NAME_110))+ "." + result.rows[0].FILEEXT_110;
  311. returndata = '<a onclick="javascript:window.open(\'' + url + '\')" class="hasFile">下载</a>&nbsp;&nbsp;';
  312. }else{
  313. var downfilename = "";
  314. var filenames = "";
  315. for (var i = 0; i < result.rows.length; i++) {
  316. downfilename += result.rows[i].NAME_110+ "." + result.rows[i].FILEEXT_110 +";";
  317. filenames += result.rows[i].SAVENAME_110+ "." + result.rows[i].FILEEXT_110 +";";
  318. }
  319. var url = "/nwyj/page/business/am/org/query/downZipFile.jsp?downfilename="+encodeURI(encodeURI(filenames))+"&filenames="+encodeURI(encodeURI(downfilename));
  320. returndata = '<a onclick="javascript:window.open(\'' + url + '\')" class="hasFile">下载</a>&nbsp;&nbsp;';
  321. }
  322. },
  323. error : function(e) {
  324. $.messager.alert('查询附件失败');
  325. }
  326. });
  327. return returndata;
  328. }
  329. //对填报部门列进行渲染
  330. function _addStatus(rowdata, rowindex, value, column){
  331. //if(value=="预警行动信息报告" || value=="预警总结报告"){
  332. var now = getServerTime().replace(/-/g,"/");//allGetServerTime();
  333. var timestr = rowdata.PROGRAMME_TIME_322.replace(/-/g,"/");
  334. var progressTime = new Date(timestr);
  335. if(rowdata.IS_OVERTIME_322=="是"){
  336. //超时,红色
  337. if(rowdata.WRITER_STATE_322=="已填报"){
  338. var object_id = '"'+rowdata.fd_object_id+'"';
  339. var comp_id='"'+rowdata.deptId+'"';
  340. var report_type=rowdata.report_type;
  341. var reporterId = '"'+rowdata.WRITER_ID_322+'"';
  342. return "<div><a href='javascript:openbaobiao("+object_id+","+comp_id+","+report_type+","+reporterId+")'><span style='margin-left:25px;margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/red1.png'/></span>" + value + "</a></div>";
  343. }else{
  344. return "<div><a><span style=' margin-left:25px;margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/red1.png'/></span>" + value + "</a></div>";
  345. }
  346. //return "<div><a><span style='margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/red1.png'/></span>" + value + "</a></div>";
  347. }else if(rowdata.WRITER_STATE_322=="已填报"){
  348. //否则,已填报,绿色
  349. var object_id = '"'+rowdata.fd_object_id+'"';
  350. var comp_id='"'+rowdata.deptId+'"';
  351. var report_type=rowdata.report_type;
  352. var reporterId = '"'+rowdata.WRITER_ID_322+'"';
  353. return "<div><a href='javascript:openbaobiao("+object_id+","+comp_id+","+report_type+","+reporterId+")'><span style='margin-left:25px;margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/green1.png'/></span>" + value + "</a></div>";
  354. }else if(rowdata.WRITER_STATE_322=="未填报"){
  355. if(Date.parse(now)+1000*60*15>Date.parse(progressTime) && Date.parse(now) < Date.parse(progressTime)){
  356. //若时间将近(在1小时之内了),则黄色
  357. return "<div><a><span style='margin-left:25px;margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/yellow1.png'/></span>" + value + "</a></div>";
  358. }else{
  359. //绿色
  360. return "<div><a><span style='margin-left:25px;margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/green1.png'/></span>" + value + "</a></div>";
  361. }
  362. }
  363. //}
  364. else{
  365. return value;
  366. }
  367. }
  368. function setHt(){
  369. $(window.document.body).height($("#layout1 .padding_right5").height()+$("._statusBar").height()+$("#searchPanel").height()+30);
  370. $(parent.document.body).find("iframe").height($(window.document.body).height());
  371. }
  372. function openbaobiao(object_id,comp_id,report_type,reporterId){
  373. //alert(object_id);
  374. var deptLevel = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getDeptLevel",{"comp_id":comp_id},"text");
  375. var roleId = "";
  376. var roleArr = getYqRole(role_id);
  377. if(roleArr.length==1){
  378. roleId = roleArr[0];
  379. }else{
  380. roleId = $("#roleSel").attr("relValue");
  381. if("R002105430205"==roleId){
  382. roleId = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getRoleIdByReportType",{"report_type":report_type},"text");
  383. }
  384. }
  385. //parent.parent.window.open("/nwyj/page/business/em/report/Report_View.html?监控"+"?"+object_id+"?"+report_type+"?"+comp_id+"?"+roleId+"?"+deptLevel+"?"+reporterId, "_blank");
  386. $.indexOpenNextWindow("/nwyj/page/business/em/report/Report_View.html?监控"+"?"+object_id+"?"+report_type+"?"+comp_id+"?"+roleId+"?"+deptLevel+"?"+reporterId, "_blank");
  387. }
  388. var len = 0;
  389. function initShow(role,flag,task_id){
  390. $.ajax({
  391. url : $.pathname()+ '/ws/bbjk/QueryReportProgrammeServiceForReport/loadReportPlan',
  392. type : 'post',
  393. //timeout : 15000,
  394. data : {'deptId':deptId,'role_id':role,"flag":flag,"task_id":task_id},
  395. dataType : 'json',
  396. async :false,
  397. success : function(data) {
  398. debugger;
  399. // alert(JSON.stringify(data));
  400. //调用方法加载右边的表格
  401. showDeptGrid();
  402. len = data.length;
  403. //console.log(JSON.stringify(data));
  404. if(data.length>0){
  405. for (var i = 0; i < data.length; i++) {
  406. var name = data[i].name;
  407. var projectData = data[i].list;
  408. var $pdom = $('<a href="javascript:;" title="'+name+'" class="titlebar">'+ name+'</a>');
  409. $("#singleNav").append($pdom);
  410. var $dd = $("<div style='display:none;' class='parentNavDiv'></div>");
  411. $("#singleNav").append($dd);
  412. for(var k=0;k<projectData.length;k++){
  413. var $cdom = $('<div title='+projectData[k]["PROJECT_NAME"]+' class="leftnav" id="'+projectData[k]["FD_OBJECTID"]+'">'+projectData[k]["PROJECT_NAME"]+'</div>');
  414. if(name=="上级计划"){
  415. $cdom.data("data-stat",'sj');
  416. }
  417. $cdom.data("rowdata",projectData[k]);
  418. $cdom.bind("click",checkedCurrent);
  419. $dd.append($cdom);
  420. }
  421. }
  422. if(_thisUrl.indexOf("?")>-1 && _thisUrl.split("?").length==5){
  423. var $selectDom = $(".leftnav").each(function(){
  424. var _this = $(this);
  425. if(task_id.indexOf(_this.attr("id"))>-1){
  426. return this;
  427. }
  428. });
  429. var $titlebar = null;
  430. if(flag=="true"){
  431. if($selectDom.data("data-stat")=="sj"){
  432. $titlebar = $("#singleNav").find("a[title='上级计划']");
  433. }else{
  434. $titlebar = $("#singleNav").find("a[title='本级计划']");
  435. }
  436. }else{
  437. $titlebar = $("#singleNav").find("a[title='下级计划']");
  438. }
  439. $titlebar.click();
  440. $(".current").removeClass("current");
  441. $selectDom.addClass("current");
  442. $selectDom.click();
  443. }else{
  444. $("#singleNav").find("a").eq(0).click();
  445. $("#singleNav").find(".parentNavDiv").eq(0).find(".leftnav").eq(0).addClass("current");
  446. $("#singleNav").find(".parentNavDiv").eq(0).find(".leftnav").eq(0).click();
  447. }
  448. }
  449. },
  450. error : function(e) {
  451. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  452. }
  453. });
  454. }
  455. function showRole(userId,zyRoleId){
  456. $.ajax({
  457. url : $.pathname() +"/ws/getUserRole/GetRoleService/getUserRole",
  458. type : 'post',
  459. timeout : 15000,
  460. async : false,
  461. data : {
  462. userId:userId,
  463. roleId:zyRoleId
  464. },
  465. dataType : 'json',
  466. success : function(data) {
  467. $("#roleSel").data("data",data);
  468. $("#roleSel").render();
  469. },
  470. error : function(e) {
  471. $.messager.alert('查询报表类型失败', '访问服务失败!', 'error');
  472. }
  473. });
  474. }
  475. function getWtData(data,role){
  476. var arr = [];
  477. var returnData = "";
  478. var nowWriteTime = "";
  479. var now = getServerTime().replace(/-/g,"/");
  480. now = new Date(now).getTime();
  481. var hourSecond = 60*60*1000;
  482. var time1 = now+hourSecond;
  483. var time2 = now-hourSecond;
  484. for(var i=0;i<data.length;i++){
  485. var dataObj = data[i];
  486. var stat = dataObj["WRITER_STATE_322"];
  487. var planTime = new Date(dataObj["PROGRAMME_TIME_322"].replace(/-/g,"/")).getTime();
  488. if(stat=="未填报" && (time1>=planTime && time2<=planTime)){
  489. nowWriteTime = dataObj["PROGRAMME_TIME_322"];
  490. if("R002105430205"==role){
  491. if($.inArray(dataObj["report_type"],arr)==-1){
  492. arr.push(dataObj["report_type"]);
  493. returnData += dataObj["report_type"]+",";
  494. }
  495. }else{
  496. if($.inArray(dataObj["deptId"],arr)==-1){
  497. arr.push(dataObj["deptId"]);
  498. returnData += dataObj["deptId"]+",";
  499. }
  500. }
  501. }
  502. }
  503. returnData = returnData.substring(0, returnData.lastIndexOf(","));
  504. returnData += "_"+nowWriteTime;
  505. return returnData;
  506. }
  507. /***重置日期框***/
  508. function renderDate(){
  509. //获取当前主题风格,用于设置日期控件的皮肤
  510. try {
  511. dateSkin=themeColor;
  512. }
  513. catch(e){};
  514. document.getElementById('riqi').onfocus=function(){
  515. var $riqi=$dp.$('riqi');
  516. //这里设置了最大日期为当前日期,如果不需要则把maxDate:'%y-%M-%d'去掉
  517. WdatePicker({skin:dateSkin,onpicked:function(){$riqi.blur();checkedCurrent(false);},maxDate:'%y-%M-%d',minDate:'#F{$dp.$D(\'beginTime\')}'});
  518. };
  519. }
  520. function getNowDateTime(time){
  521. var now=null;
  522. if(time){
  523. now = new Date(time);
  524. }else{
  525. now=allGetServerTime();
  526. }
  527. //获取年份
  528. var year=now.getFullYear();
  529. //获取月份
  530. var month=now.getMonth()+1;
  531. if(month>=1&&month<=9){
  532. month = "0"+month;
  533. }
  534. //获取日期
  535. var day=now.getDate();
  536. if(day>=1&&day<=9){
  537. day = "0"+day;
  538. }
  539. //获取小时
  540. var hours=now.getHours();
  541. if(hours>=1&&hours<=9){
  542. hours = "0"+hours;
  543. }
  544. //获取分钟
  545. var minutes=now.getMinutes();
  546. if(minutes>=1&&minutes<=9){
  547. minutes = "0"+minutes;
  548. }
  549. var seconds = now.getSeconds();
  550. if(seconds>=1&&seconds<=9){
  551. seconds = "0"+seconds;
  552. }
  553. var currentTime =year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds;
  554. return currentTime;
  555. }