Browse Source

[新增]echarts天津地图

tianjin
邵佳豪 2 years ago
parent
commit
6716f69161
  1. 19467
      package-lock.json
  2. 2
      package.json
  3. 352
      src/app/pages/login/login.component.ts
  4. 21
      src/app/plan-audit/plan-record/plan-record.component.ts
  5. 69
      src/app/plan-audit/wait-examineer/wait-examineer.component.ts
  6. 9
      src/app/statistic-analysis/home/home.component.html
  7. 1
      src/app/statistic-analysis/home/home.component.scss
  8. 1189
      src/app/statistic-analysis/home/home.component.ts
  9. 19
      src/assets/echarts/tianjin.js
  10. 1
      src/assets/echarts/tianjin.json
  11. 4
      src/index.html
  12. 23
      tsconfig.json
  13. 943
      yarn.lock

19467
package-lock.json generated

File diff suppressed because it is too large Load Diff

2
package.json

@ -32,7 +32,7 @@
"cesium": "^1.64.0",
"crypto-js": "^4.0.0",
"e-ngx-cesium": "^6.3.2",
"echarts": "^4.6.0",
"echarts": "^4.1.0",
"firebase": "^7.6.2",
"ng-zorro-antd": "^9.3.0",
"ng2-file-upload": "^1.4.0",

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

@ -1,188 +1,204 @@
import { ApplicationRef, Component, ComponentFactoryResolver, Injector, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http'
import { Data } from '../../interface'
import { Router, ActivatedRoute } from '@angular/router'
import { CacheTokenService } from '../../http-interceptors/cache-token.service'//引入服务
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import {
ApplicationRef,
Component,
ComponentFactoryResolver,
Injector,
OnInit,
} from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Data } from "../../interface";
import { Router, ActivatedRoute } from "@angular/router";
import { CacheTokenService } from "../../http-interceptors/cache-token.service"; //引入服务
import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
import { MatDialog, MatDialogRef } from "@angular/material/dialog";
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss'],
selector: "app-login",
templateUrl: "./login.component.html",
styleUrls: ["./login.component.scss"],
})
export class LoginComponent implements OnInit {
constructor(
private http: HttpClient,
private router: Router,
private route: ActivatedRoute,
public token: CacheTokenService,
public snackBar: MatSnackBar,
public dialog: MatDialog
) {}
ngOnInit() {
this.automaticLogin();
}
errmsg: string = "";
onSubmit(e) {
this.http
.post("/api/Account/SignIn", {
name: e.name,
password: e.password,
})
.subscribe(
(data: Data) => {
sessionStorage.setItem("level", data.level);
sessionStorage.setItem("token", data.token);
sessionStorage.setItem("refreshToken", data.refreshToken);
sessionStorage.setItem("isDefaultPassword", data.isDefaultPassword); //是否需要修改默认密码
this.http.get("/api/Account/NavMenus").subscribe((data: any) => {
console.log("菜单数据", data);
let isHave = data.find((item) => {
return item.url == "/statisticanalysis/home";
});
let isHaveGis = data.find((item) => {
return item.url == "/gis";
});
let isKeyUnit = data.find((item) => {
return item.url == "/keyUnit";
});
constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, public token: CacheTokenService, public snackBar: MatSnackBar, public dialog: MatDialog) {
}
ngOnInit() {
this.automaticLogin()
}
errmsg: string = ''
onSubmit(e) {
this.http.post('/api/Account/SignIn', {
name: e.name,
password: e.password
}).subscribe((data: Data) => {
sessionStorage.setItem("level", data.level);
sessionStorage.setItem("token", data.token);
sessionStorage.setItem("refreshToken", data.refreshToken);
sessionStorage.setItem("isDefaultPassword", data.isDefaultPassword);//是否需要修改默认密码
this.http.get('/api/Account/NavMenus').subscribe((data: any) => {
let isHave = data.find(item => { return item.url == "/statisticanalysis/home" })
let isHaveGis = data.find(item => { return item.url == "/gis" })
if (isHave) {
this.router.navigate([`/statisticanalysis/home`])
this.dialogChangePassword()
return
} else if (isHaveGis) {
this.router.navigate([`/gis`])
this.dialogChangePassword()
return
} else if (data.length != 0) {
this.router.navigate([`/keyUnit`])
this.dialogChangePassword()
return
} else {
this.snackBar.open('该用户角色未分配任何菜单', '确定', {
duration: 3000
});
}
})
if (e.notlogin) { //7天免登录时
localStorage.setItem("isnologin", "true")
localStorage.setItem("token", data.token)
localStorage.setItem("refreshToken", data.refreshToken)
let URL = data.find((item) => {
return item.url;
});
console.log(URL);
if (isHave) {
this.router.navigate([`/statisticanalysis/home`]);
this.dialogChangePassword();
return;
} else if (isHaveGis) {
this.router.navigate([`/gis`]);
this.dialogChangePassword();
return;
} else if (isKeyUnit) {
this.router.navigate([`/keyUnit`]);
this.dialogChangePassword();
return;
} else if (data.length != 0) {
this.router.navigate([URL.url]);
this.dialogChangePassword();
return;
} else {
this.snackBar.open("该用户角色未分配任何菜单", "确定", {
duration: 3000,
});
}
//调用服务中的function刷新token
this.token.startUp()
});
if (e.notlogin) {
//7天免登录时
localStorage.setItem("isnologin", "true");
localStorage.setItem("token", data.token);
localStorage.setItem("refreshToken", data.refreshToken);
}
//调用服务中的function刷新token
this.token.startUp();
},
(err) => { this.errmsg = err }
)
}
dialogChangePassword() {
if (sessionStorage.getItem('isDefaultPassword') == 'true') {
let dialogRef = this.dialog.open(ChangepasswordComponent2,
{ width: '348px' });
dialogRef.afterClosed().subscribe((data) => {
sessionStorage.setItem('isDefaultPassword', 'false')
// this.lookUpdateData()
});
} else {
// this.lookUpdateData()
(err) => {
this.errmsg = err;
}
);
}
dialogChangePassword() {
if (sessionStorage.getItem("isDefaultPassword") == "true") {
let dialogRef = this.dialog.open(ChangepasswordComponent2, {
width: "348px",
});
dialogRef.afterClosed().subscribe((data) => {
sessionStorage.setItem("isDefaultPassword", "false");
});
}
//查看更新内容
lookUpdateData() {
let dialogRef = this.dialog.open(lookUpdateDataComponent,
{ width: '668px' });
dialogRef.afterClosed().subscribe((data) => {
});
}
//7天免登录自动登录
automaticLogin() {
let isNoLogin = localStorage.getItem("isnologin")
if (isNoLogin) { //7天免登录时
let token = localStorage.getItem("token");
let refreshToken = localStorage.getItem("refreshToken");
this.http.post('/api/Account/RefreshToken', {
token: token,
refreshToken: refreshToken
}).subscribe((data: any) => {
sessionStorage.setItem("level", data.level);
sessionStorage.setItem("token", data.token);
sessionStorage.setItem("refreshToken", data.refreshToken);
this.token.startUp()
this.router.navigate(['/keyUnit'])
this.snackBar.open('已自动登录', '确定', { duration: 3000 });
})
} //if
}
//打开弹窗
open() {
this.snackBar.open('请联系管理员', '确定', {
duration: 3000
}
//查看更新内容
lookUpdateData() {
let dialogRef = this.dialog.open(lookUpdateDataComponent, {
width: "668px",
});
dialogRef.afterClosed().subscribe((data) => {});
}
//7天免登录自动登录
automaticLogin() {
let isNoLogin = localStorage.getItem("isnologin");
if (isNoLogin) {
//7天免登录时
let token = localStorage.getItem("token");
let refreshToken = localStorage.getItem("refreshToken");
this.http
.post("/api/Account/RefreshToken", {
token: token,
refreshToken: refreshToken,
})
.subscribe((data: any) => {
sessionStorage.setItem("level", data.level);
sessionStorage.setItem("token", data.token);
sessionStorage.setItem("refreshToken", data.refreshToken);
this.token.startUp();
this.router.navigate(["/keyUnit"]);
this.snackBar.open("已自动登录", "确定", { duration: 3000 });
});
}
} //if
}
//打开弹窗
open() {
this.snackBar.open("请联系管理员", "确定", {
duration: 3000,
});
}
}
@Component({
selector: 'app-changepassword',
templateUrl: './changePassword.html',
styleUrls: ['./changepassword.scss']
selector: "app-changepassword",
templateUrl: "./changePassword.html",
styleUrls: ["./changepassword.scss"],
})
export class ChangepasswordComponent2 implements OnInit {
constructor(private http: HttpClient, public snackBar: MatSnackBar,
public dialogRef: MatDialogRef<ChangepasswordComponent2>) { }
ngOnInit() {
}
errmsg: string = ''
onSubmit(e) {
this.http.put(
'/api/Account/Password',
{
newPassword: e.newPassword,
password: 'SHya119!@'
}
).subscribe(data => {
this.dialogRef.close(data);
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('密码修改成功', '确定', config);
}, (err) => { this.errmsg = err }
)
}
constructor(
private http: HttpClient,
public snackBar: MatSnackBar,
public dialogRef: MatDialogRef<ChangepasswordComponent2>
) {}
ngOnInit() {}
errmsg: string = "";
onSubmit(e) {
this.http
.put("/api/Account/Password", {
newPassword: e.newPassword,
password: "SHya119!@",
})
.subscribe(
(data) => {
this.dialogRef.close(data);
const config = new MatSnackBarConfig();
config.verticalPosition = "top";
config.duration = 3000;
this.snackBar.open("密码修改成功", "确定", config);
},
(err) => {
this.errmsg = err;
}
);
}
}
@Component({
selector: 'app-lookUpdateData',
templateUrl: './lookUpdateData.html',
styleUrls: ['./lookUpdateData.scss']
selector: "app-lookUpdateData",
templateUrl: "./lookUpdateData.html",
styleUrls: ["./lookUpdateData.scss"],
})
export class lookUpdateDataComponent implements OnInit {
constructor(private http: HttpClient, public snackBar: MatSnackBar,
public dialogRef: MatDialogRef<lookUpdateDataComponent>) { }
ngOnInit() {
}
onSubmit(e) {
}
}
constructor(
private http: HttpClient,
public snackBar: MatSnackBar,
public dialogRef: MatDialogRef<lookUpdateDataComponent>
) {}
ngOnInit() {}
onSubmit(e) {}
}

21
src/app/plan-audit/plan-record/plan-record.component.ts

@ -8,8 +8,8 @@ import {
} from "@angular/material/dialog";
import { HttpClient } from "@angular/common/http";
import { DomSanitizer } from "@angular/platform-browser";
import { Viewer } from "photo-sphere-viewer";
import * as ViewerJs from "viewerjs";
import { photoViewer } from "photo-sphere-viewer";
import Viewer from "viewerjs";
@Component({
selector: "app-plan-record",
templateUrl: "./plan-record.component.html",
@ -234,7 +234,7 @@ export class PlanRecordComponent implements OnInit {
obj.innerHTML = "";
}
window.setTimeout(() => {
this.viewer = new Viewer({
this.viewer = new photoViewer({
container: document.querySelector("#viewer"),
panorama: "/api/Objects/PlanPlatform/" + this.fetchUrl,
});
@ -248,15 +248,12 @@ export class PlanRecordComponent implements OnInit {
node.id = "img";
dom.appendChild(node);
setTimeout(() => {
let viewer = new ViewerJs(
document.getElementById(`viewerjs`),
{
hidden: () => {
dom.removeChild(pObjs[0]);
viewer.destroy();
},
}
);
let viewer = new Viewer(document.getElementById(`viewerjs`), {
hidden: () => {
dom.removeChild(pObjs[0]);
viewer.destroy();
},
});
node.click();
}, 0);
} else {

69
src/app/plan-audit/wait-examineer/wait-examineer.component.ts

@ -17,9 +17,9 @@ import {
import { HttpClient } from "@angular/common/http";
declare var CryptoJS;
import { DomSanitizer } from "@angular/platform-browser";
import { Viewer as photoViewer } from "photo-sphere-viewer";
import { photoViewer } from "photo-sphere-viewer";
declare var echarts: any;
import * as ViewerJs from "viewerjs";
import Viewer from "viewerjs";
@Component({
selector: "app-wait-examineer",
templateUrl: "./wait-examineer.component.html",
@ -156,30 +156,7 @@ export class WaitExamineerComponent implements OnInit {
this.PageNumber = e.pageIndex + 1;
this.getAlltabledate();
}
lookImg(imgUrl, type?: boolean) {
// console.log(imgUrl)
let dom = document.getElementById(`viewerjs`);
let pObjs = dom.childNodes;
let node = document.createElement("img");
node.style.display = "none";
if (type) {
let src = imgUrl.split("?")[0];
node.src = src;
} else {
node.src = "/api/Objects/PlanPlatform/" + imgUrl;
}
node.id = "imgxxx";
dom.appendChild(node);
setTimeout(() => {
let viewer = new Viewer(document.getElementById(`viewerjs`), {
hidden: () => {
dom.removeChild(pObjs[0]);
viewer.destroy();
},
});
node.click();
}, 0);
}
//radio点击事件
viewer; //全景图对象
waterData: any; //需要传递给子组件的水源信息
@ -371,15 +348,12 @@ export class WaitExamineerComponent implements OnInit {
node.id = "img";
dom.appendChild(node);
setTimeout(() => {
let viewer = new ViewerJs(
document.getElementById(`viewerjs`),
{
hidden: () => {
dom.removeChild(pObjs[0]);
viewer.destroy();
},
}
);
let viewer = new Viewer(document.getElementById(`viewerjs`), {
hidden: () => {
dom.removeChild(pObjs[0]);
viewer.destroy();
},
});
node.click();
}, 0);
} else {
@ -406,7 +380,30 @@ export class WaitExamineerComponent implements OnInit {
}
this.radioid = item.itemId;
}
lookImg(imgUrl, type?: boolean) {
// console.log(imgUrl)
let dom = document.getElementById(`viewerjs`);
let pObjs = dom.childNodes;
let node = document.createElement("img");
node.style.display = "none";
if (type) {
let src = imgUrl.split("?")[0];
node.src = src;
} else {
node.src = "/api/Objects/PlanPlatform/" + imgUrl;
}
node.id = "imgxxx";
dom.appendChild(node);
setTimeout(() => {
let viewer = new Viewer(document.getElementById(`viewerjs`), {
hidden: () => {
dom.removeChild(pObjs[0]);
viewer.destroy();
},
});
node.click();
}, 0);
}
//毕升
lookWord() {
console.log("lookWord");

9
src/app/statistic-analysis/home/home.component.html

@ -70,13 +70,8 @@
<div class="item-txt" id="number02">{{dataGetNum}}</div>
</div> -->
</div>
<!-- 图表 -->
<!-- <div class="panel panel06 mt-mlger">
<div class="panel-bd">
<div id="chartQusj" class="chart-item"></div>
</div>
</div> -->
</div>
</div>
<!-- 右侧 -->
<div class="main-right">
<div class="box-wrap planNum" style="flex: 0.7;position: relative;">

1
src/app/statistic-analysis/home/home.component.scss

@ -4,6 +4,7 @@
}
#chartMap{
margin-left: 5px;
// border: 1px solid red;
}
.number-area{
position: absolute;

1189
src/app/statistic-analysis/home/home.component.ts

File diff suppressed because it is too large Load Diff

19
src/assets/echarts/tianjin.js

File diff suppressed because one or more lines are too long

1
src/assets/echarts/tianjin.json

File diff suppressed because one or more lines are too long

4
src/index.html

@ -17,8 +17,4 @@
</body>
<script src="/assets/html2canvas.js"></script>
<!-- <script type="text/javascript" src="/assets/wordexport/jquery.js"></script>
<script type="text/javascript" src="/assets/wordexport/FileSaver.js"></script>
<script type="text/javascript" src="/assets/wordexport/jquery.wordexport.js"></script> -->
</html>

23
tsconfig.json

@ -10,26 +10,19 @@
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",//es6
"target": "es2015", //es6
"allowJs": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"typeRoots": ["node_modules/@types"],
"lib": ["es2018", "dom"],
"paths": {
"@src/*":["src/*"]
"@src/*": ["src/*"]
}
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
"strictInjectionParameters": true,
"resolveJsonModule": true,
"esModuleInterop": true
},
"include": [
"src/**/*.d.ts",
"src/**/*.ts",
"typings.d.ts"
]
"include": ["src/**/*.d.ts", "src/**/*.ts", "typings.d.ts"]
}

943
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save