以前没接触过EXT.NET,最近突然接到一个活,关于EXT的,瞬间蒙逼。。求各路大侠帮帮忙。。要求是:按打印键,能把查询出来的结果一次性都打印出来,而且显示的查询信息要完整。我试过window.print(),可是只能打印当前页面,还有很多信息没法打印,救命啊。。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Accident.aspx.cs" Inherits="TrafficAnalysis.Pages.Accident" %> <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <title></title> <style> .formstyle { padding: 5px 10px; } </style> <link href="../Css/css.css" rel="stylesheet" type="text/css" /> <script> //保存事故信息 var SaveAccidentMsg = function () { if(Ext.getCmp("AccID").getValue()==null|| Ext.getCmp("Time1").getValue()==null|| Ext.getCmp("Time2").getValue()==null|| Ext.getCmp("DealWayID").getValue()==null) { Ext.Msg.alert("提示","日期、时间、处理方式均不能为空!");return; } var accid = Ext.getCmp("AccID").getValue(); X.SaveAccidentMsg(accid, { success: function (result) { if (result) { Ext.Msg.alert("提示", "保存成功"); } else { Ext.Msg.show({ title: '警告', msg: '信息保存失败!请不要重复保存', buttons: Ext.Msg.OK, icon: Ext.Msg.WARING }); } } }); } //打开事故信息窗口 var NewAccident = function () { App.CallBackForm.hide(); App.AccidentDetails.show(); //Ext.getCmp("AccidentDetails").setVisable(true); Ext.getCmp("AccidentForm").reset(); Ext.getCmp("PersonCarForm").reset(); App.PeopleStore.removeAll(); AddAccident(); } //保存人车信息 var SavePeopleMsg = function () { var behave = Ext.getCmp("Behave").getValue(); var accid = Ext.getCmp("AccID").getValue(); if (accid == "") { Ext.Msg.alert("提示", "请先保存案件信息"); return; } if(Ext.getCmp("Name").getValue()==null) { alert("姓名不能为空!");return; } X.SavePeopleMsg(accid, behave, { success: function (result) { if (result) { //更新事故的伤亡情况 X.RefreshHurtAndDieCount(accid, { success: function (result) { var strs = new Array(2); strs = result.split("|"); Ext.getCmp("HurtNum").setValue(strs[0]); Ext.getCmp("DeadNum").setValue(strs[1]); }, eventMask: { showMask: false, minDelay: 500 } }); App.PeopleStore.reload(); Ext.Msg.notify("提示", "保存成功"); } else { Ext.Msg.show({ title: '警告', msg: '信息保存失败!', buttons: Ext.Msg.OK, icon: Ext.Msg.WARING }); } } }); } //双击Grid var showDetails = function (record) { X.initLuDuan(record.data.AccID); App.CallBackForm.hide(); App.AccidentDetails.show(); Ext.getCmp("AccidentForm").reset(); Ext.getCmp("PersonCarForm").reset(); App.PeopleStore.removeAll(); //NewAccident(); X.showDetails(record.data.AccID); App.CallBackForm.show(); } //显示人员信息 var showPeopleMsg = function (record) { if (record.data.PeopleID == "") { return } X.showPeopleMsg(record.data.PeopleID,{ success:function(result){ if(result){ autoID(); } } }); } //新增人员 var AddPeople = function () { App.PersonCarForm.reset(); } //新增案件 var AddAccident = function () { Ext.getCmp("AccidentForm").reset(); Ext.getCmp("PersonCarForm").reset(); App.PeopleStore.removeAll(); X.AddAccident(); } //新增回访记录 var NewCallBack = function () { App.CallBackForm.reset(); //X.NewCallBack(); } //保存回访记录 //var SaveCallMsg = function () { // X.SaveCallMsg({ // success: function (result) { // if (result != "" || result != null) { // App.ID.setValue(result); // Ext.Msg.notify("提示", "保存成功"); // } else { // Ext.Msg.show({ // title: '警告', // msg: '信息保存失败!', // buttons: Ext.Msg.OK, // icon: Ext.Msg.WARING // }); // } // } // }); //} //调用地图 function showMap() { var x = Ext.getCmp("Longitude").getValue(); var y = Ext.getCmp("Latitude").getValue(); if (x == "" || y == "") { window.open("MapE.html?id=1&DeptID="+<%=DeptRegionID%>); } else { document.cookie = "deadPoints=''"; document.cookie = "hurtPoints=''"; document.cookie = "nodhPoints=" + x + "," + y; window.open("MapE.html?id=multi&DeptID="+<%=DeptRegionID%>); } } //调用地图 空间分布 //function showInMap() { // window.open("Map.aspx"); // //App.MapWin.show(); //} function setPlace(a, b) { //alert("调用回调函数!"+dataInputx.toString()+":"+dataInputy.toString()); //alert("调用回调函数!"+dataInputx.value); App.Longitude.setValue(a); App.Latitude.setValue(b); //alert("调用回调函数,获取坐标:" + str); //getMapApp().pan(); } function showXY() { X.showXY({ success: function (result) { if (result != "") { //alert(result); } else { Ext.Msg.notify("提示", "操作失败,没有获得坐标!"); } } }); } function getRoadPart() { var road = Ext.getCmp("Road").getValue(); Ext.getCmp("serachRoad").setValue(road); X.getRoadPart(road); } //身份证判断以及自动填充性别生日年龄 function autoID() { var a = Ext.getCmp("CertificateNo").getValue(); if (a.length == 0) return; else if (a.length == 18 || a.length == 15) { if(a.length == 18){ var year = a.substr(6, 4) var month = a.substr(10, 2); var day = a.substr(12, 2); var bg = a.substr(16, 1); } if (a.length == 15) { var year = "19"+a.substr(6, 2); var month = a.substr(8, 2); var day = a.substr(10, 2); var bg = a.substr(14, 1); } if (isNaN(year) || isNaN(month) || isNaN(day) || isNaN(bg)) { alert("身份证号格式不正确!"); return; } Ext.getCmp("Birthday").setValue(year + '-' + month + '-' + day); autoAge(); if (parseInt(bg) % 2 == 1) { Ext.getCmp("Sex").setValue("男"); } else { Ext.getCmp("Sex").setValue("女"); } } else { alert("身份证号格式不正确!"); return; } } //根据生日判断年龄,由于小孩等没有身份证号,这里需单独判断 function autoAge() { var strBirthday = Ext.getCmp("Birthday").getValue(); var returnAge; var birthYear = strBirthday.getFullYear(); var birthMonth = strBirthday.getMonth()+1; var birthDay = strBirthday.getDate(); d = new Date(); var nowYear = d.getFullYear(); var nowMonth = d.getMonth() + 1; var nowDay = d.getDate(); if (nowYear == birthYear) { returnAge = 0;//同年 则为0岁 } else { var ageDiff = nowYear - birthYear; //年之差 if (ageDiff > 0) { if (nowMonth == birthMonth) { var dayDiff = nowDay - birthDay;//日之差 if (dayDiff < 0) { returnAge = ageDiff - 1; } else { returnAge = ageDiff; } } else { var monthDiff = nowMonth - birthMonth;//月之差 if (monthDiff < 0) { returnAge = ageDiff - 1; } else { returnAge = ageDiff; } } } else { alert("年龄错误,请检查身份证号和年月日"); return; returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天 } } Ext.getCmp("PeopleAge").setValue(returnAge);//返回周岁年龄 } //计算几日后死亡 var getDieDays = function () { if (!checkCurrent("DieDate")) return; X.getDieDays(); } //根据是否死亡 设置readonly var setByIsDead = function () { var value = Ext.getCmp("IsDead").getValue(); //alert(value); if (value == 1) { Ext.getCmp("DieDate").setReadOnly(false); Ext.getCmp("DeadDays").setReadOnly(false); } else if (value == 0 || value==-1) { Ext.getCmp("DieDate").reset(); Ext.getCmp("DeadDays").reset(); Ext.getCmp("DieDate").setReadOnly(true); Ext.getCmp("DeadDays").setReadOnly(true); } else { } } //检测事故日期是否大于当前日期 var checkTime1 = function () { var time1 = Ext.getCmp("Time1").getValue(); if (new Date() >= time1) { return; } else { if (Ext.getCmp("Time1").getValue() != null) { checkTime2(); Ext.getCmp("Time1").setValue(new Date()); return; } alert("选定日期超过当前日期!!系统已自动修改为当前日期"); Ext.getCmp("Time1").setValue(new Date()); } } var checkTime2 = function () { var time2 = Ext.getCmp("Time2").getValue(); var tmp = Ext.getCmp("Time1").getValue(); if (tmp == null) return; tmp.setHours(time2.getHours()); tmp.setMinutes(time2.getMinutes()); if (new Date() >= tmp) { return; } else { alert("时间出错!"); Ext.getCmp("Time2").setValue(new Date()); } } function checkCurrent (control) { var time1 = Ext.getCmp(control).getValue(); if (new Date() >= time1) { return true; } else { alert("选定日期超过当前日期!!系统已自动修改为当前日期"); Ext.getCmp(control).setValue(new Date()); return false; } } //根据逃逸情况 设置侦破readonly var checkRunAway = function () { if (Ext.getCmp("IsRunAway").getValue() == "1") { Ext.getCmp("IsSolved").setReadOnly(false); } else { Ext.getCmp("IsSolved").setReadOnly(true); } } //填充地址 var autoAddr = function () { var road1 = Ext.getCmp("Road").rawValue; var road2 = Ext.getCmp("RoadP").rawValue; var Meter = Ext.getCmp("Meter").getValue(); if (road1 != "" && Meter != "") { var string = null; if (road2 != "") { string = road2 + Meter; } else { string = road1 +"--"+ Meter; } Ext.getCmp("Place").setValue(string); } } //根据道路代码自动选择道路 var serachRoad = function () { var s = Ext.getCmp("serachRoad").getValue(); Ext.getCmp("Road").setValue(s); getRoadPart(); } //function AutoDeptUser(){ // var s=Ext.getCmp("DeptZhongDui").getValue(); // Ext.getCmp("DeptUser").reset(); // //alert(s); // X.getUserName(s); //} if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (elt /*, from*/) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } //根据违法行为自动判断是否酒驾 function AutoJiuJia(){ var a=Ext.getCmp("Behave").getValue(); if(a.indexOf("4")>=0 ) { Ext.getCmp("IsDrunk_man").setValue("1"); //alert("zuijiu"); } if(a.indexOf("5")>=0) { Ext.getCmp("IsDrunk_man").setValue("2"); //alert("zuijiu"); } } </script> </head> <body> <%--<div id="allmap" ></div> --%> <ext:ResourceManager runat="server" ID="RM1" DirectMethodNamespace="X" /> <form id="form1" runat="server"> <ext:Window runat="server" ID="AccidentDetails" Constrain="true" Title="事故信息" Closable="true" Hidden="true" CloseAction="Hide" Width="990" Height="580" AutoScroll="true"> <Items> <ext:FormPanel runat="server" ID="AccidentForm" Title="" Layout="FormLayout" BodyCls="borderright"> <Items> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:TextField runat="server" ID="AccID" LabelAlign="Right" Hidden="true" /> <ext:TextField runat="server" ID="PoliceNo" Hidden="true" /> <ext:TextField runat="server" ID="AccidentNo" FieldLabel="事故编号" LabelAlign="Right" ReadOnly="true" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" /> <ext:DateField runat="server" ID="Time1" FieldLabel="日期" LabelAlign="Right" Format="yyyy-MM-dd" LabelWidth="70" ColumnWidth=".25" MarginSpec="1"> <Listeners> <Blur Handler="checkTime1()" /> </Listeners> </ext:DateField> <ext:TimeField runat="server" ID="Time2" FieldLabel="时间" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" > <Listeners> <Blur Handler="checkTime2()" /> </Listeners> </ext:TimeField> <ext:ComboBox runat="server" ID="WeatherID" FieldLabel="天气" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1"> </ext:ComboBox> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:Label runat="server" ColumnWidth=".05" Html="<span style='font-size:14px; width:35px;margin-left:10px;'>道路:</span>"></ext:Label> <ext:TextField runat="server" ID="serachRoad" ColumnWidth=".06"> <Listeners> <Blur Handler="serachRoad()"/> </Listeners> </ext:TextField> <ext:ComboBox runat="server" ID="Road" LabelAlign="Right" FieldLabel="" LabelWidth="70" ColumnWidth=".14"> <Listeners> <Select Handler="getRoadPart()" /> <Change Handler="autoAddr()" /> </Listeners> </ext:ComboBox> <ext:ComboBox runat="server" ID="RoadP" FieldLabel="路段" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" ValueField="LDDM" DisplayField="LDMC" > <Store> <ext:Store runat="server" ID="RoadStore"> <Fields> <ext:ModelField Name="LDDM" /> <ext:ModelField Name="LDMC" /> </Fields> </ext:Store> </Store> <Listeners> <Change Handler="autoAddr()" /> </Listeners> </ext:ComboBox> <ext:TextField runat="server" ID="Meter" FieldLabel="具体位置" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1"> <Listeners> <Blur Handler="autoAddr()" /> </Listeners> </ext:TextField> <ext:TextField runat="server" ID="Place" FieldLabel="地址" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" /> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:Button runat="server" ID="Map" Text="显示地图" MarginSpec="1" Icon="Map" ColumnWidth=".25" Handler="showMap()" /> <ext:Button runat="server" Handler="showXY()" Text="获取坐标" ColumnWidth=".25" MarginSpec="1"></ext:Button> <ext:TextField runat="server" ID="Longitude" FieldLabel="经度" LabelAlign="Right" ReadOnly="true" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" /> <ext:TextField runat="server" ID="Latitude" FieldLabel="纬度" LabelAlign="Right" ReadOnly="true" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" /> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:ComboBox runat="server" ID="CollisionTypeID" FieldLabel="调解类型" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1"> </ext:ComboBox> <ext:ComboBox runat="server" ID="HowSeriousID" FieldLabel="严重程度" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" Visible="false"> </ext:ComboBox> <ext:ComboBox runat="server" ID="DealWayID" FieldLabel="处理方式" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1"> </ext:ComboBox> <ext:ComboBox runat="server" ID="AccidentTypeID" FieldLabel="单车事故类型" LabelAlign="Right" LabelWidth="90" ColumnWidth=".25" MarginSpec="1"> </ext:ComboBox> <ext:ComboBox runat="server" ID="AccidentTypeID2" FieldLabel="车辆间事故类型" LabelAlign="Right" LabelWidth="110" ColumnWidth=".25" MarginSpec="1"> </ext:ComboBox> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:ComboBox runat="server" ID="IsRunAway" FieldLabel="是否逃逸" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1"> <Items> <ext:ListItem Text="否" Value="0" /> <ext:ListItem Text="是" Value="1" /> </Items> <%--<SelectedItems> <ext:ListItem Text="否" Value="0" /> </SelectedItems>--%> <Listeners> <Change Handler="checkRunAway()" /> </Listeners> </ext:ComboBox> <ext:ComboBox runat="server" ID="IsSolved" FieldLabel="是否侦破" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" ReadOnly="true"> <Items> <ext:ListItem Text="否" Value="0" /> <ext:ListItem Text="是" Value="1" /> </Items> <%--<SelectedItems> <ext:ListItem Text="否" Value="0" /> </SelectedItems>--%> </ext:ComboBox> <ext:ComboBox runat="server" ID="IsDrunk" FieldLabel="是否酒驾" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" Visible="false"> <Items> <ext:ListItem Text="否" Value="0" /> <ext:ListItem Text="酒后驾驶" Value="1" /> <ext:ListItem Text="醉酒驾驶" Value="2" /> </Items> <%--<SelectedItems> <ext:ListItem Text="否" Value="0" /> </SelectedItems>--%> </ext:ComboBox> <ext:NumberField runat="server" ID="DeadNum" FieldLabel="死亡人数" LabelAlign="Right" Text="0" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" /> <ext:NumberField runat="server" ID="HurtNum" FieldLabel="受伤人数" LabelAlign="Right" Text="0" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" /> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:NumberField runat="server" ID="BreakCarNum" FieldLabel="损失车辆" LabelAlign="Right" Text="0" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" Hidden="true" /> <ext:ComboBox runat="server" ID="DeptZhongDui" FieldLabel="所属中队" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" > <%--<Listeners> <Select Handler="AutoDeptUser()" /> </Listeners>--%> </ext:ComboBox> <ext:ComboBox runat="server" ID="DeptUser" FieldLabel="办案民警" LabelAlign="Right" LabelWidth="70" ColumnWidth=".25" MarginSpec="1" ValueField="UserID" DisplayField="UserName"> <Store> <ext:Store runat="server" ID="StoreDeptUser"> <Fields> <ext:ModelField Name="UserID" /> <ext:ModelField Name="UserName" /> </Fields> </ext:Store> </Store> </ext:ComboBox> <%-- <ext:TextField runat="server" ID="DeptID" FieldLabel="所属单位" LabelWidth="70" ColumnWidth=".25" MarginSpec="1"> </ext:TextField>--%> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:TextArea runat="server" ID="AccidentDescription" LabelAlign="Right" FieldLabel="事故概述" LabelWidth="70" Height="40" ColumnWidth="1" MarginSpec="1" /> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone" Hidden="true"> <Items> <ext:TextArea runat="server" ID="AccidentReason" LabelAlign="Right" FieldLabel="事故原因" LabelWidth="70" Height="80" ColumnWidth="1" MarginSpec="1" /> </Items> </ext:Panel> </Items> <TopBar> <ext:Toolbar runat="server"> <Items> <ext:Button runat="server" ID="AddAccBut" Text="新增" MarginSpec="1 10" Icon="New" Handler="AddAccident()" /> <ext:Button runat="server" ID="SaveAccBut" Text="保存" MarginSpec="1 10" Icon="Disk" Handler="SaveAccidentMsg()" /> <ext:Label runat="server" StyleSpec="font-size:20px;padding:0px 0px 0px 88px;left:320px !important;margin:-5px !important;" Html="<span style='font-size:20px'>事故基本信息</span>"> </ext:Label> <%--<ext:Button runat="server" ID="ChangeAccBut" Text="修改" MarginSpec="1 10" Icon="BugFix" Handler="FixAccident()" />--%> </Items> </ext:Toolbar> </TopBar> </ext:FormPanel> <ext:Panel runat="server" ID="PeolpePanel" Title="" Layout="FormLayout" BodyCls="borderright"> <TopBar> <ext:Toolbar runat="server"> <Items> <ext:Button runat="server" ID="NewPeopleBut" Text="新增" MarginSpec="1 10" Icon="New" Handler="AddPeople()" /> <ext:Button runat="server" ID="SavePeopleBut" Text="保存" MarginSpec="1 10" Icon="Disk" Handler="SavePeopleMsg()" /> <ext:Label runat="server" StyleSpec="font-size:20px;padding:0px 0px 0px 88px;left:288px !important;margin:-5px !important;" Html="<span style='font-size:20px'>事故当事人基本信息</span>"> </ext:Label> <%--<ext:Button runat="server" ID="ChangePeopleBut" Text="修改" MarginSpec="1 10" Icon="BugFix" Handler="FixPeople()" /> <ext:Button runat="server" ID="RefreshHurtAndDieCount" Text="test" MarginSpec="1 10" Icon="ApplicationHome" Handler="test()" />--%> </Items> </ext:Toolbar> </TopBar> <Items> <ext:GridPanel runat="server" ID="PeopleMsgGrid"> <Store> <ext:Store runat="server" ID="PeopleStore" OnReadData="PeopleStore_ReadData" AutoLoad="false"> <AutoLoadParams> <ext:StoreParameter Name="start" Value="0" Mode="Raw"></ext:StoreParameter> <ext:StoreParameter Name="limit" Value="10" Mode="Raw"></ext:StoreParameter> </AutoLoadParams> <Parameters> </Parameters> <Proxy> <ext:PageProxy /> </Proxy> <Model> <ext:Model runat="server"> <Fields> <ext:ModelField Name="PeopleID" /> <ext:ModelField Name="Name" /> <ext:ModelField Name="PhoneNo" /> <ext:ModelField Name="HurtID" /> <ext:ModelField Name="TrafficTypeID" /> <ext:ModelField Name="CarNo" /> <ext:ModelField Name="Responsibility" /> </Fields> </ext:Model> </Model> </ext:Store> </Store> <Listeners> <ItemClick Handler="showPeopleMsg(record)" /> </Listeners> <ColumnModel> <Columns> <ext:Column runat="server" Text="id" Hidden="true" Flex="2" DataIndex="PeopleID" /> <ext:Column runat="server" Text="名称" Flex="2" DataIndex="Name" /> <ext:Column runat="server" Text="联系电话" Flex="2" DataIndex="PhoneNo" /> <ext:Column runat="server" Text="伤亡程度" Flex="2" DataIndex="HurtID" Hidden="true" /> <ext:Column runat="server" Text="交通方式" Flex="2" DataIndex="TrafficTypeID" /> <ext:Column runat="server" Text="责任" Flex="2" DataIndex="Responsibility" /> </Columns> </ColumnModel> </ext:GridPanel> <ext:FormPanel runat="server" ID="PersonCarForm" Layout="FormLayout" BodyCls="bordernone"> <Items> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:TextField runat="server" ID="PeopleID" Hidden="true" /> <ext:TextField runat="server" ID="Name" FieldLabel="姓名" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1" /> <ext:ComboBox runat="server" ID="CertificatesTypeID" Hidden="true" FieldLabel="证件类型" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1"> </ext:ComboBox> <ext:TextField runat="server" ID="CertificateNo" FieldLabel="身份证号" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1"> <Listeners> <Blur Handler="autoID()" /> </Listeners> </ext:TextField> <ext:ComboBox runat="server" ID="Sex" FieldLabel="性别" LabelWidth="70" LabelAlign="Right" ColumnWidth=".33" MarginSpec="1"> <Items> <ext:ListItem Text="男" /> <ext:ListItem Text="女" /> </Items> </ext:ComboBox> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:DateField runat="server" ID="Birthday" FieldLabel="出生日期" LabelAlign="Right" Format="yyyy-MM-dd" LabelWidth="70" ColumnWidth=".33" MarginSpec="1" > <Listeners> <Blur Handler="autoAge()" /> </Listeners> </ext:DateField> <ext:NumberField runat="server" ID="PeopleAge" FieldLabel="年龄" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1" /> <ext:TextField runat="server" ID="PhoneNo" FieldLabel="联系电话" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1" /> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:ComboBox runat="server" ID="PeopleKindID" FieldLabel="人员类型" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1"> </ext:ComboBox> <ext:ComboBox runat="server" ID="TrafficTypeID" FieldLabel="交通方式" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1"> </ext:ComboBox> <ext:NumberField runat="server" ID="DriveAge" FieldLabel="驾龄" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1" /> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:ComboBox runat="server" ID="Responsibility" FieldLabel="事故责任" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1"> </ext:ComboBox> <ext:MultiCombo ID="Behave" runat="server" LabelWidth="70" Icon="DiskMultiple" LabelAlign="Right" FieldLabel="违法行为" ColumnWidth=".66" > <Listeners> <Blur Handler="AutoJiuJia()" /> </Listeners> </ext:MultiCombo> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:ComboBox runat="server" ID="CarTypeID" FieldLabel="车辆类型" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1" Hidden="true"> </ext:ComboBox> <ext:TextField runat="server" ID="CarNo" FieldLabel="车牌号" LabelWidth="70" LabelAlign="Right" Text="鲁C" ColumnWidth=".33" MarginSpec="1" /> <ext:ComboBox runat="server" ID="CarUseTypeID" FieldLabel="车辆使用性质" LabelAlign="Right" LabelWidth="95" ColumnWidth=".33" MarginSpec="1"> </ext:ComboBox> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:NumberField runat="server" ID="LostMoney" FieldLabel="财产损失(元)" LabelAlign="Right" Text="0" LabelWidth="95" ColumnWidth=".33" MarginSpec="1" /> <ext:ComboBox runat="server" ID="IsDrunk_man" FieldLabel="是否酒驾" LabelAlign="Right" LabelWidth="70" ColumnWidth=".33" MarginSpec="1"> <Items> <ext:ListItem Text="否" Value="0" /> <ext:ListItem Text="酒后驾驶" Value="1" /> <ext:ListItem Text="醉酒驾驶" Value="2" /> </Items> <SelectedItems> <ext:ListItem Text="否" Value="0" /> </SelectedItems> </ext:ComboBox> <ext:TextField runat="server" ID="CarModel" FieldLabel="机动车型号" LabelAlign="Right" LabelWidth="95" ColumnWidth=".33" MarginSpec="1" Hidden="true" /> <ext:TextField runat="server" ID="SuranceNo" FieldLabel="保险凭证号" LabelAlign="Right" LabelWidth="95" ColumnWidth=".33" MarginSpec="1" /> </Items> </ext:Panel> <ext:Panel runat="server" Layout="ColumnLayout" BodyCls="bordernone"> <Items> <ext:ComboBox runat="server" ID="IsDead" FieldLabel="伤亡状态" LabelWidth="70" LabelAlign="Right" ColumnWidth=".33" MarginSpec="1"> <Items> <ext:ListItem Text="未受伤" Value="-1" /> <ext:ListItem Text="受伤" Value="0" /> <ext:ListItem Text="死亡" Value="1" /> </Items> <Listeners> <Change Handler="setByIsDead()" /> </Listeners> </ext:ComboBox> <ext:DateField runat="server" ID="DieDate" FieldLabel="死亡日期" Format="yyyy-MM-dd" LabelWidth="70" ReadOnly="true" LabelAlign="Right" ColumnWidth=".33" MarginSpec="1"> <Listeners> <Blur Handler="getDieDays()" /> </Listeners> </ext:DateField> <ext:NumberField runat="server" ID="DeadDays" FieldLabel="几日后死亡" LabelWidth="80" ReadOnly="true" LabelAlign="Right" ColumnWidth=".33" MarginSpec="1" /> </Items> </ext:Panel> </Items> </ext:FormPanel> </Items> </ext:Panel> <ext:FormPanel runat="server" Layout="FormLayout" Title="回访信息" ID="CallBackForm" Hidden="true"> <Items> <ext:Panel runat="server" BodyCls="bordernone" Layout="ColumnLayout"> <Items> <ext:TextField runat="server" ID="ID" Hidden="true" /> <ext:TextField runat="server" ID="WriterID" Hidden="true" /> <ext:DateField runat="server" ID="CallDate" LabelAlign="Right" Format="yyyy-MM-dd" LabelWidth="70" FieldLabel="回访日期" ColumnWidth=".33" MarginSpec="1" /> </Items> </ext:Panel> <ext:Panel runat="server" BodyCls="bordernone" Layout="ColumnLayout"> <Items> <ext:TextArea runat="server" ID="Description" LabelAlign="Right" FieldLabel="回访记录" LabelWidth="70" ColumnWidth=".975" MarginSpec="1" Height="80" /> </Items> </ext:Panel> </Items> </ext:FormPanel> </Items> </ext:Window> <div> <ext:Viewport runat="server" Layout="FitLayout"> <Items> <ext:Panel runat="server" ID="AccidentPanel" Layout="BorderLayout" BodyCls="bordernone"> <Items> <ext:FormPanel runat="server" ID="SearchForm" Region="North" BodyCls="formstyle"> <Items> <ext:Panel runat="server" BodyCls="bordernone" Layout="HBoxLayout"> <Items> <ext:DateField runat="server" ID="BeginDate" FieldLabel="事故日期" Format="yyyy-MM-dd" MarginSpec="5 3" LabelWidth="70" Flex="4" /> <ext:DateField runat="server" ID="EndDate" FieldLabel="-------" Format="yyyy-MM-dd" MarginSpec="5 3" LabelWidth="50" Flex="4" /> <ext:TextField runat="server" ID="srhName" FieldLabel="当事人姓名" LabelWidth="80" MarginSpec="5 3" Flex="4" /> <ext:TextField runat="server" ID="srhSFZ" FieldLabel="身份证" LabelWidth="60" MarginSpec="5 3" Flex="4" /> <ext:TextField runat="server" ID="srhCheHao" FieldLabel="车牌号" LabelWidth="60" MarginSpec="5 3" Flex="3" /> </Items> </ext:Panel> <ext:Panel runat="server" BodyCls="bordernone" Layout="HBoxLayout"> <Items> <ext:TextField runat="server" ID="AccNo" FieldLabel="事故编号" LabelWidth="70" MarginSpec="5 3" Flex="4" /> <%--<ext:Combobox runat="server" ID="AccType" FieldLabel="单车事故类型" MarginSpec="5 3" LabelWidth="90" Flex="4" /> <ext:ComboBox runat="server" ID="AccType2" FieldLabel="车辆间事故类型" MarginSpec="5 3" LabelWidth="110" Flex="4" />--%> <ext:TextField runat="server" ID="DieHurtNum" FieldLabel="死亡人数" MarginSpec="5 3" LabelWidth="70" Flex="2" /> <%--<ext:NumberField runat="server" ID="EndHurtNum" FieldLabel="~" MarginSpec="5 3" LabelWidth="10" Flex="1" /> --%> <ext:Button runat="server" Text="查询" Icon="Magnifier" MarginSpec="5 3" Width="50" Flex="2" Handler="App.AccidentStore.reload()" /> <ext:Button runat="server" Text="新建" ID="AddAcc" Icon="New" MarginSpec="5 3" Width="60" Flex="2" Handler="NewAccident()" /> <ext:Button runat="server" Text="打印" ID="Button1" MarginSpec="5 3" Width="50" Flex="2" Icon="Printer" /> <%-- <ext:Button runat="server" Text="打印" ID="Print" MarginSpec="5 3" Width="50" Flex="2" Icon="Printer" OnClientClick="javascript:document.location.href='Print.aspx';return false;" /> --%> <ext:Button runat="server" Text="导出" ID="Export" MarginSpec="5 3" Width="50" Flex="2" /> </Items> </ext:Panel> </Items> </ext:FormPanel> <ext:GridPanel runat="server" ID="AccidentGrid" Region="Center"> <Store> <ext:Store runat="server" ID="AccidentStore" OnReadData="AccidentStore_ReadData" AutoLoad="false"> <AutoLoadParams> <ext:StoreParameter Name="start" Value="0" Mode="Raw"></ext:StoreParameter> <ext:StoreParameter Name="limit" Value="20" Mode="Raw"></ext:StoreParameter> </AutoLoadParams> <Parameters> </Parameters> <Proxy> <ext:PageProxy /> </Proxy> <Model> <ext:Model runat="server"> <Fields> <ext:ModelField Name="AccID" /> <ext:ModelField Name="AccidentNo" /> <ext:ModelField Name="Time" Type="Date" /> <ext:ModelField Name="Place" /> <%-- <ext:ModelField Name="AccidentTypeID" /> <ext:ModelField Name="AccidentTypeID2" />--%> <ext:ModelField Name="HowSeriousID" /> <ext:ModelField Name="HurtNum" /> <ext:ModelField Name="DeadNum" /> <ext:ModelField Name="PoliceNo" /> <ext:ModelField Name="PoliceName" /> <ext:ModelField Name="DeptName" /> </Fields> </ext:Model> </Model> </ext:Store> </Store> <ColumnModel> <Columns> <ext:Column runat="server" Text="id" Hidden="true" Flex="2" DataIndex="AccID" Align="Center" /> <ext:Column runat="server" Text="事故编号" Flex="2" DataIndex="AccidentNo" Hidden="true"/> <ext:DateColumn runat="server" Text="发生时间" Format="yyyy-MM-dd HH:mm" Flex="2" DataIndex="Time" Align="Center"/> <ext:Column runat="server" Text="发生地点" Flex="4" DataIndex="Place" Align="Center" /> <ext:Column runat="server" Text="单车事故类型" Flex="2" DataIndex="AccidentTypeID" Hidden="true" /> <ext:Column runat="server" Text="车辆间事故类型" Flex="2" DataIndex="AccidentTypeID2" Hidden="true"/> <ext:Column runat="server" Text="严重程度" Flex="2" DataIndex="HowSeriousID" Align="Center"/> <ext:Column runat="server" Text="死亡人数" Flex="2" DataIndex="DeadNum" Align="Center"/> <ext:Column runat="server" Text="受伤人数" Flex="2" DataIndex="HurtNum" Align="Center"/> <ext:Column runat="server" Text="办案人员" Flex="2" DataIndex="PoliceName" Align="Center"/> <ext:Column runat="server" Text="所属部门" Flex="2" DataIndex="DeptName" Align="Center"/> </Columns> </ColumnModel> <Listeners> <ItemDblClick Handler="showDetails(record)" /> </Listeners> <BottomBar> <ext:PagingToolbar runat="server" /> </BottomBar> </ext:GridPanel> </Items> </ext:Panel> </Items> </ext:Viewport> </div> </form> </body> </html>
给你2个方案:1:后台打印,把你的数据传到后台,可以从 Application 或 Document 对象调用 PrintOut(),PrintOut的参数你自己去查
2:你现在用的前端打印,你只可以取到当前页的,当然就打印当前页面的,你该想办法把所有数据都赋给window对象,
var win=new Ext.Window({ title:"test", width:300, height:100, html:'<iframe/>', buttons:[{ text:'print', handler:function(){ //你的dom对象 var m=win.body.first().dom.innerHTML; var printer=win.body.last().dom.contentWindow; printer.document.body.innerHtml=m; printer.focus(); printer.print(); } }] });
这个.....把所有数据都赋给window对象不太理解,能详细说说吗
@微笑范特西: 你的分页是真分页还是假分页?
@稳稳的河: 就是把你的整个数据的dom付给window,你现在就是当前页的dom
@稳稳的河: 真假分页?现在这个页面是别人做的,我这是刚来插手这个,具体不清楚啊
@微笑范特西: 哦,其实就是js获取dom,在赋值
@稳稳的河: 啊。。我要晕死了。。感觉我学的太不行了。。
@微笑范特西: 没关系,边工作边学,你不需要管驱动吗,不区分客户端与服务端打印吗?
@稳稳的河: 我以前没接触过EXT,就前几天经理突然让我们往里面加几个功能,我们都不会,分给我一个打印的功能,我用的window.print()他说不太好,我真是醉了。他想要的效果是一点按钮,把查询的信息每条都打印出来。我试过一点按钮转到一个新页面打印出来,可是我不会怎么在新页面上把查询的结果显示出来,唉...
@微笑范特西: 那去后台打印把,这个一下也说不清,没必要着急,刚入手是这样
@稳稳的河: 和同事多交流交流
@稳稳的河: 同事也不懂这个...我们都是刚实习...我用的asp.net的打印方法加在里面不行啊。后台打印是个什么鬼能说一下吗?