浏览 5824 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-07-31
我的代码片断 1、XML模板 <?xml version="1.0" encoding="GB2312"?> <print id="{T:WhoUse}"> <!-- BEGIN printlist --> <info> <printid>{T:PrintId}</printid> <financeid>{T:FinanceId}</financeid> <contractid>{T:ContractId}</contractid> <printname>{T:PrintName}</printname> <client>{T:Client}</client> <printnumber>{T:PrintNumber}</printnumber> <unitprice>{T:UnitPrice}</unitprice> <totalprice>{T:TotalPrice}</totalprice> <contractprice>{T:ContractPrice}</contractprice> <contractunitprice>{T:ContractUnitPrice}</contractunitprice> <sendate>{T:SendDate}</sendate> <salesname>{T:SalesName}</salesname> <isaskaudit>{T:IsAskAudit}</isaskaudit> <saleaudit>{T:SaleAudit}</saleaudit> <finaceaudit>{T:FinaceAudit}</finaceaudit> <pmcaudit>{T:PmcAudit}</pmcaudit> <time>{T:Time}</time> </info> <!-- END printlist --> </print> 2、调用的程序 printList : function() { $('loading').innerHTML = this.loadingImg + ' 数据加载中。。。'; new Ajax.Request("_quote/printlist.php", { method:"get",parameters:"?randomid=" + Math.random() + "&Module=" + $F('module') + "&systemid=" + $F('systemid') + "&printname=" + base64encode(utf16to8($F('printname'))) + "&contractid=" + $F('contractid') + "&financeid=" + $F('financeid') + "&startdate=" + $F('startdate') + "&enddate=" + $F('enddate'), onComplete: function(transport) { rXML = transport.responseXML; var xmlRule = rXML.getElementsByTagName("print"); var xmlRoot = rXML.getElementsByTagName("info"); var sName = new Array(); var sHead = '<table cellspacing="0" width="100%" align="center" id="quotetableall">'; var iGdWidth = ($F('module') == '_gdshare') ? 'w-45':'w-15'; var sGongDan = ($F('module') == '_gdall' || $F('module') == '_gdshare') ? '<th class="' + iGdWidth + ' f-b-n c-title">工单</th>':'<th class="w-45 f-b-n c-title">报价</th>'; var sCpShow = ($F('module') == '_gdall' || $F('module') == '_gdshare') ? '':'<th class="w-40 f-b-n c-title">合计单价</th><th class="w-80 f-b-n c-title">合计总价</th>'; var iRule = xmlRule(0).getAttribute("id"); for (var i=0; i<xmlRoot.length; i++) { pId = xmlRoot[i].getElementsByTagName('printid')[0].firstChild.nodeValue; sFinanceId = xmlRoot[i].getElementsByTagName('financeid')[0].firstChild.nodeValue; sContractId = xmlRoot[i].getElementsByTagName('contractid')[0].firstChild.nodeValue; sPrintName = xmlRoot[i].getElementsByTagName('printname')[0].firstChild.nodeValue; sClient = xmlRoot[i].getElementsByTagName('client')[0].firstChild.nodeValue; iPrintNumber = xmlRoot[i].getElementsByTagName('printnumber')[0].firstChild.nodeValue; fUnitPrice = xmlRoot[i].getElementsByTagName('unitprice')[0].firstChild.nodeValue; fTotalPrice = xmlRoot[i].getElementsByTagName('totalprice')[0].firstChild.nodeValue; fCUnitPrice = xmlRoot[i].getElementsByTagName('contractunitprice')[0].firstChild.nodeValue; fCTotalPrice = xmlRoot[i].getElementsByTagName('contractprice')[0].firstChild.nodeValue; sSendDate = xmlRoot[i].getElementsByTagName('sendate')[0].firstChild.nodeValue; sSalesName = xmlRoot[i].getElementsByTagName('salesname')[0].firstChild.nodeValue; sTime = xmlRoot[i].getElementsByTagName('time')[0].firstChild.nodeValue; iAskAudit = xmlRoot[i].getElementsByTagName('isaskaudit')[0].firstChild.nodeValue; sSales = xmlRoot[i].getElementsByTagName('saleaudit')[0].firstChild.nodeValue; sFinance = xmlRoot[i].getElementsByTagName('finaceaudit')[0].firstChild.nodeValue; sPmc = xmlRoot[i].getElementsByTagName('pmcaudit')[0].firstChild.nodeValue; sSales = sSales.split(','); sFinance = sFinance.split(','); sPmc = sPmc.split(','); var sHeightLight = ''; sClient = (iRule == 3) ? '<i class="i2n" style="font-size:8px">' + sClient + '</i>':sClient; if (sSales[0] == 0) { sSalesDetail = (iAskAudit == 0) ? '<b style="color:red;">未提交审核</b>':'<b>已提交<br />待审核</b>'; sSalesBg = ''; } else { sSalesDetail = '<b>' + sSales[1] + '</b><br /><b class="i2n" style="font-size:9px">(' + sSales[2] + ')</b>'; sSalesBg = ' style="background:#F5FAFA url(images/audit_s.gif) center center no-repeat;"'; } if (sFinance[0] == 0) { sFinanceDetail = '<b>待审核</b>'; sFinanceBg = ''; } else { sFinanceDetail = '<b>' + sFinance[1] + '</b><br /><b class="i2n" style="font-size:9px">(' + sFinance[2] + ')</b>'; sFinanceBg = ' style="background:#F5FAFA url(images/audit_finace_s.gif) center center no-repeat;"'; } if (sPmc[0] == 0) { sPmcDetail = '<b>待下单</b>'; sPmcBg = ''; } else { sPmcDetail = '<b>' + sPmc[1] + '</b><br /><b class="i2n" style="font-size:9px">(' + sPmc[2] + ')</b>'; sPmcBg = ' style="background:#F5FAFA url(images/audit_pmc_s.gif) center center no-repeat;"'; } today = new Date(); year = today.getYear(); month = today.getMonth() + 1; day = today.getDate(); month = (month < 10) ? '0' + month:month; day = (day < 10) ? '0' + day:day; sNowDay = year + '-' + month + '-' + day; sFinanceDay = sFinance[2].substr(0,10); sHeightLight = (sFinanceDay == sNowDay) ? ' style="background:lightyellow;"':''; sModuleLink = ($F('module') == '_gdall') ? '_gdedit':'_qpedit'; sShareMe = "FC.shareQuery('0" + pId + "');"; sDelActionA = "FC.delQuote('0" + pId + "',FC.getRowIndex());"; sImPrint = "FC.importPrint('0" + pId + "');"; sDelAction = (sSales[0] == 1 || $F('module') == '_gdshare') ? 'javascript:void(0);':sDelActionA; sEditLink = ((iRule >=1 && ($F('module') != '_qpall')) || $F('module') == '_gdshare' || $F('module') == '_qpshare') ? '':'<td><a href="main.php?Module=' + sModuleLink + '&Type=_quote&qpid=0' + pId + '" target="new"><img src="images/icon/small/edit.gif" alt="编辑" /></a></td>'; sDelLink = ((iRule >=1 && ($F('module') != '_qpall')) || $F('module') == '_gdshare' || $F('module') == '_qpshare') ? '':'<td><input type="button" id="btn0' + pId + '" onclick="' + sDelAction + '" style="display:none;" /><a href="javascript:btn0' + pId + '.click();"><img src="images/icon/small/del.gif" alt="删除" /></a></td>'; sSales = ((iRule >=1 && ($F('module') != '_qpall')) || $F('module') == '_gdshare' || $F('module') == '_qpshare') ? '<td>' + sSalesName + '</td>':''; //sSales = ($F('module') == '_qpall') ? '':sSales; sShareLink = (iRule >=2 || $F('module') == '_gdshare' || $F('module') == '_qpshare') ? '':'<td><div id="share0' + pId + '" class="showshare"></div><a href="javascript:void(0);"><img src="images/icon/small/share.gif" alt="共享" onclick="' + sShareMe + '" /></a></td>'; sContract = ($F('module') == '_qpall' || $F('module') == '_qpshare') ? '':' <td' + sHeightLight + ' class="w-80 w-break">' + sContractId + '</td>'; sSendDateArea = ($F('module') == '_qpall' || $F('module') == '_qpshare') ? '':' <td' + sHeightLight + '>' + sSendDate + '</td>'; sViewPrint = "javascript:FC.openReport('0" + pId + "','y')"; sChangePrint = "javascript:FC.changePrint('0" + pId + "')"; var sCpArea = ''; if ($F('module') == '_qpall') { sCpArea = ' <a href="javascript:void(0);"><img src="images/icon/small/change.gif" alt="报价转工单" onclick="' + sChangePrint + '"/></a>'; } else if ($F('module') == '_gdshare') { sCpArea = ' <a href="javascript:void(0);"><img src="images/icon/small/import.gif" alt="导入共享的文件" onclick="' + sImPrint + '" /></a>'; } if ($F('module') == '_qpall' || $F('module') == '_qpshare') { sSalesAuditArea = ''; sFinanceAuditArea = ''; sPmcAuditArea = ''; } else { sSalesAuditArea = ' <td' + sSalesBg + '>' + sSalesDetail + '</td>'; sFinanceAuditArea = ' <td' + sFinanceBg + '>' + sFinanceDetail + '</td>'; sPmcAuditArea = ' <td' + sPmcBg + '>' + sPmcDetail + '</td>'; } var sUnitPrice = sTotalPrice = sCUnitPrice = sCTotalPrice = ''; if (iRule == 3) { sUnitPrice = sTotalPrice = sCUnitPrice = sCTotalPrice = ''; } else { sUnitPrice = ' <td align="right"' + sHeightLight + '>' + fUnitPrice + '</td>'; sTotalPrice = ' <td align="right"' + sHeightLight + '>' + fTotalPrice + '</td>'; sCUnitPrice = ($F('module') == '_qpall' || $F('module') == '_qpshare') ? ' <td align="right" style="background:#F9FEEF">' + fCUnitPrice + '</td>':''; sCTotalPrice = ($F('module') == '_qpall' || $F('module') == '_qpshare') ? ' <td align="right" style="background:#F9FEEF">' + fCTotalPrice + '</td>':''; } sName[i] = '<tr align="center">' + ' <td' + sHeightLight +'>' + sFinanceId + '</td>' + sContract + ' <td' + sHeightLight + '>' + sPrintName + '</td>' + ' <td' + sHeightLight + '>' + sClient + '</td>' + ' <td align="right"' + sHeightLight + '>' + iPrintNumber + '</td>' + sUnitPrice + sTotalPrice + sCUnitPrice + sCTotalPrice + sSendDateArea + sSales + sSalesAuditArea + sFinanceAuditArea + sPmcAuditArea + ' <td' + sHeightLight + '>' + sTime + '</td>' + ' <td' + sHeightLight + '><a href="' + sViewPrint + '"><img src="images/icon/small/rpv.gif" alt="" /></a>' + sCpArea + '</td>' + sEditLink + sDelLink + sShareLink + '</tr>'; } switch(iRule*1) { case 3: sHead += '<tr><th class="w-60 f-b-n c-title">印件编号</th>' + '<th class="f-b-n c-title">合同号码</th>' + '<th class="f-b-n c-title" width="200">印件名称</th>' + '<th class="f-b-n c-title">客户名称</th>' + '<th class="f-b-n c-title">印件数量</th>' + '<th class="w-60 f-b-n c-title">交货日期</th>' + '<th class="w-60 f-b-n c-title">制单员</th>' + '<th class="f-b-n c-title">营业审核</th>' + '<th class="f-b-n c-title">财务审核</th>' + '<th class="f-b-n c-title">生产审核</th>' + '<th class="w-60 f-b-n c-title">操作日期</th>' + sGongDan + '</tr>'; break; case 2: sHead += '<tr><th class="w-60 f-b-n c-title">印件编号</th>' + '<th class="f-b-n c-title">合同号码</th>' + '<th class="f-b-n c-title">印件名称</th>' + '<th class="f-b-n c-title">客户名称</th>' + '<th class="f-b-n c-title">印件数量</th>' + '<th class="w-40 f-b-n c-title">印件单价</th>' + '<th class="w-80 f-b-n c-title">印件总价</th>' + sCpShow + '<th class="w-60 f-b-n c-title">交货日期</th>' + '<th class="w-60 f-b-n c-title">制单员</th>' + '<th class="f-b-n c-title">营业审核</th>' + '<th class="f-b-n c-title">财务审核</th>' + '<th class="f-b-n c-title">生产审核</th>' + '<th class="w-60 f-b-n c-title">操作日期</th>' + sGongDan + '</tr>'; break; case 1: sHead += '<tr><th class="w-60 f-b-n c-title">印件编号</th>' + '<th class="f-b-n c-title">合同号码</th>' + '<th class="f-b-n c-title">印件名称</th>' + '<th class="f-b-n c-title">客户名称</th>' + '<th class="f-b-n c-title">印件数量</th>' + '<th class="w-40 f-b-n c-title">印件单价</th>' + '<th class="w-80 f-b-n c-title">印件总价</th>' + sCpShow + '<th class="w-60 f-b-n c-title">交货日期</th>' + '<th class="w-60 f-b-n c-title">制单员</th>' + '<th class="f-b-n c-title">营业审核</th>' + '<th class="f-b-n c-title">财务审核</th>' + '<th class="f-b-n c-title">生产审核</th>' + '<th class="w-60 f-b-n c-title">操作日期</th>' + sGongDan + '<th class="w-15 f-b-n c-title">共享</th></tr>'; break; default: sHead += '<tr><th class="w-60 f-b-n c-title">印件编号</th>' + '<th class="f-b-n c-title">合同号码</th>' + '<th class="f-b-n c-title">印件名称</th>' + '<th class="f-b-n c-title">客户名称</th>' + '<th class="f-b-n c-title">印件数量</th>' + '<th class="w-40 f-b-n c-title">印件单价</th>' + '<th class="w-80 f-b-n c-title">印件总价</th>' + sCpShow + '<th class="w-60 f-b-n c-title">交货日期</th>' + '<th class="f-b-n c-title">营业审核</th>' + '<th class="f-b-n c-title">财务审核</th>' + '<th class="f-b-n c-title">生产审核</th>' + '<th class="w-60 f-b-n c-title">操作日期</th>' + sGongDan + '<th class="w-15 f-b-n c-title">更新</th>' + '<th class="w-15 f-b-n c-title">删除</th>' + '<th class="w-15 f-b-n c-title">共享</th></tr>'; break; } if ($F('module') == '_gdshare') { sHead = '<table cellspacing="0" width="100%" align="center" id="quotetableall"><tr><th class="w-60 f-b-n c-title">印件编号</th>' + '<th class="f-b-n c-title">合同号码</th>' + '<th class="f-b-n c-title">印件名称</th>' + '<th class="f-b-n c-title">客户名称</th>' + '<th class="f-b-n c-title">印件数量</th>' + '<th class="w-40 f-b-n c-title">印件单价</th>' + '<th class="w-80 f-b-n c-title">印件总价</th>' + '<th class="w-60 f-b-n c-title">交货日期</th>' + '<th class="w-60 f-b-n c-title">制单员</th>' + '<th class="f-b-n c-title">营业审核</th>' + '<th class="f-b-n c-title">财务审核</th>' + '<th class="f-b-n c-title">生产审核</th>' + '<th class="w-60 f-b-n c-title">操作日期</th>' + sGongDan + '</tr>'; } if ($F('module') == '_qpall') { sHead = '<table cellspacing="0" width="100%" align="center" id="quotetableall"><tr><th class="w-60 f-b-n c-title">印件编号</th>' + '<th class="f-b-n c-title">印件名称</th>' + '<th class="f-b-n c-title">客户名称</th>' + '<th class="f-b-n c-title">印件数量</th>' + '<th class="w-40 f-b-n c-title">印件单价</th>' + '<th class="w-80 f-b-n c-title">印件总价</th>' + '<th class="w-40 f-b-n c-title">合计单价</th>' + '<th class="w-80 f-b-n c-title">合计总价</th>' + '<th class="w-60 f-b-n c-title">操作日期</th>' + sGongDan + '<th class="w-15 f-b-n c-title">更新</th>' + '<th class="w-15 f-b-n c-title">删除</th>' + '<th class="w-15 f-b-n c-title">共享</th></tr>'; } if ($F('module') == '_qpshare') { sHead = '<table cellspacing="0" width="100%" align="center" id="quotetableall"><tr><th class="w-60 f-b-n c-title">印件编号</th>' + '<th class="f-b-n c-title">印件名称</th>' + '<th class="f-b-n c-title">客户名称</th>' + '<th class="f-b-n c-title">印件数量</th>' + '<th class="w-40 f-b-n c-title">印件单价</th>' + '<th class="w-80 f-b-n c-title">印件总价</th>' + '<th class="w-40 f-b-n c-title">合计单价</th>' + '<th class="w-80 f-b-n c-title">合计总价</th>' + '<th class="w-60 f-b-n c-title">制单员</th>' + '<th class="w-60 f-b-n c-title">操作日期</th>' + sGongDan + '</tr>'; } var sEnd = '</table>'; oo('quoteall').innerHTML = sHead + sName.join("") + sEnd; $('loading').innerHTML = ''; } }); } 看看有没有做化的地方? 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2007-07-31
我发现你最大的问题是用了太多的string的相加,这是js最忌讳的,js的string的效率最低,你把你所有的string相加,都改成array,我想应该能解决你的问题,写个例子
var a = [] a.push("你的内容"); a.push("你的内容2"); //等等 //最后使用时 alert(a.join('')); |
|
返回顶楼 | |
发表时间:2007-08-01
修改过还是会假死呀
|
|
返回顶楼 | |
发表时间:2007-08-01
你能把这个应用上传上来吗,我在tomcat下跑跑看
|
|
返回顶楼 | |
发表时间:2007-08-29
这个大概是最末的一种选择。
要么直接从服务器得到你用字符串相加拼出来的表格。 要么在页面上就有一个表格让你修改。这两种方法都会比这个快。 |
|
返回顶楼 | |
发表时间:2007-08-30
我前一段时间也出现这个问题,不过我用的是DWR,返回给IE的数据量比楼主的大的多,等解析完全最少要15秒,我试了好几种方法。一开始我以为我的java文件写的有问题,后来发现从服务器返回到页面最多就两秒,剩下的时间全部被IE占用处理字符串了。我想问问:有没有比较好的方案???
|
|
返回顶楼 | |