Compare commits

...

35 Commits

Author SHA1 Message Date
邵佳豪 35d3a8a67c [完善]证照资质预警过滤 1 month ago
邵佳豪 a6888a1b63 [完善]中台登录错误参数下载 4 months ago
邵佳豪 e3a63bdab9 [完善]预警处置后赋值处置人 5 months ago
邵佳豪 bc21575204 [新增]机构更改父组织 5 months ago
邵佳豪 2dd4ac1ff2 [完善]中台登录用户隐藏右上角按钮 5 months ago
邵佳豪 9df04beb8b [完善]综合统计页面 5 months ago
邵佳豪 e6969318e9 [完善]综合统计顶部菜单显示 5 months ago
邵佳豪 6d868d46d8 [完善]综合统计页面 5 months ago
邵佳豪 647cac21c2 [新增]综合统计 5 months ago
邵佳豪 8d0f3c1ed1 [完善]新增页面 6 months ago
邵佳豪 9070556c7c [新增]打包配置 6 months ago
邵佳豪 eca559d138 [完善]中台油站用户登录完善 6 months ago
邵佳豪 d5dd9ec2b5 [新增]识别类型 6 months ago
邵佳豪 15340ce75e [修改]预警声音修改 6 months ago
邵佳豪 9321f29ad1 [新增]resId增加 7 months ago
邵佳豪 697f701d5f [新增]多组织机构获取 7 months ago
邵佳豪 9747d866ea [完善]选择用户按钮 7 months ago
邵佳豪 0779b377a4 [新增]中台组织机构绑定 7 months ago
邵佳豪 c2237a44d6 [完善]中台对接 7 months ago
邵佳豪 ebc4346ef0 [完善]中台筛选条件 7 months ago
邵佳豪 82a47e7b52 [新增]中台用户绑定 7 months ago
邵佳豪 7500b9da8f [完善]反向代理 7 months ago
邵佳豪 462733e9ca [完善]%3D处理 7 months ago
邵佳豪 a599173713 [新增]中台跳转 7 months ago
邵佳豪 3734779800 [新增]中台对接 7 months ago
邵佳豪 4a41bfafc0 [新增]中台登录配合修改 7 months ago
邵佳豪 3bfc6a47cb [新增]延长壳牌工装 8 months ago
邵佳豪 eef70064e8 [完善]更新时间 9 months ago
邵佳豪 9ca4e6a7d8 [完善]更新预警播报声音 10 months ago
邵佳豪 cfb5c9c13a [完善]修改默认密码弹出逻辑+发送短信按钮bug 12 months ago
邵佳豪 065b41de17 [新增]预警图片查看大图 1 year ago
邵佳豪 1722ad6151 [完善]新增预警类型 1 year ago
邵佳豪 59df72222f [新增]判断是否singleSignOn决定查询日期区间 1 year ago
邵佳豪 f8cebca2c8 [新增]免登录设置 1 year ago
邵佳豪 b7a1357c9b [完善]密码最小长度12位 1 year ago
  1. 11
      angular.json
  2. 16787
      package-lock.json
  3. 10
      proxy.config.json
  4. 63
      src/app/app-routing.module.ts
  5. 2
      src/app/app.component.ts
  6. 107
      src/app/auth.guard.ts
  7. 102
      src/app/http-interceptors/base-interceptor.ts
  8. 14
      src/app/pages/audit/audit-ing/audit-ing.component.ts
  9. 494
      src/app/pages/audit/audit-record/audit-record.component.ts
  10. 4
      src/app/pages/change-password/change-password.component.ts
  11. 328
      src/app/pages/home-page-comprehensive/home-page-comprehensive.component.html
  12. 578
      src/app/pages/home-page-comprehensive/home-page-comprehensive.component.scss
  13. 1786
      src/app/pages/home-page-comprehensive/home-page-comprehensive.component.ts
  14. 10
      src/app/pages/home-page/home-page.component.html
  15. 14
      src/app/pages/home-page/home-page.component.ts
  16. 66
      src/app/pages/home/home.component.html
  17. 50
      src/app/pages/home/home.component.scss
  18. 215
      src/app/pages/home/home.component.ts
  19. 205
      src/app/pages/login/forget/forget.component.ts
  20. 45
      src/app/pages/login/login.component.html
  21. 453
      src/app/pages/login/login.component.ts
  22. 517
      src/app/pages/oil-station-info/oil-station-info.component.ts
  23. 10
      src/app/pages/oil-unloading-process/anxin-img-look/anxin-img-look.component.ts
  24. 109
      src/app/pages/pages-routing.module.ts
  25. 4
      src/app/pages/pages.module.ts
  26. 14
      src/app/pages/plan-admin/file-license-list/file-license-list.component.ts
  27. 226
      src/app/pages/plan-admin/plan-admin.component.ts
  28. 17
      src/app/pages/plan-admin/update-license-list/update-license-list.component.ts
  29. 1241
      src/app/pages/records/criminal-records-admin/criminal-records-admin.component.ts
  30. 1140
      src/app/pages/records/criminal-records/criminal-records.component.ts
  31. 39
      src/app/pages/records/oil-unloading-process-list/oil-unloading-process-list.component.ts
  32. 109
      src/app/pages/records/records-nav/records-nav.component.ts
  33. 1013
      src/app/pages/records/warning-statistics-list/warning-statistics-list.component.ts
  34. 0
      src/app/pages/singlelogin/singlelogin.component.html
  35. 0
      src/app/pages/singlelogin/singlelogin.component.scss
  36. 405
      src/app/pages/singlelogin/singlelogin.component.ts
  37. 585
      src/app/pages/today-warning-admin/today-warning-admin.component.ts
  38. 9
      src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html
  39. 52
      src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts
  40. 7
      src/app/pages/today-warning/today-warning.component.ts
  41. 9
      src/app/service/pattern.service.ts
  42. 7
      src/app/service/tree.service.ts
  43. 21
      src/app/system-management/algorithm-config/algorithm-config.component.ts
  44. 384
      src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts
  45. 2
      src/app/system-management/navigation/navigation.component.html
  46. 2
      src/app/system-management/navigation/navigation.component.scss
  47. 16
      src/app/system-management/navigation/navigation.component.ts
  48. 35
      src/app/system-management/or-binding/or-binding-model/or-binding-model.component.html
  49. 76
      src/app/system-management/or-binding/or-binding-model/or-binding-model.component.scss
  50. 128
      src/app/system-management/or-binding/or-binding-model/or-binding-model.component.ts
  51. 56
      src/app/system-management/or-binding/or-binding.component.html
  52. 168
      src/app/system-management/or-binding/or-binding.component.scss
  53. 156
      src/app/system-management/or-binding/or-binding.component.ts
  54. 4
      src/app/system-management/organization/change-or/change-or.component.html
  55. 5
      src/app/system-management/organization/change-or/change-or.component.scss
  56. 55
      src/app/system-management/organization/change-or/change-or.component.ts
  57. 9
      src/app/system-management/organization/organization.component.html
  58. 84
      src/app/system-management/organization/organization.component.ts
  59. 4
      src/app/system-management/system-management-routing.module.ts
  60. 15
      src/app/system-management/system-management.module.ts
  61. 113
      src/app/system-management/user-binding/binding/binding.component.html
  62. 223
      src/app/system-management/user-binding/binding/binding.component.scss
  63. 208
      src/app/system-management/user-binding/binding/binding.component.ts
  64. 101
      src/app/system-management/user-binding/user-binding.component.html
  65. 173
      src/app/system-management/user-binding/user-binding.component.scss
  66. 106
      src/app/system-management/user-binding/user-binding.component.ts
  67. 122
      src/app/system-management/user/adduser/adduser.component.ts
  68. 276
      src/app/system-management/user/edituser/edituser.component.ts
  69. 16
      src/app/system-management/user/user.component.html
  70. 38
      src/app/system-management/user/user.component.ts
  71. BIN
      src/assets/sound/chouyan.mp3
  72. BIN
      src/assets/sound/chuangru.mp3
  73. BIN
      src/assets/sound/dadianhua.mp3
  74. BIN
      src/assets/sound/gongzhuang.mp3
  75. BIN
      src/assets/sound/jinchukou.mp3
  76. BIN
      src/assets/sound/minghuo.mp3
  77. BIN
      src/assets/sound/xychaichuxyguan.mp3
  78. BIN
      src/assets/sound/xygeli.mp3
  79. BIN
      src/assets/sound/xyjianxie.mp3
  80. BIN
      src/assets/sound/xyjiedi.mp3
  81. BIN
      src/assets/sound/xymiehuoqi.mp3
  82. BIN
      src/assets/sound/xywuren.mp3
  83. BIN
      src/assets/sound/xyxianchang.mp3
  84. BIN
      src/assets/sound/xyxieyouguan.mp3
  85. BIN
      src/assets/sound/yanwu.mp3
  86. 63
      src/styles.scss
  87. 18
      src/theme.less

11
angular.json

@ -18,6 +18,7 @@
"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",
@ -130,9 +131,7 @@
"output": "/assets/abp" "output": "/assets/abp"
} }
], ],
"styles": [ "styles": ["src/styles.scss"],
"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"
@ -147,9 +146,7 @@
"tsconfig.spec.json", "tsconfig.spec.json",
"e2e/tsconfig.json" "e2e/tsconfig.json"
], ],
"exclude": [ "exclude": ["**/node_modules/**"]
"**/node_modules/**"
]
} }
}, },
"e2e": { "e2e": {
@ -171,4 +168,4 @@
"cli": { "cli": {
"analytics": false "analytics": false
} }
} }

16787
package-lock.json generated

File diff suppressed because it is too large Load Diff

10
proxy.config.json

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

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

@ -1,35 +1,52 @@
import { NgModule } from '@angular/core'; import { NgModule } from "@angular/core";
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from "@angular/router";
import { LoginComponent } from './pages/login/login.component'; import { LoginComponent } from "./pages/login/login.component";
import { RegisterComponent } from './pages/register/register.component'; import { RegisterComponent } from "./pages/register/register.component";
//路由守卫 //路由守卫
import { AuthGuard } from './auth.guard' 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";
const routes: Routes = [ const routes: Routes = [
{ path: '', redirectTo: 'login', pathMatch: 'full' }, { path: '', redirectTo: 'singlelogin', pathMatch: 'full' },
{ path: 'login', component: LoginComponent }, //登录页 { path: "singlelogin", component: SingleloginComponent }, //单点登录页
{ path: 'register', component: RegisterComponent }, //注册页 { path: "login", component: LoginComponent }, //登录页
{ path: "register", component: RegisterComponent }, //注册页
// { path: 'homepagenologin', component: HomePageNologinComponent }, //注册页 // { path: 'homepagenologin', component: HomePageNologinComponent }, //注册页
{ {
path: '', component: HomeComponent, canActivate: [AuthGuard], children: [ path: "",
{ path: '', loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule) } component: HomeComponent,
] canActivate: [AuthGuard],
children: [
{
path: "",
loadChildren: () =>
import("./pages/pages.module").then((m) => m.PagesModule),
},
],
}, //首页 }, //首页
{ {
path: '', component: NavigationComponent, canActivate: [AuthGuard], children: [ path: "",
{ path: 'system', loadChildren: () => import('./system-management/system-management.module').then(m => m.SystemManagementModule) } component: NavigationComponent,
] canActivate: [AuthGuard],
}//系统管理 children: [
{
path: "system",
loadChildren: () =>
import("./system-management/system-management.module").then(
(m) => m.SystemManagementModule
),
},
],
}, //系统管理
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' })], imports: [RouterModule.forRoot(routes, { relativeLinkResolution: "legacy" })],
exports: [RouterModule] exports: [RouterModule],
}) })
export class AppRoutingModule { } export class AppRoutingModule {}

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 = 20230807; VERSION = 20240822;
ngOnInit(): void { ngOnInit(): void {
this.sayHello(); this.sayHello();
} }

107
src/app/auth.guard.ts

@ -1,35 +1,100 @@
import { Component, OnInit, Inject } from '@angular/core'; import { HttpClient } from "@angular/common/http";
import { Injectable } from '@angular/core'; import { Component, OnInit, Inject } from "@angular/core";
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router'; import { Injectable } from "@angular/core";
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();
} }
return this.checkLogin();
}
// 路由守卫 checkLogin(): boolean {
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { // 判断本地有没有token
// console.log('路由守卫',next.data) const token = sessionStorage.getItem("token");
// if(next.data.permission == 'xxxx'){
// return true; // 如果有token,允许访问
// } if (token) {
return this.checkLogin(); return true;
} }
checkLogin(): boolean { //如果没有token,跳转登录页
// 判断本地有没有token // this.router.navigate(["/login"]);
const token = sessionStorage.getItem('token');
// 如果有token,允许访问 return false;
if (token) { return true; } }
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();
}
);
});
}
//如果没有token,跳转登录页
this.router.navigate(['/login']);
return false;
}
} }

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

@ -1,24 +1,27 @@
import { Injectable } from '@angular/core'; import { Injectable } from "@angular/core";
import { import {
HttpClient, HttpInterceptor, HttpHandler, HttpRequest, HttpClient,
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) {
@ -33,77 +36,86 @@ 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) return next.handle(newReq).pipe(
.pipe( tap(
tap(event => { (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('token', event.headers.get('x-refresh-token')) sessionStorage.setItem(
sessionStorage.setItem('encryptedAccessToken', event.headers.get('x-refresh-encryptedtoken')) "token",
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')
) })
);
} }
// 捕获错误 // 捕获错误
//401 token过期 403没权限!!! 400参数错误 404未找到 614刷新令牌过期!!! //401 token过期 403没权限!!! 400参数错误 404未找到 614刷新令牌过期!!!
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(['/login']) this.router.navigate(["/singlelogin"]);
} }
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('error', `${error.error.error.details || error.error.error.message}`); this.message.create(
"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}, ` + `Backend returned code ${error.status}, ` + `body was: ${error.error}`
`body was: ${error.error}`); );
} }
// 返回带有面向用户的错误信息 // 返回带有面向用户的错误信息
return throwError( return throwError(error);
error); }
};
} }

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

@ -438,8 +438,10 @@ 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) => {
@ -449,8 +451,14 @@ export class AuditIngComponent implements OnInit {
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items.forEach((element) => { data.result.items.forEach((element) => {
if (element.id == OrganizationUnitId) { if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
element.parentId = null; if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) {
element.parentId = null;
}
} }
element.key = element.id; element.key = element.id;
element.title = element.displayName; element.title = element.displayName;

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

@ -1,42 +1,60 @@
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(private element: ElementRef, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private toTree: TreeService, private http: HttpClient, private fb: FormBuilder) { } constructor(
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 (JSON.parse(sessionStorage.getItem('userdata')).organization.level == 1) { if (
this.level = true JSON.parse(sessionStorage.getItem("userdata")).organization.level == 1
) {
this.level = true;
} }
this.tableScrollHeight = '100px' this.tableScrollHeight = "100px";
// 页面监听 // 页面监听
this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { this.resizeListener = fromEvent(window, "resize")
let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight .pipe(debounceTime(100))
this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 10) + 'px' .subscribe((event) => {
}); 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],
info: [null], info: [null],
@ -50,172 +68,214 @@ 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 = nowY + "-" + (nowM < 10 ? "0" + nowM : nowM) + "-" + (nowD < 10 ? "0" + nowD : nowD);//当前日期 this.enddate =
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 = lastY + "-" + (lastM < 10 ? "0" + lastM : lastM) + "-" + (lastD < 10 ? "0" + lastD : lastD);//三十天之前日期 this.startdate =
lastY +
this.getTypeList() "-" +
await this.getAllOrganization() (lastM < 10 ? "0" + lastM : lastM) +
this.getRecordList() "-" +
(lastD < 10 ? "0" + lastD : lastD); //三十天之前日期
this.getTypeList();
await this.getAllOrganization();
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].toLocaleDateString() this.validateForm.value.datePicker[0] =
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].toLocaleDateString() this.validateForm.value.datePicker[1] =
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.id, organization: JSON.parse(sessionStorage.getItem("userdata")).organization
.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')).organization.id let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata"))
.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) => {
this.http.get('/api/services/app/Organization/GetAll', { this.http
params: params .get("/api/services/app/Organization/GetAll", {
}).subscribe((data: any) => { params: params,
data.result.items.forEach(element => { })
if (element.id == OrganizationUnitId) { .subscribe((data: any) => {
element.parentId = null data.result.items.forEach((element) => {
} if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
element.key = element.id if (OrganizationUnitIds.includes(element.id)) {
element.title = element.displayName element.parentId = null;
}); }
this.nodes = [...this.toTree.toTree(data.result.items)] } else {
this.validateForm.patchValue({ if (element.id == OrganizationUnitId) {
organization: JSON.parse(sessionStorage.getItem('userdata')).organization.id, element.parentId = null;
datePicker: [this.startdate, this.enddate], }
}
element.key = element.id;
element.title = element.displayName;
});
this.nodes = [...this.toTree.toTree(data.result.items)];
this.validateForm.patchValue({
organization: JSON.parse(sessionStorage.getItem("userdata"))
.organization.id,
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 = ['/api/services/app/ValidityLicenseType/GetAll', '/api/services/app/FileLicenseType/GetAll'] let api = [
api.forEach(element => { "/api/services/app/ValidityLicenseType/GetAll",
"/api/services/app/FileLicenseType/GetAll",
];
api.forEach((element) => {
promiseArr.push( promiseArr.push(
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
this.http.get(element, { this.http
params: { .get(element, {
SkipCount: '0', params: {
MaxResultCount: '999' SkipCount: "0",
} MaxResultCount: "999",
}).subscribe({ },
next: (data) => { })
resolve(data) .subscribe({
}, next: (data) => {
error: err => { resolve(data);
reject(err) },
} error: (err) => {
}) reject(err);
},
});
}) })
) );
}); });
Promise.all(promiseArr).then((result) => { Promise.all(promiseArr)
// console.log('审批类型', result) .then((result) => {
this.typeListOfUsers = [{ licenseName: '用户信息' }] // console.log('审批类型', result)
this.typeListOfStationData = [{ licenseName: '油站信息' }] this.typeListOfUsers = [{ licenseName: "用户信息" }];
this.typeListOfUpdate = result[0].result.items this.typeListOfStationData = [{ licenseName: "油站信息" }];
this.typeListOfFile = result[1].result.items this.typeListOfUpdate = result[0].result.items;
this.typeList = [...this.typeListOfUsers, ...this.typeListOfStationData, ...this.typeListOfUpdate, ...this.typeListOfFile] this.typeListOfFile = result[1].result.items;
this.typeLoading = false this.typeList = [
}).catch((error) => { ...this.typeListOfUsers,
...this.typeListOfStationData,
}) ...this.typeListOfUpdate,
...this.typeListOfFile,
];
this.typeLoading = false;
})
.catch((error) => {});
} }
warningTypesDetails warningTypesDetails;
warningTypesDetailsCopy warningTypesDetailsCopy;
//获得所有预警事件 //获得所有预警事件
warningType() { warningType() {
this.http.get('/api/services/app/Violation/GetAllList').subscribe((data: any) => { this.http
.get("/api/services/app/Violation/GetAllList")
data.result = data.result.filter((item) => { .subscribe((data: any) => {
return item.eventSystemName != '设备报废临期提醒' && item.eventSystemName != '设备维保临期提醒' && item.eventSystemName != '证照有效期办理提醒' && item.eventSystemName != '证照有效期临期提醒' && item.eventSystemName != '证照年检办理提醒' && item.eventSystemName != '证照年检临期提醒' data.result = data.result.filter((item) => {
}) return (
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.typeListOfStationData, ...this.typeListOfUpdate, ...this.typeListOfFile] this.typeList = [
...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,
@ -226,119 +286,145 @@ export class AuditRecordComponent implements OnInit {
Sorting: null, Sorting: null,
SkipCount: this.SkipCount, SkipCount: this.SkipCount,
MaxResultCount: this.MaxResultCount, MaxResultCount: this.MaxResultCount,
} };
this.http.get('/api/services/app/ContentAuditLog/GetHistory', { params }).subscribe((data: any) => { this.http
data.result.items.forEach(element => { .get("/api/services/app/ContentAuditLog/GetHistory", { params })
element.itemData = JSON.parse(element.itemData) .subscribe((data: any) => {
data.result.items.forEach((element) => {
element.itemData = JSON.parse(element.itemData);
});
this.list = this.list.concat(data.result.items);
this.list = [...this.list];
this.totalCount = data.result.totalCount;
this.tableSpin = false;
console.log("审核历史纪录", this.list);
setTimeout(() => {
let tableHeader =
this.element.nativeElement.querySelector(
`.ant-table-header`
).clientHeight;
this.tableScrollHeight =
document.getElementById("tablebox").clientHeight -
tableHeader -
10 +
"px";
}, 0);
}); });
this.list = this.list.concat(data.result.items);
this.list = [...this.list]
this.totalCount = data.result.totalCount
this.tableSpin = false
console.log('审核历史纪录', this.list)
setTimeout(() => {
let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight
this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 10) + 'px'
}, 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,
}, },
nzKeyboard:false, nzKeyboard: false,
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 = { displayName: item.organization ? item.organization.displayName : "" } let organization = {
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.licenseType.handleRemindDays data.result.handleRemindDaysDefault =
data.result.closingRemindDaysDefault = data.result.licenseType.closingRemindDays data.result.licenseType.handleRemindDays;
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(this.element.nativeElement.querySelector(`.ant-table-body`) as HTMLCanvasElement, 'scroll').pipe(debounceTime(100)).subscribe((event: any) => { //监听 DOM 滚动事件 fromEvent(
if (event.target.scrollHeight - (event.target.scrollTop + event.target.clientHeight) <= 10) { this.element.nativeElement.querySelector(
if (this.totalCount > this.list.length) { `.ant-table-body`
this.SkipCount = String(Number(this.SkipCount) + 50) ) as HTMLCanvasElement,
this.getRecordList() "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) {
this.SkipCount = String(Number(this.SkipCount) + 50);
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 ? `长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种,且口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符` : '长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种', en: `Password phone number is not valid` } }; return isPassword(value) ? null : { mobile: { 'zh-cn': PatternService.isProd ? `长度至少 12 位,必须包含大写字母、小写字母、数字、符号四种中的三种,且口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符` : '长度至少 12 位,必须包含大写字母、小写字母、数字、符号四种中的三种', 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_!@#$%^&*`~()-+=]{8,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_!@#$%^&*`~()-+=]{12,99}$/.test(value);
} }

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

@ -0,0 +1,328 @@
<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

@ -0,0 +1,578 @@
.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"> <div class="eventechartpieAll" id="eventechartpieAll_YZ">
</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"> <div class="eventechartpie" id="eventechartpie_YZ">
</div> </div>
<div class="eventechartline" id="eventechartline"> <div class="eventechartline" id="eventechartline_YZ">
</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"> <div class="eventechartpie" id="oilechartpie_YZ">
</div> </div>
<div style="height: 80%;" class="eventechartline" id="oilechartline"> <div style="height: 80%;" class="eventechartline" id="oilechartline_YZ">
</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"), document.getElementById("eventechartpieAll_YZ"),
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"), document.getElementById("eventechartpie_YZ"),
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") document.getElementById("eventechartline_YZ")
); );
// 卸油饼图 // 卸油饼图
this.oilchartpie = echarts.init( this.oilchartpie = echarts.init(
document.getElementById("oilechartpie"), document.getElementById("oilechartpie_YZ"),
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")); this.oilchartbar = echarts.init(document.getElementById("oilechartline_YZ"));
window.onresize = () => { window.onresize = () => {
setTimeout(() => { setTimeout(() => {
@ -614,6 +614,8 @@ 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() {
@ -799,7 +801,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,

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

@ -3,20 +3,32 @@
<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">
数字油站 数字油站
</li> </li>
</ng-container> </ng-container>
<ng-template #elseTemplate> <ng-template #elseTemplate>
<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>
@ -58,11 +70,12 @@
<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> <ul nz-menu nzSelectable *ngIf="isZT ==='false'">
<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>
@ -70,9 +83,11 @@
<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>
@ -117,45 +132,4 @@
</ng-template> </ng-template>
</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,39 +13,41 @@
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(closest-side at 50% 55%, #004988 0%, #00122D 100%); background: radial-gradient(
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: 33%; width: 35%;
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 {
@ -67,7 +69,7 @@
span { span {
font-size: 16px; font-size: 16px;
color: #FFFFFF; color: #ffffff;
opacity: 0.6; opacity: 0.6;
} }
@ -77,7 +79,6 @@
} }
} }
.backbtn { .backbtn {
position: absolute; position: absolute;
left: 205px; left: 205px;
@ -87,9 +88,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;
} }
} }
@ -115,7 +116,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;
} }
@ -124,13 +125,17 @@
.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(270deg, rgba(35, 153, 255, 0) 0%, #36A2FF 50%, rgba(35, 153, 255, 0) 100%); background: linear-gradient(
270deg,
rgba(35, 153, 255, 0) 0%,
#36a2ff 50%,
rgba(35, 153, 255, 0) 100%
);
} }
// 适配125% // 适配125%
@ -140,8 +145,6 @@
font-size: 14px; font-size: 14px;
.libox { .libox {
width: 33%;
li { li {
height: 42px; height: 42px;
line-height: 42px; line-height: 42px;
@ -190,13 +193,11 @@
// 适配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;
@ -229,7 +230,6 @@
} }
} }
.backbtn { .backbtn {
left: 156px; left: 156px;
bottom: 0px; bottom: 0px;
@ -243,6 +243,4 @@
padding: 0; padding: 0;
} }
} }
} }

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

@ -71,6 +71,7 @@ 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" },
@ -99,8 +100,14 @@ export class HomeComponent implements OnInit {
menuList1 = []; menuList1 = [];
menuList2 = []; menuList2 = [];
selectedItem; selectedItem;
isZT = sessionStorage.getItem("isZT") || "false";
isComprehensive = false;
routerChange(item) { routerChange(item) {
if (JSON.parse(sessionStorage.getItem("isGasStation"))) { if (
JSON.parse(sessionStorage.getItem("isGasStation")) &&
this.isZT !== "true"
) {
let a = JSON.parse(sessionStorage.getItem("3dSceneData")); let a = JSON.parse(sessionStorage.getItem("3dSceneData"));
if (!a.hasBuildingInfo && item.url == "/plan/petrolStation") { if (!a.hasBuildingInfo && item.url == "/plan/petrolStation") {
this.message.info("当前油站未开通!"); this.message.info("当前油站未开通!");
@ -117,36 +124,22 @@ export class HomeComponent implements OnInit {
} }
isProd: boolean; isProd: boolean;
ngOnInit(): void { 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; this.isProd = this.patternService.isProd;
this.location.subscribe((event) => { this.initSelectedItem(this.router);
if (event.url == "/homepage") {
sessionStorage.setItem("selectedMenu", "首页");
this.selectedItem = "首页";
} 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", "今日预警");
this.selectedItem = "今日预警";
} 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 = "预警记录";
} else if (
event.url == "/license" ||
event.url == "/license/petrolStation"
) {
sessionStorage.setItem("selectedMenu", "证照管理");
this.selectedItem = "证照管理";
}
});
let a = sessionStorage.getItem("userdata"); let a = sessionStorage.getItem("userdata");
this.userMenu = JSON.parse(a).menus; this.userMenu = JSON.parse(a).menus;
@ -232,17 +225,30 @@ 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) {
// console.log(666, event);
if (event.url.indexOf("/homepage") !== -1) {
sessionStorage.setItem("selectedMenu", "首页");
this.selectedItem = "首页";
} else if (event.url.indexOf("/todaywarning") !== -1) {
sessionStorage.setItem("selectedMenu", "今日预警");
this.selectedItem = "今日预警";
} else if (event.url.indexOf("/records_nav") != -1) {
this.selectedItem = "预警记录";
}
}
isWarningVoice = true; //预警声音 isWarningVoice = true; //预警声音
isWarningWindow = true; //预警弹窗 isWarningWindow = true; //预警弹窗
/** /**
@ -300,49 +306,6 @@ 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);
@ -363,18 +326,7 @@ export class HomeComponent implements OnInit {
messageId = []; messageId = [];
receiptOfNotification(userNotification) { receiptOfNotification(userNotification) {
if (this.isWarningVoice) { if (this.isWarningVoice) {
// if (!window.speechSynthesis) { this.Sound(userNotification);
// 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 = {
@ -389,11 +341,82 @@ export class HomeComponent implements OnInit {
this.messageId.push(obj); this.messageId.push(obj);
} }
} }
Sound() {
var mp3Url = "../../../assets/sound/warning.mp3"; msg = new SpeechSynthesisUtterance();
var player = new Audio(mp3Url); playingViolationName = "";
player.play(); //播放 mp3这个音频对象 Sound(userNotification) {
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);

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

@ -1,129 +1,163 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { FormBuilder, FormGroup, Validators, AbstractControl } from '@angular/forms'; import {
import { NzMessageService } from 'ng-zorro-antd/message'; FormBuilder,
import { NzSafeAny } from 'ng-zorro-antd/core/types'; FormGroup,
import { HttpClient } from '@angular/common/http'; Validators,
import { NzModalRef } from 'ng-zorro-antd/modal'; AbstractControl,
} 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(private fb: FormBuilder, private message: NzMessageService, private http: HttpClient, private modal: NzModalRef, private patternService: PatternService) { } constructor(
isProd: boolean private fb: FormBuilder,
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.get('/api/services/app/User/GetPhoneNumber', { this.http
params: { .get("/api/services/app/User/GetPhoneNumber", {
userName: this.validateForm.value.account params: {
} userName: this.validateForm.value.account,
}).subscribe({ },
next: (data: any) => { })
this.phoneNum = data.result .subscribe({
this.currentStep = 2 next: (data: any) => {
} this.phoneNum = data.result;
}) 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.post('/api/services/app/User/SendVerificationCode', null, { params: params }).subscribe({ this.http
next: (data: any) => { .post("/api/services/app/User/SendVerificationCode", null, {
this.message.create('success', '已发送'); params: params,
//按钮倒计时 })
this.codeCountDown = 30 .subscribe({
let codesetInterval = setInterval(() => { next: (data: any) => {
this.codeCountDown = this.codeCountDown - 1 this.message.create("success", "已发送");
if (this.codeCountDown == 0) { //按钮倒计时
clearInterval(codesetInterval) let codesetInterval = setInterval(() => {
} this.codeCountDown = this.codeCountDown - 1;
}, 1000); if (this.codeCountDown == 0) {
} clearInterval(codesetInterval);
}) }
}, 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.get('/api/services/app/User/VerifyVerificationCode', { params: params }).subscribe({ this.http
next: (data: any) => { .get("/api/services/app/User/VerifyVerificationCode", {
this.currentStep = 3 params: params,
} })
}) .subscribe({
next: (data: any) => {
this.currentStep = 3;
},
});
} }
} }
step3() { step3() {
if (this.validateForm3.valid) { if (this.validateForm3.valid) {
let word = JSON.parse(JSON.stringify(this.validateForm3.value.newpassword)).toLowerCase() let word = JSON.parse(
if (this.validateForm3.value.newpassword != this.validateForm3.value.affirmpassword) { JSON.stringify(this.validateForm3.value.newpassword)
this.message.create('warning', '两次密码输入不一致!'); ).toLowerCase();
return false if (
} if (word.indexOf('sino') != -1 || word.indexOf('zhonghua') != -1) { this.validateForm3.value.newpassword !=
this.message.create('warning', '口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符'); this.validateForm3.value.affirmpassword
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.http
this.message.create('success', '修改成功!'); .post("/api/services/app/User/ChangePasswordBySms", body)
this.modal.close() .subscribe(
return true (data) => {
}, err => { this.message.create("success", "修改成功!");
return false 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<string, NzSafeAny>; export type MyErrorsOptions = { "zh-cn": string; en: string } & Record<
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 {
@ -133,13 +167,26 @@ export class MyValidators extends Validators {
return null; return null;
} }
return isPassword(value) ? null : { mobile: { 'zh-cn': PatternService.isProd ? `长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种,且口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符` : '长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种', en: `Password phone number is not valid` } }; return isPassword(value)
? 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 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); 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
)
);
} }

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

@ -43,7 +43,48 @@
<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>

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

@ -1,29 +1,43 @@
import { Component, OnInit, ViewContainerRef } from '@angular/core'; import { Component, OnInit, ViewContainerRef } from "@angular/core";
import { HttpClient } from '@angular/common/http' import { HttpClient } from "@angular/common/http";
import { Router, ActivatedRoute } from '@angular/router' import { Router, ActivatedRoute } from "@angular/router";
import { CacheTokenService } from '../../service/cache-token.service'//引入服务 import { CacheTokenService } from "../../service/cache-token.service"; //引入服务
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; import {
import { NzMessageService } from 'ng-zorro-antd/message'; AbstractControl,
import { Base64 } from 'js-base64'; FormBuilder,
import { NzNotificationService } from 'ng-zorro-antd/notification'; FormGroup,
import { NzSafeAny } from 'ng-zorro-antd/core/types'; Validators,
import { SelectedMenu } from 'src/app/service/selectedMenu.service'; } from "@angular/forms";
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzMessageService } from "ng-zorro-antd/message";
import { ForgetComponent } from './forget/forget.component'; import { Base64 } from "js-base64";
import { PatternService } from 'src/app/service/pattern.service'; import { NzNotificationService } from "ng-zorro-antd/notification";
// import { THIS_EXPR } from '@angular/compiler/src/output/output_ast'; import { NzSafeAny } from "ng-zorro-antd/core/types";
import { SelectedMenu } from "src/app/service/selectedMenu.service";
import { NzModalService } from "ng-zorro-antd/modal";
import { ForgetComponent } from "./forget/forget.component";
import { PatternService } from "src/app/service/pattern.service";
declare var abp: any
@Component({ @Component({
selector: 'app-login', selector: "app-login",
templateUrl: './login.component.html', templateUrl: "./login.component.html",
styleUrls: ['./login.component.scss'] styleUrls: ["./login.component.scss"],
}) })
export class LoginComponent implements OnInit { export class LoginComponent implements OnInit {
validateForm!: FormGroup; validateForm!: FormGroup;
passwordValidateForm!: FormGroup; passwordValidateForm!: FormGroup;
constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, public token: CacheTokenService, private fb: FormBuilder, private message: NzMessageService, private notificationService: NzNotificationService, private selectedMenu: SelectedMenu, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private patternService: PatternService) { constructor(
private http: HttpClient,
private router: Router,
private route: ActivatedRoute,
public token: CacheTokenService,
private fb: FormBuilder,
private message: NzMessageService,
private notificationService: NzNotificationService,
private selectedMenu: SelectedMenu,
private modal: NzModalService,
private viewContainerRef: ViewContainerRef,
private patternService: PatternService
) {
const { password } = MyValidators; const { password } = MyValidators;
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
userName: [null, [Validators.required]], userName: [null, [Validators.required]],
@ -34,224 +48,325 @@ export class LoginComponent implements OnInit {
this.passwordValidateForm = this.fb.group({ this.passwordValidateForm = this.fb.group({
oldpassword: [null, [Validators.required]], oldpassword: [null, [Validators.required]],
newpassword: [null, [Validators.required, password]], newpassword: [null, [Validators.required, password]],
affirmpassword: [null, [Validators.required, password]] affirmpassword: [null, [Validators.required, password]],
}); });
} }
isProd: boolean;
isProd: boolean
ngOnInit() { ngOnInit() {
this.isProd = this.patternService.isProd this.isProd = this.patternService.isProd;
//如果本地储存了账号密码信息,那就回显在输入框 //如果本地储存了账号密码信息,那就回显在输入框
let account = localStorage.getItem('account') let account = localStorage.getItem("account");
let password = localStorage.getItem('password') let password = localStorage.getItem("password");
if (account && password) { if (account && password) {
this.validateForm.patchValue({ this.validateForm.patchValue({
userName: Base64.decode(localStorage.getItem('account')), userName: Base64.decode(localStorage.getItem("account")),
password: Base64.decode(localStorage.getItem('password')) password: Base64.decode(localStorage.getItem("password")),
}); });
this.remember = true //这一步是回显后让勾选框为选中状态 this.remember = true; //这一步是回显后让勾选框为选中状态
} }
//自动登录 //自动登录
if (localStorage.getItem('isautologin') == 'true') { if (localStorage.getItem("isautologin") == "true") {
this.submitForm() this.submitForm();
this.autologin = true //这一步是回显后让勾选框为选中状态 this.autologin = true; //这一步是回显后让勾选框为选中状态
} }
} }
errmsg: string = ''; //错误信息 errmsg: string = ""; //错误信息
//跳转注册页面 //跳转注册页面
toRegister() { toRegister() {
this.router.navigate(['/register']) this.router.navigate(["/register"]);
} }
//记住密码 //记住密码
rememberInfo() { rememberInfo() {
// 判断用户是否勾选记住密码,如果勾选,在本地储存中储存登录信息 // 判断用户是否勾选记住密码,如果勾选,在本地储存中储存登录信息
if (this.remember) { if (this.remember) {
localStorage.setItem("account", Base64.encode(this.validateForm.value.userName)) localStorage.setItem(
localStorage.setItem("password", Base64.encode(this.validateForm.value.password)) "account",
Base64.encode(this.validateForm.value.userName)
);
localStorage.setItem(
"password",
Base64.encode(this.validateForm.value.password)
);
} }
} }
//自动登录 //自动登录
autoLogin() { autoLogin() {
if (this.autologin) { if (this.autologin) {
localStorage.setItem("isautologin", 'true') localStorage.setItem("isautologin", "true");
} }
} }
remember: any//记住密码 remember: any; //记住密码
autologin: any//自动登录 autologin: any; //自动登录
isLoading = false; isLoading = false;
messages messages;
encryptedAccessToken encryptedAccessToken;
menu1 = [ menu1 = [
{ name: '首页', url: '/homepage' }, { name: "首页", url: "/homepage" },
{ name: '数字油站', url: '/plan' }, { name: "数字油站", url: "/plan" },
{ name: '今日预警', url: '/todaywarning' }, { name: "今日预警", url: "/todaywarning" },
{ name: '预警记录', url: '/records_nav' }, { name: "预警记录", url: "/records_nav" },
{ name: '证照管理', url: '/audit' }, { name: "证照管理", url: "/audit" },
] ];
menu2 = [ menu2 = [
{ name: '数字油站', url: '/plan/petrolStation' }, { name: "数字油站", url: "/plan/petrolStation" },
{ name: '今日预警', url: '/todaywarning/petrolStation' }, { name: "今日预警", url: "/todaywarning/petrolStation" },
{ name: '预警记录', url: '/records_nav/petrolStation' }, { name: "预警记录", url: "/records_nav/petrolStation" },
{ name: '证照管理', url: '/license/petrolStation' }, { name: "证照管理", url: "/license/petrolStation" },
] ];
init3D init3D;
async getGasStationBaseInfo() { async getGasStationBaseInfo() {
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
let params = { organizationUnitId: (JSON.parse(sessionStorage.getItem('userdataOfgasstation'))).organization.id } let params = {
this.http.get('/api/services/app/GasStation/Get', { params: params }).subscribe((data: any) => { organizationUnitId: JSON.parse(
resolve(data.result) 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)) sessionStorage.setItem("3dSceneData", JSON.stringify(data.result));
this.init3D = data.result.hasBuildingInfo this.init3D = data.result.hasBuildingInfo;
});
}) });
})
} }
submitForm(): void {
submitData;
submitForm(): void {
if (!this.remember) { if (!this.remember) {
localStorage.removeItem("account") localStorage.removeItem("account");
localStorage.removeItem("password") localStorage.removeItem("password");
} }
if (!this.autologin) { if (!this.autologin) {
localStorage.removeItem("isautologin") localStorage.removeItem("isautologin");
} }
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();
} }
if (!this.validateForm.valid) { if (!this.validateForm.valid) {
this.message.create('error', `请输入账号密码`); this.message.create("error", `请输入账号密码`);
return return;
} }
this.isLoading = true; this.isLoading = true;
this.http.post('/api/TokenAuth/Authenticate', { this.http
userNameOrEmailAddress: this.validateForm.value.userName, .post("/api/TokenAuth/Authenticate", {
password: this.validateForm.value.password userNameOrEmailAddress: this.validateForm.value.userName,
}).subscribe( password: this.validateForm.value.password,
(data: any) => { })
sessionStorage.setItem("token", data.result.accessToken); .subscribe(
sessionStorage.setItem("encryptedAccessToken", data.result.encryptedAccessToken); (data: any) => {
this.http.get('/api/services/app/Session/GetCurrentLoginInformations').subscribe(async (data: any) => { sessionStorage.setItem("token", data.result.accessToken);
console.log('GetCurrentLoginInformations', data.result) sessionStorage.setItem(
if (data.result.user.menus.length == 0) { "encryptedAccessToken",
this.message.create('error', `当前用户未分配菜单`); data.result.encryptedAccessToken
this.isLoading = false );
return this.http
} .get("/api/services/app/Session/GetCurrentLoginInformations")
.subscribe(
sessionStorage.setItem('userdata', JSON.stringify(data.result.user)) async (data: any) => {
sessionStorage.setItem('userdataOfgasstation', JSON.stringify(data.result.user)) this.submitData = data;
sessionStorage.setItem('isDefaultPassword', JSON.stringify(data.result.user.isDefaultPassword)) console.log("GetCurrentLoginInformations", data.result);
sessionStorage.setItem('isPasswordExpired', JSON.stringify(data.result.user.isPasswordExpired)) if (data.result.user.menus.length == 0) {
this.isLoading = false; this.message.create("error", `当前用户未分配菜单`);
if (!data.result.user.organization) { this.isLoading = false;
this.message.create('error', `当前用户没有组织机构信息`); return;
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.autoLogin()
if (data.result.user.organization.isGasStation) { sessionStorage.setItem(
sessionStorage.setItem("isGasStation", 'true'); "userdata",
let a = sessionStorage.getItem('userdataOfgasstation') JSON.stringify(data.result.user)
let menuList = this.returnLastMenus(a, this.menu2) );
let isTrue = menuList.find((item) => { sessionStorage.setItem(
return item.name == "今日预警" "userdataOfgasstation",
}); JSON.stringify(data.result.user)
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', `当前用户未分配菜单`); 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.autoLogin();
if (
data.result.user.isDefaultPassword ||
data.result.user.isPasswordExpired
) {
this.isLoading = false;
this.changePasswordPopup();
return;
}
} //跳转页面
if (isTrue) { this.toPage(data);
this.router.navigate(['/homepage'])
sessionStorage.setItem('selectedMenu', '首页')
} else {
this.router.navigate([menuList[0].url])
sessionStorage.setItem('selectedMenu', menuList[0].name)
}
//
} this.message.create("success", `登录成功`);
this.message.create('success', `登录成功`); },
}, err => { (err) => {
this.isLoading = false;
}
);
},
(err) => {
this.isLoading = false; this.isLoading = false;
}) }
}, );
(err) => { }
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 = [];
let menuList = [] let menuList = [];
for (let index = 0; index < userMenu.length; index++) { for (let index = 0; index < userMenu.length; index++) {
let a = userMenu[index].name let a = userMenu[index].name;
tap.push(a) tap.push(a);
} }
for (let index = 0; index < originalMenus.length; index++) { for (let index = 0; index < originalMenus.length; index++) {
for (let k = 0; k < tap.length; k++) { for (let k = 0; k < tap.length; k++) {
if (tap[k] == originalMenus[index].name) { if (tap[k] == originalMenus[index].name) {
menuList.push(originalMenus[index]) menuList.push(originalMenus[index]);
} }
} }
} }
return menuList return menuList;
} }
forget() { forget() {
// this.message.create('warning', `请联系管理员`); // this.message.create('warning', `请联系管理员`);
this.modal.create({ this.modal.create({
nzTitle: '忘记密码', nzTitle: "忘记密码",
nzContent: ForgetComponent, nzContent: ForgetComponent,
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 288, nzWidth: 288,
nzComponentParams: {}, nzComponentParams: {},
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<string, NzSafeAny>; export type MyErrorsOptions = { "zh-cn": string; en: string } & Record<
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 {
@ -261,14 +376,24 @@ export class MyValidators extends Validators {
return null; return null;
} }
return isPassword(value) ? null : { mobile: { 'zh-cn': `长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种`, en: `Password phone number is not valid` } }; return isPassword(value)
? null
: {
mobile: {
"zh-cn": `长度至少 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 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_!@#$%^&*`~()-+=]{8,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_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{12,99}$/.test(
value
)
);
} }

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

@ -1,25 +1,31 @@
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(private router: Router, private fb: FormBuilder, private objectsSrv: ObjectsSimpleService, private http: HttpClient, private message: NzMessageService, public route: ActivatedRoute) { } constructor(
private router: Router,
private fb: FormBuilder,
userdata: any private objectsSrv: ObjectsSimpleService,
dateFormat = 'yyyy-MM-dd'; private http: HttpClient,
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: [],
@ -40,243 +46,306 @@ 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.get('/api/services/app/GasStation/Get', { this.http
params: { .get("/api/services/app/GasStation/Get", {
organizationUnitId: this.route.snapshot.queryParams.id params: {
} organizationUnitId: this.route.snapshot.queryParams.id,
}).subscribe((data: any) => { },
})
this.httpBody.locationName ? null : this.httpBody.locationName = this.httpBody.proposalAreaName .subscribe(
this.httpBody.companyName ? null : this.httpBody.companyName = this.httpBody.proposalCompanyName (data: any) => {
if (new Date(data.result.openTime).getTime() == -62135625943000) { this.httpBody.locationName
data.result.openTime = null ? null
} : (this.httpBody.locationName = this.httpBody.proposalAreaName);
this.httpBody = data.result this.httpBody.companyName
if (!this.httpBody.govUnitDetail) { ? null
this.httpBody.govUnitDetail = { : (this.httpBody.companyName = this.httpBody.proposalCompanyName);
policeStation: {},
hospital: {}, if (new Date(data.result.openTime).getTime() == -62135625943000) {
fireBrigade: {} data.result.openTime = null;
}
this.httpBody = data.result;
if (!this.httpBody.govUnitDetail) {
this.httpBody.govUnitDetail = {
policeStation: {},
hospital: {},
fireBrigade: {},
};
} else {
this.httpBody.govUnitDetail = JSON.parse(data.result.govUnitDetail);
this.policeStation = data.result.govUnitDetail.policeStation;
this.hospital = data.result.govUnitDetail.hospital;
this.fireBrigade = data.result.govUnitDetail.fireBrigade;
}
if (this.httpBody.otherData) {
this.otherInfoData = JSON.parse(this.httpBody.otherData);
}
console.log("油站信息", this.httpBody);
},
(err) => {
console.log("油站错误信息", err.error.error.message);
} }
} else { );
this.httpBody.govUnitDetail = JSON.parse(data.result.govUnitDetail)
this.policeStation = data.result.govUnitDetail.policeStation
this.hospital = data.result.govUnitDetail.hospital
this.fireBrigade = data.result.govUnitDetail.fireBrigade
}
if (this.httpBody.otherData) {
this.otherInfoData = JSON.parse(this.httpBody.otherData)
}
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.get(`/api/services/app/GasStation/ExportExcelFile?gasStationId=${this.httpBody.id}`, httpOptions).subscribe((data: any) => { this.http
// console.log('导出成功') .get(
// 文件名中有中文 则对文件名进行转码 `/api/services/app/GasStation/ExportExcelFile?gasStationId=${this.httpBody.id}`,
const link = document.createElement('a'); httpOptions
const blob = new Blob([data], { type: 'application/vnd.ms-excel' }); )
link.setAttribute('href', window.URL.createObjectURL(blob)); .subscribe(
link.setAttribute('download', this.httpBody.stationName + '基本信息' + '.xls'); (data: any) => {
link.style.visibility = 'hidden'; // console.log('导出成功')
document.body.appendChild(link); // 文件名中有中文 则对文件名进行转码
link.click(); const link = document.createElement("a");
document.body.removeChild(link); const blob = new Blob([data], { type: "application/vnd.ms-excel" });
this.message.create('success', '导出成功!'); link.setAttribute("href", window.URL.createObjectURL(blob));
}, err => { link.setAttribute(
this.message.create('error', '导出失败!'); "download",
}) this.httpBody.stationName + "基本信息" + ".xls"
);
link.style.visibility = "hidden";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
this.message.create("success", "导出成功!");
},
(err) => {
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.displayName, stationName: JSON.parse(sessionStorage.getItem("userdata")).organization
organizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id, .displayName,
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({ name: '', brand: '', oilGunNum: '', oilsArticleNum: '', oilGunSerialNum: '' }) tableData.push({
name: "",
brand: "",
oilGunNum: "",
oilsArticleNum: "",
oilGunSerialNum: "",
});
} }
if (type == 'tankEquipment') { if (type == "tankEquipment") {
tableData.push({ name: '', oilsArticleNum: '', oilGunSerialNum: '', oilOmeterVolume: '', safetyVolume: '', oilOmeterType: 0, oilPumpType: 0 }) tableData.push({
name: "",
oilsArticleNum: "",
oilGunSerialNum: "",
oilOmeterVolume: "",
safetyVolume: "",
oilOmeterType: 0,
oilPumpType: 0,
});
} }
if (type == 'oilDeliveryPipe') { if (type == "oilDeliveryPipe") {
tableData.push({ name: '', connectTanker: '', connectOilTank: '', designPaper: '' }) tableData.push({
name: "",
connectTanker: "",
connectOilTank: "",
designPaper: "",
});
} }
} }
deleteTable(tableData, key) { deleteTable(tableData, key) {
tableData.splice(key, 1) tableData.splice(key, 1);
} }
uploadType: string;
uploadType: string isUploadLoading = false;
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(file, `stationPhotos/${this.route.snapshot.queryParams.id}/`, item) this.openFileSelect(
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) // 超过5MB要分块上传 if (fileSize >= shardSize) {
{ // 超过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 = ObjectsSimpleService.baseUrl + dataObj.objectName; let filePath: string =
item.designPaper = filePath ObjectsSimpleService.baseUrl + dataObj.objectName;
this.isUploadLoading = false item.designPaper = filePath;
resolve('success') this.isUploadLoading = false;
resolve("success");
}); });
}) });
} }
/** /**
* *
* @param file * @param file
*/ */
postFileByMul(file: File, item) { postFileByMul(file: File, item) {
this.objectsSrv.postFile_MultipartUpload(this.postFilePath, file).then((value) => { this.objectsSrv
let dataObj = value as any; .postFile_MultipartUpload(this.postFilePath, file)
item.designPaper = dataObj.filePath .then((value) => {
this.isUploadLoading = false let dataObj = value as any;
}); item.designPaper = dataObj.filePath;
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);
@ -286,78 +355,92 @@ 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('YYYY-MM-DD')//开业时间格式化 this.httpBody.openTime = moment(this.httpBody.openTime).format(
this.httpBody.govUnitDetail.policeStation = this.validateForm.value.policeStation "YYYY-MM-DD"
this.httpBody.govUnitDetail.hospital = this.validateForm.value.hospital ); //开业时间格式化
this.httpBody.govUnitDetail.fireBrigade = this.validateForm.value.fireBrigade this.httpBody.govUnitDetail.policeStation =
this.validateForm.value.policeStation;
let body = JSON.parse(JSON.stringify(this.httpBody)) this.httpBody.govUnitDetail.hospital = this.validateForm.value.hospital;
body.stationType this.httpBody.govUnitDetail.fireBrigade =
body.govUnitDetail = JSON.stringify(this.httpBody.govUnitDetail) this.validateForm.value.fireBrigade;
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((data: any) => { this.http.put("/api/services/app/GasStation/Update", body).subscribe(
resolve(data) (data: any) => {
this.isLoadingSave = false resolve(data);
this.message.create('success', '保存成功!'); this.isLoadingSave = false;
}, err => { this.message.create("success", "保存成功!");
reject(err) },
this.isLoadingSave = false (err) => {
this.message.create('error', '保存失败!'); reject(err);
}) 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.http
this.isSubmitAuditLoading = false .post("/api/services/app/GasStation/Commit", null, { params: params })
this.getInfo() .subscribe(
this.message.create('success', '提交审核成功!'); (data: any) => {
}, err => { this.isSubmitAuditLoading = false;
this.isSubmitAuditLoading = false this.getInfo();
this.message.create('error', '提交审核失败!'); 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.http
this.isRevocationAuditLoading = false .post("/api/services/app/GasStation/Uncommit", null, { params: params })
this.getInfo() .subscribe(
this.message.create('success', '撤销审核成功!'); (data: any) => {
}, err => { this.isRevocationAuditLoading = false;
this.isRevocationAuditLoading = false this.getInfo();
this.message.create('error', '撤销审核失败!'); 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: 2, name: "便装", color: "#46DFFF" }, { id: 1, 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,6 +54,14 @@ 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; //登录账号的用户名

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

@ -1,54 +1,69 @@
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: 'plan', component: PlanAdminComponent }, { path: "comprehensive", component: HomePageComprehensiveComponent },
{ path: 'plan/petrolStation', component: PlanComponent, canActivate: [init3DGuard], }, { path: "plan", component: PlanAdminComponent },
{ path: 'todaywarning', component: TodayWarningAdminComponent }, {
{ path: 'todaywarning/petrolStation', component: TodayWarningComponent }, path: "plan/petrolStation",
{ component: PlanComponent,
path: 'records_nav', component: RecordsNavComponent, children: [ canActivate: [init3DGuard],
{ path: 'all', component: CriminalRecordsAdminComponent }, },
{ path: 'oliunloadinglist', component: OilUnloadingProcessListComponent }, { path: "todaywarning", component: TodayWarningAdminComponent },
{ path: 'warningstatisticslist', component: WarningStatisticsListComponent }, { path: "todaywarning/petrolStation", component: TodayWarningComponent },
] {
}, path: "records_nav",
{ component: RecordsNavComponent,
path: 'records_nav/petrolStation', component: RecordsNavComponent, children: [ children: [
{ path: 'all', component: CriminalRecordsComponent }, { path: "all", component: CriminalRecordsAdminComponent },
{ path: 'oliunloadinglist', component: OilUnloadingProcessListComponent }, { path: "oliunloadinglist", component: OilUnloadingProcessListComponent },
{ path: 'warningstatisticslist', component: WarningStatisticsListComponent } {
] 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 } path: "records_nav/petrolStation",
component: RecordsNavComponent,
children: [
{ path: "all", component: CriminalRecordsComponent },
{ 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 {}

4
src/app/pages/pages.module.ts

@ -94,10 +94,12 @@ 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 { HomePageComprehensiveComponent } from './home-page-comprehensive/home-page-comprehensive.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], 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],
imports: [ imports: [

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

@ -88,8 +88,10 @@ 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) => {
@ -99,8 +101,14 @@ export class FileLicenseListComponent implements OnInit {
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items.forEach((element) => { data.result.items.forEach((element) => {
if (element.id == OrganizationUnitId) { if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
element.parentId = null; if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) {
element.parentId = null;
}
} }
element.key = element.id; element.key = element.id;
element.title = element.displayName; element.title = element.displayName;

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

@ -1,161 +1,175 @@
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 { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; import {
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNode } from 'ng-zorro-antd/tree'; NzContextMenuService,
import { Router } from '@angular/router'; NzDropdownMenuComponent,
import { NavChangeService } from 'src/app/service/navChange.service'; } from "ng-zorro-antd/dropdown";
import { fromEvent } from 'rxjs'; import {
import { debounceTime } from 'rxjs/operators'; NzFormatEmitEvent,
import { OilStationListComponent } from './oil-station-list/oil-station-list.component'; NzTreeComponent,
import { UpdateLicenseListComponent } from './update-license-list/update-license-list.component'; NzTreeNode,
import { FileLicenseListComponent } from './file-license-list/file-license-list.component'; } from "ng-zorro-antd/tree";
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 })
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; 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(private element: ElementRef, private navChangeService: NavChangeService, private http: HttpClient, private toTree: TreeService, private fb: FormBuilder, private nzContextMenuService: NzContextMenuService, private router: Router) { } constructor(
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 = {
OrganizationUnitId: OrganizationUnitId, IsContainsChildren: "true",
IsContainsChildren: "true" };
} this.http
this.http.get('/api/services/app/Organization/GetAll', { .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 .subscribe((data: any) => {
this.getStationsNum(data.result.items) this.organization = data.result.items;
}) this.getStationsNum(data.result.items);
});
} }
//获得组织机构下有多少油站 //获得组织机构下有多少油站
stationsList stationsList;
getStationsNum(e) { getStationsNum(currentOrList) {
let OrganizationUnitId = JSON.parse(sessionStorage.getItem('userdata')).organization.id console.log("e", currentOrList);
this.http.get('/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true').subscribe((data: any) => { let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata"))
this.stationsList = data.result .organization.id;
const arrs = e.map(item => { let OrganizationUnitIds = JSON.parse(
const data = this.stationsList.find(i => item.id == i.organizationId) sessionStorage.getItem("userdata")
return { ).organizations.map((v) => v.id);
...item, this.http
products: data ? data : false .get(
} "/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true"
}) )
for (let index = 0; index < arrs.length; index++) { .subscribe((data: any) => {
if (arrs[index].id == OrganizationUnitId) { this.stationsList = data.result;
arrs[index].parentId = null const arrs = currentOrList.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].title = arrs[index].displayName this.orSpin = false;
arrs[index].key = arrs[index].id this.nodes = [...this.toTree.toTree(arrs)];
} this.nzExpandedKeys = [this.nodes[0].id];
this.orSpin = false this.nzSelectedKeys = [this.nodes[0].id];
this.nodes = [...this.toTree.toTree(arrs)] sessionStorage.setItem("planAdminOrid", this.nodes[0].id);
this.nzExpandedKeys = [OrganizationUnitId] this.oilStationListComponent.onChildMethod();
this.nzSelectedKeys = [OrganizationUnitId] });
sessionStorage.setItem('planAdminOrid', OrganizationUnitId)
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;
} }
} }

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

@ -84,8 +84,11 @@ 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) => {
@ -95,8 +98,14 @@ export class UpdateLicenseListComponent implements OnInit {
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items.forEach((element) => { data.result.items.forEach((element) => {
if (element.id == OrganizationUnitId) { if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
element.parentId = null; if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) {
element.parentId = null;
}
} }
element.key = element.id; element.key = element.id;
element.title = element.displayName; element.title = element.displayName;
@ -287,7 +296,7 @@ export class UpdateLicenseListComponent implements OnInit {
}, },
nzFooter: null, nzFooter: null,
nzClosable: false, nzClosable: false,
nzKeyboard:false, nzKeyboard: false,
nzOnOk: async () => {}, nzOnOk: async () => {},
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

@ -47,6 +47,7 @@ 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();
@ -142,6 +143,7 @@ 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 +
"-" + "-" +
@ -149,7 +151,16 @@ export class OilUnloadingProcessListComponent implements OnInit {
"-" + "-" +
(nowD < 10 ? "0" + nowD : nowD); //当前日期 (nowD < 10 ? "0" + nowD : nowD); //当前日期
//获取三十天前日期 //获取三十天前日期
let lw = new Date(myDate - 1000 * 60 * 60 * 24 * 29); //最后一个数字30可改,30天的意思 let lw;
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();
@ -687,13 +698,15 @@ export class OilUnloadingProcessListComponent implements OnInit {
//获取所有组织机构 //获取所有组织机构
nodes: any = []; nodes: any = [];
getAllOrganization() { getAllOrganization() {
let OrganizationUnitId = let userData = null;
sessionStorage.getItem("isGasStation") == "true" if (sessionStorage.getItem("isGasStation") == "true") {
? JSON.parse(sessionStorage.getItem("userdataOfgasstation")) userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
.organization.id } else {
: JSON.parse(sessionStorage.getItem("userdata")).organization.id; userData = JSON.parse(sessionStorage.getItem("userdata"));
}
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
@ -702,8 +715,14 @@ export class OilUnloadingProcessListComponent implements OnInit {
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
data.result.items.forEach((element) => { data.result.items.forEach((element) => {
if (element.id == OrganizationUnitId) { if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
element.parentId = null; if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) {
element.parentId = null;
}
} }
element.key = element.id; element.key = element.id;
element.title = element.displayName; element.title = element.displayName;
@ -870,7 +889,7 @@ export class OilUnloadingProcessListComponent implements OnInit {
console.log(item); console.log(item);
let arr = []; let arr = [];
let arr1 = item.oilUnloadingNodes.find((item) => { let arr1 = item.oilUnloadingNodes.find((item) => {
return item.nodeName == "车辆进场" || item.nodeName == "油罐车进场"; return item.nodeName == "车辆进场" || item.nodeName == "油罐车进场";
}); });
let arr2 = item.oilUnloadingNodes.find((item) => { let arr2 = item.oilUnloadingNodes.find((item) => {
return ( return (

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

@ -1,80 +1,85 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import { IsShowEchartsService } from 'src/app/service/isShowEcharts.service'; import { IsShowEchartsService } from "src/app/service/isShowEcharts.service";
import {Location} from "@angular/common"; import { Location } from "@angular/common";
@Component({ @Component({
selector: 'app-records-nav', selector: "app-records-nav",
templateUrl: './records-nav.component.html', templateUrl: "./records-nav.component.html",
styleUrls: ['./records-nav.component.scss'] styleUrls: ["./records-nav.component.scss"],
}) })
export class RecordsNavComponent implements OnInit { export class RecordsNavComponent implements OnInit {
constructor(
private router: Router,
private isShowEcharts: IsShowEchartsService,
private location: Location
) {}
constructor(private router: Router, private isShowEcharts: IsShowEchartsService,private location: Location) { } isEcharts = true;
menuList = ["预警类型统计", "卸油统计", "证照预警统计"];
isEcharts = true tap = [];
menuList = ['预警类型统计', '卸油统计', '证照预警统计'] userMenu = [];
tap=[] menu = [];
userMenu = [] selectedMenu;
menu=[]
selectedMenu
ngOnInit(): void { ngOnInit(): void {
let a= sessionStorage.getItem('userdata') let a = sessionStorage.getItem("userdata");
this.userMenu=JSON.parse(a).menus this.userMenu = JSON.parse(a).menus;
console.log(this.userMenu);
for (let index = 0; index < this.userMenu.length; index++) { for (let index = 0; index < this.userMenu.length; index++) {
let a=this.userMenu[index].name let a = this.userMenu[index].name;
this.tap.push(a) this.tap.push(a);
} }
console.log(this.tap); if (this.userMenu.length == 0) {
this.menu = this.menuList;
if (this.userMenu.length==0) { } else {
this.menu=this.menuList
}else{
for (let index = 0; index < this.menuList.length; index++) { for (let index = 0; index < this.menuList.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.menuList[index]) { if (this.tap[k] == this.menuList[index]) {
this.menu.push(this.tap[k]) this.menu.push(this.tap[k]);
console.log( this.menu); console.log(this.menu);
} }
} }
} }
} }
this.selectedMenu = this.menu[0] if (this.router.url.indexOf("oliunloadinglist") !== -1) {
this.routerChange() this.selectedMenu = "卸油统计";
} else {
this.selectedMenu = this.menu[0];
}
// this.selectedMenu = this.menu[0];
this.routerChange();
} }
selectMenu(item) { selectMenu(item) {
if (this.selectedMenu == item) { if (this.selectedMenu == item) {
return return;
} }
this.isEcharts = true this.isEcharts = true;
this.selectedMenu = item this.selectedMenu = item;
this.routerChange() this.routerChange();
} }
routerChange() { routerChange() {
if (sessionStorage.getItem('isGasStation') == 'false') { if (
if (this.selectedMenu == '预警类型统计') { sessionStorage.getItem("isGasStation") == "false" ||
this.router.navigate(['/records_nav/all']) sessionStorage.getItem("isZT") == "true"
} else if (this.selectedMenu == '卸油统计') { ) {
this.router.navigate(['/records_nav/oliunloadinglist']) if (this.selectedMenu == "预警类型统计") {
} else if (this.selectedMenu == '证照预警统计') { this.router.navigate(["/records_nav/all"]);
this.router.navigate(['/records_nav/warningstatisticslist']) } else if (this.selectedMenu == "卸油统计") {
this.router.navigate(["/records_nav/oliunloadinglist"]);
} else if (this.selectedMenu == "证照预警统计") {
this.router.navigate(["/records_nav/warningstatisticslist"]);
} }
} else { } else {
if (this.selectedMenu == '预警类型统计') { if (this.selectedMenu == "预警类型统计") {
this.router.navigate(['/records_nav/petrolStation/all']) this.router.navigate(["/records_nav/petrolStation/all"]);
} else if (this.selectedMenu == '卸油统计') { } else if (this.selectedMenu == "卸油统计") {
this.router.navigate(['/records_nav/petrolStation/oliunloadinglist']) this.router.navigate(["/records_nav/petrolStation/oliunloadinglist"]);
} else if (this.selectedMenu == '证照预警统计') { } else if (this.selectedMenu == "证照预警统计") {
this.router.navigate(['/records_nav/petrolStation/warningstatisticslist']) this.router.navigate([
"/records_nav/petrolStation/warningstatisticslist",
]);
} }
} }
} }
} }

1013
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

@ -0,0 +1,405 @@
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;
}
}

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

@ -1,29 +1,38 @@
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(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) { } constructor(
isSpin: boolean = false 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
) {}
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],
@ -33,95 +42,115 @@ export class TodayWarningAdminComponent implements OnInit {
area: [null], area: [null],
disposalState: [null], disposalState: [null],
appealState: [null], appealState: [null],
datePickerStart: [new Date(`${moment(new Date()).format('YYYY-MM-DD')} 00:00`)], datePickerStart: [
datePickerEnd: [new Date(`${moment(new Date()).format('YYYY-MM-DD')} 23:59`)] new Date(`${moment(new Date()).format("YYYY-MM-DD")} 00:00`),
],
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(sessionStorage.getItem('userdataOfgasstation')) loginUserInfo = JSON.parse(
sessionStorage.getItem("userdataOfgasstation")
);
} else { } else {
loginUserInfo = JSON.parse(sessionStorage.getItem('userdata')) loginUserInfo = JSON.parse(sessionStorage.getItem("userdata"));
} }
if (loginUserInfo.permissions.find((item) => { if (
return item.name == 'Data.Violation.Positive.Censor' loginUserInfo?.permissions?.find((item) => {
})) { 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.get('/api/services/app/Violation/GetAllList').subscribe((data: any) => { this.http
this.warningTypesDetails = JSON.parse(JSON.stringify(data.result)) .get("/api/services/app/Violation/GetAllList")
this.warningTypesDetailsCopy = JSON.parse(JSON.stringify(data.result)) //原始数据备份 .subscribe((data: any) => {
this.warningTypes = (data.result as any).groupBy((t) => { return t.violationType }); this.warningTypesDetails = JSON.parse(JSON.stringify(data.result));
this.warningTypesCopy = (data.result as any).groupBy((t) => { return t.violationType }) this.warningTypesDetailsCopy = JSON.parse(JSON.stringify(data.result)); //原始数据备份
this.warningLevels = (data.result as any).groupBy((t) => { return t.level }); this.warningTypes = (data.result as any).groupBy((t) => {
this.warningLevelsCopy = (data.result as any).groupBy((t) => { return t.level }) return t.violationType;
this.warningLevels.sort(function (a, b) { });
if (a.key < b.key) { this.warningTypesCopy = (data.result as any).groupBy((t) => {
return -1; return t.violationType;
} else if (a.key == b.key) { });
return 0; this.warningLevels = (data.result as any).groupBy((t) => {
} else { return t.level;
return 1; });
} this.warningLevelsCopy = (data.result as any).groupBy((t) => {
}); return t.level;
this.warningLevelsCopy.sort(function (a, b) { });
if (a.key < b.key) { this.warningLevels.sort(function (a, b) {
return -1; if (a.key < b.key) {
} else if (a.key == b.key) { return -1;
return 0; } else if (a.key == b.key) {
} else { return 0;
return 1; } else {
} return 1;
}
});
this.warningLevelsCopy.sort(function (a, b) {
if (a.key < b.key) {
return -1;
} else if (a.key == b.key) {
return 0;
} else {
return 1;
}
});
// console.log(111, this.warningTypesDetails)
// console.log(222, this.warningTypesCopy)
// console.log(333, this.warningLevels)
}); });
// console.log(111, this.warningTypesDetails)
// console.log(222, this.warningTypesCopy)
// 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) => { return t.level }); this.warningLevels = (element as any).groupBy((t) => {
return t.level;
});
} }
}); });
this.validateForm.patchValue({ this.validateForm.patchValue({
@ -130,17 +159,19 @@ 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) => { return t.violationType }); this.warningTypes = (element as any).groupBy((t) => {
return t.violationType;
});
} }
}); });
this.validateForm.patchValue({ this.validateForm.patchValue({
@ -148,100 +179,142 @@ export class TodayWarningAdminComponent implements OnInit {
}); });
} }
defaultOrId: string defaultOrId: string;
//获取所有组织机构 //获取所有组织机构
nodes: any = [] nodes: any = [];
getAllOrganization() { getAllOrganization() {
let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id let userData = null;
let params = { if (sessionStorage.getItem("isGasStation") == "true") {
OrganizationUnitId: OrganizationUnitId, userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
IsContainsChildren: "true" } else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
} }
this.http.get('/api/services/app/Organization/GetAll', { let OrganizationUnitId = userData.organization.id;
params: params let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
}).subscribe((data: any) => { let params = {
data.result.items.forEach(element => { IsContainsChildren: "true",
if (element.id == OrganizationUnitId) { };
element.parentId = null this.http
} .get("/api/services/app/Organization/GetAll", {
element.key = element.id params: params,
element.title = element.displayName })
.subscribe((data: any) => {
data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) {
element.parentId = null;
}
}
element.key = element.id;
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)
this.isSpin = true let ViolateTime = null;
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: (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: ViolateTime,
// 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.get('/api/services/app/ViolateRecord/GetAll', { this.http
params: params .get("/api/services/app/ViolateRecord/GetAll", {
}).subscribe((data: any) => { params: params,
this.list = data.result.items })
this.totalCount = data.result.totalCount .subscribe((data: any) => {
console.log('预警列表', this.list) data.result.items = data.result.items.filter((item) => {
this.isSpin = false return (
this.isLoading = false item.violation.violationType != "证照资质" ||
let obj = { (item.violation.violationType == "证照资质" &&
name: '改变数量', item.gasStation.companyName.includes("延长"))
num: this.totalCount );
} });
setTimeout(() => { this.list = data.result.items;
this.navChangeService.sendMessage(obj);//发布一条消息 this.totalCount = data.result.totalCount;
}, 0); console.log("预警列表", this.list);
this.isSpin = false;
}) this.isLoading = false;
let obj = {
name: "改变数量",
num: this.totalCount,
};
setTimeout(() => {
this.navChangeService.sendMessage(obj); //发布一条消息
}, 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 {
@ -252,93 +325,125 @@ 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.id, organization: JSON.parse(sessionStorage.getItem("userdata")).organization
datePickerStart: new Date(`${moment(new Date()).format('YYYY-MM-DD')} 00:00`), .id,
datePickerEnd: new Date(`${moment(new Date()).format('YYYY-MM-DD')} 23:59`) datePickerStart: new Date(
`${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: instance.copydata2.violatedItemSnapshotObj.storageLocation, storageLocation:
productionDate: moment(instance.copydata2.violatedItemSnapshotObj.productionDate).format('yyyy-MM-DD'), instance.copydata2.violatedItemSnapshotObj.storageLocation,
maintenanceDate: moment(instance.copydata2.violatedItemSnapshotObj.maintenanceDate).format('yyyy-MM-DD'), productionDate: moment(
validityEndTime: moment(instance.copydata2.violatedItemSnapshotObj.validityEndTime).format('yyyy-MM-DD'), instance.copydata2.violatedItemSnapshotObj.productionDate
).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: item.violatedItemSnapshotObj.organizationUnitId organizationUnitId:
} item.violatedItemSnapshotObj.organizationUnitId,
this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { };
let body = { this.http
id: item.id, .put("/api/services/app/FireEquipment/Update", body)
handleRecord: '报废成功!' .subscribe((data: any) => {
} let body = {
this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { id: item.id,
resolve(data) handleRecord: "报废成功!",
this.message.create('success', '报废成功!'); };
item.handleTime = new Date() this.http
return true .post(
}) "/api/services/app/ViolateRecord/HandleViolateRecord",
}) body
}) )
.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(instance.validateForm.value.productionDate).format('yyyy-MM-DD'), productionDate: moment(
maintenanceDate: moment(instance.validateForm.value.maintenanceDate).format('yyyy-MM-DD'), instance.validateForm.value.productionDate
validityEndTime: moment(instance.validateForm.value.validityEndTime).format('yyyy-MM-DD'), ).format("yyyy-MM-DD"),
organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId maintenanceDate: moment(
} instance.validateForm.value.maintenanceDate
this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { ).format("yyyy-MM-DD"),
// item.violatedItemSnapshotObj = data.result validityEndTime: moment(
let body = { instance.validateForm.value.validityEndTime
id: item.id, ).format("yyyy-MM-DD"),
handleRecord: '维保成功!' organizationUnitId:
} item.violatedItemSnapshotObj.organizationUnitId,
this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { };
resolve(data) this.http
this.message.create('success', '维保成功!'); .put("/api/services/app/FireEquipment/Update", body)
item.handleTime = new Date() .subscribe((data: any) => {
return true // item.violatedItemSnapshotObj = data.result
}) let body = {
}) id: item.id,
}) handleRecord: "维保成功!",
};
this.http
.post(
"/api/services/app/ViolateRecord/HandleViolateRecord",
body
)
.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 {
@ -346,69 +451,73 @@ export class TodayWarningAdminComponent implements OnInit {
nzContent: GetOutOfLineDetailsComponent, nzContent: GetOutOfLineDetailsComponent,
nzWrapClassName: "vertical-center-modal", nzWrapClassName: "vertical-center-modal",
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: (document.documentElement.clientHeight < 650 || document.documentElement.clientWidth < 1400) ? 1000 : 1200, nzWidth:
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.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { this.http
resolve(data) .post("/api/services/app/ViolateRecord/HandleViolateRecord", body)
this.message.create('success', '处置成功!'); .subscribe((data) => {
item.handleTime = new Date() resolve(data);
return true this.message.create("success", "处置成功!");
}) item.handleTime = new Date();
}) return true;
});
});
} else { } else {
this.message.create('warning', '请填写完整!'); this.message.create("warning", "请填写完整!");
return false return false;
} }
}, },
}); });

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

@ -23,9 +23,10 @@
<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;" [ngStyle]="{'background': typeArr[item.id].color}"> <div style="width: 10px;height: 10px;display: inline-block;"
[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> -->
@ -37,7 +38,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"></canvas> [id]="'canvas'+data.id" (click)="viewImg($event)"></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>
@ -62,7 +63,7 @@
</ng-container> </ng-container>
<ng-template #elseTemplate3> <ng-template #elseTemplate3>
暂无视频 暂无视频
</ng-template> </ng-template>
</div> </div>
</div> </div>
<p style="margin-bottom: 0px;margin-top: 3px;box-sizing: border-box;padding: 0 12px;" <p style="margin-bottom: 0px;margin-top: 3px;box-sizing: border-box;padding: 0 12px;"

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

@ -50,7 +50,7 @@ export class GetOutOfLineDetailsComponent implements OnInit {
legendList: any = []; legendList: any = [];
typeArr = [ typeArr = [
{ id: 0, name: "工装", color: "#91CCFF" }, { id: 0, name: "工装", color: "#91CCFF" },
{ id: 2, name: "便装", color: "#46DFFF" }, { id: 1, 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" },
@ -69,8 +69,12 @@ export class GetOutOfLineDetailsComponent implements OnInit {
{ 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: 21, name: "延长壳牌工装", color: "red" },
{ id: 22, name: "山西高速工装", color: "red" },
]; ];
userName; //登录账号的用户名 userName; //登录账号的用户名
name; //登录账号的真实名
isShowAxOtherRegion; //控制哪些用户可以看到ax全部 isShowAxOtherRegion; //控制哪些用户可以看到ax全部
isCarStop = false; isCarStop = false;
@ -80,6 +84,7 @@ 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 {
@ -232,24 +237,32 @@ 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);
imgBg.onload = () => { const drawImageAndRect = () => {
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);
this.ctx = canvas.getContext("2d");
const cWidth = canvas.width,
cHeight = canvas.height;
setTimeout(() => { setTimeout(() => {
console.log("以图画底,描绘预警框..."); this.ctx = canvas.getContext("2d");
// 以图画底 const cWidth = canvas.width,
cHeight = canvas.height;
console.log(1, cWidth, cHeight);
this.ctx.drawImage(imgBg, 0, 0, cWidth, cHeight); this.ctx.drawImage(imgBg, 0, 0, cWidth, cHeight);
this.strokeRect(this.currentCoordinate); this.strokeRect(this.currentCoordinate);
}, 100); }, 0);
}; };
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]),
@ -260,7 +273,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; this.ctx.strokeStyle = this.typeArr[item.id]?.color || "yellow";
this.ctx.lineWidth = 3; this.ctx.lineWidth = 3;
this.ctx.strokeRect( this.ctx.strokeRect(
startPoint[0], startPoint[0],
@ -270,16 +283,16 @@ export class GetOutOfLineDetailsComponent implements OnInit {
); );
//如果当前矩形区域为错误区域,则左上角增加色块 //如果当前矩形区域为错误区域,则左上角增加色块
if (item.error) { if (item.error) {
this.ctx.fillStyle = this.typeArr[item.id].color; this.ctx.fillStyle = this.typeArr[item.id]?.color || "yellow";
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; this.ctx.fillStyle = this.typeArr[item.id]?.color || "yellow";
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; name = this.typeArr[item.id]?.name || "未定义" + item.scores;
} else { } else {
name = this.typeArr[item.id].name; name = this.typeArr[item.id]?.name || "未定义";
} }
this.ctx.fillText( this.ctx.fillText(
name, name,
@ -290,7 +303,7 @@ export class GetOutOfLineDetailsComponent implements OnInit {
); );
} else { } else {
if (item.error) { if (item.error) {
this.ctx.strokeStyle = this.typeArr[item.id].color; this.ctx.strokeStyle = this.typeArr[item.id]?.color || "yellow";
this.ctx.lineWidth = 3; this.ctx.lineWidth = 3;
this.ctx.strokeRect( this.ctx.strokeRect(
startPoint[0], startPoint[0],
@ -298,9 +311,9 @@ 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; this.ctx.fillStyle = this.typeArr[item.id]?.color || "yellow";
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; this.ctx.fillStyle = this.typeArr[item.id]?.color || "yellow";
this.ctx.font = "16px Verdana"; this.ctx.font = "16px Verdana";
} }
} }
@ -421,7 +434,9 @@ export class GetOutOfLineDetailsComponent implements OnInit {
} }
//查看图片 //查看图片
viewImg(url) { viewImg(e) {
// 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");
@ -455,6 +470,7 @@ 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,6 +230,13 @@ 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);

9
src/app/service/pattern.service.ts

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

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

@ -51,7 +51,6 @@ export class AlgorithmConfigComponent implements OnInit {
organizationList; //组织机构列表 organizationList; //组织机构列表
getAllOrganization() { getAllOrganization() {
let params = { let params = {
OrganizationUnitId: this.OrganizationUnitId,
IsContainsChildren: "true", IsContainsChildren: "true",
}; };
this.http this.http
@ -73,6 +72,14 @@ 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"
@ -90,8 +97,14 @@ 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 (arrs[index].id == this.OrganizationUnitId) { if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
arrs[index].parentId = null; 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].title =
arrs[index].displayName + arrs[index].displayName +
@ -166,7 +179,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();

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

@ -1,284 +1,326 @@
import { HttpClient } from '@angular/common/http'; import { HttpClient } from "@angular/common/http";
import { Component, OnInit, AfterViewInit, ViewChild, ViewContainerRef } from '@angular/core'; import {
import { TreeService } from 'src/app/service/tree.service'; Component,
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree'; OnInit,
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; AfterViewInit,
import { NzModalService } from 'ng-zorro-antd/modal'; ViewChild,
import { NzMessageService } from 'ng-zorro-antd/message'; ViewContainerRef,
import { AddhostComponent } from './addhost/addhost.component'; } from "@angular/core";
import { AddcameraComponent } from './addcamera/addcamera.component'; import { TreeService } from "src/app/service/tree.service";
import { EdithostComponent } from './edithost/edithost.component'; import {
import { EditcameraComponent } from './editcamera/editcamera.component'; NzFormatEmitEvent,
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(
constructor(private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { } private fb: FormBuilder,
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 OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id let userData = null;
let params = { if (sessionStorage.getItem("isGasStation") == "true") {
OrganizationUnitId: OrganizationUnitId, userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
IsContainsChildren: "true" } else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
} }
this.http.get('/api/services/app/Organization/GetAll', { let OrganizationUnitId = userData.organization.id;
params: params let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
}).subscribe((data: any) => { let params = {
this.totalCount = data.result.totalCount IsContainsChildren: "true",
data.result.items.forEach(element => { };
if (element.id == OrganizationUnitId) { this.http
element.parentId = null .get("/api/services/app/Organization/GetAll", {
} params: params,
element.key = element.id })
element.title = element.displayName .subscribe((data: any) => {
element.selectable = false this.totalCount = data.result.totalCount;
data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) {
element.parentId = null;
}
}
element.key = element.id;
element.title = element.displayName;
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 })
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; 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 = [...this.nzSelectedKeys] this.nzSelectedKeys[0] = event.node.origin.id;
this.selectedOilStation = event.node.origin this.nzSelectedKeys = [...this.nzSelectedKeys];
this.getHost() this.selectedOilStation = event.node.origin;
this.getCamera() this.getHost();
this.getCamera();
} else { } else {
this.message.info('只有加油站才可以增加主机'); this.message.info("只有加油站才可以增加主机");
} }
} }
//获得加油站的主机 //获得加油站的主机
listOfData: any[] = []; listOfData: any[] = [];
getHost() { getHost() {
this.http.get('/api/services/app/EdgeDevice/GetAll', { this.http
params: { .get("/api/services/app/EdgeDevice/GetAll", {
organizationUnitId: this.selectedOilStation.id, params: {
SkipCount: '0', organizationUnitId: this.selectedOilStation.id,
MaxResultCount: '100', SkipCount: "0",
} 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.get('/api/services/app/Camera/GetAll', { this.http
params: { .get("/api/services/app/Camera/GetAll", {
organizationUnitId: this.selectedOilStation.id, params: {
SkipCount: '0', organizationUnitId: this.selectedOilStation.id,
MaxResultCount: '100', SkipCount: "0",
} MaxResultCount: "100",
}).subscribe((data: any) => { },
// console.log('摄像头列表', data) })
this.listOfDataCamera = data.result.items .subscribe((data: any) => {
}) // console.log('摄像头列表', data)
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.post('/api/services/app/EdgeDevice/Create', body).subscribe(data => { this.http
resolve(data) .post("/api/services/app/EdgeDevice/Create", body)
this.message.create('success', '创建成功!'); .subscribe((data) => {
this.getHost() resolve(data);
return true this.message.create("success", "创建成功!");
}) 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.put('/api/services/app/EdgeDevice/Update', data).subscribe(data => { this.http
resolve(data) .put("/api/services/app/EdgeDevice/Update", data)
this.message.create('success', '修改成功!'); .subscribe((data) => {
this.getHost() resolve(data);
return true this.message.create("success", "修改成功!");
}) 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.delete('/api/services/app/EdgeDevice/Delete', { this.http
params: { .delete("/api/services/app/EdgeDevice/Delete", {
Id: item.id params: {
} 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 => { this.http.post("/api/services/app/Camera/Create", body).subscribe(
resolve(data) (data) => {
this.message.create('success', '创建成功!'); resolve(data);
this.getCamera() this.message.create("success", "创建成功!");
return true this.getCamera();
}, err => { return true;
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();
} }
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(data => { this.http.put("/api/services/app/Camera/Update", data).subscribe(
resolve(data) (data) => {
this.message.create('success', '编辑成功!'); resolve(data);
this.getCamera() this.message.create("success", "编辑成功!");
return true this.getCamera();
}, err => { return true;
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.delete('/api/services/app/Camera/Delete', { this.http
params: { .delete("/api/services/app/Camera/Delete", {
Id: item.id params: {
} 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'> <a nz-dropdown [nzDropdownMenu]="menu" [nzTrigger]="'click'" [nzBackdrop]='false' *ngIf="isZT ==='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: 40px; margin-top: 0px;
} }
.headPortrait { .headPortrait {

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

@ -9,6 +9,7 @@ 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 = [];
@ -67,6 +68,16 @@ 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;
@ -89,7 +100,10 @@ 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 (JSON.parse(a).userName == "admin") { if (
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

@ -0,0 +1,35 @@
<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

@ -0,0 +1,76 @@
.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

@ -0,0 +1,128 @@
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

@ -0,0 +1,56 @@
<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

@ -0,0 +1,168 @@
.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

@ -0,0 +1,156 @@
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

@ -0,0 +1,4 @@
<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

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

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

@ -0,0 +1,55 @@
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" });
}
}

9
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 nz-button nzType="primary" (click)="addOr()"><i nz-icon nzType="plus-circle" <button *ngIf="isAdmin" 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,8 +21,8 @@
<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" nzDraggable [nzExpandAll]="nzExpandAll" [nzExpandedKeys]="defaultExpandedKeys" [nzTreeTemplate]="nzTreeTemplate" nzBlockNode
nzBlockNode (nzOnDrop)="nzEvent($event)" [nzBeforeDrop]="beforeDrop" [nzExpandedIcon]="multiExpandedIconTpl"> [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">
@ -31,9 +31,10 @@
<span *ngIf="!node.origin.isGasStation">({{node.origin.products? node.origin.products.stationsCount : <span *ngIf="!node.origin.isGasStation">({{node.origin.products? node.origin.products.stationsCount :
0}})</span> 0}})</span>
</span> </span>
<span class="operation" *ngIf="level === 1"> <span class="operation" *ngIf="level === 1 && isAdmin">
<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>

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

@ -22,6 +22,7 @@ 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",
@ -38,8 +39,18 @@ 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"));
if (userdata.userName == "admin" || userdata.userName == "superadmin") {
//是superadmin,是内部制作账号
this.isAdmin = true;
} else {
this.isAdmin = false;
}
this.level = JSON.parse( this.level = JSON.parse(
sessionStorage.getItem("userdata") sessionStorage.getItem("userdata")
).organization.level; ).organization.level;
@ -66,13 +77,7 @@ export class OrganizationComponent implements OnInit {
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
@ -89,11 +94,14 @@ export class OrganizationComponent implements OnInit {
//获得组织机构下有多少油站 //获得组织机构下有多少油站
stationsList; stationsList;
getStationsNum(e) { getStationsNum(e) {
let OrganizationUnitId = let userData = null;
sessionStorage.getItem("isGasStation") == "true" if (sessionStorage.getItem("isGasStation") == "true") {
? JSON.parse(sessionStorage.getItem("userdataOfgasstation")) userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
.organization.id } else {
: JSON.parse(sessionStorage.getItem("userdata")).organization.id; 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"
@ -110,8 +118,14 @@ export class OrganizationComponent implements OnInit {
}; };
}); });
for (let index = 0; index < arrs.length; index++) { for (let index = 0; index < arrs.length; index++) {
if (arrs[index].id == OrganizationUnitId) { if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
arrs[index].parentId = null; 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].title = arrs[index].displayName;
arrs[index].key = arrs[index].id; arrs[index].key = arrs[index].id;
@ -416,4 +430,48 @@ 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,6 +11,8 @@ 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 },
@ -21,6 +23,8 @@ 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,7 +50,12 @@ 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,
@ -82,6 +87,11 @@ import { AlgorithmConfigComponent } from './algorithm-config/algorithm-config.co
MenusComponent, MenusComponent,
WarningEventsComponent, WarningEventsComponent,
AlgorithmConfigComponent, AlgorithmConfigComponent,
UserBindingComponent,
BindingComponent,
OrBindingComponent,
OrBindingModelComponent,
ChangeOrComponent,
], ],
imports: [ imports: [
CommonModule, CommonModule,
@ -107,7 +117,7 @@ import { AlgorithmConfigComponent } from './algorithm-config/algorithm-config.co
NzSwitchModule, NzSwitchModule,
NzNotificationModule, NzNotificationModule,
DragDropModule, DragDropModule,
NzToolTipModule NzToolTipModule,
], ],
entryComponents: [ entryComponents: [
AdduserComponent, AdduserComponent,
@ -129,6 +139,7 @@ import { AlgorithmConfigComponent } from './algorithm-config/algorithm-config.co
EditmenuComponent, EditmenuComponent,
MenusComponent, MenusComponent,
WarningEventsComponent, WarningEventsComponent,
BindingComponent,
], ],
}) })
export class SystemManagementModule {} export class SystemManagementModule {}

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

@ -0,0 +1,113 @@
<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

@ -0,0 +1,223 @@
.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

@ -0,0 +1,208 @@
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

@ -0,0 +1,101 @@
<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

@ -0,0 +1,173 @@
.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

@ -0,0 +1,106 @@
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());
}
}

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

@ -1,19 +1,23 @@
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(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { } constructor(
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({
@ -23,15 +27,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[] = [];
@ -39,49 +43,67 @@ export class AdduserComponent implements OnInit {
//获取角色列表 //获取角色列表
getAllRoles() { getAllRoles() {
let params = { let params = {
SkipCount: '0', SkipCount: "0",
MaxResultCount: '999' MaxResultCount: "999",
} };
this.http.get('/api/services/app/Role/GetAll', { this.http
params: params .get("/api/services/app/Role/GetAll", {
}).subscribe((data: any) => { params: params,
// console.log('角色列表', data.result.items) })
this.listOfData = data.result.items .subscribe((data: any) => {
}) // console.log('角色列表', 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.get('/api/services/app/Role/GetAll', { this.http
params: params .get("/api/services/app/Role/GetAll", {
}).subscribe((data: any) => { params: params,
// console.log('角色列表', data.result.items) })
this.listOfData2 = data.result.items .subscribe((data: any) => {
}) // console.log('角色列表', data.result.items)
this.listOfData2 = data.result.items;
});
} }
//获取所有组织机构 //获取所有组织机构
nodes: any = [] nodes: any = [];
getAllOrganization() { getAllOrganization() {
let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id let userData = null;
let params = { if (sessionStorage.getItem("isGasStation") == "true") {
OrganizationUnitId: OrganizationUnitId, userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
IsContainsChildren: "true" } else {
userData = JSON.parse(sessionStorage.getItem("userdata"));
} }
this.http.get('/api/services/app/Organization/GetAll', { let OrganizationUnitId = userData.organization.id;
params: params let OrganizationUnitIds = userData.organizations?.map((v) => v.id);
}).subscribe((data: any) => { let params = {
data.result.items.forEach(element => { IsContainsChildren: "true",
if (element.id == OrganizationUnitId) { };
element.parentId = null this.http
} .get("/api/services/app/Organization/GetAll", {
element.key = element.id params: params,
element.title = element.displayName })
.subscribe((data: any) => {
data.result.items.forEach((element) => {
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
if (OrganizationUnitIds.includes(element.id)) {
element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) {
element.parentId = null;
}
}
element.key = element.id;
element.title = element.displayName;
});
this.nodes = [...this.toTree.toTree(data.result.items)];
}); });
this.nodes = [...this.toTree.toTree(data.result.items)]
})
} }
} }

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

@ -1,34 +1,40 @@
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(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private message: NzMessageService) { } constructor(
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({
@ -38,116 +44,158 @@ 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.get('/api/services/app/Role/GetAll', { this.http
params: params .get("/api/services/app/Role/GetAll", {
}).subscribe((data: any) => { params: params,
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.get('/api/services/app/Role/GetAll', { this.http
params: params .get("/api/services/app/Role/GetAll", {
}).subscribe((data: any) => { params: params,
resolve(data) })
this.listOfData2 = data.result.items .subscribe((data: any) => {
}) resolve(data);
}) this.listOfData2 = data.result.items;
});
});
} }
//获取所有组织机构 //获取所有组织机构
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 userData = null;
let params = { if (sessionStorage.getItem("isGasStation") == "true") {
OrganizationUnitId: OrganizationUnitId, userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
IsContainsChildren: "true" } 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) => { await new Promise<void>((resolve, reject) => {
this.http.get('/api/services/app/Organization/GetAll', { this.http
params: params .get("/api/services/app/Organization/GetAll", {
}).subscribe((data: any) => { params: params,
data.result.items.forEach(element => { })
if (element.id == OrganizationUnitId) { .subscribe((data: any) => {
element.parentId = null data.result.items.forEach((element) => {
} if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
element.key = element.id if (OrganizationUnitIds.includes(element.id)) {
element.title = element.displayName element.parentId = null;
}
} else {
if (element.id == OrganizationUnitId) {
element.parentId = null;
}
}
element.key = element.id;
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() {
this.isLoading = true // console.log(this.validateForm);
// return;
this.isLoading = true;
if (this.validateForm.valid) { if (this.validateForm.valid) {
return await new Promise(resolve => { return await new Promise((resolve) => {
for (let index = 0; index < this.validateForm.value.role2.length; index++) { for (
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 = [...this.validateForm.value.role, ...this.validateForm.value.role2] let roleNames = [
...this.validateForm.value.role,
...this.validateForm.value.role2,
];
let body = { let body = {
id: this.data.id, id: this.data.id,
userName: this.validateForm.value.account, userName: this.validateForm.controls.account.value,
name: this.validateForm.value.name, name: this.validateForm.controls.name.value,
organizationUnitId: this.validateForm.value.organization, organizationUnitId: this.validateForm.controls.organization.value,
roleNames: roleNames, roleNames: roleNames,
phoneNumber: this.validateForm.value.phonenum, phoneNumber: this.validateForm.controls.phonenum.value,
note:this.validateForm.value.note, note: this.validateForm.controls.note.value,
isActive: true isActive: true,
} };
this.http.put(this.editUrl, body).subscribe((data:any) => { this.http.put(this.editUrl, body).subscribe(
resolve(data) (data: any) => {
this.data.auditStatus = data.result.auditStatus resolve(data);
this.isLoading = false this.data.auditStatus = data.result.auditStatus;
this.message.create('success', '保存成功!'); this.isLoading = false;
}, err => { this.message.create("success", "保存成功!");
resolve(err) },
this.isLoading = false (err) => {
this.message.create('warning', '保存失败'); resolve(err);
}) this.isLoading = false;
}) this.message.create("warning", "保存失败");
}
);
});
} else { } else {
this.message.create('warning', '请填写完整!'); this.message.create("warning", "请填写完整!");
} }
} }
//取消 //取消
@ -156,28 +204,38 @@ 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', '审核完成的不能重复提交,请编辑后提交'); //提交审核
return this.message.create("warning", "审核完成的不能重复提交,请编辑后提交");
return;
} }
if(type){ if (type) {
await this.ok() await this.ok();
} }
this.isLoading = true this.isLoading = true;
let url let url;
type ? url = '/api/services/app/EdittingUser/Commit' : url = '/api/services/app/EdittingUser/Uncommit' type
this.http.post(url, '', { ? (url = "/api/services/app/EdittingUser/Commit")
params: { : (url = "/api/services/app/EdittingUser/Uncommit");
id: this.data.id this.http
} .post(url, "", {
}).subscribe((data: any) => { params: {
this.data.auditStatus = data.result.auditStatus id: this.data.id,
this.isLoading = false },
this.message.create('success', type ? '提交审核成功' : '撤销审核成功'); })
}, err => { .subscribe(
this.isLoading = false (data: any) => {
this.message.create('error', type ? '提交审核失败' : '撤销审核失败'); 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 nz-button nzType="primary" (click)="addUser()"><i nz-icon nzType="plus-circle" <button *ngIf="isAdmin" 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"> <div class="tablebox" #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 nz-icon nz-tooltip nzTooltipTitle="重置密码" (click)="resetPassword(data)"> <i *ngIf="isAdmin" 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" class="greenColor2" nz-icon nzType="stop" nzTheme="outline" nz-tooltip <i *ngIf="!data.isActive && isAdmin" class="greenColor2" nz-icon nzType="stop" nzTheme="outline"
nzTooltipTitle="启用" (click)="cancel(data,true)"></i> nz-tooltip nzTooltipTitle="启用" (click)="cancel(data,true)"></i>
<i *ngIf="data.isActive" class="redColor" nz-icon nzType="stop" nzTheme="outline" nz-tooltip <i *ngIf="data.isActive && isAdmin" class="redColor" nz-icon nzType="stop" nzTheme="outline" nz-tooltip
nzTooltipTitle="停用" (click)="cancel(data,false)"></i> nzTooltipTitle="停用" (click)="cancel(data,false)"></i>
<i class="redColor" nz-icon nzType="poweroff" nzTheme="outline" nz-tooltip nzTooltipTitle="注销" <i *ngIf="isAdmin" class="redColor" nz-icon nzType="poweroff" nzTheme="outline" nz-tooltip
(click)="delete(data)"></i> nzTooltipTitle="注销" (click)="delete(data)"></i>
</td> </td>
</tr> </tr>
</tbody> </tbody>

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

@ -46,7 +46,16 @@ 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],
}); });
@ -152,13 +161,7 @@ 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) => {
@ -175,11 +178,14 @@ export class UserComponent implements OnInit {
}); });
} }
async getuser(e) { async getuser(e) {
let OrganizationUnitId = let userData = null;
sessionStorage.getItem("isGasStation") == "true" if (sessionStorage.getItem("isGasStation") == "true") {
? JSON.parse(sessionStorage.getItem("userdataOfgasstation")) userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation"));
.organization.id } else {
: JSON.parse(sessionStorage.getItem("userdata")).organization.id; userData = JSON.parse(sessionStorage.getItem("userdata"));
}
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",
@ -204,8 +210,14 @@ export class UserComponent implements OnInit {
}); });
for (let index = 0; index < arrs.length; index++) { for (let index = 0; index < arrs.length; index++) {
if (arrs[index].id == OrganizationUnitId) { if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) {
arrs[index].parentId = null; 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].title = arrs[index].displayName;
arrs[index].key = arrs[index].id; arrs[index].key = arrs[index].id;

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.

BIN
src/assets/sound/gongzhuang.mp3

Binary file not shown.

BIN
src/assets/sound/jinchukou.mp3

Binary file not shown.

BIN
src/assets/sound/minghuo.mp3

Binary file not shown.

BIN
src/assets/sound/xychaichuxyguan.mp3

Binary file not shown.

BIN
src/assets/sound/xygeli.mp3

Binary file not shown.

BIN
src/assets/sound/xyjianxie.mp3

Binary file not shown.

BIN
src/assets/sound/xyjiedi.mp3

Binary file not shown.

BIN
src/assets/sound/xymiehuoqi.mp3

Binary file not shown.

BIN
src/assets/sound/xywuren.mp3

Binary file not shown.

BIN
src/assets/sound/xyxianchang.mp3

Binary file not shown.

BIN
src/assets/sound/xyxieyouguan.mp3

Binary file not shown.

BIN
src/assets/sound/yanwu.mp3

Binary file not shown.

63
src/styles.scss

@ -104,8 +104,8 @@ h1 {
//三维场景 //三维场景
.dropDown { .dropDown {
border: 1px solid #23D9FF; border: 1px solid #23d9ff;
background: linear-gradient(180deg, #000D21 0%, #006E85 100%); background: linear-gradient(180deg, #000d21 0%, #006e85 100%);
li:hover { li:hover {
background-color: transparent; background-color: transparent;
@ -121,8 +121,8 @@ h1 {
} }
.dropDownPlan { .dropDownPlan {
background: linear-gradient(360deg, #000D21 0%, rgba(0, 59, 110, 0.8) 100%); background: linear-gradient(360deg, #000d21 0%, rgba(0, 59, 110, 0.8) 100%);
box-shadow: 0px 0px 6px #2399FF; box-shadow: 0px 0px 6px #2399ff;
li { li {
color: #fff; color: #fff;
@ -131,10 +131,9 @@ h1 {
//任务弹窗 //任务弹窗
.taskDialog { .taskDialog {
.ant-modal-header, .ant-modal-header,
.ant-modal-content { .ant-modal-content {
background: radial-gradient(circle, #004988 0%, #00122D 100%); background: radial-gradient(circle, #004988 0%, #00122d 100%);
} }
.ant-modal-header, .ant-modal-header,
@ -143,26 +142,26 @@ h1 {
} }
.ant-modal-title, .ant-modal-title,
.ant-form-item-label>label, .ant-form-item-label > label,
.ant-input { .ant-input {
color: #C4E2FC; color: #c4e2fc;
} }
.ant-modal-footer .ant-btn:first-child { .ant-modal-footer .ant-btn:first-child {
color: #C4E2FC; color: #c4e2fc;
background: #000D21; background: #000d21;
border: 1px solid #C4E2FC; border: 1px solid #c4e2fc;
} }
.ant-modal-footer .ant-btn:last-child { .ant-modal-footer .ant-btn:last-child {
color: #C4E2FC; color: #c4e2fc;
background: rgba(0, 129, 255, 0.6); background: rgba(0, 129, 255, 0.6);
border: 1px solid #36A2FF; border: 1px solid #36a2ff;
} }
.ant-input { .ant-input {
background: rgba(145, 204, 255, 0.41); background: rgba(145, 204, 255, 0.41);
border: 1px solid #91CCFF; border: 1px solid #91ccff;
} }
textarea { textarea {
@ -181,7 +180,11 @@ h1 {
.ant-modal-body, .ant-modal-body,
.ant-modal-content { .ant-modal-content {
height: 100%; height: 100%;
background: radial-gradient(closest-side at 50% 55%, #004988 0%, #00122D 100%); background: radial-gradient(
closest-side at 50% 55%,
#004988 0%,
#00122d 100%
);
} }
} }
@ -214,7 +217,6 @@ h1 {
//bbl 内置color //bbl 内置color
#threeDimensional { #threeDimensional {
//可展开面板 //可展开面板
#disposalPlan { #disposalPlan {
font-size: 15px; font-size: 15px;
@ -223,7 +225,7 @@ h1 {
width: 100%; width: 100%;
height: 35px; height: 35px;
line-height: 35px; line-height: 35px;
color: #23D9FF; color: #23d9ff;
padding: 0px; padding: 0px;
background: rgba(35, 153, 255, 0.41); background: rgba(35, 153, 255, 0.41);
border: 1px solid rgba(35, 217, 255, 0.4); border: 1px solid rgba(35, 217, 255, 0.4);
@ -235,12 +237,12 @@ h1 {
.ant-collapse-content { .ant-collapse-content {
background-color: transparent; background-color: transparent;
width: 100% width: 100%;
} }
} }
.ant-tree { .ant-tree {
color: #C4E2FC; color: #c4e2fc;
} }
//tree //tree
@ -257,7 +259,8 @@ h1 {
//tree //tree
.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector { .ant-select-disabled.ant-select-single:not(.ant-select-customize-input)
.ant-select-selector {
color: #fff; color: #fff;
} }
@ -296,9 +299,9 @@ h1 {
padding-left: 5px; padding-left: 5px;
height: 30px; height: 30px;
line-height: 28px; line-height: 28px;
background: linear-gradient(360deg, #000D21 0%, rgba(0, 59, 110, 0.8) 100%); background: linear-gradient(360deg, #000d21 0%, rgba(0, 59, 110, 0.8) 100%);
border: 1px solid rgba(35, 217, 255, 0.4); border: 1px solid rgba(35, 217, 255, 0.4);
color: #23D9FF; color: #23d9ff;
.ant-collapse-arrow { .ant-collapse-arrow {
left: 5px; left: 5px;
@ -314,13 +317,13 @@ h1 {
//步骤条 //步骤条
//滚动条样式 //滚动条样式
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 5px; width: 5px;
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background-image: linear-gradient(#2495f8, #1c73c2, #02233f, ); background-image: linear-gradient(#2495f8, #1c73c2, #02233f);
} }
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
@ -366,7 +369,7 @@ ul {
} }
.btn { .btn {
color: #36A2FF; color: #36a2ff;
span { span {
cursor: pointer; cursor: pointer;
@ -380,7 +383,6 @@ ul {
margin-right: 40px; margin-right: 40px;
} }
} }
} }
.spin { .spin {
@ -395,3 +397,12 @@ ul {
left: 0; left: 0;
top: 0; top: 0;
} }
#progressBar {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 5px;
background-color: #ccc; /* 进度条默认颜色 */
}

18
src/theme.less

@ -419,13 +419,13 @@
} }
nz-tree { nz-tree {
nz-tree-node { // nz-tree-node {
margin-left: 20px; // margin-left: 20px;
} // }
nz-tree-node:nth-child(1) { // nz-tree-node:nth-child(1) {
margin-left: 0px; // margin-left: 0px;
} // }
} }
.ant-table table { .ant-table table {
@ -665,9 +665,11 @@
} }
} }
#userBox {
.ant-modal-close-x {
color: #000;
}
.ant-modal-close-x {
color: #fff;
} }
.maxHeightTreeSelect { .maxHeightTreeSelect {

Loading…
Cancel
Save