|
@@ -2,7 +2,7 @@ import { Provide } from '@midwayjs/core';
|
|
|
import { InjectDataSource, InjectEntityModel } from '@midwayjs/typeorm';
|
|
|
import { DataSource, In, Repository } from 'typeorm';
|
|
|
import { Menus } from '../../entity/system/menus.entity';
|
|
|
-import { cloneDeep, get, isNull, isNumber, isObject, isUndefined, omit } from 'lodash';
|
|
|
+import { get, isNull, isNumber, isUndefined } from 'lodash';
|
|
|
import { User } from '../../entity/system/user.entity';
|
|
|
import { Admin } from '../../entity/system/admin.entity';
|
|
|
import { Achievement } from '../../entity/platform/achievement.entity';
|
|
@@ -122,243 +122,6 @@ export class DataDealService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**初始化用户目录,先去数据库把表清空,顺便重置下id索引 */
|
|
|
- async 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_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_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: '通知管理',
|
|
|
- route_name: 'center_notice',
|
|
|
- i18n_code: 'menus.center_notice',
|
|
|
- path: '/center/notice',
|
|
|
- component: '/center/notice',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'Notebook',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 3,
|
|
|
- name: '行业动态',
|
|
|
- route_name: 'center_news2',
|
|
|
- i18n_code: 'menus.center_news2',
|
|
|
- path: '/center/news2',
|
|
|
- component: '/center/news2',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'Message',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 4,
|
|
|
- name: '需求管理',
|
|
|
- route_name: 'center_demand',
|
|
|
- i18n_code: 'menus.center_demand',
|
|
|
- path: '/center/demand',
|
|
|
- component: '/center/demand',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'DataBoard',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 5,
|
|
|
- name: '供给管理',
|
|
|
- route_name: 'center_supply',
|
|
|
- i18n_code: 'menus.center_supply',
|
|
|
- path: '/center/supply',
|
|
|
- component: '/center/supply',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'Notification',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 6,
|
|
|
- name: '成果管理',
|
|
|
- route_name: 'center_achievement',
|
|
|
- i18n_code: 'menus.center_achievement',
|
|
|
- path: '/center/achievement',
|
|
|
- component: '/center/achievement',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'Medal',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 7,
|
|
|
- name: '项目管理',
|
|
|
- route_name: 'center_project',
|
|
|
- i18n_code: 'menus.center_project',
|
|
|
- path: '/center/project',
|
|
|
- component: '/center/project',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'Trophy',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 8,
|
|
|
- name: '中试管理',
|
|
|
- route_name: 'center_footplate',
|
|
|
- i18n_code: 'menus.center_footplate',
|
|
|
- path: '/center/footplate',
|
|
|
- component: '/center/footplate',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'TakeawayBox',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 9,
|
|
|
- name: '服务管理',
|
|
|
- route_name: 'center_service',
|
|
|
- i18n_code: 'menus.center_service',
|
|
|
- path: '/center/service',
|
|
|
- component: '/center/service',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'TakeawayBox',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 10,
|
|
|
- name: '赛事管理',
|
|
|
- route_name: 'center_match',
|
|
|
- i18n_code: 'menus.center_match',
|
|
|
- path: '/center/match',
|
|
|
- component: '/center/match',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'CollectionTag',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 11,
|
|
|
- name: '活动管理',
|
|
|
- route_name: 'center_sign',
|
|
|
- i18n_code: 'menus.center_sign',
|
|
|
- path: '/center/sign',
|
|
|
- component: '/center/sign',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'Suitcase',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 12,
|
|
|
- name: '产研行研',
|
|
|
- route_name: 'center_journal',
|
|
|
- i18n_code: 'menus.center_journal',
|
|
|
- path: '/center/journal',
|
|
|
- component: '/center/journal',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'Reading',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 13,
|
|
|
- name: '企业选择',
|
|
|
- route_name: 'center_company',
|
|
|
- i18n_code: 'menus.center_company',
|
|
|
- path: '/center/company',
|
|
|
- component: '/center/company',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'SwitchFilled',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 998,
|
|
|
- name: '我的收藏',
|
|
|
- route_name: 'center_collection',
|
|
|
- i18n_code: 'menus.center_collection',
|
|
|
- path: '/center/collection',
|
|
|
- component: '/center/collection',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'Collection',
|
|
|
- },
|
|
|
- {
|
|
|
- order_num: 999,
|
|
|
- name: '修改密码',
|
|
|
- route_name: 'center_password',
|
|
|
- i18n_code: 'menus.center_password',
|
|
|
- path: '/center/password',
|
|
|
- component: '/center/password',
|
|
|
- type: '1',
|
|
|
- config: [],
|
|
|
- is_default: '0',
|
|
|
- is_use: '0',
|
|
|
- icon: 'Lock',
|
|
|
- },
|
|
|
- ];
|
|
|
- await this.UserMenus.insert(datas);
|
|
|
- }
|
|
|
-
|
|
|
- async initRoleMenus() {
|
|
|
- /**
|
|
|
- * 初始化角色的菜单
|
|
|
- * 共有: 基础信息,认证信息,行业动态,
|
|
|
- */
|
|
|
- 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 });
|
|
|
- // 第一类菜单
|
|
|
- const menus1 = [...common, 'center_news2', 'center_demand', 'center_supply', 'center_achievement', 'center_project', 'center_footplate', 'center_service'];
|
|
|
- // 第一类菜单用户: 用户,科研机构,孵化基地,企业,高校
|
|
|
- const roleUseMenus1 = ['Expert', 'Unit', 'Incubator', 'Company', 'YX'];
|
|
|
- await this.Role.update({ code: In(roleUseMenus1) }, { menu: menus1 });
|
|
|
- // 创业大赛用户: 需要去掉报名管理,加入赛事管理
|
|
|
- const MatchRole = common.filter(f => f != 'center_sign');
|
|
|
- MatchRole.push('center_match');
|
|
|
- await this.Role.update({ code: In(['Competition']) }, { menu: MatchRole });
|
|
|
- }
|
|
|
-
|
|
|
count = 0;
|
|
|
|
|
|
isNoValue(val) {
|