查询时允许字段为空
This commit is contained in:
parent
ca2af73a2c
commit
425113a0d7
@ -816,10 +816,10 @@ EOF;
|
|||||||
$props['value'] = $default;
|
$props['value'] = $default;
|
||||||
}
|
}
|
||||||
// 表单不显示主键
|
// 表单不显示主键
|
||||||
if (($filter == 'form_show' && $primary_key && $field == $primary_key && $auto_increment)) {
|
if ($filter == 'form_show' && $primary_key && $field == $primary_key && $auto_increment) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 范围查询
|
// 查询类型
|
||||||
if ($type == 'search') {
|
if ($type == 'search') {
|
||||||
if ($info['search_type'] == 'between' && method_exists($form, "{$control}Range")) {
|
if ($info['search_type'] == 'between' && method_exists($form, "{$control}Range")) {
|
||||||
$control = "{$control}Range";
|
$control = "{$control}Range";
|
||||||
@ -827,6 +827,16 @@ EOF;
|
|||||||
$control = "{$control}Like";
|
$control = "{$control}Like";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 查询移除required
|
||||||
|
if ($type == 'search' && !empty($props['lay-verify'])) {
|
||||||
|
$verify_items = explode('|', $props['lay-verify']);
|
||||||
|
foreach ($verify_items as $key => $value) {
|
||||||
|
if ($value === 'required') {
|
||||||
|
unset($verify_items[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$props['lay-verify'] = implode('|', $verify_items);
|
||||||
|
}
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
'label' => $info['comment'] ?: $field,
|
'label' => $info['comment'] ?: $field,
|
||||||
|
@ -871,6 +871,16 @@ EOF
|
|||||||
where: []
|
where: []
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 字段允许为空
|
||||||
|
form.verify({
|
||||||
|
phone: [/(^$)|^1\d{10}$/, "请输入正确的手机号"],
|
||||||
|
email: [/(^$)|^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/, "邮箱格式不正确"],
|
||||||
|
url: [/(^$)|(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/, "链接格式不正确"],
|
||||||
|
number: [/(^$)|^\d+$/,'只能填写数字'],
|
||||||
|
date: [/(^$)|^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/, "日期格式不正确"],
|
||||||
|
identity: [/(^$)|(^\d{15}$)|(^\d{17}(x|X|\d)$)/, "请输入正确的身份证号"]
|
||||||
|
});
|
||||||
|
|
||||||
// 表格排序事件
|
// 表格排序事件
|
||||||
table.on("sort(data-table)", function(obj){
|
table.on("sort(data-table)", function(obj){
|
||||||
|
@ -237,6 +237,16 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 字段允许为空
|
||||||
|
form.verify({
|
||||||
|
phone: [/(^$)|^1\d{10}$/, "请输入正确的手机号"],
|
||||||
|
email: [/(^$)|^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/, "邮箱格式不正确"],
|
||||||
|
url: [/(^$)|(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/, "链接格式不正确"],
|
||||||
|
number: [/(^$)|^\d+$/,'只能填写数字'],
|
||||||
|
date: [/(^$)|^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/, "日期格式不正确"],
|
||||||
|
identity: [/(^$)|(^\d{15}$)|(^\d{17}(x|X|\d)$)/, "请输入正确的身份证号"]
|
||||||
|
});
|
||||||
|
|
||||||
form.on("submit(table-query)", function(data) {
|
form.on("submit(table-query)", function(data) {
|
||||||
table.reload("data-table", {
|
table.reload("data-table", {
|
||||||
where: data.field
|
where: data.field
|
||||||
|
Loading…
Reference in New Issue
Block a user