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

This commit is contained in:
evoxwht 2023-04-11 18:25:48 +08:00
commit 865482b261
6 changed files with 52 additions and 12 deletions

View File

@ -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'));
}
/**

View File

@ -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;

View File

@ -65,11 +65,39 @@ class SystemCrudServices extends BaseServices
return compact('list', 'count');
}
/**
* 数据库字段类型
* @return \string[][]
* @author 等风来
* @email 136327134@qq.com
* @date 2023/4/11
*/
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',
]
];
}

View File

@ -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;

View File

@ -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];
}

View File

@ -114,8 +114,8 @@
<Button @click="init">重置</Button>
</div>
<Tabs v-model="routeType" @on-click="changTab">
<TabPane label="基础接口" name="1"></TabPane>
<TabPane label="公共接口" name="0"></TabPane>
<TabPane label="公共接口" name="1"></TabPane>
<TabPane label="基础接口" name="0"></TabPane>
</Tabs>
<div class="rule">
<div
@ -128,7 +128,7 @@
>
<div>接口名称:{{ item.real_name }}</div>
<div>请求方式:{{ item.method }}</div>
<div>接口地址:{{ item.rule }}</div>
<div>接口地址:{{ item.path }}</div>
</div>
</div>
</Modal>
@ -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);