Velocity模板项目使用案例
2017-07-07 17:16
169 查看
前面已经转载介绍了VM模块的使用,下面就贴几个公司开发的案例吧
1.if判断的使用
2.金额样式$!number.format("样式",获取的值)
3.时间格式$!date.format('yyyy年MM月dd日',获取对应的数值)
4.if else end 非空判断
<tr>
4000
<td width="76"><p align="center"><strong>招标项目 </strong></p></td>
<td width="592" colspan="3"><p>
勘 察
#if ('KC' == $!projectInfo.tenderCategory)
■
#else
□
#end
设 计
#if ('SJ' == $!projectInfo.tenderCategory)
■
#else
□
#end</p></td>
</tr>
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="utf-8"/> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>中标通知书 </title> <style type="text/css"> body { font-family: "宋体"; font-size: 10.5px; line-height: 150%; font-weight: normal; color: #000000; background-color: #FFF; text-align: center; margin: 20px; padding: 20px; height: auto; width:auto; } table { width:697px; height:auto; margin:0 auto; border:0.2px solid #000000; } tr{ line-height: 40px; } td{ height:30px; border:0.2px solid #000000; } .highline{ line-height: 50px; text-align: left; } .highline td{ height: 50px; border-top:0px; } .content_left{ padding:5px; } .list{ list-style-type:none; } .font24{ font-size:24px; font-weight:bold; padding:20px; } .title{ text-align:left; width:697px; height:30px; margin:0 auto; } .right_title150{ margin-right:150px; } .right_title10{ margin-right:10px; } .right_title40{ margin-right:40px; } .vertical_8{ padding:8px } .noborder_u_d_l_r{ border-bottom-width:0px; border-top-width:0px; border-left-width:0px; border-right-width:0px; border-bottom-color:#FFFFFF; } .inner_noborder_u_d_l_r{ border-bottom-width:0px; border-bottom-color:#FFFFFF; border-top-width:0px; border-top-color:#FFFFFF; border-left-width:0px; border-left-color:#FFFFFF; border-right-width:0px; border-right-color:#FFFFFF; } .bottom{ text-align:left; width:697px; height:180px; } </style> </head> <body> <span id="back_to_top"></span> <ul class="list"> <li class="font24">中标通知书</li> </ul> <div class="title"> <table style="border:0px;"> <tr> <td style="text-align:left; border-bottom-width:0px; border-top-width:0px; border-left-width:0px; border-right-width:0px;border-bottom-color:#FFFFFF"></td> <td style="text-align:right; border-bottom-width:0px; border-top-width:0px; border-left-width:0px; border-right-width:0px;border-bottom-color:#FFFFFF"></td> </tr> </table> </div> <div> <table border="1" cellspacing="0" cellpadding="0" width="652"> <tr> <td width="150"><p align="center">工程名称 </p></td> <td width="200" colspan="2"><p align="center">$!projectInfo.projectName</p></td> <td width="100"><p align="center">招标编号 </p></td> <td width="200" colspan="2"><p>$!projectInfo.projectCode</p></td> </tr> <tr> <td width="150"><p align="center">工程建设地址 </p></td> <td width="470" colspan="5"><p> #if ('SBJ' == $!projectExtra.constructionLocation) 北京市 #end #if ('DC' == $!projectInfo.constructionLocation) 东城区 #end #if ('XC' == $!projectExtra.constructionLocation) 西城区 #end #if ('CY' == $!projectExtra.constructionLocation) 朝阳区 #end #if ('HD' == $!projectExtra.constructionLocation) 海淀区 #end #if ('FT' == $!projectExtra.constructionLocation) 丰台区 #end #if ('SJS' == $!projectExtra.constructionLocation) 石景山区 #end #if ('MTG' == $!projectExtra.constructionLocation) 门头沟区 #end #if ('FS' == $!projectExtra.constructionLocation) 房山区 #end #if ('DX' == $!projectExtra.constructionLocation) 大兴区 #end #if ('TZ' == $!projectExtra.constructionLocation) 通州区 #end #if ('SY' == $!projectExtra.constructionLocation) 顺义区 #end #if ('CP' == $!projectExtra.constructionLocation) 昌平区 #end #if ('PG' == $!projectExtra.constructionLocation) 平谷区 #end #if ('HR' == $!projectExtra.constructionLocation) 怀柔区 #end #if ('MY' == $!projectExtra.constructionLocation) 密云县 #end #if ('YQ' == $!projectExtra.constructionLocation) 延庆县 #end $!projectExtra.constructionLocationDes</p></td> </tr> <tr> <td width="150"><p align="center">批准总投资额 </p></td> <td width="180"><p align="center">$!number.format("#0.0000",$!projectInfo.investmentSum) 万元</p></td> <td width="140" colspan="2"><p align="center">批准总建筑面积 </p></td> <td width="150" colspan="2"><p>$!number.format("#0.00",$!projectExtra.buildArea) ㎡</p></td> </tr> <tr> <td width="150"><p align="center">中标单位名称 </p></td> <td width="470" colspan="5"><p align="center">$!resultLetter.pubOrgName</p></td> </tr> <tr> <td width="150"><p align="center">中标价 </p></td> <td width="180"><p>$!number.format("#0.00",$!resultLetter.pubRealPrice) 元</p></td> <td width="140" colspan="2"><p align="center">确定中标日期 </p></td> <td width="150" colspan="2"><p>$!date.format('yyyy年MM月dd日',$!{resultLetter.signTime})</p></td> </tr> <tr> <td width="150"><p align="center">中标方案需要说明的问题 </p></td> <td width="470" colspan="5"><p align="center">$!resultLetter.bidInstruction</p></td> </tr> <tr> <td width="290" colspan="3"> <div style="padding-left:5px;height:150px">法人代表:(签章)</div> </td> <td width="330" colspan="3"> <div style="padding-left:5px;height:135px">招标单位:(盖章)</div> #if (!$resultLetter.submitTime) <div style="float:right;padding-right:50px;padding-bottom:5px;"> 年 月 日</div> #else <div style="float:right;">$!date.format('yyyy年MM月dd日',$!{resultLetter.submitTime})</div> #end </td> </tr> </table> <div class="bottom"> <table style="border:0px;"> <tr> <td class="noborder_u_d_l_r" style="text-align:left;" colspan="2">注:本表一式四份,招标单位、中标单位、代理机构及管理部门各一份。</td> </tr> <tr> <td class="noborder_u_d_l_r" style="text-align:left;" colspan="2"><span style="color:#FFFFFF;"> </span>申报单位应对所报材料真实性负责。</td> </tr> </table> </div> </div> </body> </html>这个案例中使用到了
1.if判断的使用
#if ('CY' == $!projectExtra.constructionLocation) 朝阳区 #end
2.金额样式$!number.format("样式",获取的值)
$!number.format("#0.0000",$!projectInfo.investmentSum)
3.时间格式$!date.format('yyyy年MM月dd日',获取对应的数值)
$!date.format('yyyy年MM月dd日',$!{resultLetter.signTime})
4.if else end 非空判断
#if (!$resultLetter.submitTime) <div style="float:right;padding-right:50px;padding-bottom:5px;"> 年 月 日</div> #else <div style="float:right;">$!date.format('yyyy年MM月dd日',$!{resultLetter.submitTime})</div> #end5.if else end 判断
<tr>
4000
<td width="76"><p align="center"><strong>招标项目 </strong></p></td>
<td width="592" colspan="3"><p>
勘 察
#if ('KC' == $!projectInfo.tenderCategory)
■
#else
□
#end
设 计
#if ('SJ' == $!projectInfo.tenderCategory)
■
#else
□
#end</p></td>
</tr>
相关文章推荐
- SSI项目在Intellij Idea下开发,使用velocity模板技术的操作流程
- SpringBoot 项目中使用velocity模板(转载)
- 让中文环境的Visual Studio 2005使用英文版的项目模板
- 使用 Velocity 实现客户端和服务器端模板
- 使用 Velocity 实现客户端和服务器端模板
- 如何:使用向导来处理项目模板 【转载】
- 《Velocity 模板使用指南》中文版
- 使用 Velocity 实现客户端和服务器端模板
- 测试需求和测试案例模板导入TD使用说明
- VS2008中使用CSLA.NET项目模板时报错的处理
- Team System:使用过程模板简化团队项目
- Struts2中使用Velocity模板需要加入的4个类库文件
- 使用模板的EXCEL操作(读取和写入,不定数量的行项目)
- Java语言介绍(04)开源项目(04)模板引擎(01)Velocity
- 《Velocity 模板使用指南》中文版
- Spring中使用Velocity模板
- Velocity Quick Start [5] - 在模板中使用对象属性、方法
- 使用 Velocity 实现客户端和服务器端模板
- Velocity 模板使用指南
- .NET : 在定义项目模板的时候使用占位符