mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 06:20:50 +00:00
修改生成默认模板
This commit is contained in:
parent
d35d416c18
commit
f413c45952
@ -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,6 +567,7 @@ 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())),
|
||||
]);
|
||||
|
||||
|
||||
@ -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']) {
|
||||
|
||||
@ -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'] ?? '';
|
||||
|
||||
@ -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()];
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ export default {
|
||||
columns: [
|
||||
{
|
||||
title: 'ID',
|
||||
key: 'id',
|
||||
key: '{%key%}',
|
||||
width: 80,
|
||||
},{%content-vue%}
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user