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

This commit is contained in:
From-wh 2023-04-23 10:03:13 +08:00
commit 5bc849d9c0
6 changed files with 13 additions and 10 deletions

View File

@ -87,6 +87,9 @@ class SystemCrud extends AuthController
];
}
if ($item['from_type']) {
if (!$item['table_name']) {
return app('json')->fail('表单标题必须填写');
}
$fromField[] = [
'field' => $item['field'],
'type' => $item['from_type'],

View File

@ -531,6 +531,7 @@ class SystemCrudServices extends BaseServices
$service = app()->make(Service::class);
$service->setFilePathName($filePath['service'] ?? '')->setbasePath($basePath)->handle($tableName, [
'field' => $options['fromField'],
'key' => $options['key'],
'usePath' => $dao->getUsePath(),
'modelName' => $options['modelName'] ?? '',
]);
@ -566,12 +567,13 @@ class SystemCrudServices extends BaseServices
$viewPages->setFilePathName($filePath['pages'] ?? '')->setbasePath($basePath)->handle($tableName, [
'field' => $options['columnField'],
'route' => $routeName,
'key' => $options['key'],
'pathApiJs' => '@/' . str_replace('\\', '/', str_replace([Make::adminTemplatePath(), '.js'], '', $viewApi->getPath())),
]);
//创建文件
if ($isMake) {
FileService::batchMakeFiles([$model, $dao, $service, $controller, $route, $viewApi, $viewPages, $viewRouter]);
FileService::batchMakeFiles([$model, $validate, $dao, $service, $controller, $route, $viewApi, $viewPages, $viewRouter]);
}
return [

View File

@ -49,12 +49,9 @@ class Service extends Make
$this->value['use-php'] = $this->getDaoClassName($name, $path);
$this->value['modelName'] = $options['modelName'] ?? $name;
$action = $options['action'] ?? [];
$field = $options['field'] ?? [];
if (!$action) {
$action = ['index', 'form', 'save', 'update'];
}
$field = $options['field'] ?? [];
$action = ['index', 'form', 'save', 'update'];
$contentAction = '';
foreach ($action as $item) {
@ -64,8 +61,8 @@ class Service extends Make
//生成form表单
if (in_array('save', $action) || in_array('update', $action)) {
$var = ['{%date%}', '{%route%}', '{%form-php%}', '{%modelName%}'];
$value = [$this->value['date'], Str::snake($options['route'] ?? $name)];
$var = ['{%key%}', '{%date%}', '{%route%}', '{%form-php%}', '{%modelName%}'];
$value = [$options['key'] ?? 'id', $this->value['date'], Str::snake($options['route'] ?? $name)];
$from = [];
foreach ($field as $item) {
switch ($item['type']) {

View File

@ -90,6 +90,7 @@ class ViewPages extends Make
}
$this->value['auth'] = Str::snake($name);
$this->value['componentName'] = $this->value['auth'];
$this->value['key'] = $options['key'] ?? 'id';
$this->value['route'] = $route;
$this->value['content-vue'] = $columnStr ? "\n" . implode($this->tab(2) . ',', $columnStr) . $this->tab(2) . ',' : '';
$this->value['pathApiJs'] = $options['pathApiJs'] ?? '';

View File

@ -7,7 +7,7 @@
public function getCrudListIndex(array $where = [])
{
[$page, $limit] = $this->getPageValue();
$model = $this->dao->selectModel($where, '*', $page, $limit);
$model = $this->dao->selectModel($where, '*', $page ?: 1, $limit ?: 10, '{%key%} desc');
return ['count' => $model->count(), 'list' => $model->select()->toArray()];
}

View File

@ -48,7 +48,7 @@ export default {
columns: [
{
title: 'ID',
key: 'id',
key: '{%key%}',
width: 80,
},{%content-vue%}
{