Compare commits

...

15 Commits

Author SHA1 Message Date
Karson 17931decd5
!471 动态显示组件在进行判断时, 增加对已被附加禁用(disabled)组件的处理
Merge pull request !471 from AriFe.Liu/develop
2024-11-18 09:50:09 +00:00
Karson 4fd2558a8b
!442 update public/assets/js/require-table.js.
Merge pull request !442 from 御宅男(YznCMS官方)/N/A
2024-11-18 09:46:58 +00:00
Karson be3c601b72
!468 searchList 如果传入的是$.getJSON,则无法正确显示label
Merge pull request !468 from 还俗二师兄/develop
2024-11-18 09:46:12 +00:00
Karson 426209a5d5
!479 CRUD生成admin表时,默认字段为nickname
Merge pull request !479 from simon429/develop
2024-11-18 09:14:36 +00:00
Karson 385a33344c
!472 重构初始化安装的数据库配置处理,使用 .env 文件
Merge pull request !472 from ox5a0b54/env-file-db-config
2024-11-18 09:01:55 +00:00
Karson 7763aefd61
!478 做了一些修改
Merge pull request !478 from 端木/develop
2024-11-18 08:00:59 +00:00
Simon 16ae2acb2c CRUD生成admin表时,默认字段为nickname 2024-11-10 18:42:35 +08:00
端木 63cdd2ad25 mod: add type comments 2024-11-10 11:09:48 +08:00
ox5a0b54 c12e304aec 重构初始化安装的数据库配置处理 2024-08-01 15:50:55 +08:00
ox5a0b54 0fb49c1a9a 重构初始化安装的数据库配置处理 2024-08-01 15:38:42 +08:00
gtlee d12f549396 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-01 15:07:27 +08:00
AriFe.Liu 7c7780bc56
动态显示组件在进行判断时, 增加对已被附加禁用(disabled)组件的处理
原代码在进行校验时, 使用serializeArray方法在序列化表单元素时, 会默认将disabled的组件过滤掉, 此操作将会导致动态显示组件依赖的组件被设置为disabled时判断失效, 会隐藏掉使用了data-favisible的组件
本次修改在调用序列化之前, 先临时移除disabled属性, 取出完整的序列化参数后, 再将其恢复禁用, 从而使附加了disabled的组件也能使data-favisible组件正确获取到其当前值
使用情景: 添加表单时某个选项需要管理员手动选择, 在添加完成后, 编辑不能再次修改该选项, 但其下根据该元素需要显隐的组件应当正常展示

Signed-off-by: AriFe.Liu <88468560@qq.com>
2024-07-26 12:51:44 +00:00
还俗二师兄 6ab795e12f
update public/assets/js/require-table.js.
searchList 如果传入的是$.getJSON,则无法正确显示label

如果传入的是value直接是数组的话就无需切割成数组

Signed-off-by: 还俗二师兄 <505097558@qq.com>
2024-07-17 16:55:12 +00:00
gtlee ccf6bd9a98 修复头像URL在命令行初始化安装时无法获取域名问题 2024-06-14 22:38:07 +08:00
御宅男 fe9029beac
update public/assets/js/require-table.js.
修复例如角色组,菜单规则菜单已经关闭通用搜索,但是还是状态还是显示搜索tips的bug

Signed-off-by: 御宅男 <530765310@qq.com>
2023-04-27 05:42:42 +00:00
6 changed files with 48 additions and 31 deletions

View File

@ -920,6 +920,7 @@ class Crud extends Command
$replace = '\'{"custom[type]":"' . $table . '"}\'';
} elseif ($selectpageController == 'admin') {
$attrArr['data-source'] = 'auth/admin/selectpage';
$attrArr['data-field'] = 'nickname';
} elseif ($selectpageController == 'user') {
$attrArr['data-source'] = 'user/user/index';
$attrArr['data-field'] = 'nickname';

View File

@ -214,22 +214,27 @@ class Install extends Command
$adminFile = ROOT_PATH . 'public' . DS . 'admin.php';
// 数据库配置文件
$dbConfigFile = APP_PATH . 'database.php';
$dbConfigText = @file_get_contents($dbConfigFile);
$envSampleFile = ROOT_PATH . '.env.sample';
$envFile = ROOT_PATH . '.env';
if (!file_exists($envFile)) {
if (!copy($envSampleFile, $envFile)) {
throw new Exception(__('Failed to copy %s to %s', '.env.sample', '.env'));
}
}
$envText = @file_get_contents($envFile);
$callback = function ($matches) use ($mysqlHostname, $mysqlHostport, $mysqlUsername, $mysqlPassword, $mysqlDatabase, $mysqlPrefix) {
$field = "mysql" . ucfirst($matches[1]);
$replace = $$field;
if ($matches[1] == 'hostport' && $mysqlHostport == 3306) {
$replace = '';
}
return "'{$matches[1]}'{$matches[2]}=>{$matches[3]}Env::get('database.{$matches[1]}', '{$replace}'),";
return "{$matches[1]} = {$replace}";
};
$dbConfigText = preg_replace_callback("/'(hostname|database|username|password|hostport|prefix)'(\s+)=>(\s+)Env::get\((.*)\)\,/", $callback, $dbConfigText);
$envText = preg_replace_callback("/(hostname|database|username|password|hostport|prefix)\s*=\s*(.*)/", $callback, $envText);
// 检测能否成功写入数据库配置
$result = @file_put_contents($dbConfigFile, $dbConfigText);
$result = @file_put_contents($envFile, $envText);
if (!$result) {
throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/database.php'));
throw new Exception(__('The current permissions are insufficient to write the file %s', '.env'));
}
// 设置新的Token随机密钥key
@ -244,7 +249,7 @@ class Install extends Command
throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/config.php'));
}
$avatar = request()->domain() . '/assets/img/avatar.png';
$avatar = '/assets/img/avatar.png';
// 变更默认管理员密码
$adminPassword = $adminPassword ? $adminPassword : Random::alnum(8);
$adminEmail = $adminEmail ? $adminEmail : "admin@admin.com";

View File

@ -11,11 +11,11 @@ class Http
/**
* 发送一个POST请求
* @param string $url 请求URL
* @param array $params 请求参数
* @param array $options 扩展参数
* @param array $params 请求参数
* @param array $options 扩展参数
* @return mixed|string
*/
public static function post($url, $params = [], $options = [])
public static function post(string $url, array $params = [], array $options = [])
{
$req = self::sendRequest($url, $params, 'POST', $options);
return $req['ret'] ? $req['msg'] : '';
@ -24,11 +24,11 @@ class Http
/**
* 发送一个GET请求
* @param string $url 请求URL
* @param array $params 请求参数
* @param array $options 扩展参数
* @param array $params 请求参数
* @param array $options 扩展参数
* @return mixed|string
*/
public static function get($url, $params = [], $options = [])
public static function get(string $url, array $params = [], array $options = [])
{
$req = self::sendRequest($url, $params, 'GET', $options);
return $req['ret'] ? $req['msg'] : '';
@ -42,7 +42,7 @@ class Http
* @param mixed $options CURL的参数
* @return array
*/
public static function sendRequest($url, $params = [], $method = 'POST', $options = [])
public static function sendRequest(string $url, $params = [], string $method = 'POST', $options = []): array
{
$method = strtoupper($method);
$protocol = substr($url, 0, 5);
@ -108,7 +108,7 @@ class Http
* @param string $method 请求的方法
* @return boolean TRUE
*/
public static function sendAsyncRequest($url, $params = [], $method = 'POST')
public static function sendAsyncRequest(string $url, $params = [], string $method = 'POST'): bool
{
$method = strtoupper($method);
$method = $method == 'POST' ? 'POST' : 'GET';
@ -157,10 +157,10 @@ class Http
/**
* 发送文件到客户端
* @param string $file
* @param bool $delaftersend
* @param bool $exitaftersend
* @param bool $deleteAfterSend
* @param bool $exitAfterSend
*/
public static function sendToBrowser($file, $delaftersend = true, $exitaftersend = true)
public static function sendToBrowser(string $file, bool $deleteAfterSend = true, bool $exitAfterSend = true)
{
if (file_exists($file) && is_readable($file)) {
header('Content-Description: File Transfer');
@ -174,10 +174,10 @@ class Http
ob_clean();
flush();
readfile($file);
if ($delaftersend) {
if ($deleteAfterSend) {
unlink($file);
}
if ($exitaftersend) {
if ($exitAfterSend) {
exit;
}
}

View File

@ -14,7 +14,7 @@ class Random
* @param int $len 长度
* @return string
*/
public static function alnum($len = 6)
public static function alnum(int $len = 6): string
{
return self::build('alnum', $len);
}
@ -25,7 +25,7 @@ class Random
* @param int $len 长度
* @return string
*/
public static function alpha($len = 6)
public static function alpha(int $len = 6): string
{
return self::build('alpha', $len);
}
@ -36,7 +36,7 @@ class Random
* @param int $len 长度
* @return string
*/
public static function numeric($len = 4)
public static function numeric(int $len = 4): string
{
return self::build('numeric', $len);
}
@ -47,7 +47,7 @@ class Random
* @param int $len 长度
* @return string
*/
public static function nozero($len = 4)
public static function nozero(int $len = 4): string
{
return self::build('nozero', $len);
}
@ -58,7 +58,7 @@ class Random
* @param int $len 长度
* @return string
*/
public static function build($type = 'alnum', $len = 8)
public static function build(string $type = 'alnum', int $len = 8): string
{
switch ($type) {
case 'alpha':
@ -93,7 +93,7 @@ class Random
* 获取全球唯一标识
* @return string
*/
public static function uuid()
public static function uuid(): string
{
return sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',

View File

@ -559,7 +559,9 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio
}
};
// @formatter:on
var $disabledElements = form.find(':disabled').removeAttr('disabled');
var dataArr = form.serializeArray(), dataObj = {}, fieldName, fieldValue;
$disabledElements.attr('disabled', 'disabled');
$(dataArr).each(function (i, field) {
fieldName = field.name;
fieldValue = field.value;

View File

@ -805,7 +805,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
display = __(value.charAt(0).toUpperCase() + value.slice(1));
}
var html = '<span class="text-' + color + '">' + (icon ? '<i class="' + icon + '"></i> ' : '') + display + '</span>';
if (this.operate != false) {
if (typeof this.operate !== 'undefined' && this.operate != false) {
html = '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + this.field + '" data-value="' + value + '">' + html + '</a>';
}
return html;
@ -870,6 +870,15 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
value = Fast.api.escape(customValue);
field = this.customField;
}
if (typeof that.searchList === 'object' && typeof that.searchList.then === 'function') {
$.when(that.searchList).done(function (ret) {
if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
that.searchList = ret.data.searchlist;
} else if (ret.constructor === Array || ret.constructor === Object) {
that.searchList = ret;
}
})
}
if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') {
var i = 0;
var searchValues = Object.keys(colorArr).map(function (e) {
@ -885,7 +894,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
//渲染Flag
var html = [];
var arr = value !== '' ? value.split(',') : [];
var arr = $.isArray(value) ? value : value !== '' ? value.split(',') : [];
var color, display, label;
$.each(arr, function (i, value) {
value = value == null || value.length === 0 ? '' : value.toString();