diff --git a/proxy.conf.js b/proxy.conf.js
index d9d60dfc..ff162fda 100644
--- a/proxy.conf.js
+++ b/proxy.conf.js
@@ -30,7 +30,7 @@ module.exports = {
// },
'//api': {
target: {
- host: 'tms-api-test.eascs.com',
+ host: 'tms-api-dev.eascs.com',
protocol: 'https:',
port: 443
},
diff --git a/src/app/routes/sys-setting/components/organization-management/api-auth-modal/api-auth-modal.component.html b/src/app/routes/sys-setting/components/organization-management/api-auth-modal/api-auth-modal.component.html
new file mode 100644
index 00000000..1ac66921
--- /dev/null
+++ b/src/app/routes/sys-setting/components/organization-management/api-auth-modal/api-auth-modal.component.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/routes/sys-setting/components/organization-management/api-auth-modal/api-auth-modal.component.less b/src/app/routes/sys-setting/components/organization-management/api-auth-modal/api-auth-modal.component.less
new file mode 100644
index 00000000..d97b0abb
--- /dev/null
+++ b/src/app/routes/sys-setting/components/organization-management/api-auth-modal/api-auth-modal.component.less
@@ -0,0 +1,17 @@
+:host {
+ ::ng-deep {
+ .box {
+ width : 100%;
+ margin: 0 auto;
+ }
+
+ .sv__label {
+ display : inline-block;
+ float : left;
+ width : 120px;
+ color : #000;
+ font-size : 13px;
+ text-align: right;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/app/routes/sys-setting/components/organization-management/api-auth-modal/api-auth-modal.component.ts b/src/app/routes/sys-setting/components/organization-management/api-auth-modal/api-auth-modal.component.ts
new file mode 100644
index 00000000..d0465454
--- /dev/null
+++ b/src/app/routes/sys-setting/components/organization-management/api-auth-modal/api-auth-modal.component.ts
@@ -0,0 +1,85 @@
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { NzModalRef } from 'ng-zorro-antd/modal';
+import { SystemService } from '../../../services/system.service';
+import { SettingMenuComponent } from '../../role-management/menu/menu.component';
+
+@Component({
+ selector: 'app-api-auth-modal',
+ templateUrl: './api-auth-modal.component.html',
+ styleUrls: ['./api-auth-modal.component.less']
+})
+export class ApiAuthModalComponent implements OnInit {
+ @ViewChild('menu', { static: false })
+ menu!: SettingMenuComponent;
+ roleInfoData: any = {};
+ authorityAssistId: any[] = [];
+ params: any;
+ changeValue: boolean = false;
+ authority: any[] = [];
+
+ loadingInfo = false;
+ constructor(private modal: NzModalRef, public service: SystemService) {}
+
+ ngOnInit(): void {
+ if (this.params.id) {
+ this.getRoleInfo();
+ }
+ }
+ getRoleInfo() {
+ this.loadingInfo = true;
+ this.service.request(this.params.infoUrl, { id: this.params.id }).subscribe(
+ res => {
+ if (res) {
+ this.roleInfoData = res;
+ }
+ this.loadingInfo = false;
+ },
+ _ => (this.loadingInfo = false),
+ () => (this.loadingInfo = false)
+ );
+ }
+ getData(res: { authority: any[]; authorityAssistId: any[] }) {
+ console.log('修改了');
+
+ this.authority = res.authority;
+ this.authorityAssistId = res.authorityAssistId;
+ }
+ close() {
+ this.modal.destroy();
+ }
+ changeIF(value: any) {
+ this.changeValue = true;
+ }
+ sure() {
+ const auths = this.menu?.washTree();
+ if (auths.authorityAssistId.length === 0) {
+ this.service.msgSrv.warning('请选择权限!');
+ return;
+ }
+ const params: any = {
+ id: this.params.id,
+ ...this.roleInfoData,
+ authority: auths.authority,
+ authorityAssistId: auths.authorityAssistId
+ };
+
+ if (this.params.id === 0) {
+ delete params.id;
+ }
+ if (this.params?.type === 'freight') {
+ Object.assign(params, { enterpriseId: 0, enterpriseProjectId: 0 });
+ }
+ this.loadingInfo = true;
+ this.service.request(this.params.updateUrl, params).subscribe(
+ res => {
+ if (res) {
+ this.service.msgSrv.success('编辑成功');
+ this.modal.close(true);
+ }
+ this.loadingInfo = false;
+ },
+ _ => (this.loadingInfo = false),
+ () => (this.loadingInfo = false)
+ );
+ }
+}
diff --git a/src/app/routes/sys-setting/components/organization-management/organization-management.component.html b/src/app/routes/sys-setting/components/organization-management/organization-management.component.html
new file mode 100644
index 00000000..530cdc09
--- /dev/null
+++ b/src/app/routes/sys-setting/components/organization-management/organization-management.component.html
@@ -0,0 +1,51 @@
+
+ [nzCheckedKeys]="defaultCheckedKeys" [nzExpandedKeys]="defaultExpandedKeys" style="max-height: 600px;
+ overflow: auto;">
diff --git a/src/app/routes/sys-setting/components/role-management/menu/menu.component.ts b/src/app/routes/sys-setting/components/role-management/menu/menu.component.ts
index 4f6c67a5..85c11d0c 100644
--- a/src/app/routes/sys-setting/components/role-management/menu/menu.component.ts
+++ b/src/app/routes/sys-setting/components/role-management/menu/menu.component.ts
@@ -57,15 +57,15 @@ export class SettingMenuComponent implements OnInit, OnChanges {
});
}
addAuthority(origin: { id: any; all: any }, node: { buttonInfoList: any[] }, item?: { checked: any; functionButtonId: any }) {
- console.log(origin,node);
-
+ console.log(origin, node);
+
if (this.authority?.length && this.authority.filter(authItem => authItem.authorityId === origin.id).length) {
// 判断此菜单权限是否已经存在权限列表中
// 当前操作菜单id存在权限列表里
this.authority.forEach(menuItem => {
console.log(menuItem);
console.log(item);
-
+
if (menuItem.authorityId === origin.id) {
menuItem.buttonAuthorityIds = menuItem.buttonAuthorityIds || []; // 防止属性不存在,给属性指定数据类型
if (item) {
@@ -253,12 +253,13 @@ export class SettingMenuComponent implements OnInit, OnChanges {
const halfCheckedNode: any = this.nzTreeComponent.getHalfCheckedNodeList();
this.authorityAssistId = [];
halfCheckedNode.forEach((item: { key: any }) => {
- authorityMenu.push({ authorityId: item.key });
+ authorityMenu.push({ authorityId: item.key, isUpdateAuthority: 0 });
tempAuthorityIdDTOListMenu.push(item.key);
});
this.overWashTree(checkedNode, tempAuthorityIdDTOListMenu, authorityMenu);
if (this.authority && this.authority.length) {
this.authority.forEach(item => {
+ item.isUpdateAuthority = 1;
if (tempAuthorityIdDTOListMenu.indexOf(item.authorityId) !== -1) {
tempAuthorityIdDTOListMenu.forEach((oldItem, oldIndex) => {
if (oldItem === item.authorityId) {
@@ -318,7 +319,7 @@ export class SettingMenuComponent implements OnInit, OnChanges {
origin.buttonInfoList = res;
origin.all = false;
console.log(origin);
-
+
// 判断此菜单下是否已有此按钮权限
this.againGetBtn(id, origin);
}
diff --git a/src/app/routes/sys-setting/services/system.service.ts b/src/app/routes/sys-setting/services/system.service.ts
index 33c7f6e6..85a266fe 100644
--- a/src/app/routes/sys-setting/services/system.service.ts
+++ b/src/app/routes/sys-setting/services/system.service.ts
@@ -8,6 +8,7 @@
*/
import { Injectable, Injector } from '@angular/core';
import { BaseService } from 'src/app/shared/services';
+import { TreeNodeInterface } from '../../menu-manager/services/menu-manager.service';
@Injectable({
providedIn: 'root'
@@ -45,6 +46,9 @@ export class SystemService extends BaseService {
// 获取角色列表
$api_getAppRoleList = '/api/mdc/cuc/roleInfo/getRoleList';
+ // 获取组织角色树列表
+ $api_get_organization_role_list = '/api/mdc/cuc/roleInfo/getOrganizationRoleList';
+
// 查询字典选项列表
$api_get_dict_page = '/api/mdc/pbc/dictItems/list/page';
// 根据id批量删除字典选项
@@ -191,4 +195,49 @@ export class SystemService extends BaseService {
constructor(public injector: Injector) {
super(injector);
}
+
+ collapse(array: TreeNodeInterface[], data: TreeNodeInterface, $event: boolean): void {
+ if (!$event) {
+ if (data.children) {
+ data.children.forEach(d => {
+ const target = array.find(a => a.key === d.key)!;
+ target.expand = false;
+ this.collapse(array, target, false);
+ });
+ } else {
+ return;
+ }
+ }
+ }
+
+ convertTreeToList(root: TreeNodeInterface): TreeNodeInterface[] {
+ const stack: TreeNodeInterface[] = [];
+ const array: TreeNodeInterface[] = [];
+ const hashMap = {};
+ stack.push({ ...root, level: 0, expand: true });
+
+ while (stack.length !== 0) {
+ const node = stack.pop()!;
+ this.visitNode(node, hashMap, array);
+ if (node.children) {
+ for (let i = node.children.length - 1; i >= 0; i--) {
+ stack.push({
+ ...node.children[i],
+ level: node.level! + 1,
+ expand: false,
+ parent: node
+ });
+ }
+ }
+ }
+
+ return array;
+ }
+
+ visitNode(node: TreeNodeInterface, hashMap: { [key: string]: boolean }, array: TreeNodeInterface[]): void {
+ if (!hashMap[node.key]) {
+ hashMap[node.key] = true;
+ array.push(node);
+ }
+ }
}
diff --git a/src/app/routes/sys-setting/sys-setting-routing.module.ts b/src/app/routes/sys-setting/sys-setting-routing.module.ts
index f0670f64..ea5ae5c4 100644
--- a/src/app/routes/sys-setting/sys-setting-routing.module.ts
+++ b/src/app/routes/sys-setting/sys-setting-routing.module.ts
@@ -26,11 +26,13 @@ import { InsuranceSetComponent } from './components/insurance-set/insurance-set.
import { NetworkFreightNewComponent } from './components/network-freight/new/new.component';
import { NoTeManagementComponent } from './components/note-management/note-management.component';
import { SmsTemplateComponent } from './components/sms-template/sms-template.component';
+import { OrganizationManagementComponent } from './components/organization-management/organization-management.component';
const routes: Routes = [
{ path: 'staff-management', component: StaffManagementComponent },
{ path: 'role-management/user/:type', component: RoleManagementComponent },
{ path: 'role-management/freight/:type', component: RoleManagementComponent },
+ { path: 'organization-management', component: OrganizationManagementComponent },
{ path: 'basic-setting', component: BasicSettingComponent },
{ path: 'note-management', component: NoTeManagementComponent },
{ path: 'basic-config', component: BasicConfigComponent },
diff --git a/src/app/routes/sys-setting/sys-setting.module.ts b/src/app/routes/sys-setting/sys-setting.module.ts
index 2e1275c1..c7462e40 100644
--- a/src/app/routes/sys-setting/sys-setting.module.ts
+++ b/src/app/routes/sys-setting/sys-setting.module.ts
@@ -34,6 +34,9 @@ import { InsuranceSetComponent } from './components/insurance-set/insurance-set.
import { NetworkFreightNewComponent } from './components/network-freight/new/new.component';
import { NoTeManagementComponent } from './components/note-management/note-management.component';
import { SmsTemplateComponent } from './components/sms-template/sms-template.component';
+import { OrganizationManagementComponent } from './components/organization-management/organization-management.component';
+import { OrganizationModalComponent } from './components/organization-management/organization-modal/organization-modal.component';
+import { ApiAuthModalComponent } from './components/organization-management/api-auth-modal/api-auth-modal.component';
const COMPONENTS = [
StaffManagementComponent,
@@ -52,7 +55,8 @@ const COMPONENTS = [
AnnouncementMessageComponent,
InsuranceSetComponent,
NoTeManagementComponent,
- SmsTemplateComponent
+ SmsTemplateComponent,
+ OrganizationManagementComponent
];
const NOTROUTECOMPONENTS = [
BuyerTranspowerComponent,
@@ -61,10 +65,11 @@ const NOTROUTECOMPONENTS = [
AuditResonConfigActionModalComponent,
CartConfigActionModalComponent,
SettingRoleEditComponent,
- SettingMenuComponent
+ SettingMenuComponent,
+ OrganizationModalComponent
];
@NgModule({
- declarations: [...COMPONENTS, ...NOTROUTECOMPONENTS],
+ declarations: [...COMPONENTS, ...NOTROUTECOMPONENTS, ApiAuthModalComponent],
imports: [CommonModule, SysSettingRoutingModule, SharedModule, DynamicSettingModule]
})
export class SysSettingModule {}