From 2cff827e3f1d4e1812b26a283b2fb24b469a408d Mon Sep 17 00:00:00 2001 From: Taric Xin Date: Tue, 12 Apr 2022 17:06:27 +0800 Subject: [PATCH] edit --- .../contract-list.component.html | 13 ++-- .../bulk-detail/bulk-detail.component.ts | 3 +- .../vehicle-detail.component.ts | 26 +++---- src/app/shared/services/core/base.service.ts | 68 ++++++++++--------- 4 files changed, 58 insertions(+), 52 deletions(-) diff --git a/src/app/routes/contract-management/components/contract-list/contract-list.component.html b/src/app/routes/contract-management/components/contract-list/contract-list.component.html index 2c054c6a..0876e5cf 100644 --- a/src/app/routes/contract-management/components/contract-list/contract-list.component.html +++ b/src/app/routes/contract-management/components/contract-list/contract-list.component.html @@ -30,7 +30,7 @@
+ (click)="st?.load(1)" acl [acl-ability]="['CONTRACT-INDEX-searchDetail']">查询
- + - {{ item?.contractCode }} + {{ item?.contractCode }} + - - + + diff --git a/src/app/routes/order-management/components/bulk-detail/bulk-detail.component.ts b/src/app/routes/order-management/components/bulk-detail/bulk-detail.component.ts index f69ffb9d..5bd52254 100644 --- a/src/app/routes/order-management/components/bulk-detail/bulk-detail.component.ts +++ b/src/app/routes/order-management/components/bulk-detail/bulk-detail.component.ts @@ -128,7 +128,8 @@ export class OrderManagementBulkeDetailComponent implements OnInit { if(value ==='1'){ this.modalTitle = '附件信息'; // this.modalcontent = this.i?.contractContent?.contractContent; - this.service.reviewPDF(this.i?.contractContent?.contractFilePath) + // this.service.reviewPDF(this.i?.contractContent?.contractFilePath) + this.service.openURL(this.i?.contractContent?.contractFilePath); }else if(value === '2'){ this.modalTitle = '补充协议'; this.modalcontent = this.i?.supplementContent?.contractContent; diff --git a/src/app/routes/order-management/components/vehicle-detail/vehicle-detail.component.ts b/src/app/routes/order-management/components/vehicle-detail/vehicle-detail.component.ts index 099775a6..2b7a6718 100644 --- a/src/app/routes/order-management/components/vehicle-detail/vehicle-detail.component.ts +++ b/src/app/routes/order-management/components/vehicle-detail/vehicle-detail.component.ts @@ -24,7 +24,7 @@ import { OrderManagementService } from '../../services/order-management.service' export class OrderManagementVehicleDetailComponent implements OnInit { id = this.route.snapshot.params.id; modalcontent: any; - modalTitle:string = ''; + modalTitle: string = ''; trajectory = 'car'; mapList: any[] = []; //地图点位数据组 pois: any[] = []; @@ -55,7 +55,7 @@ export class OrderManagementVehicleDetailComponent implements OnInit { { title: '支付状态', className: 'text-center', - index: 'paymentStatusLabel', + index: 'paymentStatusLabel' } ]; constructor( @@ -97,15 +97,15 @@ export class OrderManagementVehicleDetailComponent implements OnInit { }); this.service.request(this.service.$api_listBillComplianceAbnormalByBillId, { id: this.id }).subscribe(res => { if (res) { - console.log('风险详情') - console.log(res) - this.abnormalList = res + console.log('风险详情'); + console.log(res); + this.abnormalList = res; } }); this.service.request(this.service.$api_getAbnormalWarningByBillId, { id: this.id }).subscribe(res => { if (res) { - console.log('异常预警') - console.log(res) + console.log('异常预警'); + console.log(res); } }); } @@ -132,15 +132,15 @@ export class OrderManagementVehicleDetailComponent implements OnInit { this.router.navigate(['order-management/vehicle-detailChange', this.id]); } agreement(value: any) { - if(value ==='1'){ - this.modalTitle = '附件信息'; - this.modalcontent = this.i?.contractContent?.contractContent; - - }else if(value === '2'){ + if (value === '1') { + // this.modalTitle = '附件信息'; + // this.modalcontent = this.i?.contractContent?.contractContent; + this.service.openURL(this.i?.contractContent?.contractFilePath); + } else if (value === '2') { this.modalTitle = '补充协议'; this.modalcontent = this.i?.supplementContent?.contractContent; + this.isVisible = true; } - this.isVisible = true; } handleCancel() { this.isVisible = false; diff --git a/src/app/shared/services/core/base.service.ts b/src/app/shared/services/core/base.service.ts index 210b97ed..d7785d97 100644 --- a/src/app/shared/services/core/base.service.ts +++ b/src/app/shared/services/core/base.service.ts @@ -34,7 +34,7 @@ import { IBase } from '../../interfaces'; import { EAFileUtil } from '../../utils'; @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class BaseService implements IBase { // 新增实例接口地址 @@ -94,7 +94,7 @@ export class BaseService implements IBase { parameter: any = {}, method: 'POST' | 'GET', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Observable { if (paramType === 'FORM') { parameter = this.getFormData(parameter); @@ -104,7 +104,7 @@ export class BaseService implements IBase { return this.http .request(method, url, { body: paramInBody ? parameter : null, - params: paramInBody ? null : parameter, + params: paramInBody ? null : parameter }) .pipe( map((res: any) => { @@ -122,7 +122,7 @@ export class BaseService implements IBase { this.msgSrv.warning(res.msg); return allowBadCode ? res : null; } - }), + }) ); } @@ -144,7 +144,7 @@ export class BaseService implements IBase { parameter: any = {}, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Observable { return this.httpRequest(url, parameter, method, paramInBody, paramType); } @@ -154,7 +154,7 @@ export class BaseService implements IBase { parameter: any = {}, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Promise { return this.request(url, parameter, method, paramInBody, paramType).toPromise(); } @@ -165,7 +165,7 @@ export class BaseService implements IBase { url: string = this.$api_add_one, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Observable { return this.request(url, parameter, method, paramInBody, paramType); } @@ -175,7 +175,7 @@ export class BaseService implements IBase { url: string = this.$api_add_one, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Promise { return this.addOne(parameter, url, method, paramInBody, paramType).toPromise(); } @@ -185,7 +185,7 @@ export class BaseService implements IBase { url: string = this.$api_add_many, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Observable { return this.request(url, parameter, method, paramInBody, paramType); } @@ -195,7 +195,7 @@ export class BaseService implements IBase { url: string = this.$api_add_many, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Promise { return this.addMany(parameter, url, method, paramInBody, paramType).toPromise(); } @@ -206,7 +206,7 @@ export class BaseService implements IBase { url: string = this.$api_del_one, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Observable { return this.request(url, parameter, method, paramInBody, paramType); } @@ -216,7 +216,7 @@ export class BaseService implements IBase { url: string = this.$api_del_one, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Promise { return this.delOne(parameter, url, method, paramInBody, paramType).toPromise(); } @@ -226,7 +226,7 @@ export class BaseService implements IBase { url: string = this.$api_del_many, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Observable { return this.request(url, parameter, method, paramInBody, paramType); } @@ -236,7 +236,7 @@ export class BaseService implements IBase { url: string = this.$api_del_many, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Promise { return this.delMany(parameter, url, method, paramInBody, paramType).toPromise(); } @@ -247,7 +247,7 @@ export class BaseService implements IBase { url: string = this.$api_edit_one, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Observable { return this.request(url, parameter, method, paramInBody, paramType); } @@ -257,7 +257,7 @@ export class BaseService implements IBase { url: string = this.$api_edit_one, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Promise { return this.updateOne(parameter, url, method, paramInBody, paramType).toPromise(); } @@ -267,7 +267,7 @@ export class BaseService implements IBase { url: string = this.$api_edit_many, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Observable { return this.request(url, parameter, method, paramInBody, paramType); } @@ -277,7 +277,7 @@ export class BaseService implements IBase { url: string = this.$api_edit_many, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Promise { return this.updateMany(parameter, url, method, paramInBody, paramType).toPromise(); } @@ -290,7 +290,7 @@ export class BaseService implements IBase { url: string = this.$api_get_one, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Observable { return this.request(url, parameter, method, paramInBody, paramType); } @@ -300,7 +300,7 @@ export class BaseService implements IBase { url: string = this.$api_get_one, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Promise { return this.getOne(parameter, url, method, paramInBody, paramType).toPromise(); } @@ -313,12 +313,12 @@ export class BaseService implements IBase { url: string = this.$api_get_many, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Observable { return this.httpRequest(url, parameter, method, paramInBody, paramType).pipe( - map((res) => { + map(res => { return (res as any[]) || []; - }), + }) ); } @@ -327,7 +327,7 @@ export class BaseService implements IBase { url: string = this.$api_get_many, method: 'POST' | 'GET' = 'POST', paramInBody: boolean = true, - paramType: 'JSON' | 'FORM' = 'JSON', + paramType: 'JSON' | 'FORM' = 'JSON' ): Promise { return this.getMany(parameter, url, method, paramInBody, paramType).toPromise(); } @@ -352,19 +352,19 @@ export class BaseService implements IBase { paramInBody: boolean = true, paramType: 'JSON' | 'FORM' = 'JSON', allowBadCode: boolean = true, - async: boolean = true, + async: boolean = true ): Observable | Promise { if (allowBadCode) { url += `?_allow_badcode=true`; } const response = this.httpRequest(url, parameter, method, paramInBody, paramType).pipe( - tap((res) => { + tap(res => { if (res.success) { this.msgSrv.success(`创建下载任务成功,请前往下载任务列表下载您的文件!`); window.open('#/download'); } return res; - }), + }) ); return async ? response.toPromise() : response; } @@ -396,11 +396,15 @@ export class BaseService implements IBase { this.msgSrv.warning(m.msg); return false; } - }), + }) ) .toPromise(); } + openURL(url: string) { + window.open(url); + } + /** * 直接下载文件 */ @@ -464,19 +468,19 @@ export class BaseService implements IBase { */ getDict(key: string): Observable { return this.http.post(this.$api_get_dict, { dict: key }).pipe( - map((res) => { + map(res => { if (res.success === true) { return res.data.map((r: any) => { return { label: r.itemValue, - value: r.itemKey, + value: r.itemKey }; }); } else { this.msgSrv.warning(`获取取字典【${key}】时发生错误:${res.msg || '未知错误!'}`); return []; } - }), + }) ); } @@ -508,7 +512,7 @@ export class BaseService implements IBase { if (paramsIndex > -1) { const paramsStr = url.substr(paramsIndex + 1); const params = paramsStr.split('&'); - const keyMap = params.find((e) => e.includes(paramName)); + const keyMap = params.find(e => e.includes(paramName)); const value = keyMap ? keyMap.split('=')[1] : ''; return value; }