From 2402d0f796e912411b06a99e176d927c0647db56 Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Thu, 20 Apr 2023 11:56:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9crudBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/crmeb/services/crud/Controller.php | 2 +- crmeb/crmeb/services/crud/Make.php | 2 +- crmeb/crmeb/services/crud/ViewPages.php | 3 ++- crmeb/crmeb/services/crud/stubs/view/pages/crud/index.stub | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crmeb/crmeb/services/crud/Controller.php b/crmeb/crmeb/services/crud/Controller.php index 1289f8a92..616ebd4dd 100644 --- a/crmeb/crmeb/services/crud/Controller.php +++ b/crmeb/crmeb/services/crud/Controller.php @@ -94,7 +94,7 @@ class Controller extends Make $this->value['name'] = $className; $this->value['path'] = $this->getfolderPath($path); $this->value['content-php'] = $contentPhp; - $this->value['use-php'] = "use " . $options['usePath'] . "Services;\n"; + $this->value['use-php'] = "use " . str_replace('/', '\\', $options['usePath']) . "Services;\n"; $contentStr = str_replace($this->var, $this->value, $contentController); diff --git a/crmeb/crmeb/services/crud/Make.php b/crmeb/crmeb/services/crud/Make.php index e9f5a1ebb..d1380fe76 100644 --- a/crmeb/crmeb/services/crud/Make.php +++ b/crmeb/crmeb/services/crud/Make.php @@ -236,7 +236,7 @@ abstract class Make $this->value['path'] = $this->getfolderPath($path); } if (isset($this->value['use-php']) && !empty($options['usePath'])) { - $this->value['use-php'] = "use " . $options['usePath'] . ";\n"; + $this->value['use-php'] = "use " . str_replace('/', '\\', $options['usePath']) . ";\n"; } $contentStr = str_replace($this->var, $this->value, $content); diff --git a/crmeb/crmeb/services/crud/ViewPages.php b/crmeb/crmeb/services/crud/ViewPages.php index 034aa65a2..e04d2b957 100644 --- a/crmeb/crmeb/services/crud/ViewPages.php +++ b/crmeb/crmeb/services/crud/ViewPages.php @@ -88,8 +88,9 @@ class ViewPages extends Make } $columnStr[] = ($key == 0 ? $this->tab(2) : '') . "{\n" . $this->tab(3) . "title:\"{$item['name']}\"," . $this->tab(2) . "\n" . $this->tab(3) . "key:\"{$item['field']}\"\n" . $this->tab(2) . "}\n"; } - $this->value['route'] = $route; $this->value['auth'] = Str::snake($name); + $this->value['componentName'] = $this->value['auth']; + $this->value['route'] = $route; $this->value['content-vue'] = $columnStr ? "\n" . implode($this->tab(2) . ',', $columnStr) . $this->tab(2) . ',' : ''; $this->value['pathApiJs'] = $options['pathApiJs'] ?? ''; $this->value['nameStudly'] = Str::studly($name); diff --git a/crmeb/crmeb/services/crud/stubs/view/pages/crud/index.stub b/crmeb/crmeb/services/crud/stubs/view/pages/crud/index.stub index f11b09c97..9a22311bb 100644 --- a/crmeb/crmeb/services/crud/stubs/view/pages/crud/index.stub +++ b/crmeb/crmeb/services/crud/stubs/view/pages/crud/index.stub @@ -34,7 +34,7 @@ import { mapState } from 'vuex'; import { {%nameCamel%}SaveApi, {%nameCamel%}DeleteApi, {%nameCamel%}UpdateApi, get{%nameStudly%}CreateApi, get{%nameStudly%}EditApi, get{%nameStudly%}ListApi} from '{%pathApiJs%}'; export default { - name: 'user_group', + name: '{%componentName%}', data() { return { grid: {