123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444 |
- // 'use strict';
- // var appchild = angular.module("myAppchild", []);
- app.controller('childpapeCtrl', ["$scope", "api_report_nx", "$rootScope", "$stateParams", function($scope, api_report_nx, $rootScope, $stateParams) {
- $scope.hearderlist = [];
- $scope.mapheaderdata = [];
- $scope.mapbodydata = [];
- $scope.parameters = {};
- $scope.starttimes = $scope.parameters.paramDateFrom = $stateParams.starttime;
- $scope.endtimes = $scope.parameters.paramDateTo = $stateParams.endtime;
- $scope.startlist = JSON.parse($stateParams.model)
- $scope.nowdata = moment(new Date()).format('YYYY/MM/DD HH:ss:mm');
- /***
- * 故障现象总数
- */
- function incidentClassify() {
- $scope.pielenddata = [];
- $scope.piebodydata = [];
- $scope.hearderlist = [{ name: "事件类别(三级)", value: "type3" }, { name: "事件数量", value: "num" }, { name: "所属类型(二级)", value: "type2" }, { name: "所属类型(一级)", value: "type1" }, { name: "占比", value: "proportion" }];
- api_report_nx.fetchDataList("incidentClassify", { "startTime": $scope.parameters.paramDateFrom, "endTime": $scope.parameters.paramDateTo }).then(function(response) {
- if (response.code == 200) {
- $scope.sum = response.sum;
- $scope.rRows = response.incidentClassifyList;
- angular.forEach(response.incidentClassify, function(item) {
- $scope.pielenddata.push(item.type);
- $scope.piebodydata.push({ "value": item.num, "name": item.type, "proportion": item.proportion });
- })
- pieechart()
- } else {
- }
- });
- }
- incidentClassify()
- /**
- * 处理事件占比
- */
- function incidentHandler() {
- $scope.barlenddata = [];
- $scope.barbodydata = [];
- $scope.hearderlist = [{ name: "处理人", value: "name" }, { name: "完成事件数", value: "num" }, { name: "占比", value: "proportion" }];
- api_report_nx.fetchDataList("incidentHandler", { "startTime": $scope.parameters.paramDateFrom, "endTime": $scope.parameters.paramDateTo }).then(function(response) {
- if (response.code == 200) {
- $scope.rRows = response.incidentHandler;
- angular.forEach(response.incidentHandler, function(item) {
- $scope.barlenddata.push(item.name);
- $scope.barbodydata.push({ "value": item.num, "name": item.name, "proportion": item.proportion });
- })
- barechart()
- } else {
- }
- });
- }
- // incidentHandler()
- /**
- * 问题总数
- */
- function problemClassify() {
- $scope.pielenddata = [];
- $scope.piebodydata = [];
- $scope.hearderlist = [{ name: "问题类别(三级)", value: "type3" }, { name: "问题数量", value: "num" }, { name: "所属类型(二级)", value: "type2" }, { name: "所属类型(一级)", value: "type1" }, { name: "占比", value: "proportion" }];
- api_report_nx.fetchDataList("problemClassify", { "startTime": $scope.parameters.paramDateFrom, "endTime": $scope.parameters.paramDateTo }).then(function(response) {
- if (response.code == 200) {
- $scope.sum = response.sum;
- $scope.rRows = response.problemClassifyList;
- angular.forEach(response.problemClassify, function(item) {
- $scope.pielenddata.push(item.type);
- $scope.piebodydata.push({ "value": item.num, "name": item.type, "proportion": item.proportion });
- })
- pieechart()
- } else {
- }
- });
- }
- /**
- * 处理问题占比
- */
- function problemHandler() {
- $scope.barlenddata = [];
- $scope.barbodydata = [];
- $scope.hearderlist = [{ name: "主责人", value: "name" }, { name: "完成问题数", value: "num" }, { name: "占比", value: "proportion" }];
- api_report_nx.fetchDataList("problemHandler", { "startTime": $scope.parameters.paramDateFrom, "endTime": $scope.parameters.paramDateTo }).then(function(response) {
- if (response.code == 200) {
- $scope.rRows = response.problemHandler;
- angular.forEach(response.problemHandler, function(item) {
- $scope.barlenddata.push(item.name);
- $scope.barbodydata.push({ "value": item.num, "name": item.name, "proportion": item.proportion });
- })
- barechart()
- } else {
- }
- });
- }
- /**
- * 变更总数
- */
- function changeClassify() {
- $scope.pielenddata = [];
- $scope.piebodydata = [];
- $scope.hearderlist = [{ name: "变更类别(三级)", value: "type3" }, { name: "变更数量", value: "num" }, { name: "所属类型(二级)", value: "type2" }, { name: "所属类型(一级)", value: "type1" }, { name: "占比", value: "proportion" }];
- api_report_nx.fetchDataList("changeClassify", { "startTime": $scope.parameters.paramDateFrom, "endTime": $scope.parameters.paramDateTo }).then(function(response) {
- if (response.code == 200) {
- $scope.sum = response.sum;
- $scope.rRows = response.changeClassifyList;
- angular.forEach(response.changeClassify, function(item) {
- $scope.pielenddata.push(item.type);
- $scope.piebodydata.push({ "value": item.num, "name": item.type, "proportion": item.proportion });
- })
- pieechart()
- } else {
- }
- });
- }
- /**
- * 完成变更占比
- */
- function changeHandler() {
- $scope.barlenddata = [];
- $scope.barbodydata = [];
- $scope.hearderlist = [{ name: "主责人", value: "name" }, { name: "完成变更数", value: "num" }, { name: "占比", value: "proportion" }];
- api_report_nx.fetchDataList("changeHandler", { "startTime": $scope.parameters.paramDateFrom, "endTime": $scope.parameters.paramDateTo }).then(function(response) {
- if (response.code == 200) {
- $scope.rRows = response.changeHandler;
- angular.forEach(response.changeHandler, function(item) {
- $scope.barlenddata.push(item.name);
- $scope.barbodydata.push({ "value": item.num, "name": item.name, "proportion": item.proportion });
- })
- barechart()
- } else {
- }
- });
- }
- /**
- * 发布总数
- */
- function releaseClassify() {
- $scope.pielenddata = [];
- $scope.piebodydata = [];
- api_report_nx.fetchDataList("releaseClassify", { "startTime": $scope.parameters.paramDateFrom, "endTime": $scope.parameters.paramDateTo }).then(function(response) {
- if (response.code == 200) {
- $scope.sum = response.sum;
- $scope.rRows = response.releaseClassifyList;
- angular.forEach(response.releaseClassify, function(item) {
- $scope.pielenddata.push(item.name);
- $scope.piebodydata.push({ "value": item.num, "name": item.name, "proportion": item.proportion });
- })
- pieechart()
- } else {
- }
- });
- }
- /**
- * 完成发布占比
- */
- function releaseHandler() {
- $scope.barlenddata = [];
- $scope.barbodydata = [];
- api_report_nx.fetchDataList("releaseHandler", { "startTime": $scope.parameters.paramDateFrom, "endTime": $scope.parameters.paramDateTo }).then(function(response) {
- if (response.code == 200) {
- $scope.rRows = response.releaseHandler;
- angular.forEach(response.releaseHandler, function(item) {
- $scope.barlenddata.push(item.name);
- $scope.barbodydata.push({ "value": item.num, "name": item.name, "proportion": item.proportion });
- })
- barechart()
- } else {
- }
- });
- }
- /**
- * 环形图
- */
- function pieechart() {
- var dom = document.getElementById("report");
- var myChart = echarts.init(dom);
- var app = {};
- var option = null;
- myChart.showLoading({
- text: '数据加载中...',
- color: '#c23531',
- textColor: '#fff',
- maskColor: 'rgba(255,255,255,0)',
- zlevel: 0
- });
- myChart.hideLoading();
- option = {
- // graphic: {
- // elements: [{
- // type: 'text',
- // // position: ['20%', '35%'],
- // style: {
- // text: $scope.sum,
- // font: {
- // color: '#005395',
- // fontSize: '42px',
- // },
- // },
- // left: '20%',
- // top: '50%'
- // }]
- // },
- // title: {
- // text: $scope.startlist.title,
- // left: '15%',
- // top: '35%',
- // // position: ['20%', '35%'],
- // textStyle: {
- // color: '#333',
- // fontSize: 16,
- // align: 'center'
- // }
- // },
- title: [{
- text: $scope.sum,
- x: '16%',
- y: '50%',
- textStyle: {
- fontSize: 42,
- fontWeight: 'normal',
- fontStyle: 'normal',
- color: '#005395'
- }
- }, {
- text: $scope.startlist.title,
- x: '15%',
- y: '40%',
- textStyle: {
- fontSize: 16,
- fontWeight: 'normal',
- fontStyle: 'normal',
- align: 'center',
- color: '#333'
- }
- }],
- tooltip: {
- "backgroundColor": "rgba(0,0,0,9)",
- "textStyle": {
- "fontSize": 12,
- "color": '#f9f9f9',
- },
- trigger: 'item',
- formatter: "{a} <br/>{b}: {c} ({d}%)"
- },
- legend: {
- orient: 'vertical',
- x: '40%',
- y: 'center',
- itemGap: 40,
- data: $scope.pielenddata,
- formatter: function(param) {
- for (var i = 0; i < $scope.pielenddata.length; i++) {
- if ($scope.piebodydata[i].name == param) {
- return ' ' + $scope.piebodydata[i].name + ' ' + $scope.piebodydata[i].value + ' ' + $scope.piebodydata[i].proportion;
- }
- }
- }
- },
- series: [{
- name: $scope.startlist.title,
- type: 'pie',
- radius: ['70%', '85%'],
- center: ['20%', '50%'],
- color: ['#315b7e', '#3370a1', '#1a3a53', '#61829d', '#8496A5', '#e6eef4', '#15598F', '#61829d', '#5F9FD1', '#7EAFD6'],
- hoverAnimation: true,
- label: {
- normal: {
- show: false,
- position: 'center'
- },
- // emphasis: {
- // show: true,
- // textStyle: {
- // fontSize: '30',
- // fontWeight: 'bold'
- // }
- // }
- },
- labelLine: {
- normal: {
- show: false
- }
- },
- data: $scope.piebodydata
- }]
- };
- if (option && typeof option === "object") {
- myChart.setOption(option, true);
- myChart.hideLoading();
- }
- }
- // }, 1000)
- /***
- * 柱状图
- */
- function hardDisks(data) {
- if ($scope.sum == 0) {
- return 0;
- } else {
- }
- return data / $scope.sum;
- }
- function barechart() {
- var dom = document.getElementById("barreport");
- var mybarChart = echarts.init(dom);
- var app = {};
- var optionbar = null;
- mybarChart.showLoading({
- text: '数据加载中...',
- color: '#c23531',
- textColor: '#fff',
- maskColor: 'rgba(255,255,255,0)',
- zlevel: 0
- });
- mybarChart.hideLoading();
- optionbar = {
- title: {
- // text: '(件)故障数量',
- x: '10',
- y: '0',
- textStyle: {
- fontWeight: 'normal',
- fontSize: 12,
- color: "#56c9ff",
- }
- },
- xAxis: {
- axisTick: {
- show: false
- },
- splitLine: {
- show: false
- },
- splitArea: {
- show: false
- },
- // data: XData,
- data: $scope.barlenddata,
- axisLine: {
- lineStyle: {
- color: '#eaeaea'
- }
- },
- axisLabel: {
- textStyle: {
- color: '#999',
- fontSize: 14,
- }
- },
- },
- yAxis: {
- axisTick: {
- show: false
- },
- splitLine: {
- show: false
- },
- splitArea: {
- show: false
- },
- minInterval: 1,
- axisLabel: {
- show: true,
- textStyle: {
- color: '#999',
- fontSize: 14,
- }
- },
- axisLine: {
- show: false,
- lineStyle: {
- color: '#eaeaea'
- }
- },
- splitLine: {
- lineStyle: {
- color: "#eaeaea"
- }
- }
- },
- grid: {
- left: 10,
- top: 25,
- bottom: 0,
- right: 10,
- containLabel: true
- },
- "tooltip": {
- "trigger": "item",
- "backgroundColor": "rgba(0,0,0,9)",
- "textStyle": {
- "fontSize": 12,
- "color": '#f9f9f9',
- },
- formatter: function(data) {
- return $scope.startlist.tip1 + ':' + data.value + '<br />' + $scope.startlist.tip2 + ':' + data.data.proportion + '%';
- },
- },
- series: {
- type: "bar",
- itemStyle: {
- normal: {
- color: function(params) {
- // type = 'linear';
- // var colorList = [
- // '#005395'
- // ];
- return '#005395'
- },
- }
- },
- label: {
- normal: {
- show: true,
- position: 'top',
- textStyle: {
- // color: '#56c9ff'
- }
- }
- },
- barWidth: 18,
- // barWidth: '30%',
- // data: yData
- data: $scope.barbodydata
- }
- };
- if (optionbar && typeof optionbar === "object") {
- mybarChart.setOption(optionbar, true);
- mybarChart.hideLoading();
- }
- }
- }])
|