diff --git a/src/app/pages/main/main.component.ts b/src/app/pages/main/main.component.ts index 84e8df2..e6d39af 100644 --- a/src/app/pages/main/main.component.ts +++ b/src/app/pages/main/main.component.ts @@ -470,6 +470,7 @@ export class MainComponent implements OnInit { /** * 创建线程并执行 */ + public promise:Worker = new Worker('/adminweb/assets/web-worker-handle.js'); creatWorkers() { let dynamicData = { raw_data: this.raw_data, @@ -480,20 +481,19 @@ export class MainComponent implements OnInit { flightStatus: this.flightStatus, flightTypes: this.flightTypes } - // const promise = new Worker('/assets/web-worker-handle.js'); - // promise.postMessage(dynamicData); - // promise.onmessage = function (e) { - // console.log('====='); - // this.combined_data = e.data; - // this.selectChange('dynamic'); - // // promise.terminate(); - // }.bind(this); - const promise = this.webWorkerService.run(webWorkerHandle, dynamicData); - promise.then(function (response) { - this.combined_data = response; + this.promise.postMessage(dynamicData); + this.promise.onmessage = function (e) { + console.log('====='); + this.combined_data = e.data; this.selectChange('dynamic'); - this.webWorkerService.terminate(promise); - }.bind(this)); + // this.promise.terminate(); + }.bind(this); + // const promise = this.webWorkerService.run(webWorkerHandle, dynamicData); + // promise.then(function (response) { + // this.combined_data = response; + // this.selectChange('dynamic'); + // this.webWorkerService.terminate(promise); + // }.bind(this)); } /** @@ -646,7 +646,7 @@ export class MainComponent implements OnInit { continue; } } else { - if (item['preFlight'][key] === filterItems[key]) { + if (item['preFlight'][key] == filterItems[key]) { is_satis = true; continue; } else { @@ -690,7 +690,7 @@ export class MainComponent implements OnInit { continue; } } else { - if (item['reaFlight'][key] === filterItems[key]) { + if (item['reaFlight'][key] == filterItems[key]) { is_satis = true; continue; } else { @@ -735,7 +735,7 @@ export class MainComponent implements OnInit { continue; } } else { - if (item['preFlight'][key] === filterItems[key]) { + if (item['preFlight'][key] == filterItems[key]) { pre_satis = true; continue; } else { @@ -776,7 +776,7 @@ export class MainComponent implements OnInit { continue; } } else { - if (item['reaFlight'][key] === filterItems[key]) { + if (item['reaFlight'][key] == filterItems[key]) { rea_satis = true; continue; } else {