This commit is contained in:
Taric Xin
2022-02-25 15:08:32 +08:00
parent ca31caa229
commit 30b24c2e7a
3 changed files with 41 additions and 34 deletions

View File

@ -3,6 +3,7 @@ import { BaseService } from '../core/base.service';
import { map } from 'rxjs/operators';
import { cacheConf } from '@conf/cache.conf';
import { EACacheService } from '..';
import { of } from 'rxjs';
@Injectable({
providedIn: 'root'
@ -19,6 +20,8 @@ export class ShipperBaseService extends BaseService {
// 根据FullKey获取系统子配置(树)
$api_getSysConfigTreeByParentFullKey = `/api/mdc/pbc/sysConfig/getSysConfigTreeByParentFullKey`;
envCache: any;
list: any[] = [];
constructor(public injector: Injector, public eaCacheSrv: EACacheService) {
super(injector);
this.envCache = this.eaCacheSrv.get(cacheConf.env);
@ -26,7 +29,7 @@ export class ShipperBaseService extends BaseService {
/**
* 获取无车承运人
* @returns
* @returns
*/
getCarlessCarrier() {
const params = {};
@ -45,22 +48,26 @@ export class ShipperBaseService extends BaseService {
* 获取所属项目
* @returns
*/
getEnterpriseProject(params?: any) {
getEnterpriseProject(params?: any) {
if (this.list.length > 0) {
return of(this.list);
}
return this.request(this.$api_get_enterprise_project, params).pipe(
map((res: any) => {
if (!res) {
return [];
}
const list = res.map(((item: any) => {
const list = res.map((item: any) => {
return {
label: item.projectName,
value: item.id
}
}))
};
});
const obj = [{ value: '', label: '全部' }];
this.list = [...obj, ...list];
return [...obj, ...list];
})
)
);
}
/**
@ -184,30 +191,30 @@ export class ShipperBaseService extends BaseService {
);
}
/**
/**
* 获取角色列表
* @returns
*/
getRoles(params = {}, containerAll = false) {
return this.request(this.$api_get_roles, params).pipe(
map((res: any) => {
if (!res) {
return [];
}
const list = res.map((item: any) => {
return {
label: item.roleName,
value: item.id
};
});
const obj = [];
if (containerAll) {
obj.push({ label: '全部', value: '' });
}
return [...obj, ...list];
})
);
}
getRoles(params = {}, containerAll = false) {
return this.request(this.$api_get_roles, params).pipe(
map((res: any) => {
if (!res) {
return [];
}
const list = res.map((item: any) => {
return {
label: item.roleName,
value: item.id
};
});
const obj = [];
if (containerAll) {
obj.push({ label: '全部', value: '' });
}
return [...obj, ...list];
})
);
}
/**
* 根据ID获取网络货运人