From 9e4268e74686e236ac1b3af6fe742fd2331691c5 Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Tue, 11 Apr 2023 17:46:37 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/v1/setting/SystemMenus.php | 5 ++- .../services/system/SystemCrudServices.php | 33 +++++++++++++++++-- .../src/pages/setting/systemMenus/index.vue | 10 ++++-- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php b/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php index e00e5e15d..331888b5b 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php +++ b/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php @@ -256,13 +256,12 @@ class SystemMenus extends AuthController public function ruleList() { //获取所有的路由 - $ruleList = app()->make(SystemRouteServices::class)->selectList(['app_name' => 'adminapi'], 'name,path,method,type,id'); + $ruleList = app()->make(SystemRouteServices::class)->selectList(['app_name' => 'adminapi'], 'name,path,method,type,id')->toArray(); $menuApiList = $this->services->getColumn(['auth_type' => 2, 'is_del' => 0], "concat(`api_url`,'_',lower(`methods`)) as rule"); if ($menuApiList) $menuApiList = array_column($menuApiList, 'rule'); $list = []; foreach ($ruleList as $item) { - $item['path'] = str_replace('adminapi/', '', $item['path']); - if (!in_array($item['path'] . '_' . $item['method'], $menuApiList)) { + if (!in_array($item['path'] . '_' . strtolower($item['method']), $menuApiList)) { $item['real_name'] = $item['name'] ?? ''; $item['method'] = strtoupper($item['method']); $list[] = $item; diff --git a/crmeb/app/services/system/SystemCrudServices.php b/crmeb/app/services/system/SystemCrudServices.php index cbd4106ec..986a71b0b 100644 --- a/crmeb/app/services/system/SystemCrudServices.php +++ b/crmeb/app/services/system/SystemCrudServices.php @@ -65,12 +65,39 @@ class SystemCrudServices extends BaseServices return compact('list', 'count'); } + /** + * 数据库字段类型 + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 + * @return \string[][] + */ public function getTabelRule() { - $adapter = app()->make(MysqlAdapter::class); return [ - 'types' => $adapter->getColumnTypes(), - ]; + 'types' => [ + 'string', + 'char', + 'text', + 'integer', + 'biginteger', + 'float', + 'decimal', + 'datetime', + 'timestamp', + 'time', + 'date', + 'blob', + 'binary', + 'varbinary', + 'boolean', + 'uuid', + // Geospatial data types + 'geometry', + 'point', + 'linestring', + 'polygon', + ]; } /** diff --git a/template/admin/src/pages/setting/systemMenus/index.vue b/template/admin/src/pages/setting/systemMenus/index.vue index 8664f1e13..d7cea3c79 100644 --- a/template/admin/src/pages/setting/systemMenus/index.vue +++ b/template/admin/src/pages/setting/systemMenus/index.vue @@ -114,8 +114,8 @@ - - + +
接口名称:{{ item.real_name }}
请求方式:{{ item.method }}
-
接口地址:{{ item.rule }}
+
接口地址:{{ item.path }}
@@ -250,6 +250,10 @@ export default { // 获取权限列表 getRuleList() { getRuleList().then((res) => { + this.foundationList = []; + this.openList = []; + this.seletRouteIds = []; + this.seletRoute = []; res.data.map((e) => { if (e.type) { this.foundationList.push(e); From 447b2f5fa411a3fefdb7507a27858bfdc157bef5 Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Tue, 11 Apr 2023 17:47:24 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/services/system/SystemCrudServices.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crmeb/app/services/system/SystemCrudServices.php b/crmeb/app/services/system/SystemCrudServices.php index 986a71b0b..b8c97b6b1 100644 --- a/crmeb/app/services/system/SystemCrudServices.php +++ b/crmeb/app/services/system/SystemCrudServices.php @@ -67,10 +67,10 @@ class SystemCrudServices extends BaseServices /** * 数据库字段类型 + * @return \string[][] * @author 等风来 * @email 136327134@qq.com * @date 2023/4/11 - * @return \string[][] */ public function getTabelRule() { @@ -97,7 +97,8 @@ class SystemCrudServices extends BaseServices 'point', 'linestring', 'polygon', - ]; + ] + ]; } /** From 941af658a58123c05faacbc0347784ffe4432a99 Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Tue, 11 Apr 2023 18:02:38 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adminapi/controller/v1/setting/SystemCrud.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php index b1b874a06..198e8515e 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php +++ b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php @@ -88,9 +88,10 @@ class SystemCrud extends AuthController */ public function getFilePath() { - [$menuName, $tableName, $fromField, $columnField] = $this->request->postMore([ + [$menuName, $tableName, $isTable, $fromField, $columnField] = $this->request->postMore([ ['menuName', ''], ['tableName', ''], + ['isTable', 0], ['fromField', []], ['columnField', []], ], true); @@ -108,7 +109,15 @@ class SystemCrud extends AuthController $makePath[$key] = $item['path']; } - return app('json')->success($makePath); + $tableField = []; + if (!$isTable) { + $field = $this->services->getColumnNamesList($tableName); + foreach ($field as $item) { + $tableField[] = ['value' => $item['name'], 'comment' => $item['comment'], 'label' => $item['name']]; + } + } + + return app('json')->success(compact('makePath', 'tableField')); } /** From 61e948e4bcd36834845df98ab14f485d3d312c07 Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Tue, 11 Apr 2023 18:07:35 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/crmeb/services/crud/Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crmeb/crmeb/services/crud/Controller.php b/crmeb/crmeb/services/crud/Controller.php index f999f6044..ce3e19a51 100644 --- a/crmeb/crmeb/services/crud/Controller.php +++ b/crmeb/crmeb/services/crud/Controller.php @@ -109,7 +109,7 @@ class Controller extends Make * @email 136327134@qq.com * @date 2023/3/13 */ - protected function getStub(string $type = '') + protected function getStub(string $type = 'controller') { $controllerPath = __DIR__ . DS . 'stubs' . DS . 'controller' . DS; From a66295d6a3c9ab0f62e03d57ca6ce8665d141514 Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Tue, 11 Apr 2023 18:10:34 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/crmeb/services/crud/Route.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crmeb/crmeb/services/crud/Route.php b/crmeb/crmeb/services/crud/Route.php index 774ea2701..921493c61 100644 --- a/crmeb/crmeb/services/crud/Route.php +++ b/crmeb/crmeb/services/crud/Route.php @@ -80,7 +80,7 @@ class Route extends Make $contentStr = str_replace($this->var, $this->value, $content); - $filePath = $this->getFilePathName($path, $this->value['nameCamel']); + $filePath = $this->getFilePathName($path, strtolower($name)); return [$this->makeFile($filePath, $contentStr), $filePath]; }