用jquery实现动态列表

html:

//工单表

<table id="tcdSalesTable" style="position: absolute;top:10px;left:10%;">
<tr>
<td >工单编号</td>
<td >工单类型</td>
<td >设备编号</td>
</tr>

</table>

//费用表

<table id="payTable" class="inline-table" style="position: absolute;top:10px;left:10%;">
<tr>
<td style="">费用名称</td>
<td style="">金额</td>
<td style="">凭证</td>
</tr>
</table>

javaScript:

$(function(){

                //拼接工单表

                //判断该列表(entityList)是否存在,并对其进行遍历和重命名。

var worekHtml="<#if entityList??> <#list entityList as entityLists> <tr>";

                //注:实体引用用单引号修饰

worekHtml+='<td style="border: 1px solid #C9C9C9;">'+'${entityLists.workNumber!''}'+'</td>'
if(${entityLists.tefrwType!''} == 2)
        worekHtml+='<td style="border: 1px solid #C9C9C9;">巡检工单</td>'
if(${entityLists.tefrwType!''} == 1)
worekHtml+='<td style="border: 1px solid #C9C9C9;">维修工单</td>'
worekHtml+='<td style="border: 1px solid #C9C9C9;">'+'${entityLists.productNumber!''}'+'</td>';
worekHtml+="</tr> </#list> </#if>"
$('#tcdSalesTable').append(worekHtml);

        

                拼接费用表:

var payHtml="<#if payList??> <#list payList as payLists> <tr>";
payHtml+='<td style="border: 1px solid #C9C9C9;">'+'${payLists.twName!''}'+'</td>'
+'<td style="border: 1px solid #C9C9C9;">'+'${payLists.tefriAmount!''}'+'</td>'

+'<td style="border: 1px solid #C9C9C9;padding: 0px 0px;">

               <img onclick="openload(\'${payLists.tefriFiles!''}\')" width="50" height="25" src="${payLists.tefriFiles!''}"/>

               </td>';

payHtml+="</tr> </#list> </#if>"
$('#payTable').append(payHtml);
});


猜你喜欢

转载自blog.csdn.net/qq_38793958/article/details/80308824