Compare commits
No commits in common. "main" and "v0.6.11" have entirely different histories.
@ -2,7 +2,7 @@
|
|||||||
"name": "webman/admin",
|
"name": "webman/admin",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "基于Webman官方的Admin修改",
|
"description": "Webman Admin",
|
||||||
"require": {
|
"require": {
|
||||||
"workerman/webman-framework": ">=1.4",
|
"workerman/webman-framework": ">=1.4",
|
||||||
"illuminate/database": ">=7.30",
|
"illuminate/database": ">=7.30",
|
||||||
|
@ -799,7 +799,6 @@ EOF;
|
|||||||
$field = $info['field'];
|
$field = $info['field'];
|
||||||
$default = $columns[$key]['default'];
|
$default = $columns[$key]['default'];
|
||||||
$control = strtolower($info['control']);
|
$control = strtolower($info['control']);
|
||||||
$auto_increment = $columns[$key]['auto_increment'];
|
|
||||||
// 搜索框里上传组件替换为input
|
// 搜索框里上传组件替换为input
|
||||||
if ($type == 'search' && in_array($control, ['upload', 'uploadimg'])) {
|
if ($type == 'search' && in_array($control, ['upload', 'uploadimg'])) {
|
||||||
$control = 'input';
|
$control = 'input';
|
||||||
@ -808,24 +807,18 @@ EOF;
|
|||||||
|
|
||||||
$props = Util::getControlProps($control, $info['control_args']);
|
$props = Util::getControlProps($control, $info['control_args']);
|
||||||
// 增加修改记录验证必填项
|
// 增加修改记录验证必填项
|
||||||
if ($filter == 'form_show' && !$columns[$key]['nullable'] && $default === null && ($field !== 'password' || $type === 'insert')) {
|
if ($filter == 'form_show' && !isset($props['lay-verify']) && !$columns[$key]['nullable'] && $default === null && ($field !== 'password' || $type === 'insert')) {
|
||||||
if (!isset($props['lay-verify'])) {
|
|
||||||
$props['lay-verify'] = 'required';
|
$props['lay-verify'] = 'required';
|
||||||
// 非类似字符串类型不允许传空
|
|
||||||
} elseif (!in_array($columns[$key]['type'], ['string', 'text', 'mediumText', 'longText', 'char', 'binary', 'json'])
|
|
||||||
&& strpos($props['lay-verify'], 'required') === false) {
|
|
||||||
$props['lay-verify'] = 'required|' . $props['lay-verify'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 增加记录显示默认值
|
// 增加记录显示默认值
|
||||||
if ($type === 'insert' && !isset($props['value']) && $default !== null) {
|
if ($type === 'insert' && !isset($props['value']) && $default !== null) {
|
||||||
$props['value'] = $default;
|
$props['value'] = $default;
|
||||||
}
|
}
|
||||||
// 主键是自增字段或者表单是更新类型不显示主键
|
// 表单不显示主键
|
||||||
if ($primary_key && $field == $primary_key && (($type == 'insert' && $auto_increment) || $type == 'update')) {
|
if ($filter == 'form_show' && $primary_key && $field == $primary_key) {
|
||||||
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";
|
||||||
@ -833,10 +826,6 @@ EOF;
|
|||||||
$control = "{$control}Like";
|
$control = "{$control}Like";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 查询类型移除lay-verify
|
|
||||||
if ($type == 'search' && !empty($props['lay-verify'])) {
|
|
||||||
$props['lay-verify'] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
'label' => $info['comment'] ?: $field,
|
'label' => $info['comment'] ?: $field,
|
||||||
|
@ -563,7 +563,6 @@ class TableController extends Base
|
|||||||
$pk = 'id';
|
$pk = 'id';
|
||||||
$properties = '';
|
$properties = '';
|
||||||
$timestamps = '';
|
$timestamps = '';
|
||||||
$incrementing = '';
|
|
||||||
$columns = [];
|
$columns = [];
|
||||||
try {
|
try {
|
||||||
$database = config('database.connections')['plugin.admin.mysql']['database'];
|
$database = config('database.connections')['plugin.admin.mysql']['database'];
|
||||||
@ -572,18 +571,6 @@ class TableController extends Base
|
|||||||
if ($item->COLUMN_KEY === 'PRI') {
|
if ($item->COLUMN_KEY === 'PRI') {
|
||||||
$pk = $item->COLUMN_NAME;
|
$pk = $item->COLUMN_NAME;
|
||||||
$item->COLUMN_COMMENT .= "(主键)";
|
$item->COLUMN_COMMENT .= "(主键)";
|
||||||
if (strpos(strtolower($item->DATA_TYPE), 'int') === false) {
|
|
||||||
$incrementing = <<<EOF
|
|
||||||
/**
|
|
||||||
* Indicates if the model's ID is auto-incrementing.
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public \$incrementing = false;
|
|
||||||
|
|
||||||
EOF;
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$type = $this->getType($item->DATA_TYPE);
|
$type = $this->getType($item->DATA_TYPE);
|
||||||
$properties .= " * @property $type \${$item->COLUMN_NAME} {$item->COLUMN_COMMENT}\n";
|
$properties .= " * @property $type \${$item->COLUMN_NAME} {$item->COLUMN_COMMENT}\n";
|
||||||
@ -598,7 +585,6 @@ EOF;
|
|||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public \$timestamps = false;
|
public \$timestamps = false;
|
||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -628,8 +614,9 @@ class $class extends Base
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected \$primaryKey = '$pk';
|
protected \$primaryKey = '$pk';
|
||||||
|
|
||||||
$timestamps
|
$timestamps
|
||||||
$incrementing
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,16 +859,6 @@ EOF
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// 字段允许为空
|
|
||||||
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){
|
||||||
table.reload("data-table", {
|
table.reload("data-table", {
|
||||||
@ -1020,15 +997,6 @@ EOF;
|
|||||||
$js
|
$js
|
||||||
//提交事件
|
//提交事件
|
||||||
layui.use(["form", "popup"], function () {
|
layui.use(["form", "popup"], function () {
|
||||||
// 字段验证允许为空
|
|
||||||
layui.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)$)/, "请输入正确的身份证号"]
|
|
||||||
});
|
|
||||||
layui.form.on("submit(save)", function (data) {
|
layui.form.on("submit(save)", function (data) {
|
||||||
layui.$.ajax({
|
layui.$.ajax({
|
||||||
url: INSERT_API,
|
url: INSERT_API,
|
||||||
@ -1139,15 +1107,6 @@ EOF;
|
|||||||
|
|
||||||
//提交事件
|
//提交事件
|
||||||
layui.use(["form", "popup"], function () {
|
layui.use(["form", "popup"], function () {
|
||||||
// 字段验证允许为空
|
|
||||||
layui.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)$)/, "请输入正确的身份证号"]
|
|
||||||
});
|
|
||||||
layui.form.on("submit(save)", function (data) {
|
layui.form.on("submit(save)", function (data) {
|
||||||
data.field[PRIMARY_KEY] = layui.url().search[PRIMARY_KEY];
|
data.field[PRIMARY_KEY] = layui.url().search[PRIMARY_KEY];
|
||||||
layui.$.ajax({
|
layui.$.ajax({
|
||||||
|
@ -125,6 +125,7 @@
|
|||||||
return layui.popup.failure(res.msg);
|
return layui.popup.failure(res.msg);
|
||||||
}
|
}
|
||||||
return layui.popup.success("操作成功", function () {
|
return layui.popup.success("操作成功", function () {
|
||||||
|
parent.refreshTable();
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -40,17 +40,6 @@
|
|||||||
<?=$form->js(3)?>
|
<?=$form->js(3)?>
|
||||||
|
|
||||||
layui.use(["form", "popup"], function () {
|
layui.use(["form", "popup"], function () {
|
||||||
|
|
||||||
// 字段验证允许为空
|
|
||||||
layui.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)$)/, "请输入正确的身份证号"]
|
|
||||||
});
|
|
||||||
|
|
||||||
//提交事件
|
//提交事件
|
||||||
layui.form.on("submit(save)", function (data) {
|
layui.form.on("submit(save)", function (data) {
|
||||||
layui.$.ajax({
|
layui.$.ajax({
|
||||||
|
@ -76,15 +76,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
layui.use(["form", "popup"], function () {
|
layui.use(["form", "popup"], function () {
|
||||||
// 字段验证允许为空
|
|
||||||
layui.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)$)/, "请输入正确的身份证号"]
|
|
||||||
});
|
|
||||||
//提交事件
|
//提交事件
|
||||||
layui.form.on("submit(save)", function (data) {
|
layui.form.on("submit(save)", function (data) {
|
||||||
layui.$.ajax({
|
layui.$.ajax({
|
||||||
|
@ -237,16 +237,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 字段验证允许为空
|
|
||||||
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
|
||||||
|
@ -17,5 +17,5 @@ return [
|
|||||||
'controller_suffix' => 'Controller',
|
'controller_suffix' => 'Controller',
|
||||||
'controller_reuse' => false,
|
'controller_reuse' => false,
|
||||||
'plugin_market_host' => 'https://www.workerman.net',
|
'plugin_market_host' => 'https://www.workerman.net',
|
||||||
'version' => '0.6.12'
|
'version' => '0.6.0'
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user