edit
This commit is contained in:
@ -0,0 +1,5 @@
|
||||
<page-header-wrapper [title]="''"></page-header-wrapper>
|
||||
|
||||
<button nz-button [nzSize]="'small'" (click)="menuImport()" [nzLoading]="service.http.loading">
|
||||
导入
|
||||
</button>
|
||||
@ -0,0 +1,16 @@
|
||||
:host {
|
||||
::ng-deep {
|
||||
.pane-content-left {
|
||||
padding-right: 12px;
|
||||
|
||||
nz-select {
|
||||
width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
border-bottom: 2px solid #15408e;
|
||||
}
|
||||
}
|
||||
.pane-content-right {
|
||||
padding-left: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MenuManagerComponentsIndexComponent } from './index.component';
|
||||
|
||||
describe('MenuManagerComponentsIndexComponent', () => {
|
||||
let component: MenuManagerComponentsIndexComponent;
|
||||
let fixture: ComponentFixture<MenuManagerComponentsIndexComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [MenuManagerComponentsIndexComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MenuManagerComponentsIndexComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
120
src/app/routes/menu-manager/components/index/index.component.ts
Normal file
120
src/app/routes/menu-manager/components/index/index.component.ts
Normal file
@ -0,0 +1,120 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Menu } from '@delon/theme';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { MenuManagerService } from './../../services/menu-manager.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu-manager-components-index',
|
||||
templateUrl: './index.component.html',
|
||||
styleUrls: ['./index.component.less'],
|
||||
})
|
||||
export class MenuManagerComponentsIndexComponent implements OnInit {
|
||||
selectedPlatform!: { name: string; appId: string; enName: string };
|
||||
menus: Array<any> = [];
|
||||
platforms: Array<any> = [];
|
||||
currentSelectedNode: any;
|
||||
transferData!: string;
|
||||
dropType = {
|
||||
dropPrev: true,
|
||||
dropNext: true,
|
||||
dropInner: true,
|
||||
};
|
||||
constructor(public service: MenuManagerService, private modal: NzModalService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.initData();
|
||||
}
|
||||
|
||||
initData(): void {
|
||||
this.platforms = [
|
||||
{ name: '运维平台', appId: 'D40B4EFC33FC4803864934872A11B0CE', enName: 'scm-soc-ui' },
|
||||
{ name: '运营后台', appId: '2537B72DDA534361AE4931903F0BFEB3', enName: 'scm-ows-ui' },
|
||||
{ name: '供应商平台', appId: '0CEE254099064665872B777CF9FCBB6B', enName: 'scm-cvc-ui' },
|
||||
// { name: '代理商平台', appId: '737BB699C8894B2D81F21FC667A21169', enName: 'scm-cac-ui' },
|
||||
// { name: '分销商平台', appId: '0D00C7CC306A4CACA5AF95BBD1251980', enName: 'scm-cdc-ui' },
|
||||
// { name: '开放平台', appId: '7B216DD933CB4922BD9094ED8F96B0B4', enName: 'scm-opc-ui' },
|
||||
];
|
||||
}
|
||||
|
||||
platformChange(e: { name: string; appId: string }) {
|
||||
if (e) {
|
||||
this.loadMenus(e.appId);
|
||||
} else {
|
||||
this.menus = [];
|
||||
this.currentSelectedNode = null;
|
||||
}
|
||||
}
|
||||
|
||||
loadMenus(appId: string) {
|
||||
this.service.request(this.service.$api_get_all, { appId }, 'POST', true, 'FORM').subscribe((res) => {
|
||||
this.menus = res;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
editValueChange(event: any) {
|
||||
console.log('editChanged', event);
|
||||
}
|
||||
|
||||
|
||||
menuImport() {
|
||||
if (!this.selectedPlatform) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.service.http.request('GET', `assets/tmp/_mock/platform/${this.selectedPlatform.enName}.json`).subscribe((res: any) => {
|
||||
// console.log(res);
|
||||
this.addMenu(res.menu);
|
||||
});
|
||||
}
|
||||
|
||||
addMenu(menus: Array<Menu>, parentId: string = '') {
|
||||
menus.forEach((r) => {
|
||||
if (parentId !== '') {
|
||||
r.parentId = parentId;
|
||||
}
|
||||
this.service.request(this.service.$api_get_one, { appId: this.selectedPlatform.appId, i18n: r.i18n }).subscribe((res) => {
|
||||
// 如果res.data存在,则更新菜单
|
||||
if (res.data) {
|
||||
r.id = res.data.id;
|
||||
}
|
||||
this.service
|
||||
.addOne({ appId: this.selectedPlatform.appId, ...r, isLeaf: !(r.children && r.children.length > 0) })
|
||||
.subscribe((result) => {
|
||||
if (result) {
|
||||
if (r.children && r.children.length > 0) {
|
||||
this.addMenu(r.children, result.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.loadMenus(this.selectedPlatform.appId);
|
||||
}
|
||||
|
||||
addMenuRecursion() {
|
||||
|
||||
}
|
||||
|
||||
delMenu(appId: string, menus: Array<Menu>) {
|
||||
if (!menus || menus.length === 0) {
|
||||
return;
|
||||
}
|
||||
let notice = `确认删除菜单[${menus[0].text}]?`;
|
||||
if (menus.length > 1) {
|
||||
notice = `确认删除勾选的${menus.length}行菜单记录?`;
|
||||
}
|
||||
const ids = menus.map((r) => r.id);
|
||||
this.modal.confirm({
|
||||
nzTitle: '<i>删除确认</i>',
|
||||
nzContent: `<b>${notice}</b><br>是否删除?`,
|
||||
nzOnOk: () =>
|
||||
this.service.delMany(ids).subscribe((res) => {
|
||||
if (res === true) {
|
||||
this.service.msgSrv.success('删除成功!');
|
||||
}
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
14
src/app/routes/menu-manager/menu-manager-routing.module.ts
Normal file
14
src/app/routes/menu-manager/menu-manager-routing.module.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { MenuManagerComponentsIndexComponent } from './components/index/index.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: 'index', pathMatch: 'full' },
|
||||
{ path: 'index', component: MenuManagerComponentsIndexComponent },
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class MenuManagerRoutingModule {}
|
||||
12
src/app/routes/menu-manager/menu-manager.module.ts
Normal file
12
src/app/routes/menu-manager/menu-manager.module.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { NgModule, Type } from '@angular/core';
|
||||
import { SharedModule } from '@shared';
|
||||
import { MenuManagerComponentsIndexComponent } from './components/index/index.component';
|
||||
import { MenuManagerRoutingModule } from './menu-manager-routing.module';
|
||||
|
||||
const COMPONENTS: Type<void>[] = [MenuManagerComponentsIndexComponent];
|
||||
const COMPONENTS_NOROUNT: Type<void>[] = [];
|
||||
@NgModule({
|
||||
imports: [SharedModule, MenuManagerRoutingModule],
|
||||
declarations: [...COMPONENTS, ...COMPONENTS_NOROUNT]
|
||||
})
|
||||
export class MenuManagerModule {}
|
||||
23
src/app/routes/menu-manager/services/menu-manager.service.ts
Normal file
23
src/app/routes/menu-manager/services/menu-manager.service.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { BaseService } from '@shared';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class MenuManagerService extends BaseService {
|
||||
// 新增/更新菜单
|
||||
$api_add_one = `/scm/cuc/cuc/functionInfo/saveFunctionInfo`;
|
||||
|
||||
// 根据应用ID获取所有菜单
|
||||
$api_get_all = `/scm/cuc/cuc/functionInfo/getAllFunctionInfoByAppId`;
|
||||
|
||||
// 根据i18n和应用ID获取菜单
|
||||
$api_get_one = `/scm/cuc/cuc/functionInfo/getFunctionsInfoByI18n?_allow_badcode=true`;
|
||||
|
||||
// 删除多个菜单
|
||||
$api_del_many = `/scm/cuc/cuc/functionInfo/deletebatchFunctionInfo`;
|
||||
|
||||
constructor(public injector: Injector) {
|
||||
super(injector);
|
||||
}
|
||||
}
|
||||
132
src/app/routes/menu-manager/services/user.service.ts
Normal file
132
src/app/routes/menu-manager/services/user.service.ts
Normal file
@ -0,0 +1,132 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { BaseService } from '@shared';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class UserService extends BaseService {
|
||||
// 保存单个实例接口地址
|
||||
$api_save_one = '/tms/cuc/oaUserHarvestAddress/save';
|
||||
// 保存多个实例接口地址
|
||||
$api_save_many = '';
|
||||
// 删除一个实例接口地址
|
||||
$api_del_one = '';
|
||||
// 删除多个实例接口地址
|
||||
$api_del_many = '/tms/cuc/oaUserHarvestAddress/deletebatch';
|
||||
// 获取单个实例接口地址
|
||||
$api_get_one = '/bcp/cuc/cuc/userInfo/getUserDetailByUserId';
|
||||
// 获取多个实例接口地址
|
||||
$api_get_many = '';
|
||||
// 获取实例分页数据接口地址
|
||||
$api_get_page = '/bcp/cuc/cuc/userInfo/getUserInfoListPage';
|
||||
// 导出接口地址
|
||||
$api_export = '/bcp/cuc/cuc/userInfo/exportUserList';
|
||||
// 导入接口地址
|
||||
$api_import = '';
|
||||
// 导入模板下载地址
|
||||
$api_import_download_tpl = '';
|
||||
// 获取项目列表
|
||||
$api_getProjectInfoList = '/scm/cuc/cuc/projectInfo/getProjectInfoList';
|
||||
// 根据项目获取应用列表
|
||||
$api_getAppInfoListByProjectId = '/scm/cuc/cuc/appInfo/getAppInfoListByProjectId';
|
||||
// 根据应用获取菜单列表
|
||||
$api_getAllFunctionInfoByAppId = '/scm/cuc/cuc/functionInfo/getAllFunctionInfoByAppId';
|
||||
// 获取菜单已拥有的按钮
|
||||
$api_getFunctionButtonInfo = '/scm/cuc/cuc/functionButton/getFunctionButtonInfo';
|
||||
// 获取菜单已拥有的数据字典
|
||||
$api_getFunctionDataInfo = '/scm/cuc/cuc/functionData/getFunctionDataInfo';
|
||||
// 获取所有按钮
|
||||
$api_getButtonInfoList = '/scm/cuc/cuc/buttonInfo/getButtonInfoList';
|
||||
// 获取按钮列表
|
||||
$api_getButtonInfoPage = '/scm/cuc/cuc/buttonInfo/getButtonInfoPage';
|
||||
// 新增编辑按钮信息
|
||||
$api_saveButtonInfo = '/scm/cuc/cuc/buttonInfo/saveButtonInfo';
|
||||
// 查看菜单信息
|
||||
$api_getFunctionInfo = '/scm/cuc/cuc/functionInfo/getFunctionInfo';
|
||||
|
||||
// 删除
|
||||
$api_deletebatchButton = '/scm/cuc/cuc/buttonInfo/deletebatchButton';
|
||||
// 新增 and 编辑
|
||||
$api_saveFunctionInfo = '/scm/cuc/cuc/functionInfo/saveFunctionInfo';
|
||||
// 删除菜单(含多个)
|
||||
$api_deletebatchFunctionInfo = '/scm/cuc/cuc/functionInfo/deletebatchFunctionInfo';
|
||||
// 字典列表
|
||||
$api_getDictTree = '/scce/pbc/pbc/dict/getDictTree';
|
||||
// 删除字典
|
||||
$api_delete = '/scce/pbc/pbc/dict/delete';
|
||||
// 删除字典选项
|
||||
$api_deleteById = '/scce/pbc/pbc/dictItems/deleteById';
|
||||
// 字典详情
|
||||
$api_getDictItemsByDictId = '/scce/pbc/pbc/dictItems/getDictItemsByDictId';
|
||||
// 编辑字典
|
||||
$api_dictUpdate = '/scce/pbc/pbc/dict/update';
|
||||
// 新增字典
|
||||
$api_dictSave = '/scce/pbc/pbc/dict/save';
|
||||
// 编辑字典选项
|
||||
$api_dictItemsUpdate = '/scce/pbc/pbc/dictItems/update';
|
||||
// 新增字典选项
|
||||
$api_dictItemsSave = '/scce/pbc/pbc/dictItems/save';
|
||||
// 角色模板列表查询
|
||||
$api_getRoleTemplateInfoList = '/scm/cuc/cuc/roleTemplateInfo/getRoleTemplateInfoList';
|
||||
// 删除角色模板(含多个)
|
||||
$api_removeRoleTemplateInfo = '/scm/cuc/cuc/roleTemplateInfo/removeRoleTemplateInfo';
|
||||
// 编辑角色模板信息
|
||||
$api_updateRoleTemplateInfo = '/scm/cuc/cuc/roleTemplateInfo/updateRoleTemplateInfo';
|
||||
// 获取角色详情
|
||||
$api_getRoleInfo = '/scm/cuc/cuc/roleInfo/getRoleInfo';
|
||||
// 角色列表
|
||||
$api_getAppRoleInfoList = '/scm/cuc/cuc/roleInfo/getAppRoleInfoList';
|
||||
// 删除角色
|
||||
$api_removeRoleInfo = '/scm/cuc/cuc/roleInfo/removeRoleInfo';
|
||||
// 编辑角色
|
||||
$api_updateRoleInfo = '/scm/cuc/cuc/roleInfo/updateRoleInfo';
|
||||
// 获取角色模板详情
|
||||
$api_getRoleTemplateInfo = '/scm/cuc/cuc/roleTemplateInfo/getRoleTemplateInfo';
|
||||
// 获取角色模板权限
|
||||
$api_getRoleTemplateAuthority = '/scm/cuc/cuc/roleTemplateInfo/getRoleTemplateAuthority';
|
||||
// 角色菜单下已拥有按钮权限
|
||||
$api_getRoleFunctionButtonAuthority = '/scm/cuc/cuc/roleAuthority/getRoleFunctionButtonAuthority';
|
||||
// 角色菜单下已拥有数据权限
|
||||
$api_getRoleFunctionDataAuthorit = '/scm/cuc/cuc/roleAuthority/getRoleFunctionDataAuthority';
|
||||
// 用户角色关系列表
|
||||
$api_getUserRoleList = '/scm/cuc/cuc/userAuthority/getUserRoleList';
|
||||
// 删除用户角色关系列表
|
||||
$api_deleteUserAuthority = '/scm/cuc/cuc/userAuthority/deleteUserAuthority';
|
||||
// 用户列表
|
||||
$api_getUserListPage = '/scm/cuc/cuc/userBasicInfo/getUserListPage';
|
||||
// 获取所有应用
|
||||
$api_getAppList = '/scm/cuc/cuc/appInfo/getAppList';
|
||||
// 用户详情
|
||||
$api_getUserInfo = '/scm/cuc/cuc/userBasicInfo/getUserInfo';
|
||||
// 获取用户下所有应用
|
||||
$api_getAppInfoByUserId = '/scm/cuc/cuc/userApp/getAppInfoByUserId';
|
||||
// 获取用户下所有企业
|
||||
$api_getUserEnterpriseList = '/scm/cuc/cuc/userEnterprise/getUserEnterpriseList';
|
||||
// 应用用户列表
|
||||
$api_getAppUserList = '/scm/cuc/cuc/userApp/getAppUserList';
|
||||
// 新增应用用户
|
||||
$api_saveAppUser = '/scm/cuc/cuc/userApp/saveAppUser';
|
||||
// 编辑应用用户信息
|
||||
$api_updateAppUser = '/scm/cuc/cuc/userApp/updateAppUser';
|
||||
// 删除应用用户
|
||||
$api_deleteAppUser = '/scm/cuc/cuc/userApp/deleteAppUser';
|
||||
// 获取应用列表
|
||||
$api_getAppListByLesseeId = '/scm/cuc/cuc/appInfo/getAppListByLesseeId';
|
||||
// 获取应用用户详情
|
||||
$api_getAppUser = '/scm/cuc/cuc/userApp/getAppUser';
|
||||
// 重置密码
|
||||
$api_resetPw = '/scm/cuc/cuc/userBasicInfo/resetPassword';
|
||||
// 冻结或恢复应用用户
|
||||
$api_userApp_freezeOrResume = '/scm/cuc/cuc/userApp/freezeOrResume';
|
||||
// 新增角色
|
||||
$api_roleInfo_saveRoleInfo = '/scm/cuc/cuc/roleInfo/saveRoleInfo';
|
||||
// 编辑角色
|
||||
$api_roleInfo_updateRoleInfo = '/scm/cuc/cuc/roleInfo/updateRoleInfo';
|
||||
// 冻结或恢复角色
|
||||
$api_roleInfo_freezeOrResume = '/scm/cuc/cuc/roleInfo/freezeOrResume';
|
||||
// 获取角色下用户列表
|
||||
$api_getRoleUserList = '/scm/cuc/cuc/userAuthority/getRoleUserList';
|
||||
|
||||
constructor(public injector: Injector) {
|
||||
super(injector);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user