1、onkeypress="enterSearch()"
是键盘按键按下后后,触发的方法,keyCode
为13是回车键
function enterSearch() {
//回车键的值是13
if (event.keyCode == 13) {
//调用搜索按键事件
$.table.search()
}
}
2、赋值时候,双引号,单引号不影响
1)$("#coldStorageCode").val();
取值
2)$("#coldStorageCode").val(deviceCode);
赋值
3、class="form-control m-b"
为带搜索框的下拉栏,前提要引入select2.js
4、thymeleaf的使用
th:with="type=${@dict.getType('add_goods_status')}"
dict
是service类的bean,可以直接使用@service
注解标准的驼峰bean或者@service("dict")
自定bean
getType()
是service中的方法名,add_goods_status
是参数
5、option 中的th:value绑定select中 th:field="*{coldStorageCode}"
,显示的是 th:text
中的数据
<select id="coldStorageCode" name="coldStorageCode" class="form-control m-b"
th:field="*{coldStorageCode}" th:with="coldStorages=${@trayServiceImpl.getColdStorage()}">
<option th:each="coldStorage : ${coldStorages}" th:text="${coldStorage.deviceNm}"
th:value="${coldStorage.deviceCode}"></option>
</select>
6、在页面间传值时候,一种可以使用 获取上级页面的参数
/**
* 获取URL参数
* @param name 参数名称
* @returns {string} 参数值
*/
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]);
return ''; //返回参数值
}
另一种可以直接通过后台,把值传递给页面的input,直接获取input就可以
7、singleSelect
为列表展示时true单选
8、$(function () { });
为页面初始化直接加载的方法
9、submitHandler()
是获取的页面的方法
var iframeWin = layero.find('iframe')[0];
let selectInfo = iframeWin.contentWindow.submitHandler();
$('#shelfId').val(selectInfo[0].id);
$('#shelfCode').val(selectInfo[0].shelfCode);
10、模糊查找and vt.tray_code like concat('%', #{trayCode}, '%')
是concat()中间空没有单引号
11、回车查找时,自动刷新页面的原因是因为form表单中只有一个input
可以新增一个input需要设置成
<input type="text" class="form-control" style="display:none">
注意:hidden不生效,需要使用style=“display:none”