|
|
|
@ -9,20 +9,24 @@ import { NzMessageService } from 'ng-zorro-antd/message';
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-examine', |
|
|
|
|
templateUrl: './examine.component.html', |
|
|
|
|
styleUrls: ['./examine.component.scss'] |
|
|
|
|
styleUrls: ['./examine.component.scss'], |
|
|
|
|
}) |
|
|
|
|
export class ExamineComponent implements OnInit { |
|
|
|
|
constructor( |
|
|
|
|
private http: HttpClient, |
|
|
|
|
private toTree: TreeService, |
|
|
|
|
private methodService: MethodService, |
|
|
|
|
private router: Router, |
|
|
|
|
private message: NzMessageService |
|
|
|
|
) {} |
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient, private toTree: TreeService, private methodService: MethodService, private router: Router, private message: NzMessageService) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echartsOfBar |
|
|
|
|
echartsOfBar; |
|
|
|
|
echartsOfBarOption = { |
|
|
|
|
grid: { |
|
|
|
|
left: '2%', |
|
|
|
|
right: '2%', |
|
|
|
|
top: '18%', |
|
|
|
|
bottom: '16%' |
|
|
|
|
bottom: '16%', |
|
|
|
|
}, |
|
|
|
|
legend: { |
|
|
|
|
top: '3%', |
|
|
|
@ -30,44 +34,46 @@ export class ExamineComponent implements OnInit {
|
|
|
|
|
itemGap: 15, |
|
|
|
|
itemWidth: 10, |
|
|
|
|
itemHeight: 10, |
|
|
|
|
orient: 'horizontal' |
|
|
|
|
orient: 'horizontal', |
|
|
|
|
}, |
|
|
|
|
tooltip: { |
|
|
|
|
trigger: 'axis', |
|
|
|
|
axisPointer: { |
|
|
|
|
type: 'shadow' |
|
|
|
|
} |
|
|
|
|
type: 'shadow', |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
xAxis: { |
|
|
|
|
type: 'category', |
|
|
|
|
data: [], |
|
|
|
|
axisTick: { //x轴刻度尺
|
|
|
|
|
show: false |
|
|
|
|
axisTick: { |
|
|
|
|
//x轴刻度尺
|
|
|
|
|
show: false, |
|
|
|
|
}, |
|
|
|
|
axisLine: {//x轴线条颜色
|
|
|
|
|
axisLine: { |
|
|
|
|
//x轴线条颜色
|
|
|
|
|
show: false, |
|
|
|
|
lineStyle: { |
|
|
|
|
color: '#C7CAD0' |
|
|
|
|
} |
|
|
|
|
color: '#C7CAD0', |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
axisLabel: { |
|
|
|
|
show: true, |
|
|
|
|
interval: 0,//使x轴上的文字显示完全,
|
|
|
|
|
interval: 0, //使x轴上的文字显示完全,
|
|
|
|
|
//设置一行显示几个字,自己设置
|
|
|
|
|
formatter: function (params) { |
|
|
|
|
var newParamsName = ""; |
|
|
|
|
var newParamsName = ''; |
|
|
|
|
var paramsNameNumber = params.length; |
|
|
|
|
var provideNumber = 6; |
|
|
|
|
var rowNumber = Math.ceil(paramsNameNumber / provideNumber); |
|
|
|
|
if (paramsNameNumber > provideNumber) { |
|
|
|
|
for (var p = 0; p < rowNumber; p++) { |
|
|
|
|
var tempStr = ""; |
|
|
|
|
var tempStr = ''; |
|
|
|
|
var start = p * provideNumber; |
|
|
|
|
var end = start + provideNumber; |
|
|
|
|
if (p == rowNumber - 1) { |
|
|
|
|
tempStr = params.substring(start, paramsNameNumber); |
|
|
|
|
} else { |
|
|
|
|
tempStr = params.substring(start, end) + "\n"; |
|
|
|
|
tempStr = params.substring(start, end) + '\n'; |
|
|
|
|
} |
|
|
|
|
newParamsName += tempStr; |
|
|
|
|
} |
|
|
|
@ -75,22 +81,24 @@ export class ExamineComponent implements OnInit {
|
|
|
|
|
newParamsName = params; |
|
|
|
|
} |
|
|
|
|
return newParamsName; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
yAxis: { |
|
|
|
|
type: 'value', |
|
|
|
|
splitLine: {//网格线
|
|
|
|
|
splitLine: { |
|
|
|
|
//网格线
|
|
|
|
|
lineStyle: { |
|
|
|
|
type: 'solid', //设置网格线类型 dotted:虚线 solid:实线
|
|
|
|
|
color: '#ECEFF1' //网格线颜色
|
|
|
|
|
type: 'solid', //设置网格线类型 dotted:虚线 solid:实线
|
|
|
|
|
color: '#ECEFF1', //网格线颜色
|
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
axisLine: {//y轴线条颜色
|
|
|
|
|
axisLine: { |
|
|
|
|
//y轴线条颜色
|
|
|
|
|
show: false, |
|
|
|
|
lineStyle: { |
|
|
|
|
color: '#C7CAD0' |
|
|
|
|
} |
|
|
|
|
color: '#C7CAD0', |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
series: [ |
|
|
|
@ -99,221 +107,274 @@ export class ExamineComponent implements OnInit {
|
|
|
|
|
type: 'bar', |
|
|
|
|
barWidth: 16, // 柱子宽度
|
|
|
|
|
label: { |
|
|
|
|
show: false |
|
|
|
|
show: false, |
|
|
|
|
}, |
|
|
|
|
emphasis: { |
|
|
|
|
focus: 'series' |
|
|
|
|
focus: 'series', |
|
|
|
|
}, |
|
|
|
|
data: [] |
|
|
|
|
data: [], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: '当场整改', |
|
|
|
|
type: 'bar', |
|
|
|
|
barWidth: 16, // 柱子宽度
|
|
|
|
|
label: { |
|
|
|
|
show: false |
|
|
|
|
show: false, |
|
|
|
|
}, |
|
|
|
|
emphasis: { |
|
|
|
|
focus: 'series' |
|
|
|
|
focus: 'series', |
|
|
|
|
}, |
|
|
|
|
data: [] |
|
|
|
|
data: [], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: '推送大队', |
|
|
|
|
type: 'bar', |
|
|
|
|
barWidth: 16, // 柱子宽度
|
|
|
|
|
label: { |
|
|
|
|
show: false |
|
|
|
|
show: false, |
|
|
|
|
}, |
|
|
|
|
emphasis: { |
|
|
|
|
focus: 'series' |
|
|
|
|
focus: 'series', |
|
|
|
|
}, |
|
|
|
|
data: [] |
|
|
|
|
data: [], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: '社会单位数量', |
|
|
|
|
type: 'bar', |
|
|
|
|
barWidth: 16, // 柱子宽度
|
|
|
|
|
label: { |
|
|
|
|
show: false |
|
|
|
|
show: false, |
|
|
|
|
}, |
|
|
|
|
emphasis: { |
|
|
|
|
focus: 'series' |
|
|
|
|
focus: 'series', |
|
|
|
|
}, |
|
|
|
|
data: [] |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
data: [], |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
searchForm = { |
|
|
|
|
or: '', |
|
|
|
|
date: null |
|
|
|
|
} |
|
|
|
|
date: null, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
|
|
|
|
|
this.searchForm.date = this.methodService.getDateOf30() |
|
|
|
|
this.getAllOrganization() |
|
|
|
|
this.searchForm.date = this.methodService.getDateOf30(); |
|
|
|
|
this.getAllOrganization(); |
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.echartsOfBar = echarts.init(document.getElementById('echarts'), null, { devicePixelRatio: 2 }); |
|
|
|
|
this.echartsOfBar = echarts.init( |
|
|
|
|
document.getElementById('echarts'), |
|
|
|
|
null, |
|
|
|
|
{ devicePixelRatio: 2 } |
|
|
|
|
); |
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isLoading = false |
|
|
|
|
expandKeys |
|
|
|
|
defaultOrId: string |
|
|
|
|
isLoading = false; |
|
|
|
|
expandKeys; |
|
|
|
|
defaultOrId: string; |
|
|
|
|
//获取所有组织机构
|
|
|
|
|
nodes: any = [] |
|
|
|
|
nodes: any = []; |
|
|
|
|
getAllOrganization() { |
|
|
|
|
this.isLoading = true |
|
|
|
|
let organizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId |
|
|
|
|
this.isLoading = true; |
|
|
|
|
let organizationId = JSON.parse( |
|
|
|
|
sessionStorage.getItem('userData') |
|
|
|
|
).organizationId; |
|
|
|
|
let params = { |
|
|
|
|
ContainsChildren: "true", |
|
|
|
|
ContainsChildren: 'true', |
|
|
|
|
PageNumber: 1, |
|
|
|
|
PageSize: 9999, |
|
|
|
|
code: '0000' |
|
|
|
|
} |
|
|
|
|
this.http.get('/api/Organizations', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
console.log(data.items) |
|
|
|
|
data.items.forEach(element => { |
|
|
|
|
if (element.id == organizationId) { |
|
|
|
|
element.parentId = null |
|
|
|
|
} |
|
|
|
|
element.key = element.id |
|
|
|
|
element.title = element.name |
|
|
|
|
if (element.level == 'squadron') { |
|
|
|
|
element.isLeaf = true |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.nodes = [...this.toTree.toTree(data.items)] |
|
|
|
|
this.searchForm.or = JSON.parse(sessionStorage.getItem('userData')).organizationId |
|
|
|
|
|
|
|
|
|
code: '0000', |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.get('/api/Organizations', { |
|
|
|
|
params: params, |
|
|
|
|
}) |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
console.log(data.items); |
|
|
|
|
data.items.forEach((element) => { |
|
|
|
|
if (element.id == organizationId) { |
|
|
|
|
element.parentId = null; |
|
|
|
|
} |
|
|
|
|
element.key = element.id; |
|
|
|
|
element.title = element.name; |
|
|
|
|
if (element.level == 'squadron') { |
|
|
|
|
element.isLeaf = true; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.nodes = [...this.toTree.toTree(data.items)]; |
|
|
|
|
this.searchForm.or = JSON.parse( |
|
|
|
|
sessionStorage.getItem('userData') |
|
|
|
|
).organizationId; |
|
|
|
|
|
|
|
|
|
this.getRecord() |
|
|
|
|
}) |
|
|
|
|
this.getRecord(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
search() { |
|
|
|
|
this.getRecord() |
|
|
|
|
this.getRecord(); |
|
|
|
|
} |
|
|
|
|
reset() { |
|
|
|
|
this.searchForm = { |
|
|
|
|
date: this.methodService.getDateOf30(), |
|
|
|
|
or: JSON.parse(sessionStorage.getItem('userData')).organizationId |
|
|
|
|
} |
|
|
|
|
this.getRecord() |
|
|
|
|
or: JSON.parse(sessionStorage.getItem('userData')).organizationId, |
|
|
|
|
}; |
|
|
|
|
this.getRecord(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
showArr = [ |
|
|
|
|
'济南市消防救援支队', |
|
|
|
|
'特勤', |
|
|
|
|
'市中', |
|
|
|
|
'历下', |
|
|
|
|
'槐荫', |
|
|
|
|
'天桥', |
|
|
|
|
'历城', |
|
|
|
|
'长清', |
|
|
|
|
'章丘', |
|
|
|
|
'平阴', |
|
|
|
|
'济阳', |
|
|
|
|
'商河', |
|
|
|
|
'莱芜', |
|
|
|
|
'钢城', |
|
|
|
|
'高新', |
|
|
|
|
'南部', |
|
|
|
|
'起步', |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
listOfData = []; |
|
|
|
|
|
|
|
|
|
getRecord() { |
|
|
|
|
this.isLoading = true |
|
|
|
|
this.http.get('/api/PlanTasks/GetOrgRecheckStat', { |
|
|
|
|
params: { |
|
|
|
|
OrganizationId: this.searchForm.or, |
|
|
|
|
CheckStartTime: moment(this.searchForm.date[0]).format('yyyy-MM-DD') + ' 00:00:00', |
|
|
|
|
CheckEndTime: moment(this.searchForm.date[1]).format('yyyy-MM-DD') + ' 23:59:59' |
|
|
|
|
} |
|
|
|
|
}).subscribe({ |
|
|
|
|
next: (data: any) => { |
|
|
|
|
this.listOfData = [...data] |
|
|
|
|
console.log('统计表格', data) |
|
|
|
|
this.isLoading = false |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.echartsSetData(this.listOfData) |
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
this.isLoading = true; |
|
|
|
|
this.http |
|
|
|
|
.get('/api/PlanTasks/GetOrgRecheckStat', { |
|
|
|
|
params: { |
|
|
|
|
OrganizationId: this.searchForm.or, |
|
|
|
|
CheckStartTime: |
|
|
|
|
moment(this.searchForm.date[0]).format('yyyy-MM-DD') + ' 00:00:00', |
|
|
|
|
CheckEndTime: |
|
|
|
|
moment(this.searchForm.date[1]).format('yyyy-MM-DD') + ' 23:59:59', |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
.subscribe({ |
|
|
|
|
next: (data: any) => { |
|
|
|
|
let num = 100; |
|
|
|
|
data.forEach((item) => { |
|
|
|
|
let sortId = this.showArr.findIndex((v) => { |
|
|
|
|
return item['组织机构'].name.indexOf(v) !== -1; |
|
|
|
|
}); |
|
|
|
|
if (sortId === -1) { |
|
|
|
|
sortId = num; |
|
|
|
|
num += 1; |
|
|
|
|
} |
|
|
|
|
item.sortId = sortId; |
|
|
|
|
}); |
|
|
|
|
data.sort(sort('sortId')); |
|
|
|
|
this.listOfData = [...data]; |
|
|
|
|
this.isLoading = false; |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.echartsSetData(this.listOfData); |
|
|
|
|
}, 0); |
|
|
|
|
}, |
|
|
|
|
error: (err) => {}, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
function sort(prop) { |
|
|
|
|
return function (obj1, obj2) { |
|
|
|
|
var val1 = obj1[prop]; |
|
|
|
|
var val2 = obj2[prop]; |
|
|
|
|
if (!isNaN(Number(val1)) && !isNaN(Number(val2))) { |
|
|
|
|
val1 = Number(val1); |
|
|
|
|
val2 = Number(val2); |
|
|
|
|
} |
|
|
|
|
if (val1 < val2) { |
|
|
|
|
return -1; |
|
|
|
|
} else if (val1 > val2) { |
|
|
|
|
return 1; |
|
|
|
|
} else { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echartsSetData(data) { |
|
|
|
|
this.echartsOfBar.clear(); |
|
|
|
|
|
|
|
|
|
let barData = data |
|
|
|
|
let Barx = [] |
|
|
|
|
let Bary1 = [] |
|
|
|
|
let Bary2 = [] |
|
|
|
|
let Bary3 = [] |
|
|
|
|
let Bary4 = [] |
|
|
|
|
barData.forEach(element => { |
|
|
|
|
Barx.push(element['组织机构'].name) |
|
|
|
|
Bary1.push(element['总隐患数'])//已完成
|
|
|
|
|
Bary2.push(element['当场整改数'])//未完成
|
|
|
|
|
Bary3.push(element['上报数量'])//已完成
|
|
|
|
|
Bary4.push(element['单位数量'])//未完成
|
|
|
|
|
let barData = data; |
|
|
|
|
let Barx = []; |
|
|
|
|
let Bary1 = []; |
|
|
|
|
let Bary2 = []; |
|
|
|
|
let Bary3 = []; |
|
|
|
|
let Bary4 = []; |
|
|
|
|
barData.forEach((element) => { |
|
|
|
|
Barx.push(element['组织机构'].name); |
|
|
|
|
Bary1.push(element['总隐患数']); //已完成
|
|
|
|
|
Bary2.push(element['当场整改数']); //未完成
|
|
|
|
|
Bary3.push(element['上报数量']); //已完成
|
|
|
|
|
Bary4.push(element['单位数量']); //未完成
|
|
|
|
|
}); |
|
|
|
|
this.echartsOfBarOption.xAxis.data = Barx |
|
|
|
|
this.echartsOfBarOption.series[0].data = Bary1 |
|
|
|
|
this.echartsOfBarOption.series[1].data = Bary2 |
|
|
|
|
this.echartsOfBarOption.series[2].data = Bary3 |
|
|
|
|
this.echartsOfBarOption.series[3].data = Bary4 |
|
|
|
|
|
|
|
|
|
this.echartsOfBarOption.xAxis.data = Barx; |
|
|
|
|
this.echartsOfBarOption.series[0].data = Bary1; |
|
|
|
|
this.echartsOfBarOption.series[1].data = Bary2; |
|
|
|
|
this.echartsOfBarOption.series[2].data = Bary3; |
|
|
|
|
this.echartsOfBarOption.series[3].data = Bary4; |
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.echartsOfBar && this.echartsOfBar.setOption(this.echartsOfBarOption); |
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isSubordinate = false |
|
|
|
|
isSubordinate = false; |
|
|
|
|
openSubordinate(item) { |
|
|
|
|
if (item.id != this.searchForm.or && item.level === 'battalion') { |
|
|
|
|
this.isSubordinate = true |
|
|
|
|
this.searchForm.or = item.id |
|
|
|
|
this.getRecord() |
|
|
|
|
this.isSubordinate = true; |
|
|
|
|
this.searchForm.or = item.id; |
|
|
|
|
this.getRecord(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
tableBack() { |
|
|
|
|
this.isSubordinate = false |
|
|
|
|
this.searchForm.or = JSON.parse(sessionStorage.getItem('userData')).organizationId |
|
|
|
|
this.getRecord() |
|
|
|
|
this.isSubordinate = false; |
|
|
|
|
this.searchForm.or = JSON.parse( |
|
|
|
|
sessionStorage.getItem('userData') |
|
|
|
|
).organizationId; |
|
|
|
|
this.getRecord(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
goback() { |
|
|
|
|
this.router.navigate(['/statistic/home']) |
|
|
|
|
this.router.navigate(['/statistic/home']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exportExcel() { |
|
|
|
|
const httpOptions = { |
|
|
|
|
responseType: 'blob' as 'json', |
|
|
|
|
params: { |
|
|
|
|
OrganizationId: this.searchForm.or, |
|
|
|
|
CheckStartTime: moment(this.searchForm.date[0]).format('yyyy-MM-DD') + ' 00:00:00', |
|
|
|
|
CheckEndTime: moment(this.searchForm.date[1]).format('yyyy-MM-DD') + ' 23:59:59', |
|
|
|
|
RecheckStaType: '检查情况' |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
this.http.get(`/api/PlanTasks/ExportOrgRecheckStat`, httpOptions).subscribe({ |
|
|
|
|
next: (data: any) => { |
|
|
|
|
const link = document.createElement('a'); |
|
|
|
|
const blob = new Blob([data], { type: 'application/vnd.ms-excel' }); |
|
|
|
|
link.setAttribute('href', window.URL.createObjectURL(blob)); |
|
|
|
|
link.setAttribute('download', '检查情况统计' + '.xls'); |
|
|
|
|
link.style.visibility = 'hidden'; |
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
link.click(); |
|
|
|
|
document.body.removeChild(link); |
|
|
|
|
this.message.create('success', `导出成功`); |
|
|
|
|
CheckStartTime: |
|
|
|
|
moment(this.searchForm.date[0]).format('yyyy-MM-DD') + ' 00:00:00', |
|
|
|
|
CheckEndTime: |
|
|
|
|
moment(this.searchForm.date[1]).format('yyyy-MM-DD') + ' 23:59:59', |
|
|
|
|
RecheckStaType: '检查情况', |
|
|
|
|
}, |
|
|
|
|
error: err => { |
|
|
|
|
this.message.create('error', `导出失败`); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.get(`/api/PlanTasks/ExportOrgRecheckStat`, httpOptions) |
|
|
|
|
.subscribe({ |
|
|
|
|
next: (data: any) => { |
|
|
|
|
const link = document.createElement('a'); |
|
|
|
|
const blob = new Blob([data], { type: 'application/vnd.ms-excel' }); |
|
|
|
|
link.setAttribute('href', window.URL.createObjectURL(blob)); |
|
|
|
|
link.setAttribute('download', '检查情况统计' + '.xls'); |
|
|
|
|
link.style.visibility = 'hidden'; |
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
link.click(); |
|
|
|
|
document.body.removeChild(link); |
|
|
|
|
this.message.create('success', `导出成功`); |
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
this.message.create('error', `导出失败`); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|