theamleaf
html
字典值
<select class="form-control" name="fplx" id="fplx" th:with="type=${@dict.getType('sys_fplx')}">
<option value="" th:text="全部"></option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}">
</option>
</select>
var deptIdDatas = [[${@dict.getType('sys_workshop_name')}]];
var datas = [[${@dict.getType('sys_oper_type')}]];
formatter: function(value, row, index) {
return $.table.selectDictLabel(datas, value);
}
java service
/**
* 根据字典类型查询字典数据信息
*
* @param dictType 字典类型
* @return 参数键值
*/
public List<SysDictData> getType(String dictType)
{
return dictTypeService.selectDictDataByType(dictType);
}
文章展示了HTML代码中使用字典值填充下拉选择框的示例,以及JavaScript函数处理显示数据的方式。对应的Java服务方法根据字典类型查询字典数据。
2872

被折叠的 条评论
为什么被折叠?



