mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 05:50:50 +00:00
增加接口
This commit is contained in:
parent
97db6107f5
commit
e9162d657c
@ -367,6 +367,49 @@ class SystemCrud extends AuthController
|
||||
return app('json')->success(['download_url' => sys_config('site_url') . '/adminapi/download/' . $key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取权限路由
|
||||
* @param $tableName
|
||||
* @return Response
|
||||
* @author 等风来
|
||||
* @email 136327134@qq.com
|
||||
* @date 2023/4/20
|
||||
*/
|
||||
public function getRouteList($tableName)
|
||||
{
|
||||
$info = $this->services->get(['table_name' => $tableName]);
|
||||
if (!$info) {
|
||||
return app('json')->fail('crud详情查询失败');
|
||||
}
|
||||
|
||||
$routeList = app()->make(SystemMenusServices::class)->getColumn([
|
||||
['id', 'in', $info->menu_ids],
|
||||
['auth_type', '=', 2]
|
||||
], 'methods,api_url');
|
||||
|
||||
$column = $this->services->getColumnNamesList($info->table_name);
|
||||
$key = 'id';
|
||||
foreach ($column as $value) {
|
||||
if ($value['primaryKey']) {
|
||||
$key = $value['name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$columns = [];
|
||||
foreach ((array)$info->field['tableField'] as $item) {
|
||||
if (isset($item['from_type']) && $item['from_type']) {
|
||||
$columns[] = [
|
||||
'title' => $item['table_name'],
|
||||
'key' => $item['field'],
|
||||
'from_type' => $item['from_type'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return app('json')->success(compact('key', 'routeList', 'columns'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @author 等风来
|
||||
|
||||
@ -133,6 +133,7 @@ Route::group('system', function () {
|
||||
'delete' => '删除路由分类'
|
||||
],
|
||||
]);
|
||||
Route::get('crud/config/:tableName', 'v1.setting.SystemCrud/getRouteList')->option(['real_name' => '获取CRUD配置']);
|
||||
//下载生成的文件
|
||||
Route::get('crud/download/:id', 'v1.setting.SystemCrud/download')->option(['real_name' => '下载生成的文件']);
|
||||
//获取CRUD列表
|
||||
|
||||
@ -283,7 +283,7 @@ class SystemCrudServices extends BaseServices
|
||||
$dataMenu = [
|
||||
'pid' => $data['pid'],
|
||||
'menu_name' => $data['menuName'],
|
||||
'menu_path' => '/' . $routeName . '/list',
|
||||
'menu_path' => '/' . $routeName ,
|
||||
'auth_type' => 1,
|
||||
'is_show' => 1,
|
||||
'is_del' => 0,
|
||||
|
||||
@ -20,14 +20,14 @@ const meta = {
|
||||
const pre = '{%name%}_'
|
||||
|
||||
export default {
|
||||
path: `${routePre}/{%route%}`,
|
||||
path: `${routePre}`,
|
||||
name: 'crud_{%name%}',
|
||||
header: '{%nameHeader%}',
|
||||
meta,
|
||||
component: LayoutMain,
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
path: '{%route%}',
|
||||
name: `${pre}list`,
|
||||
meta: {
|
||||
auth: ['{%name%}-crud-list-index'],
|
||||
|
||||
@ -72,7 +72,7 @@
|
||||
></Input>
|
||||
</template>
|
||||
<template slot-scope="{ row, index }" slot="field_type">
|
||||
<span v-if="foundation.isTable">{{ row.disabledInput }}</span>
|
||||
<span v-if="foundation.isTable">{{ row.field_type }}</span>
|
||||
<Select v-else v-model="tableField[index].field_type" @on-change="changeItemField($event, index)">
|
||||
<Option v-for="item in columnTypeList" :value="item" :key="item">{{ item }}</Option>
|
||||
</Select>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user