Compare commits

..

No commits in common. "main" and "v0.6.10" have entirely different histories.

9 changed files with 12 additions and 96 deletions

View File

@ -2,7 +2,7 @@
"name": "webman/admin",
"type": "project",
"license": "MIT",
"description": "基于Webman官方的Admin修改",
"description": "Webman Admin",
"require": {
"workerman/webman-framework": ">=1.4",
"illuminate/database": ">=7.30",

View File

@ -235,9 +235,6 @@ EOF;
EOF;
$options_string = '';
if (!isset($props['images_upload_url'])) {
$props['images_upload_url'] = '/app/admin/upload/image';
}
foreach ($props as $key => $item) {
if (is_array($item)) {
$item = json_encode($item, JSON_UNESCAPED_UNICODE);
@ -799,7 +796,6 @@ EOF;
$field = $info['field'];
$default = $columns[$key]['default'];
$control = strtolower($info['control']);
$auto_increment = $columns[$key]['auto_increment'];
// 搜索框里上传组件替换为input
if ($type == 'search' && in_array($control, ['upload', 'uploadimg'])) {
$control = 'input';
@ -808,24 +804,18 @@ EOF;
$props = Util::getControlProps($control, $info['control_args']);
// 增加修改记录验证必填项
if ($filter == 'form_show' && !$columns[$key]['nullable'] && $default === null && ($field !== 'password' || $type === 'insert')) {
if (!isset($props['lay-verify'])) {
$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 ($filter == 'form_show' && !isset($props['lay-verify']) && !$columns[$key]['nullable'] && $default === null && ($field !== 'password' || $type === 'insert')) {
$props['lay-verify'] = 'required';
}
// 增加记录显示默认值
if ($type === 'insert' && !isset($props['value']) && $default !== null) {
$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;
}
// 查询类型
// 范围查询
if ($type == 'search') {
if ($info['search_type'] == 'between' && method_exists($form, "{$control}Range")) {
$control = "{$control}Range";
@ -833,10 +823,6 @@ EOF;
$control = "{$control}Like";
}
}
// 查询类型移除lay-verify
if ($type == 'search' && !empty($props['lay-verify'])) {
$props['lay-verify'] = '';
}
$options = [
'label' => $info['comment'] ?: $field,

View File

@ -563,7 +563,6 @@ class TableController extends Base
$pk = 'id';
$properties = '';
$timestamps = '';
$incrementing = '';
$columns = [];
try {
$database = config('database.connections')['plugin.admin.mysql']['database'];
@ -572,18 +571,6 @@ class TableController extends Base
if ($item->COLUMN_KEY === 'PRI') {
$pk = $item->COLUMN_NAME;
$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);
$properties .= " * @property $type \${$item->COLUMN_NAME} {$item->COLUMN_COMMENT}\n";
@ -598,7 +585,6 @@ EOF;
* @var bool
*/
public \$timestamps = false;
EOF;
}
@ -628,8 +614,9 @@ class $class extends Base
* @var string
*/
protected \$primaryKey = '$pk';
$timestamps
$incrementing
}
@ -871,16 +858,6 @@ EOF
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){
@ -1020,15 +997,6 @@ EOF;
$js
//提交事件
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.$.ajax({
url: INSERT_API,
@ -1139,15 +1107,6 @@ EOF;
//提交事件
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) {
data.field[PRIMARY_KEY] = layui.url().search[PRIMARY_KEY];
layui.$.ajax({

View File

@ -125,6 +125,7 @@
return layui.popup.failure(res.msg);
}
return layui.popup.success("操作成功", function () {
parent.refreshTable();
parent.layer.close(parent.layer.getFrameIndex(window.name));
});
}

View File

@ -40,17 +40,6 @@
<?=$form->js(3)?>
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.$.ajax({

View File

@ -76,15 +76,6 @@
});
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.$.ajax({

View File

@ -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) {
table.reload("data-table", {
where: data.field

View File

@ -17,5 +17,5 @@ return [
'controller_suffix' => 'Controller',
'controller_reuse' => false,
'plugin_market_host' => 'https://www.workerman.net',
'version' => '0.6.12'
'version' => '0.6.0'
];

View File

@ -25,9 +25,9 @@ layui.define(['jquery'],function (exports) {
}
, success: function (res, succFun, failFun) {//图片上传完成回调 根据自己需要修改
if (res[this.response.statusName] == this.response.statusCode.ok) {
succFun(res[this.response.dataName]["url"]);
succFun(res[this.response.dataName]);
} else {
failFun(res[this.response.msgName]["url"]);
failFun(res[this.response.msgName]);
}
}
};