瀏覽代碼

Modificación de consulta de historial

JeanBenitez 3 年之前
父節點
當前提交
b903f729b4

+ 0 - 1
vacaciones/src/app/components/mes/mesmhs/mesmhs-form/mesmhs-form.component.ts

@@ -21,7 +21,6 @@ export class MESMHSFORMComponent implements OnInit {
 
   constructor(
     public dialogRef: MatDialogRef<any>,
-    private _snackBar: MatSnackBar,
     @Inject(MAT_DIALOG_DATA) public data: any,
   ) {    
     this.formGroup = this.createFormGroup();

+ 10 - 7
vacaciones/src/app/components/mes/mesmhs/mesmhs.component.ts

@@ -13,7 +13,7 @@ import { USERInterface } from '../../../interfaces/user-interface';
 import { ENCService } from 'src/app/services/enc/enc.service';
 import { MCOMAUService } from 'src/app/services/mco/mcomau/mcomau.service';
 import { ValidationsService } from 'src/app/services/validations.service';
-import { map, Observable, startWith } from 'rxjs';
+import { lastValueFrom, map, Observable, startWith } from 'rxjs';
 import { FormControl } from '@angular/forms';
 
 @Component({
@@ -562,12 +562,15 @@ export class MESMHSComponent implements AfterViewInit {
   }
 
   obtenerDetalleSolicitud(item: any) {
-    this._mesmhsService.obtenerDetalleSolicitud(item.IDSOLICITUD).subscribe(
-      (res) => {
-        this.solicitud = res;
-        this.openDialogForm(this.solicitud);
-      },
-      (error) => {
+
+
+    lastValueFrom(this._mesmhsService.obtenerDetalleSolicitud(item.IDSOLICITUD)).then(
+      (data:any) => {
+        if (!data.error) {
+          this.openDialogForm(data.response);
+        }
+       
+      }, (error) => {
         if (!error.ok) {
           this._validationService.openSnackBar('Ocurrió un error inesperado');
         }

+ 1 - 18
vacaciones/src/app/services/mes/mesmhs/mesmhs.service.ts

@@ -56,24 +56,7 @@ export class MESMHSService {
         `${this._url}/MESMHS/consultar/solicitud/${id_solicitud}/${this.formatoRFC(this.usuario_session.RFCEMPRESA)}`,
         { headers: this.headers }
       )
-      .pipe(
-        map(
-          (data: any) => {
-            return data.response;
-          },
-          (error: any) => {
-            if (!error.ok) {
-              this.snackAlert('Ocurrió un error inesperado');
-            }
-            if (error.error.msg != undefined) {
-              this.snackAlert(error.error.msg);
-            }
-            if (error.status == 408) {
-              this.snackAlert('Conexion lenta');
-            }
-          }
-        )
-      );
+      .pipe(map((data: any) => data));
   }
 
   obtenerSubordinados(numero_usuario: any) {