mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 06:20:50 +00:00
Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev
This commit is contained in:
commit
0ce7b98c36
@ -367,6 +367,68 @@ 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');
|
||||
|
||||
$newRoute = [];
|
||||
foreach ($routeList as $item) {
|
||||
if ($item['methods'] == 'GET') {
|
||||
if (strstr('create', $item['api_url'])) {
|
||||
$key = 'create';
|
||||
} else if (strstr('edit', $item['api_url'])) {
|
||||
$key = 'edit';
|
||||
} else {
|
||||
$key = 'index';
|
||||
}
|
||||
} else if ($item['methods'] == 'DELETE') {
|
||||
$key = 'delete';
|
||||
}
|
||||
|
||||
if (isset($key)) {
|
||||
$newRoute[$key] = $item['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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
$routeList = $newRoute;
|
||||
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列表
|
||||
|
||||
@ -67,7 +67,15 @@ class Order extends AuthController
|
||||
if (!$services->count(['to_uid' => $uid])) {
|
||||
return app('json')->fail(410092);
|
||||
}
|
||||
return app('json')->success($this->services->getOrderApiList($where));
|
||||
if ($where['status'] == -1) {
|
||||
unset($where['status']);
|
||||
$where['is_cancel'] = 0;
|
||||
$refundServices = app()->make(StoreOrderRefundServices::class);
|
||||
$data = $refundServices->refundList($where)['list'];
|
||||
} else {
|
||||
$data = $this->services->getOrderApiList($where);
|
||||
}
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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,
|
||||
@ -360,8 +360,9 @@ class SystemCrudServices extends BaseServices
|
||||
'methods' => $item['method'],
|
||||
'api_url' => $item['path'],
|
||||
'unique_auth' => $item['unique_auth'],
|
||||
'name' => $item['name'],
|
||||
'menu_name' => $item['name'],
|
||||
'is_del' => 0,
|
||||
'auth_type' => 2,
|
||||
];
|
||||
}
|
||||
$menus = app()->make(SystemMenusServices::class)->saveAll($menuData);
|
||||
|
||||
@ -53,5 +53,5 @@ return [
|
||||
//后台前端模板根路径
|
||||
'admin_template_path' => dirname(app()->getRootPath()) . DS . 'template' . DS . 'admin' . DS . 'src' . DS,
|
||||
//在保存crud的是否是否直接生成文件
|
||||
'crud_make' => false
|
||||
'crud_make' => true
|
||||
];
|
||||
|
||||
@ -57,13 +57,7 @@ class WechatService
|
||||
$appId = isset($wechat['wechat_app_appid']) ? trim($wechat['wechat_app_appid']) : '';
|
||||
$appsecret = isset($wechat['wechat_app_appsecret']) ? trim($wechat['wechat_app_appsecret']) : '';
|
||||
} else {
|
||||
$appId = null;
|
||||
if (request()->isPc()) {
|
||||
$appId = sys_config('wechat_open_app_id');
|
||||
}
|
||||
if (!$appId) {
|
||||
$appId = isset($wechat['wechat_appid']) ? trim($wechat['wechat_appid']) : '';
|
||||
}
|
||||
$appId = isset($wechat['wechat_appid']) ? trim($wechat['wechat_appid']) : '';
|
||||
$appsecret = isset($wechat['wechat_appsecret']) ? trim($wechat['wechat_appsecret']) : '';
|
||||
}
|
||||
$config = [
|
||||
|
||||
@ -1 +1 @@
|
||||
Route::get('{%route%}/create', 'crud.{%routePath%}{%controller%}/create')->name('{%menus%}获取创建表单接口');
|
||||
Route::get('{%route%}/create', 'crud.{%routePath%}{%controller%}/create')->option(['real_name' => '{%menus%}获取创建表单接口']);
|
||||
|
||||
@ -1 +1 @@
|
||||
Route::delete('{%route%}/:id', 'crud.{%routePath%}{%controller%}/delete')->name('{%menus%}删除数据接口');
|
||||
Route::delete('{%route%}/:id', 'crud.{%routePath%}{%controller%}/delete')->option(['real_name' => '{%menus%}删除数据接口']);
|
||||
|
||||
@ -1 +1 @@
|
||||
Route::get('{%route%}/:id/edit', 'crud.{%routePath%}{%controller%}/edit')->name('{%menus%}获取修改表单接口');
|
||||
Route::get('{%route%}/:id/edit', 'crud.{%routePath%}{%controller%}/edit')->option(['real_name' => '{%menus%}获取修改表单接口']);
|
||||
|
||||
@ -1 +1 @@
|
||||
Route::get('{%route%}', 'crud.{%routePath%}{%controller%}/index')->name('{%menus%}列表接口');
|
||||
Route::get('{%route%}', 'crud.{%routePath%}{%controller%}/index')->option(['real_name' => '{%menus%}列表接口']);
|
||||
|
||||
@ -1 +1 @@
|
||||
Route::post('{%route%}', 'crud.{%routePath%}{%controller%}/save')->name('{%menus%}保存数据接口');
|
||||
Route::post('{%route%}', 'crud.{%routePath%}{%controller%}/save')->option(['real_name' => '{%menus%}保存数据接口']);
|
||||
|
||||
@ -1 +1 @@
|
||||
Route::put('{%route%}/:id', 'crud.{%routePath%}{%controller%}/update')->name('{%menus%}修改数据接口');
|
||||
Route::put('{%route%}/:id', 'crud.{%routePath%}{%controller%}/update')->option(['real_name' => '{%menus%}修改数据接口']);
|
||||
|
||||
@ -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'],
|
||||
|
||||
@ -4,10 +4,11 @@
|
||||
crud生成说明
|
||||
<template #desc>
|
||||
<p>1、字段配置中表存在生成的字段为表内列的信息,并且主键、伪删除字段不允许设置为列,主键默认展示在列表中,伪删除字段不允许展示</p>
|
||||
<p>2、在字段配置中新建表时,字段类型为addTimestamps会自动创建create_time、update_time字段,字段类型为:timestamp</p>
|
||||
<p>3、在字段配置中新建表时,字段类型为addSoftDelete会字段创建delete_time字段,字段类型为:timestamp,作用是伪删除</p>
|
||||
<p>4、在字段配置中,表单类型为frameImageOne时属于图片单选,frameImages时为图片多选</p>
|
||||
<p>5、在字段配置中,表单类型为不生成时创建后不会生成对应的表单项</p>
|
||||
<p>2、在字段配置中新建表时,主键不需要增加列,会在生成的时候默认自带主键id</p>
|
||||
<p>3、在字段配置中新建表时,字段类型为addTimestamps会自动创建create_time、update_time字段,字段类型为:timestamp</p>
|
||||
<p>4、在字段配置中新建表时,字段类型为addSoftDelete会字段创建delete_time字段,字段类型为:timestamp,作用是伪删除</p>
|
||||
<p>5、在字段配置中,表单类型为frameImageOne时属于图片单选,frameImages时为图片多选</p>
|
||||
<p>6、在字段配置中,表单类型为不生成时创建后不会生成对应的表单项</p>
|
||||
</template>
|
||||
</Alert>
|
||||
<Form ref="foundation" :model="foundation" :rules="foundationRules" :label-width="100">
|
||||
@ -71,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>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// 请求接口地址 如果没有配置自动获取当前网址路径
|
||||
const VUE_APP_API_URL = process.env.VUE_APP_API_URL || `${location.origin}/adminapi`;
|
||||
const VUE_APP_API_URL = `https://v5.wuht.net/adminapi`||process.env.VUE_APP_API_URL || `${location.origin}/adminapi`;
|
||||
|
||||
const Setting = {
|
||||
// 路由前缀
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user