Compare commits

..

13 Commits

  1. 9
      angular.json
  2. 9064
      package-lock.json
  3. 2
      package.json
  4. 13
      proxy.config.json
  5. 8
      src/app/app-routing.module.ts
  6. 2
      src/app/app.component.ts
  7. 95
      src/app/auth.guard.ts
  8. 90
      src/app/http-interceptors/base-interceptor.ts
  9. 10
      src/app/pages/audit/audit-ing/audit-ing.component.ts
  10. 452
      src/app/pages/audit/audit-record/audit-record.component.ts
  11. 4
      src/app/pages/change-password/change-password.component.ts
  12. 15
      src/app/pages/gis-home/card-list/card-list.component.html
  13. 54
      src/app/pages/gis-home/card-list/card-list.component.scss
  14. 20
      src/app/pages/gis-home/card-list/card-list.component.ts
  15. 4
      src/app/pages/gis-home/card-title/card-title.component.html
  16. 29
      src/app/pages/gis-home/card-title/card-title.component.scss
  17. 14
      src/app/pages/gis-home/card-title/card-title.component.ts
  18. 67
      src/app/pages/gis-home/gis-home.component.html
  19. 156
      src/app/pages/gis-home/gis-home.component.scss
  20. 1401
      src/app/pages/gis-home/gis-home.component.ts
  21. 6
      src/app/pages/gis-home/unit-title/unit-title.component.html
  22. 36
      src/app/pages/gis-home/unit-title/unit-title.component.scss
  23. 48
      src/app/pages/gis-home/unit-title/unit-title.component.ts
  24. 328
      src/app/pages/home-page-comprehensive/home-page-comprehensive.component.html
  25. 578
      src/app/pages/home-page-comprehensive/home-page-comprehensive.component.scss
  26. 1786
      src/app/pages/home-page-comprehensive/home-page-comprehensive.component.ts
  27. 10
      src/app/pages/home-page/home-page.component.html
  28. 14
      src/app/pages/home-page/home-page.component.ts
  29. 81
      src/app/pages/home/home.component.html
  30. 50
      src/app/pages/home/home.component.scss
  31. 280
      src/app/pages/home/home.component.ts
  32. 187
      src/app/pages/login/forget/forget.component.ts
  33. 51
      src/app/pages/login/login.component.html
  34. 207
      src/app/pages/login/login.component.ts
  35. 471
      src/app/pages/oil-station-info/oil-station-info.component.ts
  36. 10
      src/app/pages/oil-unloading-process/anxin-img-look/anxin-img-look.component.ts
  37. 97
      src/app/pages/pages-routing.module.ts
  38. 8
      src/app/pages/pages.module.ts
  39. 10
      src/app/pages/plan-admin/file-license-list/file-license-list.component.ts
  40. 216
      src/app/pages/plan-admin/plan-admin.component.ts
  41. 11
      src/app/pages/plan-admin/update-license-list/update-license-list.component.ts
  42. 46
      src/app/pages/records/criminal-records-admin/criminal-records-admin.component.ts
  43. 1064
      src/app/pages/records/criminal-records/criminal-records.component.ts
  44. 33
      src/app/pages/records/oil-unloading-process-list/oil-unloading-process-list.component.ts
  45. 40
      src/app/pages/records/records-nav/records-nav.component.ts
  46. 965
      src/app/pages/records/warning-statistics-list/warning-statistics-list.component.ts
  47. 0
      src/app/pages/singlelogin/singlelogin.component.html
  48. 0
      src/app/pages/singlelogin/singlelogin.component.scss
  49. 405
      src/app/pages/singlelogin/singlelogin.component.ts
  50. 12
      src/app/pages/today-warning-admin/today-warning-admin.component.html
  51. 38
      src/app/pages/today-warning-admin/today-warning-admin.component.scss
  52. 519
      src/app/pages/today-warning-admin/today-warning-admin.component.ts
  53. 7
      src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html
  54. 121
      src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts
  55. 7
      src/app/pages/today-warning/today-warning.component.ts
  56. 7
      src/app/service/pattern.service.ts
  57. 7
      src/app/service/tree.service.ts
  58. 19
      src/app/system-management/algorithm-config/algorithm-config.component.ts
  59. 356
      src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts
  60. 2
      src/app/system-management/navigation/navigation.component.html
  61. 2
      src/app/system-management/navigation/navigation.component.scss
  62. 16
      src/app/system-management/navigation/navigation.component.ts
  63. 35
      src/app/system-management/or-binding/or-binding-model/or-binding-model.component.html
  64. 76
      src/app/system-management/or-binding/or-binding-model/or-binding-model.component.scss
  65. 128
      src/app/system-management/or-binding/or-binding-model/or-binding-model.component.ts
  66. 56
      src/app/system-management/or-binding/or-binding.component.html
  67. 168
      src/app/system-management/or-binding/or-binding.component.scss
  68. 156
      src/app/system-management/or-binding/or-binding.component.ts
  69. 4
      src/app/system-management/organization/change-or/change-or.component.html
  70. 5
      src/app/system-management/organization/change-or/change-or.component.scss
  71. 55
      src/app/system-management/organization/change-or/change-or.component.ts
  72. 11
      src/app/system-management/organization/organization.component.html
  73. 121
      src/app/system-management/organization/organization.component.ts
  74. 4
      src/app/system-management/system-management-routing.module.ts
  75. 15
      src/app/system-management/system-management.module.ts
  76. 113
      src/app/system-management/user-binding/binding/binding.component.html
  77. 223
      src/app/system-management/user-binding/binding/binding.component.scss
  78. 208
      src/app/system-management/user-binding/binding/binding.component.ts
  79. 101
      src/app/system-management/user-binding/user-binding.component.html
  80. 173
      src/app/system-management/user-binding/user-binding.component.scss
  81. 106
      src/app/system-management/user-binding/user-binding.component.ts
  82. 112
      src/app/system-management/user/adduser/adduser.component.ts
  83. 264
      src/app/system-management/user/edituser/edituser.component.ts
  84. 16
      src/app/system-management/user/user.component.html
  85. 34
      src/app/system-management/user/user.component.ts
  86. BIN
      src/assets/gismap/cardbg.png
  87. BIN
      src/assets/gismap/cardtitle.png
  88. BIN
      src/assets/gismap/gis/1.png
  89. BIN
      src/assets/gismap/gis/2.png
  90. BIN
      src/assets/gismap/gis/3.png
  91. BIN
      src/assets/gismap/gis/4.png
  92. BIN
      src/assets/gismap/gis/marker.png
  93. BIN
      src/assets/gismap/icon/1.png
  94. BIN
      src/assets/gismap/icon/2.png
  95. BIN
      src/assets/gismap/icon/3.png
  96. BIN
      src/assets/gismap/icon/4.png
  97. BIN
      src/assets/gismap/listtitle.png
  98. BIN
      src/assets/sound/chouyan.mp3
  99. BIN
      src/assets/sound/chuangru.mp3
  100. BIN
      src/assets/sound/dadianhua.mp3
  101. Some files were not shown because too many files have changed in this diff Show More

9
angular.json

@ -18,7 +18,6 @@
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:browser",
"options": { "options": {
"baseHref": "/",
"outputPath": "dist/anxin119", "outputPath": "dist/anxin119",
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "main": "src/main.ts",
@ -131,7 +130,9 @@
"output": "/assets/abp" "output": "/assets/abp"
} }
], ],
"styles": ["src/styles.scss"], "styles": [
"src/styles.scss"
],
"scripts": [ "scripts": [
"node_modules/@aspnet/signalr/dist/browser/signalr.min.js", "node_modules/@aspnet/signalr/dist/browser/signalr.min.js",
"node_modules/abp-web-resources/Abp/Framework/scripts/abp.js" "node_modules/abp-web-resources/Abp/Framework/scripts/abp.js"
@ -146,7 +147,9 @@
"tsconfig.spec.json", "tsconfig.spec.json",
"e2e/tsconfig.json" "e2e/tsconfig.json"
], ],
"exclude": ["**/node_modules/**"] "exclude": [
"**/node_modules/**"
]
} }
}, },
"e2e": { "e2e": {

9064
package-lock.json generated

File diff suppressed because it is too large Load Diff

2
package.json

@ -3,7 +3,7 @@
"version": "0.0.0", "version": "0.0.0",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve --proxy-config proxy.config.json --open --port 1119", "start": "ng serve --proxy-config proxy.config.json --open --port 1119 --host 192.168.1.82",
"build": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --configuration production", "build": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --configuration production",
"test": "ng test", "test": "ng test",
"lint": "ng lint", "lint": "ng lint",

13
proxy.config.json

@ -1,22 +1,13 @@
{ {
"/api": { "/api": {
"target": "https://znaq.sinochemoilmarketing.com/", "target": "http://121.36.37.70:8225/",
"测试1": "http://121.36.37.70:8906/",
"测试2": "https://znaq.sinochemoilmarketing.com/",
"测试3": "https://gas.anxincloud.cn/",
"中台": "http://10.156.134.54:8906/",
"secure": false, "secure": false,
"changeOrigin": true "changeOrigin": true
}, },
"/signalr": { "/signalr": {
"target": "https://znaq.sinochemoilmarketing.com/", "target": "http://121.36.37.70:8225/",
"secure": false, "secure": false,
"ws": true, "ws": true,
"logLevel": "debug" "logLevel": "debug"
},
"/sagframe-portal": {
"target": "https://uat-uomsp.sinochemoilmarketing.com/",
"secure": false,
"changeOrigin": true
} }
} }

8
src/app/app-routing.module.ts

@ -8,15 +8,13 @@ import { AuthGuard } from "./auth.guard";
import { HomeComponent } from "./pages/home/home.component"; import { HomeComponent } from "./pages/home/home.component";
import { NavigationComponent } from "./system-management/navigation/navigation.component"; import { NavigationComponent } from "./system-management/navigation/navigation.component";
import { HomePageNologinComponent } from "./pages/home-page-nologin/home-page-nologin.component"; import { HomePageNologinComponent } from "./pages/home-page-nologin/home-page-nologin.component";
import { SingleloginComponent } from "./pages/singlelogin/singlelogin.component"; import { GisHomeComponent } from "./pages/gis-home/gis-home.component";
const routes: Routes = [ const routes: Routes = [
{ path: '', redirectTo: 'singlelogin', pathMatch: 'full' }, { path: "", redirectTo: "login", pathMatch: "full" },
{ path: "singlelogin", component: SingleloginComponent }, //单点登录页
{ path: "login", component: LoginComponent }, //登录页 { path: "login", component: LoginComponent }, //登录页
{ path: "register", component: RegisterComponent }, //注册页 { path: "register", component: RegisterComponent }, //注册页
// { path: 'homepagenologin', component: HomePageNologinComponent }, //注册 { path: "gishome", component: GisHomeComponent }, //地图首
{ {
path: "", path: "",
component: HomeComponent, component: HomeComponent,

2
src/app/app.component.ts

@ -19,7 +19,7 @@ export class AppComponent {
public token: CacheTokenService, public token: CacheTokenService,
private notificationService: NzNotificationService private notificationService: NzNotificationService
) {} ) {}
VERSION = 20240822; VERSION = 20230807;
ngOnInit(): void { ngOnInit(): void {
this.sayHello(); this.sayHello();
} }

95
src/app/auth.guard.ts

@ -1,100 +1,35 @@
import { HttpClient } from "@angular/common/http"; import { Component, OnInit, Inject } from '@angular/core';
import { Component, OnInit, Inject } from "@angular/core"; import { Injectable } from '@angular/core';
import { Injectable } from "@angular/core"; import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
import {
CanActivate,
ActivatedRouteSnapshot,
RouterStateSnapshot,
Router,
} from "@angular/router";
@Injectable({ @Injectable({
providedIn: "root", providedIn: 'root'
}) })
export class AuthGuard implements CanActivate { export class AuthGuard implements CanActivate {
constructor(private http: HttpClient, private router: Router) {}
// 路由守卫 constructor(private router: Router) {
async canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Promise<boolean> {
console.log("路由守卫", next);
if (
next.queryParams.singleSignOn &&
next.queryParams.singleSignOn === "true"
) {
sessionStorage.setItem("singleSignOn", "true");
await this.autoLogin();
} }
// 路由守卫
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
// console.log('路由守卫',next.data)
// if(next.data.permission == 'xxxx'){
// return true;
// }
return this.checkLogin(); return this.checkLogin();
} }
checkLogin(): boolean { checkLogin(): boolean {
// 判断本地有没有token // 判断本地有没有token
const token = sessionStorage.getItem("token"); const token = sessionStorage.getItem('token');
// 如果有token,允许访问 // 如果有token,允许访问
if (token) { if (token) { return true; }
return true;
}
//如果没有token,跳转登录页 //如果没有token,跳转登录页
// this.router.navigate(["/login"]); this.router.navigate(['/login']);
return false; return false;
} }
autoLogin() {
return new Promise<void>((resolve, reject) => {
this.http
.post("/api/TokenAuth/Authenticate", {
userNameOrEmailAddress: "admin",
password: "Admin119119119",
})
.subscribe(
(data: any) => {
sessionStorage.setItem("token", data.result.accessToken);
sessionStorage.setItem(
"encryptedAccessToken",
data.result.encryptedAccessToken
);
this.http
.get("/api/services/app/Session/GetCurrentLoginInformations")
.subscribe(
async (data: any) => {
console.log("GetCurrentLoginInformations", data.result);
sessionStorage.setItem(
"userdata",
JSON.stringify(data.result.user)
);
sessionStorage.setItem(
"userdataOfgasstation",
JSON.stringify(data.result.user)
);
sessionStorage.setItem(
"isDefaultPassword",
JSON.stringify(data.result.user.isDefaultPassword)
);
sessionStorage.setItem(
"isPasswordExpired",
JSON.stringify(data.result.user.isPasswordExpired)
);
sessionStorage.setItem("isGasStation", "false");
resolve();
},
(err) => {
reject();
}
);
},
(err) => {
reject();
}
);
});
}
} }

90
src/app/http-interceptors/base-interceptor.ts

@ -1,27 +1,24 @@
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { import {
HttpClient, HttpClient, HttpInterceptor, HttpHandler, HttpRequest,
HttpInterceptor,
HttpHandler,
HttpRequest,
HttpErrorResponse, HttpErrorResponse,
HttpResponse, HttpResponse
} from "@angular/common/http"; } from '@angular/common/http';
import { throwError } from "rxjs"; import { throwError } from 'rxjs'
import { catchError, tap, finalize } from "rxjs/operators"; import { catchError, tap, finalize } from 'rxjs/operators';
import { Router } from "@angular/router"; import { Router } from '@angular/router'
import { NzMessageService } from "ng-zorro-antd/message"; import { NzMessageService } from 'ng-zorro-antd/message';
//baseurl //baseurl
// const baseurl = 'http://39.106.78.171:8008'; // const baseurl = 'http://39.106.78.171:8008';
@Injectable() @Injectable()
export class BaseInterceptor implements HttpInterceptor { export class BaseInterceptor implements HttpInterceptor {
constructor(private router: Router, private message: NzMessageService) { } constructor(private router: Router, private message: NzMessageService) { }
intercept(req, next: HttpHandler) { intercept(req, next: HttpHandler) {
// req.url = "/youzhan" + req.url;
// req.urlWithParams = "/youzhan" + req.urlWithParams;
let params = req.params; let params = req.params;
for (const key of req.params.keys()) { for (const key of req.params.keys()) {
if (params.get(key) === undefined || params.get(key) === null) { if (params.get(key) === undefined || params.get(key) === null) {
@ -36,43 +33,36 @@ export class BaseInterceptor implements HttpInterceptor {
}); });
if (!req.cancelToken) { if (!req.cancelToken) {
/*获取token*/ /*获取token*/
let token = sessionStorage.getItem("token"); let token = sessionStorage.getItem("token")
/*此处设置额外请求头,token令牌*/ /*此处设置额外请求头,token令牌*/
if (!!token) { if (!!token) {
newReq.headers = newReq.headers.set("Authorization", `Bearer ${token}`); newReq.headers = newReq.headers.set('Authorization', `Bearer ${token}`)
} }
} }
// 携带请求头发送下一次请求 // 携带请求头发送下一次请求
return next.handle(newReq).pipe( return next.handle(newReq)
tap( .pipe(
(event) => { tap(event => {
if (event instanceof HttpResponse) { if (event instanceof HttpResponse) {
// 成功 // 成功
// console.log('成功', event.headers.get('x-refresh-encryptedtoken')) // console.log('成功', event.headers.get('x-refresh-encryptedtoken'))
if (!!event.headers.get("x-refresh-token")) { if (!!event.headers.get('x-refresh-token')) {
sessionStorage.setItem( sessionStorage.setItem('token', event.headers.get('x-refresh-token'))
"token", sessionStorage.setItem('encryptedAccessToken', event.headers.get('x-refresh-encryptedtoken'))
event.headers.get("x-refresh-token")
);
sessionStorage.setItem(
"encryptedAccessToken",
event.headers.get("x-refresh-encryptedtoken")
);
} }
} }
}, }, error => {
(error) => {
// 失败 // 失败
console.log("请求http失败", error); console.log('请求http失败', error)
this.handleError(error); this.handleError(error)
} }),
),
finalize(() => { finalize(() => {
// 请求完成 // 请求完成
// console.log('complete') // console.log('complete')
}) })
); )
} }
// 捕获错误 // 捕获错误
@ -81,41 +71,39 @@ export class BaseInterceptor implements HttpInterceptor {
private handleError(error: HttpErrorResponse) { private handleError(error: HttpErrorResponse) {
// 用户认证失败返回登录页 // 用户认证失败返回登录页
if (error.status === 401 || error.status === 614) { if (error.status === 401 || error.status === 614) {
sessionStorage.clear(); sessionStorage.clear()
localStorage.removeItem("isautologin"); localStorage.removeItem("isautologin")
this.message.create("error", `用户认证信息过期,请重新登录!`); this.message.create('error', `用户认证信息过期,请重新登录!`);
this.router.navigate(["/singlelogin"]); this.router.navigate(['/login'])
} }
if (error.status === 403) { if (error.status === 403) {
this.message.create("error", `对不起,您无此权限!`); this.message.create('error', `对不起,您无此权限!`);
} }
if (error.status === 400) { if (error.status === 400) {
this.message.create("error", `请核对您的输入信息或格式是否正确!`); this.message.create('error', `请核对您的输入信息或格式是否正确!`);
} }
if (error.status === 500) { if (error.status === 500) {
if (error.error.error.message) { if (error.error.error.message) {
this.message.create( this.message.create('error', `${error.error.error.details || error.error.error.message}`);
"error",
`${error.error.error.details || error.error.error.message}`
);
} else { } else {
this.message.create("error", `状态500`); this.message.create('error', `状态500`);
} }
} }
if (error.status === 404) { if (error.status === 404) {
this.message.create("error", `${error.error.error.message}`); this.message.create('error', `${error.error.error.message}`);
} }
if (error.error instanceof ErrorEvent) { if (error.error instanceof ErrorEvent) {
// 发生客户端或网络错误。相应处理。 // 发生客户端或网络错误。相应处理。
console.error("An error occurred:", error.error.error.message); console.error('An error occurred:', error.error.error.message);
} else { } else {
// 服务端返回http状态码 // 服务端返回http状态码
// 服务端返回错误信息 // 服务端返回错误信息
console.error( console.error(
`Backend returned code ${error.status}, ` + `body was: ${error.error}` `Backend returned code ${error.status}, ` +
); `body was: ${error.error}`);
} }
// 返回带有面向用户的错误信息 // 返回带有面向用户的错误信息
return throwError(error); return throwError(
} error);
};
} }

10
src/app/pages/audit/audit-ing/audit-ing.component.ts

@ -438,10 +438,8 @@ export class AuditIngComponent implements OnInit {
async getAllOrganization() { async getAllOrganization() {
let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata")) let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata"))
.organization.id; .organization.id;
let OrganizationUnitIds = JSON.parse(
sessionStorage.getItem("userdata")
).organizations.map((v) => v.id);
let params = { let params = {
OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true", IsContainsChildren: "true",
}; };
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
@ -451,15 +449,9 @@ export class AuditIngComponent implements OnInit {
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items.forEach((element) => { data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) { if (element.id == OrganizationUnitId) {
element.parentId = null; element.parentId = null;
} }
}
element.key = element.id; element.key = element.id;
element.title = element.displayName; element.title = element.displayName;
}); });

452
src/app/pages/audit/audit-record/audit-record.component.ts

@ -1,59 +1,41 @@
import { HttpClient } from "@angular/common/http"; import { HttpClient } from '@angular/common/http';
import { Component, ElementRef, OnInit, ViewContainerRef } from "@angular/core"; import { Component, ElementRef, OnInit, ViewContainerRef } from '@angular/core';
import { FormBuilder, FormGroup } from "@angular/forms"; import { FormBuilder, FormGroup } from '@angular/forms';
import { NzModalService } from "ng-zorro-antd/modal"; import { NzModalService } from 'ng-zorro-antd/modal';
import { Observable, fromEvent } from "rxjs"; import { Observable, fromEvent } from 'rxjs';
import { debounceTime } from "rxjs/operators"; import { debounceTime } from 'rxjs/operators';
import { TreeService } from "src/app/service/tree.service"; import { TreeService } from 'src/app/service/tree.service';
import { DetailsFileCategoryComponent } from "../../license/file-category/details-file-category/details-file-category.component"; import { DetailsFileCategoryComponent } from '../../license/file-category/details-file-category/details-file-category.component';
import { DetailsUpdateCategoryComponent } from "../../license/update-category/details-update-category/details-update-category.component"; import { DetailsUpdateCategoryComponent } from '../../license/update-category/details-update-category/details-update-category.component';
import { AuditDetailsInformTimeComponent } from "../audit-inform-time/audit-details-inform-time/audit-details-inform-time.component"; import { AuditDetailsInformTimeComponent } from '../audit-inform-time/audit-details-inform-time/audit-details-inform-time.component';
import { AppealDetailsComponent } from "../audit-ing/appeal-details/appeal-details.component"; import { AppealDetailsComponent } from '../audit-ing/appeal-details/appeal-details.component';
import { UserDetailsComponent } from "../audit-ing/user-details/user-details.component"; import { UserDetailsComponent } from '../audit-ing/user-details/user-details.component';
import { GasBaseInfoComponent } from "../gas-base-info/gas-base-info.component"; import { GasBaseInfoComponent } from '../gas-base-info/gas-base-info.component';
@Component({ @Component({
selector: "app-audit-record", selector: 'app-audit-record',
templateUrl: "./audit-record.component.html", templateUrl: './audit-record.component.html',
styleUrls: ["./audit-record.component.scss"], styleUrls: ['./audit-record.component.scss']
}) })
export class AuditRecordComponent implements OnInit { export class AuditRecordComponent implements OnInit {
validateForm!: FormGroup; validateForm!: FormGroup;
constructor( constructor(private element: ElementRef, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private toTree: TreeService, private http: HttpClient, private fb: FormBuilder) { }
private element: ElementRef,
private modal: NzModalService,
private viewContainerRef: ViewContainerRef,
private toTree: TreeService,
private http: HttpClient,
private fb: FormBuilder
) {}
list = []; list = []
level = false; level = false
tableScrollHeight; tableScrollHeight
resizeListener; resizeListener
startdate; startdate
enddate; enddate
async ngOnInit(): Promise<void> { async ngOnInit(): Promise<void> {
if ( if (JSON.parse(sessionStorage.getItem('userdata')).organization.level == 1) {
JSON.parse(sessionStorage.getItem("userdata")).organization.level == 1 this.level = true
) {
this.level = true;
} }
this.tableScrollHeight = "100px"; this.tableScrollHeight = '100px'
// 页面监听 // 页面监听
this.resizeListener = fromEvent(window, "resize") this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => {
.pipe(debounceTime(100)) let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight
.subscribe((event) => { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 10) + 'px'
let tableHeader =
this.element.nativeElement.querySelector(
`.ant-table-header`
).clientHeight;
this.tableScrollHeight =
document.getElementById("tablebox").clientHeight -
tableHeader -
10 +
"px";
}); });
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
type: [null], type: [null],
@ -68,214 +50,172 @@ export class AuditRecordComponent implements OnInit {
let nowY = myDate.getFullYear(); let nowY = myDate.getFullYear();
let nowM = myDate.getMonth() + 1; let nowM = myDate.getMonth() + 1;
let nowD = myDate.getDate(); let nowD = myDate.getDate();
this.enddate = this.enddate = nowY + "-" + (nowM < 10 ? "0" + nowM : nowM) + "-" + (nowD < 10 ? "0" + nowD : nowD);//当前日期
nowY +
"-" +
(nowM < 10 ? "0" + nowM : nowM) +
"-" +
(nowD < 10 ? "0" + nowD : nowD); //当前日期
//获取三十天前日期 //获取三十天前日期
let lw = new Date(myDate - 1000 * 60 * 60 * 24 * 29);//最后一个数字30可改,30天的意思 let lw = new Date(myDate - 1000 * 60 * 60 * 24 * 29);//最后一个数字30可改,30天的意思
let lastY = lw.getFullYear(); let lastY = lw.getFullYear();
let lastM = lw.getMonth() + 1; let lastM = lw.getMonth() + 1;
let lastD = lw.getDate(); let lastD = lw.getDate();
this.startdate = this.startdate = lastY + "-" + (lastM < 10 ? "0" + lastM : lastM) + "-" + (lastD < 10 ? "0" + lastD : lastD);//三十天之前日期
lastY +
"-" +
(lastM < 10 ? "0" + lastM : lastM) +
"-" +
(lastD < 10 ? "0" + lastD : lastD); //三十天之前日期
this.getTypeList(); this.getTypeList()
await this.getAllOrganization(); await this.getAllOrganization()
this.getRecordList(); this.getRecordList()
this.warningType();
this.warningType()
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.resizeListener.unsubscribe(); this.resizeListener.unsubscribe()
} }
submitForm(): void { submitForm(): void {
if (this.validateForm.value.datePicker[0].toLocaleDateString) { if (this.validateForm.value.datePicker[0].toLocaleDateString) {
this.validateForm.value.datePicker[0] = this.validateForm.value.datePicker[0] = this.validateForm.value.datePicker[0].toLocaleDateString()
this.validateForm.value.datePicker[0].toLocaleDateString();
} }
if (this.validateForm.value.datePicker[1].toLocaleDateString) { if (this.validateForm.value.datePicker[1].toLocaleDateString) {
this.validateForm.value.datePicker[1] = this.validateForm.value.datePicker[1] = this.validateForm.value.datePicker[1].toLocaleDateString()
this.validateForm.value.datePicker[1].toLocaleDateString();
} }
this.list = []; this.list = []
this.SkipCount = "0"; this.SkipCount = '0'
this.getRecordList(); this.getRecordList()
} }
resetForm(e: MouseEvent): void { resetForm(e: MouseEvent): void {
e.preventDefault(); e.preventDefault();
this.validateForm.reset(); this.validateForm.reset();
this.validateForm.patchValue({ this.validateForm.patchValue({
organization: JSON.parse(sessionStorage.getItem("userdata")).organization organization: JSON.parse(sessionStorage.getItem('userdata')).organization.id,
.id,
datePicker: [this.startdate, this.enddate], datePicker: [this.startdate, this.enddate],
}); });
this.list = []; this.list = []
this.SkipCount = "0"; this.SkipCount = '0'
this.getRecordList(); this.getRecordList()
} }
//获取所有组织机构 //获取所有组织机构
nodes: any = []; nodes: any = []
async getAllOrganization() { async getAllOrganization() {
let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata")) let OrganizationUnitId = JSON.parse(sessionStorage.getItem('userdata')).organization.id
.organization.id;
let OrganizationUnitIds = JSON.parse(
sessionStorage.getItem("userdata")
).organizations?.map((v) => v.id);
let params = { let params = {
IsContainsChildren: "true", OrganizationUnitId: OrganizationUnitId,
}; IsContainsChildren: "true"
await new Promise((resolve, reject) => {
this.http
.get("/api/services/app/Organization/GetAll", {
params: params,
})
.subscribe((data: any) => {
data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
} }
} else { await new Promise((resolve, reject) => {
this.http.get('/api/services/app/Organization/GetAll', {
params: params
}).subscribe((data: any) => {
data.result.items.forEach(element => {
if (element.id == OrganizationUnitId) { if (element.id == OrganizationUnitId) {
element.parentId = null; element.parentId = null
}
} }
element.key = element.id; element.key = element.id
element.title = element.displayName; element.title = element.displayName
}); });
this.nodes = [...this.toTree.toTree(data.result.items)]; this.nodes = [...this.toTree.toTree(data.result.items)]
this.validateForm.patchValue({ this.validateForm.patchValue({
organization: JSON.parse(sessionStorage.getItem("userdata")) organization: JSON.parse(sessionStorage.getItem('userdata')).organization.id,
.organization.id,
datePicker: [this.startdate, this.enddate], datePicker: [this.startdate, this.enddate],
}); });
resolve(data); resolve(data)
});
}); })
})
} }
//证照类型 //证照类型
typeLoading; typeLoading
typeList; typeList
typeListOfUsers; typeListOfUsers
typeListOfStationData; typeListOfStationData
typeListOfUpdate; typeListOfUpdate
typeListOfFile; typeListOfFile
getTypeList() { getTypeList() {
this.typeLoading = true; this.typeLoading = true
let promiseArr = []; let promiseArr = []
let api = [ let api = ['/api/services/app/ValidityLicenseType/GetAll', '/api/services/app/FileLicenseType/GetAll']
"/api/services/app/ValidityLicenseType/GetAll", api.forEach(element => {
"/api/services/app/FileLicenseType/GetAll",
];
api.forEach((element) => {
promiseArr.push( promiseArr.push(
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
this.http this.http.get(element, {
.get(element, {
params: { params: {
SkipCount: "0", SkipCount: '0',
MaxResultCount: "999", MaxResultCount: '999'
}, }
}) }).subscribe({
.subscribe({
next: (data) => { next: (data) => {
resolve(data); resolve(data)
},
error: (err) => {
reject(err);
}, },
}); error: err => {
reject(err)
}
})
}) })
); )
}); });
Promise.all(promiseArr) Promise.all(promiseArr).then((result) => {
.then((result) => {
// console.log('审批类型', result) // console.log('审批类型', result)
this.typeListOfUsers = [{ licenseName: "用户信息" }]; this.typeListOfUsers = [{ licenseName: '用户信息' }]
this.typeListOfStationData = [{ licenseName: "油站信息" }]; this.typeListOfStationData = [{ licenseName: '油站信息' }]
this.typeListOfUpdate = result[0].result.items; this.typeListOfUpdate = result[0].result.items
this.typeListOfFile = result[1].result.items; this.typeListOfFile = result[1].result.items
this.typeList = [ this.typeList = [...this.typeListOfUsers, ...this.typeListOfStationData, ...this.typeListOfUpdate, ...this.typeListOfFile]
...this.typeListOfUsers, this.typeLoading = false
...this.typeListOfStationData, }).catch((error) => {
...this.typeListOfUpdate,
...this.typeListOfFile,
];
this.typeLoading = false;
}) })
.catch((error) => {});
} }
warningTypesDetails; warningTypesDetails
warningTypesDetailsCopy; warningTypesDetailsCopy
//获得所有预警事件 //获得所有预警事件
warningType() { warningType() {
this.http this.http.get('/api/services/app/Violation/GetAllList').subscribe((data: any) => {
.get("/api/services/app/Violation/GetAllList")
.subscribe((data: any) => {
data.result = data.result.filter((item) => { data.result = data.result.filter((item) => {
return ( return item.eventSystemName != '设备报废临期提醒' && item.eventSystemName != '设备维保临期提醒' && item.eventSystemName != '证照有效期办理提醒' && item.eventSystemName != '证照有效期临期提醒' && item.eventSystemName != '证照年检办理提醒' && item.eventSystemName != '证照年检临期提醒'
item.eventSystemName != "设备报废临期提醒" && })
item.eventSystemName != "设备维保临期提醒" &&
item.eventSystemName != "证照有效期办理提醒" &&
item.eventSystemName != "证照有效期临期提醒" &&
item.eventSystemName != "证照年检办理提醒" &&
item.eventSystemName != "证照年检临期提醒"
);
});
this.warningTypesDetails = JSON.parse(JSON.stringify(data.result)); this.warningTypesDetails = JSON.parse(JSON.stringify(data.result))
this.warningTypesDetailsCopy = JSON.parse(JSON.stringify(data.result)); //原始数据备份 this.warningTypesDetailsCopy = JSON.parse(JSON.stringify(data.result)) //原始数据备份
// console.log('所有预警事件', this.warningTypesDetailsCopy) // console.log('所有预警事件', this.warningTypesDetailsCopy)
}); })
} }
infoChange(e) { infoChange(e) {
if (e == "0") { if (e == '0') {
this.typeList = this.typeListOfStationData; this.typeList = this.typeListOfStationData
} else if (e == "1") { } else if (e == '1') {
this.typeList = this.typeListOfUpdate; this.typeList = this.typeListOfUpdate
} else if (e == "2") { } else if (e == '2') {
this.typeList = this.typeListOfUpdate; this.typeList = this.typeListOfUpdate
} else if (e == "3") { } else if (e == '3') {
this.typeList = this.typeListOfFile; this.typeList = this.typeListOfFile
} else if (e == "4") { } else if (e == '4') {
this.typeList = this.typeListOfUsers; this.typeList = this.typeListOfUsers
} else if (e == "5") { } else if (e == '5') {
this.typeList = [...this.warningTypesDetailsCopy]; this.typeList = [...this.warningTypesDetailsCopy]
} else { } else {
this.typeList = [ this.typeList = [...this.typeListOfStationData, ...this.typeListOfUpdate, ...this.typeListOfFile]
...this.typeListOfStationData,
...this.typeListOfUpdate,
...this.typeListOfFile,
];
} }
} }
//历史记录列表 //历史记录列表
totalCount; //列表总数 totalCount//列表总数
tableSpin = true; tableSpin = true
SkipCount: string = "0"; SkipCount: string = '0'
MaxResultCount: string = "50"; MaxResultCount: string = '50'
getRecordList() { getRecordList() {
this.tableSpin = true; this.tableSpin = true
let endTime = this.validateForm.value.datePicker[1] + " 23:59:59"; let endTime = this.validateForm.value.datePicker[1] + ' 23:59:59'
console.log("结束时间", endTime); console.log('结束时间', endTime)
let params = { let params = {
IsContainsChildren: "true", IsContainsChildren: 'true',
OrganizationUnitId: this.validateForm.value.organization, OrganizationUnitId: this.validateForm.value.organization,
AuditTitle: this.validateForm.value.type, AuditTitle: this.validateForm.value.type,
AuditType: this.validateForm.value.info, AuditType: this.validateForm.value.info,
@ -286,66 +226,57 @@ export class AuditRecordComponent implements OnInit {
Sorting: null, Sorting: null,
SkipCount: this.SkipCount, SkipCount: this.SkipCount,
MaxResultCount: this.MaxResultCount, MaxResultCount: this.MaxResultCount,
}; }
this.http this.http.get('/api/services/app/ContentAuditLog/GetHistory', { params }).subscribe((data: any) => {
.get("/api/services/app/ContentAuditLog/GetHistory", { params }) data.result.items.forEach(element => {
.subscribe((data: any) => { element.itemData = JSON.parse(element.itemData)
data.result.items.forEach((element) => {
element.itemData = JSON.parse(element.itemData);
}); });
this.list = this.list.concat(data.result.items); this.list = this.list.concat(data.result.items);
this.list = [...this.list]; this.list = [...this.list]
this.totalCount = data.result.totalCount; this.totalCount = data.result.totalCount
this.tableSpin = false; this.tableSpin = false
console.log("审核历史纪录", this.list); console.log('审核历史纪录', this.list)
setTimeout(() => { setTimeout(() => {
let tableHeader = let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight
this.element.nativeElement.querySelector( this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 10) + 'px'
`.ant-table-header`
).clientHeight;
this.tableScrollHeight =
document.getElementById("tablebox").clientHeight -
tableHeader -
10 +
"px";
}, 0); }, 0);
}); })
} }
details(item) { details(item) {
console.log("点击的item", item); console.log('点击的item', item)
let component; let component
if (item.auditType == 0) { if (item.auditType == 0) {
component = GasBaseInfoComponent; component = GasBaseInfoComponent
} else if (item.auditType == 1) { } else if (item.auditType == 1) {
component = AuditDetailsInformTimeComponent; component = AuditDetailsInformTimeComponent
} else if (item.auditType == 2) { } else if (item.auditType == 2) {
component = DetailsUpdateCategoryComponent; component = DetailsUpdateCategoryComponent
} else if (item.auditType == 4) { } else if (item.auditType == 4) {
component = UserDetailsComponent; component = UserDetailsComponent
} else if (item.auditType == 5) { } else if (item.auditType == 5) {
component = AppealDetailsComponent; component = AppealDetailsComponent
} else if (item.auditType) { } else if (item.auditType) {
component = DetailsFileCategoryComponent; component = DetailsFileCategoryComponent
} }
this.getData(item).then((res) => { this.getData(item).then(res => {
item.getData = res; item.getData = res
if (item.auditType == 1) { if (item.auditType == 1) {
item.getData.organization = item.organization; item.getData.organization = item.organization
} }
const modal = this.modal.create({ const modal = this.modal.create({
nzContent: component, nzContent: component,
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: item.auditType == 0 ? 700 : 450, nzWidth: item.auditType == 0 ? 700 : 450,
nzBodyStyle: { nzBodyStyle: {
border: "1px solid #91CCFF", 'border': '1px solid #91CCFF',
"border-radius": "0px", 'border-radius': '0px',
padding: "7px", 'padding': '7px',
"box-shadow": "0 0 8px 0 #fff", 'box-shadow': '0 0 8px 0 #fff',
"background-image": "linear-gradient(#003665, #000f25)", 'background-image': 'linear-gradient(#003665, #000f25)'
}, },
nzStyle: { nzStyle: {
top: "50px", 'top': '50px',
}, },
nzComponentParams: { nzComponentParams: {
data: item.getData, data: item.getData,
@ -354,75 +285,58 @@ export class AuditRecordComponent implements OnInit {
nzFooter: null, nzFooter: null,
nzClosable: false, nzClosable: false,
}); });
}); })
} }
//获取证照类data //获取证照类data
getData(item) { getData(item) {
let url; let url
if (item.auditType == 0) { if (item.auditType == 0) { //油站基本信息
//油站基本信息
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let organization = { organizationId: item.organizationId }; let organization = { organizationId: item.organizationId }
resolve(organization); resolve(organization)
}); })
} else if (item.auditType == 1) { } else if (item.auditType == 1) {
url = "/api/services/app/OrganizationValidityLicenseRule/Get"; url = '/api/services/app/OrganizationValidityLicenseRule/Get'
} else if (item.auditType == 2) { } else if (item.auditType == 2) {
url = "/api/services/app/StationValidityLicense/Get"; url = '/api/services/app/StationValidityLicense/Get'
} else if (item.auditType == 4) { } else if (item.auditType == 4) {
url = "/api/services/app/EdittingUser/Get"; url = '/api/services/app/EdittingUser/Get'
} else if (item.auditType == 5) { } else if (item.auditType == 5) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(item); resolve(item)
}); })
} else if (item.auditType) { } else if (item.auditType) {
url = "/api/services/app/StationFileLicense/Get"; url = '/api/services/app/StationFileLicense/Get'
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let params = { id: item.itemId }; let params = { id: item.itemId }
this.http.get(url, { params }).subscribe((data: any) => { this.http.get(url, { params }).subscribe((data: any) => {
let auditLog = { rejectReason: item.rejectReason }; let auditLog = { rejectReason: item.rejectReason }
let organization = { let organization = { displayName: item.organization ? item.organization.displayName : "" }
displayName: item.organization ? item.organization.displayName : "",
};
if (item.auditType == 1) { if (item.auditType == 1) {
data.result.auditLog = auditLog; data.result.auditLog = auditLog
data.result.organization = organization; data.result.organization = organization
data.result.handleRemindDaysDefault = data.result.handleRemindDaysDefault = data.result.licenseType.handleRemindDays
data.result.licenseType.handleRemindDays; data.result.closingRemindDaysDefault = data.result.licenseType.closingRemindDays
data.result.closingRemindDaysDefault =
data.result.licenseType.closingRemindDays;
} }
if (item.auditType == 2 || item.auditType == 3) { if (item.auditType == 2 || item.auditType == 3) {
data.result.auditLogId = item.id; data.result.auditLogId = item.id
} }
if (item.auditType == 4) { if (item.auditType == 4) {
data.result.auditLog = auditLog; data.result.auditLog = auditLog
} }
resolve(data.result); resolve(data.result)
}); })
}); })
} }
ngAfterViewInit(): void { ngAfterViewInit(): void {
fromEvent( fromEvent(this.element.nativeElement.querySelector(`.ant-table-body`) as HTMLCanvasElement, 'scroll').pipe(debounceTime(100)).subscribe((event: any) => { //监听 DOM 滚动事件
this.element.nativeElement.querySelector( if (event.target.scrollHeight - (event.target.scrollTop + event.target.clientHeight) <= 10) {
`.ant-table-body`
) as HTMLCanvasElement,
"scroll"
)
.pipe(debounceTime(100))
.subscribe((event: any) => {
//监听 DOM 滚动事件
if (
event.target.scrollHeight -
(event.target.scrollTop + event.target.clientHeight) <=
10
) {
if (this.totalCount > this.list.length) { if (this.totalCount > this.list.length) {
this.SkipCount = String(Number(this.SkipCount) + 50); this.SkipCount = String(Number(this.SkipCount) + 50)
this.getRecordList(); this.getRecordList()
} }
} }
}); });

4
src/app/pages/change-password/change-password.component.ts

@ -34,7 +34,7 @@ export class MyValidators extends Validators {
return null; return null;
} }
return isPassword(value) ? null : { mobile: { 'zh-cn': PatternService.isProd ? `长度至少 12 位,必须包含大写字母、小写字母、数字、符号四种中的三种,且口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符` : '长度至少 12 位,必须包含大写字母、小写字母、数字、符号四种中的三种', en: `Password phone number is not valid` } }; return isPassword(value) ? null : { mobile: { 'zh-cn': PatternService.isProd ? `长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种,且口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符` : '长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种', en: `Password phone number is not valid` } };
} }
} }
@ -42,5 +42,5 @@ function isEmptyInputValue(value: NzSafeAny): boolean {
return value == null || value.length === 0; return value == null || value.length === 0;
} }
function isPassword(value: string): boolean { function isPassword(value: string): boolean {
return typeof value === 'string' && /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)(?!.*[sS][iI][nN][oO].*)(?!.*[zZ][hH][oO][nN][gG][hH][uU][aA].*)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{12,99}$/.test(value); return typeof value === 'string' && /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)(?!.*[sS][iI][nN][oO].*)(?!.*[zZ][hH][oO][nN][gG][hH][uU][aA].*)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,99}$/.test(value);
} }

15
src/app/pages/gis-home/card-list/card-list.component.html

@ -0,0 +1,15 @@
<div class="box" cdkDrag>
<div class="title" cdkDragHandle>
<span>
{{title}}
</span>
<span class="close" (click)="close()">
<i nz-icon nzType="close" nzTheme="outline"></i>
</span>
</div>
<div class="content">
<ul>
<li *ngFor="let item of data">{{item}}</li>
</ul>
</div>
</div>

54
src/app/pages/gis-home/card-list/card-list.component.scss

@ -0,0 +1,54 @@
.box {
width: 280px;
font-size: 16px;
border: 1px solid #558DB1;
}
.title {
height: 32px;
line-height: 32px;
background-image: url(../../../../assets/gismap/listtitle.png);
background-size: 100% 100%;
background-repeat: no-repeat;
color: #fff;
box-sizing: border-box;
padding-left: 16px;
padding-right: 10px;
display: flex;
justify-content: space-between;
cursor: default;
.close{
cursor: pointer;
}
}
.content {
max-height: 250px;
overflow-y: auto;
ul{
margin-bottom: 0;
}
li {
height: 38px;
line-height: 38px;
padding-left: 16px;
padding-right: 10px;
color: #f7faff;
font-size: 15px;
cursor: pointer;
}
li:nth-child(odd) {
background: linear-gradient(
90deg,
RGBA(17, 50, 83, 1),
RGBA(17, 50, 83, 0.8)
);
}
li:nth-child(even) {
background: linear-gradient(
90deg,
RGBA(38, 56, 73, 1),
RGBA(38, 56, 73, 0.8)
);
border-top: 1px solid #3e4f60;
border-bottom: 1px solid #3e4f60;
}
}

20
src/app/pages/gis-home/card-list/card-list.component.ts

@ -0,0 +1,20 @@
import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
@Component({
selector: "app-card-list",
templateUrl: "./card-list.component.html",
styleUrls: ["./card-list.component.scss"],
})
export class CardListComponent implements OnInit {
@Input() title;
@Input() data;
@Output() childEvent = new EventEmitter<any>();
constructor() {}
ngOnInit(): void {}
close() {
this.childEvent.emit("closeCardList");
}
}

4
src/app/pages/gis-home/card-title/card-title.component.html

@ -0,0 +1,4 @@
<div class="box">
<span class="title">{{title}}</span>
<span class="subtitle">{{subtitle}}</span>
</div>

29
src/app/pages/gis-home/card-title/card-title.component.scss

@ -0,0 +1,29 @@
.box {
width: 100%;
height: 52px;
background-image: url(../../../../assets/gismap/cardtitle.png);
background-repeat: no-repeat;
background-size: 100% 100%;
position: absolute;
top: -6px;
left: 0px;
display: flex;
align-items: center;
.title {
font-size: 20px;
margin-left: 60px;
margin-top: 10px;
color: #fff;
font-family: titlefont;
// background: linear-gradient(to bottom, #fff, #88c3ec);
// -webkit-background-clip: text;
// -webkit-text-fill-color: transparent;
}
.subtitle {
font-size: 12px;
color: rgba(185, 233, 255, 0.4);
font-family: titlefont;
margin-left: 6px;
margin-top: 16px;
}
}

14
src/app/pages/gis-home/card-title/card-title.component.ts

@ -0,0 +1,14 @@
import { Component, Input, OnInit } from "@angular/core";
@Component({
selector: "app-card-title",
templateUrl: "./card-title.component.html",
styleUrls: ["./card-title.component.scss"],
})
export class CardTitleComponent implements OnInit {
@Input() title: string;
@Input() subtitle: string;
constructor() {}
ngOnInit(): void {}
}

67
src/app/pages/gis-home/gis-home.component.html

@ -0,0 +1,67 @@
<div class="box">
<div id="mapDiv"></div>
<div class="mask" style="pointer-events: none;"></div>
<div class="leftBox">
<div class="left1 cardItem"
(click)="urlTo('http://121.36.37.70:8201/planManagement/entryPlan?singleSignOn=true')">
<app-card-title [title]="'预案统计'" [subtitle]="'Plan statistics'"></app-card-title>
<app-unit-title [num]="21250" (childEvent)="handleChildData($event)"></app-unit-title>
<div class="content">
<div id="echartleft1"></div>
</div>
</div>
<div class="left2 cardItem" (click)="aHref($event,'ax://startup')">
<app-card-title [title]="'演练统计'" [subtitle]="'Exercise statistics'"></app-card-title>
<app-unit-title [num]="126"></app-unit-title>
<div class="content">
<div id="echartleft2"></div>
</div>
</div>
<div class="left3 cardItem" (click)="aHref($event,'ax2://startup')">
<app-card-title [title]="'风险管控平台统计'" [subtitle]="'Risk management'"></app-card-title>
<app-unit-title [num]="33"></app-unit-title>
<div class="content">
<div id="echartleft3"></div>
</div>
</div>
</div>
<div class="rightBox">
<div class="right1 cardItem" (click)="urlTo('http://121.36.37.70:8906/homepage?singleSignOn=true')">
<app-card-title [title]="'接入类型'" [subtitle]="'Intervention type'"></app-card-title>
<div class="content">
<div class="accessList">
<div class="accessitem" *ngFor="let item of accessList">
<div class="img">
<img [src]="item.img" alt="">
</div>
<div class="namebox">
<span class="name">{{item.name}}</span>
<span class="value" [ngStyle]="{'color': item.color}">{{item.value}}</span>
</div>
</div>
</div>
</div>
</div>
<div class="right2 cardItem" (click)="urlTo('http://121.36.37.70:8906/todaywarning?singleSignOn=true')">
<app-card-title [title]="'预警统计'" [subtitle]="'Warning statistics'"></app-card-title>
<div class="content">
<div id="echartright1"></div>
</div>
</div>
<div class="right3 cardItem"
(click)="urlTo('http://121.36.37.70:8906/records_nav/oliunloadinglist?singleSignOn=true')">
<app-card-title [title]="'卸油事件'" [subtitle]="'Oil unloading event'"></app-card-title>
<div class="content">
<div id="echartright2"></div>
<div id="echartright3"></div>
</div>
</div>
</div>
<div class="unitList" [hidden]="!isConnectedUnit">
<app-card-list [title]="'已接入单位'" [data]="unitList1" (childEvent)="handleChildData($event)"></app-card-list>
</div>
<div class="secretkey" (dblclick)="secretkeyTo()"></div>
</div>

156
src/app/pages/gis-home/gis-home.component.scss

@ -0,0 +1,156 @@
.box {
width: 100%;
height: 100%;
position: relative;
}
.mask {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 500;
// background: radial-gradient(
// rgba(255, 255, 255, 0) 0%,
// rgba(6, 24, 50, 0.6) 50%,
// rgb(5, 26, 56) 100%
// );
background: radial-gradient(
rgba(255, 255, 255, 0),
rgba(255, 255, 255, 0),
rgba(6, 24, 50, 0.6),
rgba(6, 24, 50, 1)
);
}
#mapDiv {
width: 100%;
height: 100%;
}
.leftBox,
.rightBox {
width: 430px;
height: 100%;
position: absolute;
top: 0;
z-index: 500;
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
padding-top: 20px;
padding-bottom: 10px;
}
.leftBox {
left: 20px;
.left1 {
height: 38%;
}
.left2 {
height: 29%;
}
.left3 {
height: 29%;
}
}
.rightBox {
right: 20px;
.right1 {
height: 25%;
}
.right2 {
height: 34%;
}
.right3 {
height: 38%;
}
}
.cardItem {
background-image: url(../../../assets/gismap/cardbg.png);
background-repeat: no-repeat;
background-size: 100% 100%;
position: relative;
box-sizing: border-box;
padding-top: 50px;
display: flex;
flex-direction: column;
.content {
flex: 1;
position: relative;
}
}
.accessList {
display: flex;
flex-wrap: wrap;
align-items: center;
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 12px 35px 12px 12px;
.accessitem {
width: 50%;
display: flex;
align-items: center;
.img {
margin-left: 20%;
margin-right: 12px;
}
.namebox {
display: flex;
flex-direction: column;
justify-content: center;
.name {
font-size: 16px;
// font-family: Alibaba PuHuiTi;
font-weight: 500;
color: #ffffff;
}
.value {
font-size: 20px;
font-family: DINPro;
font-weight: bold;
color: #479ffe;
}
}
}
}
#echartleft1,
#echartleft2,
#echartleft3,
#echartright1 {
width: 100%;
height: 100%;
}
#echartright2 {
width: 100%;
height: 60%;
}
#echartright3 {
width: 100%;
height: 45%;
position: absolute;
left: 0;
bottom: 0;
}
.unitList {
position: absolute;
left: 24%;
top: 2%;
z-index: 500;
}
.secretkey {
position: absolute;
right: 0;
bottom: 0;
width: 5px;
height: 5px;
cursor: pointer;
z-index: 999;
}

1401
src/app/pages/gis-home/gis-home.component.ts

File diff suppressed because it is too large Load Diff

6
src/app/pages/gis-home/unit-title/unit-title.component.html

@ -0,0 +1,6 @@
<div class="box">
<div class="numbox">
截至{{time}} , 已接入单位数 : <div class="num" *ngFor="let item of numArr">{{item}}</div>
</div>
<!-- <button class="btn" (click)="select($event)">选择</button> -->
</div>

36
src/app/pages/gis-home/unit-title/unit-title.component.scss

@ -0,0 +1,36 @@
.box {
color: #fff;
display: flex;
align-items: center;
font-size: 13px;
margin-top: 3px;
margin-left: 30px;
}
.numbox {
display: flex;
align-items: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 12px;
.num {
width: 22px;
height: 22px;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid rgba(129, 197, 200, 0.6);
font-family: DS-Digital;
font-weight: bold;
color: #ef9c00;
margin: 0 2px;
}
}
.btn {
width: 50px;
height: 24px;
border: 1px solid #46bbf1;
background: linear-gradient(0deg, #4ad0ff 0%, #2d3d5b 100%);
border-radius: 3px;
cursor: pointer;
}

48
src/app/pages/gis-home/unit-title/unit-title.component.ts

@ -0,0 +1,48 @@
import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
@Component({
selector: "app-unit-title",
templateUrl: "./unit-title.component.html",
styleUrls: ["./unit-title.component.scss"],
})
export class UnitTitleComponent implements OnInit {
@Input() num: number;
@Output() childEvent = new EventEmitter<any>();
constructor() {}
time: string;
ngOnInit(): void {
console.log(this.num);
this.getTime();
this.transformationNum(this.num);
}
getTime() {
let today = new Date();
let year = today.getFullYear();
let month = today.getMonth() + 1; // 月份是从0开始的,所以要加1
let day = today.getDate();
this.time = year + "/" + month + "/" + day;
}
numArr = [];
transformationNum(num) {
let str = String(num);
switch (str.length) {
case 1:
this.numArr = ["0", "0", str];
break;
case 2:
this.numArr = ["0", str[0], str[1]];
break;
default:
this.numArr = str.split("");
}
}
select(event) {
event.stopPropagation();
this.childEvent.emit("openCardList");
}
}

328
src/app/pages/home-page-comprehensive/home-page-comprehensive.component.html

@ -1,328 +0,0 @@
<div class="homepagebox">
<div class="informbox">
<div class="warningnumber">
<img src="../../../assets/images/warningnum.png" alt="">
<span class="num">{{totalCount}}</span>
<span class="today" (click)="getUnreadNotification()">今日预警</span>
</div>
<div class="inform">
<div class="infologo">
<img src="../../../assets/images/inform.png" alt="">
通知
</div>
<!-- 循环轮播信息 -->
<div id="container" (mouseenter)="mouseEnter()" (mouseleave)="mouseleave()">
<div id="list-wrapper" style="top: 0">
<ul class="notice-list" id="notice-list">
<li class="info" *ngFor="let item of unreadMessageList;let key = index">
<div class="infoitem">
<img src="../../../assets/images/warning1.png" alt="">
您有一条新的预警信息!{{item.notification.data.violationName}}
</div>
<div class="btn">
<span (click)="look(item)">查看</span>
<span (click)="ignore(key)">忽略</span>
</div>
</li>
</ul>
<ul class="notice-list" id="notice-list-2">
</ul>
</div>
</div>
</div>
</div>
<div class="centerbox">
<div class="title">
<app-title [name]="'统计分析'"></app-title>
</div>
<div class="content_box">
<div class="leftitem leftitemlimit">
<div class="eventechartpieAll" id="eventechartpieAll">
</div>
<nz-spin *ngIf="isSpin" nzSimple class="nzspin"></nz-spin>
</div>
<div class="leftitem ranking">
<span class="itemname">油站近30天事件排名</span>
<div class="box eventbox">
<div class="eventboxitem" *ngFor="let item of HomeAggregatioData.violationNameAgg;let key = index">
<div class="eventname" [title]="item.eventSystemName">
<div class="block" [ngClass]="{'yellow': key < 3,'blue': key > 2}">
<ng-container *ngIf="key != 9; else elseTemplate">
{{'0' + (key + 1)}}
</ng-container>
<ng-template #elseTemplate>
{{key + 1}}
</ng-template>
</div>
{{item.eventSystemName}}
</div>
<div class="progressbox">
<div class="progress">
<div class="colorbar"
[ngStyle]="width(item.count,HomeAggregatioData.violationNameAgg[0].count)"
[ngClass]="{'yellow': key < 3,'blue': key > 2}">
</div>
</div>
</div>
<div style="margin-left: 6px;">
{{item.count}}
</div>
</div>
</div>
<nz-spin *ngIf="isSpin" nzSimple class="nzspin"></nz-spin>
</div>
<div class="leftitem ranking" style="margin-left: 50px;">
<span class="itemname">近30天油站排名</span>
<div class="box eventbox">
<div class="eventboxitem" *ngFor="let item of HomeAggregatioData.stationAgg;let key = index">
<div class="eventname" [title]="item.companyName + item.stationName">
<div class="block" [ngClass]="{'yellow': key < 3,'blue': key > 2}">
<ng-container *ngIf="key != 9; else elseTemplate">
{{'0' + (key + 1)}}
</ng-container>
<ng-template #elseTemplate>
{{key + 1}}
</ng-template>
</div>
{{item.companyName}} {{item.stationName}}
</div>
<div class="progressbox">
<div class="progress">
<div class="colorbar"
[ngStyle]="width(item.count,HomeAggregatioData.stationAgg[0].count)"
[ngClass]="{'yellow': key < 3,'blue': key > 2}">
</div>
</div>
</div>
<div style="margin-left: 6px;">
{{item.count}}
</div>
</div>
</div>
<nz-spin *ngIf="isSpin" nzSimple class="nzspin"></nz-spin>
</div>
<div class="rightitem">
<div class="numlistbox">
<img src="../../../assets/images/stationNum.png" alt="">
<div class="content">
<span class="lightspan lightspan1">{{HomeAggregatioData.dev.stationCount}}</span>
<span>接入油站(个)</span>
</div>
</div>
<div class="numlistbox">
<img src="../../../assets/images/modelNum.png" alt="">
<div class="content">
<span class="lightspan lightspan2">{{HomeAggregatioData.dev.violationCount}}</span>
<span>预警分析模型(个)</span>
</div>
</div>
<div class="numlistbox">
<img src="../../../assets/images/cameraNum.png" alt="">
<div class="content">
<span class="lightspan lightspan3">{{HomeAggregatioData.dev.cameraCount}}</span>
<span>摄像头(个)</span>
</div>
</div>
</div>
<div class="angle-border left-top-border"></div>
<div class="angle-border right-top-border"></div>
<div class="angle-border left-bottom-border"></div>
<div class="angle-border right-bottom-border"></div>
</div>
<div class="content_box">
<div class="leftitem leftitemlimit">
<div class="eventechartpieAll" id="eventechartpieAll_YK">
</div>
<nz-spin *ngIf="isSpin_YK" nzSimple class="nzspin"></nz-spin>
</div>
<div class="leftitem ranking">
<span class="itemname">油库近30天事件排名</span>
<div class="box eventbox">
<div class="eventboxitem"
*ngFor="let item of HomeAggregatioData_YK.violationNameAgg;let key = index">
<div class="eventname" [title]="item.eventSystemName">
<div class="block" [ngClass]="{'yellow': key < 3,'blue': key > 2}">
<ng-container *ngIf="key != 9; else elseTemplate">
{{'0' + (key + 1)}}
</ng-container>
<ng-template #elseTemplate>
{{key + 1}}
</ng-template>
</div>
{{item.eventSystemName}}
</div>
<div class="progressbox">
<div class="progress">
<div class="colorbar"
[ngStyle]="width(item.count,HomeAggregatioData_YK.violationNameAgg[0].count)"
[ngClass]="{'yellow': key < 3,'blue': key > 2}">
</div>
</div>
</div>
<div style="margin-left: 6px;">
{{item.count}}
</div>
</div>
</div>
<nz-spin *ngIf="isSpin_YK" nzSimple class="nzspin"></nz-spin>
</div>
<div class="leftitem ranking" style="margin-left: 50px;">
<span class="itemname">近30天油库排名</span>
<div class="box eventbox">
<div class="eventboxitem" *ngFor="let item of HomeAggregatioData_YK.stationAgg;let key = index">
<div class="eventname" [title]="item.companyName + item.stationName">
<div class="block" [ngClass]="{'yellow': key < 3,'blue': key > 2}">
<ng-container *ngIf="key != 9; else elseTemplate">
{{'0' + (key + 1)}}
</ng-container>
<ng-template #elseTemplate>
{{key + 1}}
</ng-template>
</div>
{{item.companyName}} {{item.stationName}}
</div>
<div class="progressbox">
<div class="progress">
<div class="colorbar"
[ngStyle]="width(item.count,HomeAggregatioData_YK.stationAgg[0].count)"
[ngClass]="{'yellow': key < 3,'blue': key > 2}">
</div>
</div>
</div>
<div style="margin-left: 6px;">
{{item.count}}
</div>
</div>
</div>
<nz-spin *ngIf="isSpin_YK" nzSimple class="nzspin"></nz-spin>
</div>
<div class="rightitem">
<div class="numlistbox">
<img src="../../../assets/images/stationNum.png" alt="">
<div class="content">
<span class="lightspan lightspan1">{{HomeAggregatioData_YK.dev.stationCount}}</span>
<span>接入油库(个)</span>
</div>
</div>
<div class="numlistbox">
<img src="../../../assets/images/modelNum.png" alt="">
<div class="content">
<span class="lightspan lightspan2">{{HomeAggregatioData_YK.dev.violationCount}}</span>
<span>预警分析模型(个)</span>
</div>
</div>
<div class="numlistbox">
<img src="../../../assets/images/cameraNum.png" alt="">
<div class="content">
<span class="lightspan lightspan3">{{HomeAggregatioData_YK.dev.cameraCount}}</span>
<span>摄像头(个)</span>
</div>
</div>
</div>
<div class="angle-border left-top-border"></div>
<div class="angle-border right-top-border"></div>
<div class="angle-border left-bottom-border"></div>
<div class="angle-border right-bottom-border"></div>
</div>
</div>
<div class="bottombox">
<div class="bottomitem">
<div class="title" style="padding-left: 20px;">
<app-title [name]="'预警走势'"></app-title>
</div>
<div class="bottomitemcontent bottomitemcontent1">
<div class="bottomitemchartboxspecial">
<span class="bartitle">油站近30天预警事件统计</span>
<div class="eventechartpie" id="eventechartpie"></div>
<div class="eventechartline" id="eventechartline"></div>
<div class="angle-border left-top-border"></div>
<div class="angle-border right-top-border"></div>
<div class="angle-border left-bottom-border"></div>
<div class="angle-border right-bottom-border"></div>
<nz-spin *ngIf="isSpinOfEventWarning" nzSimple class="nzspin"></nz-spin>
</div>
</div>
<div class="bottomitemcontent bottomitemcontent2">
<div class="bottomitemchartboxspecial">
<span class="bartitle">油库近30天预警事件统计</span>
<div class="eventechartpie" id="eventechartpie_YK"></div>
<div class="eventechartline" id="eventechartline_YK"></div>
<div class="angle-border left-top-border"></div>
<div class="angle-border right-top-border"></div>
<div class="angle-border left-bottom-border"></div>
<div class="angle-border right-bottom-border"></div>
<nz-spin *ngIf="isSpinOfEventWarning_YK" nzSimple class="nzspin"></nz-spin>
</div>
</div>
</div>
<div class="bottomitem">
<div class="title">
<app-title [name]="'事件监督'"></app-title>
</div>
<div class="bottomitemcontent bottomitemcontent3">
<div class="bottomitemchartboxspecial">
<span class="bartitle">油站近30天卸油预警走势</span>
<div class="eventechartpie" id="oilechartpie"></div>
<div style="height: 80%;" class="eventechartline" id="oilechartline"></div>
<div class="angle-border left-top-border"></div>
<div class="angle-border right-top-border"></div>
<div class="angle-border left-bottom-border"></div>
<div class="angle-border right-bottom-border"></div>
<nz-spin *ngIf="isSpinOfOilDischarge" nzSimple class="nzspin"></nz-spin>
<div class="oilNum">
<div class="oilNumItem">
<div class="pointbox">
<div class="point"></div>
<span>累计卸油总车次</span>
</div>
{{HomeAggregatioData.ouViolationType.ouTotalCount}}
</div>
<div class="oilNumItem">
<div class="pointbox">
<div class="point"></div>
<span>累计卸油预警车次</span>
</div>
{{HomeAggregatioData.ouViolationType.ouNotCorrectCount}}
</div>
</div>
</div>
</div>
<div class="bottomitemcontent bottomitemcontent4">
<div class="bottomitemchartboxspecial">
<span class="bartitle">油库近30天发油预警走势</span>
<div class="eventechartpie" id="oilechartpie_YK"></div>
<div style="height: 80%;" class="eventechartline" id="oilechartline_YK"></div>
<div class="angle-border left-top-border"></div>
<div class="angle-border right-top-border"></div>
<div class="angle-border left-bottom-border"></div>
<div class="angle-border right-bottom-border"></div>
<nz-spin *ngIf="isSpinOfOilDischarge_YK" nzSimple class="nzspin"></nz-spin>
<div class="oilNum">
<div class="oilNumItem">
<div class="pointbox">
<div class="point"></div>
<span>累计发油总车次</span>
</div>
{{HomeAggregatioData_YK.ouViolationType.ouTotalCount}}
</div>
<div class="oilNumItem">
<div class="pointbox">
<div class="point"></div>
<span>累计发油预警车次</span>
</div>
{{HomeAggregatioData_YK.ouViolationType.ouNotCorrectCount}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>

578
src/app/pages/home-page-comprehensive/home-page-comprehensive.component.scss

@ -1,578 +0,0 @@
.homepagebox {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.informbox {
width: 100%;
height: 45px;
margin: 10px 0;
display: flex;
box-sizing: border-box;
padding: 0 22px;
align-items: center;
justify-content: space-between;
.warningnumber {
width: 250px;
display: flex;
align-items: center;
img {
width: 60px;
}
.num {
font-size: 32px;
text-shadow: 0px 0px 6px #8df;
color: white;
font-weight: 600;
margin: 0 8px;
}
.today {
font-size: 18px;
font-family: titlefont;
color: #d0eaff;
margin-bottom: 13px;
margin-left: 4px;
}
}
.inform {
flex: 1;
border: 1px solid rgba(54, 162, 255, 0.4);
height: 45px;
display: flex;
align-items: center;
justify-content: space-between;
.infologo {
img {
width: 32px;
}
height: 32px;
line-height: 32px;
color: #91ccff;
font-size: 14px;
margin-left: 16px;
margin-right: 40px;
}
#container {
flex: 1;
position: relative;
height: 46px;
overflow: hidden;
}
#list-wrapper {
position: relative;
}
ul {
list-style: none;
}
.info {
flex: 1;
display: flex;
height: 46px;
line-height: 46px;
color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
.infoitem {
flex: 1;
display: flex;
align-items: center;
img {
width: 40px;
}
color: #fff;
}
.btn {
color: #36a2ff;
span {
cursor: pointer;
}
span:nth-child(1) {
margin-right: 24px;
}
span:nth-child(2) {
margin-right: 40px;
}
}
}
}
}
.centerbox {
height: 45%;
width: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
box-sizing: border-box;
.title {
box-sizing: border-box;
padding: 0 20px;
width: 100%;
height: 40px;
}
.content_box {
position: relative;
flex: 1;
display: flex;
box-sizing: border-box;
margin: 5px 30px;
border: 1px solid rgba(54, 162, 255, 0.3);
.leftitem {
position: relative;
flex: 1;
box-sizing: border-box;
display: flex;
flex-direction: column;
.eventechartpieAll {
width: 100%;
height: 100%;
}
.progress {
height: 4px;
width: 100%;
background: rgba(54, 162, 255, 0.2);
position: relative;
.colorbar {
height: 4px;
left: 0;
top: 0;
}
.red {
color: #ff4b65;
background: linear-gradient(
90deg,
rgba(255, 75, 101, 0) 0%,
#ff4b65 100%
);
}
.yellow {
color: #ff9963;
background: linear-gradient(
90deg,
rgba(255, 153, 99, 0) 0%,
#ff9963 100%
);
}
.blue {
color: #36a2ff;
background: linear-gradient(
90deg,
rgba(54, 162, 255, 0) 0%,
#36a2ff 100%
);
}
}
.itemname {
color: #fff;
font-size: 13px;
}
.box {
flex: 1;
width: 100%;
}
.areabox {
display: flex;
flex-direction: column;
justify-content: space-around;
.areaboxitemtop {
display: flex;
justify-content: space-between;
align-items: center;
color: #ffffff;
font-size: 14px;
margin-bottom: 12px;
.red {
color: #ff4b65;
}
.yellow {
color: #ff9963;
}
.blue {
color: #36a2ff;
}
}
}
.eventbox {
display: flex;
flex-direction: column;
justify-content: space-around;
.eventboxitem {
display: flex;
align-items: center;
color: #fff;
font-size: 12px;
.eventname {
display: inline-block;
width: 30%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.block {
display: inline-block;
width: 14px;
height: 14px;
line-height: 12px;
font-size: 8px;
color: #fff;
}
.yellow {
background-color: #ff9963;
}
.blue {
background-color: #36a2ff;
}
}
.progressbox {
flex: 1;
}
}
}
.stationbox {
display: flex;
flex-direction: column;
justify-content: space-around;
.stationboxitem {
display: flex;
align-items: center;
color: #fff;
font-size: 12px;
.stationname {
display: inline-block;
width: 50%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.block {
display: inline-block;
width: 14px;
height: 14px;
line-height: 12px;
font-size: 8px;
color: #fff;
}
.yellow {
background-color: #ff9963;
}
.blue {
background-color: #36a2ff;
}
}
.area {
flex: 1;
.yellow {
color: #ff9963;
}
.blue {
color: #36a2ff;
}
}
}
}
}
.leftitemlimit {
max-width: 280px;
}
.ranking {
flex: 1;
padding: 5px 0;
}
.rightitem {
width: 400px;
position: relative;
height: 100%;
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
padding: 12px 0;
padding-top: 20px;
margin-left: 30px;
.numlistbox {
height: 64px;
width: 50%;
display: flex;
align-items: center;
img {
width: 45px;
height: 45px;
margin-right: 18px;
}
.content {
display: flex;
flex-direction: column;
justify-content: flex-start;
span {
color: white;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.lightspan {
font-size: 22px;
font-weight: 600;
line-height: 28px;
}
.lightspan1 {
text-shadow: 0px 0px 16px #3a9aff;
}
.lightspan2 {
text-shadow: 0px 0px 16px #23d9ff;
}
.lightspan3 {
text-shadow: 0px 0px 16px #ffb791;
}
}
}
}
}
}
.bottombox {
flex: 1;
display: flex;
.title {
box-sizing: border-box;
width: 100%;
height: 40px;
}
.bottomitem {
flex: 1;
height: 100%;
display: flex;
flex-direction: column;
.bottomitemcontent {
flex: 1;
box-sizing: border-box;
.bottomitemchartbox {
position: relative;
height: 100%;
border: 1px solid rgba(54, 162, 255, 0.3);
display: flex;
.numlistbox {
position: absolute;
left: 5%;
bottom: 6%;
display: flex;
flex-direction: column;
.numlistboxitem {
display: flex;
color: #fff;
align-items: center;
margin: 3px 0;
span {
font-size: 12px;
}
.top {
display: inline-block;
width: 15px;
height: 15px;
line-height: 15px;
text-align: center;
font-size: 8px;
border-radius: 2px;
}
.top1 {
background: #ff4b65;
}
.top2 {
background: #ff9963;
}
.top3 {
background: #36a2ff;
}
.name {
margin: 0 16px;
}
}
}
.eventechartpie,
.oilechartpie {
height: 100%;
width: 23%;
position: relative;
}
.eventechartline,
.oilechartline {
height: 100%;
flex: 1;
}
}
.bottomitemchartboxspecial {
position: relative;
height: 100%;
width: 100%;
border: 1px solid rgba(54, 162, 255, 0.3);
display: flex;
.bartitle {
position: absolute;
top: 5px;
left: 20px;
color: #ffffff;
font-size: 13px;
}
.eventechartpie {
height: 100%;
width: 100%;
position: relative;
}
.eventechartline {
position: absolute;
right: 0;
bottom: 0;
height: 83%;
width: 76%;
}
.oilNum {
position: absolute;
left:40px;
bottom: 5px;
display: flex;
flex-direction: column;
.oilNumItem {
display: flex;
align-items: center;
justify-content: space-between;
color: white;
font-size: 12px;
span {
margin: 0 4px;
}
.pointbox {
display: flex;
align-items: center;
}
.point {
width: 6px;
height: 6px;
background-color: #91ccff;
}
}
}
}
}
.bottomitemcontent1 {
padding: 5px 0 10px 30px;
}
.bottomitemcontent2 {
padding: 0px 0 10px 30px;
}
.bottomitemcontent3 {
padding: 5px 30px 10px 20px;
}
.bottomitemcontent4 {
padding: 0px 30px 10px 20px;
}
}
}
.angle-border {
position: absolute;
width: 8px;
height: 8px;
}
.left-top-border {
top: 0;
left: 0;
border-left: 2px solid #ffffff;
border-top: 2px solid #ffffff;
}
.right-top-border {
top: 0;
right: -2px;
border-right: 2px solid #ffffff;
border-top: 2px solid #ffffff;
}
.left-bottom-border {
bottom: 0;
left: 0;
border-bottom: 2px solid #ffffff;
border-left: 2px solid #ffffff;
}
.right-bottom-border {
bottom: 0;
right: -2px;
border-right: 2px solid #ffffff;
border-bottom: 2px solid #ffffff;
}

1786
src/app/pages/home-page-comprehensive/home-page-comprehensive.component.ts

File diff suppressed because it is too large Load Diff

10
src/app/pages/home-page/home-page.component.html

@ -46,7 +46,7 @@
</div> </div>
<img class="bucket" src="../../../assets/images/bucket.png" alt=""> <img class="bucket" src="../../../assets/images/bucket.png" alt="">
<img class="circle" src="../../../assets/images/circle.png" alt=""> --> <img class="circle" src="../../../assets/images/circle.png" alt=""> -->
<div class="eventechartpieAll" id="eventechartpieAll_YZ"> <div class="eventechartpieAll" id="eventechartpieAll">
</div> </div>
@ -233,11 +233,11 @@
<div class="bottomitemcontent bottomitemcontent1"> <div class="bottomitemcontent bottomitemcontent1">
<div class="bottomitemchartboxspecial"> <div class="bottomitemchartboxspecial">
<span class="bartitle">近30天预警事件统计</span> <span class="bartitle">近30天预警事件统计</span>
<div class="eventechartpie" id="eventechartpie_YZ"> <div class="eventechartpie" id="eventechartpie">
</div> </div>
<div class="eventechartline" id="eventechartline_YZ"> <div class="eventechartline" id="eventechartline">
</div> </div>
<div class="angle-border left-top-border"></div> <div class="angle-border left-top-border"></div>
@ -255,10 +255,10 @@
<div class="bottomitemcontent bottomitemcontent1"> <div class="bottomitemcontent bottomitemcontent1">
<div class="bottomitemchartboxspecial"> <div class="bottomitemchartboxspecial">
<span class="bartitle">近30天卸油预警走势</span> <span class="bartitle">近30天卸油预警走势</span>
<div class="eventechartpie" id="oilechartpie_YZ"> <div class="eventechartpie" id="oilechartpie">
</div> </div>
<div style="height: 80%;" class="eventechartline" id="oilechartline_YZ"> <div style="height: 80%;" class="eventechartline" id="oilechartline">
</div> </div>
<div class="angle-border left-top-border"></div> <div class="angle-border left-top-border"></div>

14
src/app/pages/home-page/home-page.component.ts

@ -533,14 +533,14 @@ export class HomePageComponent implements OnInit {
// 饼图 // 饼图
this.warningechartpieAll = echarts.init( this.warningechartpieAll = echarts.init(
document.getElementById("eventechartpieAll_YZ"), document.getElementById("eventechartpieAll"),
null, null,
{ devicePixelRatio: 2 } { devicePixelRatio: 2 }
); );
// this.equipmentechart = echarts.init(document.getElementById('equipmentechart')); // this.equipmentechart = echarts.init(document.getElementById('equipmentechart'));
// 预警饼图 // 预警饼图
this.warningechartpie = echarts.init( this.warningechartpie = echarts.init(
document.getElementById("eventechartpie_YZ"), document.getElementById("eventechartpie"),
null, null,
{ devicePixelRatio: 2 } { devicePixelRatio: 2 }
); );
@ -556,12 +556,12 @@ export class HomePageComponent implements OnInit {
}); });
// 预警线图 // 预警线图
this.warningechartbar = echarts.init( this.warningechartbar = echarts.init(
document.getElementById("eventechartline_YZ") document.getElementById("eventechartline")
); );
// 卸油饼图 // 卸油饼图
this.oilchartpie = echarts.init( this.oilchartpie = echarts.init(
document.getElementById("oilechartpie_YZ"), document.getElementById("oilechartpie"),
null, null,
{ devicePixelRatio: 2 } { devicePixelRatio: 2 }
); );
@ -576,7 +576,7 @@ export class HomePageComponent implements OnInit {
this.get30daysViolate(false, arr); this.get30daysViolate(false, arr);
}); });
// 卸油线图 // 卸油线图
this.oilchartbar = echarts.init(document.getElementById("oilechartline_YZ")); this.oilchartbar = echarts.init(document.getElementById("oilechartline"));
window.onresize = () => { window.onresize = () => {
setTimeout(() => { setTimeout(() => {
@ -614,8 +614,6 @@ export class HomePageComponent implements OnInit {
this.warningechartbar.dispose(); this.warningechartbar.dispose();
this.oilchartpie.dispose(); this.oilchartpie.dispose();
this.oilchartbar.dispose(); this.oilchartbar.dispose();
this.mouseEnter();
} }
resolutionRatio() { resolutionRatio() {
@ -801,7 +799,7 @@ export class HomePageComponent implements OnInit {
? (this.isSpinOfEventWarning = true) ? (this.isSpinOfEventWarning = true)
: (this.isSpinOfOilDischarge = true); : (this.isSpinOfOilDischarge = true);
let params = { let params = {
// OrganizationUnitId: this.organizationUnitId, OrganizationUnitId: this.organizationUnitId,
IsContainsChildren: true, IsContainsChildren: true,
ViolationTypes: type ? data : null, ViolationTypes: type ? data : null,
EventSystemNames: type ? null : data, EventSystemNames: type ? null : data,

81
src/app/pages/home/home.component.html

@ -1,27 +1,15 @@
<div class="box"> <div class="box">
<div class="menu"> <div class="menu">
<div class="boxleft"> <!-- <div class="boxleft">
<img *ngIf="isProd" src="../../../assets/images/logo2.png" alt=""> <img *ngIf="isProd" src="../../../assets/images/logo2.png" alt="">
</div> </div> -->
<!-- <div class="libox" *ngIf="!isGasStationNav">
<div class="libox" *ngIf="!isGasStationNav && isComprehensive">
<li class="router-link-active">
AI视频预警统计
</li>
</div>
<div class="libox" *ngIf="!isGasStationNav && !isComprehensive">
<li *ngFor="let item of menuList1" (click)="routerChange(item)" <li *ngFor="let item of menuList1" (click)="routerChange(item)"
[ngClass]="{'router-link-active': item.name == selectedItem}"> [ngClass]="{'router-link-active': item.name == selectedItem}">
{{item.name}} {{item.name}}
</li> </li>
</div> </div>
<div class="libox" *ngIf="isGasStationNav">
<div class="libox" *ngIf="isGasStationNav && isComprehensive">
<li class="router-link-active">
AI视频预警统计
</li>
</div>
<div class="libox" *ngIf="isGasStationNav && !isComprehensive">
<ng-container *ngIf="isGasStationBack; else elseTemplate"> <ng-container *ngIf="isGasStationBack; else elseTemplate">
<li [routerLink]="['/plan/petrolStation']" routerLinkActive="router-link-active"> <li [routerLink]="['/plan/petrolStation']" routerLinkActive="router-link-active">
数字油站 数字油站
@ -33,8 +21,13 @@
{{item.name}} {{item.name}}
</li> </li>
</ng-template> </ng-template>
</div> -->
<div class="libox">
<li *ngFor="let item of menubeijing" (click)="routerChange(item)"
[ngClass]="{'router-link-active': item.name == selectedItem}">
{{item.name}}
</li>
</div> </div>
<!-- 登录信息按钮 --> <!-- 登录信息按钮 -->
<div class="boxright"> <div class="boxright">
@ -70,24 +63,21 @@
<span style="margin: 0 12px;">|</span> <span style="margin: 0 12px;">|</span>
<span style="margin-right: 8px;"> {{surname}} </span> <span style="margin-right: 8px;"> {{surname}} </span>
<a nz-dropdown [nzDropdownMenu]="menu" [nzTrigger]="'click'" [nzBackdrop]='false'> <a nz-dropdown [nzDropdownMenu]="menu" [nzTrigger]="'click'" [nzBackdrop]='false'>
<img src="../../../assets/images/head.png" alt=""> <img src="../../../assets/images/head.png" alt="">
</a> </a>
<nz-dropdown-menu #menu="nzDropdownMenu"> <nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable *ngIf="isZT ==='false'"> <ul nz-menu nzSelectable>
<li *ngIf="isGasStation" nz-menu-item (click)="navChange('/oliStationInfo')">基本信息</li> <li *ngIf="isGasStation" nz-menu-item (click)="navChange('/oliStationInfo')">基本信息</li>
<li *ngIf="isGasStation" nz-menu-item (click)="navChange('/equipmentInfo')">器材信息</li> <li *ngIf="isGasStation" nz-menu-item (click)="navChange('/equipmentInfo')">器材信息</li>
<li nz-menu-item (click)="changePassword()">修改密码</li> <li nz-menu-item (click)="changePassword()">修改密码</li>
<li *ngIf="xitongguanli" nz-menu-item (click)="navChange2()">系统管理</li> <li nz-menu-item (click)="navChange2()">系统管理</li>
<li nz-menu-item (click)="signOut()">退出系统</li> <li nz-menu-item (click)="signOut()">退出系统</li>
</ul> </ul>
</nz-dropdown-menu> </nz-dropdown-menu>
<!-- <span style="margin: 0 12px;" *ngIf="isGasStationBack">|</span> -->
<span style="margin: 0 12px;" *ngIf="isGasStationBack">|</span> <!-- <img style="cursor: pointer;" *ngIf="isGasStationBack" src="../../../assets/images/goback.png" alt=""
<img style="cursor: pointer;" *ngIf="isGasStationBack" src="../../../assets/images/goback.png" alt="" (click)="goback()"> -->
(click)="goback()">
</div> </div>
</div> </div>
@ -133,3 +123,44 @@
</ng-template> </ng-template>
<!-- 修改密码 -->
<nz-modal [(nzVisible)]="isVisible" [nzTitle]="modalTitle" [nzContent]="modalContent" [nzFooter]="modalFooter"
[nzWidth]="350">
<ng-template #modalTitle>
修改初始密码
</ng-template>
<ng-template #modalContent>
<form nz-form [formGroup]="passwordValidateForm">
<nz-form-item>
<nz-form-control nzErrorTip="">
<nz-input-group>
<input name="oldpassword" type="password" nz-input formControlName="oldpassword" placeholder="请输入原密码"
autocomplete="off" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-input-group>
<input name="newpassword" nz-input type="password" formControlName="newpassword" placeholder="请输入新密码"
autocomplete="off" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-input-group>
<input name="affirmpassword" nz-input type="password" formControlName="affirmpassword" placeholder="确认新密码"
autocomplete="new-password" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
</form>
</ng-template>
<ng-template #modalFooter>
<button nz-button nzType="primary" (click)="handleOk()" [nzLoading]="isConfirmLoading">确定</button>
</ng-template>
</nz-modal>

50
src/app/pages/home/home.component.scss

@ -1,10 +1,10 @@
.blue { .blue {
color: #36a2ff; color: #36A2FF;
cursor: pointer; cursor: pointer;
} }
.grey { .grey {
color: #ffffff; color: #FFFFFF;
opacity: 0.6; opacity: 0.6;
} }
@ -13,41 +13,39 @@
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
// background-image: radial-gradient(closest-side at 50% 55%,#03447c, #02325c, #002046); // background-image: radial-gradient(closest-side at 50% 55%,#03447c, #02325c, #002046);
background: radial-gradient( background: radial-gradient(closest-side at 50% 55%, #004988 0%, #00122D 100%);
closest-side at 50% 55%,
#004988 0%,
#00122d 100%
);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.menu { .menu {
height: 56px; height: 56px;
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
font-size: 17px; font-size: 17px;
background: url("../../../assets/images/navbg.png") no-repeat; background: url('../../../assets/images/navbg.png') no-repeat;
background-size: 100% 115%; background-size: 100% 115%;
position: relative; position: relative;
.libox { .libox {
width: 35%; width: 33%;
display: flex; display: flex;
justify-content: center;
li { li {
// flex: 1; flex: 1;
box-sizing: border-box;
padding: 0 20px;
height: 52px; height: 52px;
line-height: 52px; line-height: 52px;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
font-family: sybold; font-family: sybold;
color: #ebfaff; color: #EBFAFF;
} }
} }
} }
.boxleft { .boxleft {
@ -69,7 +67,7 @@
span { span {
font-size: 16px; font-size: 16px;
color: #ffffff; color: #FFFFFF;
opacity: 0.6; opacity: 0.6;
} }
@ -79,6 +77,7 @@
} }
} }
.backbtn { .backbtn {
position: absolute; position: absolute;
left: 205px; left: 205px;
@ -88,9 +87,9 @@
width: 64px; width: 64px;
height: 32px; height: 32px;
background: rgba(0, 129, 255, 0.3); background: rgba(0, 129, 255, 0.3);
border: 1px solid #36a2ff; border: 1px solid #36A2FF;
border-radius: 0px; border-radius: 0px;
color: #91ccff; color: #91CCFF;
} }
} }
@ -116,7 +115,7 @@
.today { .today {
font-size: 19px; font-size: 19px;
font-family: titlefont; font-family: titlefont;
color: #d0eaff; color: #D0EAFF;
margin-top: 11px; margin-top: 11px;
margin-left: 10px; margin-left: 10px;
} }
@ -125,17 +124,13 @@
.content { .content {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
} }
.router-link-active { .router-link-active {
// background: linear-gradient(270deg, rgba(35, 153, 255, 0) 0%, #1c8199 50%, rgba(35, 153, 255, 0) 100%); // background: linear-gradient(270deg, rgba(35, 153, 255, 0) 0%, #1c8199 50%, rgba(35, 153, 255, 0) 100%);
background: linear-gradient( background: linear-gradient(270deg, rgba(35, 153, 255, 0) 0%, #36A2FF 50%, rgba(35, 153, 255, 0) 100%);
270deg,
rgba(35, 153, 255, 0) 0%,
#36a2ff 50%,
rgba(35, 153, 255, 0) 100%
);
} }
// 适配125% // 适配125%
@ -145,6 +140,8 @@
font-size: 14px; font-size: 14px;
.libox { .libox {
width: 33%;
li { li {
height: 42px; height: 42px;
line-height: 42px; line-height: 42px;
@ -193,11 +190,13 @@
// 适配150% // 适配150%
@media screen and (max-height: 600px) { @media screen and (max-height: 600px) {
.menu { .menu {
height: 32px; height: 32px;
font-size: 8px; font-size: 8px;
.libox { .libox {
width: 33%;
li { li {
height: 32px; height: 32px;
@ -230,6 +229,7 @@
} }
} }
.backbtn { .backbtn {
left: 156px; left: 156px;
bottom: 0px; bottom: 0px;
@ -243,4 +243,6 @@
padding: 0; padding: 0;
} }
} }
} }

280
src/app/pages/home/home.component.ts

@ -41,16 +41,13 @@ export class HomeComponent implements OnInit {
private listRefreshService: listRefreshService, private listRefreshService: listRefreshService,
private http: HttpClient, private http: HttpClient,
private router: Router, private router: Router,
private navChangeService: NavChangeService,
public token: CacheTokenService, public token: CacheTokenService,
private message: NzMessageService, private message: NzMessageService,
private notificationService: NzNotificationService, private notificationService: NzNotificationService,
private modal: NzModalService, private modal: NzModalService,
private viewContainerRef: ViewContainerRef, private viewContainerRef: ViewContainerRef,
private fb: FormBuilder, private fb: FormBuilder,
private selectedMenu: SelectedMenu, private location: Location
private location: Location,
private patternService: PatternService
) { ) {
const { password } = MyValidators; const { password } = MyValidators;
@ -71,7 +68,6 @@ export class HomeComponent implements OnInit {
//菜单 //菜单
menu1 = [ menu1 = [
{ name: "AI视频预警统计", url: "/comprehensive" },
{ name: "首页", url: "/homepage" }, { name: "首页", url: "/homepage" },
{ name: "数字油站", url: "/plan" }, { name: "数字油站", url: "/plan" },
{ name: "今日预警", url: "/todaywarning" }, { name: "今日预警", url: "/todaywarning" },
@ -94,26 +90,28 @@ export class HomeComponent implements OnInit {
{ name: "资产类证照管理", url: "/system/fileOfLicense" }, { name: "资产类证照管理", url: "/system/fileOfLicense" },
{ name: "菜单管理", url: "/system/menu" }, { name: "菜单管理", url: "/system/menu" },
]; ];
menubeijing = [
{ name: "首页", url: "/homepage" },
// { name: "数字油站", url: "/plan" },
{ name: "今日预警", url: "/todaywarning" },
{ name: "预警记录", url: "/records_nav" },
// { name: "证照管理", url: "/audit" },
];
xitongguanli = false; xitongguanli = false;
userMenu = []; userMenu = [];
tap = []; tap = [];
menuList1 = []; menuList1 = [];
menuList2 = []; menuList2 = [];
selectedItem; selectedItem;
isZT = sessionStorage.getItem("isZT") || "false";
isComprehensive = false;
routerChange(item) { routerChange(item) {
if ( // if (JSON.parse(sessionStorage.getItem("isGasStation"))) {
JSON.parse(sessionStorage.getItem("isGasStation")) && // let a = JSON.parse(sessionStorage.getItem("3dSceneData"));
this.isZT !== "true" // if (!a.hasBuildingInfo && item.url == "/plan/petrolStation") {
) { // this.message.info("当前油站未开通!");
let a = JSON.parse(sessionStorage.getItem("3dSceneData")); // return;
if (!a.hasBuildingInfo && item.url == "/plan/petrolStation") { // }
this.message.info("当前油站未开通!"); // }
return;
}
}
if (item.name == this.selectedItem) { if (item.name == this.selectedItem) {
return; return;
@ -122,25 +120,9 @@ export class HomeComponent implements OnInit {
this.selectedItem = item.name; this.selectedItem = item.name;
this.router.navigate([item.url]); this.router.navigate([item.url]);
} }
isProd: boolean;
ngOnInit(): void {
if (this.isZT == "true") {
this.menu2 = [
{ name: "数字油站", url: "/plan" },
{ name: "今日预警", url: "/todaywarning" },
{ name: "预警记录", url: "/records_nav" },
{ name: "证照管理", url: "/audit" },
];
}
//油站人员进入油站
if (this.router.url.indexOf("comprehensive") != -1) {
//控制返回按钮显示
this.isComprehensive = true;
}
this.isProd = this.patternService.isProd; ngOnInit(): void {
this.initSelectedItem(this.router); this.initSelectedItem(this.router);
let a = sessionStorage.getItem("userdata"); let a = sessionStorage.getItem("userdata");
this.userMenu = JSON.parse(a).menus; this.userMenu = JSON.parse(a).menus;
for (let index = 0; index < this.userMenu.length; index++) { for (let index = 0; index < this.userMenu.length; index++) {
@ -152,33 +134,6 @@ export class HomeComponent implements OnInit {
} }
this.isGasStation = JSON.parse(sessionStorage.getItem("isGasStation")); this.isGasStation = JSON.parse(sessionStorage.getItem("isGasStation"));
//初始化登陆 如果是油站用户
if (this.isGasStation) {
this.isGasStationNav = true;
for (let index = 0; index < this.menu2.length; index++) {
for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k] == this.menu2[index].name) {
this.menuList1.push(this.menu2[index]);
}
}
}
} else {
//初始化登陆 如果是管理者用户
this.isGasStationNav = false;
this.isGasStationBack = false;
for (let index = 0; index < this.menu1.length; index++) {
for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k] == this.menu1[index].name) {
this.menuList1.push(this.menu1[index]);
}
}
}
for (let index = 0; index < this.tap.length; index++) {
if (this.tap[index] == "系统管理") {
this.xitongguanli = true;
}
}
}
this.router.events this.router.events
.pipe(filter((event) => event instanceof NavigationEnd)) .pipe(filter((event) => event instanceof NavigationEnd))
@ -225,30 +180,47 @@ export class HomeComponent implements OnInit {
this.userName = JSON.parse(sessionStorage.getItem("userdata")).userName; this.userName = JSON.parse(sessionStorage.getItem("userdata")).userName;
} }
// if ( if (
// (sessionStorage.getItem("isDefaultPassword") == "true" || (sessionStorage.getItem("isDefaultPassword") == "true" ||
// sessionStorage.getItem("isPasswordExpired") == "true") && sessionStorage.getItem("isPasswordExpired") == "true") &&
// JSON.parse(sessionStorage.getItem("userdata")).userName != "admin" JSON.parse(sessionStorage.getItem("userdata")).userName != "admin"
// ) { ) {
// this.changePasswordPopup(); this.changePasswordPopup();
// } }
this.getWarningSwitch(); this.getWarningSwitch();
} }
switchUsers() {}
initSelectedItem(event) { initSelectedItem(event) {
// console.log(666, event); if (event.url == "/homepage") {
if (event.url.indexOf("/homepage") !== -1) {
sessionStorage.setItem("selectedMenu", "首页"); sessionStorage.setItem("selectedMenu", "首页");
this.selectedItem = "首页"; this.selectedItem = "首页";
} else if (event.url.indexOf("/todaywarning") !== -1) { } else if (event.url == "/plan" || event.url == "/plan/petrolStation") {
sessionStorage.setItem("selectedMenu", "数字油站");
this.selectedItem = "数字油站";
} else if (
event.url == "/todaywarning" ||
event.url == "/todaywarning/petrolStation"
) {
sessionStorage.setItem("selectedMenu", "今日预警"); sessionStorage.setItem("selectedMenu", "今日预警");
this.selectedItem = "今日预警"; this.selectedItem = "今日预警";
} else if (event.url.indexOf("/records_nav") != -1) { } else if (event.url.indexOf("/records_nav") != -1) {
if (event.url == "/records_nav") {
this.router.navigate(["/records_nav/all"]);
} else if (event.url == "/records_nav/petrolStation") {
this.router.navigate(["/records_nav/petrolStation/all"]);
}
sessionStorage.setItem("selectedMenu", "预警记录");
this.selectedItem = "预警记录"; this.selectedItem = "预警记录";
} else if (
event.url == "/license" ||
event.url == "/license/petrolStation"
) {
sessionStorage.setItem("selectedMenu", "证照管理");
this.selectedItem = "证照管理";
} }
} }
isWarningVoice = true; //预警声音 isWarningVoice = true; //预警声音
isWarningWindow = true; //预警弹窗 isWarningWindow = true; //预警弹窗
/** /**
@ -306,6 +278,49 @@ export class HomeComponent implements OnInit {
SignalRAspNetCoreHelper.initSignalR(); SignalRAspNetCoreHelper.initSignalR();
abp.event.on("abp.notifications.received", this.reloadPage); abp.event.on("abp.notifications.received", this.reloadPage);
} }
//初次登陆修改密码弹窗
isVisible = false;
isConfirmLoading = false;
changePasswordPopup() {
this.isVisible = true;
}
handleOk(): void {
if (this.passwordValidateForm.invalid) {
this.message.create("warning", `输入格式不正确`);
} else {
if (
this.passwordValidateForm.value.newpassword !=
this.passwordValidateForm.value.affirmpassword
) {
this.message.create("warning", "两次密码输入不一致!");
} else if (
this.passwordValidateForm.value.newpassword ==
this.passwordValidateForm.value.oldpassword
) {
this.message.create("warning", "旧密码和新密码不能相同!");
} else {
this.isConfirmLoading = true;
let body = {
currentPassword: this.passwordValidateForm.value.oldpassword,
newPassword: this.passwordValidateForm.value.newpassword,
};
this.http.post("/api/services/app/User/ChangePassword", body).subscribe(
(data) => {
this.message.create("success", "修改成功!");
this.isConfirmLoading = false;
this.isVisible = false;
//清除sessionStorage
sessionStorage.removeItem("isDefaultPassword");
sessionStorage.removeItem("isPasswordExpired");
},
(err) => {
this.message.create("warning", err.error.error.message);
this.isConfirmLoading = false;
}
);
}
}
}
reloadPage = (userNotification) => { reloadPage = (userNotification) => {
console.log("abp.notifications.received收到通知", userNotification); console.log("abp.notifications.received收到通知", userNotification);
@ -326,7 +341,18 @@ export class HomeComponent implements OnInit {
messageId = []; messageId = [];
receiptOfNotification(userNotification) { receiptOfNotification(userNotification) {
if (this.isWarningVoice) { if (this.isWarningVoice) {
this.Sound(userNotification); // if (!window.speechSynthesis) {
// this.message.create("warning", `该游览器不支持语音播报`);
// } else {
// let speakMsg = new SpeechSynthesisUtterance(
// "请注意,收到一条新的预警信息,请及时处理!"
// );
// speakMsg.lang = "zh-CN";
// speakMsg.rate = 1;
// speakMsg.pitch = 1.5;
// window.speechSynthesis.speak(speakMsg);
// }
this.Sound();
} }
if (this.isWarningWindow) { if (this.isWarningWindow) {
let obj = { let obj = {
@ -341,82 +367,11 @@ export class HomeComponent implements OnInit {
this.messageId.push(obj); this.messageId.push(obj);
} }
} }
Sound() {
msg = new SpeechSynthesisUtterance(); var mp3Url = "../../../assets/sound/warning.mp3";
playingViolationName = ""; var player = new Audio(mp3Url);
Sound(userNotification) { player.play(); //播放 mp3这个音频对象
let violationName =
userNotification.notification.data.properties.ViolationName;
let CameraNo = userNotification.notification.data.properties.CameraNo;
const soundMap = {
: `请注意,${CameraNo}有非工作人员闯入,请及时处理`,
: `请注意,${CameraNo}有长时间停放车辆,请及时处理`,
: `请注意,${CameraNo}有顾客疑似抽烟,请及时处理`,
: `请注意,${CameraNo}有顾客接打电话,请及时处理`,
: "请注意,卸油前未按规定设置隔离,请及时处理",
: "请注意,卸油后未按规定拆除卸油管,请及时处理",
:
"请注意,卸油前未按规定连接静电接地,请及时处理",
: "请注意,卸油前未按规定放置灭火器,请及时处理",
: "请注意,卸油后长时间未清理现场,请及时处理",
: "请注意,油罐车长时间无人卸油,请及时处理",
: "请注意,卸油前未按规定连接卸油管,请及时处理",
: "请注意,卸油中未按规定全程监卸,请及时处理",
: `请注意,${CameraNo}疑似出现烟雾,请及时处理`,
: `请注意,${CameraNo}疑似出现明火,请及时处理`,
"收银员未穿工装/非工作人员闯入收银区":
"请注意,收银员未穿工装或非工作人员闯入收银区,请及时处理",
};
if (violationName == "前庭有顾客疑似抽烟") {
window.speechSynthesis.cancel();
}
if (
violationName == "前庭有顾客接打电话" &&
this.playingViolationName !== "前庭有顾客疑似抽烟"
) {
window.speechSynthesis.cancel();
}
// 如果你想控制语速、音量或声音等
this.msg.text =
soundMap[violationName] || "请注意,收到一条新的预警信息,请及时处理";
this.msg.rate = 0.8; // 语速,默认值为1
this.msg.volume = 1; // 音量,0到1之间
this.msg.lang = "zh-CN"; // 语言,支持多种语言
this.playingViolationName = violationName;
window.speechSynthesis.speak(this.msg);
// 监听语音结束事件
this.msg.onend = () => {
this.playingViolationName = "";
};
// let violationName =
// userNotification.notification.data.properties.ViolationName;
// const soundMap = {
// 油罐区非工作人员闯入: "../../../assets/sound/chuangru.mp3",
// 进出口长时间停放车辆: "../../../assets/sound/jinchukou.mp3",
// 前庭有顾客疑似抽烟: "../../../assets/sound/chouyan.mp3",
// 前庭有顾客接打电话: "../../../assets/sound/dadianhua.mp3",
// 卸油前未按规定设置隔离: "../../../assets/sound/xygeli.mp3",
// 卸油后未按规定拆除卸油管: "../../../assets/sound/xychaichuxyguan.mp3",
// 卸油前未按规定连接静电接地: "../../../assets/sound/xyjiedi.mp3",
// 卸油前未按规定放置灭火器: "../../../assets/sound/xymiehuoqi.mp3",
// 卸油后长时间未清理现场: "../../../assets/sound/xyxianchang.mp3",
// 油罐车长时间无人卸油: "../../../assets/sound/xywuren.mp3",
// 卸油前未按规定连接卸油管: "../../../assets/sound/xyxieyouguan.mp3",
// 卸油中未按规定全程监卸: "../../../assets/sound/xyjianxie.mp3",
// 疑似烟雾: "../../../assets/sound/yanwu.mp3",
// 疑似明火: "../../../assets/sound/minghuo.mp3",
// "收银员未穿工装/非工作人员闯入收银区":
// "../../../assets/sound/gongzhuang.mp3",
// default: "../../../assets/sound/warning.mp3",
// };
// const audioUrl = soundMap[violationName] || soundMap.default;
// var player = new Audio(audioUrl);
// player.play(); //播放 mp3这个音频对象
} }
modalData; modalData;
look(item) { look(item) {
console.log("推送信息", item); console.log("推送信息", item);
@ -694,19 +649,20 @@ export class HomeComponent implements OnInit {
} }
} }
navChange2() { navChange2() {
for (let index = 0; index < this.menu3.length; index++) { // for (let index = 0; index < this.menu3.length; index++) {
for (let k = 0; k < this.tap.length; k++) { // for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k] == this.menu3[index].name) { // if (this.tap[k] == this.menu3[index].name) {
this.menuList2.push(this.menu3[index]); // this.menuList2.push(this.menu3[index]);
} // }
} // }
} // }
if (this.menuList2.length == 0) { // if (this.menuList2.length == 0) {
this.message.create("warning", "未分配系统管理菜单"); // this.message.create("warning", "未分配系统管理菜单");
return; // return;
} else { // } else {
window.open(this.menuList2[0].url); // window.open(this.menuList2[0].url);
} // }
window.open("/system/organization");
} }
goback() { goback() {
this.router.navigate(["/plan"]); this.router.navigate(["/plan"]);

187
src/app/pages/login/forget/forget.component.ts

@ -1,163 +1,129 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from '@angular/core';
import { import { FormBuilder, FormGroup, Validators, AbstractControl } from '@angular/forms';
FormBuilder, import { NzMessageService } from 'ng-zorro-antd/message';
FormGroup, import { NzSafeAny } from 'ng-zorro-antd/core/types';
Validators, import { HttpClient } from '@angular/common/http';
AbstractControl, import { NzModalRef } from 'ng-zorro-antd/modal';
} from "@angular/forms";
import { NzMessageService } from "ng-zorro-antd/message";
import { NzSafeAny } from "ng-zorro-antd/core/types";
import { HttpClient } from "@angular/common/http";
import { NzModalRef } from "ng-zorro-antd/modal";
@Component({ @Component({
selector: "app-forget", selector: 'app-forget',
templateUrl: "./forget.component.html", templateUrl: './forget.component.html',
styleUrls: ["./forget.component.scss"], styleUrls: ['./forget.component.scss']
}) })
export class ForgetComponent implements OnInit { export class ForgetComponent implements OnInit {
validateForm!: FormGroup; validateForm!: FormGroup;
validateForm2!: FormGroup; validateForm2!: FormGroup;
validateForm3!: FormGroup; validateForm3!: FormGroup;
constructor( constructor(private fb: FormBuilder, private message: NzMessageService, private http: HttpClient, private modal: NzModalRef, private patternService: PatternService) { }
private fb: FormBuilder, isProd: boolean
private message: NzMessageService,
private http: HttpClient,
private modal: NzModalRef,
private patternService: PatternService
) {}
isProd: boolean;
ngOnInit(): void { ngOnInit(): void {
this.isProd = this.patternService.isProd; this.isProd = this.patternService.isProd
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
account: [null, [Validators.required]], account: [null, [Validators.required]]
}); });
this.validateForm2 = this.fb.group({ this.validateForm2 = this.fb.group({
code: [null, [Validators.required]], code: [null, [Validators.required]]
}); });
const { password } = MyValidators; const { password } = MyValidators;
this.validateForm3 = this.fb.group({ this.validateForm3 = this.fb.group({
newpassword: [null, [Validators.required, password]], newpassword: [null, [Validators.required, password]],
affirmpassword: [null, [Validators.required, password]], affirmpassword: [null, [Validators.required, password]]
}); });
} }
currentStep = 1; currentStep = 1
phoneNum: string; phoneNum: string
step1() { step1() {
console.log(this.validateForm); console.log(this.validateForm)
if (this.validateForm.invalid) { if (this.validateForm.invalid) {
this.message.create("warning", "请填写完整"); this.message.create('warning', '请填写完整');
} else { } else {
this.http this.http.get('/api/services/app/User/GetPhoneNumber', {
.get("/api/services/app/User/GetPhoneNumber", {
params: { params: {
userName: this.validateForm.value.account, userName: this.validateForm.value.account
}, }
}) }).subscribe({
.subscribe({
next: (data: any) => { next: (data: any) => {
this.phoneNum = data.result; this.phoneNum = data.result
this.currentStep = 2; this.currentStep = 2
}, }
}); })
} }
} }
//发送验证码 //发送验证码
codeCountDown = 0; codeCountDown = 0
code() { code() {
this.codeCountDown = 30;
let params = { let params = {
userName: this.validateForm.value.account, userName: this.validateForm.value.account,
}; }
this.http this.http.post('/api/services/app/User/SendVerificationCode', null, { params: params }).subscribe({
.post("/api/services/app/User/SendVerificationCode", null, {
params: params,
})
.subscribe({
next: (data: any) => { next: (data: any) => {
this.message.create("success", "已发送"); this.message.create('success', '已发送');
//按钮倒计时 //按钮倒计时
this.codeCountDown = 30
let codesetInterval = setInterval(() => { let codesetInterval = setInterval(() => {
this.codeCountDown = this.codeCountDown - 1; this.codeCountDown = this.codeCountDown - 1
if (this.codeCountDown == 0) { if (this.codeCountDown == 0) {
clearInterval(codesetInterval); clearInterval(codesetInterval)
} }
}, 1000); }, 1000);
}, }
}); })
} }
step2() { step2() {
if (this.validateForm2.invalid) { if (this.validateForm2.invalid) {
this.message.create("warning", "请填写完整"); this.message.create('warning', '请填写完整');
} else { } else {
console.log(this.validateForm.value.account); console.log(this.validateForm.value.account)
let params = { let params = {
userName: this.validateForm.value.account, userName: this.validateForm.value.account,
code: this.validateForm2.value.code, code: this.validateForm2.value.code
}; }
this.http this.http.get('/api/services/app/User/VerifyVerificationCode', { params: params }).subscribe({
.get("/api/services/app/User/VerifyVerificationCode", {
params: params,
})
.subscribe({
next: (data: any) => { next: (data: any) => {
this.currentStep = 3; this.currentStep = 3
}, }
}); })
} }
} }
step3() { step3() {
if (this.validateForm3.valid) { if (this.validateForm3.valid) {
let word = JSON.parse( let word = JSON.parse(JSON.stringify(this.validateForm3.value.newpassword)).toLowerCase()
JSON.stringify(this.validateForm3.value.newpassword) if (this.validateForm3.value.newpassword != this.validateForm3.value.affirmpassword) {
).toLowerCase(); this.message.create('warning', '两次密码输入不一致!');
if ( return false
this.validateForm3.value.newpassword != } if (word.indexOf('sino') != -1 || word.indexOf('zhonghua') != -1) {
this.validateForm3.value.affirmpassword this.message.create('warning', '口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符');
) { return false
this.message.create("warning", "两次密码输入不一致!");
return false;
}
if (word.indexOf("sino") != -1 || word.indexOf("zhonghua") != -1) {
this.message.create(
"warning",
"口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符"
);
return false;
} else { } else {
let body = { let body = {
userName: this.validateForm.value.account, userName: this.validateForm.value.account,
code: this.validateForm2.value.code, code: this.validateForm2.value.code,
newPassword: this.validateForm3.value.newpassword, newPassword: this.validateForm3.value.newpassword,
};
this.http
.post("/api/services/app/User/ChangePasswordBySms", body)
.subscribe(
(data) => {
this.message.create("success", "修改成功!");
this.modal.close();
return true;
},
(err) => {
return false;
}
);
} }
this.http.post('/api/services/app/User/ChangePasswordBySms', body).subscribe(data => {
this.message.create('success', '修改成功!');
this.modal.close()
return true
}, err => {
return false
})
}
} else { } else {
this.message.create("warning", "请填写完整!"); this.message.create('warning', '请填写完整!');
return false; return false
} }
} }
} }
import { PatternService } from "src/app/service/pattern.service"; import { PatternService } from 'src/app/service/pattern.service';
export type MyErrorsOptions = { "zh-cn": string; en: string } & Record< export type MyErrorsOptions = { 'zh-cn': string; en: string } & Record<string, NzSafeAny>;
string,
NzSafeAny
>;
export type MyValidationErrors = Record<string, MyErrorsOptions>; export type MyValidationErrors = Record<string, MyErrorsOptions>;
export class MyValidators extends Validators { export class MyValidators extends Validators {
static password(control: AbstractControl): MyValidationErrors | null { static password(control: AbstractControl): MyValidationErrors | null {
@ -167,26 +133,13 @@ export class MyValidators extends Validators {
return null; return null;
} }
return isPassword(value) return isPassword(value) ? null : { mobile: { 'zh-cn': PatternService.isProd ? `长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种,且口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符` : '长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种', en: `Password phone number is not valid` } };
? null
: {
mobile: {
"zh-cn": PatternService.isProd
? `长度至少 12 位,必须包含大写字母、小写字母、数字、符号四种中的三种,且口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符`
: "长度至少 12 位,必须包含大写字母、小写字母、数字、符号四种中的三种",
en: `Password phone number is not valid`,
},
};
} }
} }
function isEmptyInputValue(value: NzSafeAny): boolean { function isEmptyInputValue(value: NzSafeAny): boolean {
return value == null || value.length === 0; return value == null || value.length === 0;
} }
function isPassword(value: string): boolean { function isPassword(value: string): boolean {
return ( return typeof value === 'string' && /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)(?!.*[sS][iI][nN][oO].*)(?!.*[zZ][hH][oO][nN][gG][hH][uU][aA].*)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,99}$/.test(value);
typeof value === "string" &&
/^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)(?!.*[sS][iI][nN][oO].*)(?!.*[zZ][hH][oO][nN][gG][hH][uU][aA].*)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{12,99}$/.test(
value
)
);
} }

51
src/app/pages/login/login.component.html

@ -1,7 +1,7 @@
<div class="login" id="login"> <div class="login" id="login">
<div class="card"> <div class="card">
<h1 class="cardheader">欢迎登录</h1> <h1 class="cardheader">欢迎登录</h1>
<h1 class="cardheader">加油站智能安全管理系统</h1> <h1 class="cardheader">智能安全管理系统</h1>
<form nz-form [formGroup]="validateForm" class="login-form" (ngSubmit)="submitForm()"> <form nz-form [formGroup]="validateForm" class="login-form" (ngSubmit)="submitForm()">
<nz-form-item> <nz-form-item>
@ -38,53 +38,12 @@
<button [nzLoading]="isLoading" nz-button class="login-form-button login-form-margin" <button [nzLoading]="isLoading" nz-button class="login-form-button login-form-margin"
[nzType]="'primary'">登录</button> [nzType]="'primary'">登录</button>
</form> </form>
<p *ngIf="isProd" class="company">中化石油销售有限公司 北京安信科创软件有限公司 版权所有</p> <p *ngIf="isProd" class="company">北京安信科创软件有限公司 版权所有</p>
</div> </div>
<div class="name"> <!-- <div class="name">
<img *ngIf="isProd" src="assets/images/logo2.png" alt=""> <img *ngIf="isProd" src="../../../assets/images/logo2.png" alt="">
</div> </div> -->
</div> </div>
<!-- 修改密码 -->
<nz-modal [(nzVisible)]="isVisible" [nzTitle]="modalTitle" [nzContent]="modalContent" [nzFooter]="modalFooter"
[nzWidth]="350">
<ng-template #modalTitle>
修改初始密码
</ng-template>
<ng-template #modalContent>
<form nz-form [formGroup]="passwordValidateForm">
<nz-form-item>
<nz-form-control nzErrorTip="">
<nz-input-group>
<input name="oldpassword" type="password" nz-input formControlName="oldpassword" placeholder="请输入原密码"
autocomplete="off" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-input-group>
<input name="newpassword" nz-input type="password" formControlName="newpassword" placeholder="请输入新密码"
autocomplete="off" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-input-group>
<input name="affirmpassword" nz-input type="password" formControlName="affirmpassword" placeholder="确认新密码"
autocomplete="new-password" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
</form>
</ng-template>
<ng-template #modalFooter>
<button nz-button nzType="primary" (click)="handleOk()" [nzLoading]="isConfirmLoading">确定</button>
</ng-template>
</nz-modal>

207
src/app/pages/login/login.component.ts

@ -16,7 +16,9 @@ import { SelectedMenu } from "src/app/service/selectedMenu.service";
import { NzModalService } from "ng-zorro-antd/modal"; import { NzModalService } from "ng-zorro-antd/modal";
import { ForgetComponent } from "./forget/forget.component"; import { ForgetComponent } from "./forget/forget.component";
import { PatternService } from "src/app/service/pattern.service"; import { PatternService } from "src/app/service/pattern.service";
// import { THIS_EXPR } from '@angular/compiler/src/output/output_ast';
declare var abp: any;
@Component({ @Component({
selector: "app-login", selector: "app-login",
templateUrl: "./login.component.html", templateUrl: "./login.component.html",
@ -136,8 +138,6 @@ export class LoginComponent implements OnInit {
}); });
}); });
} }
submitData;
submitForm(): void { submitForm(): void {
if (!this.remember) { if (!this.remember) {
localStorage.removeItem("account"); localStorage.removeItem("account");
@ -172,13 +172,12 @@ export class LoginComponent implements OnInit {
.get("/api/services/app/Session/GetCurrentLoginInformations") .get("/api/services/app/Session/GetCurrentLoginInformations")
.subscribe( .subscribe(
async (data: any) => { async (data: any) => {
this.submitData = data;
console.log("GetCurrentLoginInformations", data.result); console.log("GetCurrentLoginInformations", data.result);
if (data.result.user.menus.length == 0) { // if (data.result.user.menus.length == 0) {
this.message.create("error", `当前用户未分配菜单`); // this.message.create('error', `当前用户未分配菜单`);
this.isLoading = false; // this.isLoading = false
return; // return
} // }
sessionStorage.setItem( sessionStorage.setItem(
"userdata", "userdata",
@ -188,42 +187,73 @@ export class LoginComponent implements OnInit {
"userdataOfgasstation", "userdataOfgasstation",
JSON.stringify(data.result.user) JSON.stringify(data.result.user)
); );
sessionStorage.setItem(
this.isLoading = false; "isDefaultPassword",
if (!data.result.user.organization) { JSON.stringify(data.result.user.isDefaultPassword)
this.message.create("error", `当前用户没有组织机构信息`);
return;
}
if (data.result.user.organization.isGasStation) {
await this.getGasStationBaseInfo();
if (
data.result.user.menus[0].name == "数字油站" &&
data.result.user.menus.length == 1 &&
!this.init3D
) {
this.message.create(
"error",
`当前用户油站未开通3D且仅分配油站菜单`
); );
return; sessionStorage.setItem(
} "isPasswordExpired",
} JSON.stringify(data.result.user.isPasswordExpired)
);
this.isLoading = false;
// if (!data.result.user.organization) {
// this.message.create('error', `当前用户没有组织机构信息`);
// return
// }
// if (data.result.user.organization.isGasStation) {
// await this.getGasStationBaseInfo()
// if (data.result.user.menus[0].name == "数字油站" && data.result.user.menus.length == 1 && !this.init3D) {
// this.message.create('error', `当前用户油站未开通3D且仅分配油站菜单`);
// return
// }
// }
//记住密码 //记住密码
this.rememberInfo(); this.rememberInfo();
//自动登录 //自动登录
this.autoLogin(); this.autoLogin();
if (
data.result.user.isDefaultPassword ||
data.result.user.isPasswordExpired
) {
this.isLoading = false;
this.changePasswordPopup();
return;
}
//跳转页面 // if (data.result.user.organization.isGasStation) {
this.toPage(data); // sessionStorage.setItem("isGasStation", 'true');
// let a = sessionStorage.getItem('userdataOfgasstation')
// let menuList = this.returnLastMenus(a, this.menu2)
// let isTrue = menuList.find((item) => {
// return item.name == "今日预警"
// });
// if (isTrue) {
// this.router.navigate(['/todaywarning/petrolStation'])
// sessionStorage.setItem('selectedMenu', '今日预警')
// } else if (data.result.user.menus[0].name == "数字油站" && !this.init3D) {
// this.router.navigate([menuList[1].url])
// sessionStorage.setItem('selectedMenu', menuList[1].name)
// } else if (menuList.length == 0) {
// return this.message.create('warning', `当前用户未分配菜单`);
// } else {
// this.router.navigate([menuList[0].url])
// sessionStorage.setItem('selectedMenu', menuList[0].name)
// }
// } else {
// sessionStorage.setItem("isGasStation", 'false');
// let a = sessionStorage.getItem('userdata')
// let menuList = this.returnLastMenus(a, this.menu1)
// let isTrue = menuList.find((item) => {
// return item.name == "首页"
// });
// if (menuList.length == 0) {
// return this.message.create('warning', `当前用户未分配菜单`);
// }
// if (isTrue) {
// this.router.navigate(['/homepage'])
// sessionStorage.setItem('selectedMenu', '首页')
// } else {
// this.router.navigate([menuList[0].url])
// sessionStorage.setItem('selectedMenu', menuList[0].name)
// }
// //
// }
this.router.navigate(["/gishome"]);
this.message.create("success", `登录成功`); this.message.create("success", `登录成功`);
}, },
(err) => { (err) => {
@ -233,51 +263,10 @@ export class LoginComponent implements OnInit {
}, },
(err) => { (err) => {
this.isLoading = false; this.isLoading = false;
// this.message.create('error', err.error.error.details);
} }
); );
} }
toPage(data) {
if (data.result.user.organization.isGasStation) {
sessionStorage.setItem("isGasStation", "true");
let a = sessionStorage.getItem("userdataOfgasstation");
let menuList = this.returnLastMenus(a, this.menu2);
let isTrue = menuList.find((item) => {
return item.name == "今日预警";
});
if (isTrue) {
this.router.navigate(["/todaywarning/petrolStation"]);
sessionStorage.setItem("selectedMenu", "今日预警");
} else if (data.result.user.menus[0].name == "数字油站" && !this.init3D) {
this.router.navigate([menuList[1].url]);
sessionStorage.setItem("selectedMenu", menuList[1].name);
} else if (menuList.length == 0) {
return this.message.create("warning", `当前用户未分配菜单`);
} else {
this.router.navigate([menuList[0].url]);
sessionStorage.setItem("selectedMenu", menuList[0].name);
}
} else {
sessionStorage.setItem("isGasStation", "false");
let a = sessionStorage.getItem("userdata");
let menuList = this.returnLastMenus(a, this.menu1);
let isTrue = menuList.find((item) => {
return item.name == "首页";
});
if (menuList.length == 0) {
return this.message.create("warning", `当前用户未分配菜单`);
}
if (isTrue) {
this.router.navigate(["/homepage"]);
sessionStorage.setItem("selectedMenu", "首页");
} else {
this.router.navigate([menuList[0].url]);
sessionStorage.setItem("selectedMenu", menuList[0].name);
}
//
}
}
returnLastMenus(data, originalMenus) { returnLastMenus(data, originalMenus) {
let userMenu = JSON.parse(data).menus; let userMenu = JSON.parse(data).menus;
let tap = []; let tap = [];
@ -306,62 +295,6 @@ export class LoginComponent implements OnInit {
nzFooter: null, nzFooter: null,
}); });
} }
//初次登陆修改密码弹窗
isVisible = false;
isConfirmLoading = false;
changePasswordPopup() {
this.isVisible = true;
}
handleOk(): void {
if (this.passwordValidateForm.invalid) {
this.message.create("warning", `输入格式不正确`);
} else {
if (
this.passwordValidateForm.value.newpassword !=
this.passwordValidateForm.value.affirmpassword
) {
this.message.create("warning", "两次密码输入不一致!");
} else if (
this.passwordValidateForm.value.newpassword ==
this.passwordValidateForm.value.oldpassword
) {
this.message.create("warning", "旧密码和新密码不能相同!");
} else {
this.isConfirmLoading = true;
let body = {
currentPassword: this.passwordValidateForm.value.oldpassword,
newPassword: this.passwordValidateForm.value.newpassword,
};
this.http.post("/api/services/app/User/ChangePassword", body).subscribe(
(data) => {
//记住密码
if (this.remember) {
localStorage.setItem(
"account",
Base64.encode(this.validateForm.value.userName)
);
localStorage.setItem(
"password",
Base64.encode(this.passwordValidateForm.value.newpassword)
);
}
//自动登录
this.autoLogin();
this.message.create("success", "修改成功!");
this.isConfirmLoading = false;
this.isVisible = false;
this.toPage(this.submitData);
},
(err) => {
this.message.create("warning", err.error.error.message);
this.isConfirmLoading = false;
}
);
}
}
}
} }
export type MyErrorsOptions = { "zh-cn": string; en: string } & Record< export type MyErrorsOptions = { "zh-cn": string; en: string } & Record<
string, string,
@ -380,7 +313,7 @@ export class MyValidators extends Validators {
? null ? null
: { : {
mobile: { mobile: {
"zh-cn": `长度至少 12 位,必须包含大写字母、小写字母、数字、符号四种中的三种`, "zh-cn": `长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种`,
en: `Password phone number is not valid`, en: `Password phone number is not valid`,
}, },
}; };
@ -392,7 +325,7 @@ function isEmptyInputValue(value: NzSafeAny): boolean {
function isPassword(value: string): boolean { function isPassword(value: string): boolean {
return ( return (
typeof value === "string" && typeof value === "string" &&
/^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{12,99}$/.test( /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,99}$/.test(
value value
) )
); );

471
src/app/pages/oil-station-info/oil-station-info.component.ts

@ -1,31 +1,25 @@
import { HttpClient } from "@angular/common/http"; import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ObjectsSimpleService } from "src/app/service/objectsSimple.service"; import { ObjectsSimpleService } from 'src/app/service/objectsSimple.service';
import { NzMessageService } from "ng-zorro-antd/message"; import { NzMessageService } from 'ng-zorro-antd/message';
import * as moment from "moment"; import * as moment from 'moment';
import Viewer from "viewerjs"; import Viewer from 'viewerjs';
import { Router, ActivatedRoute } from "@angular/router"; import { Router, ActivatedRoute } from '@angular/router'
@Component({ @Component({
selector: "app-oil-station-info", selector: 'app-oil-station-info',
templateUrl: "./oil-station-info.component.html", templateUrl: './oil-station-info.component.html',
styleUrls: ["./oil-station-info.component.scss"], styleUrls: ['./oil-station-info.component.scss']
}) })
export class OilStationInfoComponent implements OnInit { export class OilStationInfoComponent implements OnInit {
validateForm!: FormGroup; validateForm!: FormGroup;
constructor( constructor(private router: Router, private fb: FormBuilder, private objectsSrv: ObjectsSimpleService, private http: HttpClient, private message: NzMessageService, public route: ActivatedRoute) { }
private router: Router,
private fb: FormBuilder,
private objectsSrv: ObjectsSimpleService, userdata: any
private http: HttpClient, dateFormat = 'yyyy-MM-dd';
private message: NzMessageService,
public route: ActivatedRoute
) {}
userdata: any;
dateFormat = "yyyy-MM-dd";
ngOnInit(): void { ngOnInit(): void {
this.userdata = JSON.parse(sessionStorage.getItem("userdata")); this.userdata = JSON.parse(sessionStorage.getItem('userdata'))
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
oilStation: this.fb.group({ oilStation: this.fb.group({
organization: [], organization: [],
@ -46,306 +40,243 @@ export class OilStationInfoComponent implements OnInit {
name: [null], name: [null],
address: [null], address: [null],
distance: [null], distance: [null],
contactInformation: [null], contactInformation: [null]
}), }),
hospital: this.fb.group({ hospital: this.fb.group({
name: [null], name: [null],
address: [null], address: [null],
distance: [null], distance: [null],
contactInformation: [null], contactInformation: [null]
}), }),
fireBrigade: this.fb.group({ fireBrigade: this.fb.group({
name: [null], name: [null],
address: [null], address: [null],
distance: [null], distance: [null],
contactInformation: [null], contactInformation: [null]
}), })
}); });
this.getInfo(); this.getInfo()
} }
//获取油站信息 //获取油站信息
// gallery // gallery
getInfo() { getInfo() {
this.http this.http.get('/api/services/app/GasStation/Get', {
.get("/api/services/app/GasStation/Get", {
params: { params: {
organizationUnitId: this.route.snapshot.queryParams.id, organizationUnitId: this.route.snapshot.queryParams.id
}, }
}) }).subscribe((data: any) => {
.subscribe(
(data: any) => {
this.httpBody.locationName this.httpBody.locationName ? null : this.httpBody.locationName = this.httpBody.proposalAreaName
? null this.httpBody.companyName ? null : this.httpBody.companyName = this.httpBody.proposalCompanyName
: (this.httpBody.locationName = this.httpBody.proposalAreaName);
this.httpBody.companyName
? null
: (this.httpBody.companyName = this.httpBody.proposalCompanyName);
if (new Date(data.result.openTime).getTime() == -62135625943000) { if (new Date(data.result.openTime).getTime() == -62135625943000) {
data.result.openTime = null; data.result.openTime = null
} }
this.httpBody = data.result; this.httpBody = data.result
if (!this.httpBody.govUnitDetail) { if (!this.httpBody.govUnitDetail) {
this.httpBody.govUnitDetail = { this.httpBody.govUnitDetail = {
policeStation: {}, policeStation: {},
hospital: {}, hospital: {},
fireBrigade: {}, fireBrigade: {}
}; }
} else { } else {
this.httpBody.govUnitDetail = JSON.parse(data.result.govUnitDetail); this.httpBody.govUnitDetail = JSON.parse(data.result.govUnitDetail)
this.policeStation = data.result.govUnitDetail.policeStation; this.policeStation = data.result.govUnitDetail.policeStation
this.hospital = data.result.govUnitDetail.hospital; this.hospital = data.result.govUnitDetail.hospital
this.fireBrigade = data.result.govUnitDetail.fireBrigade; this.fireBrigade = data.result.govUnitDetail.fireBrigade
} }
if (this.httpBody.otherData) { if (this.httpBody.otherData) {
this.otherInfoData = JSON.parse(this.httpBody.otherData); this.otherInfoData = JSON.parse(this.httpBody.otherData)
}
console.log("油站信息", this.httpBody);
},
(err) => {
console.log("油站错误信息", err.error.error.message);
} }
); console.log('油站信息', this.httpBody)
}, err => {
console.log('油站错误信息', err.error.error.message)
})
} }
exportExcel() { exportExcel() {
const httpOptions = { const httpOptions = {
responseType: "blob" as "json", responseType: 'blob' as 'json'
}; };
this.http this.http.get(`/api/services/app/GasStation/ExportExcelFile?gasStationId=${this.httpBody.id}`, httpOptions).subscribe((data: any) => {
.get(
`/api/services/app/GasStation/ExportExcelFile?gasStationId=${this.httpBody.id}`,
httpOptions
)
.subscribe(
(data: any) => {
// console.log('导出成功') // console.log('导出成功')
// 文件名中有中文 则对文件名进行转码 // 文件名中有中文 则对文件名进行转码
const link = document.createElement("a"); const link = document.createElement('a');
const blob = new Blob([data], { type: "application/vnd.ms-excel" }); const blob = new Blob([data], { type: 'application/vnd.ms-excel' });
link.setAttribute("href", window.URL.createObjectURL(blob)); link.setAttribute('href', window.URL.createObjectURL(blob));
link.setAttribute( link.setAttribute('download', this.httpBody.stationName + '基本信息' + '.xls');
"download", link.style.visibility = 'hidden';
this.httpBody.stationName + "基本信息" + ".xls"
);
link.style.visibility = "hidden";
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
document.body.removeChild(link); document.body.removeChild(link);
this.message.create("success", "导出成功!"); this.message.create('success', '导出成功!');
}, }, err => {
(err) => { this.message.create('error', '导出失败!');
this.message.create("error", "导出失败!"); })
}
);
} }
policeStation = { policeStation = {
name: "", name: '',
address: "", address: '',
distance: "", distance: '',
contactInformation: "", contactInformation: ''
}; }
hospital = { hospital = {
name: "", name: '',
address: "", address: '',
distance: "", distance: '',
contactInformation: "", contactInformation: ''
}; }
fireBrigade = { fireBrigade = {
name: "", name: '',
address: "", address: '',
distance: "", distance: '',
contactInformation: "", contactInformation: ''
}; }
httpBody = { httpBody = {
id: null, id: null,
stationName: JSON.parse(sessionStorage.getItem("userdata")).organization stationName: JSON.parse(sessionStorage.getItem('userdata')).organization.displayName,
.displayName, organizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id,
organizationUnitId: JSON.parse(sessionStorage.getItem("userdata"))
.organization.id,
auditLog: { auditLog: {
auditStatusDesc: null, auditStatusDesc: null,
rejectReason: null, rejectReason: null
}, },
auditStatus: null, auditStatus: null,
openTime: "", openTime: '',
stationType: "", stationType: '',
laneCount: "", laneCount: '',
address: "", address: '',
locationName: "", locationName: '',
companyName: "", companyName: '',
leaderName: "", leaderName: '',
proposalAreaName: "", proposalAreaName: '',
proposalCompanyName: "", proposalCompanyName: '',
leaderContact: "", leaderContact: '',
stationLevel: "", stationLevel: '',
sellVariety: "", sellVariety: '',
gasStationCount: "", gasStationCount: '',
tankVolume: "", tankVolume: '',
govUnitDetail: { govUnitDetail: {
policeStation: {}, policeStation: {},
hospital: {}, hospital: {},
fireBrigade: {}, fireBrigade: {}
}, },
hasBuildingInfo: true, hasBuildingInfo: true,
businessLicenseImage: "", businessLicenseImage: '',
dangerousChemicalLicenseImage: "", dangerousChemicalLicenseImage: '',
gasSellLicenseImage: "", gasSellLicenseImage: '',
licenses: [], licenses: [
otherData: null, ],
}; otherData: null
}
otherInfoData = { otherInfoData = {
oilingMachine: [ oilingMachine: [
{ { name: '', brand: '', oilGunNum: '', oilsArticleNum: '', oilGunSerialNum: '' }
name: "",
brand: "",
oilGunNum: "",
oilsArticleNum: "",
oilGunSerialNum: "",
},
], ],
tankEquipment: [ tankEquipment: [
{ { name: '', oilsArticleNum: '', oilGunSerialNum: '', oilOmeterVolume: '', safetyVolume: '', oilOmeterType: 0, oilPumpType: 0 }
name: "",
oilsArticleNum: "",
oilGunSerialNum: "",
oilOmeterVolume: "",
safetyVolume: "",
oilOmeterType: 0,
oilPumpType: 0,
},
], ],
oilDeliveryPipe: [ oilDeliveryPipe: [
{ name: "", connectTanker: "", connectOilTank: "", designPaper: "" }, { name: '', connectTanker: '', connectOilTank: '', designPaper: '' }
], ],
oilVaporRecovery: [ oilVaporRecovery: [
{ { name: '油气回收管线', onceSystemType: '将卸油时产生的油气进行回收', twiceSystemType: 1, twicePumpType: 'mini9000', thriceProcessingUnit: '冷凝+吸附', monitoringDevice: '监测气液比、密闭性,出现异常可及时预警', designPaper: '' }
name: "油气回收管线",
onceSystemType: "将卸油时产生的油气进行回收",
twiceSystemType: 1,
twicePumpType: "mini9000",
thriceProcessingUnit: "冷凝+吸附",
monitoringDevice: "监测气液比、密闭性,出现异常可及时预警",
designPaper: "",
},
], ],
valve: [ valve: [
{ { name: 'P/V阀(机械呼吸阀)', description: '阀内设计双向开启功能,阀门处于常闭状态,当油罐压力/真空达到阀门预设压力/真空值时,阀门自行打开进行排气/吸气,以维持油罐内压力与大气压保持平衡。' }
name: "P/V阀(机械呼吸阀)", ]
description: }
"阀内设计双向开启功能,阀门处于常闭状态,当油罐压力/真空达到阀门预设压力/真空值时,阀门自行打开进行排气/吸气,以维持油罐内压力与大气压保持平衡。",
},
],
};
addTable(tableData, type) { addTable(tableData, type) {
if (type == "oilingMachine") { if (type == 'oilingMachine') {
tableData.push({ tableData.push({ name: '', brand: '', oilGunNum: '', oilsArticleNum: '', oilGunSerialNum: '' })
name: "",
brand: "",
oilGunNum: "",
oilsArticleNum: "",
oilGunSerialNum: "",
});
} }
if (type == "tankEquipment") { if (type == 'tankEquipment') {
tableData.push({ tableData.push({ name: '', oilsArticleNum: '', oilGunSerialNum: '', oilOmeterVolume: '', safetyVolume: '', oilOmeterType: 0, oilPumpType: 0 })
name: "",
oilsArticleNum: "",
oilGunSerialNum: "",
oilOmeterVolume: "",
safetyVolume: "",
oilOmeterType: 0,
oilPumpType: 0,
});
} }
if (type == "oilDeliveryPipe") { if (type == 'oilDeliveryPipe') {
tableData.push({ tableData.push({ name: '', connectTanker: '', connectOilTank: '', designPaper: '' })
name: "",
connectTanker: "",
connectOilTank: "",
designPaper: "",
});
} }
} }
deleteTable(tableData, key) { deleteTable(tableData, key) {
tableData.splice(key, 1); tableData.splice(key, 1)
} }
uploadType: string;
isUploadLoading = false; uploadType: string
isUploadLoading = false
filechange(e, type, item) { filechange(e, type, item) {
this.isUploadLoading = true; this.isUploadLoading = true
let file = e.target.files[0] || null; //获取上传的文件 let file = e.target.files[0] || null //获取上传的文件
this.uploadType = type; this.uploadType = type
this.openFileSelect( this.openFileSelect(file, `stationPhotos/${this.route.snapshot.queryParams.id}/`, item)
file,
`stationPhotos/${this.route.snapshot.queryParams.id}/`,
item
);
} }
//设置文件路径并上传 //设置文件路径并上传
postFilePath; postFilePath
async openFileSelect(file: File, extensionPath: string, item) { async openFileSelect(file: File, extensionPath: string, item) {
this.postFilePath = extensionPath; this.postFilePath = extensionPath;
let fileSize = file.size || null; //上传文件的总大小 let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024; //5MB 超过5MB要分块上传 let shardSize = 5 * 1024 * 1024 //5MB 超过5MB要分块上传
if (fileSize >= shardSize) { if (fileSize >= shardSize) // 超过5MB要分块上传
// 超过5MB要分块上传 {
await this.postFileByMul(file, item); await this.postFileByMul(file, item);
} //普通上传 }
else { else //普通上传
{
await this.postFile(file, item); await this.postFile(file, item);
} }
} }
//上传文件 //上传文件
async postFile(file: File, item) { async postFile(file: File, item) {
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
this.objectsSrv.postFile(this.postFilePath, file).subscribe((data) => { this.objectsSrv.postFile(this.postFilePath, file).subscribe(data => {
let dataObj = data as any; let dataObj = data as any;
let filePath: string = let filePath: string = ObjectsSimpleService.baseUrl + dataObj.objectName;
ObjectsSimpleService.baseUrl + dataObj.objectName; item.designPaper = filePath
item.designPaper = filePath; this.isUploadLoading = false
this.isUploadLoading = false; resolve('success')
resolve("success");
});
}); });
})
} }
/** /**
* *
* @param file * @param file
*/ */
postFileByMul(file: File, item) { postFileByMul(file: File, item) {
this.objectsSrv this.objectsSrv.postFile_MultipartUpload(this.postFilePath, file).then((value) => {
.postFile_MultipartUpload(this.postFilePath, file)
.then((value) => {
let dataObj = value as any; let dataObj = value as any;
item.designPaper = dataObj.filePath; item.designPaper = dataObj.filePath
this.isUploadLoading = false; this.isUploadLoading = false
}); });
} }
//查看图片 //查看图片
viewImg(url) { viewImg(url) {
let dom = document.getElementById(`viewerjs`); let dom = document.getElementById(`viewerjs`)
let pObjs = dom.childNodes; let pObjs = dom.childNodes;
let node = document.createElement("img"); let node = document.createElement("img")
node.style.display = "none"; node.style.display = "none";
node.src = url; node.src = url;
node.id = "img"; node.id = 'img'
dom.appendChild(node); dom.appendChild(node)
setTimeout(() => { setTimeout(() => {
let viewer = new Viewer(document.getElementById(`viewerjs`), { let viewer = new Viewer(document.getElementById(`viewerjs`), {
hidden: () => { hidden: () => {
dom.removeChild(pObjs[0]); dom.removeChild(pObjs[0]);
viewer.destroy(); viewer.destroy();
}, }
}); });
node.click(); node.click();
}, 0); }, 0);
@ -355,92 +286,78 @@ export class OilStationInfoComponent implements OnInit {
history.go(-1); history.go(-1);
} }
isLoadingSave: boolean = false; isLoadingSave: boolean = false
async submitForm() { async submitForm() {
if (this.validateForm.valid) { if (this.validateForm.valid) {
this.isLoadingSave = true; this.isLoadingSave = true
this.httpBody.openTime = moment(this.httpBody.openTime).format( this.httpBody.openTime = moment(this.httpBody.openTime).format('YYYY-MM-DD')//开业时间格式化
"YYYY-MM-DD" this.httpBody.govUnitDetail.policeStation = this.validateForm.value.policeStation
); //开业时间格式化 this.httpBody.govUnitDetail.hospital = this.validateForm.value.hospital
this.httpBody.govUnitDetail.policeStation = this.httpBody.govUnitDetail.fireBrigade = this.validateForm.value.fireBrigade
this.validateForm.value.policeStation;
this.httpBody.govUnitDetail.hospital = this.validateForm.value.hospital; let body = JSON.parse(JSON.stringify(this.httpBody))
this.httpBody.govUnitDetail.fireBrigade = body.stationType
this.validateForm.value.fireBrigade; body.govUnitDetail = JSON.stringify(this.httpBody.govUnitDetail)
let body = JSON.parse(JSON.stringify(this.httpBody));
body.stationType;
body.govUnitDetail = JSON.stringify(this.httpBody.govUnitDetail);
if (!body.hasBuildingInfo) { if (!body.hasBuildingInfo) {
body.otherData = JSON.stringify(this.otherInfoData); body.otherData = JSON.stringify(this.otherInfoData)
} }
body.licenses.forEach((item) => { body.licenses.forEach(item => {
delete item.isPerpetual; delete item.isPerpetual
}); })
// body.stationName = "太原东服务区东区加油站";
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
this.http.put("/api/services/app/GasStation/Update", body).subscribe( this.http.put('/api/services/app/GasStation/Update', body).subscribe((data: any) => {
(data: any) => { resolve(data)
resolve(data); this.isLoadingSave = false
this.isLoadingSave = false; this.message.create('success', '保存成功!');
this.message.create("success", "保存成功!"); }, err => {
}, reject(err)
(err) => { this.isLoadingSave = false
reject(err); this.message.create('error', '保存失败!');
this.isLoadingSave = false; })
this.message.create("error", "保存失败!"); })
}
);
});
} else { } else {
this.message.create("warning", "请填写完整!"); this.message.create('warning', '请填写完整!');
return false; return false
} }
} }
isSubmitAuditLoading: boolean = false;
isSubmitAuditLoading: boolean = false
async submitAudit() { async submitAudit() {
await this.submitForm();
await this.submitForm()
if (this.validateForm.valid) { if (this.validateForm.valid) {
let params = { let params = {
id: this.httpBody.id, id: this.httpBody.id
};
this.http
.post("/api/services/app/GasStation/Commit", null, { params: params })
.subscribe(
(data: any) => {
this.isSubmitAuditLoading = false;
this.getInfo();
this.message.create("success", "提交审核成功!");
},
(err) => {
this.isSubmitAuditLoading = false;
this.message.create("error", "提交审核失败!");
} }
); this.http.post('/api/services/app/GasStation/Commit', null, { params: params }).subscribe((data: any) => {
this.isSubmitAuditLoading = false
this.getInfo()
this.message.create('success', '提交审核成功!');
}, err => {
this.isSubmitAuditLoading = false
this.message.create('error', '提交审核失败!');
})
} }
} }
isRevocationAuditLoading: boolean = false; isRevocationAuditLoading: boolean = false
revocationAudit() { revocationAudit() {
let params = { let params = {
id: this.httpBody.id, id: this.httpBody.id
};
this.http
.post("/api/services/app/GasStation/Uncommit", null, { params: params })
.subscribe(
(data: any) => {
this.isRevocationAuditLoading = false;
this.getInfo();
this.message.create("success", "撤销审核成功!");
},
(err) => {
this.isRevocationAuditLoading = false;
this.message.create("error", "撤销审核失败!");
} }
); this.http.post('/api/services/app/GasStation/Uncommit', null, { params: params }).subscribe((data: any) => {
this.isRevocationAuditLoading = false
this.getInfo()
this.message.create('success', '撤销审核成功!');
}, err => {
this.isRevocationAuditLoading = false
this.message.create('error', '撤销审核失败!');
})
} }
} }

10
src/app/pages/oil-unloading-process/anxin-img-look/anxin-img-look.component.ts

@ -40,7 +40,7 @@ export class AnxinImgLookComponent implements OnInit {
legendList: any = []; legendList: any = [];
typeArr = [ typeArr = [
{ id: 0, name: "工装", color: "#91CCFF" }, { id: 0, name: "工装", color: "#91CCFF" },
{ id: 1, name: "便装", color: "#46DFFF" }, { id: 2, name: "便装", color: "#46DFFF" },
{ id: 2, name: "抽烟", color: "#36A2FF" }, { id: 2, name: "抽烟", color: "#36A2FF" },
{ id: 3, name: "打电话", color: "#FF6181" }, { id: 3, name: "打电话", color: "#FF6181" },
{ id: 4, name: "隔离锥", color: "#000000" }, { id: 4, name: "隔离锥", color: "#000000" },
@ -54,14 +54,6 @@ export class AnxinImgLookComponent implements OnInit {
{ id: 12, name: "卸油车", color: "yellow" }, { id: 12, name: "卸油车", color: "yellow" },
{ id: 13, name: "私家车", color: "black" }, { id: 13, name: "私家车", color: "black" },
{ id: 14, name: "断开的卸油管", color: "blue" }, { id: 14, name: "断开的卸油管", color: "blue" },
{ id: 15, name: "烟雾预警", color: "#B4C3FF" },
{ id: 16, name: "火灾报警", color: "red" },
{ id: 17, name: "延长工装", color: "blue" },
{ id: 18, name: "江苏工装", color: "blue" },
{ id: 19, name: "经理工装", color: "yellow" },
{ id: 20, name: "江苏道达尔工装", color: "yellow" },
{ id: 21, name: "延长壳牌工装", color: "red" },
{ id: 22, name: "山西高速工装", color: "red" },
]; ];
userName; //登录账号的用户名 userName; //登录账号的用户名

97
src/app/pages/pages-routing.module.ts

@ -1,69 +1,54 @@
import { Routes, RouterModule } from "@angular/router"; import { Routes, RouterModule } from '@angular/router';
import { NgModule } from "@angular/core"; import { NgModule } from '@angular/core';
import { PlanComponent } from "./plan/plan.component"; import { PlanComponent } from './plan/plan.component';
import { TodayWarningComponent } from "./today-warning/today-warning.component"; import { TodayWarningComponent } from './today-warning/today-warning.component';
import { CriminalRecordsComponent } from "./records/criminal-records/criminal-records.component"; import { CriminalRecordsComponent } from './records/criminal-records/criminal-records.component';
import { AuthGuard } from "../auth.guard"; import { AuthGuard } from '../auth.guard'
import { TodayWarningAdminComponent } from "./today-warning-admin/today-warning-admin.component"; import { TodayWarningAdminComponent } from './today-warning-admin/today-warning-admin.component';
import { CriminalRecordsAdminComponent } from "./records/criminal-records-admin/criminal-records-admin.component"; import { CriminalRecordsAdminComponent } from './records/criminal-records-admin/criminal-records-admin.component';
import { OilStationInfoComponent } from "./oil-station-info/oil-station-info.component"; import { OilStationInfoComponent } from './oil-station-info/oil-station-info.component';
import { EquipmentInfoComponent } from "./equipment-info/equipment-info.component"; import { EquipmentInfoComponent } from './equipment-info/equipment-info.component';
import { PlanAdminComponent } from "./plan-admin/plan-admin.component"; import { PlanAdminComponent } from './plan-admin/plan-admin.component';
import { HomePageComponent } from "./home-page/home-page.component"; import { HomePageComponent } from './home-page/home-page.component';
import { OilUnloadingProcessListComponent } from "./records/oil-unloading-process-list/oil-unloading-process-list.component"; import { OilUnloadingProcessListComponent } from './records/oil-unloading-process-list/oil-unloading-process-list.component';
import { init3DGuard } from "./init3D.guard"; import { init3DGuard } from './init3D.guard';
import { NavBarComponent } from "./license/nav-bar/nav-bar.component"; import { NavBarComponent } from './license/nav-bar/nav-bar.component';
import { AuditNavComponent } from "./audit/audit-nav/audit-nav.component"; import { AuditNavComponent } from './audit/audit-nav/audit-nav.component';
import { WarningStatisticsListComponent } from "./records/warning-statistics-list/warning-statistics-list.component"; import { WarningStatisticsListComponent } from './records/warning-statistics-list/warning-statistics-list.component';
import { RecordsNavComponent } from "./records/records-nav/records-nav.component"; import { RecordsNavComponent } from './records/records-nav/records-nav.component';
import { DownImageComponent } from "./down-image/down-image.component"; import { DownImageComponent } from './down-image/down-image.component'
import { HomePageComprehensiveComponent } from "./home-page-comprehensive/home-page-comprehensive.component";
const routes: Routes = [ const routes: Routes = [
{ path: "homepage", component: HomePageComponent }, { path: 'homepage', component: HomePageComponent },
{ path: "comprehensive", component: HomePageComprehensiveComponent }, { path: 'plan', component: PlanAdminComponent },
{ path: "plan", component: PlanAdminComponent }, { path: 'plan/petrolStation', component: PlanComponent, canActivate: [init3DGuard], },
{ path: 'todaywarning', component: TodayWarningAdminComponent },
{ path: 'todaywarning/petrolStation', component: TodayWarningComponent },
{ {
path: "plan/petrolStation", path: 'records_nav', component: RecordsNavComponent, children: [
component: PlanComponent, { path: 'all', component: CriminalRecordsAdminComponent },
canActivate: [init3DGuard], { path: 'oliunloadinglist', component: OilUnloadingProcessListComponent },
{ path: 'warningstatisticslist', component: WarningStatisticsListComponent },
]
}, },
{ path: "todaywarning", component: TodayWarningAdminComponent },
{ path: "todaywarning/petrolStation", component: TodayWarningComponent },
{ {
path: "records_nav", path: 'records_nav/petrolStation', component: RecordsNavComponent, children: [
component: RecordsNavComponent, { path: 'all', component: CriminalRecordsComponent },
children: [ { path: 'oliunloadinglist', component: OilUnloadingProcessListComponent },
{ path: "all", component: CriminalRecordsAdminComponent }, { path: 'warningstatisticslist', component: WarningStatisticsListComponent }
{ path: "oliunloadinglist", component: OilUnloadingProcessListComponent }, ]
{
path: "warningstatisticslist",
component: WarningStatisticsListComponent,
},
],
}, },
{ { path: 'equipmentInfo', component: EquipmentInfoComponent },
path: "records_nav/petrolStation", { path: 'oliStationInfo', component: OilStationInfoComponent },
component: RecordsNavComponent, { path: 'license/petrolStation', component: NavBarComponent },
children: [ { path: 'audit', component: AuditNavComponent },
{ path: "all", component: CriminalRecordsComponent }, { path: 'downImage', component: DownImageComponent }
{ path: "oliunloadinglist", component: OilUnloadingProcessListComponent },
{
path: "warningstatisticslist",
component: WarningStatisticsListComponent,
},
],
},
{ path: "equipmentInfo", component: EquipmentInfoComponent },
{ path: "oliStationInfo", component: OilStationInfoComponent },
{ path: "license/petrolStation", component: NavBarComponent },
{ path: "audit", component: AuditNavComponent },
{ path: "downImage", component: DownImageComponent },
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule], exports: [RouterModule]
}) })
export class PagesRoutingModule { } export class PagesRoutingModule { }

8
src/app/pages/pages.module.ts

@ -94,12 +94,14 @@ import { HomePageNologinComponent } from './home-page-nologin/home-page-nologin.
import { DownImageComponent } from './down-image/down-image.component'; import { DownImageComponent } from './down-image/down-image.component';
import { ImgLookComponent } from './audit/img-look/img-look.component'; import { ImgLookComponent } from './audit/img-look/img-look.component';
import { AnxinImgLookComponent } from './oil-unloading-process/anxin-img-look/anxin-img-look.component'; import { AnxinImgLookComponent } from './oil-unloading-process/anxin-img-look/anxin-img-look.component';
import { SingleloginComponent } from './singlelogin/singlelogin.component'; import { GisHomeComponent } from './gis-home/gis-home.component';
import { HomePageComprehensiveComponent } from './home-page-comprehensive/home-page-comprehensive.component'; import { CardTitleComponent } from './gis-home/card-title/card-title.component';
import { UnitTitleComponent } from './gis-home/unit-title/unit-title.component';
import { CardListComponent } from './gis-home/card-list/card-list.component';
@NgModule({ @NgModule({
declarations: [LoginComponent, RegisterComponent, HomeComponent, PlanComponent, TodayWarningComponent, CriminalRecordsComponent, declarations: [LoginComponent, RegisterComponent, HomeComponent, PlanComponent, TodayWarningComponent, CriminalRecordsComponent,
TodayWarningAdminComponent, CriminalRecordsAdminComponent, LeftDomainComponent, EquipmentInfoComponent, OilStationInfoComponent, TodayWarningAdminComponent, CriminalRecordsAdminComponent, LeftDomainComponent, EquipmentInfoComponent, OilStationInfoComponent,
AddequipmentComponent, EditequipmentComponent, PlanAdminComponent, GetOutOfLineDetailsComponent, DispositionComponent, OilUnloadingProcessComponent, HomePageComponent, OilUnloadingProcessListComponent, ChangePasswordComponent, FacilitySortPipe, WarningStatisticsListComponent, DisposeequipmentComponent, NavBarComponent, InformComponent, UpdateCategoryComponent, FileCategoryComponent, HistoriesComponent, EditUpdateCategoryComponent, DetailsUpdateCategoryComponent, EditFileCategoryComponent, DetailsFileCategoryComponent, PdfWordLookComponent, OilStationListComponent, UpdateLicenseListComponent, FileLicenseListComponent, AuditNavComponent, AuditIngComponent, AuditRecordComponent, AuditInformTimeComponent, AuditDisposeComponent, EditInformTimeComponent, AuditDetailsInformTimeComponent, auditStatusPipe, GasBaseInfoComponent, notificationContent, licenseViolationType, handleState, AnnualInspectionComponent, EditAnnualInspectionComponent, RecordsNavComponent, UserDetailsComponent, AppealDetailsComponent, fileName, SystemModelComponent, ForgetComponent, HomePageNologinComponent, DownImageComponent, ImgLookComponent, AnxinImgLookComponent, SingleloginComponent, HomePageComprehensiveComponent], AddequipmentComponent, EditequipmentComponent, PlanAdminComponent, GetOutOfLineDetailsComponent, DispositionComponent, OilUnloadingProcessComponent, HomePageComponent, OilUnloadingProcessListComponent, ChangePasswordComponent, FacilitySortPipe, WarningStatisticsListComponent, DisposeequipmentComponent, NavBarComponent, InformComponent, UpdateCategoryComponent, FileCategoryComponent, HistoriesComponent, EditUpdateCategoryComponent, DetailsUpdateCategoryComponent, EditFileCategoryComponent, DetailsFileCategoryComponent, PdfWordLookComponent, OilStationListComponent, UpdateLicenseListComponent, FileLicenseListComponent, AuditNavComponent, AuditIngComponent, AuditRecordComponent, AuditInformTimeComponent, AuditDisposeComponent, EditInformTimeComponent, AuditDetailsInformTimeComponent, auditStatusPipe, GasBaseInfoComponent, notificationContent, licenseViolationType, handleState, AnnualInspectionComponent, EditAnnualInspectionComponent, RecordsNavComponent, UserDetailsComponent, AppealDetailsComponent, fileName, SystemModelComponent, ForgetComponent, HomePageNologinComponent, DownImageComponent, ImgLookComponent, AnxinImgLookComponent, GisHomeComponent, CardTitleComponent, UnitTitleComponent, CardListComponent],
imports: [ imports: [

10
src/app/pages/plan-admin/file-license-list/file-license-list.component.ts

@ -88,10 +88,8 @@ export class FileLicenseListComponent implements OnInit {
async getAllOrganization() { async getAllOrganization() {
let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata")) let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata"))
.organization.id; .organization.id;
let OrganizationUnitIds = JSON.parse(
sessionStorage.getItem("userdata")
).organizations?.map((v) => v.id);
let params = { let params = {
OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true", IsContainsChildren: "true",
}; };
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
@ -101,15 +99,9 @@ export class FileLicenseListComponent implements OnInit {
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items.forEach((element) => { data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) { if (element.id == OrganizationUnitId) {
element.parentId = null; element.parentId = null;
} }
}
element.key = element.id; element.key = element.id;
element.title = element.displayName; element.title = element.displayName;
}); });

216
src/app/pages/plan-admin/plan-admin.component.ts

@ -1,175 +1,161 @@
import { Component, OnInit, ViewChild, ElementRef } from "@angular/core"; import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { HttpClient } from "@angular/common/http"; import { HttpClient } from '@angular/common/http';
import { TreeService } from "src/app/service/tree.service"; import { TreeService } from 'src/app/service/tree.service';
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown';
NzContextMenuService, import { NzFormatEmitEvent, NzTreeComponent, NzTreeNode } from 'ng-zorro-antd/tree';
NzDropdownMenuComponent, import { Router } from '@angular/router';
} from "ng-zorro-antd/dropdown"; import { NavChangeService } from 'src/app/service/navChange.service';
import { import { fromEvent } from 'rxjs';
NzFormatEmitEvent, import { debounceTime } from 'rxjs/operators';
NzTreeComponent, import { OilStationListComponent } from './oil-station-list/oil-station-list.component';
NzTreeNode, import { UpdateLicenseListComponent } from './update-license-list/update-license-list.component';
} from "ng-zorro-antd/tree"; import { FileLicenseListComponent } from './file-license-list/file-license-list.component';
import { Router } from "@angular/router";
import { NavChangeService } from "src/app/service/navChange.service";
import { fromEvent } from "rxjs";
import { debounceTime } from "rxjs/operators";
import { OilStationListComponent } from "./oil-station-list/oil-station-list.component";
import { UpdateLicenseListComponent } from "./update-license-list/update-license-list.component";
import { FileLicenseListComponent } from "./file-license-list/file-license-list.component";
@Component({ @Component({
selector: "app-plan-admin", selector: 'app-plan-admin',
templateUrl: "./plan-admin.component.html", templateUrl: './plan-admin.component.html',
styleUrls: ["./plan-admin.component.scss"], styleUrls: ['./plan-admin.component.scss']
}) })
export class PlanAdminComponent implements OnInit { export class PlanAdminComponent implements OnInit {
@ViewChild("nzTreeComponent", { static: false })
nzTreeComponent!: NzTreeComponent; @ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent;
@ViewChild("child") oilStationListComponent!: OilStationListComponent; @ViewChild('child') oilStationListComponent!: OilStationListComponent;;
@ViewChild("child2") updateLicenseListComponent!: UpdateLicenseListComponent; @ViewChild('child2') updateLicenseListComponent!: UpdateLicenseListComponent;;
@ViewChild("child3") fileLicenseListComponent!: FileLicenseListComponent; @ViewChild('child3') fileLicenseListComponent!: FileLicenseListComponent;;
constructor( constructor(private element: ElementRef, private navChangeService: NavChangeService, private http: HttpClient, private toTree: TreeService, private fb: FormBuilder, private nzContextMenuService: NzContextMenuService, private router: Router) { }
private element: ElementRef,
private navChangeService: NavChangeService,
private http: HttpClient,
private toTree: TreeService,
private fb: FormBuilder,
private nzContextMenuService: NzContextMenuService,
private router: Router
) {}
ngOnInit(): void { ngOnInit(): void {
this.getAllOrganization(); this.getAllOrganization()
} }
//选择右侧tab页 //选择右侧tab页
selectedTab = 0; selectedTab = 0
selectTab(index) { selectTab(index) {
this.selectedTab = index; this.selectedTab = index
if (this.selectedTab == 0) { if (this.selectedTab == 0) {
setTimeout(() => { setTimeout(() => {
this.oilStationListComponent.list = []; this.oilStationListComponent.list = []
this.oilStationListComponent.SkipCount = "0"; this.oilStationListComponent.SkipCount = '0'
this.oilStationListComponent.onChildMethod(); this.oilStationListComponent.onChildMethod()
}, 0); }, 0);
} }
if (this.selectedTab == 1) { if (this.selectedTab == 1) {
setTimeout(() => { setTimeout(() => {
this.updateLicenseListComponent.list = []; this.updateLicenseListComponent.list = []
this.updateLicenseListComponent.SkipCount = "0"; this.updateLicenseListComponent.SkipCount = '0'
this.updateLicenseListComponent.onChildMethod(); this.updateLicenseListComponent.onChildMethod()
}, 0); }, 0);
} }
if (this.selectedTab == 2) { if (this.selectedTab == 2) {
setTimeout(() => { setTimeout(() => {
this.fileLicenseListComponent.list = []; this.fileLicenseListComponent.list = []
this.fileLicenseListComponent.SkipCount = "0"; this.fileLicenseListComponent.SkipCount = '0'
this.fileLicenseListComponent.onChildMethod(); this.fileLicenseListComponent.onChildMethod()
}, 0); }, 0);
} }
} }
//获取所有组织机构 //获取所有组织机构
nodes: any = []; nodes: any = []
nzExpandAll = false; nzExpandAll = false
nzSelectedKeys: any = []; nzSelectedKeys: any = []
orSpin: boolean = false; orSpin: boolean = false
organization: any; organization: any
getAllOrganization() { getAllOrganization() {
this.orSpin = true; this.orSpin = true
let OrganizationUnitId = JSON.parse(sessionStorage.getItem('userdata')).organization.id
let params = { let params = {
IsContainsChildren: "true", OrganizationUnitId: OrganizationUnitId,
}; IsContainsChildren: "true"
this.http }
.get("/api/services/app/Organization/GetAll", { this.http.get('/api/services/app/Organization/GetAll', {
params: params, params: params
}).subscribe((data: any) => {
data.result.items = data.result.items.filter((item, i) => {
return !item.isGasStation
})
this.organization = data.result.items
this.getStationsNum(data.result.items)
}) })
.subscribe((data: any) => {
this.organization = data.result.items;
this.getStationsNum(data.result.items);
});
} }
//获得组织机构下有多少油站 //获得组织机构下有多少油站
stationsList; stationsList
getStationsNum(currentOrList) { getStationsNum(e) {
console.log("e", currentOrList); let OrganizationUnitId = JSON.parse(sessionStorage.getItem('userdata')).organization.id
let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata")) this.http.get('/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true').subscribe((data: any) => {
.organization.id; this.stationsList = data.result
let OrganizationUnitIds = JSON.parse( const arrs = e.map(item => {
sessionStorage.getItem("userdata") const data = this.stationsList.find(i => item.id == i.organizationId)
).organizations.map((v) => v.id);
this.http
.get(
"/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true"
)
.subscribe((data: any) => {
this.stationsList = data.result;
const arrs = currentOrList.map((item) => {
const data = this.stationsList.find(
(i) => item.id == i.organizationId
);
return { return {
...item, ...item,
products: data ? data : false, products: data ? data : false
};
});
for (let index = 0; index < arrs.length; index++) {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(arrs[index].id)) {
arrs[index].parentId = null;
} }
} else { })
for (let index = 0; index < arrs.length; index++) {
if (arrs[index].id == OrganizationUnitId) { if (arrs[index].id == OrganizationUnitId) {
arrs[index].parentId = null; arrs[index].parentId = null
}
} }
arrs[index].title = arrs[index].displayName; arrs[index].title = arrs[index].displayName
arrs[index].key = arrs[index].id; arrs[index].key = arrs[index].id
} }
this.orSpin = false; this.orSpin = false
this.nodes = [...this.toTree.toTree(arrs)]; this.nodes = [...this.toTree.toTree(arrs)]
this.nzExpandedKeys = [this.nodes[0].id]; this.nzExpandedKeys = [OrganizationUnitId]
this.nzSelectedKeys = [this.nodes[0].id]; this.nzSelectedKeys = [OrganizationUnitId]
sessionStorage.setItem("planAdminOrid", this.nodes[0].id); sessionStorage.setItem('planAdminOrid', OrganizationUnitId)
this.oilStationListComponent.onChildMethod(); this.oilStationListComponent.onChildMethod()
}); })
} }
nzExpandedKeys: any = [];
nzExpandedKeys: any = []
activatedNode?: NzTreeNode; activatedNode?: NzTreeNode;
//点击tree节点 //点击tree节点
activeNode(data: NzFormatEmitEvent): void { activeNode(data: NzFormatEmitEvent): void {
this.activatedNode = data.node!; this.activatedNode = data.node!;
sessionStorage.setItem("planAdminOrid", data.node.origin.id); sessionStorage.setItem('planAdminOrid', data.node.origin.id)
if (this.selectedTab == 0) { if (this.selectedTab == 0) {
setTimeout(() => { setTimeout(() => {
this.oilStationListComponent.list = []; this.oilStationListComponent.list = []
this.oilStationListComponent.SkipCount = "0"; this.oilStationListComponent.SkipCount = '0'
this.oilStationListComponent.onChildMethod(); this.oilStationListComponent.onChildMethod()
}, 0); }, 0);
} }
if (this.selectedTab == 1) { if (this.selectedTab == 1) {
setTimeout(() => { setTimeout(() => {
this.updateLicenseListComponent.list = []; this.updateLicenseListComponent.list = []
this.updateLicenseListComponent.SkipCount = "0"; this.updateLicenseListComponent.SkipCount = '0'
this.updateLicenseListComponent.onChildMethod(); this.updateLicenseListComponent.onChildMethod()
}, 0); }, 0);
} }
if (this.selectedTab == 2) { if (this.selectedTab == 2) {
setTimeout(() => { setTimeout(() => {
this.fileLicenseListComponent.list = []; this.fileLicenseListComponent.list = []
this.fileLicenseListComponent.SkipCount = "0"; this.fileLicenseListComponent.SkipCount = '0'
this.fileLicenseListComponent.onChildMethod(); this.fileLicenseListComponent.onChildMethod()
}, 0); }, 0);
} }
} }
expand(e, node) { expand(e, node) {
e.stopPropagation(); e.stopPropagation()
node.isExpanded = !node.isExpanded; node.isExpanded = !node.isExpanded
} }
} }

11
src/app/pages/plan-admin/update-license-list/update-license-list.component.ts

@ -84,11 +84,8 @@ export class UpdateLicenseListComponent implements OnInit {
async getAllOrganization() { async getAllOrganization() {
let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata")) let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata"))
.organization.id; .organization.id;
let OrganizationUnitIds = JSON.parse(
sessionStorage.getItem("userdata")
).organizations?.map((v) => v.id);
let params = { let params = {
OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true", IsContainsChildren: "true",
}; };
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
@ -98,15 +95,9 @@ export class UpdateLicenseListComponent implements OnInit {
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items.forEach((element) => { data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) { if (element.id == OrganizationUnitId) {
element.parentId = null; element.parentId = null;
} }
}
element.key = element.id; element.key = element.id;
element.title = element.displayName; element.title = element.displayName;
}); });

46
src/app/pages/records/criminal-records-admin/criminal-records-admin.component.ts

@ -385,15 +385,7 @@ export class CriminalRecordsAdminComponent implements OnInit {
"-" + "-" +
(nowD < 10 ? "0" + nowD : nowD); //当前日期 (nowD < 10 ? "0" + nowD : nowD); //当前日期
//获取三十天前日期 //获取三十天前日期
let lw; let lw = new Date(myDate - 1000 * 60 * 60 * 24 * 29); //最后一个数字30可改,30天的意思
if (
sessionStorage.getItem("singleSignOn") &&
sessionStorage.getItem("singleSignOn") === "true"
) {
lw = new Date(myDate - 1000 * 60 * 60 * 24 * 180); //最后一个数字30可改,30天的意思
} else {
lw = new Date(myDate - 1000 * 60 * 60 * 24 * 29); //最后一个数字30可改,30天的意思
}
let lastY = lw.getFullYear(); let lastY = lw.getFullYear();
let lastM = lw.getMonth() + 1; let lastM = lw.getMonth() + 1;
let lastD = lw.getDate(); let lastD = lw.getDate();
@ -476,15 +468,13 @@ export class CriminalRecordsAdminComponent implements OnInit {
//获取所有组织机构 //获取所有组织机构
nodes: any = []; nodes: any = [];
getAllOrganization() { getAllOrganization() {
let userData = null; let OrganizationUnitId =
if (sessionStorage.getItem("isGasStation") == "true") { sessionStorage.getItem("isGasStation") == "true"
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation")); ? JSON.parse(sessionStorage.getItem("userdataOfgasstation"))
} else { .organization.id
userData = JSON.parse(sessionStorage.getItem("userdata")); : JSON.parse(sessionStorage.getItem("userdata")).organization.id;
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
let params = { let params = {
OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true", IsContainsChildren: "true",
}; };
this.http this.http
@ -493,15 +483,9 @@ export class CriminalRecordsAdminComponent implements OnInit {
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items.forEach((element) => { data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) { if (element.id == OrganizationUnitId) {
element.parentId = null; element.parentId = null;
} }
}
element.key = element.id; element.key = element.id;
element.title = element.displayName; element.title = element.displayName;
}); });
@ -520,13 +504,17 @@ export class CriminalRecordsAdminComponent implements OnInit {
//饼图 //饼图
let option = this.myChart.getOption(); let option = this.myChart.getOption();
var num = 0; var num = 0;
if (data) {
data.pieTop.forEach((element) => { data.pieTop.forEach((element) => {
num += element.count; num += element.count;
element.name = element.key; element.name = element.key;
element.value = element.count; element.value = element.count;
}); });
this.num = num;
option.series[0].data = data.pieTop; option.series[0].data = data.pieTop;
}
this.num = num;
this.myChart.setOption(option); this.myChart.setOption(option);
} }
//刷新柱状折线图表数据 //刷新柱状折线图表数据
@ -540,10 +528,13 @@ export class CriminalRecordsAdminComponent implements OnInit {
option = this.baroption; option = this.baroption;
let monthArr = []; let monthArr = [];
let valuedata = []; let valuedata = [];
if(data){
data.timeTop.forEach((element) => { data.timeTop.forEach((element) => {
monthArr.push(moment(element.key).format("MM.DD")); monthArr.push(moment(element.key).format("MM.DD"));
valuedata.push(element.count); valuedata.push(element.count);
}); });
}
option.xAxis.data = monthArr; option.xAxis.data = monthArr;
option.series[0].data = valuedata; option.series[0].data = valuedata;
option.series[1].data = valuedata; option.series[1].data = valuedata;
@ -662,13 +653,6 @@ export class CriminalRecordsAdminComponent implements OnInit {
params: params, params: params,
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items = data.result.items.filter((item) => {
return (
item.violation.violationType != "证照资质" ||
(item.violation.violationType == "证照资质" &&
item.gasStation.companyName.includes("延长"))
);
});
this.list = this.list.concat(data.result.items); this.list = this.list.concat(data.result.items);
this.list = [...this.list]; this.list = [...this.list];
this.totalCount = data.result.totalCount; this.totalCount = data.result.totalCount;

1064
src/app/pages/records/criminal-records/criminal-records.component.ts

File diff suppressed because it is too large Load Diff

33
src/app/pages/records/oil-unloading-process-list/oil-unloading-process-list.component.ts

@ -47,7 +47,6 @@ export class OilUnloadingProcessListComponent implements OnInit {
//获取三十天前日期 //获取三十天前日期
var lw = new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * 30); //最后一个数字30可改,30天的意思 var lw = new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * 30); //最后一个数字30可改,30天的意思
console.log("le", lw);
var lastY = lw.getFullYear(); var lastY = lw.getFullYear();
var lastM = lw.getMonth() + 1; var lastM = lw.getMonth() + 1;
var lastD = lw.getDate(); var lastD = lw.getDate();
@ -143,7 +142,6 @@ export class OilUnloadingProcessListComponent implements OnInit {
let nowY = myDate.getFullYear(); let nowY = myDate.getFullYear();
let nowM = myDate.getMonth() + 1; let nowM = myDate.getMonth() + 1;
let nowD = myDate.getDate(); let nowD = myDate.getDate();
this.enddate = this.enddate =
nowY + nowY +
"-" + "-" +
@ -151,16 +149,7 @@ export class OilUnloadingProcessListComponent implements OnInit {
"-" + "-" +
(nowD < 10 ? "0" + nowD : nowD); //当前日期 (nowD < 10 ? "0" + nowD : nowD); //当前日期
//获取三十天前日期 //获取三十天前日期
let lw; let lw = new Date(myDate - 1000 * 60 * 60 * 24 * 29); //最后一个数字30可改,30天的意思
if (
sessionStorage.getItem("singleSignOn") &&
sessionStorage.getItem("singleSignOn") === "true"
) {
lw = new Date(myDate - 1000 * 60 * 60 * 24 * 180); //最后一个数字30可改,30天的意思
} else {
lw = new Date(myDate - 1000 * 60 * 60 * 24 * 29); //最后一个数字30可改,30天的意思
}
let lastY = lw.getFullYear(); let lastY = lw.getFullYear();
let lastM = lw.getMonth() + 1; let lastM = lw.getMonth() + 1;
let lastD = lw.getDate(); let lastD = lw.getDate();
@ -698,15 +687,13 @@ export class OilUnloadingProcessListComponent implements OnInit {
//获取所有组织机构 //获取所有组织机构
nodes: any = []; nodes: any = [];
getAllOrganization() { getAllOrganization() {
let userData = null; let OrganizationUnitId =
if (sessionStorage.getItem("isGasStation") == "true") { sessionStorage.getItem("isGasStation") == "true"
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation")); ? JSON.parse(sessionStorage.getItem("userdataOfgasstation"))
} else { .organization.id
userData = JSON.parse(sessionStorage.getItem("userdata")); : JSON.parse(sessionStorage.getItem("userdata")).organization.id;
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
let params = { let params = {
OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true", IsContainsChildren: "true",
}; };
this.http this.http
@ -715,15 +702,9 @@ export class OilUnloadingProcessListComponent implements OnInit {
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items.forEach((element) => { data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) { if (element.id == OrganizationUnitId) {
element.parentId = null; element.parentId = null;
} }
}
element.key = element.id; element.key = element.id;
element.title = element.displayName; element.title = element.displayName;
}); });

40
src/app/pages/records/records-nav/records-nav.component.ts

@ -18,34 +18,16 @@ export class RecordsNavComponent implements OnInit {
menuList = ["预警类型统计", "卸油统计", "证照预警统计"]; menuList = ["预警类型统计", "卸油统计", "证照预警统计"];
tap = []; tap = [];
userMenu = []; userMenu = [];
menu = []; menu = ["预警类型统计", "卸油统计"];
selectedMenu; selectedMenu;
ngOnInit(): void { ngOnInit(): void {
let a = sessionStorage.getItem("userdata"); console.log(this.router);
this.userMenu = JSON.parse(a).menus;
for (let index = 0; index < this.userMenu.length; index++) {
let a = this.userMenu[index].name;
this.tap.push(a);
}
if (this.userMenu.length == 0) {
this.menu = this.menuList;
} else {
for (let index = 0; index < this.menuList.length; index++) {
for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k] == this.menuList[index]) {
this.menu.push(this.tap[k]);
console.log(this.menu);
}
}
}
}
if (this.router.url.indexOf("oliunloadinglist") !== -1) { if (this.router.url.indexOf("oliunloadinglist") !== -1) {
this.selectedMenu = "卸油统计"; this.selectedMenu = "卸油统计";
} else { }
if (this.router.url === "/records_nav") {
this.selectedMenu = this.menu[0]; this.selectedMenu = this.menu[0];
} }
// this.selectedMenu = this.menu[0];
this.routerChange(); this.routerChange();
} }
@ -59,10 +41,16 @@ export class RecordsNavComponent implements OnInit {
} }
routerChange() { routerChange() {
if ( console.log("this.selectedMenu", this.selectedMenu);
sessionStorage.getItem("isGasStation") == "false" || if (this.selectedMenu == "预警类型统计") {
sessionStorage.getItem("isZT") == "true" this.router.navigate(["/records_nav/all"]);
) { } else if (this.selectedMenu == "卸油统计") {
this.router.navigate(["/records_nav/oliunloadinglist"]);
} else if (this.selectedMenu == "证照预警统计") {
this.router.navigate(["/records_nav/warningstatisticslist"]);
}
return;
if (sessionStorage.getItem("isGasStation") == "false") {
if (this.selectedMenu == "预警类型统计") { if (this.selectedMenu == "预警类型统计") {
this.router.navigate(["/records_nav/all"]); this.router.navigate(["/records_nav/all"]);
} else if (this.selectedMenu == "卸油统计") { } else if (this.selectedMenu == "卸油统计") {

965
src/app/pages/records/warning-statistics-list/warning-statistics-list.component.ts

File diff suppressed because it is too large Load Diff

0
src/app/pages/singlelogin/singlelogin.component.html

0
src/app/pages/singlelogin/singlelogin.component.scss

405
src/app/pages/singlelogin/singlelogin.component.ts

@ -1,405 +0,0 @@
import { HttpClient } from "@angular/common/http";
import { ActivatedRoute, Router } from "@angular/router";
import { Component, OnInit, TemplateRef, ViewChild } from "@angular/core";
import { FormBuilder, FormGroup } from "@angular/forms";
import { NzFormatEmitEvent } from "ng-zorro-antd/tree";
import { TreeService } from "src/app/service/tree.service";
import { NzMessageService } from "ng-zorro-antd/message";
@Component({
selector: "app-singlelogin",
templateUrl: "./singlelogin.component.html",
styleUrls: ["./singlelogin.component.scss"],
})
export class SingleloginComponent implements OnInit {
constructor(
public route: ActivatedRoute,
private fb: FormBuilder,
private http: HttpClient,
private toTree: TreeService,
private router: Router,
private message: NzMessageService
) {}
sinToken;
pageType;
async ngOnInit(): Promise<void> {
console.log("查询参数", this.route.snapshot.queryParams.page);
this.pageType = this.route.snapshot.queryParams.page;
let token = this.getCookie("SAG_USER_TOKEN");
if (!token) {
alert("未获取到token!");
return;
} else {
token = token.replace(/%3D/g, "=");
this.sinToken = token;
await this.getCurrentUserInfo();
await this.getAuthOrganInfos();
if (this.CurrentUserInfo && this.AuthOrganInfos) {
this.SinochemLogin();
}
}
}
//设置cookie
setCookie(obj) {
for (let key in obj) {
document.cookie = key + "=" + obj[key];
}
}
//读取cookie
getCookie(key) {
console.log(
document.cookie.match(new RegExp("(^|\\s)" + key + "=([^;]+)(;|$)"))
);
let arr = document.cookie.match(
new RegExp("(^|\\s)" + key + "=([^;]+)(;|$)")
);
if (arr && arr.length !== 0) {
return document.cookie.match(
new RegExp("(^|\\s)" + key + "=([^;]+)(;|$)")
)[2];
} else {
return null;
}
}
//删除cookie
removeCookie(key) {
this.setCookie({ [key]: "" });
}
CurrentUserInfo;
AuthOrganInfos;
//获取当前登录用户信息
getCurrentUserInfo() {
return new Promise<void>((resolve, reject) => {
this.http
.get("/sagframe-portal/p3p/auth/getCurrentUserInfo", {
params: {
token: this.sinToken,
},
})
.subscribe(
(data: any) => {
this.CurrentUserInfo = data;
console.log("当前登录用户信息", this.CurrentUserInfo);
resolve();
},
(err) => {
alert("请求中台接口失败");
reject();
}
);
});
}
//获取当前登录用户授权机构
getAuthOrganInfos() {
return new Promise<void>((resolve, reject) => {
this.http
.get("/sagframe-portal/p3p/auth/getAuthOrganInfos", {
params: {
token: this.sinToken,
},
headers: {
resId:
this.pageType == "ai"
? "1724119213161666287118"
: "1724119243583142965118",
},
})
.subscribe(
(data: any) => {
this.AuthOrganInfos = data;
console.log("当前登录用户授权机构", this.CurrentUserInfo);
resolve();
},
(err) => {
alert("请求中台接口失败");
reject();
}
);
});
}
downloadAsTxt(obj) {
// 将对象转换为 JSON 字符串
const jsonString = JSON.stringify(obj, null, 2);
// 创建 Blob 对象
const blob = new Blob([jsonString], { type: "text/plain" });
// 创建下载链接
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "错误参数.txt"; // 文件名为 data.txt
link.click(); // 触发下载
// 释放 URL 对象
URL.revokeObjectURL(link.href);
}
//中化用户登录获得自己的token信息
SinochemLogin() {
return new Promise<void>((resolve, reject) => {
this.CurrentUserInfo.data.userId = this.CurrentUserInfo.data.id;
delete this.CurrentUserInfo.data.id;
delete this.CurrentUserInfo.data.permissions;
let body = {
user: this.CurrentUserInfo.data,
org: this.AuthOrganInfos.data[0],
sinochemOrgs: this.AuthOrganInfos.data,
userDetail: JSON.stringify(this.CurrentUserInfo.data),
};
this.http.post("/api/TokenAuth/SinochemLogin", body).subscribe(
(data: any) => {
sessionStorage.setItem("isZT", "true");
if (this.pageType == "ai") {
this.enterPage(data);
} else if (this.pageType == "comprehensive") {
this.enterComprehensive(data);
} else {
this.enterPageSystem(data);
}
resolve();
},
(err) => {
this.downloadAsTxt(body);
alert(err?.error?.error?.message || "SinochemLogin接口请求失败");
reject();
}
);
});
}
enterPageSystem(tokenData) {
sessionStorage.setItem("token", tokenData.result.accessToken);
sessionStorage.setItem(
"encryptedAccessToken",
tokenData.result.encryptedAccessToken
);
this.http
.get("/api/services/app/Session/GetCurrentLoginInformations")
.subscribe(
async (data: any) => {
console.log("当前登录账号的信息", data.result);
sessionStorage.setItem("userdata", JSON.stringify(data.result.user));
sessionStorage.setItem(
"userdataOfgasstation",
JSON.stringify(data.result.user)
);
if (data.result.user.menus.length == 0) {
alert("当前用户未分配菜单");
return;
}
if (!data.result.user.organization) {
alert("当前用户没有组织机构信息");
return;
}
// if (data.result.user.organization.isGasStation) {
// alert("油站用户无系统管理权限");
// return;
// }
//跳转页面
this.toPageSystem();
},
(err) => {
alert("获取用户信息错误");
}
);
}
menu3 = [
{ name: "组织机构管理", url: "/system/organization" },
{ name: "用户管理", url: "/system/user" },
{ name: "角色管理", url: "/system/role" },
{ name: "分析主机管理", url: "/system/host" },
{ name: "推送管理", url: "/system/push" },
{ name: "经营类证照管理", url: "/system/updateOfLicense" },
{ name: "资产类证照管理", url: "/system/fileOfLicense" },
{ name: "菜单管理", url: "/system/menu" },
];
userMenu = [];
tap = [];
menuList2 = [];
toPageSystem() {
let a = sessionStorage.getItem("userdata");
this.userMenu = JSON.parse(a).menus;
for (let index = 0; index < this.userMenu.length; index++) {
let a = this.userMenu[index].name;
this.tap.push(a);
}
for (let index = 0; index < this.menu3.length; index++) {
for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k] == this.menu3[index].name) {
this.menuList2.push(this.menu3[index]);
}
}
}
if (this.menuList2.length == 0) {
this.message.create("warning", "未分配系统管理菜单");
return;
} else {
this.router.navigate([this.menuList2[0].url]);
}
}
enterPage(tokenData) {
sessionStorage.setItem("token", tokenData.result.accessToken);
sessionStorage.setItem(
"encryptedAccessToken",
tokenData.result.encryptedAccessToken
);
this.http
.get("/api/services/app/Session/GetCurrentLoginInformations")
.subscribe(
async (data: any) => {
console.log("当前登录账号的信息", data.result);
sessionStorage.setItem("userdata", JSON.stringify(data.result.user));
sessionStorage.setItem(
"userdataOfgasstation",
JSON.stringify(data.result.user)
);
if (data.result.user.menus.length == 0) {
alert("当前用户未分配菜单");
return;
}
if (!data.result.user.organization) {
alert("当前用户没有组织机构信息");
return;
}
if (data.result.user.organization.isGasStation) {
await this.getGasStationBaseInfo();
// if (
// data.result.user.menus[0].name == "数字油站" &&
// data.result.user.menus.length == 1 &&
// !this.init3D
// ) {
// this.message.create(
// "error",
// `当前用户油站未开通3D且仅分配油站菜单`
// );
// return;
// }
}
//跳转页面
this.toPage(data);
},
(err) => {
alert("获取用户信息错误");
}
);
}
enterComprehensive(tokenData) {
sessionStorage.setItem("token", tokenData.result.accessToken);
sessionStorage.setItem(
"encryptedAccessToken",
tokenData.result.encryptedAccessToken
);
this.http
.get("/api/services/app/Session/GetCurrentLoginInformations")
.subscribe(
async (data: any) => {
sessionStorage.setItem("userdata", JSON.stringify(data.result.user));
sessionStorage.setItem(
"userdataOfgasstation",
JSON.stringify(data.result.user)
);
//跳转页面
sessionStorage.setItem("isGasStation", "false");
this.router.navigate(["/comprehensive"]);
},
(err) => {
alert("获取用户信息错误");
}
);
}
menu1 = [
{ name: "首页", url: "/homepage" },
{ name: "数字油站", url: "/plan" },
{ name: "今日预警", url: "/todaywarning" },
{ name: "预警记录", url: "/records_nav" },
{ name: "证照管理", url: "/audit" },
];
menu2 = [
{ name: "数字油站", url: "/plan" },
{ name: "今日预警", url: "/todaywarning" },
{ name: "预警记录", url: "/records_nav" },
{ name: "证照管理", url: "/audit" },
];
init3D;
async getGasStationBaseInfo() {
await new Promise((resolve, reject) => {
let params = {
organizationUnitId: JSON.parse(
sessionStorage.getItem("userdataOfgasstation")
).organization.id,
};
this.http
.get("/api/services/app/GasStation/Get", { params: params })
.subscribe((data: any) => {
resolve(data.result);
sessionStorage.setItem("3dSceneData", JSON.stringify(data.result));
this.init3D = data.result.hasBuildingInfo;
});
});
}
toPage(data) {
if (data.result.user.organization.isGasStation) {
sessionStorage.setItem("isGasStation", "true");
let userdata = sessionStorage.getItem("userdataOfgasstation");
let menuList = this.returnLastMenus(userdata, this.menu2);
let isTrue = menuList.find((item) => {
return item.name == "今日预警";
});
if (isTrue) {
this.router.navigate(["/todaywarning"]);
sessionStorage.setItem("selectedMenu", "今日预警");
} else if (menuList.length == 0) {
return this.message.create("warning", `当前用户未分配菜单`);
} else {
this.router.navigate([menuList[0].url]);
sessionStorage.setItem("selectedMenu", menuList[0].name);
}
} else {
sessionStorage.setItem("isGasStation", "false");
let a = sessionStorage.getItem("userdata");
let menuList = this.returnLastMenus(a, this.menu1);
let isTrue = menuList.find((item) => {
return item.name == "首页";
});
if (menuList.length == 0) {
return this.message.create("warning", `当前用户未分配菜单`);
}
if (isTrue) {
this.router.navigate(["/homepage"]);
sessionStorage.setItem("selectedMenu", "首页");
} else {
this.router.navigate([menuList[0].url]);
sessionStorage.setItem("selectedMenu", menuList[0].name);
}
}
}
returnLastMenus(data, originalMenus) {
let userMenu = JSON.parse(data).menus;
let tap = [];
let menuList = [];
for (let index = 0; index < userMenu.length; index++) {
let a = userMenu[index].name;
tap.push(a);
}
for (let index = 0; index < originalMenus.length; index++) {
for (let k = 0; k < tap.length; k++) {
if (tap[k] == originalMenus[index].name) {
menuList.push(originalMenus[index]);
}
}
}
return menuList;
}
}

12
src/app/pages/today-warning-admin/today-warning-admin.component.html

@ -61,12 +61,12 @@
<nz-form-control> <nz-form-control>
<nz-select [nzMaxTagCount]="1" nzMode="multitagsple" nzAllowClear id="area" formControlName="area" <nz-select [nzMaxTagCount]="1" nzMode="multitagsple" nzAllowClear id="area" formControlName="area"
nzPlaceHolder="预警区域"> nzPlaceHolder="预警区域">
<nz-option nzValue="出入口" nzLabel="出入口"></nz-option> <!-- <nz-option nzValue="出入口" nzLabel="出入口"></nz-option>
<nz-option nzValue="加油区" nzLabel="加油区"></nz-option> <nz-option nzValue="加油区" nzLabel="加油区"></nz-option>
<nz-option nzValue="油罐区" nzLabel="油罐区"></nz-option> <nz-option nzValue="油罐区" nzLabel="油罐区"></nz-option>
<nz-option nzValue="便利店" nzLabel="便利店"></nz-option> <nz-option nzValue="便利店" nzLabel="便利店"></nz-option> -->
<nz-option nzValue="办公区" nzLabel="办公区"></nz-option> <nz-option nzValue="办公区" nzLabel="办公区"></nz-option>
<nz-option nzValue="其他区域" nzLabel="其他区域"></nz-option> <!-- <nz-option nzValue="其他区域" nzLabel="其他区域"></nz-option> -->
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
@ -158,12 +158,12 @@
<div nz-col nzSpan="1" *ngIf="isMisinformation"> <div nz-col nzSpan="1" *ngIf="isMisinformation">
申诉状态 申诉状态
</div> </div>
<div nz-col nzSpan="1"> <div nz-col nzSpan="1" style="min-width: 65px;">
操作 操作
</div> </div>
</div> </div>
<div nz-row class="listitem" *ngFor="let item of list"> <div nz-row class="listitem listitembody" *ngFor="let item of list">
<div nz-col nzSpan="2" class="imgbox"> <div nz-col nzSpan="2" class="imgbox">
<span *ngIf="item.violation.violationType == '卸油作业检查'"> <span *ngIf="item.violation.violationType == '卸油作业检查'">
<img src="../../../assets/images/warning2.png"> <img src="../../../assets/images/warning2.png">
@ -231,7 +231,7 @@
'申诉撤销' : item.appealStatus == 5 ? '申诉完成' : null}} '申诉撤销' : item.appealStatus == 5 ? '申诉完成' : null}}
</span> </span>
</div> </div>
<div nz-col nzSpan="1" style="min-width: 64px;"> <div nz-col nzSpan="1" style="min-width: 65px;">
<button nz-button (click)="look(item)">查看</button> <button nz-button (click)="look(item)">查看</button>
</div> </div>
</div> </div>

38
src/app/pages/today-warning-admin/today-warning-admin.component.scss

@ -7,7 +7,7 @@
.title { .title {
box-sizing: border-box; box-sizing: border-box;
padding: 0 20PX; padding: 0 20px;
width: 100%; width: 100%;
height: 48px; height: 48px;
margin: 16px 0; margin: 16px 0;
@ -28,7 +28,7 @@
.today { .today {
font-size: 18px; font-size: 18px;
font-family: titlefont; font-family: titlefont;
color: #D0EAFF; color: #d0eaff;
margin-left: 8px; margin-left: 8px;
margin-right: 16px; margin-right: 16px;
} }
@ -39,8 +39,6 @@
color: white; color: white;
font-weight: 600; font-weight: 600;
} }
} }
.search { .search {
@ -83,7 +81,6 @@
nz-select { nz-select {
color: rgba(145, 204, 255, 0.95); color: rgba(145, 204, 255, 0.95);
;
} }
nz-tree-select { nz-tree-select {
@ -107,11 +104,16 @@
width: 100%; width: 100%;
height: 78px; height: 78px;
display: flex; display: flex;
flex-wrap: nowrap;
align-items: center; align-items: center;
border: 1px solid rgba(54, 162, 255, 0.478); border: 1px solid rgba(54, 162, 255, 0.478);
color: #91CCFF; color: #91ccff;
margin-bottom: 12px; margin-bottom: 12px;
background: linear-gradient(180deg, rgba(3, 0, 0, 0) 0%, rgba(0, 46, 91, 0.68) 100%); background: linear-gradient(
180deg,
rgba(3, 0, 0, 0) 0%,
rgba(0, 46, 91, 0.68) 100%
);
box-sizing: border-box; box-sizing: border-box;
white-space: nowrap; white-space: nowrap;
@ -127,7 +129,7 @@
font-size: 15px; font-size: 15px;
background-color: #013064; background-color: #013064;
border: 1px solid #4c8ac8; border: 1px solid #4c8ac8;
color: #91CCFF; color: #91ccff;
} }
} }
@ -154,11 +156,11 @@
} }
.propsm1 { .propsm1 {
background: #2399FF; background: #2399ff;
} }
.propsm2 { .propsm2 {
background: #FF9963; background: #ff9963;
} }
} }
@ -167,11 +169,9 @@
line-height: 40px; line-height: 40px;
background: rgba(35, 153, 255, 0.22); background: rgba(35, 153, 255, 0.22);
border: 1px solid rgba(35, 217, 255, 0.4); border: 1px solid rgba(35, 217, 255, 0.4);
color: #23D9FF; color: #23d9ff;
} }
} }
} }
// 适配125% // 适配125%
@ -179,7 +179,7 @@
.warningbox { .warningbox {
.title { .title {
box-sizing: border-box; box-sizing: border-box;
padding: 0 16PX; padding: 0 16px;
height: 42px; height: 42px;
margin: 12px 0; margin: 12px 0;
position: relative; position: relative;
@ -202,8 +202,6 @@
.num { .num {
font-size: 18px; font-size: 18px;
} }
} }
.search { .search {
@ -220,8 +218,6 @@
} }
} }
.listbox { .listbox {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
@ -251,7 +247,7 @@
.warningbox { .warningbox {
.title { .title {
box-sizing: border-box; box-sizing: border-box;
padding: 0 12PX; padding: 0 12px;
height: 38px; height: 38px;
margin: 6px 0; margin: 6px 0;
position: relative; position: relative;
@ -274,8 +270,6 @@
.num { .num {
font-size: 16px; font-size: 16px;
} }
} }
.search { .search {
@ -292,8 +286,6 @@
} }
} }
.listbox { .listbox {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;

519
src/app/pages/today-warning-admin/today-warning-admin.component.ts

@ -1,38 +1,29 @@
import { Component, OnInit, ViewContainerRef } from "@angular/core"; import { Component, OnInit, ViewContainerRef } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from "@angular/router"; import { Router } from '@angular/router';
import { HttpClient } from "@angular/common/http"; import { HttpClient } from '@angular/common/http';
import { NzModalService } from "ng-zorro-antd/modal"; import { NzModalService } from 'ng-zorro-antd/modal';
import { GetOutOfLineDetailsComponent } from "../today-warning/get-out-of-line-details/get-out-of-line-details.component"; import { GetOutOfLineDetailsComponent } from '../today-warning/get-out-of-line-details/get-out-of-line-details.component';
import * as moment from "moment"; import * as moment from 'moment';
import { TreeService } from "../../service/tree.service"; import { TreeService } from '../../service/tree.service';
import { NavChangeService } from "../../service/navChange.service"; import { NavChangeService } from '../../service/navChange.service';
import "linqjs"; import 'linqjs';
import { DispositionComponent } from "../disposition/disposition.component"; import { DispositionComponent } from '../disposition/disposition.component';
import { NzMessageService } from "ng-zorro-antd/message"; import { NzMessageService } from 'ng-zorro-antd/message';
import { listRefreshService } from "../../service/listRefresh.service"; import { listRefreshService } from '../../service/listRefresh.service';
import { DisposeequipmentComponent } from "../records/warning-statistics-list/disposeequipment/disposeequipment.component"; import { DisposeequipmentComponent } from '../records/warning-statistics-list/disposeequipment/disposeequipment.component';
@Component({ @Component({
selector: "app-today-warning-admin", selector: 'app-today-warning-admin',
templateUrl: "./today-warning-admin.component.html", templateUrl: './today-warning-admin.component.html',
styleUrls: ["./today-warning-admin.component.scss"], styleUrls: ['./today-warning-admin.component.scss']
}) })
export class TodayWarningAdminComponent implements OnInit { export class TodayWarningAdminComponent implements OnInit {
validateForm!: FormGroup; validateForm!: FormGroup;
constructor( constructor(private listRefreshService: listRefreshService, private http: HttpClient, private fb: FormBuilder, private router: Router, private toTree: TreeService, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private navChangeService: NavChangeService, private message: NzMessageService) { }
private listRefreshService: listRefreshService, isSpin: boolean = false
private http: HttpClient,
private fb: FormBuilder,
private router: Router,
private toTree: TreeService,
private modal: NzModalService,
private viewContainerRef: ViewContainerRef,
private navChangeService: NavChangeService,
private message: NzMessageService
) {}
isSpin: boolean = false;
isMisinformation: boolean = false; //误报按钮的显隐 isMisinformation: boolean = false//误报按钮的显隐
ngOnInit(): void { ngOnInit(): void {
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
level: [null], level: [null],
@ -42,80 +33,62 @@ export class TodayWarningAdminComponent implements OnInit {
area: [null], area: [null],
disposalState: [null], disposalState: [null],
appealState: [null], appealState: [null],
datePickerStart: [ datePickerStart: [new Date(`${moment(new Date()).format('YYYY-MM-DD')} 00:00`)],
new Date(`${moment(new Date()).format("YYYY-MM-DD")} 00:00`), datePickerEnd: [new Date(`${moment(new Date()).format('YYYY-MM-DD')} 23:59`)]
],
datePickerEnd: [
new Date(`${moment(new Date()).format("YYYY-MM-DD")} 23:59`),
],
}); });
this.warningType(); this.warningType()
this.isSpin = true; this.isSpin = true
this.getAllOrganization(); this.getAllOrganization()
this.listRefreshService.getMessage().subscribe((message: any) => { this.listRefreshService.getMessage().subscribe((message: any) => {
//列表刷新 //列表刷新
if (message.type == "add") { if (message.type == 'add') {
this.getEarlyWarningList(); this.getEarlyWarningList()
} }
//更新处置状态 //更新处置状态
if (message.type == "updatehandleTime") { if (message.type == 'updatehandleTime') {
console.log("更新处置状态", message); console.log('更新处置状态', message)
// console.log(this.list) // console.log(this.list)
this.list.forEach((element) => { this.list.forEach(element => {
if (element.id == message.data) { if (element.id == message.data) {
element.handleTime = new Date(); element.handleTime = new Date()
} }
}); });
} }
}); });
let loginUserInfo; let loginUserInfo
if (sessionStorage.getItem("isGasStation") == "true") { if (sessionStorage.getItem('isGasStation') == 'true') {
loginUserInfo = JSON.parse( loginUserInfo = JSON.parse(sessionStorage.getItem('userdataOfgasstation'))
sessionStorage.getItem("userdataOfgasstation")
);
} else { } else {
loginUserInfo = JSON.parse(sessionStorage.getItem("userdata")); loginUserInfo = JSON.parse(sessionStorage.getItem('userdata'))
} }
if ( if (loginUserInfo.permissions.find((item) => {
loginUserInfo?.permissions?.find((item) => { return item.name == 'Data.Violation.Positive.Censor'
return item.name == "Data.Violation.Positive.Censor"; })) {
}) this.isMisinformation = true
) {
this.isMisinformation = true;
} else { } else {
this.isMisinformation = false; this.isMisinformation = false
} }
} }
//预警类型接口 //预警类型接口
warningTypesDetails: any; warningTypesDetails: any
warningTypesDetailsCopy: any; warningTypesDetailsCopy: any
warningTypes: any; //预警接口数据 warningTypes: any //预警接口数据
warningTypesCopy: any; warningTypesCopy: any
warningLevels: any; warningLevels: any
warningLevelsCopy: any; warningLevelsCopy: any
warningType() { warningType() {
this.http this.http.get('/api/services/app/Violation/GetAllList').subscribe((data: any) => {
.get("/api/services/app/Violation/GetAllList") this.warningTypesDetails = JSON.parse(JSON.stringify(data.result))
.subscribe((data: any) => { this.warningTypesDetailsCopy = JSON.parse(JSON.stringify(data.result)) //原始数据备份
this.warningTypesDetails = JSON.parse(JSON.stringify(data.result)); this.warningTypes = (data.result as any).groupBy((t) => { return t.violationType });
this.warningTypesDetailsCopy = JSON.parse(JSON.stringify(data.result)); //原始数据备份 this.warningTypesCopy = (data.result as any).groupBy((t) => { return t.violationType })
this.warningTypes = (data.result as any).groupBy((t) => { this.warningLevels = (data.result as any).groupBy((t) => { return t.level });
return t.violationType; this.warningLevelsCopy = (data.result as any).groupBy((t) => { return t.level })
});
this.warningTypesCopy = (data.result as any).groupBy((t) => {
return t.violationType;
});
this.warningLevels = (data.result as any).groupBy((t) => {
return t.level;
});
this.warningLevelsCopy = (data.result as any).groupBy((t) => {
return t.level;
});
this.warningLevels.sort(function (a, b) { this.warningLevels.sort(function (a, b) {
if (a.key < b.key) { if (a.key < b.key) {
return -1; return -1;
@ -137,20 +110,18 @@ export class TodayWarningAdminComponent implements OnInit {
// console.log(111, this.warningTypesDetails) // console.log(111, this.warningTypesDetails)
// console.log(222, this.warningTypesCopy) // console.log(222, this.warningTypesCopy)
// console.log(333, this.warningLevels) // console.log(333, this.warningLevels)
}); })
} }
typeChange(e) { typeChange(e) {
if (!e) { if (!e) {
this.warningTypesDetails = this.warningTypesDetailsCopy; this.warningTypesDetails = this.warningTypesDetailsCopy
this.warningLevels = this.warningLevelsCopy; this.warningLevels = this.warningLevelsCopy
return; return
} }
this.warningTypes.forEach((element) => { this.warningTypes.forEach(element => {
if (element.key == e) { if (element.key == e) {
this.warningTypesDetails = element; this.warningTypesDetails = element
this.warningLevels = (element as any).groupBy((t) => { this.warningLevels = (element as any).groupBy((t) => { return t.level });
return t.level;
});
} }
}); });
this.validateForm.patchValue({ this.validateForm.patchValue({
@ -159,19 +130,17 @@ export class TodayWarningAdminComponent implements OnInit {
} }
levelChange(e) { levelChange(e) {
if (!e) { if (!e) {
this.warningTypesDetails = this.warningTypesDetailsCopy; this.warningTypesDetails = this.warningTypesDetailsCopy
this.warningTypes = this.warningTypesCopy; this.warningTypes = this.warningTypesCopy
this.validateForm.patchValue({ this.validateForm.patchValue({
type: null, type: null,
}); });
return; return
} }
this.warningLevels.forEach((element) => { this.warningLevels.forEach(element => {
if (element.key == e) { if (element.key == e) {
this.warningTypesDetails = element; this.warningTypesDetails = element
this.warningTypes = (element as any).groupBy((t) => { this.warningTypes = (element as any).groupBy((t) => { return t.violationType });
return t.violationType;
});
} }
}); });
this.validateForm.patchValue({ this.validateForm.patchValue({
@ -179,142 +148,100 @@ export class TodayWarningAdminComponent implements OnInit {
}); });
} }
defaultOrId: string; defaultOrId: string
//获取所有组织机构 //获取所有组织机构
nodes: any = []; nodes: any = []
getAllOrganization() { getAllOrganization() {
let userData = null; let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id
if (sessionStorage.getItem("isGasStation") == "true") {
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
} else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
let params = { let params = {
IsContainsChildren: "true", OrganizationUnitId: OrganizationUnitId,
}; IsContainsChildren: "true"
this.http
.get("/api/services/app/Organization/GetAll", {
params: params,
})
.subscribe((data: any) => {
data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
} }
} else { this.http.get('/api/services/app/Organization/GetAll', {
params: params
}).subscribe((data: any) => {
data.result.items.forEach(element => {
if (element.id == OrganizationUnitId) { if (element.id == OrganizationUnitId) {
element.parentId = null; element.parentId = null
} }
} element.key = element.id
element.key = element.id; element.title = element.displayName
element.title = element.displayName;
});
this.nodes = [...this.toTree.toTree(data.result.items)];
this.defaultOrId = JSON.parse(
sessionStorage.getItem("userdata")
).organization.id;
this.validateForm.value.organization = this.defaultOrId;
this.getEarlyWarningList();
}); });
this.nodes = [...this.toTree.toTree(data.result.items)]
this.defaultOrId = JSON.parse(sessionStorage.getItem('userdata')).organization.id
this.validateForm.value.organization = this.defaultOrId
this.getEarlyWarningList()
})
} }
//获得预警列表 //获得预警列表
list: any = []; list: any = [
totalCount: string; //预警总数 ]
isLoading = false; totalCount: string //预警总数
isLoading = false
getEarlyWarningList() { getEarlyWarningList() {
this.isLoading = true; this.isLoading = true
let ViolationIds = []; let ViolationIds = []
if (this.validateForm.value.event) { if (this.validateForm.value.event) {
ViolationIds = this.validateForm.value.event; ViolationIds = this.validateForm.value.event
} }
if (this.validateForm.value.type && !this.validateForm.value.event) { if (this.validateForm.value.type && !this.validateForm.value.event) {
this.warningTypesDetails.forEach((item) => { this.warningTypesDetails.forEach(item => {
item.id ? ViolationIds.push(item.id) : null; item.id ? ViolationIds.push(item.id) : null
}); });
} }
let disposalState; let disposalState
if (this.validateForm.value.disposalState == "0") { if (this.validateForm.value.disposalState == '0') {
disposalState = true; disposalState = true
} else if (this.validateForm.value.disposalState == "1") { } else if (this.validateForm.value.disposalState == '1') {
disposalState = false; disposalState = false
} else { } else {
disposalState = null; disposalState = null
} }
// console.log(this.validateForm.value) // console.log(this.validateForm.value)
let ViolateTime = null; this.isSpin = true
if (
sessionStorage.getItem("singleSignOn") &&
sessionStorage.getItem("singleSignOn") === "true"
) {
ViolateTime = [
"2023-9-1",
moment(this.validateForm.value.datePickerEnd).format("yyyy-MM-DD"),
];
} else {
this.validateForm.value.datePickerEnd &&
this.validateForm.value.datePickerStart
? (ViolateTime = [
moment(this.validateForm.value.datePickerStart).format(
"yyyy-MM-DD HH:mm:ss"
),
moment(this.validateForm.value.datePickerEnd).format(
"yyyy-MM-DD HH:mm:ss"
),
])
: (ViolateTime = null);
}
this.isSpin = true;
let params = { let params = {
Level: this.validateForm.value.level, Level: this.validateForm.value.level,
ViolationIds: ViolationIds, ViolationIds: ViolationIds,
ViolateAreas: this.validateForm.value.area, ViolateAreas: this.validateForm.value.area,
organizationUnitId: this.validateForm.value.organization, organizationUnitId: this.validateForm.value.organization,
ViolateTime: ViolateTime, ViolateTime: (this.validateForm.value.datePickerEnd && this.validateForm.value.datePickerStart) ? [moment(this.validateForm.value.datePickerStart).format('yyyy-MM-DD HH:mm:ss'), moment(this.validateForm.value.datePickerEnd).format('yyyy-MM-DD HH:mm:ss')] : null,
// ViolateTime: ['2021-10-27', '2021-11-26'], // ViolateTime: ['2021-10-27', '2021-11-26'],
IsHandled: disposalState, IsHandled: disposalState,
AppealStatus: this.validateForm.value.appealState, AppealStatus: this.validateForm.value.appealState,
IsContainsChildren: "true", IsContainsChildren: 'true',
SkipCount: "0", SkipCount: '0',
MaxResultCount: "9999", MaxResultCount: '9999',
Positive: "true", Positive: 'true'
}; }
this.http this.http.get('/api/services/app/ViolateRecord/GetAll', {
.get("/api/services/app/ViolateRecord/GetAll", { params: params
params: params, }).subscribe((data: any) => {
}) this.list = data.result.items
.subscribe((data: any) => { this.totalCount = data.result.totalCount
data.result.items = data.result.items.filter((item) => { console.log('预警列表', this.list)
return ( this.isSpin = false
item.violation.violationType != "证照资质" || this.isLoading = false
(item.violation.violationType == "证照资质" &&
item.gasStation.companyName.includes("延长"))
);
});
this.list = data.result.items;
this.totalCount = data.result.totalCount;
console.log("预警列表", this.list);
this.isSpin = false;
this.isLoading = false;
let obj = { let obj = {
name: "改变数量", name: '改变数量',
num: this.totalCount, num: this.totalCount
}; }
setTimeout(() => { setTimeout(() => {
this.navChangeService.sendMessage(obj);//发布一条消息 this.navChangeService.sendMessage(obj);//发布一条消息
}, 0); }, 0);
});
})
} }
submitForm(): void { submitForm(): void {
for (const i in this.validateForm.controls) { for (const i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity(); this.validateForm.controls[i].updateValueAndValidity();
} }
this.getEarlyWarningList(); this.getEarlyWarningList()
} }
resetForm(e: MouseEvent): void { resetForm(e: MouseEvent): void {
@ -325,125 +252,93 @@ export class TodayWarningAdminComponent implements OnInit {
this.validateForm.controls[key].updateValueAndValidity(); this.validateForm.controls[key].updateValueAndValidity();
} }
this.validateForm.patchValue({ this.validateForm.patchValue({
organization: JSON.parse(sessionStorage.getItem("userdata")).organization organization: JSON.parse(sessionStorage.getItem('userdata')).organization.id,
.id, datePickerStart: new Date(`${moment(new Date()).format('YYYY-MM-DD')} 00:00`),
datePickerStart: new Date( datePickerEnd: new Date(`${moment(new Date()).format('YYYY-MM-DD')} 23:59`)
`${moment(new Date()).format("YYYY-MM-DD")} 00:00`
),
datePickerEnd: new Date(
`${moment(new Date()).format("YYYY-MM-DD")} 23:59`
),
}); });
this.getEarlyWarningList(); this.getEarlyWarningList()
} }
isVisible = false;
isVisible = false
look(item) { look(item) {
if (item.violation.violationType == "设备监测") { if (item.violation.violationType == '设备监测') {
item.violatedItemSnapshotObj = JSON.parse(item.violatedItemSnapshot); item.violatedItemSnapshotObj = JSON.parse(item.violatedItemSnapshot)
const modal = this.modal.create({ const modal = this.modal.create({
nzContent: DisposeequipmentComponent, nzContent: DisposeequipmentComponent,
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 380, nzWidth: 380,
nzBodyStyle: { nzBodyStyle: {
border: "1px solid #91CCFF", 'border': '1px solid #91CCFF',
"border-radius": "0px", 'border-radius': '0px',
padding: "7px", 'padding': '7px',
"box-shadow": "0 0 8px 0 #fff", 'box-shadow': '0 0 8px 0 #fff',
"background-image": "linear-gradient(#003665, #000f25)", 'background-image': 'linear-gradient(#003665, #000f25)'
}, },
nzComponentParams: { nzComponentParams: {
data: item, data: item
}, },
nzFooter: null, nzFooter: null,
nzClosable: false, nzClosable: false,
nzOnOk: async () => { nzOnOk: async () => {
if (instance.isScrap) { if (instance.isScrap) {
await new Promise((resolve) => { await new Promise(resolve => {
let body = { let body = {
id: item.violatedItemSnapshotObj.id, id: item.violatedItemSnapshotObj.id,
name: instance.copydata2.violatedItemSnapshotObj.name, name: instance.copydata2.violatedItemSnapshotObj.name,
storageLocation: storageLocation: instance.copydata2.violatedItemSnapshotObj.storageLocation,
instance.copydata2.violatedItemSnapshotObj.storageLocation, productionDate: moment(instance.copydata2.violatedItemSnapshotObj.productionDate).format('yyyy-MM-DD'),
productionDate: moment( maintenanceDate: moment(instance.copydata2.violatedItemSnapshotObj.maintenanceDate).format('yyyy-MM-DD'),
instance.copydata2.violatedItemSnapshotObj.productionDate validityEndTime: moment(instance.copydata2.violatedItemSnapshotObj.validityEndTime).format('yyyy-MM-DD'),
).format("yyyy-MM-DD"),
maintenanceDate: moment(
instance.copydata2.violatedItemSnapshotObj.maintenanceDate
).format("yyyy-MM-DD"),
validityEndTime: moment(
instance.copydata2.violatedItemSnapshotObj.validityEndTime
).format("yyyy-MM-DD"),
isScrapped: true, isScrapped: true,
organizationUnitId: organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId
item.violatedItemSnapshotObj.organizationUnitId, }
}; this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => {
this.http
.put("/api/services/app/FireEquipment/Update", body)
.subscribe((data: any) => {
let body = { let body = {
id: item.id, id: item.id,
handleRecord: "报废成功!", handleRecord: '报废成功!'
}; }
this.http this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => {
.post( resolve(data)
"/api/services/app/ViolateRecord/HandleViolateRecord", this.message.create('success', '报废成功!');
body item.handleTime = new Date()
) return true
.subscribe((data) => { })
resolve(data); })
this.message.create("success", "报废成功!"); })
item.handleTime = new Date();
return true;
});
});
});
} else { } else {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise((resolve) => { await new Promise(resolve => {
let body = { let body = {
id: item.violatedItemSnapshotObj.id, id: item.violatedItemSnapshotObj.id,
name: instance.validateForm.value.name, name: instance.validateForm.value.name,
storageLocation: instance.validateForm.value.storageLocation, storageLocation: instance.validateForm.value.storageLocation,
productionDate: moment( productionDate: moment(instance.validateForm.value.productionDate).format('yyyy-MM-DD'),
instance.validateForm.value.productionDate maintenanceDate: moment(instance.validateForm.value.maintenanceDate).format('yyyy-MM-DD'),
).format("yyyy-MM-DD"), validityEndTime: moment(instance.validateForm.value.validityEndTime).format('yyyy-MM-DD'),
maintenanceDate: moment( organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId
instance.validateForm.value.maintenanceDate }
).format("yyyy-MM-DD"), this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => {
validityEndTime: moment(
instance.validateForm.value.validityEndTime
).format("yyyy-MM-DD"),
organizationUnitId:
item.violatedItemSnapshotObj.organizationUnitId,
};
this.http
.put("/api/services/app/FireEquipment/Update", body)
.subscribe((data: any) => {
// item.violatedItemSnapshotObj = data.result // item.violatedItemSnapshotObj = data.result
let body = { let body = {
id: item.id, id: item.id,
handleRecord: "维保成功!", handleRecord: '维保成功!'
}; }
this.http this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => {
.post( resolve(data)
"/api/services/app/ViolateRecord/HandleViolateRecord", this.message.create('success', '维保成功!');
body item.handleTime = new Date()
) return true
.subscribe((data) => { })
resolve(data); })
this.message.create("success", "维保成功!"); })
item.handleTime = new Date();
return true;
});
});
});
} else { } else {
this.message.create("warning", "请填写完整!"); this.message.create('warning', '请填写完整!');
return false; return false
}
} }
} }
},
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} else { } else {
@ -451,73 +346,69 @@ export class TodayWarningAdminComponent implements OnInit {
nzContent: GetOutOfLineDetailsComponent, nzContent: GetOutOfLineDetailsComponent,
nzWrapClassName: "vertical-center-modal", nzWrapClassName: "vertical-center-modal",
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: nzWidth: (document.documentElement.clientHeight < 650 || document.documentElement.clientWidth < 1400) ? 1000 : 1200,
document.documentElement.clientHeight < 650 ||
document.documentElement.clientWidth < 1400
? 1000
: 1200,
nzClosable: false, nzClosable: false,
nzClassName: "modelnobg", nzClassName: 'modelnobg',
nzBodyStyle: { nzBodyStyle: {
"border-radius": "0px", 'border-radius': '0px',
padding: "0px", 'padding': '0px',
}, },
nzComponentParams: { nzComponentParams: {
data: item, data: item
}, },
nzFooter: null, nzFooter: null,
nzOnOk: async () => { nzOnOk: async () => {
console.log("误报处理"); console.log('误报处理')
for (let index = 0; index < this.list.length; index++) { for (let index = 0; index < this.list.length; index++) {
const element = this.list[index]; const element = this.list[index];
if (element.id == item.id) { if (element.id == item.id) {
this.list.splice(index, 1); this.list.splice(index, 1)
this.totalCount = String(Number(this.totalCount) - 1); this.totalCount = String(Number(this.totalCount) - 1)
// this.SkipCount = String(Number(this.SkipCount) - 1) // this.SkipCount = String(Number(this.SkipCount) - 1)
} }
} }
}, }
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
} }
dispose(item) { dispose(item) {
console.log(item); console.log(item)
const modal = this.modal.create({ const modal = this.modal.create({
nzContent: DispositionComponent, nzContent: DispositionComponent,
nzWrapClassName: "vertical-center-modal", nzWrapClassName: "vertical-center-modal",
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 380, nzWidth: 380,
nzBodyStyle: { nzBodyStyle: {
border: "1px solid #91CCFF", 'border': '1px solid #91CCFF',
"border-radius": "0px", 'border-radius': '0px',
padding: "7px", 'padding': '7px',
"box-shadow": "0 0 8px 0 #fff", 'box-shadow': '0 0 8px 0 #fff',
"background-image": "linear-gradient(#003665, #000f25)", 'background-image': 'linear-gradient(#003665, #000f25)'
}, },
nzComponentParams: {}, nzComponentParams: {},
nzFooter: null, nzFooter: null,
nzClosable: false, nzClosable: false,
nzOnOk: async () => { nzOnOk: async () => {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise((resolve) => { await new Promise(resolve => {
let body = { let body = {
id: item.id, id: item.id,
handleRecord: instance.validateForm.value.content, handleRecord: instance.validateForm.value.content
}; }
this.http this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => {
.post("/api/services/app/ViolateRecord/HandleViolateRecord", body) resolve(data)
.subscribe((data) => { this.message.create('success', '处置成功!');
resolve(data); item.handleTime = new Date()
this.message.create("success", "处置成功!"); return true
item.handleTime = new Date(); })
return true; })
});
});
} else { } else {
this.message.create("warning", "请填写完整!"); this.message.create('warning', '请填写完整!');
return false; return false
} }
}, },
}); });

7
src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html

@ -23,10 +23,9 @@
<ng-container *ngIf="isShowAxOtherRegion"> <ng-container *ngIf="isShowAxOtherRegion">
<label *ngFor="let item of this.legendList" nz-checkbox [(ngModel)]="item.checked" <label *ngFor="let item of this.legendList" nz-checkbox [(ngModel)]="item.checked"
(ngModelChange)="typeChange(item)"> (ngModelChange)="typeChange(item)">
<div style="width: 10px;height: 10px;display: inline-block;" <div style="width: 10px;height: 10px;display: inline-block;" [ngStyle]="{'background': typeArr[item.id].color}">
[ngStyle]="{'background': typeArr[item.id]?.color || 'yellow'}">
</div> </div>
{{typeArr[item.id]?.name || '未定义'}} {{typeArr[item.id].name}}
</label> </label>
</ng-container> </ng-container>
<!-- <button nz-button nzType="primary" (click)="downImg()">导出图片</button> --> <!-- <button nz-button nzType="primary" (click)="downImg()">导出图片</button> -->
@ -38,7 +37,7 @@
<img [id]="'img'+data.id" [src]="imgUrl" alt=""> <img [id]="'img'+data.id" [src]="imgUrl" alt="">
<canvas *ngIf="isAnxin" [width]="canvasWidth" [height]="canvasHeight" <canvas *ngIf="isAnxin" [width]="canvasWidth" [height]="canvasHeight"
[ngStyle]="{'width': canvasWidth + 'px','height': canvasHeight + 'px'}" class="canvas" [ngStyle]="{'width': canvasWidth + 'px','height': canvasHeight + 'px'}" class="canvas"
[id]="'canvas'+data.id" (click)="viewImg($event)"></canvas> [id]="'canvas'+data.id"></canvas>
<div *ngIf="isCarStop && isAnxin" class="pageturning lastpage" (click)="pageturning('last')"> <div *ngIf="isCarStop && isAnxin" class="pageturning lastpage" (click)="pageturning('last')">
<i nz-icon nzType="left" nzTheme="outline"></i> <i nz-icon nzType="left" nzTheme="outline"></i>
</div> </div>

121
src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts

@ -49,32 +49,35 @@ export class GetOutOfLineDetailsComponent implements OnInit {
currentCoordinate = []; //当前需要标绘坐标点信息 currentCoordinate = []; //当前需要标绘坐标点信息
legendList: any = []; legendList: any = [];
typeArr = [ typeArr = [
{ id: 0, name: "工装", color: "#91CCFF" }, // { id: 0, name: "工装", color: "#91CCFF" },
{ id: 1, name: "便装", color: "#46DFFF" }, // { id: 2, name: "便装", color: "#46DFFF" },
{ id: 2, name: "抽烟", color: "#36A2FF" }, // { id: 2, name: "抽烟", color: "#36A2FF" },
{ id: 3, name: "打电话", color: "#FF6181" }, // { id: 3, name: "打电话", color: "#FF6181" },
{ id: 4, name: "隔离锥", color: "#000000" }, // { id: 4, name: "隔离锥", color: "#000000" },
{ id: 5, name: "手持灭火器", color: "#ffffff" }, // { id: 5, name: "手持灭火器", color: "#ffffff" },
{ id: 6, name: "推车灭火器", color: "#B4C3FF" }, // { id: 6, name: "推车灭火器", color: "#B4C3FF" },
{ id: 7, name: "静电接地", color: "#FF9963" }, // { id: 7, name: "静电接地", color: "#FF9963" },
{ id: 8, name: "输油管(连接)", color: "#5A9CFF" }, // { id: 8, name: "输油管(连接)", color: "#5A9CFF" },
{ id: 9, name: "输油管连接车", color: "#4BFFD4" }, // { id: 9, name: "输油管连接车", color: "#4BFFD4" },
{ id: 10, name: "输油管连接卸油口", color: "red" }, // { id: 10, name: "输油管连接卸油口", color: "red" },
{ id: 11, name: "卸油口盖子", color: "green" }, // { id: 11, name: "卸油口盖子", color: "green" },
{ id: 12, name: "卸油车", color: "yellow" }, // { id: 12, name: "卸油车", color: "yellow" },
{ id: 13, name: "私家车", color: "black" }, // { id: 13, name: "私家车", color: "black" },
{ id: 14, name: "断开的卸油管", color: "blue" }, // { id: 14, name: "断开的卸油管", color: "blue" },
{ id: 15, name: "烟雾预警", color: "#B4C3FF" }, // { id: 15, name: "烟雾预警", color: "#B4C3FF" },
{ id: 16, name: "火灾报警", color: "red" }, // { id: 16, name: "火灾报警", color: "red" },
{ id: 17, name: "延长工装", color: "blue" }, // { id: 17, name: "延长工装", color: "blue" },
{ id: 18, name: "江苏工装", color: "blue" }, // { id: 18, name: "江苏工装", color: "blue" },
{ id: 19, name: "经理工装", color: "yellow" }, // { id: 19, name: "经理工装", color: "yellow" },
{ id: 20, name: "江苏道达尔工装", color: "yellow" }, { id: 0, name: "安全帽", color: "yellow" },
{ id: 21, name: "延长壳牌工装", color: "red" }, { id: 1, name: "清醒人", color: "blue" },
{ id: 22, name: "山西高速工装", color: "red" }, { id: 2, name: "睡觉人", color: "blue" },
{ id: 3, name: "抽烟", color: "red" },
{ id: 4, name: "打电话", color: "pink" },
{ id: 5, name: "灭火器", color: "green" },
{ id: 6, name: "隔离锥", color: "gray" },
]; ];
userName; //登录账号的用户名 userName; //登录账号的用户名
name; //登录账号的真实名
isShowAxOtherRegion; //控制哪些用户可以看到ax全部 isShowAxOtherRegion; //控制哪些用户可以看到ax全部
isCarStop = false; isCarStop = false;
@ -84,7 +87,6 @@ export class GetOutOfLineDetailsComponent implements OnInit {
console.log("传进来的信息", this.data); console.log("传进来的信息", this.data);
// 安信框选 // 安信框选
this.userName = JSON.parse(sessionStorage.getItem("userdata")).userName; this.userName = JSON.parse(sessionStorage.getItem("userdata")).userName;
this.name = JSON.parse(sessionStorage.getItem("userdata")).name;
if (this.userName === "admin" || this.userName === "superadmin") { if (this.userName === "admin" || this.userName === "superadmin") {
this.isShowAxOtherRegion = true; this.isShowAxOtherRegion = true;
} else { } else {
@ -237,32 +239,24 @@ export class GetOutOfLineDetailsComponent implements OnInit {
ctx; ctx;
canvasLabel() { canvasLabel() {
let imgBg: any = document.getElementById("img" + this.data.id); let imgBg: any = document.getElementById("img" + this.data.id);
const drawImageAndRect = () => { imgBg.onload = () => {
console.log("图片加载完毕...");
this.canvasWidth = imgBg.offsetWidth; this.canvasWidth = imgBg.offsetWidth;
this.canvasHeight = imgBg.offsetHeight; this.canvasHeight = imgBg.offsetHeight;
const canvas: any = document.getElementById("canvas" + this.data.id); const canvas: any = document.getElementById("canvas" + this.data.id);
setTimeout(() => {
this.ctx = canvas.getContext("2d"); this.ctx = canvas.getContext("2d");
const cWidth = canvas.width, const cWidth = canvas.width,
cHeight = canvas.height; cHeight = canvas.height;
console.log(1, cWidth, cHeight); setTimeout(() => {
console.log("以图画底,描绘预警框...");
// 以图画底
this.ctx.drawImage(imgBg, 0, 0, cWidth, cHeight); this.ctx.drawImage(imgBg, 0, 0, cWidth, cHeight);
this.strokeRect(this.currentCoordinate); this.strokeRect(this.currentCoordinate);
}, 0); }, 100);
};
if (imgBg.complete) {
console.log("图片已经加载, 直接绘制...");
drawImageAndRect(); // 如果图片已加载,直接调用绘制函数
} else {
imgBg.onload = () => {
console.log("图片加载完毕...");
drawImageAndRect(); // 图片加载完成后,调用绘制函数
}; };
} }
}
strokeRect(data) { strokeRect(data) {
console.log(data);
data.forEach((item) => { data.forEach((item) => {
let startPoint = [ let startPoint = [
Math.round(this.canvasWidth * item.box[0]), Math.round(this.canvasWidth * item.box[0]),
@ -273,7 +267,7 @@ export class GetOutOfLineDetailsComponent implements OnInit {
Math.round(this.canvasHeight * item.box[3]), Math.round(this.canvasHeight * item.box[3]),
]; ];
if (this.isShowAxOtherRegion) { if (this.isShowAxOtherRegion) {
this.ctx.strokeStyle = this.typeArr[item.id]?.color || "yellow"; this.ctx.strokeStyle = this.typeArr[item.id].color;
this.ctx.lineWidth = 3; this.ctx.lineWidth = 3;
this.ctx.strokeRect( this.ctx.strokeRect(
startPoint[0], startPoint[0],
@ -283,27 +277,35 @@ export class GetOutOfLineDetailsComponent implements OnInit {
); );
//如果当前矩形区域为错误区域,则左上角增加色块 //如果当前矩形区域为错误区域,则左上角增加色块
if (item.error) { if (item.error) {
this.ctx.fillStyle = this.typeArr[item.id]?.color || "yellow"; this.ctx.fillStyle = this.typeArr[item.id].color;
this.ctx.fillRect(startPoint[0], startPoint[1], 10, 10); this.ctx.fillRect(startPoint[0], startPoint[1], 10, 10);
} }
this.ctx.fillStyle = this.typeArr[item.id]?.color || "yellow"; this.ctx.fillStyle = this.typeArr[item.id].color;
this.ctx.font = "16px Verdana"; this.ctx.font = "16px Verdana";
let name = ""; let name = "";
// ⛑ 戴了
// 👨🦲 没戴
if (this.isShowAxOtherRegion) { if (this.isShowAxOtherRegion) {
name = this.typeArr[item.id]?.name || "未定义" + item.scores; if (this.typeArr[item.id].name.indexOf("人") !== -1) {
let icon;
item.helmet_person ? (icon = "⛑") : (icon = "👨🦲");
name = icon + this.typeArr[item.id].name + item.scores;
} else { } else {
name = this.typeArr[item.id]?.name || "未定义"; name = this.typeArr[item.id].name + item.scores;
} }
this.ctx.fillText( } else {
name, if (this.typeArr[item.id].name.indexOf("人") !== -1) {
startPoint[0], let icon;
startPoint[1] < 20 || item.id === 2 || item.id === 3 item.helmet_person ? (icon = "⛑") : (icon = "👨🦲");
? endPoint[1] + 18 name = icon + this.typeArr[item.id].name;
: startPoint[1] - 5 } else {
); name = this.typeArr[item.id].name;
}
}
this.ctx.fillText(name, startPoint[0], startPoint[1] - 5);
} else { } else {
if (item.error) { if (item.error) {
this.ctx.strokeStyle = this.typeArr[item.id]?.color || "yellow"; this.ctx.strokeStyle = this.typeArr[item.id].color;
this.ctx.lineWidth = 3; this.ctx.lineWidth = 3;
this.ctx.strokeRect( this.ctx.strokeRect(
startPoint[0], startPoint[0],
@ -311,10 +313,16 @@ export class GetOutOfLineDetailsComponent implements OnInit {
endPoint[0] - startPoint[0], endPoint[0] - startPoint[0],
endPoint[1] - startPoint[1] endPoint[1] - startPoint[1]
); );
this.ctx.fillStyle = this.typeArr[item.id]?.color || "yellow"; this.ctx.fillStyle = this.typeArr[item.id].color;
this.ctx.fillRect(startPoint[0], startPoint[1], 10, 10); this.ctx.fillRect(startPoint[0], startPoint[1], 10, 10);
this.ctx.fillStyle = this.typeArr[item.id]?.color || "yellow"; this.ctx.fillStyle = this.typeArr[item.id].color;
this.ctx.font = "16px Verdana"; this.ctx.font = "16px Verdana";
if (this.typeArr[item.id].name.indexOf("人") !== -1) {
let icon;
item.helmet_person ? (icon = "⛑") : (icon = "👨🦲");
this.ctx.fillText(icon, startPoint[0], startPoint[1] - 5);
}
} }
} }
}); });
@ -434,9 +442,7 @@ export class GetOutOfLineDetailsComponent implements OnInit {
} }
//查看图片 //查看图片
viewImg(e) { viewImg(url) {
// return;
const url = e.target.toDataURL();
let dom = document.getElementById(`viewerjs`); let dom = document.getElementById(`viewerjs`);
let pObjs = dom.childNodes; let pObjs = dom.childNodes;
let node = document.createElement("img"); let node = document.createElement("img");
@ -470,7 +476,6 @@ export class GetOutOfLineDetailsComponent implements OnInit {
this.message.create("success", "处置成功!"); this.message.create("success", "处置成功!");
this.data.handleTime = new Date(); this.data.handleTime = new Date();
this.data.handleStateStr = "已处置"; this.data.handleStateStr = "已处置";
this.data.handleUserName = this.name;
this.data.handleRecord = this.content; this.data.handleRecord = this.content;
}); });
} }

7
src/app/pages/today-warning/today-warning.component.ts

@ -230,13 +230,6 @@ export class TodayWarningComponent implements OnInit {
params: params, params: params,
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items = data.result.items.filter((item) => {
return (
item.violation.violationType != "证照资质" ||
(item.violation.violationType == "证照资质" &&
item.gasStation.companyName.includes("延长"))
);
});
this.list = data.result.items; this.list = data.result.items;
this.totalCount = data.result.totalCount; this.totalCount = data.result.totalCount;
console.log("预警列表", this.list); console.log("预警列表", this.list);

7
src/app/service/pattern.service.ts

@ -1,12 +1,13 @@
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
@Injectable({ @Injectable({
providedIn: "root", providedIn: 'root'
}) })
export class PatternService { export class PatternService {
static isProd: any = true; static isProd: any = true;
constructor() { } constructor() { }
public isProd: boolean = true; //是否是生产环境 public isProd: boolean = true //是否是生产环境
} }

7
src/app/service/tree.service.ts

@ -18,12 +18,11 @@ export class TreeService {
} }
parentNode.children.push(item); parentNode.children.push(item);
} else { } else {
// 如果parentId找不到对应的id,则将parentId设置为null,并添加到newdata的顶层 if (!item.parentId) {
if (item.parentId !== null && item.parentId !== undefined) { //如果parentId为null
item.parentId = null; // 将parentId设置为null
}
newdata.push(item); newdata.push(item);
} }
}
}); });
return newdata; return newdata;
} }

19
src/app/system-management/algorithm-config/algorithm-config.component.ts

@ -51,6 +51,7 @@ export class AlgorithmConfigComponent implements OnInit {
organizationList; //组织机构列表 organizationList; //组织机构列表
getAllOrganization() { getAllOrganization() {
let params = { let params = {
OrganizationUnitId: this.OrganizationUnitId,
IsContainsChildren: "true", IsContainsChildren: "true",
}; };
this.http this.http
@ -72,14 +73,6 @@ export class AlgorithmConfigComponent implements OnInit {
nzExpandedKeys = []; nzExpandedKeys = [];
nzSelectedKeys: any[] = []; nzSelectedKeys: any[] = [];
getStationsNum(e) { getStationsNum(e) {
let userData = null;
if (sessionStorage.getItem("isGasStation") == "true") {
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
} else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
this.http this.http
.get( .get(
"/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true" "/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true"
@ -97,15 +90,9 @@ export class AlgorithmConfigComponent implements OnInit {
}); });
for (let index = 0; index < arrs.length; index++) { for (let index = 0; index < arrs.length; index++) {
arrs[index].isLeaf = true; arrs[index].isLeaf = true;
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) { if (arrs[index].id == this.OrganizationUnitId) {
if (OrganizationUnitIds.includes(arrs[index].id)) {
arrs[index].parentId = null;
}
} else {
if (arrs[index].id == OrganizationUnitId) {
arrs[index].parentId = null; arrs[index].parentId = null;
} }
}
arrs[index].title = arrs[index].title =
arrs[index].displayName + arrs[index].displayName +
" " + " " +
@ -179,7 +166,7 @@ export class AlgorithmConfigComponent implements OnInit {
} }
pageSizeChange($event) { pageSizeChange($event) {
// console.log($event); // console.log($event);
this.MaxResultCount = $event; this.MaxResultCount = $event
this.SkipCount = 0; this.SkipCount = 0;
this.nzPageIndex = 1; this.nzPageIndex = 1;
this.getStationViolationConfigList(); this.getStationViolationConfigList();

356
src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts

@ -1,326 +1,284 @@
import { HttpClient } from "@angular/common/http"; import { HttpClient } from '@angular/common/http';
import { import { Component, OnInit, AfterViewInit, ViewChild, ViewContainerRef } from '@angular/core';
Component, import { TreeService } from 'src/app/service/tree.service';
OnInit, import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
AfterViewInit, import { FormBuilder, FormGroup, Validators } from '@angular/forms';
ViewChild, import { NzModalService } from 'ng-zorro-antd/modal';
ViewContainerRef, import { NzMessageService } from 'ng-zorro-antd/message';
} from "@angular/core"; import { AddhostComponent } from './addhost/addhost.component';
import { TreeService } from "src/app/service/tree.service"; import { AddcameraComponent } from './addcamera/addcamera.component';
import { import { EdithostComponent } from './edithost/edithost.component';
NzFormatEmitEvent, import { EditcameraComponent } from './editcamera/editcamera.component';
NzTreeComponent,
NzTreeNodeOptions,
} from "ng-zorro-antd/tree";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { NzModalService } from "ng-zorro-antd/modal";
import { NzMessageService } from "ng-zorro-antd/message";
import { AddhostComponent } from "./addhost/addhost.component";
import { AddcameraComponent } from "./addcamera/addcamera.component";
import { EdithostComponent } from "./edithost/edithost.component";
import { EditcameraComponent } from "./editcamera/editcamera.component";
@Component({ @Component({
selector: "app-analysis-of-the-host", selector: 'app-analysis-of-the-host',
templateUrl: "./analysis-of-the-host.component.html", templateUrl: './analysis-of-the-host.component.html',
styleUrls: ["./analysis-of-the-host.component.scss"], styleUrls: ['./analysis-of-the-host.component.scss']
}) })
export class AnalysisOfTheHostComponent implements OnInit { export class AnalysisOfTheHostComponent implements OnInit {
constructor(
private fb: FormBuilder, constructor(private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { }
private http: HttpClient,
private toTree: TreeService,
private modal: NzModalService,
private message: NzMessageService,
private viewContainerRef: ViewContainerRef
) {}
ngOnInit(): void { ngOnInit(): void {
this.getAllOrganization(); this.getAllOrganization()
} }
//获取所有组织机构 //获取所有组织机构
searchValue = ""; searchValue = '';
nzExpandAll = false; nzExpandAll = false;
totalCount: string; totalCount: string
getAllOrganization() { getAllOrganization() {
let userData = null; let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id
if (sessionStorage.getItem("isGasStation") == "true") {
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
} else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
let params = { let params = {
IsContainsChildren: "true", OrganizationUnitId: OrganizationUnitId,
}; IsContainsChildren: "true"
this.http
.get("/api/services/app/Organization/GetAll", {
params: params,
})
.subscribe((data: any) => {
this.totalCount = data.result.totalCount;
data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
} }
} else { this.http.get('/api/services/app/Organization/GetAll', {
params: params
}).subscribe((data: any) => {
this.totalCount = data.result.totalCount
data.result.items.forEach(element => {
if (element.id == OrganizationUnitId) { if (element.id == OrganizationUnitId) {
element.parentId = null; element.parentId = null
} }
} element.key = element.id
element.key = element.id; element.title = element.displayName
element.title = element.displayName; element.selectable = false
element.selectable = false;
});
this.nodes = [...this.toTree.toTree(data.result.items)];
this.defaultExpandedKeys = [this.nodes[0].id];
this.defaultExpandedKeys = [...this.defaultExpandedKeys];
}); });
this.nodes = [...this.toTree.toTree(data.result.items)]
this.defaultExpandedKeys = [this.nodes[0].id]
this.defaultExpandedKeys = [...this.defaultExpandedKeys]
})
} }
@ViewChild("nzTreeComponent", { static: false })
nzTreeComponent!: NzTreeComponent; @ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent;
defaultExpandedKeys = []; defaultExpandedKeys = [];
nodes: any[] = []; nodes: any[] = []
nzSelectedKeys: any[] = []; nzSelectedKeys: any[] = []
selectedOilStation: any; selectedOilStation: any
nzClick(event: NzFormatEmitEvent): void { nzClick(event: NzFormatEmitEvent): void {
console.log(event.node.origin); console.log(event.node.origin);
if (event.node.origin.isGasStation) { if (event.node.origin.isGasStation) {//如果点击的是加油站才生效
//如果点击的是加油站才生效 this.nzSelectedKeys[0] = event.node.origin.id
this.nzSelectedKeys[0] = event.node.origin.id; this.nzSelectedKeys = [...this.nzSelectedKeys]
this.nzSelectedKeys = [...this.nzSelectedKeys]; this.selectedOilStation = event.node.origin
this.selectedOilStation = event.node.origin; this.getHost()
this.getHost(); this.getCamera()
this.getCamera();
} else { } else {
this.message.info("只有加油站才可以增加主机"); this.message.info('只有加油站才可以增加主机');
} }
} }
//获得加油站的主机 //获得加油站的主机
listOfData: any[] = []; listOfData: any[] = [];
getHost() { getHost() {
this.http this.http.get('/api/services/app/EdgeDevice/GetAll', {
.get("/api/services/app/EdgeDevice/GetAll", {
params: { params: {
organizationUnitId: this.selectedOilStation.id, organizationUnitId: this.selectedOilStation.id,
SkipCount: "0", SkipCount: '0',
MaxResultCount: "100", MaxResultCount: '100',
}, }
}).subscribe((data: any) => {
console.log('主机列表', data.result.items)
this.listOfData = data.result.items
}) })
.subscribe((data: any) => {
console.log("主机列表", data.result.items);
this.listOfData = data.result.items;
});
} }
//获得加油站摄像头 //获得加油站摄像头
listOfDataCamera: any[] = []; listOfDataCamera: any[] = [];
getCamera() { getCamera() {
this.http this.http.get('/api/services/app/Camera/GetAll', {
.get("/api/services/app/Camera/GetAll", {
params: { params: {
organizationUnitId: this.selectedOilStation.id, organizationUnitId: this.selectedOilStation.id,
SkipCount: "0", SkipCount: '0',
MaxResultCount: "100", MaxResultCount: '100',
}, }
}) }).subscribe((data: any) => {
.subscribe((data: any) => {
// console.log('摄像头列表', data) // console.log('摄像头列表', data)
this.listOfDataCamera = data.result.items; this.listOfDataCamera = data.result.items
}); })
} }
ngAfterViewInit(): void {}
ngAfterViewInit(): void {
}
//新增分析主机 //新增分析主机
addHost() { addHost() {
console.log(this.selectedOilStation); console.log(this.selectedOilStation)
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: "新增加油站主机", nzTitle: '新增加油站主机',
nzContent: AddhostComponent, nzContent: AddhostComponent,
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 288, nzWidth: 288,
nzComponentParams: {}, nzComponentParams: {},
nzOnOk: async () => { nzOnOk: async () => {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise((resolve) => { await new Promise(resolve => {
console.log("表单信息", instance.validateForm); console.log('表单信息', instance.validateForm)
let body = { let body = {
hostIPAddress: instance.validateForm.value.ip, hostIPAddress: instance.validateForm.value.ip,
organizationUnitId: this.selectedOilStation.id, organizationUnitId: this.selectedOilStation.id
}; }
this.http this.http.post('/api/services/app/EdgeDevice/Create', body).subscribe(data => {
.post("/api/services/app/EdgeDevice/Create", body) resolve(data)
.subscribe((data) => { this.message.create('success', '创建成功!');
resolve(data); this.getHost()
this.message.create("success", "创建成功!"); return true
this.getHost(); })
return true; })
});
});
} else { } else {
this.message.create("warning", "请填写完整!"); this.message.create('warning', '请填写完整!');
return false; return false
}
} }
},
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
edit(data) { edit(data) {
console.log(data); console.log(data)
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: "编辑加油站主机", nzTitle: '编辑加油站主机',
nzContent: EdithostComponent, nzContent: EdithostComponent,
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 288, nzWidth: 288,
nzComponentParams: { nzComponentParams: {
ip: data.hostIPAddress, ip: data.hostIPAddress
}, },
nzOnOk: async () => { nzOnOk: async () => {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise((resolve) => { await new Promise(resolve => {
console.log("表单信息", instance.validateForm); console.log('表单信息', instance.validateForm)
(data.hostIPAddress = instance.validateForm.value.ip), data.hostIPAddress = instance.validateForm.value.ip,
this.http this.http.put('/api/services/app/EdgeDevice/Update', data).subscribe(data => {
.put("/api/services/app/EdgeDevice/Update", data) resolve(data)
.subscribe((data) => { this.message.create('success', '修改成功!');
resolve(data); this.getHost()
this.message.create("success", "修改成功!"); return true
this.getHost(); })
return true; })
});
});
} else { } else {
this.message.create("warning", "请填写完整!"); this.message.create('warning', '请填写完整!');
return false; return false
}
} }
},
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
delete(item) { delete(item) {
console.log(item); console.log(item)
this.modal.confirm({ this.modal.confirm({
nzTitle: `确定要删除${item.name}这个主机吗?`, nzTitle: `确定要删除${item.name}这个主机吗?`,
nzOkText: "确定", nzOkText: '确定',
nzOkType: "primary", nzOkType: 'primary',
nzOnOk: () => { nzOnOk: () => {
this.http this.http.delete('/api/services/app/EdgeDevice/Delete', {
.delete("/api/services/app/EdgeDevice/Delete", {
params: { params: {
Id: item.id, Id: item.id
}, }
}).subscribe(data => {
this.message.create('success', '删除成功!');
this.getHost()
}) })
.subscribe((data) => {
this.message.create("success", "删除成功!");
this.getHost();
});
}, },
nzCancelText: "取消", nzCancelText: '取消'
}); });
} }
//摄像头 //摄像头
addCamera() { addCamera() {
console.log(this.selectedOilStation); console.log(this.selectedOilStation)
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: "新增加油站摄像头", nzTitle: '新增加油站摄像头',
nzContent: AddcameraComponent, nzContent: AddcameraComponent,
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 288, nzWidth: 288,
nzComponentParams: {}, nzComponentParams: {},
nzOnOk: async () => { nzOnOk: async () => {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise((resolve) => { await new Promise(resolve => {
console.log("表单信息", instance.validateForm); console.log('表单信息', instance.validateForm)
let body = { let body = {
organizationUnitId: this.selectedOilStation.id, organizationUnitId: this.selectedOilStation.id,
ipAdress: instance.validateForm.value.ip, ipAdress: instance.validateForm.value.ip,
code: instance.validateForm.value.code, code: instance.validateForm.value.code,
name: instance.validateForm.value.name, name: instance.validateForm.value.name,
// description: "", // description: "",
};
this.http.post("/api/services/app/Camera/Create", body).subscribe(
(data) => {
resolve(data);
this.message.create("success", "创建成功!");
this.getCamera();
return true;
},
(err) => {
return false;
} }
); this.http.post('/api/services/app/Camera/Create', body).subscribe(data => {
}); resolve(data)
this.message.create('success', '创建成功!');
this.getCamera()
return true
}, err => {
return false
})
})
} else { } else {
this.message.create("warning", "请填写完整!"); this.message.create('warning', '请填写完整!');
return false; return false
}
} }
},
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
editCamera(data) { editCamera(data) {
console.log(data);
console.log(data)
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: "编辑加油站摄像头", nzTitle: '编辑加油站摄像头',
nzContent: EditcameraComponent, nzContent: EditcameraComponent,
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 288, nzWidth: 288,
nzComponentParams: { nzComponentParams: {
data: data, data: data
}, },
nzOnOk: async () => { nzOnOk: async () => {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise((resolve) => { await new Promise(resolve => {
console.log("表单信息", instance.validateForm); console.log('表单信息', instance.validateForm)
data.name = instance.validateForm.value.name; data.name = instance.validateForm.value.name
data.code = instance.validateForm.value.code; data.code = instance.validateForm.value.code
data.ipAdress = instance.validateForm.value.ip; data.ipAdress = instance.validateForm.value.ip
this.http.put("/api/services/app/Camera/Update", data).subscribe( this.http.put('/api/services/app/Camera/Update', data).subscribe(data => {
(data) => { resolve(data)
resolve(data); this.message.create('success', '编辑成功!');
this.message.create("success", "编辑成功!"); this.getCamera()
this.getCamera(); return true
return true; }, err => {
}, return false
(err) => { })
return false; })
}
);
});
} else { } else {
this.message.create("warning", "请填写完整!"); this.message.create('warning', '请填写完整!');
return false; return false
}
} }
},
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
deleteCamera(item) { deleteCamera(item) {
console.log(item); console.log(item)
this.modal.confirm({ this.modal.confirm({
nzTitle: `确定要删除${item.name}这个摄像头吗?`, nzTitle: `确定要删除${item.name}这个摄像头吗?`,
nzOkText: "确定", nzOkText: '确定',
nzOkType: "primary", nzOkType: 'primary',
nzOnOk: () => { nzOnOk: () => {
this.http this.http.delete('/api/services/app/Camera/Delete', {
.delete("/api/services/app/Camera/Delete", {
params: { params: {
Id: item.id, Id: item.id
}, }
}).subscribe(data => {
this.message.create('success', '删除成功!');
this.getCamera()
}) })
.subscribe((data) => {
this.message.create("success", "删除成功!");
this.getCamera();
});
}, },
nzCancelText: "取消", nzCancelText: '取消'
}); });
} }
} }

2
src/app/system-management/navigation/navigation.component.html

@ -25,7 +25,7 @@
<nz-layout> <nz-layout>
<nz-header> <nz-header>
<span>Hey,欢迎登录加油站智能安全管理系统</span> <span>Hey,欢迎登录加油站智能安全管理系统</span>
<a nz-dropdown [nzDropdownMenu]="menu" [nzTrigger]="'click'" [nzBackdrop]='false' *ngIf="isZT ==='false'"> <a nz-dropdown [nzDropdownMenu]="menu" [nzTrigger]="'click'" [nzBackdrop]='false'>
<i nz-icon nzType="setting"></i> <i nz-icon nzType="setting"></i>
</a> </a>
<nz-dropdown-menu #menu="nzDropdownMenu"> <nz-dropdown-menu #menu="nzDropdownMenu">

2
src/app/system-management/navigation/navigation.component.scss

@ -16,7 +16,7 @@ nz-sider {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 0px; margin-top: 40px;
} }
.headPortrait { .headPortrait {

16
src/app/system-management/navigation/navigation.component.ts

@ -9,7 +9,6 @@ import { PatternService } from "src/app/service/pattern.service";
}) })
export class NavigationComponent implements OnInit { export class NavigationComponent implements OnInit {
constructor(private router: Router, private patternService: PatternService) {} constructor(private router: Router, private patternService: PatternService) {}
isZT = sessionStorage.getItem("isZT") || "false";
userMenu = []; userMenu = [];
menu = []; menu = [];
tap = []; tap = [];
@ -68,16 +67,6 @@ export class NavigationComponent implements OnInit {
url: "/system/algorithm", url: "/system/algorithm",
img: "../../../assets/images/icon/license.png", img: "../../../assets/images/icon/license.png",
}, },
{
name: "中台用户绑定",
url: "/system/userbinding",
img: "../../../assets/images/icon/license.png",
},
{
name: "中台机构绑定",
url: "/system/orbinding",
img: "../../../assets/images/icon/license.png",
},
]; ];
name; name;
@ -100,10 +89,7 @@ export class NavigationComponent implements OnInit {
// console.log(this.menuList1); // console.log(this.menuList1);
} }
for (let index = 0; index < this.menu3.length; index++) { for (let index = 0; index < this.menu3.length; index++) {
if ( if (JSON.parse(a).userName == "admin") {
JSON.parse(a).userName == "admin" ||
JSON.parse(a).userName == "superadmin"
) {
this.menuList2 = this.menu3; this.menuList2 = this.menu3;
} else { } else {
for (let k = 0; k < this.tap.length; k++) { for (let k = 0; k < this.tap.length; k++) {

35
src/app/system-management/or-binding/or-binding-model/or-binding-model.component.html

@ -1,35 +0,0 @@
<div class="orbox">
<div class="topbox">
<div class="righttop">
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入机构名称" [(ngModel)]="searchValue" />
</nz-input-group>
</div>
</div>
<div class="treeTitle">
<span>组织机构</span>
<label nz-checkbox [(ngModel)]="IsContainsChildren" (ngModelChange)="getAllOrganization()">包含子节点</label>
</div>
<div class="treebox">
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes"
[nzExpandedKeys]="defaultExpandedKeys" [nzTreeTemplate]="nzTreeTemplate" nzBlockNode
[nzExpandedIcon]="multiExpandedIconTpl">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="nodebox">
<span class="name">{{ node.title }}</span>
<div class="operation">
<span class="blueColor" (click)="okbinding(node)">绑定机构</span>
</div>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.children.length !== 0">
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"
class="ant-tree-switcher-line-icon"></i>
</ng-container>
</ng-template>
</div>
</div>

76
src/app/system-management/or-binding/or-binding-model/or-binding-model.component.scss

@ -1,76 +0,0 @@
.orbox {
width: 100%;
max-height: 600px;
overflow-y: auto;
margin-right: 10px;
display: flex;
flex-direction: column;
.treebox {
display: flex;
flex: 1;
overflow: auto;
flex-direction: column;
box-sizing: border-box;
padding: 10px 0;
}
.topbox2 {
width: 100%;
height: 36px;
display: flex;
align-items: center;
margin-top: 20px;
.lefttop {
height: 36px;
line-height: 36px;
color: #000;
margin-right: 10px;
font-size: 15px;
}
.righttop {
flex: 1;
height: 36px;
display: flex;
nz-input-group {
height: 36px;
}
}
}
.treeTitle {
width: 100%;
height: 55px;
line-height: 55px;
margin-top: 12px;
display: flex;
justify-content: space-between;
color: #000d21;
box-sizing: border-box;
padding: 0 10px;
background: rgba(145, 204, 255, 0.2);
border: 1px solid rgba(145, 204, 255, 0.2);
span {
font-size: 14px;
}
div {
flex: 1;
width: 100px;
margin-left: 55px;
}
}
.nodebox {
display: flex;
width: 100%;
justify-content: space-between;
}
}

128
src/app/system-management/or-binding/or-binding-model/or-binding-model.component.ts

@ -1,128 +0,0 @@
import {
Component,
Input,
OnInit,
TemplateRef,
ViewChild,
ViewContainerRef,
} from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import {
NzFormatEmitEvent,
NzTreeComponent,
NzTreeNodeOptions,
} from "ng-zorro-antd/tree";
import { NzModalService } from "ng-zorro-antd/modal";
import { NzMessageService } from "ng-zorro-antd/message";
import { HttpClient } from "@angular/common/http";
import { TreeService } from "src/app/service/tree.service";
import { NzNotificationService } from "ng-zorro-antd/notification";
@Component({
selector: "app-or-binding-model",
templateUrl: "./or-binding-model.component.html",
styleUrls: ["./or-binding-model.component.scss"],
})
export class OrBindingModelComponent implements OnInit {
@Input() data?: any;
constructor(
private fb: FormBuilder,
private modal: NzModalService,
private viewContainerRef: ViewContainerRef,
private message: NzMessageService,
private http: HttpClient,
private toTree: TreeService,
private notification: NzNotificationService,
private notificationService: NzNotificationService
) {}
level;
getAllUrl;
addUrl;
editUrl;
deleteUrl;
isAdmin: boolean;
ngOnInit(): void {
this.level = JSON.parse(
sessionStorage.getItem("userdata")
).organization.level;
this.getAllUrl = "/api/services/app/User/GetAll";
this.getAllOrganization();
}
nzSelectedKeys: any[] = [];
defaultExpandedKeys = [];
IsContainsChildren = true;
searchValue = "";
totalCount: string;
//获取所有用户
//获取所有组织机构
nodes: any = [];
organization;
async getAllOrganization() {
let userData = null;
if (sessionStorage.getItem("isGasStation") == "true") {
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
} else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
let params = {
IsContainsChildren: "true",
};
await new Promise<void>((resolve, reject) => {
this.http
.get("/api/services/app/Organization/GetAll", {
params: params,
})
.subscribe(async (data: any) => {
this.organization = data.result.items;
for (let index = 0; index < data.result.items.length; index++) {
// if (data.result.items[index].id == OrganizationUnitId) {
// data.result.items[index].parentId = null;
// }
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(data.result.items[index].id)) {
data.result.items[index].parentId = null;
}
} else {
if (data.result.items[index].id == OrganizationUnitId) {
data.result.items[index].parentId = null;
}
}
data.result.items[index].title =
data.result.items[index].displayName;
data.result.items[index].key = data.result.items[index].id;
}
this.nodes = [...this.toTree.toTree(data.result.items)];
this.defaultExpandedKeys = [this.nodes[0].id];
});
});
}
okbinding(item) {
console.log(this.data);
console.log(item);
this.modal.confirm({
nzTitle: "确定要绑定到此机构吗?",
nzOkText: "确定",
nzOkType: "primary",
nzOnOk: () => {
this.http
.post("/api/services/app/Organization/SetSinoOrgLocal", null, {
params: {
sinoOrgId: this.data.organId,
localOrgId: item.key,
},
})
.subscribe(() => {
this.message.create("success", "绑定成功");
});
},
nzCancelText: "取消",
nzOnCancel: () => console.log("Cancel"),
});
}
}

56
src/app/system-management/or-binding/or-binding.component.html

@ -1,56 +0,0 @@
<div class="userBox" id="userBox">
<div class="box">
<div class="topbox">
<div class="lefttop">
<span>中台组织机构列表</span>
<span><i nz-icon nzType="search"></i> {{listConfig.totalCount}}个组织</span>
</div>
<div class="righttop">
<button nz-button nzType="primary" style="margin-right: 12px;" (click)="syncOr()">全量同步机构</button>
<button nz-button nzType="primary" style="margin-right: 12px;" (click)="syncUser()">全量同步用户</button>
<!-- <button nz-button nzType="primary" style="margin-right: 12px;" (click)="sync()">同步数据</button> -->
<label class="isBinding" nz-checkbox [(ngModel)]="listConfig.IsBindingLocal"
(ngModelChange)="submitForm()">是否绑定本地机构</label>
<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入站名" formControlName="search" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form>
</div>
</div>
<div class="tablebox" #tablebox>
<nz-table #basicTable [nzLoading]="listConfig.loading" [nzData]="listConfig.usersLIst" [nzShowPagination]='false'
[nzPageSize]='16'>
<thead>
<tr>
<th>机构名称</th>
<th>机构类型</th>
<th>已绑机构</th>
<th [width]="'10%'">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{ data.organName }}</td>
<td>{{ getOrganType(data.detail.organType) }}</td>
<td>{{ data.organization?.displayName || '' }}</td>
<td class="operation">
<span class="blueColor" (click)="binding(data)">绑定机构</span>
</td>
</tr>
</tbody>
</nz-table>
</div>
<div class="pagination">
<nz-pagination [nzHideOnSinglePage]="false" [nzPageIndex]="1" [nzTotal]="listConfig.totalCount" [nzPageSize]="16"
[nzShowTotal]="totalTemplate" nzShowQuickJumper (nzPageIndexChange)="pageChange($event)">
</nz-pagination>
<ng-template #totalTemplate let-total> 16条/页,共{{listConfig.totalCount}}条 </ng-template>
</div>
</div>
</div>

168
src/app/system-management/or-binding/or-binding.component.scss

@ -1,168 +0,0 @@
.userBox {
width: 100%;
height: 100%;
background: #ffffff;
box-sizing: border-box;
padding: 20px;
overflow: hidden;
display: flex;
position: relative;
.treebox {
display: flex;
flex: 1;
overflow: auto;
flex-direction: column;
box-sizing: border-box;
padding: 10px 0;
}
.check {
width: 100%;
float: right;
}
.topbox2 {
width: 100%;
height: 36px;
display: flex;
align-items: center;
margin-top: 20px;
.lefttop {
height: 36px;
line-height: 36px;
color: #000;
margin-right: 10px;
font-size: 15px;
}
.righttop {
flex: 1;
height: 36px;
display: flex;
nz-input-group {
height: 36px;
}
}
}
.orbox {
width: 260px;
min-width: 250px;
overflow-y: auto;
margin-right: 10px;
display: flex;
flex-direction: column;
}
.treeTitle {
width: 100%;
height: 55px;
line-height: 55px;
margin-top: 12px;
display: flex;
justify-content: space-between;
color: #000d21;
box-sizing: border-box;
padding: 0 10px;
background: rgba(145, 204, 255, 0.2);
border: 1px solid rgba(145, 204, 255, 0.2);
span {
font-size: 14px;
}
div {
flex: 1;
width: 100px;
margin-left: 55px;
}
}
.nodebox {
display: flex;
justify-content: space-between;
}
tbody {
.operation {
i {
cursor: pointer;
margin-right: 8px;
}
}
}
}
.box {
flex: 1;
// overflow: auto;
padding-top: 20px;
overflow-y: auto;
display: flex;
flex-direction: column;
height: 100%;
}
.topbox {
width: 100%;
height: 36px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
.lefttop {
span:nth-child(1) {
color: #000d21;
margin-right: 16px;
}
span:nth-child(2) {
color: rgba(36, 36, 36, 0.24);
}
}
.righttop {
display: flex;
// align-items: center;
.isBinding {
margin-top: 6px;
}
button {
margin-left: 16px;
}
nz-input-group {
height: 32px;
}
}
}
.tablebox {
flex: 1;
overflow-y: auto;
overflow: auto;
}
.pagination {
margin: 15px 0;
display: flex;
align-items: center;
justify-content: center;
}
.ortype {
width: 36px;
height: 20px;
background: #2399ff;
opacity: 1;
border-radius: 2px;
font-size: 12px;
margin-right: 8px;
color: #fff;
text-align: center;
}

156
src/app/system-management/or-binding/or-binding.component.ts

@ -1,156 +0,0 @@
import {
Component,
OnInit,
TemplateRef,
ViewChild,
ViewContainerRef,
} from "@angular/core";
import { FormBuilder, FormGroup } from "@angular/forms";
import { NzFormatEmitEvent } from "ng-zorro-antd/tree";
import { NzModalService } from "ng-zorro-antd/modal";
import { NzMessageService } from "ng-zorro-antd/message";
import { HttpClient } from "@angular/common/http";
import { TreeService } from "src/app/service/tree.service";
import { NzNotificationService } from "ng-zorro-antd/notification";
import { OrBindingModelComponent } from "./or-binding-model/or-binding-model.component";
// import { BindingComponent } from "./binding/binding.component";
@Component({
selector: "app-or-binding",
templateUrl: "./or-binding.component.html",
styleUrls: ["./or-binding.component.scss"],
})
export class OrBindingComponent implements OnInit {
validateForm!: FormGroup;
constructor(
private fb: FormBuilder,
private http: HttpClient,
private toTree: TreeService,
private modal: NzModalService,
private message: NzMessageService,
private viewContainerRef: ViewContainerRef
) {}
ngOnInit(): void {
this.validateForm = this.fb.group({
search: [null],
});
this.getAllOr();
// this.getAllOrganization();
}
listConfig = {
loading: false,
usersLIst: [],
totalCount: 0,
IsContainsChildren: true,
searchValue: "",
OrganizationUnitId: "",
IsBindingLocal: true,
};
getAllOr() {
this.listConfig.loading = true;
let params = {
Keyword: this.validateForm.value.search
? this.validateForm.value.search
: "",
SkipCount: String(this.SkipCount),
MaxResultCount: String(this.MaxResultCount),
// OrganizationUnitId: this.OrganizationUnitId,
IsBindingLocal: this.listConfig.IsBindingLocal,
// IsActive:true,
// IsContainsChildren: String(this.listConfig.IsContainsChildren),
};
this.http
.get(this.getAllUrl, {
params: params,
})
.subscribe((data: any) => {
console.log("中台组织机构列表", data);
data.result.items.forEach((element) => {
element.detail = JSON.parse(element.detail);
});
this.listConfig.usersLIst = data.result.items;
this.listConfig.totalCount = data.result.totalCount;
this.listConfig.loading = false;
});
}
SkipCount: number = 0; //0 16 32 48
MaxResultCount: number = 16;
pageChange($event) {
this.SkipCount = ($event - 1) * this.MaxResultCount;
this.getAllOr();
}
getAllUrl = "/api/services/app/Organization/GetSinochemOrgs";
//搜索框提交
submitForm(): void {
for (const i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
this.getAllOr();
}
getOrganType(type) {
let obj = {
"00": "总公司",
"01": "省公司",
"05": "管理部门",
"06": "大区公司",
"07": "模块",
"08": "管理区域",
"09": "省子公司",
"10": "油站网点/线上商城",
"11": "油库",
};
return obj[type];
}
binding(data) {
const modal = this.modal.create({
nzTitle: "绑定本地机构",
nzContent: OrBindingModelComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 1500,
nzFooter: null,
nzMaskClosable: false,
nzComponentParams: {
data: JSON.parse(JSON.stringify(data)),
},
});
const instance = modal.getContentComponent();
modal.afterClose.subscribe((result) => this.getAllOr());
}
// sync() {
// this.http
// .post("/api/services/app/OrganizationSync/AutoSinochemOrgRelate", null)
// .subscribe((data: any) => {
// this.message.create("success", "同步成功");
// });
// }
syncOr() {
this.http
.post("/api/services/app/OrganizationSync/SyncOrgFromSinochem", null)
.subscribe(() => {
this.http
.post(
"/api/services/app/OrganizationSync/AutoSinochemOrgRelate",
null
)
.subscribe(() => {
this.message.create("success", "同步成功");
});
});
}
syncUser() {
this.http
.post("/api/services/app/OrganizationSync/SyncUserFromSinochem", null)
.subscribe(() => {
this.message.create("success", "同步成功");
});
}
}

4
src/app/system-management/organization/change-or/change-or.component.html

@ -1,4 +0,0 @@
<div class="box">
<nz-tree #nzTreeComponent [nzSelectedKeys]="defaultSelectedKeys" [nzData]="nodes"
[nzExpandedKeys]="defaultExpandedKeys"></nz-tree>
</div>

5
src/app/system-management/organization/change-or/change-or.component.scss

@ -1,5 +0,0 @@
.box {
max-height: 500px;
overflow-y: auto;
}

55
src/app/system-management/organization/change-or/change-or.component.ts

@ -1,55 +0,0 @@
import { Component, Input, OnInit, ViewChild } from "@angular/core";
import { NzModalRef } from "ng-zorro-antd/modal";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { HttpClient } from "@angular/common/http";
import { TreeService } from "src/app/service/tree.service";
import { NzTreeComponent } from "ng-zorro-antd/tree";
@Component({
selector: "app-change-or",
templateUrl: "./change-or.component.html",
styleUrls: ["./change-or.component.scss"],
})
export class ChangeOrComponent implements OnInit {
@Input() data?: any;
@ViewChild("nzTreeComponent", { static: false })
nzTreeComponent!: NzTreeComponent;
constructor(
private modal: NzModalRef,
private fb: FormBuilder,
private http: HttpClient,
private toTree: TreeService
) {}
defaultExpandedKeys = [];
defaultSelectedKeys = [];
ngOnInit(): void {
this.getAllOrganization();
// this.nzTreeComponent.getCheckedNodeList()
}
allOrList: any;
nodes: any;
getAllOrganization() {
let params = {
IsContainsChildren: "true",
};
this.http
.get("/api/services/app/Organization/GetAll", {
params: params,
})
.subscribe((data: any) => {
console.log(data);
data.result.items.forEach((element) => {
element.key = element.id;
element.title = element.displayName;
});
this.allOrList = data.result.items.filter((v) => !v.isGasStation);
this.nodes = [...this.toTree.toTree(this.allOrList)];
});
}
destroyModal(): void {
this.modal.destroy({ data: "this the result data" });
}
}

11
src/app/system-management/organization/organization.component.html

@ -12,7 +12,7 @@
<nz-input-group nzPrefixIcon="search"> <nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入单位" [(ngModel)]="searchValue" /> <input type="text" nz-input placeholder="请输入单位" [(ngModel)]="searchValue" />
</nz-input-group> </nz-input-group>
<button *ngIf="isAdmin" nz-button nzType="primary" (click)="addOr()"><i nz-icon nzType="plus-circle" <button nz-button nzType="primary" (click)="addOr()"><i nz-icon nzType="plus-circle"
nzTheme="outline"></i>新增</button> nzTheme="outline"></i>新增</button>
</div> </div>
</div> </div>
@ -21,20 +21,17 @@
<span>操作</span> <span>操作</span>
</div> </div>
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes" <nz-tree [nzHideUnMatched]='true' [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes"
[nzExpandAll]="nzExpandAll" [nzExpandedKeys]="defaultExpandedKeys" [nzTreeTemplate]="nzTreeTemplate" nzBlockNode [nzExpandAll]="nzExpandAll" [nzExpandedKeys]="defaultExpandedKeys" [nzTreeTemplate]="nzTreeTemplate" nzDraggable
[nzExpandedIcon]="multiExpandedIconTpl"> nzBlockNode (nzOnDrop)="nzEvent($event)" [nzBeforeDrop]="beforeDrop" [nzExpandedIcon]="multiExpandedIconTpl">
</nz-tree> </nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin"> <ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="nodebox"> <div class="nodebox">
<span class="name"> <span class="name">
{{ node.title }} {{ node.title }}
<span *ngIf="!node.origin.isGasStation">({{node.origin.products? node.origin.products.stationsCount :
0}})</span>
</span> </span>
<span class="operation" *ngIf="level === 1 && isAdmin"> <span class="operation">
<span (click)="addOr(node)" *ngIf="!node.origin.isGasStation">新增</span> <span (click)="addOr(node)" *ngIf="!node.origin.isGasStation">新增</span>
<span (click)="waring(node)" *ngIf="node.origin.isGasStation">配置预警事件</span> <span (click)="waring(node)" *ngIf="node.origin.isGasStation">配置预警事件</span>
<span class="blue" (click)="changeOr(node)">修改所属机构</span>
<span (click)="editOr(node)">编辑</span> <span (click)="editOr(node)">编辑</span>
<span [ngClass]="{'grey':node.origin.children && node.origin.children.length != 0}" <span [ngClass]="{'grey':node.origin.children && node.origin.children.length != 0}"
(click)="deleteOr(node)">删除</span> (click)="deleteOr(node)">删除</span>

121
src/app/system-management/organization/organization.component.ts

@ -22,7 +22,6 @@ import { NzFormatBeforeDropEvent } from "ng-zorro-antd/tree";
import { Observable, of } from "rxjs"; import { Observable, of } from "rxjs";
import { delay } from "rxjs/operators"; import { delay } from "rxjs/operators";
import { WarningEventsComponent } from "./warning-events/warning-events.component"; import { WarningEventsComponent } from "./warning-events/warning-events.component";
import { ChangeOrComponent } from "./change-or/change-or.component";
@Component({ @Component({
selector: "app-organization", selector: "app-organization",
templateUrl: "./organization.component.html", templateUrl: "./organization.component.html",
@ -39,21 +38,11 @@ export class OrganizationComponent implements OnInit {
private viewContainerRef: ViewContainerRef private viewContainerRef: ViewContainerRef
) {} ) {}
isAdmin: boolean; // level: number; //当前登录账号的组织机构等级
level: number; //当前登录账号的组织机构等级
ngOnInit(): void { ngOnInit(): void {
let userdata = JSON.parse(sessionStorage.getItem("userdata")); // this.level = JSON.parse(
if (userdata.userName == "admin" || userdata.userName == "superadmin") { // sessionStorage.getItem("userdata")
//是superadmin,是内部制作账号 // ).organization.level;
this.isAdmin = true;
} else {
this.isAdmin = false;
}
this.level = JSON.parse(
sessionStorage.getItem("userdata")
).organization.level;
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
search: [null], search: [null],
}); });
@ -73,11 +62,17 @@ export class OrganizationComponent implements OnInit {
totalCount: string; totalCount: string;
allOrList: any; allOrList: any;
organization: any;
isLoading = false; isLoading = false;
getAllOrganization() { getAllOrganization() {
this.isLoading = true; this.isLoading = true;
let OrganizationUnitId =
sessionStorage.getItem("isGasStation") == "true"
? JSON.parse(sessionStorage.getItem("userdataOfgasstation"))
.organization.id
: JSON.parse(sessionStorage.getItem("userdata")).organization.id;
let params = { let params = {
OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true", IsContainsChildren: "true",
}; };
this.http this.http
@ -85,53 +80,13 @@ export class OrganizationComponent implements OnInit {
params: params, params: params,
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
this.organization = data.result.items;
this.getStationsNum(data.result.items);
this.totalCount = data.result.totalCount; this.totalCount = data.result.totalCount;
console.log(data.result.items);
data.result.items.forEach((element) => {
element.title = element.displayName;
element.key = element.id;
}); });
} this.nodes = [...this.toTree.toTree(data.result.items)];
//获得组织机构下有多少油站
stationsList;
getStationsNum(e) {
let userData = null;
if (sessionStorage.getItem("isGasStation") == "true") {
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
} else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
this.http
.get(
"/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true"
)
.subscribe((data: any) => {
this.stationsList = data.result;
const arrs = e.map((item) => {
const data = this.stationsList.find(
(i) => item.id == i.organizationId
);
return {
...item,
products: data ? data : false,
};
});
for (let index = 0; index < arrs.length; index++) {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(arrs[index].id)) {
arrs[index].parentId = null;
}
} else {
if (arrs[index].id == OrganizationUnitId) {
arrs[index].parentId = null;
}
}
arrs[index].title = arrs[index].displayName;
arrs[index].key = arrs[index].id;
arrs[index].selectable = false;
}
this.nodes = [...this.toTree.toTree(arrs)];
this.defaultExpandedKeys.length == 0 this.defaultExpandedKeys.length == 0
? (this.defaultExpandedKeys = [this.nodes[0].id]) ? (this.defaultExpandedKeys = [this.nodes[0].id])
: (this.defaultExpandedKeys = [...this.defaultExpandedKeys]); : (this.defaultExpandedKeys = [...this.defaultExpandedKeys]);
@ -430,48 +385,4 @@ export class OrganizationComponent implements OnInit {
return of(true); return of(true);
} }
}; };
changeOr(node) {
const modal = this.modal.create({
nzTitle: "修改所属组织机构",
nzContent: ChangeOrComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 500,
nzComponentParams: {
data: this.allOrList,
},
nzOnOk: async () => {
let selectedNode =
instance.nzTreeComponent.getSelectedNodeList()[0].key;
if (selectedNode) {
await new Promise((resolve) => {
let body = {
id: node.origin.id,
parentId: selectedNode,
displayName: node.origin.displayName,
isGasStation: node.origin.isGasStation,
isSkipAudit: node.origin.isSkipAudit,
level: node.origin.level,
};
this.http
.put(`/api/services/app/Organization/Update`, body)
.subscribe((data) => {
resolve(data);
this.message.create("success", "修改成功!");
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key);
});
this.getAllOrganization();
return true;
});
});
} else {
this.message.create("warning", "请选择机构!");
return false;
}
},
});
const instance = modal.getContentComponent();
}
} }

4
src/app/system-management/system-management-routing.module.ts

@ -11,8 +11,6 @@ import { UpdateOfLicenseComponent } from "./update-of-license/update-of-license.
import { FileOfLicenseComponent } from "./file-of-license/file-of-license.component"; import { FileOfLicenseComponent } from "./file-of-license/file-of-license.component";
import { MenuComponent } from "./menu/menu.component"; import { MenuComponent } from "./menu/menu.component";
import { AlgorithmConfigComponent } from "./algorithm-config/algorithm-config.component"; import { AlgorithmConfigComponent } from "./algorithm-config/algorithm-config.component";
import { UserBindingComponent } from "./user-binding/user-binding.component";
import { OrBindingComponent } from "./or-binding/or-binding.component";
const routes: Routes = [ const routes: Routes = [
{ path: "organization", component: OrganizationComponent }, { path: "organization", component: OrganizationComponent },
{ path: "user", component: UserComponent }, { path: "user", component: UserComponent },
@ -23,8 +21,6 @@ const routes: Routes = [
{ path: "updateOfLicense", component: UpdateOfLicenseComponent }, { path: "updateOfLicense", component: UpdateOfLicenseComponent },
{ path: "menu", component: MenuComponent }, { path: "menu", component: MenuComponent },
{ path: "algorithm", component: AlgorithmConfigComponent }, { path: "algorithm", component: AlgorithmConfigComponent },
{ path: "userbinding", component: UserBindingComponent },
{ path: "orbinding", component: OrBindingComponent },
]; ];
@NgModule({ @NgModule({

15
src/app/system-management/system-management.module.ts

@ -50,12 +50,7 @@ import { NzSwitchModule } from "ng-zorro-antd/switch";
import { NzNotificationModule } from "ng-zorro-antd/notification"; import { NzNotificationModule } from "ng-zorro-antd/notification";
import { DragDropModule } from "@angular/cdk/drag-drop"; import { DragDropModule } from "@angular/cdk/drag-drop";
import { NzToolTipModule } from "ng-zorro-antd/tooltip"; import { NzToolTipModule } from "ng-zorro-antd/tooltip";
import { AlgorithmConfigComponent } from "./algorithm-config/algorithm-config.component"; import { AlgorithmConfigComponent } from './algorithm-config/algorithm-config.component';
import { UserBindingComponent } from "./user-binding/user-binding.component";
import { BindingComponent } from "./user-binding/binding/binding.component";
import { OrBindingComponent } from './or-binding/or-binding.component';
import { OrBindingModelComponent } from './or-binding/or-binding-model/or-binding-model.component';
import { ChangeOrComponent } from './organization/change-or/change-or.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
OrganizationComponent, OrganizationComponent,
@ -87,11 +82,6 @@ import { ChangeOrComponent } from './organization/change-or/change-or.component'
MenusComponent, MenusComponent,
WarningEventsComponent, WarningEventsComponent,
AlgorithmConfigComponent, AlgorithmConfigComponent,
UserBindingComponent,
BindingComponent,
OrBindingComponent,
OrBindingModelComponent,
ChangeOrComponent,
], ],
imports: [ imports: [
CommonModule, CommonModule,
@ -117,7 +107,7 @@ import { ChangeOrComponent } from './organization/change-or/change-or.component'
NzSwitchModule, NzSwitchModule,
NzNotificationModule, NzNotificationModule,
DragDropModule, DragDropModule,
NzToolTipModule, NzToolTipModule
], ],
entryComponents: [ entryComponents: [
AdduserComponent, AdduserComponent,
@ -139,7 +129,6 @@ import { ChangeOrComponent } from './organization/change-or/change-or.component'
EditmenuComponent, EditmenuComponent,
MenusComponent, MenusComponent,
WarningEventsComponent, WarningEventsComponent,
BindingComponent,
], ],
}) })
export class SystemManagementModule {} export class SystemManagementModule {}

113
src/app/system-management/user-binding/binding/binding.component.html

@ -1,113 +0,0 @@
<div class="userBox" id="userBox">
<div class="orbox">
<div class="topbox2">
<div class="lefttop">
组织机构
</div>
<div class="righttop">
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入机构名称" [(ngModel)]="searchValue" />
</nz-input-group>
</div>
</div>
<div class="treeTitle">
<span>组织机构</span>
<label nz-checkbox [(ngModel)]="IsContainsChildren" (ngModelChange)="getAllOrganization()">包含子节点</label>
</div>
<div class="treebox">
<nz-tree [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes"
[nzExpandedKeys]="defaultExpandedKeys" [nzSelectedKeys]='nzSelectedKeys' (nzClick)="nzClick($event)"
[nzExpandedIcon]="multiExpandedIconTpl" [nzHideUnMatched]="true" [nzTreeTemplate]="nzTreeTemplate">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="nodebox">
<span class="name">{{ node.title }}</span>
<span class="name">({{node.origin.products? node.origin.products.usersCount : 0}})</span>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.children.length == 0; else elseTemplate">
</ng-container>
<ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"
class="ant-tree-switcher-line-icon"></i>
</ng-template>
</ng-template>
</div>
</div>
<div class="box">
<div class="topbox">
<div class="lefttop">
<span>用户列表</span>
<span><i nz-icon nzType="search"></i> {{usersNum}}名用户</span>
</div>
<div class="righttop">
<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入用户名" formControlName="search" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form>
</div>
</div>
<div class="tablebox" #tablebox>
<nz-table #basicTable [nzLoading]="loading" [nzData]="usersLIst" [nzShowPagination]='false'
[nzPageSize]='16'>
<thead>
<tr>
<th></th>
<th>账号</th>
<th>姓名</th>
<!-- <th>角色/预警接收级别</th> -->
<th [width]="'13%'">所属机构</th>
<th [width]="'8%'">用户状态</th>
<th [width]="'8%'">备注</th>
<th [width]="'10%'">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td><img src="../../../assets/images/user.png" alt=""></td>
<td>{{ data.userName }}</td>
<td>{{ data.name }}</td>
<!-- <td nzBreakWord>
<span style="margin-right: 8px;" *ngFor="let item of data.roleDisplayNames">{{item}}</span>
</td> -->
<td>
{{data.organizationName}}
</td>
<td>
<ng-container *ngIf="data.isActive; else elseTemplate">
<span class="greenColor2">已启用</span>
</ng-container>
<ng-template #elseTemplate>
<span class="redColor">已停用</span>
</ng-template>
</td>
<td>
{{data.note}}
</td>
<td class="operation">
<span class="blueColor" (click)="okbinding(data)">确认绑定</span>
</td>
</tr>
</tbody>
</nz-table>
</div>
<div class="pagination">
<nz-pagination [nzHideOnSinglePage]="false" [nzPageIndex]="1" [nzTotal]="usersNum" [nzPageSize]="16"
[nzShowTotal]="totalTemplate" nzShowQuickJumper (nzPageIndexChange)="pageChange($event)">
</nz-pagination>
<ng-template #totalTemplate let-total> 16条/页,共{{usersNum}}条 </ng-template>
</div>
</div>
</div>

223
src/app/system-management/user-binding/binding/binding.component.scss

@ -1,223 +0,0 @@
.userBox {
width: 100%;
max-height: 680px;
background: #FFFFFF;
overflow: hidden;
display: flex;
position: relative;
.treebox {
display: flex;
flex: 1;
overflow: auto;
flex-direction: column;
box-sizing: border-box;
padding: 10px 0;
}
.topbox2 {
width: 100%;
height: 36px;
display: flex;
align-items: center;
margin-top: 20px;
.lefttop {
height: 36px;
line-height: 36px;
color: #000;
margin-right: 10px;
font-size: 15px;
}
.righttop {
flex: 1;
height: 36px;
display: flex;
nz-input-group {
height: 36px;
}
}
}
.orbox {
width: 260px;
min-width: 250px;
overflow-y: auto;
margin-right: 10px;
display: flex;
flex-direction: column;
}
.treeTitle {
width: 100%;
height: 55px;
line-height: 55px;
margin-top: 12px;
display: flex;
justify-content: space-between;
color: #000D21;
box-sizing: border-box;
padding: 0 10px;
background: rgba(145, 204, 255, 0.2);
border: 1px solid rgba(145, 204, 255, 0.2);
span {
font-size: 14px;
}
div {
flex: 1;
width: 100px;
margin-left: 55px;
}
}
.nodebox {
display: flex;
justify-content: space-between;
}
tbody {
tr {
td:nth-child(1) {
text-align: right;
}
}
.operation {
i {
cursor: pointer;
margin-right: 8px;
}
}
}
}
.box {
flex: 1;
padding-top: 20px;
display: flex;
flex-direction: column;
overflow: hidden;
}
.topbox {
width: 100%;
height: 36px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
.lefttop {
span:nth-child(1) {
color: #000D21;
margin-right: 16px;
}
span:nth-child(2) {
color: rgba(36, 36, 36, 0.24);
}
}
.righttop {
display: flex;
button {
margin-left: 16px;
}
nz-input-group {
height: 32px;
}
}
}
.tablebox {
flex: 1;
overflow-y: auto;
}
.pagination {
margin: 15px 0;
display: flex;
align-items: center;
justify-content: center;
}
.ortype {
width: 36px;
height: 20px;
background: #2399FF;
opacity: 1;
border-radius: 2px;
font-size: 12px;
margin-right: 8px;
color: #fff;
text-align: center;
}
.resetPasswordContent {
z-index: 999;
width: 380px;
height: 138px;
position: absolute;
left: 30%;
top: 30%;
display: flex;
flex-direction: column;
justify-content: center;
box-sizing: border-box;
padding-left: 40px;
color: #000;
border-radius: 5px;
border-radius: 2px;
box-shadow: 0 3px 6px -4px rgb(0 0 0 / 12%), 0 6px 16px 0 rgb(0 0 0 / 8%), 0 9px 28px 8px rgb(0 0 0 / 5%);
background: #fff;
.titlebox {
display: flex;
align-items: center;
position: relative;
span {
font-size: 18px;
font-weight: 600;
}
i {
font-size: 26px;
margin-right: 6px;
}
.close {
position: absolute;
right: 2px;
top: -22px;
font-size: 16px;
cursor: pointer;
}
.move {
position: absolute;
left: -32px;
top: -22px;
cursor: move;
}
}
.message {
margin-top: 20px;
i {
cursor: pointer;
}
i:hover {
color: #18bb18;
}
}
}

208
src/app/system-management/user-binding/binding/binding.component.ts

@ -1,208 +0,0 @@
import {
Component,
Input,
OnInit,
TemplateRef,
ViewChild,
ViewContainerRef,
} from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import {
NzFormatEmitEvent,
NzTreeComponent,
NzTreeNodeOptions,
} from "ng-zorro-antd/tree";
import { NzModalService } from "ng-zorro-antd/modal";
import { NzMessageService } from "ng-zorro-antd/message";
import { HttpClient } from "@angular/common/http";
import { TreeService } from "src/app/service/tree.service";
import { NzNotificationService } from "ng-zorro-antd/notification";
@Component({
selector: "app-binding",
templateUrl: "./binding.component.html",
styleUrls: ["./binding.component.scss"],
})
export class BindingComponent implements OnInit {
@Input() data?: any;
validateForm!: FormGroup;
constructor(
private fb: FormBuilder,
private modal: NzModalService,
private viewContainerRef: ViewContainerRef,
private message: NzMessageService,
private http: HttpClient,
private toTree: TreeService,
private notification: NzNotificationService,
private notificationService: NzNotificationService
) {}
level;
getAllUrl;
addUrl;
editUrl;
deleteUrl;
CountsByOrganizations;
isAdmin: boolean;
ngOnInit(): void {
this.validateForm = this.fb.group({
search: [null],
});
this.level = JSON.parse(
sessionStorage.getItem("userdata")
).organization.level;
this.getAllUrl = "/api/services/app/User/GetAll";
this.CountsByOrganizations =
"/api/services/app/User/GetCountsByOrganizations";
this.getAllOrganization();
}
nzSelectedKeys: any[] = [];
defaultExpandedKeys = [];
IsContainsChildren = true;
searchValue = "";
totalCount: string;
//获取所有用户
usersLIst: any = [];
usersNum: string;
OrganizationUnitId;
loading: boolean;
organizationsList = [];
getAllUsers() {
this.loading = true;
let params = {
Keyword: this.validateForm.value.search
? this.validateForm.value.search
: "",
SkipCount: String(this.SkipCount),
MaxResultCount: String(this.MaxResultCount),
OrganizationUnitId: this.OrganizationUnitId,
IsContainsChildren: String(this.IsContainsChildren),
// Sorting: 'BuildingBasicInfo.Id asc'
};
this.http
.get(this.getAllUrl, {
params: params,
})
.subscribe((data: any) => {
this.usersLIst = data.result.items;
this.usersNum = data.result.totalCount;
this.loading = false;
});
}
SkipCount: number = 0; //0 16 32 48
MaxResultCount: number = 16;
pageChange($event) {
this.SkipCount = ($event - 1) * this.MaxResultCount;
this.getAllUsers();
}
//获取所有组织机构
nodes: any = [];
organization;
async getAllOrganization() {
let params = {
IsContainsChildren: "true",
};
await new Promise<void>((resolve, reject) => {
this.http
.get("/api/services/app/Organization/GetAll", {
params: params,
})
.subscribe(async (data: any) => {
this.organization = data.result.items;
await this.getuser(data.result.items);
resolve(data);
this.getAllUsers();
});
});
}
async getuser(e) {
let userData = null;
if (sessionStorage.getItem("isGasStation") == "true") {
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
} else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
let params = {
OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true",
IsUsersCountContainsChildren: String(this.IsContainsChildren),
};
await new Promise<void>((resolve, reject) => {
this.http
.get(this.CountsByOrganizations, {
params: params,
})
.subscribe((data: any) => {
resolve(data);
this.organizationsList = data.result;
const arrs = e.map((item) => {
const data = this.organizationsList.find(
(i) => item.id == i.organizationId
);
return {
...item,
products: data ? data : false,
};
});
for (let index = 0; index < arrs.length; index++) {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(arrs[index].id)) {
arrs[index].parentId = null;
}
} else {
if (arrs[index].id == OrganizationUnitId) {
arrs[index].parentId = null;
}
}
arrs[index].title = arrs[index].displayName;
arrs[index].key = arrs[index].id;
}
this.nodes = [...this.toTree.toTree(arrs)];
this.defaultExpandedKeys = [this.nodes[0].id];
this.nzSelectedKeys = [this.nodes[0].id];
this.OrganizationUnitId = [this.nodes[0].id];
});
});
}
//搜索框提交
submitForm(): void {
for (const i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
this.getAllUsers();
}
nzClick(event: NzFormatEmitEvent) {
this.nzSelectedKeys[0] = event.node.origin.id;
this.nzSelectedKeys = [...this.nzSelectedKeys];
this.OrganizationUnitId = event.node.origin.id;
this.getAllUsers();
}
okbinding(item) {
this.modal.confirm({
nzTitle: "确定要绑定到此本地用户吗?",
nzOkText: "确定",
nzOkType: "primary",
nzOnOk: () => {
this.http
.post("/api/services/app/User/SetSinochemUserLocal", null, {
params: {
sinochemUserId: this.data.userId,
localUserId: item.id,
},
})
.subscribe(() => {
this.message.create("success", "绑定成功");
});
},
nzCancelText: "取消",
nzOnCancel: () => console.log("Cancel"),
});
}
}

101
src/app/system-management/user-binding/user-binding.component.html

@ -1,101 +0,0 @@
<div class="userBox" id="userBox">
<!-- <div class="orbox">
<div class="topbox2">
<div class="lefttop">
组织机构
</div>
<div class="righttop">
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入机构名称" [(ngModel)]="searchValue" />
</nz-input-group>
</div>
</div>
<div class="treeTitle">
<span>组织机构</span>
<label nz-checkbox [(ngModel)]="IsContainsChildren" (ngModelChange)="getAllOrganization()">包含子节点</label>
</div>
<div class="treebox">
<nz-tree [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes" [nzExpandedKeys]="defaultExpandedKeys"
[nzSelectedKeys]='nzSelectedKeys' (nzClick)="nzClick($event)" [nzExpandedIcon]="multiExpandedIconTpl"
[nzHideUnMatched]="true" [nzTreeTemplate]="nzTreeTemplate">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="nodebox">
<span class="name">{{ node.title }}</span>
<span class="name">({{node.origin.products? node.origin.products.usersCount : 0}})</span>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.children.length == 0; else elseTemplate">
</ng-container>
<ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'" class="ant-tree-switcher-line-icon"></i>
</ng-template>
</ng-template>
</div>
</div> -->
<div class="box">
<div class="topbox">
<div class="lefttop">
<span>中台用户列表</span>
<span><i nz-icon nzType="search"></i> {{listConfig.totalCount}}名用户</span>
</div>
<div class="righttop">
<label class="isBinding" nz-checkbox [(ngModel)]="listConfig.IsBindingLocal" (ngModelChange)="submitForm()">是否绑定本地用户</label>
<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入用户名" formControlName="search" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form>
</div>
</div>
<div class="tablebox" #tablebox>
<nz-table #basicTable [nzLoading]="listConfig.loading" [nzData]="listConfig.usersLIst" [nzShowPagination]='false'
[nzPageSize]='16'>
<thead>
<tr>
<th [width]="'5%'"></th>
<th>账号</th>
<th>账号id</th>
<th>绑定的本地用户id</th>
<th [width]="'8%'">备注</th>
<th [width]="'10%'">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td><img src="../../../assets/images/user.png" alt=""></td>
<td>{{ data.loginName }}</td>
<td>{{ data.userId }}</td>
<td>
{{data.localUserId}}
</td>
<td>
{{data.detail}}
</td>
<td class="operation">
<span class="blueColor" (click)="binding(data)">绑定本地用户</span>
</td>
</tr>
</tbody>
</nz-table>
</div>
<div class="pagination">
<nz-pagination [nzHideOnSinglePage]="false" [nzPageIndex]="1" [nzTotal]="listConfig.totalCount" [nzPageSize]="16"
[nzShowTotal]="totalTemplate" nzShowQuickJumper (nzPageIndexChange)="pageChange($event)">
</nz-pagination>
<ng-template #totalTemplate let-total> 16条/页,共{{listConfig.totalCount}}条 </ng-template>
</div>
</div>
</div>

173
src/app/system-management/user-binding/user-binding.component.scss

@ -1,173 +0,0 @@
.userBox {
width: 100%;
height: 100%;
background: #ffffff;
box-sizing: border-box;
padding: 20px;
overflow: hidden;
display: flex;
position: relative;
.treebox {
display: flex;
flex: 1;
overflow: auto;
flex-direction: column;
box-sizing: border-box;
padding: 10px 0;
}
.check {
width: 100%;
float: right;
}
.topbox2 {
width: 100%;
height: 36px;
display: flex;
align-items: center;
margin-top: 20px;
.lefttop {
height: 36px;
line-height: 36px;
color: #000;
margin-right: 10px;
font-size: 15px;
}
.righttop {
flex: 1;
height: 36px;
display: flex;
nz-input-group {
height: 36px;
}
}
}
.orbox {
width: 260px;
min-width: 250px;
overflow-y: auto;
margin-right: 10px;
display: flex;
flex-direction: column;
}
.treeTitle {
width: 100%;
height: 55px;
line-height: 55px;
margin-top: 12px;
display: flex;
justify-content: space-between;
color: #000d21;
box-sizing: border-box;
padding: 0 10px;
background: rgba(145, 204, 255, 0.2);
border: 1px solid rgba(145, 204, 255, 0.2);
span {
font-size: 14px;
}
div {
flex: 1;
width: 100px;
margin-left: 55px;
}
}
.nodebox {
display: flex;
justify-content: space-between;
}
tbody {
tr {
td:nth-child(1) {
text-align: right;
}
}
.operation {
i {
cursor: pointer;
margin-right: 8px;
}
}
}
}
.box {
flex: 1;
// overflow: auto;
padding-top: 20px;
overflow-y: auto;
display: flex;
flex-direction: column;
height: 100%;
}
.topbox {
width: 100%;
height: 36px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
.lefttop {
span:nth-child(1) {
color: #000d21;
margin-right: 16px;
}
span:nth-child(2) {
color: rgba(36, 36, 36, 0.24);
}
}
.righttop {
display: flex;
// align-items: center;
.isBinding {
margin-top: 6px;
}
button {
margin-left: 16px;
}
nz-input-group {
height: 32px;
}
}
}
.tablebox {
flex: 1;
overflow-y: auto;
overflow: auto;
}
.pagination {
margin: 15px 0;
display: flex;
align-items: center;
justify-content: center;
}
.ortype {
width: 36px;
height: 20px;
background: #2399ff;
opacity: 1;
border-radius: 2px;
font-size: 12px;
margin-right: 8px;
color: #fff;
text-align: center;
}

106
src/app/system-management/user-binding/user-binding.component.ts

@ -1,106 +0,0 @@
import {
Component,
OnInit,
TemplateRef,
ViewChild,
ViewContainerRef,
} from "@angular/core";
import { FormBuilder, FormGroup } from "@angular/forms";
import { NzFormatEmitEvent } from "ng-zorro-antd/tree";
import { NzModalService } from "ng-zorro-antd/modal";
import { NzMessageService } from "ng-zorro-antd/message";
import { HttpClient } from "@angular/common/http";
import { TreeService } from "src/app/service/tree.service";
import { NzNotificationService } from "ng-zorro-antd/notification";
import { BindingComponent } from "./binding/binding.component";
@Component({
selector: "app-user-binding",
templateUrl: "./user-binding.component.html",
styleUrls: ["./user-binding.component.scss"],
})
export class UserBindingComponent implements OnInit {
validateForm!: FormGroup;
constructor(
private fb: FormBuilder,
private http: HttpClient,
private toTree: TreeService,
private modal: NzModalService,
private viewContainerRef: ViewContainerRef
) {}
ngOnInit(): void {
this.validateForm = this.fb.group({
search: [null],
});
this.getAllUsers();
// this.getAllOrganization();
}
listConfig = {
loading: false,
usersLIst: [],
totalCount: 0,
IsContainsChildren: true,
searchValue: "",
OrganizationUnitId: "",
IsBindingLocal: true,
};
getAllUsers() {
this.listConfig.loading = true;
let params = {
Keyword: this.validateForm.value.search
? this.validateForm.value.search
: "",
SkipCount: String(this.SkipCount),
MaxResultCount: String(this.MaxResultCount),
// OrganizationUnitId: this.OrganizationUnitId,
IsBindingLocal: this.listConfig.IsBindingLocal,
// IsActive:true,
// IsContainsChildren: String(this.listConfig.IsContainsChildren),
};
this.http
.get(this.getAllUrl, {
params: params,
})
.subscribe((data: any) => {
console.log("中台用户列表", data);
this.listConfig.usersLIst = data.result.items;
this.listConfig.totalCount = data.result.totalCount;
this.listConfig.loading = false;
});
}
SkipCount: number = 0; //0 16 32 48
MaxResultCount: number = 16;
pageChange($event) {
this.SkipCount = ($event - 1) * this.MaxResultCount;
this.getAllUsers();
}
getAllUrl = "/api/services/app/User/GetSinochemUsers";
//搜索框提交
submitForm(): void {
for (const i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
this.getAllUsers();
}
binding(data) {
const modal = this.modal.create({
nzTitle: "绑定本地用户",
nzContent: BindingComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 1500,
nzFooter: null,
nzMaskClosable: false,
nzComponentParams: {
data: JSON.parse(JSON.stringify(data)),
},
});
const instance = modal.getContentComponent();
modal.afterClose.subscribe((result) => this.getAllUsers());
}
}

112
src/app/system-management/user/adduser/adduser.component.ts

@ -1,23 +1,19 @@
import { Component, OnInit, Input } from "@angular/core"; import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from "ng-zorro-antd/modal"; import { NzModalRef } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from "@angular/common/http"; import { HttpClient } from '@angular/common/http';
import { TreeService } from "src/app/service/tree.service"; import { TreeService } from 'src/app/service/tree.service';
@Component({ @Component({
selector: "app-adduser", selector: 'app-adduser',
templateUrl: "./adduser.component.html", templateUrl: './adduser.component.html',
styleUrls: ["./adduser.component.scss"], styleUrls: ['./adduser.component.scss']
}) })
export class AdduserComponent implements OnInit { export class AdduserComponent implements OnInit {
@Input() title?: string; @Input() title?: string;
@Input() subtitle?: string; @Input() subtitle?: string;
validateForm!: FormGroup; validateForm!: FormGroup;
constructor( constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { }
private modal: NzModalRef,
private fb: FormBuilder,
private http: HttpClient,
private toTree: TreeService
) {}
ngOnInit(): void { ngOnInit(): void {
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
@ -27,15 +23,15 @@ export class AdduserComponent implements OnInit {
role: [[], [Validators.required]], role: [[], [Validators.required]],
role2: [[]], role2: [[]],
phonenum: [null, [Validators.required]], phonenum: [null, [Validators.required]],
note: [null], note:[null]
}); });
this.getAllRoles(); this.getAllRoles()
this.getAllRoles2(); this.getAllRoles2()
this.getAllOrganization(); this.getAllOrganization()
} }
destroyModal(): void { destroyModal(): void {
this.modal.destroy({ data: "this the result data" }); this.modal.destroy({ data: 'this the result data' });
} }
listOfData: any[] = []; listOfData: any[] = [];
@ -43,67 +39,49 @@ export class AdduserComponent implements OnInit {
//获取角色列表 //获取角色列表
getAllRoles() { getAllRoles() {
let params = { let params = {
SkipCount: "0", SkipCount: '0',
MaxResultCount: "999", MaxResultCount: '999'
}; }
this.http this.http.get('/api/services/app/Role/GetAll', {
.get("/api/services/app/Role/GetAll", { params: params
params: params, }).subscribe((data: any) => {
})
.subscribe((data: any) => {
// console.log('角色列表', data.result.items) // console.log('角色列表', data.result.items)
this.listOfData = data.result.items; this.listOfData = data.result.items
}); })
} }
//获取角色列表 //获取角色列表
getAllRoles2() { getAllRoles2() {
let params = { let params = {
SkipCount: "0", SkipCount: '0',
MaxResultCount: "999", MaxResultCount: '999',
IsViolationRoles: "true", IsViolationRoles:'true'
}; }
this.http this.http.get('/api/services/app/Role/GetAll', {
.get("/api/services/app/Role/GetAll", { params: params
params: params, }).subscribe((data: any) => {
})
.subscribe((data: any) => {
// console.log('角色列表', data.result.items) // console.log('角色列表', data.result.items)
this.listOfData2 = data.result.items; this.listOfData2 = data.result.items
}); })
} }
//获取所有组织机构 //获取所有组织机构
nodes: any = []; nodes: any = []
getAllOrganization() { getAllOrganization() {
let userData = null; let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id
if (sessionStorage.getItem("isGasStation") == "true") {
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
} else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
let params = { let params = {
IsContainsChildren: "true", OrganizationUnitId: OrganizationUnitId,
}; IsContainsChildren: "true"
this.http
.get("/api/services/app/Organization/GetAll", {
params: params,
})
.subscribe((data: any) => {
data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
} }
} else { this.http.get('/api/services/app/Organization/GetAll', {
params: params
}).subscribe((data: any) => {
data.result.items.forEach(element => {
if (element.id == OrganizationUnitId) { if (element.id == OrganizationUnitId) {
element.parentId = null; element.parentId = null
} }
} element.key = element.id
element.key = element.id; element.title = element.displayName
element.title = element.displayName;
});
this.nodes = [...this.toTree.toTree(data.result.items)];
}); });
this.nodes = [...this.toTree.toTree(data.result.items)]
})
} }
} }

264
src/app/system-management/user/edituser/edituser.component.ts

@ -1,40 +1,34 @@
import { Component, OnInit, Input } from "@angular/core"; import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from "ng-zorro-antd/modal"; import { NzModalRef } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from "@angular/common/http"; import { HttpClient } from '@angular/common/http';
import { TreeService } from "src/app/service/tree.service"; import { TreeService } from 'src/app/service/tree.service';
import { NzMessageService } from "ng-zorro-antd/message"; import { NzMessageService } from 'ng-zorro-antd/message';
@Component({ @Component({
selector: "app-edituser", selector: 'app-edituser',
templateUrl: "./edituser.component.html", templateUrl: './edituser.component.html',
styleUrls: ["./edituser.component.scss"], styleUrls: ['./edituser.component.scss']
}) })
export class EdituserComponent implements OnInit { export class EdituserComponent implements OnInit {
@Input() data?: any; @Input() data?: any;
@Input() listOfData?: any; @Input() listOfData?: any;
@Input() listOfData2?: any; @Input() listOfData2?: any;
@Input() nodes?: any; @Input() nodes?: any;
@Input() editUrl?: any; @Input() editUrl?: any;
validateForm!: FormGroup; validateForm!: FormGroup;
constructor( constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private message: NzMessageService) { }
private modal: NzModalRef,
private fb: FormBuilder,
private http: HttpClient,
private toTree: TreeService,
private message: NzMessageService
) {}
isAdmin: boolean;
ngOnInit(): void { ngOnInit(): void {
console.log(this.data); console.log(this.data)
let roleData1 = []; let roleData1 = []
let roleData2 = []; let roleData2 = []
this.data.roleNames.forEach((element) => { this.data.roleNames.forEach(element => {
if (element.indexOf("LEVEL") != -1) { if (element.indexOf('LEVEL') != -1) {
roleData2.push(element); roleData2.push(element)
} else { } else {
roleData1.push(element); roleData1.push(element)
} }
}); });
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
@ -44,158 +38,116 @@ export class EdituserComponent implements OnInit {
role: [roleData1, [Validators.required]], role: [roleData1, [Validators.required]],
role2: [roleData2], role2: [roleData2],
phonenum: [null, [Validators.required]], phonenum: [null, [Validators.required]],
note: [null], note: [null]
}); });
let userdata = JSON.parse(sessionStorage.getItem("userdata"));
if (userdata.userName == "admin" || userdata.userName == "superadmin") {
//是superadmin,是内部制作账号
this.isAdmin = true;
} else {
this.isAdmin = false;
this.validateForm.get("account").disable();
this.validateForm.get("name").disable();
this.validateForm.get("organization").disable();
this.validateForm.get("phonenum").disable();
}
if (this.listOfData.length == 0) { if (this.listOfData.length == 0) {
this.getAllRoles(); this.getAllRoles()
} }
if (this.listOfData2.length == 0) { if (this.listOfData2.length == 0) {
this.getAllRoles2(); this.getAllRoles2()
} }
if (this.nodes.length == 0) { if (this.nodes.length == 0) {
this.getAllOrganization(); this.getAllOrganization()
} }
} }
destroyModal(): void { destroyModal(): void {
this.modal.destroy({ data: "this the result data" }); this.modal.destroy({ data: 'this the result data' });
} }
//获取角色列表 //获取角色列表
async getAllRoles() { async getAllRoles() {
let params = { let params = {
SkipCount: "0", SkipCount: '0',
MaxResultCount: "999", MaxResultCount: '999'
}; }
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
this.http this.http.get('/api/services/app/Role/GetAll', {
.get("/api/services/app/Role/GetAll", { params: params
params: params, }).subscribe((data: any) => {
resolve(data)
this.listOfData = data.result.items
})
}) })
.subscribe((data: any) => {
resolve(data);
this.listOfData = data.result.items;
});
});
} }
//获取角色列表 //获取角色列表
async getAllRoles2() { async getAllRoles2() {
let params = { let params = {
SkipCount: "0", SkipCount: '0',
MaxResultCount: "999", MaxResultCount: '999',
IsViolationRoles: "true", IsViolationRoles: 'true'
}; }
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
this.http this.http.get('/api/services/app/Role/GetAll', {
.get("/api/services/app/Role/GetAll", { params: params
params: params, }).subscribe((data: any) => {
resolve(data)
this.listOfData2 = data.result.items
})
}) })
.subscribe((data: any) => {
resolve(data);
this.listOfData2 = data.result.items;
});
});
} }
//获取所有组织机构 //获取所有组织机构
async getAllOrganization() { async getAllOrganization() {
let userData = null; let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id
if (sessionStorage.getItem("isGasStation") == "true") {
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
} else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
let params = { let params = {
IsContainsChildren: "true", OrganizationUnitId: OrganizationUnitId,
}; IsContainsChildren: "true"
await new Promise<void>((resolve, reject) => {
this.http
.get("/api/services/app/Organization/GetAll", {
params: params,
})
.subscribe((data: any) => {
data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
} }
} else { await new Promise<void>((resolve, reject) => {
this.http.get('/api/services/app/Organization/GetAll', {
params: params
}).subscribe((data: any) => {
data.result.items.forEach(element => {
if (element.id == OrganizationUnitId) { if (element.id == OrganizationUnitId) {
element.parentId = null; element.parentId = null
}
} }
element.key = element.id; element.key = element.id
element.title = element.displayName; element.title = element.displayName
});
this.nodes = [...this.toTree.toTree(data.result.items)];
resolve(data);
});
}); });
this.nodes = [...this.toTree.toTree(data.result.items)]
resolve(data)
})
})
} }
isLoading = false; isLoading = false
//确定 //确定
async ok() { async ok() {
// console.log(this.validateForm); this.isLoading = true
// return;
this.isLoading = true;
if (this.validateForm.valid) { if (this.validateForm.valid) {
return await new Promise((resolve) => { return await new Promise(resolve => {
for ( for (let index = 0; index < this.validateForm.value.role2.length; index++) {
let index = 0;
index < this.validateForm.value.role2.length;
index++
) {
const element = this.validateForm.value.role2[index]; const element = this.validateForm.value.role2[index];
if (element.indexOf("HANDLE") != -1) { if (element.indexOf('HANDLE') != -1) {
this.validateForm.value.role2.splice(index, 1); this.validateForm.value.role2.splice(index, 1)
index--; index--
} }
} }
let roleNames = [ let roleNames = [...this.validateForm.value.role, ...this.validateForm.value.role2]
...this.validateForm.value.role,
...this.validateForm.value.role2,
];
let body = { let body = {
id: this.data.id, id: this.data.id,
userName: this.validateForm.controls.account.value, userName: this.validateForm.value.account,
name: this.validateForm.controls.name.value, name: this.validateForm.value.name,
organizationUnitId: this.validateForm.controls.organization.value, organizationUnitId: this.validateForm.value.organization,
roleNames: roleNames, roleNames: roleNames,
phoneNumber: this.validateForm.controls.phonenum.value, phoneNumber: this.validateForm.value.phonenum,
note: this.validateForm.controls.note.value, note:this.validateForm.value.note,
isActive: true, isActive: true
}; }
this.http.put(this.editUrl, body).subscribe( this.http.put(this.editUrl, body).subscribe((data:any) => {
(data: any) => { resolve(data)
resolve(data); this.data.auditStatus = data.result.auditStatus
this.data.auditStatus = data.result.auditStatus; this.isLoading = false
this.isLoading = false; this.message.create('success', '保存成功!');
this.message.create("success", "保存成功!"); }, err => {
}, resolve(err)
(err) => { this.isLoading = false
resolve(err); this.message.create('warning', '保存失败');
this.isLoading = false; })
this.message.create("warning", "保存失败"); })
}
);
});
} else { } else {
this.message.create("warning", "请填写完整!"); this.message.create('warning', '请填写完整!');
} }
} }
//取消 //取消
@ -204,38 +156,28 @@ export class EdituserComponent implements OnInit {
} }
//提交审核 //提交审核
async audit(type) { async audit(type) {
if (type && this.data.auditStatus == 5) { if (type && this.data.auditStatus == 5) {//提交审核
//提交审核 this.message.create('warning', '审核完成的不能重复提交,请编辑后提交');
this.message.create("warning", "审核完成的不能重复提交,请编辑后提交"); return
return;
} }
if(type){ if(type){
await this.ok(); await this.ok()
} }
this.isLoading = true; this.isLoading = true
let url; let url
type type ? url = '/api/services/app/EdittingUser/Commit' : url = '/api/services/app/EdittingUser/Uncommit'
? (url = "/api/services/app/EdittingUser/Commit") this.http.post(url, '', {
: (url = "/api/services/app/EdittingUser/Uncommit");
this.http
.post(url, "", {
params: { params: {
id: this.data.id, id: this.data.id
}, }
}).subscribe((data: any) => {
this.data.auditStatus = data.result.auditStatus
this.isLoading = false
this.message.create('success', type ? '提交审核成功' : '撤销审核成功');
}, err => {
this.isLoading = false
this.message.create('error', type ? '提交审核失败' : '撤销审核失败');
}) })
.subscribe(
(data: any) => {
this.data.auditStatus = data.result.auditStatus;
this.isLoading = false;
this.message.create(
"success",
type ? "提交审核成功" : "撤销审核成功"
);
},
(err) => {
this.isLoading = false;
this.message.create("error", type ? "提交审核失败" : "撤销审核失败");
}
);
} }
} }

16
src/app/system-management/user/user.component.html

@ -82,11 +82,11 @@
<button style="display: none;" type="submit"></button> <button style="display: none;" type="submit"></button>
</nz-form-item> </nz-form-item>
</form> </form>
<button *ngIf="isAdmin" nz-button nzType="primary" (click)="addUser()"><i nz-icon nzType="plus-circle" <button nz-button nzType="primary" (click)="addUser()"><i nz-icon nzType="plus-circle"
nzTheme="outline"></i>新增</button> nzTheme="outline"></i>新增</button>
</div> </div>
</div> </div>
<div class="tablebox" #tablebox> <div class="tablebox">
<nz-table #basicTable [nzLoading]="loading" [nzData]="usersLIst" [nzShowPagination]='false' [nzPageSize]='16'> <nz-table #basicTable [nzLoading]="loading" [nzData]="usersLIst" [nzShowPagination]='false' [nzPageSize]='16'>
<thead> <thead>
<tr> <tr>
@ -129,7 +129,7 @@
<td class="operation"> <td class="operation">
<i class="blueColor" nz-icon nzType="form" nzTheme="outline" (click)="editUser(data)" nz-tooltip <i class="blueColor" nz-icon nzType="form" nzTheme="outline" (click)="editUser(data)" nz-tooltip
nzTooltipTitle="编辑"></i> nzTooltipTitle="编辑"></i>
<i *ngIf="isAdmin" nz-icon nz-tooltip nzTooltipTitle="重置密码" (click)="resetPassword(data)"> <i nz-icon nz-tooltip nzTooltipTitle="重置密码" (click)="resetPassword(data)">
<svg width="14" height="14"> <svg width="14" height="14">
<path <path
d="M766.598 75.624c-112.55-65.312-250.07-87.553-385.693-51.212C110.437 96.883-50.07 374.89 22.4 645.357c72.472 270.468 350.479 430.975 620.946 358.504 270.467-72.472 430.975-350.479 358.503-620.946-0.211-0.789-0.424-1.577-0.639-2.363h-62.505a454.786 454.786 0 0 1 5.189 17.892c63.895 238.46-77.618 483.566-316.077 547.461-238.46 63.895-483.566-77.617-547.461-316.077-63.895-238.46 77.617-483.566 316.077-547.46 119.62-32.053 240.912-12.416 340.164 45.217l-42.383 73.409 217.66-6.997L809.104 2l-42.507 73.624z" d="M766.598 75.624c-112.55-65.312-250.07-87.553-385.693-51.212C110.437 96.883-50.07 374.89 22.4 645.357c72.472 270.468 350.479 430.975 620.946 358.504 270.467-72.472 430.975-350.479 358.503-620.946-0.211-0.789-0.424-1.577-0.639-2.363h-62.505a454.786 454.786 0 0 1 5.189 17.892c63.895 238.46-77.618 483.566-316.077 547.461-238.46 63.895-483.566-77.617-547.461-316.077-63.895-238.46 77.617-483.566 316.077-547.46 119.62-32.053 240.912-12.416 340.164 45.217l-42.383 73.409 217.66-6.997L809.104 2l-42.507 73.624z"
@ -139,12 +139,12 @@
fill="#36A2FF" p-id="2328"></path> fill="#36A2FF" p-id="2328"></path>
</svg> </svg>
</i> </i>
<i *ngIf="!data.isActive && isAdmin" class="greenColor2" nz-icon nzType="stop" nzTheme="outline" <i *ngIf="!data.isActive" class="greenColor2" nz-icon nzType="stop" nzTheme="outline" nz-tooltip
nz-tooltip nzTooltipTitle="启用" (click)="cancel(data,true)"></i> nzTooltipTitle="启用" (click)="cancel(data,true)"></i>
<i *ngIf="data.isActive && isAdmin" class="redColor" nz-icon nzType="stop" nzTheme="outline" nz-tooltip <i *ngIf="data.isActive" class="redColor" nz-icon nzType="stop" nzTheme="outline" nz-tooltip
nzTooltipTitle="停用" (click)="cancel(data,false)"></i> nzTooltipTitle="停用" (click)="cancel(data,false)"></i>
<i *ngIf="isAdmin" class="redColor" nz-icon nzType="poweroff" nzTheme="outline" nz-tooltip <i class="redColor" nz-icon nzType="poweroff" nzTheme="outline" nz-tooltip nzTooltipTitle="注销"
nzTooltipTitle="注销" (click)="delete(data)"></i> (click)="delete(data)"></i>
</td> </td>
</tr> </tr>
</tbody> </tbody>

34
src/app/system-management/user/user.component.ts

@ -46,16 +46,7 @@ export class UserComponent implements OnInit {
editUrl; editUrl;
deleteUrl; deleteUrl;
CountsByOrganizations; CountsByOrganizations;
isAdmin: boolean;
ngOnInit(): void { ngOnInit(): void {
let userdata = JSON.parse(sessionStorage.getItem("userdata"));
if (userdata.userName == "admin" || userdata.userName == "superadmin") {
//是superadmin,是内部制作账号
this.isAdmin = true;
} else {
this.isAdmin = false;
}
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
search: [null], search: [null],
}); });
@ -161,7 +152,13 @@ export class UserComponent implements OnInit {
nodes: any = []; nodes: any = [];
organization; organization;
async getAllOrganization() { async getAllOrganization() {
let OrganizationUnitId =
sessionStorage.getItem("isGasStation") == "true"
? JSON.parse(sessionStorage.getItem("userdataOfgasstation"))
.organization.id
: JSON.parse(sessionStorage.getItem("userdata")).organization.id;
let params = { let params = {
OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true", IsContainsChildren: "true",
}; };
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
@ -178,14 +175,11 @@ export class UserComponent implements OnInit {
}); });
} }
async getuser(e) { async getuser(e) {
let userData = null; let OrganizationUnitId =
if (sessionStorage.getItem("isGasStation") == "true") { sessionStorage.getItem("isGasStation") == "true"
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation")); ? JSON.parse(sessionStorage.getItem("userdataOfgasstation"))
} else { .organization.id
userData = JSON.parse(sessionStorage.getItem("userdata")); : JSON.parse(sessionStorage.getItem("userdata")).organization.id;
}
let OrganizationUnitId = userData.organization.id;
let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
let params = { let params = {
OrganizationUnitId: OrganizationUnitId, OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true", IsContainsChildren: "true",
@ -210,15 +204,9 @@ export class UserComponent implements OnInit {
}); });
for (let index = 0; index < arrs.length; index++) { for (let index = 0; index < arrs.length; index++) {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(arrs[index].id)) {
arrs[index].parentId = null;
}
} else {
if (arrs[index].id == OrganizationUnitId) { if (arrs[index].id == OrganizationUnitId) {
arrs[index].parentId = null; arrs[index].parentId = null;
} }
}
arrs[index].title = arrs[index].displayName; arrs[index].title = arrs[index].displayName;
arrs[index].key = arrs[index].id; arrs[index].key = arrs[index].id;
} }

BIN
src/assets/gismap/cardbg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
src/assets/gismap/cardtitle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
src/assets/gismap/gis/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

BIN
src/assets/gismap/gis/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

BIN
src/assets/gismap/gis/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

BIN
src/assets/gismap/gis/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

BIN
src/assets/gismap/gis/marker.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/assets/gismap/icon/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
src/assets/gismap/icon/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
src/assets/gismap/icon/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
src/assets/gismap/icon/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
src/assets/gismap/listtitle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
src/assets/sound/chouyan.mp3

Binary file not shown.

BIN
src/assets/sound/chuangru.mp3

Binary file not shown.

BIN
src/assets/sound/dadianhua.mp3

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save