This commit is contained in:
Taric Xin
2022-01-04 18:00:50 +08:00
parent 94536ab262
commit ae2bde8d33
8 changed files with 267 additions and 74 deletions

View File

@ -62,7 +62,7 @@ export class BusinessInterceptor implements HttpInterceptor {
const header: any = {
appId: this.envSrv.env.appId,
tenantId: this.envSrv.env.tenantId,
enterpriseId: '0',
enterpriseId: this.envSrv.env.enterpriseId,
...position
};

View File

@ -1,8 +1,10 @@
import { HttpClient } from '@angular/common/http';
import { Inject, Injectable } from '@angular/core';
import { cacheConf } from '@conf/cache.conf';
import { sysConf } from '@conf/sys.conf';
import { ACLService } from '@delon/acl';
import { MenuService, SettingsService, TitleService, _HttpClient } from '@delon/theme';
import { AmapService, EAUserService } from '@shared';
import { AmapService, EACacheService, EAUserService } from '@shared';
import { NzSafeAny } from 'ng-zorro-antd/core/types';
import { NzIconService } from 'ng-zorro-antd/icon';
import { Observable, zip } from 'rxjs';
@ -27,6 +29,7 @@ export class StartupService {
private httpClient: _HttpClient,
private userSrv: EAUserService,
private amapService: AmapService,
public cacheSrv: EACacheService,
private coreSrv: CoreService
) {
iconSrv.addIcon(...ICONS_AUTO, ...ICONS);
@ -83,6 +86,11 @@ export class StartupService {
this.settingService.setApp(appData);
// 用户信息:包括姓名、头像、邮箱地址
this.settingService.setUser(userData);
this.cacheSrv.set(cacheConf.env, {
appId: sysConf.appId,
tenantId: userData?.tenantId || sysConf.tenantId,
enterpriseId: userData?.enterpriseId || sysConf.enterpriseId
});
// ACL设置权限为全量
this.aclService.setFull(true);
// 初始化菜单

View File

@ -0,0 +1,166 @@
<nz-card>
<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)"
*ngFor="let item of tabs; let idx = index">
{{ item.name }}
</li>
</ul>
</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>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="100">
<se label="提现审核">
<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 label="审核时间" style="margin-bottom: 0;">
<nz-radio-group [(ngModel)]="formDate.isEveryDay">
<label nz-radio [nzValue]="false" class="ml-xl block-radio">全天</label>
<label nz-radio [nzValue]="true" class="ml-xl block-radio">自定义</label>
</nz-radio-group>
</se>
<se [col]="1">
<nz-radio-group [(ngModel)]="formDate.isEveryWeek">
<label nz-radio [nzValue]="false" class="ml-xxl block-radio">
<div class="d-flex">
每天
<div class="ml-md" style="cursor:default">
<p style="color: #1890ff;cursor: pointer;">添加时间段</p>
<div class="mb-md">
<nz-time-picker nzFormat="HH:mm" nzPlaceHolder="开始时间"></nz-time-picker>
--
<nz-time-picker nzFormat="HH:mm" nzPlaceHolder="结束时间"></nz-time-picker>
<label style="color: #1890ff;cursor: pointer;" class="ml-md">删除</label>
</div>
</div>
</div>
</label>
<label nz-radio [nzValue]="true" class="ml-xxl block-radio mt-md">
<div class="d-flex">
每周
<div class="ml-md" style="cursor:default">
<p style="color: #1890ff;cursor: pointer;">添加星期</p>
<div class="mb-md">
<nz-checkbox-group [(ngModel)]="checkOptionsOne"></nz-checkbox-group>
</div>
<div>
<div class="mb-md">
<nz-time-picker nzFormat="HH:mm" nzPlaceHolder="开始时间">
</nz-time-picker>
--
<nz-time-picker nzFormat="HH:mm" nzPlaceHolder="结束时间">
</nz-time-picker>
<label style="color: #1890ff;cursor: pointer;"
class="ml-md">删除</label>
</div>
<p style="color: #1890ff;cursor: pointer;"> 添加时间段</p>
</div>
</div>
</div>
</label>
</nz-radio-group>
</se>
<se label="提现限额">
<div class="d-flex align-items-center ml-xl mb-md">
<label nz-checkbox>每日最多可提现</label>
<nz-input-group nzAddOnAfter="元" style="width: 150px;">
<input type="number" nz-input placeholder="请输入" />
</nz-input-group>
</div>
<div class="d-flex align-items-center ml-xl">
<label nz-checkbox>每月最多可提现</label>
<nz-input-group nzAddOnAfter="元" style="width: 150px;">
<input type="number" nz-input placeholder="请输入" />
</nz-input-group>
</div>
</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>
</div>
</div>
</div>
</nz-card>

View File

@ -13,73 +13,24 @@
<nz-card class="card-height" [nzBordered]="null" nzSize="small" *ngIf="selectedTab===0 || selectedTab===1">
<h2 style="font-weight: 800;">货主提现设置</h2>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="100">
<se label="提现审核">
<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 label="审核时间" style="margin-bottom: 0;">
<nz-radio-group [(ngModel)]="formDate.isEveryDay">
<label nz-radio [nzValue]="false" class="ml-xl block-radio">全天</label>
<label nz-radio [nzValue]="true" class="ml-xl block-radio">自定义</label>
</nz-radio-group>
</se>
<se [col]="1">
<nz-radio-group [(ngModel)]="formDate.isEveryWeek">
<label nz-radio [nzValue]="false" class="ml-xxl block-radio">
<div class="d-flex">
每天
<div class="ml-md" style="cursor:default">
<p style="color: #1890ff;cursor: pointer;">添加时间段</p>
<div class="mb-md">
<nz-time-picker nzFormat="HH:mm" nzPlaceHolder="开始时间"></nz-time-picker>
--
<nz-time-picker nzFormat="HH:mm" nzPlaceHolder="结束时间"></nz-time-picker>
<label style="color: #1890ff;cursor: pointer;" class="ml-md">删除</label>
</div>
</div>
</div>
</label>
<label nz-radio [nzValue]="true" class="ml-xxl block-radio mt-md">
<div class="d-flex">
每周
<div class="ml-md" style="cursor:default">
<p style="color: #1890ff;cursor: pointer;">添加星期</p>
<div class="mb-md">
<nz-checkbox-group [(ngModel)]="checkOptionsOne"></nz-checkbox-group>
</div>
<div>
<div class="mb-md">
<nz-time-picker nzFormat="HH:mm" nzPlaceHolder="开始时间">
</nz-time-picker>
--
<nz-time-picker nzFormat="HH:mm" nzPlaceHolder="结束时间">
</nz-time-picker>
<label style="color: #1890ff;cursor: pointer;"
class="ml-md">删除</label>
</div>
<p style="color: #1890ff;cursor: pointer;"> 添加时间段</p>
</div>
</div>
</div>
</label>
</nz-radio-group>
</se>
<se label="提现限额">
<div class="d-flex align-items-center ml-xl mb-md">
<label nz-checkbox>每日最多可提现</label>
<nz-input-group nzAddOnAfter="元" style="width: 150px;">
<input type="number" nz-input placeholder="请输入" />
</nz-input-group>
</div>
<div class="d-flex align-items-center ml-xl">
<label nz-checkbox>每月最多可提现</label>
<nz-input-group nzAddOnAfter="元" style="width: 150px;">
<input type="number" nz-input placeholder="请输入" />
</nz-input-group>
</div>
<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="请输入" />
</nz-input-group>
</ng-container>
</ng-container>
</se>
</div>
</div>

View File

@ -39,13 +39,71 @@ export class BasicSettingComponent implements OnInit {
{ 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: ''
}
];
constructor(private service: SystemService) {}
ngOnInit() {}
ngOnInit() {
this.configList = this.configList.map((item: any) => ({ ...item, itemValue: JSON.parse(item.itemValue) }));
}
changeType(type: number): void {
this.selectedTab = type;
console.log(type);
}
}

View File

@ -5,7 +5,7 @@ import { BaseService } from '../core/base.service';
import { EACacheService } from './../core/cache.service';
@Injectable({
providedIn: 'root',
providedIn: 'root'
})
export class EAEnvironmentService extends BaseService {
constructor(public injector: Injector, private eaCacheSrv: EACacheService) {
@ -15,12 +15,13 @@ export class EAEnvironmentService extends BaseService {
/**
* 环境信息
*/
public get env(): { appId: string; tenantId: string } {
public get env(): { appId: string; tenantId: string; enterpriseId: string } {
const cacheEnv: any = this.eaCacheSrv.get(cacheConf.env);
// 附加环境变量
const env: { appId: string; tenantId: string } = {
const env: { appId: string; tenantId: string; enterpriseId: string } = {
appId: cacheEnv?.appId || sysConf.appId,
tenantId: cacheEnv?.tenantId || sysConf.tenantId,
enterpriseId: cacheEnv?.enterpriseId || sysConf.enterpriseId
};
return env;
}

View File

@ -135,6 +135,11 @@ export class EAUserService extends BaseService {
*/
async loadUserInfo() {
return this.asyncRequest(this.$api_get_user_by_token).then(res => {
this.cacheSrv.set(cacheConf.env, {
appId: sysConf.appId,
tenantId: res?.tenantId || sysConf.tenantId,
enterpriseId: res?.enterpriseId || sysConf.enterpriseId
});
this.cacheSrv.set(cacheConf.user, res);
this.settings.setUser(res);
});

View File

@ -12,6 +12,10 @@ export const sysConf = {
* 租户ID
*/
tenantId: `1`,
/**
* 企业ID
*/
enterpriseId: `0`,
/**
* 登录路径
*/