jihua.service.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. import { Injectable } from '@angular/core';
  2. import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
  3. import { EnvService } from '../../wongoing/env.service';
  4. import { UtilsService } from '../../wongoing/utils.service';
  5. @Injectable({
  6. providedIn: 'root'
  7. })
  8. export class JihuaService {
  9. constructor(private http: HttpClient, private env: EnvService, private utilsService: UtilsService) { }
  10. /**
  11. * 获取计划执行监控总体数据列表
  12. * @param planDate 计划日期
  13. * @param equipGroupId 生产区域ID
  14. * @param equipJson 机台列表json串[{equipCode:'', equipName:''}, {equipCode:'', equipName:''}]
  15. */
  16. public getPlanExecMonitorTotalData(planDate, equipGroupId, equipJson) {
  17. const url = this.env.getPlanExecMonitorTotalData;
  18. const method = 'POST';
  19. const dsType = this.utilsService.getDataSourceType();
  20. const usedLanguage = this.utilsService.getUsedLanguage();
  21. let body = new HttpParams();
  22. body = body.append('dsType', dsType);
  23. body = body.append('planDate', planDate);
  24. body = body.append('equipGroupId', equipGroupId);
  25. body = body.append('equipJson', equipJson);
  26. const options = { headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded') };
  27. // const options = { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }; // 效果等同上一句
  28. return this.http.post(url, body.toString(), options).toPromise();
  29. }
  30. }