This commit is contained in:
Taric Xin
2022-01-05 14:11:29 +08:00
parent ae2bde8d33
commit 9e129f9a3f
4 changed files with 114 additions and 181 deletions

View File

@ -2,7 +2,7 @@
<div nz-row [nzGutter]="8">
<div nz-col nzSpan="4">
<ul nz-menu nzMode="inline" class="card-height">
<li nz-menu-item [nzSelected]="idx === 0" (click)="changeType(idx)"
<li nz-menu-item [nzSelected]="idx === 0" (click)="changeType(item)"
*ngFor="let item of tabs; let idx = index">
{{ item.name }}
</li>
@ -10,107 +10,67 @@
</div>
<div nz-col nzSpan="20" style="overflow: scroll">
<nz-card class="card-height" [nzBordered]="null" nzSize="small" *ngIf="selectedTab===0 || selectedTab===1">
<h2 style="font-weight: 800;">货主提现设置</h2>
<nz-card class="card-height" [nzBordered]="null" nzSize="small">
<h2 style="font-weight: 800;">{{selectedTab?.name}}</h2>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="250">
<se [label]="item.name" *ngFor="let item of configList">
<ng-container [ngSwitch]="item.itemValue?.type">
<ng-container *ngSwitchCase="'radio'">
<nz-radio-group [(ngModel)]="item.itemValue.data">
<label nz-radio [nzValue]="false"
class="ml-xl">{{item.itemValue.falseLable}}</label>
<label nz-radio [nzValue]="true"
class="ml-xl">{{item.itemValue.trueLable}}</label>
</nz-radio-group>
</ng-container>
<ng-container *ngSwitchCase="'input'">
<nz-input-group [nzAddOnAfter]="item.itemValue.afterLable" style="width: 150px;" class="ml-md">
<input type="number" nz-input [(ngModel)]="item.itemValue.data"
placeholder="请输入" />
<se [label]="item.name" *ngFor="let item of configList" col="1">
<ng-container [ngSwitch]="item.itemType">
<ng-container *ngSwitchCase="1">
<nz-input-group [nzAddOnAfter]="item.remark?.afterLable" style="width: 155px;"
class="ml-md mr-xl">
<input type="number" nz-input [(ngModel)]="item.itemValue" placeholder="请输入" />
</nz-input-group>
</ng-container>
<ng-container *ngSwitchCase="2">
<nz-radio-group [(ngModel)]="item.itemValue" class="mr-xl">
<label nz-radio nzValue="0" class="ml-xl">{{item.remark?.[0] || '否'}}</label>
<label nz-radio nzValue="1" class="ml-xl">{{item.remark?.[1] || '是'}}</label>
</nz-radio-group>
</ng-container>
<ng-container *ngSwitchCase="3">
<nz-time-picker nzFormat="HH:mm" nzPlaceHolder="请选择时间" [(ngModel)]="item.itemValue"
class="ml-md mr-xl">
</nz-time-picker>
</ng-container>
<ng-container *ngSwitchCase="5">
<input type="time" [(ngModel)]="item.itemValue.startTime" placeHolder="开始时间"
style="margin-left: 23px;">
<!-- <nz-time-picker nzFormat="HH:mm" nzPlaceHolder="开始时间"
[(ngModel)]="item.itemValue.startTime" style="margin-left: 23px;">
</nz-time-picker> -->
--
<input type="time" [(ngModel)]="item.itemValue.endTime" placeHolder="结束时间"
style="margin-left: 23px;" class=" mr-xl">
<!-- <nz-time-picker nzFormat="HH:mm" nzPlaceHolder="结束时间"
[(ngModel)]="item.itemValue.endTime">
</nz-time-picker> -->
</ng-container>
</ng-container>
<ng-container [ngSwitch]="item.extendType">
<ng-container *ngSwitchCase="1">
<button nz-button nzType="default">添加网络货运</button>
</ng-container>
<ng-container *ngSwitchCase="2">
<button nz-button nzType="default">添加货主</button>
</ng-container>
<ng-container *ngSwitchCase="3">
<button nz-button nzType="default">添加司机</button>
</ng-container>
<ng-container *ngSwitchCase="4">
<button nz-button nzType="default">添加车队长</button>
</ng-container>
<ng-container *ngSwitchDefault></ng-container>
</ng-container>
</se>
</div>
</div>
</nz-card>
<nz-card class="card-height" [nzBordered]="null" nzSize="small" *ngIf="selectedTab===2">
<h2 style="font-weight: 800;">路桥发票设置</h2>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="100">
<se label="发票申请" style="margin-bottom: 0;">
<nz-radio-group [(ngModel)]="formDate.isAudit">
<label nz-radio [nzValue]="false" class="ml-xl">手动申请</label>
<label nz-radio [nzValue]="true" class="ml-xl">自动申请</label>
</nz-radio-group>
</se>
<se>
<p class="ml-xl" style="color: #7e7c7c;">开启自动申请后运单完成卸货后会自动根据运单信息申请ETC发票。</p>
</se>
</div>
</div>
</nz-card>
<nz-card class="card-height" [nzBordered]="null" nzSize="small" *ngIf="selectedTab===3">
<h2 style="font-weight: 800;">风险单监控</h2>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="180">
<se [col]="1" label="早/晚于计划出发时间" style="margin-bottom: 8px;">
<nz-radio-group [(ngModel)]="formDate.isAudit">
<label nz-radio [nzValue]="false" class="ml-xl mt-sm">不限定</label>
<label nz-radio [nzValue]="true" class="ml-xl mt-sm">范围外报异常</label>
</nz-radio-group>
<nz-input-group nzAddOnAfter="小时" style="width: 200px;">
<input type="number" nz-input placeholder="请输入允许时间差" />
</nz-input-group>
</se>
<se [col]="1">
<p class="ml-xl" style="color: #7e7c7c;">当前时间与计划时间对比,允许如上合理范围内执行不报异常,差异在范围外则报异常</p>
</se>
<se [col]="1" label="早/晚于计划到达时间" style="margin-bottom: 8px;">
<nz-radio-group [(ngModel)]="formDate.isAudit">
<label nz-radio [nzValue]="false" class="ml-xl mt-sm">不限定</label>
<label nz-radio [nzValue]="true" class="ml-xl mt-sm">范围外报异常</label>
</nz-radio-group>
<nz-input-group nzAddOnAfter="小时" style="width: 200px;">
<input type="number" nz-input placeholder="请输入允许时间差" />
</nz-input-group>
</se>
<se [col]="1">
<p class="ml-xl" style="color: #7e7c7c;">当前时间与计划时间对比,允许如上合理范围内执行不报异常,差异在范围外则报异常</p>
</se>
<se [col]="1" label="损耗量" style="margin-bottom: 8px;">
<nz-radio-group [(ngModel)]="formDate.isAudit">
<label nz-radio [nzValue]="false" class="ml-xl mt-sm">不限定</label>
<label nz-radio [nzValue]="true" class="ml-xl mt-sm">范围外报异常</label>
</nz-radio-group>
<nz-input-group nzAddOnAfter="%" style="width: 200px;">
<input type="number" nz-input placeholder="请输入允许时间差" />
</nz-input-group>
</se>
<se [col]="1">
<p class="ml-xl" style="color: #7e7c7c;">签收量与装运量对比,允许如上合理范围内损耗不报异常,差异在范围外则报异常</p>
</se>
<se [col]="1" label="装货/卸货地距离范围" style="margin-bottom: 8px;">
<nz-radio-group [(ngModel)]="formDate.isAudit">
<label nz-radio [nzValue]="false" class="ml-xl mt-sm">不限定</label>
<label nz-radio [nzValue]="true" class="ml-xl mt-sm">范围外报异常</label>
</nz-radio-group>
<nz-input-group nzAddOnAfter="KM" style="width: 200px;">
<input type="number" nz-input placeholder="请输入允许时间差" />
</nz-input-group>
</se>
<se [col]="1">
<p class="ml-xl" style="color: #7e7c7c;">装货地和发货地、签收地和收货地距离对比,允许如上合理范围内执行不报异常,差异在范围外则报异常</p>
</se>
</div>
</div>
</nz-card>
<div class="mb-md save-btn">
<button class="ml-lg" nz-button nzSize="large" nzType="primary">保存</button>
<button class="ml-lg" nz-button nzSize="large" nzType="primary" (click)="saveAction()">保存</button>
</div>
</div>
</div>

View File

@ -11,12 +11,17 @@
.block-radio {
display : flex;
min-height : 32px;
min-height: 32px;
}
input {
width : 100px;
margin-left: 10px;
}
.ant-form-item-control-input-content {
display: flex;
}
}
}

View File

@ -1,5 +1,6 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
import { dateTimePickerUtil } from '@delon/util';
import { SystemService } from '../../services/system.service';
@Component({
@ -8,102 +9,65 @@ import { SystemService } from '../../services/system.service';
styleUrls: ['./basic-setting.component.less']
})
export class BasicSettingComponent implements OnInit {
formDate: any = {
isAudit: false,
isEveryDay: false,
isEveryWeek: false
};
tabs = [
{
name: '货主提现设置'
},
{
name: '司机提现设置'
},
{
name: '路桥发票设置'
},
{
name: '风险单监控'
}
];
selectedTab = 0;
tabs: any[] = [];
selectedTab: any = null;
checkOptionsOne = [
{ label: '周一', value: '周一', checked: true },
{ label: '周二', value: '周二' },
{ label: '周三', value: '周三' },
{ label: '周四', value: '周四' },
{ label: '周五', value: '周五' },
{ label: '周六', value: '周六' },
{ label: '周日', value: '周日' }
];
configList: any = [
{
configId: '1475393700370898945',
itemKey: 'goods.name.config.type.3.3',
itemType: 1,
itemValue: '{"data":false,"type":"radio","trueLable":"开启","falseLable":"关闭"}',
name: '货主是否可以设置车队长',
parentId: '0',
remark: ''
},
{
configId: '1475393700370898945',
itemKey: 'goods.name.config.type.3.4',
itemType: 1,
itemValue: '{"data":false,"type":"radio","trueLable":"开启","falseLable":"关闭"}',
name: '货主企业四要素校验开关',
parentId: '0',
remark: ''
},
{
configId: '1475393700370898945',
itemKey: 'goods.name.config.type.3.5',
itemType: 1,
itemValue: '{"data":false,"type":"radio","trueLable":"开启","falseLable":"关闭"}',
name: '货主提现功能开关',
parentId: '0',
remark: ''
},
{
configId: '1475393700370898945',
itemKey: 'goods.name.config.type.3.5',
itemType: 1,
itemValue: '{"data":"","type":"input","afterLable":"%"}',
name: '货主费率配置',
parentId: '0',
remark: ''
},
{
configId: '1475393700370898945',
itemKey: 'goods.name.config.type.3.5',
itemType: 1,
itemValue: '{"data":"5","type":"input","afterLable":"次"}',
name: '单个用户每天最大发送短信次数',
parentId: '0',
remark: ''
},
{
configId: '1475393700370898945',
itemKey: 'goods.name.config.type.3.5',
itemType: 1,
itemValue: '{"data":true,"type":"radio","trueLable":"开启","falseLable":"关闭","isCustom":true}',
name: '合同单权限',
parentId: '0',
remark: ''
}
];
configList: any = [];
constructor(private service: SystemService) {}
ngOnInit() {
this.configList = this.configList.map((item: any) => ({ ...item, itemValue: JSON.parse(item.itemValue) }));
this.getTypeList();
}
changeType(type: number): void {
getTypeList() {
this.service.request(this.service.$api_get_config_tree, { configFullKey: 'sys.config' }).subscribe((res: Array<any>) => {
if (res?.length > 0) {
const typeData = res.find(config => config.configFullKey === 'sys.config');
if (typeData) {
this.tabs = typeData.children;
this.selectedTab = typeData.children[0];
this.getConfigList(this.selectedTab.id);
}
}
});
}
getConfigList(id: string) {
this.service.request(this.service.$api_get_config_by_parent_id, { id }).subscribe((res: Array<any>) => {
if (res?.length > 0) {
res = res.map(item => ({
...item,
remark: item.remark ? JSON.parse(item.remark) : null,
itemValue: item.itemValue ? JSON.parse(item.itemValue) : item.itemValue
}));
this.configList = res;
console.log(res);
} else {
this.configList = [];
}
});
}
changeType(type: any): void {
this.selectedTab = type;
console.log(type);
this.getConfigList(this.selectedTab.id);
}
saveAction() {
if (this.configList?.length < 0) {
return;
}
const params = this.configList.map((item: any) => ({
...item,
remark: item.remark ? JSON.stringify(item.remark) : null,
itemValue: item.itemValue ? JSON.stringify(item.itemValue) : null
}));
this.service.request(this.service.$api_update_config_batch, params).subscribe(res => {
if (res) {
this.service.msgSrv.success('修改配置成功');
this.getConfigList(this.selectedTab.id);
}
});
}
}

View File

@ -101,6 +101,8 @@ export class SystemService extends BaseService {
// 根据FullKey获取系统子配置(树)
public $api_get_config_tree = '/api/mdc/pbc/sysConfig/getSysConfigTreeByParentFullKey';
// 查找系统配置项列表
public $api_get_config_by_parent_id = '/api/mdc/pbc/sysConfigItem/findSysConfigItemBySysConfigId';
// 新增系统配置
public $api_add_config = '/api/mdc/pbc/sysConfig/save';
// 更新系统配置
@ -115,6 +117,8 @@ export class SystemService extends BaseService {
public $api_add_config_item = '/api/mdc/pbc/sysConfigItem/save';
// 更新系统配置项
public $api_update_config_item = '/api/mdc/pbc/sysConfigItem/update';
// 批量更新系统配置项
public $api_update_config_batch = '/api/mdc/pbc/sysConfigItem/updateBatch';
// 更新系统配置项排序
public $api_update_config_item_sort = '/api/mdc/pbc/sysConfigItem/updateSort';
// 删除系统配置项