在表格中显示操作时间,通过script实现同一表格栏下显示不同状态的时间:
<span style="font-size:18px;"><ww:if test="${alarmAssginLevel =='p'}">
<ec:column property="taskAssignStatusCN" title="下发状态" width="10%" sortable="false"></ec:column>
<ec:column property="taskSendTime" title="下发时间" sortable="false" width="8%" cell="datetime" format="yyyy-MM-dd HH:mm"></ec:column>
</ww:if>
<ww:if test = "${alarmAssginLevel =='q'}">
<ec:column property="taskFeedbackStatusCN" title="反馈状态" width="12%" sortable="false"/>
<ec:column property="time" title="操作时间" sortable="false" width="8%" >
<span style="white-space:pre"> </span><script>
<span style="white-space:pre"> </span>if(${alarm.taskFeedbackStatus=='1'}){
<span style="white-space:pre"> </span>document.write('签收时间:${alarm.taskSignedTimeStr}');
<span style="white-space:pre"> </span>}else if(${alarm.taskFeedbackStatus=='3' || alarm.taskFeedbackStatus=='4'}){
<span style="white-space:pre"> </span>document.write('拒绝时间:${alarm.taskRefusedTimeStr}');
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span></script>
<span style="white-space:pre"> </span></ec:column>
</ww:if></span>
由于数据库中存储的是 taskRefusedTime taskSignedTime 是Date型,在页面显示直接调用会格式有问题,因而我们在页面读取的时候是 taskSignedTimeStr taskRefusedTimeStr(String),单独在相应的java文件和过滤器中定义String类.最后在对应的SQL中进行设置,将Date型转为String型。
to_char(t.TASK_SIGNED_TIME,'yyyy-MM-dd HH24:mi') as taskSignedTimeStr,
<span style="white-space:pre"> </span>to_char(t.TASK_REFUSED_TIME,'yyyy-MM-dd HH24:mi') as taskRefusedTimeStr,