/**
* 描述:查询分析
* @version:1.0.0
* @author: zb
* @创建时间: 2017-06-08 15:37:59
*/
import { Component, OnInit, OnDestroy, ViewChild } from ‘@angular/core‘;
import { Router, ActivatedRouteSnapshot, NavigationEnd, RoutesRecognized } from ‘@angular/router‘;
import { Http, Headers } from ‘@angular/http‘;
import { Observable } from ‘rxjs/Rx‘;
import { EventManager, AlertService } from ‘ng-jhipster‘;
import { Subscription } from ‘rxjs/Rx‘;
import { ITEMS_PER_PAGE, Principal } from ‘../shared‘; // 分页设置,权限验证等
import { API_URL } from ‘../app.constants‘;
import { TreeModule, TreeNode } from ‘primeng/primeng‘;
import { TabViewModule, Message } from ‘primeng/primeng‘;
import { WrRvSegMgmtComponent, WrRvRecMgmtComponent, BaseComponentsMgmtComponent, WrRvRecMgmtDetailComponent, WrRvLogMgmtComponent, WrRvLogMgmtDetailComponent } from ‘./‘;
import { WrRvRecChartComponent, WrRvLogChartComponent, WrRvSegMgmtDetailComponent } from ‘./‘;
import { BaseComponentsChartComponent } from ‘./‘;
import { PdoBCountMgmtDetailComponent, StBCountMgmtDetailComponent, WrRvSegPsMgmtDetailComponent, WrIntBMgmtDetailComponent } from ‘./‘;
import { LocalStorageService, SessionStorageService } from ‘ng2-webstorage‘;
@Component({
selector: ‘wr-query-analyze‘,
styles: [`
p-tree{
float:left;
margin-right:0.5rem;
}
p-datatable{
display:flex;
}
p-tabView{
display:flex;
padding: 0em 0em 0em;
}
.form-inline button{
margin-left:0.5rem;
}
h2{
margin:0.5rem 0;
}
.data-table-wrap{
// display:inline-block;
}
.data-table-wrap p-tree{
float: left;
height: 48.9rem;
margin-right: 1rem;
}
:host >>> .ui-tree{
height: 100%;
width:16em;
margin-top:0.5rem;
}
.areaTable{
display: flex;
}
:host >>> .col-button{
text-align:center;
}
:host >>> .col-button button{
margin:0.5rem 0;
}
:host >>> .data-table-search{
display: flex;
margin-top:0.5rem;
margin-bottom:0.5rem;
}
:host >>> .form-group:nth-child(2){
margin:0 1rem;
}
:host >>> .form-inline{
flex:1;
-webkit-box-flex:1;
}
:host >>> .form-inline .form-control {
display: inline-block;
width: auto;
margin-left: 4px;
vertical-align: middle;
}
:host >>> .modal-dialog{
margin-top:15%;
}
p-calendar{
display: -webkit-box;
-webkit-box-flex: 1;
}
:host >>> .dialog-datepick{
display: -webkit-box;
-webkit-box-flex: 1;
}
:host >>> .ui-inputtext {
display: -webkit-box;
padding: .5rem .75rem;
font-size: 1rem;
line-height: 1.25;
}
:host >>> .btn-update{
position: absolute;
right: 25px;
top: 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
:host >>> .ui-tabview-nav{
border:0px;
border-bottom:1px solid #d9d9d9;
padding:0 !important;
}
:host >>> .ui-tabview .ui-tabview-panel{
padding:1em 0;
}
:host >>> .ui-tabview{
width:100%;
}
.ui-tabview-panel{
padding:0;
}
`],
templateUrl: ‘./wr-queryAnalyze.component.html‘
})
export class WrQueryAnalyzeComponent implements OnInit, OnDestroy {
parentCode: string;
// 河段树选择的节点
selectedNode: TreeNode;
// 查询条件
query: any = {};
itemsPerPage: number = ITEMS_PER_PAGE;
totalRecords: number;
sortBy: string;
page: number;
loading: boolean = true;
index: number = 0;
hiddenRec: boolean = true;
hiddenRecDetail: boolean = true;
hiddenLog: boolean = true;
hiddenLogDetail: boolean = true;
rvRecId: string;
hiddenAll: boolean = true;
hiddenPdoBDetail: boolean = true;
hiddenStBDetail: boolean = true;
baseComponentsId: string;
// hiddenRvSegPs: boolean = true;
hiddenRvSegPsDetail: boolean = true;
hiddenIntBDetail: boolean = true;
hiddenSeg: boolean = false;
hiddenSegDetail: boolean = true;
@ViewChild(‘wrRvRecChart‘)
private wrRvRecChart: WrRvRecChartComponent;
@ViewChild(‘wrRvReclist‘)
private wrRvReclist: WrRvRecMgmtComponent;
@ViewChild(‘wrRvRecDetail‘)
private wrRvRecDetail: WrRvRecMgmtDetailComponent;
@ViewChild(‘pdoBDetail‘)
private pdoBDetail: PdoBCountMgmtDetailComponent;
@ViewChild(‘stBDetail‘)
private stBDetail: StBCountMgmtDetailComponent;
@ViewChild(‘RvSegPsDetail‘)
private RvSegPsDetail: WrRvSegPsMgmtDetailComponent;
@ViewChild(‘IntBDetail‘)
private IntBDetail: WrIntBMgmtDetailComponent;
@ViewChild(‘jhiWrRvSeg‘)
private jhiWrRvSeg: WrRvSegMgmtComponent;
@ViewChild(‘baseComponents‘)
private baseComponents: BaseComponentsMgmtComponent;
@ViewChild(‘jhiWrRvLog‘)
private jhiWrRvLog: WrRvLogMgmtComponent;
@ViewChild(‘wrRvLogDetail‘)
private wrRvLogDetail: WrRvLogMgmtDetailComponent;
@ViewChild(‘baseComponentsChart‘)
private baseComponentsChart: BaseComponentsChartComponent;
@ViewChild(‘wrRvLogChart‘)
private wrRvLogChart: WrRvLogChartComponent;
@ViewChild(‘wrRvSegDetail‘)
private wrRvSegDetail: WrRvSegMgmtDetailComponent;
account: any;
/**
* 巡河统计构造函数
* @param http
* @param alertService
*/
constructor(
private http: Http,
private router: Router,
private $localStorage: LocalStorageService,
private $sessionStorage: SessionStorageService,
private eventManager: EventManager, // 事件管理
private alertService: AlertService) { }
/**
* 页面初期加载
*/
ngOnInit() {
// 示例里面使用荣昌区,实际用的时候应该是根据登录人的所在区域来获取
this.account = this.$localStorage.retrieve(‘account‘) || this.$sessionStorage.retrieve(‘account‘);
if (this.account.addvcd != null) {
this.parentCode = this.account.addvcd;
}
// else {
// this.parentCode = "500153000000";
// }
}
//第一级tabView 点击切换加载
onTabChange(event) {
if (event.index == 0) {//河段信息
this.index = 0;
this.hiddenSeg = false;
this.hiddenSegDetail = true;
this.jhiWrRvSeg.selectedNode = this.selectedNode;
this.jhiWrRvSeg.page = 0;
this.jhiWrRvSeg.loadAll();
}
if (event.index == 1) {//基础设施与部件
this.index = 1;
this.hiddenAll = false;
this.hiddenPdoBDetail = true;
this.hiddenStBDetail = true;
this.hiddenRvSegPsDetail = true;
this.hiddenIntBDetail = true;
this.baseComponents.selectedNode = this.selectedNode;
this.baseComponents.page = 0;
this.baseComponents.loadAll();
}
// if (event.index == 2) {//水质信息
// this.index = 2;
// }
if (event.index == 2) {//巡河信息
this.index = 2;
this.hiddenRecDetail = true; //隐藏详细巡河信息
this.hiddenRec = false; //显示巡河信息列表
this.wrRvReclist.selectedNode = this.selectedNode;
this.wrRvReclist.page = 0;
this.wrRvReclist.loadAll();
}
if (event.index == 3) {//河道事件
this.index = 3;
this.hiddenLogDetail = true; //隐藏详细巡河信息
this.hiddenLog = false; //显示巡河信息列表
// this.wrRvLogDetail = wrRvLogDetail;
// this.jhiWrRvLog = jhiWrRvLog;
this.jhiWrRvLog.selectedNode = this.selectedNode;
this.jhiWrRvLog.query = {};
this.jhiWrRvLog.query.ts = ‘‘;
this.jhiWrRvLog.query.ud = ‘‘;
this.jhiWrRvLog.msgs = [];
this.jhiWrRvLog.page = 0;
this.jhiWrRvLog.loadAll();
}
}
//第二级河段信息tabView 点击切换加载
onTabSegChange(event) {
if (event.index == 0) {//河段信息
this.index = 0;
this.hiddenSeg = false;
this.hiddenSegDetail = true;
this.jhiWrRvSeg.selectedNode = this.selectedNode;
this.jhiWrRvSeg.page = 0;
this.jhiWrRvSeg.loadAll();
}
}
/**
* 巡河信息查看详情
* @param rvSegId
*/
loadSegDetail(rvSegId) {
if (rvSegId && rvSegId != null && rvSegId != ‘‘) {
this.hiddenSeg = true;
this.hiddenSegDetail = false;
this.wrRvSegDetail.rvSegId = rvSegId;
this.wrRvSegDetail.loadAll();
}
}
/**
* 从巡河详细返回 到列表页面
* @param back
*/
backSegList(back) {
if (back != null && back != ‘‘ && back == ‘backSegList‘) {
this.hiddenSegDetail = true;
this.hiddenSeg = false;
this.jhiWrRvSeg.selectedNode = this.selectedNode;
this.jhiWrRvSeg.page = 0;
this.jhiWrRvSeg.loadAll();
}
}
/**
* 巡河信息查看详情
* @param rvRecId
*/
loadRecDetail(rvRecId) {
if (rvRecId && rvRecId != null && rvRecId != ‘‘) {
this.hiddenRec = true;
this.hiddenRecDetail = false;
this.wrRvRecDetail.rvRecId = rvRecId;
this.wrRvRecDetail.load();
}
}
/**
* 从巡河详细返回 到列表页面
* @param back
*/
backRecList(back) {
if (back != null && back != ‘‘ && back == ‘backRecList‘) {
this.hiddenRecDetail = true;
this.hiddenRec = false;
this.wrRvReclist.selectedNode = this.selectedNode;
this.wrRvReclist.page = 0;
this.wrRvReclist.loadAll();
}
}
//第二级巡河信息tabView 点击切换加载
onTabRecChange(event) {
if (event.index == 0) {//巡河信息
this.index = 2;
this.hiddenRecDetail = true; //隐藏详细巡河信息
this.hiddenRec = false; //显示巡河信息列表
this.wrRvReclist.selectedNode = this.selectedNode;
this.wrRvReclist.query = {};
this.wrRvReclist.page = 0;
this.wrRvReclist.loadAll();
}
if (event.index == 1) {//巡河信息统计分析
this.index = 2.1;
this.hiddenRecDetail = true; //隐藏详细巡河信息
this.hiddenRec = true; ///隐藏巡河信息列表
this.wrRvRecChart.queryChar = {};
this.wrRvRecChart.selectedNode = this.selectedNode;
this.wrRvRecChart.queryChar.beginTm = new Date(new Date().setMonth((new Date().getMonth() - 3)));
this.wrRvRecChart.queryChar.endTm = new Date();
this.wrRvRecChart.loadChar();
}
}
//第二级基础设施与部件 tabView 点击切换加载
onTabComponentChange(event) {
console.log(event);
if (event.index == 0) {//基础设施与部件
this.index = 1;
this.hiddenAll = false;
this.hiddenPdoBDetail = true;
this.hiddenStBDetail = true;
this.hiddenRvSegPsDetail = true;
this.hiddenIntBDetail = true;
this.baseComponents.selectedNode = this.selectedNode;
this.baseComponents.page = 0;
this.baseComponents.loadAll();
}
if (event.index == 1) {//基础设施与部件统计
this.index = 1.1;
this.hiddenAll = true;
this.hiddenPdoBDetail = true;
this.hiddenStBDetail = true;
this.hiddenRvSegPsDetail = true;
this.hiddenIntBDetail = true;
this.baseComponentsChart.selectedNode = this.selectedNode;
this.baseComponentsChart.ngOnInit();
}
}
//第二级河道事件tabView 点击切换加载
onTabLogChange(event) {
console.log(event);
if (event.index == 0) {//河道事件
this.index = 3;
this.hiddenLogDetail = true; //隐藏详细巡河信息
this.hiddenLog = false; //显示巡河信息列表
this.jhiWrRvLog.selectedNode = this.selectedNode;
this.jhiWrRvLog.query = {};
this.jhiWrRvLog.query.ts = ‘‘;
this.jhiWrRvLog.query.ud = ‘‘;
this.jhiWrRvLog.msgs = [];
this.jhiWrRvLog.page = 0;
this.jhiWrRvLog.loadAll();
}
if (event.index == 1) {//河道事件统计分析
this.index = 3.1;
this.hiddenLogDetail = true; //隐藏详细巡河信息
this.hiddenLog = true; ///隐藏巡河信息列表
// this.wrRvLogChart = wrRvLogChart;
this.wrRvLogChart.selectedNode = this.selectedNode;
this.wrRvLogChart.ngOnInit();
}
}
/**
* 巡河信息查看详情
* @param wrRvLogId
*/
loadLogDetail(wrRvLogId) {
if (wrRvLogId && wrRvLogId != null && wrRvLogId != ‘‘) {
this.hiddenLog = true;
this.hiddenLogDetail = false;
this.wrRvLogDetail.wrRvLogId = wrRvLogId;
this.wrRvLogDetail.load();
}
}
/**
* 基础设施与部件 查看详情
* @param rvRecId
*/
loadDetailAll(event) {
console.log(event);
// 入河排污口 的详情 bdc82aa7-b2da-47ed-8b09-2aeb152a4aaf
if (event.comType == ‘3‘) {
if (event.baseComponentsId != null && event.baseComponentsId != ‘‘) {
this.hiddenAll = true;
this.hiddenPdoBDetail = false;
this.hiddenStBDetail = true;
this.hiddenRvSegPsDetail = true;
this.hiddenIntBDetail = true;
this.pdoBDetail.baseComponentsId = event.baseComponentsId;
this.pdoBDetail.load();
}
}
// 水文测站 的详情 ad29b755-6eee-4791-8161-8879684d65cc
else if (event.comType == ‘4‘) {
if (event.baseComponentsId != null && event.baseComponentsId != ‘‘) {
this.hiddenAll = true;
this.hiddenPdoBDetail = true;
this.hiddenStBDetail = false;
this.hiddenRvSegPsDetail = true;
this.hiddenIntBDetail = true;
this.stBDetail.baseComponentsId = event.baseComponentsId;
this.stBDetail.load();
}
}
// 公示牌 的详情 5806fa4b-36f8-4ac9-ada0-d5b5ee4f80ae
else if (event.comType == ‘9‘) {
if (event.baseComponentsId != null && event.baseComponentsId != ‘‘) {
this.hiddenAll = true;
this.hiddenPdoBDetail = true;
this.hiddenStBDetail = true;
this.hiddenRvSegPsDetail = false;
this.hiddenIntBDetail = true;
this.RvSegPsDetail.rvSegPsId = event.baseComponentsId;
this.RvSegPsDetail.load();
}
}
// 取水口 的详情 aba27a9b-58b4-4177-afff-cbd1dcd3446c
else if (event.comType == ‘1‘) {
if (event.baseComponentsId != null && event.baseComponentsId != ‘‘) {
this.hiddenAll = true;
this.hiddenPdoBDetail = true;
this.hiddenStBDetail = true;
this.hiddenRvSegPsDetail = true;
this.hiddenIntBDetail = false;
this.IntBDetail.intCd = event.baseComponentsId;
this.IntBDetail.load();
}
}
}
/**
* 从入河排污口详细返回 到列表页面
* @param back
*/
backPdoBList(back) {
if (back != null && back != ‘‘ && back == ‘backPdoBList‘) {
this.hiddenAll = false;
this.hiddenPdoBDetail = true;
this.hiddenStBDetail = true;
this.hiddenRvSegPsDetail = true;
this.hiddenIntBDetail = true;
this.baseComponents.selectedNode = this.selectedNode;
this.baseComponents.page = 0;
this.baseComponents.loadAll();
}
}
/**
* 从水文测站详细返回 到列表页面
* @param back
*/
backStBList(back) {
if (back != null && back != ‘‘ && back == ‘backStBList‘) {
this.hiddenAll = false;
this.hiddenPdoBDetail = true;
this.hiddenStBDetail = true;
this.hiddenRvSegPsDetail = true;
this.hiddenIntBDetail = true;
this.baseComponents.selectedNode = this.selectedNode;
this.baseComponents.page = 0;
this.baseComponents.loadAll();
}
}
/**
* 从公示牌详细返回 到列表页面
* @param back
*/
backRvSegPsList(back) {
if (back != null && back != ‘‘ && back == ‘backRvSegPsList‘) {
this.hiddenAll = false;
this.hiddenPdoBDetail = true;
this.hiddenStBDetail = true;
this.hiddenRvSegPsDetail = true;
this.hiddenIntBDetail = true;
this.baseComponents.selectedNode = this.selectedNode;
this.baseComponents.page = 0;
this.baseComponents.loadAll();
}
}
/**
* 从巡河详细返回 到列表页面
* @param back
*/
backLogList(back) {
if (back != null && back != ‘‘ && back == ‘backLogList‘) {
this.hiddenLogDetail = true;
this.hiddenLog = false;
this.jhiWrRvLog.selectedNode = this.selectedNode;
this.jhiWrRvLog.page = 0;
this.jhiWrRvLog.loadAll();
}
}
/**
* 从取水口详细返回 到列表页面
* @param back
*/
backIntBList(back) {
if (back != null && back != ‘‘ && back == ‘backIntBList‘) {
this.hiddenAll = false;
this.hiddenPdoBDetail = true;
this.hiddenStBDetail = true;
this.hiddenRvSegPsDetail = true;
this.hiddenIntBDetail = true;
this.baseComponents.selectedNode = this.selectedNode;
this.baseComponents.page = 0;
this.baseComponents.loadAll();
}
}
/**
* 页面销毁时的操作
*/
ngOnDestroy() {
}
/**
* 河段树的节点选择事件
* @param node 选中的树节点
*/
onNodeSelect(node) {
this.loading = false;
this.selectedNode = node;
if (this.index == 0) { //加载河段信息
this.jhiWrRvSeg.selectedNode = node;
this.jhiWrRvSeg.page = 0;
this.jhiWrRvSeg.loadAll();
}
if (this.index == 1) {//基础设施与部件
this.baseComponents.selectedNode = node;
this.baseComponents.page = 0;
this.baseComponents.query = {};
this.baseComponents.rvSegIdPath = null;
this.baseComponents.loadAll();
}
if (this.index == 1.1) {//基础设施与部件统计
this.baseComponentsChart.selectedNode = node;
this.baseComponentsChart.selectedNode = this.selectedNode;
this.baseComponentsChart.ngOnInit();
}
// if (this.index == 2) {//水质信息
// }
// if (this.index == 2.1) {//水质信息统计
// }
if (this.index == 2) {//巡河信息
this.wrRvReclist.selectedNode = this.selectedNode;
this.wrRvReclist.page = 0;
this.wrRvReclist.loadAll();
}
if (this.index == 2.1) { //巡河信息统计
this.hiddenRecDetail = true; //隐藏详细巡河信息
this.hiddenRec = true; ///隐藏巡河信息列表
this.wrRvRecChart.selectedNode = this.selectedNode;
this.wrRvRecChart.loadChar();
}
if (this.index == 3) {//
this.jhiWrRvLog.selectedNode = this.selectedNode;
this.jhiWrRvLog.page = 0;
this.jhiWrRvLog.loadAll();
}
if (this.index == 3.1) {
this.index = 3.1;
this.wrRvLogChart.selectedNode = this.selectedNode;
this.wrRvLogChart.ngOnInit();
}
}
}