From 940f2283b68b6db81a3149776c263535448d212d Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Tue, 17 May 2022 17:29:00 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../audit/audit-ing/audit-ing.component.ts | 38 +++++--- .../audit-record/audit-record.component.ts | 30 +++--- .../pages/license/inform/inform.component.ts | 7 +- .../oil-station-info.component.ts | 93 +++---------------- .../get-out-of-line-details.component.scss | 5 +- 5 files changed, 64 insertions(+), 109 deletions(-) diff --git a/src/app/pages/audit/audit-ing/audit-ing.component.ts b/src/app/pages/audit/audit-ing/audit-ing.component.ts index 03f20df..1a29b58 100644 --- a/src/app/pages/audit/audit-ing/audit-ing.component.ts +++ b/src/app/pages/audit/audit-ing/audit-ing.component.ts @@ -17,15 +17,16 @@ import { AuditDisposeComponent } from './audit-dispose/audit-dispose.component'; }) export class AuditIngComponent implements OnInit { - constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef,private http: HttpClient,private message: NzMessageService,private element: ElementRef) { } + constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef, private http: HttpClient, private message: NzMessageService, private element: ElementRef) { } tableSpin = false tableScrollHeight ngOnInit(): void { - this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' + this.tableScrollHeight = '100px' // 页面监听 fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { - this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' + let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight + this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 30) + 'px' }); this.getStationList() } @@ -50,13 +51,13 @@ export class AuditIngComponent implements OnInit { this.tableSpin = true let data = JSON.parse(sessionStorage.getItem('userdata')); let params = { - OrganizationUnitId: data.organization.id || "" , + OrganizationUnitId: data.organization.id || "", IsContainsChildren: "true", AuditStatuses: "1", SkipCount: this.SkipCount, MaxResultCount: this.MaxResultCount, } - this.http.get(`/api/services/app/ContentAuditLog/GetAuditting`,{params}).subscribe((info: any)=>{ + this.http.get(`/api/services/app/ContentAuditLog/GetAuditting`, { params }).subscribe((info: any) => { info.result.items.forEach(element => { element.itemData = JSON.parse(element.itemData) }); @@ -64,6 +65,11 @@ export class AuditIngComponent implements OnInit { this.list = [...this.list] this.totalCount = info.result.totalCount this.tableSpin = false + setTimeout(() => { + let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight + this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 30) + 'px' + }, 0); + console.log(this.list) }) } @@ -74,12 +80,12 @@ export class AuditIngComponent implements OnInit { // if (item.auditStatus != 1) { // return // } - this.getData(item).then(res=>{ + this.getData(item).then(res => { item.getData = res const modal = this.modal.create({ nzContent: AuditDisposeComponent, nzViewContainerRef: this.viewContainerRef, - nzWidth: item.auditType == 0? 700 : 600, + nzWidth: item.auditType == 0 ? 700 : 600, nzBodyStyle: { 'border': '1px solid #91CCFF', 'border-radius': '0px', @@ -108,12 +114,14 @@ export class AuditIngComponent implements OnInit { url = '/api/services/app/StationFileLicense/Audit' } let params = { - id: item.auditType == 0? item.gasStation.id : item.getData.id, + id: item.auditType == 0 ? item.gasStation.id : item.getData.id, remark: instance.textarea } - let body = instance.isPass? 2 : 3; - this.http.post(url,body,{params}).subscribe(data => { + let body = instance.isPass ? 2 : 3; + this.http.post(url, body, { params }).subscribe(data => { resolve(data); + this.list = [] + this.SkipCount = '0' this.getStationList(); this.message.create('success', '审核完成!'); return true @@ -137,12 +145,12 @@ export class AuditIngComponent implements OnInit { } else if (item.auditType) { component = DetailsFileCategoryComponent } - this.getData(item).then(res=>{ + this.getData(item).then(res => { item.getData = res const modal = this.modal.create({ nzContent: component, nzViewContainerRef: this.viewContainerRef, - nzWidth: item.auditType == 0? 700 : 450, + nzWidth: item.auditType == 0 ? 700 : 450, nzBodyStyle: { 'border': '1px solid #91CCFF', 'border-radius': '0px', @@ -166,7 +174,7 @@ export class AuditIngComponent implements OnInit { getData(item) { let url if (item.auditType == 0) { //油站基本信息 - return new Promise((resolve, reject)=>{ + return new Promise((resolve, reject) => { let organization = { organizationId: item.organizationId } resolve(organization) }) @@ -177,9 +185,9 @@ export class AuditIngComponent implements OnInit { } else if (item.auditType) { url = '/api/services/app/StationFileLicense/Get' } - return new Promise((resolve, reject)=>{ + return new Promise((resolve, reject) => { let params = { id: item.itemId } - this.http.get(url,{params}).subscribe((data: any)=>{ + this.http.get(url, { params }).subscribe((data: any) => { resolve(data.result) }) }) diff --git a/src/app/pages/audit/audit-record/audit-record.component.ts b/src/app/pages/audit/audit-record/audit-record.component.ts index 584be47..74a9f46 100644 --- a/src/app/pages/audit/audit-record/audit-record.component.ts +++ b/src/app/pages/audit/audit-record/audit-record.component.ts @@ -25,6 +25,14 @@ export class AuditRecordComponent implements OnInit { startdate enddate async ngOnInit(): Promise { + this.tableScrollHeight = '100px' + // 页面监听 + fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight + this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 30) + 'px' + + console.log('页面尺寸变化', this.tableScrollHeight) + }); this.validateForm = this.fb.group({ type: [null], info: [null], @@ -46,12 +54,6 @@ export class AuditRecordComponent implements OnInit { let lastD = lw.getDate(); this.startdate = lastY + "-" + (lastM < 10 ? "0" + lastM : lastM) + "-" + (lastD < 10 ? "0" + lastD : lastD);//三十天之前日期 - this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' - // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { - this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' - }); - this.getTypeList() await this.getAllOrganization() this.getRecordList() @@ -172,12 +174,16 @@ export class AuditRecordComponent implements OnInit { SkipCount: this.SkipCount, MaxResultCount: this.MaxResultCount, } - this.http.get('/api/services/app/ContentAuditLog/GetHistory', {params}).subscribe((data: any) => { + this.http.get('/api/services/app/ContentAuditLog/GetHistory', { params }).subscribe((data: any) => { this.list = this.list.concat(data.result.items); this.list = [...this.list] this.totalCount = data.result.totalCount this.tableSpin = false console.log('审核历史纪录', this.list) + setTimeout(() => { + let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight + this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 30) + 'px' + }, 0); }) } @@ -192,12 +198,12 @@ export class AuditRecordComponent implements OnInit { } else if (item.auditType) { component = DetailsFileCategoryComponent } - this.getData(item).then(res=>{ + this.getData(item).then(res => { item.getData = res const modal = this.modal.create({ nzContent: component, nzViewContainerRef: this.viewContainerRef, - nzWidth: item.auditType == 0? 700 : 450, + nzWidth: item.auditType == 0 ? 700 : 450, nzBodyStyle: { 'border': '1px solid #91CCFF', 'border-radius': '0px', @@ -221,7 +227,7 @@ export class AuditRecordComponent implements OnInit { getData(item) { let url if (item.auditType == 0) { //油站基本信息 - return new Promise((resolve, reject)=>{ + return new Promise((resolve, reject) => { let organization = { organizationId: item.organizationId } resolve(organization) }) @@ -232,9 +238,9 @@ export class AuditRecordComponent implements OnInit { } else if (item.auditType) { url = '/api/services/app/StationFileLicense/Get' } - return new Promise((resolve, reject)=>{ + return new Promise((resolve, reject) => { let params = { id: item.itemId } - this.http.get(url,{params}).subscribe((data: any)=>{ + this.http.get(url, { params }).subscribe((data: any) => { resolve(data.result) }) }) diff --git a/src/app/pages/license/inform/inform.component.ts b/src/app/pages/license/inform/inform.component.ts index 368e1f9..41e6777 100644 --- a/src/app/pages/license/inform/inform.component.ts +++ b/src/app/pages/license/inform/inform.component.ts @@ -15,10 +15,13 @@ export class InformComponent implements OnInit { list = [] tableScrollHeight + + fromEvent ngOnInit(): void { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + + this.fromEvent = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' }); @@ -26,6 +29,8 @@ export class InformComponent implements OnInit { this.getInform() } + + dispose() { console.log('处置') } diff --git a/src/app/pages/oil-station-info/oil-station-info.component.ts b/src/app/pages/oil-station-info/oil-station-info.component.ts index 59580b4..4c72aa5 100644 --- a/src/app/pages/oil-station-info/oil-station-info.component.ts +++ b/src/app/pages/oil-station-info/oil-station-info.component.ts @@ -223,27 +223,7 @@ export class OilStationInfoComponent implements OnInit { } isLoadingSave: boolean = false - submitForm() { - // let valid = true - // console.log(this.httpBody.licenses) - // this.httpBody.licenses.forEach(element => { - // if (!element.startTime || !element.endTime || !element.firstWarnTime || !element.secondWarnTime || !element.code) { - // valid = false - // console.log('普通拦截') - // return - // } - // if (element.hasAnnualInspection) { - // if (!element.annualInspectionWarnTime || !element.annualInspectionOrganizationName || !element.annualInspectionTime) { - // valid = false - // console.log('年检拦截') - // return - // } - // } - // }); - // if (!valid) { - // this.message.create('error', '请将证照信息填写完整!'); - // return - // } + async submitForm() { if (this.validateForm.valid) { this.isLoadingSave = true this.httpBody.openTime = moment(this.httpBody.openTime).format('YYYY-MM-MM')//开业时间格式化 @@ -260,12 +240,15 @@ export class OilStationInfoComponent implements OnInit { delete item.isPerpetual }) - this.http.put('/api/services/app/GasStation/Update', body).subscribe((data: any) => { - this.isLoadingSave = false - this.message.create('success', '保存成功!'); - }, err => { - this.isLoadingSave = false - this.message.create('error', '保存失败!'); + await new Promise((resolve, reject) => { + this.http.put('/api/services/app/GasStation/Update', body).subscribe((data: any) => { + resolve(data) + this.isLoadingSave = false + this.message.create('success', '保存成功!'); + }, err => { + this.isLoadingSave = false + this.message.create('error', '保存失败!'); + }) }) } else { this.message.create('warning', '请填写完整!'); @@ -274,62 +257,12 @@ export class OilStationInfoComponent implements OnInit { } - // uploadIndex: string - // filechange(e, index) { - // let file = e.target.files[0] || null //获取上传的文件 - // this.uploadIndex = index - // this.openFileSelect(file, `stationPhotos/${this.userdata.organization.id}/`) - // } - // //设置文件路径并上传 - // postFilePath - // async openFileSelect(file: File, extensionPath: string) { - // this.postFilePath = extensionPath; - // let fileSize = file.size || null //上传文件的总大小 - // let shardSize = 5 * 1024 * 1024 //5MB 超过5MB要分块上传 - // if (fileSize >= shardSize) // 超过5MB要分块上传 - // { - // await this.postFileByMul(file); - // setTimeout(() => { - // this.gallery.destroy() - // this.gallery = new Viewer(document.getElementById('images')); - // }, 0); - // } - // else //普通上传 - // { - // await this.postFile(file); - // setTimeout(() => { - // this.gallery.destroy() - // this.gallery = new Viewer(document.getElementById('images')); - // }, 0); - // } - // } - // //上传文件 - // async postFile(file: File) { - // await new Promise((resolve, reject) => { - // this.objectsSrv.postFile(this.postFilePath, file).subscribe(data => { - // let dataObj = data as any; - // let filePath: string = ObjectsSimpleService.baseUrl + dataObj.objectName; - // this.httpBody.licenses[this.uploadIndex].imageUrl = filePath - // resolve('success') - // }); - // }) - // } - // /** - // * 分块上传 - // * @param file - // */ - // postFileByMul(file: File) { - // this.objectsSrv.postFile_MultipartUpload(this.postFilePath, file).then((value) => { - // let dataObj = value as any; - // this.httpBody.licenses[this.uploadIndex].imageUrl = dataObj.filePath - // }); - - // } + isSubmitAuditLoading: boolean = false + async submitAudit() { + await this.submitForm() - isSubmitAuditLoading: boolean = false - submitAudit() { let params = { id: this.httpBody.id } diff --git a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.scss b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.scss index 07dcc6b..3eb7fe1 100644 --- a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.scss +++ b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.scss @@ -108,11 +108,14 @@ .btn { display: flex; align-items: center; - span{ + + span { margin: 0 4px; display: inline-block; // border: 1px solid red; } + + span:first-child(1) {margin-right: 12px;} } }