edit
This commit is contained in:
@ -16,8 +16,41 @@
|
||||
</div>
|
||||
</nz-card>
|
||||
<nz-card>
|
||||
<div class="d-flex align-items-center mb-md " style="justify-content: end;">
|
||||
<button nz-button (click)="editRoleBatch()">修改角色</button>
|
||||
<button nz-button (click)="editIWBatch()">修改网络货运人</button>
|
||||
<div class="ml-md">
|
||||
已选择
|
||||
<strong class="text-primary">{{ selectedRows.length }}</strong> 条数据
|
||||
<a *ngIf="selectedRows.length > 0" (click)="st.clearCheck()" class="ml-lg">清空</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 数据列表 -->
|
||||
<st #st [columns]="columns" [data]='service.$api_freight_config_page' [req]="{ process: beforeReq }"
|
||||
[scroll]="{ x: '1200px' }" [loading]="service.http.loading">
|
||||
[scroll]="{ x: '1200px' }" [loading]="service.http.loading" (change)="stChange($event)">
|
||||
</st>
|
||||
</nz-card>
|
||||
</nz-card>
|
||||
|
||||
<ng-template #IWModal>
|
||||
<div nz-row nzGutter="8">
|
||||
<div nz-col nzSpan="24" se-container [labelWidth]="120">
|
||||
<se [col]="1" label="网络货运人" required>
|
||||
<nz-select nzPlaceHolder="请选择" [(ngModel)]="networkTransporter">
|
||||
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of ltdId"></nz-option>
|
||||
</nz-select>
|
||||
</se>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #roleModal>
|
||||
<div nz-row nzGutter="8">
|
||||
<div nz-col nzSpan="24" se-container [labelWidth]="120">
|
||||
<se [col]="1" label="企业角色" required>
|
||||
<nz-select nzPlaceHolder="请选择" [(ngModel)]="roleId">
|
||||
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of roles"></nz-option>
|
||||
</nz-select>
|
||||
</se>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
@ -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<string>) => {
|
||||
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<string>) => {
|
||||
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 },
|
||||
{
|
||||
|
||||
@ -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';
|
||||
|
||||
Reference in New Issue
Block a user