From 2c64aababdac27921f2fb58c4d8616adcfbc04a4 Mon Sep 17 00:00:00 2001
From: jingbowen <970029315@qq.com>
Date: Thu, 23 Feb 2023 15:58:23 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8B=E8=BD=BDdownImage?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../down-image/down-image.component.html      |   3 +-
 .../pages/down-image/down-image.component.ts  | 133 ++++++++++--------
 2 files changed, 79 insertions(+), 57 deletions(-)

diff --git a/src/app/pages/down-image/down-image.component.html b/src/app/pages/down-image/down-image.component.html
index 135ad59..0de75bd 100644
--- a/src/app/pages/down-image/down-image.component.html
+++ b/src/app/pages/down-image/down-image.component.html
@@ -25,6 +25,7 @@
       <nz-form-control>
         <nz-select
           nzAllowClear
+          nzShowSearch 
           style="background-color: #fff"
           formControlName="GasStationId"
           id="GasStationId"
@@ -62,6 +63,6 @@
 
     <button nz-button nzType="primary" (click)="onClick()">提交</button>
   </form>
-  <textarea style="width: 600px; height: 300px; margin-left: 10px;" *ngIf="result" [(ngModel)]="result" nz-input></textarea>
+  <textarea style="width: 600px; height: 300px; margin-left: 10px;" *ngIf="resultString" [(ngModel)]="resultString" nz-input></textarea>
   <!-- <div  style="width: 650px; height: 100%; background-color: #fff; margin-left: 10px;">{{result}}</div> -->
 </div>
diff --git a/src/app/pages/down-image/down-image.component.ts b/src/app/pages/down-image/down-image.component.ts
index 78bcd9f..0616616 100644
--- a/src/app/pages/down-image/down-image.component.ts
+++ b/src/app/pages/down-image/down-image.component.ts
@@ -1,76 +1,97 @@
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
-import { Component, OnInit, Input } from '@angular/core';
-import { NzModalRef } from 'ng-zorro-antd/modal';
-import { HttpClient } from '@angular/common/http';
-import { TreeService } from 'src/app/service/tree.service';
-import * as moment from 'moment';
-
+import { FormBuilder, FormGroup, Validators } from "@angular/forms";
+import { Component, OnInit, Input } from "@angular/core";
+import { NzModalRef } from "ng-zorro-antd/modal";
+import { HttpClient } from "@angular/common/http";
+import { TreeService } from "src/app/service/tree.service";
+import * as moment from "moment";
 
 @Component({
-  selector: 'app-down-image',
-  templateUrl: './down-image.component.html',
-  styleUrls: ['./down-image.component.scss']
+  selector: "app-down-image",
+  templateUrl: "./down-image.component.html",
+  styleUrls: ["./down-image.component.scss"],
 })
 export class DownImageComponent implements OnInit {
   validateForm!: FormGroup;
-  constructor(private fb: FormBuilder, private http: HttpClient ,private toTree:TreeService) { }
-  isVisible=false
+  constructor(
+    private fb: FormBuilder,
+    private http: HttpClient,
+    private toTree: TreeService
+  ) {}
+  isVisible = false;
   ngOnInit(): void {
     this.validateForm = this.fb.group({
       StartTime: [null],
-      EndTime:[null],
-      NodeName:[null],
-      GasStationId:[null]
+      EndTime: [null],
+      NodeName: [null],
+      GasStationId: [null],
     });
-    this.getAllOrganization()
+
+    this.getAllOrganization();
   }
-  result
-  onClick(){
+  result;
+  resultString;
+  list = [
+    "车辆进场",
+    "设置卸油隔离区",
+    "卸油连接静电接地",
+    "卸油设置消防器材",
+    "连接卸油管",
+    "卸油中无人监卸",
+    "拆除卸油管",
+    "车辆离场",
+  ];
+  onClick() {
     console.log(this.validateForm.value);
-    let params={
-      StartTime:moment(this.validateForm.value.StartTime).format('YYYY-MM-DD HH:mm:ss'),
-      EndTime:moment(this.validateForm.value.EndTime).format('YYYY-MM-DD HH:mm:ss'),
-      NodeName:this.validateForm.value.NodeName,
-      GasStationId:this.validateForm.value.GasStationId
-    }
-    this.http.get('/api/services/app/OilUnloadingProcess/GetOilUnloadingImages', { params: params }).subscribe((data:any)=>{
-      console.log(data);
-      this.result=data.result
-      setTimeout(() => {
-        this.isVisible=true
-      }, 500);
-    })
+    let params = {
+      StartTime: this.validateForm.value.StartTime
+        ? moment(this.validateForm.value.StartTime).format(
+            "YYYY-MM-DD HH:mm:ss"
+          )
+        : null,
+      EndTime: this.validateForm.value.EndTime
+        ? moment(this.validateForm.value.EndTime).format("YYYY-MM-DD HH:mm:ss")
+        : null,
+      NodeName: this.validateForm.value.NodeName,
+      GasStationId: this.validateForm.value.GasStationId,
+    };
+    this.http
+      .get("/api/services/app/OilUnloadingProcess/GetOilUnloadingImages", {
+        params: params,
+      })
+      .subscribe((data: any) => {
+        this.result = data.result.split("\n");
+        this.result.forEach((element, k) => {
+          if (element.indexOf("http") === -1 && element.indexOf("/api") === -1) {
+            this.result[k] = window.location.origin + "/" + element;
+          }else if(element.indexOf("http") === -1 && element.indexOf("/api") != -1){
+            this.result[k] = window.location.origin + element;
+          }
+        });
+        this.result = [...this.result];
+        this.resultString=this.result.join('\n')
+      });
   }
-  list=[
-    '车辆进场',
-    '设置卸油隔离区',
-    '卸油连接静电接地',
-    '卸油设置消防器材',
-    '连接卸油管',
-    '卸油中无人监卸',
-    '拆除卸油管',
-    '车辆离场',
-  ]
-  
-  nodes: any = []
+
+
+  nodes: any = [];
   async getAllOrganization() {
-    let OrganizationUnitId = JSON.parse(sessionStorage.getItem('userdata')).organization.id
+    let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata"))
+      .organization.id;
     let params = {
       OrganizationUnitId: OrganizationUnitId,
       MaxResultCount: 9999,
-      IsContainsChildren: "true"
-    }
+      IsContainsChildren: "true",
+    };
     await new Promise((resolve, reject) => {
-      this.http.get('/api/services/app/GasStation/GetAll', {
-        params: params
-      }).subscribe((data: any) => {
-        this.nodes=data.result.items
-        
-        resolve(data)
-        
-      })
-    })
+      this.http
+        .get("/api/services/app/GasStation/GetAll", {
+          params: params,
+        })
+        .subscribe((data: any) => {
+          this.nodes = data.result.items;
 
+          resolve(data);
+        });
+    });
   }
-
 }