Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev

This commit is contained in:
From-wh 2023-04-25 18:04:15 +08:00
commit 9a6aeb11a9
17 changed files with 117 additions and 38 deletions

View File

@ -238,8 +238,8 @@ class SystemCrud extends AuthController
]);
$data = [];
foreach ($make as $item) {
if (in_array($item['path'], ['pages', 'router', 'api'])) {
foreach ($make as $key => $item) {
if (in_array($key, ['pages', 'router', 'api'])) {
$path = Make::adminTemplatePath() . $item['path'];
} else {
$path = app()->getRootPath() . $item['path'];
@ -559,9 +559,14 @@ class SystemCrud extends AuthController
];
foreach ((array)$info->field['tableField'] as $item) {
if (isset($item['is_table']) && $item['is_table']) {
if (in_array($item['from_type'], ['frameImageOne', 'frameImages'])) {
$keyName = 'slot';
} else {
$keyName = 'key';
}
$columns[] = [
'title' => $item['table_name'] ?: $item['comment'],
'key' => $item['field'],
$keyName => $item['field'],
'from_type' => $item['from_type'],
];
}

View File

@ -69,7 +69,12 @@ class SystemFile extends AuthController
//打开目录
public function opendir()
{
return app('json')->success($this->services->opendir());
[$dir, $fileDir, $superior] = $this->request->getMore([
['dir', ''],
['filedir', ''],
['superior', ''],
], true);
return app('json')->success($this->services->opendir($dir, $fileDir, $superior));
}
//文件备注

View File

@ -59,7 +59,9 @@ Route::group('setting', function () {
],
]);
//未添加的权限规则列表
Route::get('ruleList', 'v1.setting.SystemMenus/ruleList')->option(['real_name' => '未添加的权限规则列表']);
Route::get('ruleList', 'v1.setting.SystemMenus/ruleList')->option(['real_name' => '权限规则列表']);
//权限规则分类
Route::get('rule_cate', 'v1.setting.SystemMenus/ruleCate')->option(['real_name' => '权限规则分类']);
//修改显示
Route::put('menus/show/:id', 'v1.setting.SystemMenus/show')->name('SystemMenusShow')->option(['real_name' => '修改权限规格显示状态']);
})->option(['parent' => 'setting', 'cate_name' => '权限菜单']);

View File

@ -855,11 +855,13 @@ class SystemCrudServices extends BaseServices
$validate = app()->make(Validate::class);
$validate->setFilePathName($filePath['validate'] ?? '')->setbasePath($basePath)->handle($tableName, [
'field' => $options['fromField'],
'modelName' => $options['modelName'] ?? '',
]);
//生成控制器
$controller = app()->make(Controller::class);
$controller->setFilePathName($filePath['controller'] ?? '')->setbasePath($basePath)->handle($tableName, [
'usePath' => $service->getUsePath(),
'modelName' => $options['modelName'] ?? '',
'validateName' => '\\' . str_replace('/', '\\', $validate->getUsePath()) . 'Validate::class',
'field' => array_column($options['fromField'], 'field'),
]);

View File

@ -233,29 +233,25 @@ class SystemFileServices extends BaseServices
}
//打开目录
public function opendir()
public function opendir($dir, $fileDir, $superior)
{
$markList = app()->make(SystemFileInfoServices::class)->getColumn([], 'mark', 'full_path');
$fileAll = array('dir' => [], 'file' => []);
//根目录
$rootdir = $this->formatPath(app()->getRootPath());
//当前目录
$request_dir = app('request')->param('dir');
$rootDir = $this->formatPath(app()->getRootPath());
//防止查看站点以外的目录
if (strpos($request_dir, $rootdir) === false) {
$request_dir = $rootdir;
if (strpos($dir, $rootDir) === false || $dir == '') {
$dir = $rootDir;
}
//判断是否是返回上级
if (app('request')->param('superior') && !empty($request_dir)) {
if (strpos(dirname($request_dir), $rootdir) !== false) {
$dir = dirname($request_dir);
if ($superior) {
if (strpos(dirname($dir), $rootDir) !== false) {
$dir = dirname($dir);
} else {
$dir = $rootdir;
$dir = $rootDir;
}
} else {
$dir = !empty($request_dir) ? $request_dir : $rootdir;
$dir = rtrim($dir, DS) . DS . app('request')->param('filedir');
$dir = $dir . '/' . $fileDir;
}
$list = scandir($dir);
foreach ($list as $key => $v) {
@ -272,12 +268,12 @@ class SystemFileServices extends BaseServices
$uname = php_uname('s');
if (strstr($uname, 'Windows') !== false) {
$dir = ltrim($dir, '\\');
$rootdir = str_replace('\\', '\\\\', $rootdir);
$rootDir = str_replace('\\', '\\\\', $rootDir);
}
$list = array_merge($fileAll['dir'], $fileAll['file']);
$navList = [];
foreach ($list as $key => $value) {
$list[$key]['real_path'] = str_replace($rootdir, '', $value['pathname']);
$list[$key]['real_path'] = str_replace($rootDir, '', $value['pathname']);
$list[$key]['mtime'] = date('Y-m-d H:i:s', $value['mtime']);
$navList[$key]['title'] = $value['filename'];
@ -288,8 +284,26 @@ class SystemFileServices extends BaseServices
$navList[$key]['pathname'] = $value['pathname'];
$navList[$key]['contextmenu'] = true;
$list[$key]['mark'] = $markList[str_replace(root_path(), '/', $value['pathname'])] ?? '';
$count = app()->make(SystemFileInfoServices::class)->count(['full_path' => $list[$key]['real_path']]);
if (!$count) app()->make(SystemFileInfoServices::class)->save([
'name' => $value['filename'],
'path' => str_replace('/' . $value['filename'], '', $list[$key]['real_path']),
'full_path' => $list[$key]['real_path'],
'type' => $value['type'],
'create_time' => date('Y-m-d H:i:s', $value['ctime']),
'update_time' => date('Y-m-d H:i:s', time()),
]);
}
return compact('dir', 'list', 'navList');
$routeList = [['key' => '根目录', 'route' => '']];
$pathArray = explode('/', str_replace($rootDir, '', $dir));
$str = '';
foreach ($pathArray as $item) {
if ($item) {
$str = $str . '/' . $item;
$routeList[] = ['key' => $item, 'route' => $rootDir . $str];
}
}
return compact('dir', 'list', 'navList', 'routeList');
}
//读取文件

View File

@ -90,6 +90,7 @@ class Controller extends Make
[$className, $contentController] = $this->getStubContent($name, 'controller');
$this->value['modelName'] = $options['modelName'] ?? $name;
$this->value['nameCamel'] = Str::studly($name);
$this->value['name'] = $className;
$this->value['path'] = $this->getfolderPath($path);

View File

@ -56,6 +56,7 @@ class Model extends Make
$this->value['use-php'] = "use think\model\concern\SoftDelete;\n";
$this->value['content-php'] = $this->tab() . "use SoftDelete;\n";
}
$this->value['modelName'] = $options['modelName'] ?? $name;
return parent::handle($name, $options);
}

View File

@ -67,10 +67,10 @@ class Service extends Make
foreach ($field as $item) {
switch ($item['type']) {
case 'frameImageOne':
$from[] = $this->tab(2) . $this->getframeImageOnePhpContent($item['field'], $item['name'], $item['required'] ?? false) . ';';
$from[] = $this->tab(2) . $this->getframeImageOnePhpContent($item['field'], $item['name']) . ';';
break;
case 'frameImages':
$from[] = $this->tab(2) . $this->getframeImagesPhpContent($item['field'], $item['name'], $item['required'] ?? false) . ';';
$from[] = $this->tab(2) . $this->getframeImagesPhpContent($item['field'], $item['name']) . ';';
break;
default:
$valueContent = "''";

View File

@ -51,6 +51,7 @@ class Validate extends Make
[$rule, $message] = $this->getRuleContent($options['field']);
$this->value['rule-php'] = $rule;
$this->value['message-php'] = $message;
$this->value['modelName'] = $options['modelName'] ?? $name;
return parent::handle($name, $options); // TODO: Change the autogenerated stub
}

View File

@ -12,6 +12,7 @@
*/
/**
* {%modelName%}
* @author crud自动生成代码
* @date {%time%}
*/

View File

@ -12,6 +12,7 @@
*/
/**
* {%modelName%}
* @author crud自动生成代码
* @date {%time%}
*/

View File

@ -12,6 +12,7 @@
*/
/**
* {%modelName%}
* @author crud自动生成代码
* @date {%time%}
*/

View File

@ -0,0 +1,4 @@
public function get{%field%}Attr($value)
{
{%content-php%}
}

View File

@ -12,6 +12,7 @@
*/
/**
* {%modelName%}
* @author crud自动生成代码
* @date {%time%}
*/
@ -23,7 +24,6 @@ use think\exception\ValidateException;
{%use-php%}
/**
* {%modelName%}
* Class CrudService
* @date {%date%}
* @package app\services\crud{%path%}

View File

@ -12,6 +12,7 @@
*/
/**
* {%modelName%}
* @author crud自动生成代码
* @date {%time%}
*/

View File

@ -85,6 +85,44 @@ export default {
width: 100,
align: 'center',
});
res.data.columns.map(item=>{
if(item.from_type === 'frameImageOne'){
item.render = (h,params)=>{
return h('div',{
class:'tabBox_img',
directives:[{
name:'viewer'
}]
},[
h('img',{
directives:[{
name:'lazy',
value: params.row[item.slot]
}],
})
])
}
} else if(item.from_type === 'frameImages'){
item.render = (h,params)=>{
let image = params.row[item.slot] || []
let imageH = [];
image.map(item=>{
imageH.push(h('img',{
directives:[{
name:'lazy',
value: item
}],
}));
})
return h('div',{
class:'tabBox_img',
directives:[{
name:'viewer'
}]
},imageH)
}
}
})
this.columns = res.data.columns;
this.getList();
});

View File

@ -207,12 +207,13 @@ export default {
slot: 'filename',
minWidth: 150,
back: '返回上级',
sortable: true
},
{
title: '文件/文件夹路径',
key: 'real_path',
minWidth: 150,
},
// {
// title: '文件/文件夹路径',
// key: 'real_path',
// minWidth: 150,
// },
{
title: '文件/文件夹大小',
key: 'size',
@ -222,6 +223,7 @@ export default {
title: '更新时间',
key: 'mtime',
minWidth: 150,
sortable: true,
},
{
title: '备注',
@ -231,7 +233,7 @@ export default {
{
title: '操作',
slot: 'action',
minWidth: 150,
width: 100,
},
],
formItem: {
@ -346,7 +348,7 @@ export default {
open(row) {
// this.rows = row;
this.formItem = {
dir: row.path ? row.path + '/' : row.path,
dir: row.path,
superior: 0,
filedir: row.filename,
fileToken: this.fileToken,
@ -356,19 +358,19 @@ export default {
jumpRoute(item) {
console.log
let data = {
path: item.route ? item.route : '',
filename: item.route ? item.key : '',
path: item.route,
filename: '',
};
this.open(data);
},
refreshRoute() {
let data = {
dir: this.routeList[this.routeList.length - 1].route,
filename: this.routeList[this.routeList.length - 1].key,
path: this.routeList[this.routeList.length - 1].route,
filename: '',
};
this.open(data);
},
// 编辑
// 编辑ß
edit(row) {
this.navItem = row;
this.spinShow = true;
@ -943,7 +945,7 @@ export default {
min-width: 800px;
max-width: max-content;
border: 1px solid #cfcfcf;
background: #f3f3f3;
background: #f6f6f6;
.refresh{
background: #fff;
border-left: 1px solid #cfcfcf;
@ -958,7 +960,7 @@ export default {
cursor: pointer;
}
.refresh:hover,.back:hover{
background: #20a53a;
background: #2D8cF0;
border-color: #38983b;
color: #fff;
}