diff --git a/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.html b/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.html index d3dff03e..2ad5c2df 100644 --- a/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.html +++ b/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.html @@ -16,8 +16,41 @@ +
+ + +
+ 已选择 + {{ selectedRows.length }} 条数据 + 清空 +
+
+ [scroll]="{ x: '1200px' }" [loading]="service.http.loading" (change)="stChange($event)"> -
\ No newline at end of file + + + +
+
+ + + + + +
+
+
+ + +
+
+ + + + + +
+
+
\ No newline at end of file diff --git a/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.ts b/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.ts index a53238ae..b04ece6a 100644 --- a/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.ts +++ b/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; -import { STColumn, STComponent, STRequestOptions, STData } from '@delon/abc/st'; +import { STColumn, STComponent, STRequestOptions, STData, STChange } from '@delon/abc/st'; import { SFUISchema, SFSchema, SFComponent } from '@delon/form'; import { ShipperBaseService, DynamicSettingModalComponent } from '@shared'; import { NzModalService } from 'ng-zorro-antd/modal'; @@ -18,10 +18,22 @@ export class FreightConfigComponent implements OnInit { @ViewChild('st', { static: false }) st!: STComponent; @ViewChild('sf', { static: false }) sf!: SFComponent; + selectedRows: any[] = []; + + @ViewChild('IWModal', { static: false }) + IWModal!: any; + @ViewChild('roleModal', { static: false }) + roleModal!: any; + ltdId: any = []; + roles: any = []; + networkTransporter = null; + roleId = null; constructor(public service: UsermanageService, private modal: NzModalService, public shipperservice: ShipperBaseService) {} ngOnInit() { this.initST(); + this.loadltdId(); + this.loadRoles(); } beforeReq = (requestOptions: STRequestOptions) => { @@ -34,6 +46,14 @@ export class FreightConfigComponent implements OnInit { return requestOptions; }; + stChange(e: STChange): void { + switch (e.type) { + case 'checkbox': + this.selectedRows = e.checkbox!; + break; + } + } + settingAction(item?: any) { const modal = this.modal.create({ nzTitle: '配置', @@ -44,20 +64,20 @@ export class FreightConfigComponent implements OnInit { businessId: item.id, formatTypeList: (item: any[]) => [ ...item, - // { - // name: '权限配置', - // items: [ - // { - // configType: 1, - // itemType: 999 - // } - // ] - // }, { - name: '费率变更记录', + name: '权限配置', + configType: 1, + items: [ + { + itemType: 999 + } + ] + }, + { + name: '费率变更记录', + configType: 2, items: [ { - configType: 2, itemType: 999 } ] @@ -73,6 +93,68 @@ export class FreightConfigComponent implements OnInit { }); } + editRoleBatch() { + if (this.selectedRows?.length <= 0) { + this.service.msgSrv.warning('请选择企业'); + return; + } + this.roleId = null; + const modal = this.modal.create({ + nzTitle: '修改角色', + nzContent: this.roleModal, + nzOnOk: () => { + if (!this.roleId) { + return false; + } + this.service + .request(this.service.$api_update_enter_role_batch, { + enterpriseIdList: this.selectedRows.map(i => i.id), + roleId: this.roleId + }) + .subscribe((res: Array) => { + if (res) { + this.service.msgSrv.success('修改成功'); + this.st.load(1); + modal.destroy(); + } + }); + return false; + } + }); + } + + editIWBatch() { + if (this.selectedRows?.length <= 0) { + this.service.msgSrv.warning('请选择企业'); + return; + } + this.networkTransporter = null; + const modal = this.modal.create({ + nzTitle: '修改网络货运人', + nzContent: this.IWModal, + nzOnOk: () => { + if (!this.networkTransporter) { + return false; + } + this.service + .request(this.service.$api_update_enter_newowork_batch, { + enterpriseIdList: this.selectedRows.map(i => i.id), + networkTransporterId: this.networkTransporter + }) + .subscribe((res: Array) => { + if (res && res.length === 0) { + this.service.msgSrv.success('修改成功'); + this.st.load(1); + modal.destroy(); + } else { + this.service.msgSrv.error(`企业${res?.join(',')}修改失败`); + } + }); + return false; + } + }); + } + exportList() { const params = {}; if (this.sf) { @@ -83,6 +165,21 @@ export class FreightConfigComponent implements OnInit { this.service.downloadFile(this.service.$api_export_enterprise, params); } + loadltdId() { + this.service.getNetworkFreightForwarder().subscribe(res => { + if (res) { + this.ltdId = res; + } + }); + } + loadRoles() { + this.service.getRoles({ enterpriseId: 0, projectId: 0 }).subscribe(res => { + if (res) { + this.roles = res; + } + }); + } + /** * 重置表单 */ @@ -118,6 +215,7 @@ export class FreightConfigComponent implements OnInit { initST(): STColumn[] { return [ + { title: '', index: 'key', type: 'checkbox' }, { title: '企业名称', className: 'text-center', index: 'enterpriseName', width: 350 }, { title: '网络货运人', className: 'text-center', index: 'netTranName', width: 160 }, { diff --git a/src/app/routes/usercenter/services/usercenter.service.ts b/src/app/routes/usercenter/services/usercenter.service.ts index c42a9b3d..10477a2e 100644 --- a/src/app/routes/usercenter/services/usercenter.service.ts +++ b/src/app/routes/usercenter/services/usercenter.service.ts @@ -37,6 +37,10 @@ export class UsermanageService extends ShipperBaseService { // 查询货主配置列表 $api_freight_config_page = '/api/mdc/cuc/enterpriseInfo/operate/list/configPage'; + // 更新企业超级管理员权限 + $api_update_enter_role_batch = '/api/mdc/cuc/enterpriseInfo/operate/updateRole'; + // 批量更新企业网络货运人 + $api_update_enter_newowork_batch = '/api/mdc/cuc/enterpriseInfo/operate/updatnNetworkTransporter'; // 货主员工列表(运营后台) $api_get_user_list = '/api/mdc/cuc/userApp/getShipperUserList'; diff --git a/src/app/shared/components/dynamic-setting/dynamic-setting-modal/dynamic-setting-modal.component.html b/src/app/shared/components/dynamic-setting/dynamic-setting-modal/dynamic-setting-modal.component.html index aeb51322..fa61e170 100644 --- a/src/app/shared/components/dynamic-setting/dynamic-setting-modal/dynamic-setting-modal.component.html +++ b/src/app/shared/components/dynamic-setting/dynamic-setting-modal/dynamic-setting-modal.component.html @@ -3,14 +3,13 @@ - 权限配置 + - - + + - \ No newline at end of file diff --git a/src/app/shared/components/dynamic-setting/dynamic-setting.module.ts b/src/app/shared/components/dynamic-setting/dynamic-setting.module.ts index 8e06b85a..3e160194 100644 --- a/src/app/shared/components/dynamic-setting/dynamic-setting.module.ts +++ b/src/app/shared/components/dynamic-setting/dynamic-setting.module.ts @@ -20,7 +20,14 @@ import { SEModule } from '@delon/abc/se'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { RateChangeComponent } from './rate-change/rate-change.component'; import { STModule } from '@delon/abc/st'; -const COMPONENTS = [DynamicSettingH5Component, DynamicSettingModalComponent, FreightTableComponent, RateChangeComponent]; +import { EnterAuthComponent } from './enter-auth/enter-auth.component'; +const COMPONENTS = [ + DynamicSettingH5Component, + DynamicSettingModalComponent, + FreightTableComponent, + RateChangeComponent, + EnterAuthComponent +]; @NgModule({ declarations: [...COMPONENTS], imports: [CommonModule, FormsModule, SHARED_ZORRO_MODULES, SEModule, STModule], diff --git a/src/app/shared/components/dynamic-setting/enter-auth/enter-auth.component.html b/src/app/shared/components/dynamic-setting/enter-auth/enter-auth.component.html new file mode 100644 index 00000000..34b407d3 --- /dev/null +++ b/src/app/shared/components/dynamic-setting/enter-auth/enter-auth.component.html @@ -0,0 +1,15 @@ +
+
+ + + + + +
+
+
+
+ +
+
\ No newline at end of file diff --git a/src/app/shared/components/dynamic-setting/enter-auth/enter-auth.component.ts b/src/app/shared/components/dynamic-setting/enter-auth/enter-auth.component.ts new file mode 100644 index 00000000..3abd1598 --- /dev/null +++ b/src/app/shared/components/dynamic-setting/enter-auth/enter-auth.component.ts @@ -0,0 +1,52 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { NzModalRef } from 'ng-zorro-antd/modal'; +import { ShipperBaseService } from 'src/app/shared/services/business/shipper-base.service'; + +@Component({ + selector: 'app-enter-auth', + templateUrl: './enter-auth.component.html' +}) +export class EnterAuthComponent implements OnInit { + @Input() + enterpriseId = ''; + @Input() + roleId = ''; + + roles: any[] = []; + + constructor(private service: ShipperBaseService, private modalHelp: NzModalRef) { + this.loadRoles(); + } + + ngOnInit(): void { + console.log(this.enterpriseId); + + this.loadEnterRole(); + } + + loadEnterRole() { + this.service.request('/api/mdc/cuc/enterpriseInfo/operate/getRole', { enterpriseId: this.enterpriseId }).subscribe(res => { + if (res) { + this.roleId = res.roleId; + } + }); + } + loadRoles() { + this.service.getRoles({ enterpriseId: 0, projectId: 0 }).subscribe(res => { + if (res) { + this.roles = res; + } + }); + } + + saveAction() { + this.service + .request('/api/mdc/cuc/enterpriseInfo/operate/updateRole', { enterpriseIdList: [this.enterpriseId], roleId: this.roleId }) + .subscribe(res => { + if (res) { + this.service.msgSrv.success('修改成功'); + this.modalHelp.destroy(true); + } + }); + } +}