StartTime = ""; EndTime = ""; ReportType = ""; var isExporting = false; var exportTaskList = new Array(); var batchExportTimer; function CreateDayMonthReportShow(x, y, width, height, pageHeight, jsonFileNameData, jsonFileNameFunc, ReportFileName, dayMonth, paneStyle) { var toolBarHeight = 66 * ratio.ratioY; var toolBar2Height = 12 * ratio.ratioY; var buttonLabelFont = 18*ratio.ratioY+'px "苹方 粗体"'; var timeLabelFont = 18 * ratio.ratioY +'px "苹方 粗体"';//时间选择 var timeTextLabelFont = 18 * ratio.ratioY +'px "苹方 粗体"';//开始时间,结束时间 var listViewLabelFont = 18 * ratio.ratioY + 'px "苹方 粗体"'; var transparentColor = 'rgba(0,0,0,0)'; var toolBarBackColor = transparentColor;//"00000000";//"#0005194B"; var range = width - 100 * ratio.ratioX;//底部 两个按钮的间矩 var openStartTime = new Date(); var borderPaneRealNode = new ht.HtmlNode(); ReportType = dayMonth; //布局控件 borderPaneDayReport = new ht.widget.BorderPane(); var innerPane = new ht.widget.BorderPane(); //开始补帛 var startReculate=false; var listViewWidth = 140 * ratio.ratioX; var listViewHeight = 44 * ratio.ratioY; ReportFileName1 = ReportFileName; //表格控件 var ReportDiv = document.createElement("div"); //ReportDiv.style.backgroundColor=paneStyle.paneBackColor; var ReportDivChild = document.createElement("div"); //ReportDivChild.style.backgroundColor=paneStyle.paneBackColor; ReportDiv.appendChild(ReportDivChild); ReportDivChild.className = "sample-turtorial"; var reportWidth = width - listViewWidth; var reportHeight = (height) - toolBarHeight - toolBar2Height + 1; ReportDivChild.style = 'width:' + reportWidth + 'px; height:' + reportHeight + 'px;border: 1px solid gray;'; //ReportDivChild.style = 'width:100%; height:100%;border: 1px solid gray;'; ReportSpread = new GC.Spread.Sheets.Workbook(ReportDivChild, { sheetCount: 1 }); ReportDivChild.style.border = "1px solid " + toolBarBackColor; ChangeScrollBarStyle(); //页面缩放报表要自适应 var resizeTimer = 0; //window.onresize = function () { $(window).on('resizeOver', function (e) { clearTimeout(resizeTimer); resizeTimer = setTimeout(function () { console.log(ReportDiv.style.height); ReportDivChild.style.height = ReportDiv.style.height; ReportSpread.refresh(); ChangeScrollBarStyle(); range = toolbar2.getWidth()-300; var botRange=toolbar2.getItemById("botRange"); if (botRange) botRange.textField.width=range; }, 500); }); //表格加入布局 //borderPaneDayReport.setRightView(ReportDiv,width-180); borderPaneDayReport.setCenterView(ReportDiv); var NodeStartTimeDiv = document.createElement("input"); NodeStartTimeDiv.style.color = '#DADBAC';// paneStyle.DialogTitleFontColor; NodeStartTimeDiv.style.font=timeLabelFont; NodeStartTimeDiv.style.backgroundColor =transparentColor; NodeStartTimeDiv.className="back-size100"; NodeStartTimeDiv.style.width = 163*ratio.ratioX+'px'; NodeStartTimeDiv.style.height = 36*ratio.ratioY+'px'; NodeStartTimeDiv.style.border='none'; document.body.appendChild(NodeStartTimeDiv); NodeStartTimeDiv.style.background = "url(" + PAGEROOTDIR +"/script/image/date.png)"; NodeStartTimeDiv.style.padding =8* ratio.ratioY+'px '+15* ratio.ratioX+'px'; var NodeEndTimeDiv = document.createElement("input"); NodeEndTimeDiv.style.color = '#DADBAC'; NodeEndTimeDiv.style.backgroundColor = toolBarBackColor;// paneStyle.paneBackColor; NodeEndTimeDiv.style.font=timeLabelFont; NodeEndTimeDiv.className = "back-size100"; NodeEndTimeDiv.style.width = 164*ratio.ratioX+'px'; NodeEndTimeDiv.style.height = 36*ratio.ratioY+'px'; NodeEndTimeDiv.style.border='none'; NodeEndTimeDiv.style.background = "url(" + PAGEROOTDIR +"/script/image/date.png)"; NodeEndTimeDiv.style.padding = 8 * ratio.ratioY + 'px ' + 15 * ratio.ratioX + 'px'; document.body.appendChild(NodeEndTimeDiv); //时间选择控件 初始化时间 if (ReportType == "DayReport") { var tempDate = new Date(); //昨天 tempDate.setDate(tempDate.getDate() - 1); tempDate.setHours(0); tempDate.setMinutes(0); tempDate.setSeconds(0); StartTime = tempDate.toDateString() + " " + tempDate.toTimeString(); //初始化起始时间 //30天前 tempDate = new Date(); tempDate.setDate(tempDate.getDate() - 30); tempDate.setHours(0); tempDate.setMinutes(0); tempDate.setSeconds(0); SetTimeSelectDivValue(NodeStartTimeDiv, tempDate, 'date'); //今天0点 tempDate = new Date(); tempDate.setHours(0); tempDate.setMinutes(0); tempDate.setSeconds(0); SetTimeSelectDivValue(NodeEndTimeDiv, tempDate, 'date'); EndTime = tempDate.toDateString() + " " + tempDate.toTimeString(); } else if (ReportType == "MonthReport") { var tempDate = new Date(); //上月一号 tempDate.setMonth(tempDate.getMonth() - 1); tempDate.setDate(1); tempDate.setHours(0); tempDate.setMinutes(0); tempDate.setSeconds(0); StartTime = tempDate.toDateString() + " " + tempDate.toTimeString(); //12月前一号 tempDate = new Date(); tempDate.setMonth(tempDate.getMonth() - 12); tempDate.setDate(1); tempDate.setHours(0); tempDate.setMinutes(0); tempDate.setSeconds(0); SetTimeSelectDivValue(NodeStartTimeDiv, tempDate, 'month'); //本月一号 tempDate = new Date(); tempDate.setDate(1); tempDate.setHours(0); tempDate.setMinutes(0); tempDate.setSeconds(0); SetTimeSelectDivValue(NodeEndTimeDiv, tempDate, 'month'); EndTime = tempDate.toDateString() + " " + tempDate.toTimeString(); } else //自定义报表 { var tempDate = new Date(); //昨天 tempDate.setDate(tempDate.getDate() - 1); tempDate.setHours(0); tempDate.setMinutes(0); tempDate.setSeconds(0); StartTime = tempDate.toDateString() + " " + tempDate.toTimeString(); //初始化起始时间 //30天前 tempDate = new Date(); tempDate.setDate(tempDate.getDate() - 30); tempDate.setHours(0); tempDate.setMinutes(0); tempDate.setSeconds(0); SetTimeSelectDivValue(NodeStartTimeDiv, tempDate, 'date'); //今天0点 tempDate = new Date(); tempDate.setHours(0); tempDate.setMinutes(0); tempDate.setSeconds(0); SetTimeSelectDivValue(NodeEndTimeDiv, tempDate, 'date'); EndTime = tempDate.toDateString() + " " + tempDate.toTimeString(); } var beforeImportTime = new Date(); console.log("before import use time:" + (beforeImportTime - openStartTime)); //初始化报表 if (ReportType != "OwnerReport") { //网格线不显示, 此项耗时约50ms importJSON(ReportSpread, jsonFileNameData); var activeSheet = ReportSpread.getActiveSheet(); FreshReport(ReportSpread, "", paneStyle.ExportWhiteBackBlackFont, jsonFileNameFunc); //延迟执行,否则影响速度 setTimeout(function () { ReportSpread.suspendPaint(); var rowNum = activeSheet.getRowCount(); var colNum = activeSheet.getColumnCount(); ReportSpread.options.backColor = paneStyle.paneBackColor; ReportSpread.options.grayAreaBackColor=paneStyle.paneBackColor; activeSheet.options.gridline = { color: "#FF2235", showVerticalGridline: false, showHorizontalGridline: false }; for(var i=0;i= tempStartTime && tempEndTime1 <= tempEndTime) AddListViewElem(listView, val); }); listView.setSortFunc(sortFunc); } else //自定义报表 { FreshReport(ReportSpread, "", false); } } lookButton2.drawBackground= function (A, Y, g, xx, U, X) { X && (A.fillStyle = X); A.beginPath(); A.fillStyle = 'red'; A.rect(Y, g, x, U); A.fill(); } //报表导出 downloadButton2 = new ht.widget.Button(); downloadButton2.setWidth(70 * ratio.ratioX); downloadButton2.setHeight(29 * ratio.ratioY); downloadButton2.setLabel("导出"); downloadButton2.setLabelFont(buttonLabelFont); //downloadButton2.setBorderColor(typeof (paneStyle) == "undefined" ? "#4682B4" : paneStyle.btnBackColor); //downloadButton2.setBackground(typeof (paneStyle) == "undefined" ? "#4682B4" : paneStyle.btnBackColor); downloadButton2.setLabelColor(typeof (paneStyle) == "undefined" ? "#FFFAF0" : paneStyle.btnFontColor); downloadButton2.setSelectBackground(transparentColor); downloadButton2.setBorderColor(transparentColor); downloadButton2.setBackground(transparentColor); downloadButton2.onClicked = function (e) { if (!SelectTime) return; SpreadExport(ReportSpread, ReportFileName + "(" + SelectTime + ")", paneStyle.ExportWhiteBackBlackFont); } SetButtonStyle(downloadButton2, "f2button", "#333"); $btnView = $(downloadButton2.getView()); $btnView.css("background-size", "70px 29px"); //数据补抽 var recaluBtn = new ht.widget.Button(); recaluBtn.setWidth(100 * ratio.ratioX); recaluBtn.setHeight(29 * ratio.ratioY); recaluBtn.setLabel("数据补抽"); recaluBtn.setLabelFont(buttonLabelFont); recaluBtn.setBorderColor(transparentColor); recaluBtn.setBackground(transparentColor); //recaluBtn.setBorderColor(typeof (paneStyle) == "undefined" ? "#4682B4" : paneStyle.btnBackColor); //recaluBtn.setBackground(typeof (paneStyle) == "undefined" ? "#4682B4" : paneStyle.btnBackColor); recaluBtn.setLabelColor(typeof (paneStyle) == "undefined" ? "#FFFAF0" : paneStyle.btnFontColor); SetButtonStyle(recaluBtn,"f4button","#333"); $btnView=$(recaluBtn.getView()); $btnView.css("background-size","100px 29px"); recaluBtn.onClicked = function (e) { startReculate=true; progressBtn.setWidth(60); if (ReportType == "DayReport") { StartTime = NodeStartTimeDiv.value + " 0:0:0"; EndTime = NodeEndTimeDiv.value + " 0:0:0"; } else if (ReportType == "MonthReport") { StartTime = NodeStartTimeDiv.value + "-1 0:0:0"; EndTime = NodeEndTimeDiv.value + "-1 0:0:0"; } else { StartTime = NodeStartTimeDiv.value + " 0:0:0"; EndTime = NodeEndTimeDiv.value + " 0:0:0"; } recaluBtn.setDisabled(true); var obj = new CommandObj(); obj.method = "HisDataReGet"; obj.parm1 = StartTime; obj.parm2 = EndTime; var objStr = JSON.stringify(obj); socket.send(objStr); } //进度按钮 var progressBtn = new ht.widget.Button(); progressBtn.setWidth(0); progressBtn.setLabel("0%"); progressBtn.setLabelFont(buttonLabelFont); progressBtn.setBorderColor(typeof (paneStyle) == "undefined" ? "#4682B4" : toolBarBackColor); progressBtn.setBackground(typeof (paneStyle) == "undefined" ? "#4682B4" : toolBarBackColor); progressBtn.setLabelColor(typeof (paneStyle) == "undefined" ? "#FFFAF0" : paneStyle.btnFontColor); //进度条 ht.Default.setImage('progress', { width: 150, height: 12, comps: [ // 绘制背景 { type: 'rect', rect: { x: 0, y: 0, width: 115, height: 12 }, background: { func: function (data) { return data.a('background'); } } }, // 绘制前景 { rect: { x: 0, y: 0, width: 115, height: 12 }, type: function (g, rect, comp, data, view) { var width = rect.width, height = rect.height, value = data.getValue(), foreWidth = width / 100 * value; g.fillStyle = data.a('foreground'); g.fillRect(0, 0, foreWidth, height); } } ] }); //进度条 var progressNode = new ht.widget.Slider(); progressNode.setBackground(toolBarBackColor); progressNode.setMax(100); progressNode.setMin(0); progressNode.setButton(""); progressNode.setThickness(16*ratio.ratioY); progressNode.setValue(0); progressNode.setWidth(200 * ratio.ratioX); progressNode.setDisabled(true); //进度条不可点击 var proView = progressNode.getView(); if (proView.childNodes.length >= 2) { proView.childNodes[1].style.backgroundColor = "rgba(0,0,0,0)"; } //重绘进度条圆角效果 progressNode.drawBackground = function (A, Y, g, xx, U, X) { if(!startReculate) return; X && (A.fillStyle = X); A.beginPath(); A.fillStyle =paneStyle.paneBackColor; //A.rect(Y, g, x, U); drawRoundRect(A, Y, g, xx, U, 8 * ratio.ratioX, 8 * ratio.ratioY, "#083684",1) A.fill(); } progressNode.drawLeftBackground = function (A, Y, g, xx, U, X) { X && (A.fillStyle = X); if(xx<2)//宽度小于2,不画 return; A.beginPath(); A.fillStyle ="#7EF9FE";// paneStyle.btnFontColor; //A.rect(Y, g, x, U); drawRoundRect(A, Y, g, xx, U, 8* ratio.ratioX, 8*ratio.ratioY, X, 1) A.fill(); } //批量导出 var batchExportBtn = new ht.widget.Button(); batchExportBtn.setWidth(125* ratio.ratioX); batchExportBtn.setHeight(28 * ratio.ratioY); batchExportBtn.setLabel("批量导出"); batchExportBtn.setLabelFont(buttonLabelFont); batchExportBtn.setBorderColor(typeof (paneStyle) == "undefined" ? "#4682B4" : paneStyle.btnBackColor); batchExportBtn.setBackground(typeof (paneStyle) == "undefined" ? "#4682B4" : paneStyle.btnBackColor); batchExportBtn.setLabelColor(typeof (paneStyle) == "undefined" ? "#FFFAF0" : paneStyle.btnFontColor); batchExportBtn.setSelectBackground(transparentColor); batchExportBtn.setBorderColor(transparentColor); batchExportBtn.setBackground(transparentColor); $btnView = $(batchExportBtn.getView()); $btnView.css("background-size", "100px 29px"); $btnView.css("left","0px"); SetButtonStyle(batchExportBtn, "xxxxxx", "#094196"); batchExportBtn.onClicked = function (e) { var dataArray = listView.dm(); if (!dataArray) return; if (!dataArray._datas) return; dataArray._datas.forEach(function (val, index, arr) { exportTaskList.push(val.a('Name')); }); batchExportTimer = setInterval(DoExportTask, 1000); } //批量导出 function DoExportTask() { if (!exportTaskList) { clearInterval(batchExportTimer); return; } if (exportTaskList.length <= 0) { clearInterval(batchExportTimer); return; } if (isExporting) return; var dateStr = exportTaskList.pop(); if (ReportType == "DayReport") { var tempEndTime1 = new Date(Date.parse(dateStr + " 0:0:0")); StartTime = tempEndTime1.toDateString() + " 0:0:0"; tempEndTime1.setDate(tempEndTime1.getDate() + 1); EndTime = tempEndTime1.toDateString() + " 0:0:0"; } else if (ReportType == "MonthReport") { var tempEndTime1 = new Date(Date.parse(dateStr + " 0:0:0")); StartTime = tempEndTime1.toDateString() + " 0:0:0"; tempEndTime1.setMonth(tempEndTime1.getMonth() + 1); tempEndTime1.setSeconds(tempEndTime1.getSeconds() - 1); EndTime = tempEndTime1.toDateString() + " 23:59:59"; } isExporting = true; FreshReport(ReportSpread, ReportFileName + "(" + dateStr + ")", paneStyle.ExportWhiteBackBlackFont); } // toolbar.getSelectBackground = function(item){ return '#3D97D0'; }; //toolbar.getSelectBackground = function(item){ return "red"; }; //设置工具栏背景色 toolbar.getView().style.background = toolBarBackColor;// paneStyle.paneBackColor; toolbar2.getView().style.background = toolBarBackColor;// paneStyle.paneBackColor; toolbar.setItems([ { id: 'text', label: ' ', unfocusable: true, textField: { width: 150 * ratio.ratioX, height:0, background: toolBarBackColor, color: paneStyle.paneBackColor, border: 'none', editable: false, } }, { id: 'nation', unfocusable: true, textField: { text: '开始时间:', width: 90 * ratio.ratioX, background: "#00000000", color: '#A0A0A0',//paneStyle.DialogTitleFontColor, border: 'none', editable: false, font: timeTextLabelFont, } }, { id: 'nation', unfocusable: true, label: ' ', element: NodeStartTimeDiv }, { id: 'nation', unfocusable: true, textField: { text: '', width: 20, height: 0, background: toolBarBackColor, color: paneStyle.DialogTitleFontColor, border: 'none', editable: false } }, { id: 'nation', unfocusable: true, textField: { text: '结束时间:', width: 90 * ratio.ratioX, background: "#00000000", color: '#A0A0A0',// paneStyle.DialogTitleFontColor, border: 'none', editable: false, font: timeTextLabelFont, } }, { id: 'nation', unfocusable: true, label: ' ', element: NodeEndTimeDiv }, { id: 'nation', unfocusable: true, textField: { text: '', width: 20, height:0, background: toolBarBackColor, color: paneStyle.DialogTitleFontColor, border: 'none', editable: false } }, { label: '', unfocusable: true, element: lookButton2 }, { id: 'nation', unfocusable: true, textField: { text: '', width: 20, height: 0, background: toolBarBackColor, color: paneStyle.DialogTitleFontColor, border: 'none', editable: false } }, { label: '', unfocusable: true, element: downloadButton2 }, { id: 'nation', unfocusable: true, textField: { text: '', width: 20, height:0, background: toolBarBackColor, color: paneStyle.DialogTitleFontColor, border: 'none', editable: false } }, { label: '', unfocusable: true, element: recaluBtn }, { label: '', unfocusable: true, element: progressNode }, { label: '', unfocusable: true, element: progressBtn }, ]); /* toolbar2.setItems([ { id: 'botRange', label: ' ', unfocusable: true, visible: true, textField: { width: range, height:0, background: toolBarBackColor, color: paneStyle.paneBackColor, border: 'none', editable: false } }, { label: '', unfocusable: true, element: downloadButton2 }, ]); */ //建立一个websocket链接 var socket = new WebSocket('ws://' + webServiceIP + ':10087/Command'); // 打开Socket socket.onopen = function (event) { console.log('web socket connceted!', event); if (dayMonth == "DayReport") //请求报表生成日期列表 socket.send("{\"method\":\"GetHaveSaveDayList\"}"); else if (dayMonth == "MonthReport") socket.send("{\"method\":\"GetHaveSaveMonthList\"}"); else if (dayMonth == "OwnerReport") socket.send("{\"method\":\"GetOwnReportXlsxList\"}"); }; //日期列表 日 var dayStrList = new Array(); var isInitListView=false; // 监听消息 socket.onmessage = function (event) { console.log('Client received a message', event); var receiveObj = JSON.parse(event.data); var tempStartTime = new Date(Date.parse(NodeStartTimeDiv.value + " 0:0:0")); tempStartTime.setMilliseconds(0); var tempEndTime = new Date(Date.parse(NodeEndTimeDiv.value + " 0:0:0")); tempEndTime.setMilliseconds(0); if (receiveObj.method == "GetHaveSaveDayList") //获得日报表列表 { if (ReportType != "DayReport") return; var dayList = JSON.parse(receiveObj.obj); listView.dm().clear(); dayStrList = new Array(); dayList.forEach(function (val, index, arr) { dayStrList.push(val); var tempEndTime1 = new Date(Date.parse(val.Name + " 0:0:0")); tempEndTime1.setMilliseconds(0); var nowDay = new Date(); nowDay.setHours(0); nowDay.setMinutes(0); nowDay.setSeconds(0); nowDay.setMilliseconds(0); if (tempEndTime1 >= tempStartTime && tempEndTime1 <= tempEndTime && tempEndTime1 < nowDay)//不能超过今天0点 { var data= AddListViewElem(listView, val); if(!isInitListView) { listView.getSelectionModel().setSelection(data); SelectTime = data.a('Name'); } } }); isInitListView=true; listView.setSortFunc(sortFunc); } else if (receiveObj.method == "GetHaveSaveMonthList") //获得月报表列表 { if (ReportType != "MonthReport") return; var dayList = JSON.parse(receiveObj.obj); listView.dm().clear(); dayStrList = new Array(); dayList.forEach(function (val, index, arr) { dayStrList.push(val); var tempEndTime1 = new Date(Date.parse(val.Name + "-1 0:0:0")); tempEndTime1.setMilliseconds(0); if (tempEndTime1 >= tempStartTime && tempEndTime1 <= tempEndTime) { var data= AddListViewElem(listView, val); if(!isInitListView) { listView.getSelectionModel().setSelection(data); SelectTime = data.a('Name'); } } }); listView.setSortFunc(sortFunc); } else if (receiveObj.method == "GetReportJsFile") //获得报表js数据 { if (ReportType != "OwnerReport") return; var jsObj = JSON.parse(receiveObj.obj); importJSON(ReportSpread, jsObj); ReportSpread.options.backColor = paneStyle.paneBackColor; ReportSpread.options.grayAreaBackColor = paneStyle.paneBackColor; FreshReport(ReportSpread); ReportSpread.getActiveSheet().options.selectionBorderColor = 'gray'; } else if (receiveObj.method == "HisDataReGet") //历史回抽数据进度 { var jsObj = receiveObj.obj; progressBtn.setLabel(jsObj + "%"); progressNode.setValue(jsObj); if (parseInt(jsObj) >= 100) { progressBtn.setLabel("0%"); progressBtn.setWidth(0); progressNode.setValue(0); recaluBtn.setDisabled(false); startReculate=false; } } else if (receiveObj.method == "GetOwnReportXlsxList") //获得自定义报表列表 { if (ReportType != "OwnerReport") return; var dayList = JSON.parse(receiveObj.obj); listView.dm().clear(); dayList.forEach(function (val, index, arr) { AddListViewElem(listView, val); }); listView.setSortFunc(sortFunc); } }; // 监听Socket的关闭 socket.onclose = function (event) { console.log('Client notified socket has closed', event); //自动重连 setTimeout(function(){ socket = new WebSocket('ws://' + webServiceIP + ':10087/Command'); }, 1000); }; //列表控件---------------------------------------------------------------列表控件----------------------------------------------------- listView = new ht.widget.ListView(); listView.setRowLineColor(toolBarBackColor); listView.setScrollBarColor("#1C4E89"); listView.setAutoHideScrollBar(true); listView.setScrollBarSize(10); var toolbar3 = new ht.widget.Toolbar(); var gap=toolbar3.getItemGap(); toolbar3.setItemGap(0); toolbar3.getView().style.background ="#094196"; toolbar3.height=40; toolbar3.setItems( [ { id: 'nation', unfocusable: true, label: ' ', element: batchExportBtn, }, ]); innerPane.setBottomView(toolbar3,40); innerPane.setCenterView(listView); borderPaneDayReport.setLeftView(innerPane, listViewWidth); //borderPaneDayReport.setLeftView(listView, listViewWidth); var listView_View = listView.getView(); listView_View.style.backgroundColor ="#09225A";// paneStyle.paneBackColor; listView.getLabelFont=function() { return listViewLabelFont; } //listView.setCheckMode(true); var SelectTime = ""; listView.onDataClicked = function (data) //选择某个数据 { if (!data) return; if (ReportType == "DayReport")//日报表 { SelectTime = data.a('Name'); var tempEndTime1 = new Date(Date.parse(SelectTime + " 0:0:0")); StartTime = tempEndTime1.toDateString() + " 0:0:0"; tempEndTime1.setDate(tempEndTime1.getDate() + 1); EndTime = tempEndTime1.toDateString() + " 0:0:0"; FreshReport(ReportSpread, "", paneStyle.ExportWhiteBackBlackFont, jsonFileNameFunc); } else if (ReportType == "MonthReport")//月报表 { SelectTime = data.a('Name'); var tempEndTime1 = new Date(Date.parse(SelectTime + " 0:0:0")); StartTime = tempEndTime1.toDateString() + " 0:0:0"; tempEndTime1.setMonth(tempEndTime1.getMonth() + 1); tempEndTime1.setSeconds(tempEndTime1.getSeconds() - 1); EndTime = tempEndTime1.toDateString() + " 23:59:59"; FreshReport(ReportSpread, "", paneStyle.ExportWhiteBackBlackFont, jsonFileNameFunc); } else //自定义报表 { StartTime = NodeStartTimeDiv.value + " 0:0:0"; EndTime = NodeEndTimeDiv.value + " 0:0:0"; SelectTime = data.a('Name'); var obj = new CommandObj(); obj.method = "GetReportJsFile"; obj.parm1 = SelectTime.replace(".xlsx", ""); var objStr = JSON.stringify(obj); socket.send(objStr); } } listView.setRowHeight(listViewHeight); //添加列表中的数据 listView.enableToolTip(); //获得列表控件中文字颜色 listView.getLabelColor = function (data) { return this.isSelected(data) ? paneStyle.ListSelTextColor : paneStyle.DialogTitleFontColor; }; //绘制 /* listView.drawLabel =function (F, H, T, N, I) { F.font = listView.getLabelFont(H); var text=listView.getLabel(H); F.fillText(text, T, N); F.strokeText(text, T, N); // Wp(F, listView.getLabel(H), listView.getLabelFont(H), listView.getLabelColor(H), T, N, 0, I) }*/ //列表控件绘制 listView.drawRowBackground = function (g, data, selected, xx, yy, widthb, heightb) { if (this.isSelected(data)) { g.fillStyle = paneStyle.ListSelBackColor; } else if (this.getRowIndex(data) % 2 === 0) { g.fillStyle = paneStyle.paneBackColor; } else { g.fillStyle = paneStyle.paneBackColor; } g.beginPath(); g.strokeStyle = "#083684";//toolBarBackColor; g.rect(xx, yy, widthb, heightb); g.fill(); g.lineWidth = 2; g.strokeRect(xx, yy, widthb, heightb); }; listView.setIndent(60); listView.enableToolTip(); listView.getLabel = function (data) { return data.a('label'); //return data.a('Name'); }; //列表控件排序 sortFunc = function (d1, d2) { var str1 = d1.a('Name'); var str2 = d2.a('Name'); var strInt1 = str1.replace('-', ''); strInt1 = strInt1.replace('-', ''); var strInt2 = str2.replace('-', ''); strInt2 = strInt2.replace('-', ''); return parseInt(strInt2) - parseInt(strInt1); }; listView.setSortFunc(sortFunc); //--------------------------------------------------------------------列表控件--------------------------------------------------- borderPaneRealNode.setScalable(false); borderPaneRealNode.s({ '2d.selectable': true, '2d.movable': false }); borderPaneRealNode.setHtml(borderPaneDayReport); borderPaneRealNode.setPosition({ x: x, y: y }); borderPaneRealNode.setWidth(width); borderPaneRealNode.setHeight(height); borderPaneRealNode.setPadding(0); var usedTime = (new Date() - openStartTime); console.log("creat report ctrl use time:" + usedTime); return borderPaneRealNode; }; //添加列表控件的数据 function AddListViewElem(listView, obj) { var data = new ht.Data(); data.a(obj); data.a("label"," "+obj.Name); listView.dm().add(data); return data; } function ChangeScrollBarStyle() { //修改滚动条滑块的位置 if ($(".gc-scroll-container").first()) { $(".gc-scroll-container").first().css("background-color","transparent"); $(".gc-scroll-container").first().parent().css("background-color","transparent"); } if ($(".gc-scroll-container").last()) { $(".gc-scroll-container").last().css("background-color","transparent"); $(".gc-scroll-container").last().parent().css("background-color","transparent"); } //隐藏滚轮箭头 divs = document.getElementsByClassName("gc-scroll-arrow"); if (divs) { for (var xx = 0; xx < divs.length; xx++) { divs[xx].style.display = "none"; } } //修改滚动条宽度 if ($(".gc-scroll-bar").first()) { $(".gc-scroll-bar").first().css("width", "10px"); $(".gc-scroll-bar").first().css("left", "3px"); } if ($(".gc-scroll-bar").last()) { $(".gc-scroll-bar").last().css("height", "10px"); $(".gc-scroll-bar").last().css("top", "3px"); } var divx=document.getElementById("vp_vp"); if(divx) { var divwidth = (divx.width + 16); divx.style.width=divwidth+"px"; var divheight=(divx.height+16); divx.style.height=divheight+"px"; } } //设置时间选择控件的时间 function SetTimeSelectDivValue(elem, timeValue, type) { timeValue = getRelativeDate(timeValue, type); var end=laydate.render({ elem: elem, type: type, theme: 'blueblack', value: timeValue, done: function (value, date) { setTimeout(function () { ; }, 100) } });; GD.setupDatePicker(elem, end); } function CommandObj() { var method = ""; var parm1 = ""; var parm2 = ""; } function ReceiveObj() { var method = ""; var obj = ""; } //处理按钮的样式 function SetButtonStyle(buttonName,buttonPng,shadowColor) { //修改查询按钮的样式 $btnView = $(buttonName.getView()); $mask = $('
'); (function ($btnView, $mask) { $btnView.css({ 'borderRadius': '2px', 'overflow': 'hidden', 'padding': 0, 'margin': 0, 'textAlign': 'center', 'background-image':"url("+PAGEROOTDIR+"/script/image/"+buttonPng+".png) ", cursor: 'pointer', borderColor: '#ccc', boxShadow: '0 0 5px ' + shadowColor, }).hover(function () { $btnView.append($mask).css({ boxShadow: '0 0 5px ' + '#eee' }) }, function () { $mask.remove(); $btnView.css({ boxShadow: '0 0 5px ' + shadowColor }) }).on('mousedown', function () { $btnView.parent().css({ padding: '1px 0 0 1px' }) }).on('mouseup', function () { $btnView.parent().css({ padding: 0 }); }).find('canvas').css({ 'top': 0, 'left': 0, }); })($btnView, $mask); }