• 在table列表里面运用,<th:block th:switch=''>所处的值为空,或者匹配不上时,td 这列就会少一列,解决方法


     

    没有写过的代码:业务类型

     <th:block th:switch="${sales.handlingType}">
    	                                	<td th:case="1001" th:text="单宽续约"/>
    	                                	<td th:case="1002" th:text="移动续约"/>
    						<td th:case="1003" th:text="融合续约"/>
    						<td th:case="1006" th:text="加装不限量包"/>
                                                    <td th:case="1008" th:text="宽带提速"/>
    </th:block>
    

     如果,我此时的值为,加装影视包,就匹配不上,这时,这个表就少一列,如下图:

    下面这个修改好的:

    <table class="table table-hover table-condensed">
    			<thead>
    				<tr>
    					<th>#</th>
    					<th>省份</th>
    					<th>销售品名称</th>
    	                                <th>省内销售品编码</th>
    	                                <th>集团销售品编码</th>
    	                                <th>业务类型</th>
    	                                <th>操作标识</th>
    	                                <th>最后操作时间</th>
    				</tr>
    			</thead>
    			<tbody>
    				<tr th:each="sales, status: ${stockSalesList}">
    	                                <th th:text="${(pageInfo.pageNo - 1) * pageInfo.pageSize + status.index + 1}"></th>
    	                                <td th:text="${sales.provName}"></td>
    	                                <td align="left" th:text="${sales.offerTitlePrev}"></td>
    	                                <td align="left" th:text="${sales.offerCodePrev}"></td>
    	                                <td th:text="${sales.offerCodeGroup}"></td>
    	                                <td>
                              <div th:switch="${sales.handlingType}">
    							<p th:case="1001" th:text="单宽续约"></p>
    		                                	<p th:case="1002" th:text="移动续约"/>
    							<p th:case="1003" th:text="融合续约"/>
    							<p th:case="1006" th:text="加装不限量包"/>
    							<p th:case="1008" th:text="宽带提速"/>
    							<p th:case="1009" th:text="加装畅享提速包"/>
    							<p th:case="1010" th:text="加装影视包"/>
    	                                  </div>
    	                                </td>
                            <th:block th:switch="${sales.operateMark}">
                                             <td th:case="0" th:text="初始"/>
                                             <td th:case="1" th:text="新增"/>
                                       <td th:case="2" th:text="更新"/>
                                       <td th:case="3" th:text="删除"/>
                                         </th:block>
                                         <td th:text="${#dates.format(sales.lastOperateTime,'yy/MM/dd HH:mm:ss')}"></td>
                                 </tr>
                </tbody>
          </table>

     效果如下图:

  • 相关阅读:
    springmvc 方法参数自定义的解析
    numpy生成随机数组,超几何分布与连续分布
    机器学习笔试知识点
    梯度下降(Gradient Descent)小结
    numpy傅里叶变换
    numpy奇异值分解,广义逆矩阵与行列式
    numpy求解特征值和特征向量
    Scrapy简单介绍
    python异步库twisted
    同步,异步,阻塞和非阻塞的通俗理解
  • 原文地址:https://www.cnblogs.com/hanxue53/p/10966425.html
Copyright © 2020-2023  润新知