|
@@ -1,6 +1,6 @@
|
|
|
import { Provide } from '@midwayjs/core';
|
|
|
-import { InjectEntityModel } from '@midwayjs/typeorm';
|
|
|
-import { In, Repository } from 'typeorm';
|
|
|
+import { InjectDataSource, InjectEntityModel } from '@midwayjs/typeorm';
|
|
|
+import { DataSource, In, Repository } from 'typeorm';
|
|
|
import { Menus } from '../../entity/system/menus.entity';
|
|
|
import { get, isNull, isUndefined, omit } from 'lodash';
|
|
|
import { User } from '../../entity/system/user.entity';
|
|
@@ -59,46 +59,52 @@ export class DataDealService {
|
|
|
@InjectEntityModel(Role)
|
|
|
Role: Repository<Role>;
|
|
|
|
|
|
+ @InjectDataSource('default')
|
|
|
+ defaultDataSource: DataSource;
|
|
|
+
|
|
|
|
|
|
async initUserMenus() {
|
|
|
- console.log(' in initUserMenus ');
|
|
|
await this.UserMenus.query('TRUNCATE TABLE "public"."userMenus" RESTART IDENTITY RESTRICT;');
|
|
|
+ await this.defaultDataSource.query(`SELECT setval('"userMenus_id_seq"', (SELECT max(id) FROM "userMenus"));`);
|
|
|
const datas = [
|
|
|
{
|
|
|
order_num: 0,
|
|
|
name: '基础信息',
|
|
|
- route_name: 'center_base',
|
|
|
- i18n_code: 'menus.center_base',
|
|
|
- path: '/center/base',
|
|
|
- component: '/center/base/index',
|
|
|
+ route_name: 'center_basic',
|
|
|
+ i18n_code: 'menus.center_basic',
|
|
|
+ path: '/center/basic',
|
|
|
+ component: '/center/basic',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'User',
|
|
|
},
|
|
|
{
|
|
|
order_num: 1,
|
|
|
- name: '认证信息',
|
|
|
- route_name: 'center_role',
|
|
|
- i18n_code: 'menus.center_role',
|
|
|
- path: '/center/role',
|
|
|
- component: '/center/role/index',
|
|
|
+ name: '认证入驻',
|
|
|
+ route_name: 'center_attestation',
|
|
|
+ i18n_code: 'menus.center_attestation',
|
|
|
+ path: '/center/attestation',
|
|
|
+ component: '/center/attestation',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'Finished',
|
|
|
},
|
|
|
{
|
|
|
order_num: 2,
|
|
|
- name: '消息通知',
|
|
|
+ name: '通知管理',
|
|
|
route_name: 'center_notice',
|
|
|
i18n_code: 'menus.center_notice',
|
|
|
path: '/center/notice',
|
|
|
- component: '/center/notice/index',
|
|
|
+ component: '/center/notice',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'Notebook',
|
|
|
},
|
|
|
{
|
|
|
order_num: 3,
|
|
@@ -106,11 +112,12 @@ export class DataDealService {
|
|
|
route_name: 'center_news2',
|
|
|
i18n_code: 'menus.center_news2',
|
|
|
path: '/center/news2',
|
|
|
- component: '/center/news2/index',
|
|
|
+ component: '/center/news2',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'Message',
|
|
|
},
|
|
|
{
|
|
|
order_num: 4,
|
|
@@ -118,11 +125,12 @@ export class DataDealService {
|
|
|
route_name: 'center_demand',
|
|
|
i18n_code: 'menus.center_demand',
|
|
|
path: '/center/demand',
|
|
|
- component: '/center/demand/index',
|
|
|
+ component: '/center/demand',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'DataBoard',
|
|
|
},
|
|
|
{
|
|
|
order_num: 5,
|
|
@@ -130,11 +138,12 @@ export class DataDealService {
|
|
|
route_name: 'center_supply',
|
|
|
i18n_code: 'menus.center_supply',
|
|
|
path: '/center/supply',
|
|
|
- component: '/center/supply/index',
|
|
|
+ component: '/center/supply',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'Notification',
|
|
|
},
|
|
|
{
|
|
|
order_num: 6,
|
|
@@ -142,11 +151,12 @@ export class DataDealService {
|
|
|
route_name: 'center_achievement',
|
|
|
i18n_code: 'menus.center_achievement',
|
|
|
path: '/center/achievement',
|
|
|
- component: '/center/achievement/index',
|
|
|
+ component: '/center/achievement',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'Medal',
|
|
|
},
|
|
|
{
|
|
|
order_num: 7,
|
|
@@ -154,11 +164,12 @@ export class DataDealService {
|
|
|
route_name: 'center_project',
|
|
|
i18n_code: 'menus.center_project',
|
|
|
path: '/center/project',
|
|
|
- component: '/center/project/index',
|
|
|
+ component: '/center/project',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'Trophy',
|
|
|
},
|
|
|
{
|
|
|
order_num: 8,
|
|
@@ -166,11 +177,12 @@ export class DataDealService {
|
|
|
route_name: 'center_footplate',
|
|
|
i18n_code: 'menus.center_footplate',
|
|
|
path: '/center/footplate',
|
|
|
- component: '/center/footplate/index',
|
|
|
+ component: '/center/footplate',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'TakeawayBox',
|
|
|
},
|
|
|
{
|
|
|
order_num: 9,
|
|
@@ -178,23 +190,25 @@ export class DataDealService {
|
|
|
route_name: 'center_match',
|
|
|
i18n_code: 'menus.center_match',
|
|
|
path: '/center/match',
|
|
|
- component: '/center/match/index',
|
|
|
+ component: '/center/match',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'CollectionTag',
|
|
|
},
|
|
|
{
|
|
|
order_num: 10,
|
|
|
- name: '报名管理',
|
|
|
+ name: '活动管理',
|
|
|
route_name: 'center_sign',
|
|
|
i18n_code: 'menus.center_sign',
|
|
|
path: '/center/sign',
|
|
|
- component: '/center/sign/index',
|
|
|
+ component: '/center/sign',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'Suitcase',
|
|
|
},
|
|
|
{
|
|
|
order_num: 11,
|
|
@@ -202,23 +216,25 @@ export class DataDealService {
|
|
|
route_name: 'center_journal',
|
|
|
i18n_code: 'menus.center_journal',
|
|
|
path: '/center/journal',
|
|
|
- component: '/center/journal/index',
|
|
|
+ component: '/center/journal',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'Reading',
|
|
|
},
|
|
|
{
|
|
|
order_num: 998,
|
|
|
- name: '收藏管理',
|
|
|
+ name: '我的收藏',
|
|
|
route_name: 'center_collection',
|
|
|
i18n_code: 'menus.center_collection',
|
|
|
path: '/center/collection',
|
|
|
- component: '/center/collection/index',
|
|
|
+ component: '/center/collection',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'Collection',
|
|
|
},
|
|
|
{
|
|
|
order_num: 999,
|
|
@@ -226,11 +242,12 @@ export class DataDealService {
|
|
|
route_name: 'center_password',
|
|
|
i18n_code: 'menus.center_password',
|
|
|
path: '/center/password',
|
|
|
- component: '/center/password/index',
|
|
|
+ component: '/center/password',
|
|
|
type: '1',
|
|
|
config: [],
|
|
|
is_default: '0',
|
|
|
is_use: '0',
|
|
|
+ icon: 'Lock',
|
|
|
},
|
|
|
];
|
|
|
await this.UserMenus.insert(datas);
|
|
@@ -241,7 +258,7 @@ export class DataDealService {
|
|
|
* 初始化角色的菜单
|
|
|
* 共有: 基础信息,认证信息,行业动态,
|
|
|
*/
|
|
|
- const common = ['center_base', 'center_role', 'center_notice', 'center_collection', 'center_password', 'center_sign'];
|
|
|
+ const common = ['center_basic', 'center_attestation', 'center_notice', 'center_collection', 'center_password', 'center_sign'];
|
|
|
|
|
|
const justCommonRole = ['User', 'Association', 'Investment', 'State'];
|
|
|
await this.Role.update({ code: In(justCommonRole) }, { menu: common });
|