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/contract-management/components/contract-template-frame/contract-template-frame.component.html b/src/app/routes/contract-management/components/contract-template-frame/contract-template-frame.component.html index ff37b3f7..7246f2c3 100644 --- a/src/app/routes/contract-management/components/contract-template-frame/contract-template-frame.component.html +++ b/src/app/routes/contract-management/components/contract-template-frame/contract-template-frame.component.html @@ -75,7 +75,8 @@ [loading]="false" > - {{ item.templateName }} + {{ item.templateName }} + 货主 diff --git a/src/app/routes/contract-management/components/contract-template-partner/contract-template-partner.component.html b/src/app/routes/contract-management/components/contract-template-partner/contract-template-partner.component.html index 1ecef42c..235be94d 100644 --- a/src/app/routes/contract-management/components/contract-template-partner/contract-template-partner.component.html +++ b/src/app/routes/contract-management/components/contract-template-partner/contract-template-partner.component.html @@ -75,7 +75,8 @@ [loading]="false" > - {{ item.templateName }} + {{ item.templateName }} + diff --git a/src/app/routes/financial-management/services/freight-account.service.ts b/src/app/routes/financial-management/services/freight-account.service.ts index bbb7d5ee..bb736bb5 100644 --- a/src/app/routes/financial-management/services/freight-account.service.ts +++ b/src/app/routes/financial-management/services/freight-account.service.ts @@ -137,8 +137,6 @@ export class FreightAccountService extends ShipperBaseService { // 根据预收款ID获取核销信息明细 $api_get_advance_collection_hrxiao = '/api/fcc/ficoAhxH/getAhxHByYskblaId'; - - // 运营导出充值信息 充值记录导出 $api_get_exportPageByOperator = '/api/fcc/rechargeInfo/exportPageByOperator'; // 运营端导出交易流水明细 @@ -205,21 +203,22 @@ export class FreightAccountService extends ShipperBaseService { if (!url) { return; } - const uA = window.navigator.userAgent; // 判断浏览器内核 - const isIE = - /msie\s|trident\/|edge\//i.test(uA) && - !!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window); - const objectUrl = url; - const a = document.createElement('a'); - document.body.appendChild(a); - a.href = objectUrl; - a.download = `回单.pdf`; - if (isIE) { - // 兼容IE11无法触发下载的问题 - (navigator as any).msSaveBlob(url, a.download); - } else { - a.click(); - } - a.remove(); + this.openURL(url); + // const uA = window.navigator.userAgent; // 判断浏览器内核 + // const isIE = + // /msie\s|trident\/|edge\//i.test(uA) && + // !!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window); + // const objectUrl = url; + // const a = document.createElement('a'); + // document.body.appendChild(a); + // a.href = objectUrl; + // a.download = `回单.pdf`; + // if (isIE) { + // // 兼容IE11无法触发下载的问题 + // (navigator as any).msSaveBlob(url, a.download); + // } else { + // a.click(); + // } + // a.remove(); } } diff --git a/src/app/routes/insurance-management/services/insurance-management.service.ts b/src/app/routes/insurance-management/services/insurance-management.service.ts index a8b8b13b..0482f606 100644 --- a/src/app/routes/insurance-management/services/insurance-management.service.ts +++ b/src/app/routes/insurance-management/services/insurance-management.service.ts @@ -19,12 +19,11 @@ import { map } from 'rxjs/operators'; export class InsuranceManagementService extends ShipperBaseService { // 获取货主企业列表 public $api_enterpriceList = '/api/mdc/cuc/enterpriseInfo/operate/enterpriceList'; - // 查询保险费信息表 + // 查询保险费信息表 public $api_premiumInfo_list = '/api/sdc/premiumInfo/list/page'; - // 统计保险单状态数量 + // 统计保险单状态数量 public $api_listStatisticalStatus = '/api/sdc/premiumInfo/listStatisticalStatus'; - // 保险费公司认证 $api_get_submitAuthInfo = `/api/sdc/premiumInfo/submitAuthInfo`; // 退保费 @@ -36,24 +35,25 @@ export class InsuranceManagementService extends ShipperBaseService { if (!url) { return; } - const uA = window.navigator.userAgent; // 判断浏览器内核 - const isIE = - /msie\s|trident\/|edge\//i.test(uA) && - !!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window); - const objectUrl = url; - const a = document.createElement('a'); - document.body.appendChild(a); - console.log('5555'); - - a.href = objectUrl; - a.download = '保单.pdf'; - if (isIE) { - // 兼容IE11无法触发下载的问题 - (navigator as any).msSaveBlob(url, a.download); - } else { - a.click(); - } - a.remove(); + this.openURL(url); + // const uA = window.navigator.userAgent; // 判断浏览器内核 + // const isIE = + // /msie\s|trident\/|edge\//i.test(uA) && + // !!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window); + // const objectUrl = url; + // const a = document.createElement('a'); + // document.body.appendChild(a); + // console.log('5555'); + + // a.href = objectUrl; + // a.download = '保单.pdf'; + // if (isIE) { + // // 兼容IE11无法触发下载的问题 + // (navigator as any).msSaveBlob(url, a.download); + // } else { + // a.click(); + // } + // a.remove(); } constructor(public injector: Injector) { diff --git a/src/app/routes/order-management/components/abnormal-warning/abnormal-warning.component.ts b/src/app/routes/order-management/components/abnormal-warning/abnormal-warning.component.ts index 29a61f01..70043520 100644 --- a/src/app/routes/order-management/components/abnormal-warning/abnormal-warning.component.ts +++ b/src/app/routes/order-management/components/abnormal-warning/abnormal-warning.component.ts @@ -180,7 +180,7 @@ export class OrderManagementAbnormalWarningComponent implements OnInit { } } }, - carNos: { + carNo: { title: '车牌号', type: 'string', ui: { 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/routes/order-management/services/order-management.service.ts b/src/app/routes/order-management/services/order-management.service.ts index 364b7cae..ea53eff2 100644 --- a/src/app/routes/order-management/services/order-management.service.ts +++ b/src/app/routes/order-management/services/order-management.service.ts @@ -189,7 +189,6 @@ export class OrderManagementService extends ShipperBaseService { // 查询异常预警表 $api_get_abnormalWarning = `/api/sdc/abnormalWarning/list/page`; - // 异步导出运营后台大宗订单列表 $api_get_asyncExportBulkList = `/api/sdc/billOperate/asyncExportBulkList`; // 异步导出运营后台整车订单列表 @@ -248,21 +247,22 @@ export class OrderManagementService extends ShipperBaseService { if (!url) { return; } - const uA = window.navigator.userAgent; // 判断浏览器内核 - const isIE = - /msie\s|trident\/|edge\//i.test(uA) && - !!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window); - const objectUrl = url; - const a = document.createElement('a'); - document.body.appendChild(a); - a.href = objectUrl; - a.download = '附件.pdf'; - if (isIE) { - // 兼容IE11无法触发下载的问题 - (navigator as any).msSaveBlob(url, a.download); - } else { - a.click(); - } - a.remove(); + this.openURL(url); + // const uA = window.navigator.userAgent; // 判断浏览器内核 + // const isIE = + // /msie\s|trident\/|edge\//i.test(uA) && + // !!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window); + // const objectUrl = url; + // const a = document.createElement('a'); + // document.body.appendChild(a); + // a.href = objectUrl; + // a.download = '附件.pdf'; + // if (isIE) { + // // 兼容IE11无法触发下载的问题 + // (navigator as any).msSaveBlob(url, a.download); + // } else { + // a.click(); + // } + // a.remove(); } } diff --git a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts index 4b8b2798..5a261ff0 100644 --- a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts +++ b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts @@ -436,13 +436,13 @@ export class SupplyManagementReleasePublishComponent implements OnInit { map((res: any) => { return [...res]; }) - ) + ); }, change: (tag: any, org: any) => { - if(tag === '3'){ + if (tag === '3') { this.sf5.setValue('/insurancePremium', null); this.sf5.setValue('/insuranceRate', null); - }else { + } else { this.getInsurersPrice(tag); } } @@ -455,7 +455,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { ui: { widget: 'custom', visibleIf: { insuranceType: (value: string) => value === '0' } - } , + } }, type2: { type: 'string', @@ -468,7 +468,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { insurancePremium: { type: 'string', title: '服务包费用', - readOnly:true, + readOnly: true, ui: { visibleIf: { insuranceType: (value: string) => value !== '3' } } @@ -495,9 +495,9 @@ export class SupplyManagementReleasePublishComponent implements OnInit { widget: 'custom', visibleIf: { insuranceType: (value: string) => value === '1' } } - }, + } }, - required: [ 'insurancePremium'] + required: ['insurancePremium'] }; this.ui5 = { '*': { @@ -562,8 +562,12 @@ export class SupplyManagementReleasePublishComponent implements OnInit { receiptUserPhone: { type: 'string', title: '联系电话', + format: 'mobile', maxLength: 11, ui: { + errors: { + format: '请输入正确联系电话格式' + }, visibleIf: { receiptType: value => value === '2' } @@ -955,8 +959,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit { ...this.sf6.value, expenseDTOList: expenseList, paymentDays: this.sf7.value.paymentDays, - subtotal :this.sf7.value.subtotal, - total:this.sf7.value.total, + subtotal: this.sf7.value.subtotal, + total: this.sf7.value.total, estimatedKilometers: this.totalDistance, estimatedTravelTime: this.totalTime, insurancePackagedGoods: this.sf4.value.insurancePackagedGoods, @@ -999,42 +1003,42 @@ export class SupplyManagementReleasePublishComponent implements OnInit { nzContent: AmapPoiPickerComponent, nzWidth: 900, nzOnOk: item => { - if(item?.poi) { - const poi = item.poi; - const locList = poi.pois; - switch (type) { - case 'start': - this.startInfo[index].detailedAddress = poi.formattedAddress; - this.startInfo[index].longitude = locList[0]; - this.startInfo[index].latitude = locList[1]; - this.startInfo[index].province = poi.addressComponent.province; - this.startInfo[index].city = poi.addressComponent.city; - this.startInfo[index].area = poi.addressComponent.district; - break; - case 'end': - this.endInfo[index].detailedAddress = poi.formattedAddress; - this.endInfo[index].longitude = locList[0]; - this.endInfo[index].latitude = locList[1]; - this.endInfo[index].province = poi.addressComponent.province; - this.endInfo[index].city = poi.addressComponent.city; - this.endInfo[index].area = poi.addressComponent.district; - break; - default: - break; + if (item?.poi) { + const poi = item.poi; + const locList = poi.pois; + switch (type) { + case 'start': + this.startInfo[index].detailedAddress = poi.formattedAddress; + this.startInfo[index].longitude = locList[0]; + this.startInfo[index].latitude = locList[1]; + this.startInfo[index].province = poi.addressComponent.province; + this.startInfo[index].city = poi.addressComponent.city; + this.startInfo[index].area = poi.addressComponent.district; + break; + case 'end': + this.endInfo[index].detailedAddress = poi.formattedAddress; + this.endInfo[index].longitude = locList[0]; + this.endInfo[index].latitude = locList[1]; + this.endInfo[index].province = poi.addressComponent.province; + this.endInfo[index].city = poi.addressComponent.city; + this.endInfo[index].area = poi.addressComponent.district; + break; + default: + break; + } + // 计算里程,时间 + if (this.startInfo[0]?.detailedAddress && this.endInfo[0]?.detailedAddress) { + this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => { + this.totalDistance = res.distance; + this.totalTime = res.time; + this.getInsurersPrice(); // 计算保费金额 + }); + } + return true; + } else { + this.service.msgSrv.warning('请重新手动选择地址!'); + return false; } - // 计算里程,时间 - if (this.startInfo[0]?.detailedAddress && this.endInfo[0]?.detailedAddress) { - this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => { - this.totalDistance = res.distance; - this.totalTime = res.time; - this.getInsurersPrice(); // 计算保费金额 - }); - } - return true - } else { - this.service.msgSrv.warning('请重新手动选择地址!') - return false - } } }); } @@ -1193,7 +1197,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { getInsurersPrice(insuranceType = this.sf5.value?.insuranceType) { console.log(insuranceType); console.log(this.totalDistance); - if (insuranceType !== '3' && this.totalDistance > 0) { + if (insuranceType !== '3' && this.totalDistance > 0) { const params = { insuranceType, goodsValue: this.sf4.value.goodsValue, @@ -1210,14 +1214,14 @@ export class SupplyManagementReleasePublishComponent implements OnInit { }); } } - // 运费信息价格变更 - priceChange(event:any, i:any){ - i.setValue(event); - if(event>=99999){ - this.modalService.warning({ - nzTitle: '可输入的最大金额为99999元', - }); - } - this.payChange() - } + // 运费信息价格变更 + priceChange(event: any, i: any) { + i.setValue(event); + if (event >= 99999) { + this.modalService.warning({ + nzTitle: '可输入的最大金额为99999元' + }); + } + this.payChange(); + } } diff --git a/src/app/routes/tax-management/components/individual-income/individual-income.component.html b/src/app/routes/tax-management/components/individual-income/individual-income.component.html index dedb0881..56db2766 100644 --- a/src/app/routes/tax-management/components/individual-income/individual-income.component.html +++ b/src/app/routes/tax-management/components/individual-income/individual-income.component.html @@ -36,7 +36,7 @@ + [req]="{ process: beforeReq }" [page]="{}" [loading]="service.http.loading" (change)="stChange($event)"> diff --git a/src/app/routes/tax-management/components/individual-income/individual-income.component.ts b/src/app/routes/tax-management/components/individual-income/individual-income.component.ts index c55b07de..15583442 100644 --- a/src/app/routes/tax-management/components/individual-income/individual-income.component.ts +++ b/src/app/routes/tax-management/components/individual-income/individual-income.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { STChange, STColumn, STComponent, STData } from '@delon/abc/st'; +import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st'; import { SFComponent, SFDateWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; import { ShipperBaseService } from '@shared'; import { NzModalService } from 'ng-zorro-antd/modal'; @@ -32,16 +32,15 @@ export class TaxManagementIndividualIncomeComponent implements OnInit { constructor(public service: TaxManagementService) {} - /** - * 查询参数 - */ - get reqParams() { - const params = Object.assign({}, this.sf?.value || {}, { - declareStatus: this.selectedIndex - }); - delete params._$expand; - return { ...params }; - } + beforeReq = (requestOptions: STRequestOptions) => { + Object.assign(requestOptions.body, { declareStatus: this.selectedIndex }); + if (this.sf) { + Object.assign(requestOptions.body, { ...this.sf.value }); + delete requestOptions.body._$expand; + } + this.selectedRows = []; + return requestOptions; + }; stChange(e: STChange): void { switch (e.type) { diff --git a/src/app/routes/ticket-management/components/invoice-requested/invoice-requested-detail/invoice-requested-detail.component.ts b/src/app/routes/ticket-management/components/invoice-requested/invoice-requested-detail/invoice-requested-detail.component.ts index 401e2a10..7700b77c 100644 --- a/src/app/routes/ticket-management/components/invoice-requested/invoice-requested-detail/invoice-requested-detail.component.ts +++ b/src/app/routes/ticket-management/components/invoice-requested/invoice-requested-detail/invoice-requested-detail.component.ts @@ -177,7 +177,7 @@ export class InvoiceRequestedDetailComponent implements OnInit { } routeToOrder(item: any) { - if (item.billType === 1) { + if (item.billType === '1') { this.router.navigate(['/order-management/vehicle/vehicle-detail/' + item.billHId]); } else { this.router.navigate(['/order-management/bulk/bulk-detail/' + item.billHId]); diff --git a/src/app/routes/ticket-management/services/ticket.service.ts b/src/app/routes/ticket-management/services/ticket.service.ts index f8f17ed0..df5dd9d9 100644 --- a/src/app/routes/ticket-management/services/ticket.service.ts +++ b/src/app/routes/ticket-management/services/ticket.service.ts @@ -151,21 +151,22 @@ export class TicketService extends ShipperBaseService { if (!url) { return; } - const uA = window.navigator.userAgent; // 判断浏览器内核 - const isIE = - /msie\s|trident\/|edge\//i.test(uA) && - !!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window); - const objectUrl = url; - const a = document.createElement('a'); - document.body.appendChild(a); - a.href = objectUrl; - a.download = '面单.pdf'; - if (isIE) { - // 兼容IE11无法触发下载的问题 - (navigator as any).msSaveBlob(url, a.download); - } else { - a.click(); - } - a.remove(); + this.openURL(url); + // const uA = window.navigator.userAgent; // 判断浏览器内核 + // const isIE = + // /msie\s|trident\/|edge\//i.test(uA) && + // !!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window); + // const objectUrl = url; + // const a = document.createElement('a'); + // document.body.appendChild(a); + // a.href = objectUrl; + // a.download = '面单.pdf'; + // if (isIE) { + // // 兼容IE11无法触发下载的问题 + // (navigator as any).msSaveBlob(url, a.download); + // } else { + // a.click(); + // } + // a.remove(); } } diff --git a/src/app/shared/components/amap/amap-path-simplifier/amap-path-simplifier.component.ts b/src/app/shared/components/amap/amap-path-simplifier/amap-path-simplifier.component.ts index 1c810c67..efa030e9 100644 --- a/src/app/shared/components/amap/amap-path-simplifier/amap-path-simplifier.component.ts +++ b/src/app/shared/components/amap/amap-path-simplifier/amap-path-simplifier.component.ts @@ -287,7 +287,7 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges, OnDestroy * @param infoItem */ selectedPOI(infoItem: InfoItem) { - this.infoWindow.setContent(infoItem.content || `地址:
${infoItem.title}
`); + this.infoWindow.setContent(infoItem.content || `地址:
${infoItem.title}
`); this.infoWindow.open(this.aMap, infoItem.position); this.infoWindow.setPosition(infoItem.position); // 地图定位居中 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; }