123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697 |
- 'use strict';
- app.controller('deck_reportCtrl', ["$scope", "$rootScope", "$state", "$timeout", "$interval", "$http", "$cookieStore", "SweetAlert", "Restangular", "api_report", "api_statistic", "moment", 'api_user_data', function ($scope, $rootScope, $state, $timeout, $interval, $http, $cookieStore, SweetAlert, Restangular, api_report, api_statistic, moment, api_user_data) {
- $scope.tap = 'LDZS';
- // 选择日期:
- $scope.dateSelected = [{
- name: '近90天',
- id: 0
- }, {
- name: '近1年',
- id: 1
- }, {
- name: '近3年',
- id: 2
- }, {
- name: '近5年',
- id: 3
- }]
- $scope.parameters = {};
- $scope.nowdata = moment(new Date()).format('YYYY/MM/DD HH:ss:mm');
- var weeks = new Date().getDay();
- $scope.starttimes = moment(new Date().getTime() - 86400000 * (weeks + 6)).format('YYYY-MM-DD');
- $scope.endtimes = moment(new Date().getTime() - 86400000 * (weeks)).format('YYYY-MM-DD');
- $scope.changeForm = function (paramDateFrom) {
- $scope.starttimes = moment(paramDateFrom).format('YYYY-MM-DD');
- }
- $scope.changeTo = function (paramDateTo) {
- $scope.endtimes = moment(paramDateTo).format('YYYY-MM-DD');
- }
- $scope.parameters.paramDateFrom = $scope.starttimes;
- $scope.parameters.paramDateTo = $scope.endtimes;
- // n天前
- $scope.GetDateStr = function (AddDayCount) {
- var dd = new Date();
- dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
- var y = dd.getFullYear();
- var m = (dd.getMonth() + 1) < 10 ? "0" + (dd.getMonth() + 1) : (dd.getMonth() + 1); //获取当前月份的日期,不足10补0
- var d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate(); //获取当前几号,不足10补0
- return y + "-" + m + "-" + d;
- }
- //上周
- $scope.week = function () {
- $scope.searchstate = "week";
- var weeks = new Date().getDay();
- $scope.starttimes = moment(new Date().getTime() - 86400000 * (weeks + 6)).format('YYYY-MM-DD');
- $scope.endtimes = moment(new Date().getTime() - 86400000 * (weeks)).format('YYYY-MM-DD');
- $scope.parameters.paramDateFrom = $scope.starttimes;
- $scope.parameters.paramDateTo = $scope.endtimes;
- // $scope.parameters = parseDateParameter($scope.parameters);
- // $scope.mdxquery();
- }
- //上月
- $scope.month = function () {
- $scope.searchstate = "month";
- $scope.starttimes = moment((new Date(moment().startOf('month'))).setMonth((new Date()).getMonth() - 1)).format('YYYY-MM-DD');
- $scope.endtimes = moment((new Date(moment().startOf('month'))).setMonth((new Date()).getMonth()) - 86400000).format('YYYY-MM-DD');
- $scope.parameters.paramDateFrom = $scope.starttimes;
- $scope.parameters.paramDateTo = $scope.endtimes;
- // $scope.parameters = parseDateParameter($scope.parameters);
- // $scope.mdxquery();
- }
- //上年
- //今年(1月1日-至今)
- $scope.year = function () {
- $scope.searchstate = "year";
- $scope.starttimes = moment().startOf('year').format('YYYY-MM-DD');
- $scope.endtimes = moment().format('YYYY-MM-DD');
- $scope.parameters.paramDateFrom = $scope.starttimes;
- $scope.parameters.paramDateTo = $scope.endtimes;
- }
- // 近n年
- $scope.nearYear = function (n) {
- $scope.parameters.paramDateFrom = moment().subtract(n, "years").format("YYYY-MM-DD");
- $scope.parameters.paramDateTo = $scope.endtimes;
- console.log($scope.parameters.paramDateFrom, $scope.parameters.paramDateTo)
- }
- /**
- *日历
- */
- $scope.open = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.opened = !$scope.opened;
- };
- $scope.endOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.startOpened = false;
- $scope.endOpened = !$scope.endOpened;
- };
- $scope.startOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.endOpened = false;
- $scope.startOpened = !$scope.startOpened;
- };
- //选择类型
- $scope.active = function (name) {
- $scope.tap = name
- if ($scope.tap == 'LDZS') {
- setTimeout(function () {
- barechart();
- barechart1();
- }, 500);
- } else {
- setTimeout(function () {
- barechart2();
- barechart3();
- }, 500);
- }
- }
- // 请求人
- api_user_data.fetchDataList('requester', {
- "idx": 0,
- "sum": 10
- }).then(function (response) {
- if (response) {
- if (response.status = 200) {
- $scope.requester = response.list;
- }
- }
- })
- // 选择日期
- $scope.onChangeDate = function (s) {
- console.log(s)
- switch (s) {
- case 0:
- // 最近90天
- console.log('最近90天');
- $scope.parameters.paramDateFrom = $scope.GetDateStr(-90);
- break;
- case 1:
- // 最近一年
- console.log('最近一年');
- $scope.nearYear(1)
- break;
- case 2:
- // 最近三年
- console.log('最近三年');
- $scope.nearYear(3)
- break;
- case 3:
- // 最近五年
- console.log('最近五年');
- $scope.nearYear(5)
- break;
- }
- }
- //图表 来电转换
- function barechart() {
- console.log(echarts)
- var dom = document.getElementById("ldzh");
- console.log(dom)
- var myChart = echarts.init(dom);
- var option = null;
- console.log(myChart)
- myChart.showLoading({
- text: '数据加载中...',
- color: '#c23531',
- textColor: '#fff',
- maskColor: 'rgba(255,255,255,0)',
- zlevel: 0
- });
- myChart.hideLoading();
- option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: { // 坐标轴指示器,坐标轴触发有效
- type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- }
- },
- legend: {
- data: ['正班时间', '值班时间', '非工作时间', '来电转换率'],
- align: 'left',
- // itemWidth:10,
- // itemHeight:10,
- bottom: 0
- },
- grid: {
- left: '.5%',
- right: '0%',
- bottom: '15%',
- containLabel: true
- },
- xAxis: [{
- type: 'category',
- // axisTick: {
- // alignWithLabel: true
- // },
- axisLabel: {
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- }
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- data: ['10-12', '10-12', '10-12', '10-12', '10-12', '10-12', '10-12', '10-12', '10-12']
- }],
- yAxis: [{
- type: 'value',
- scale: true,
- name: '来电数量 (个)',
- min: 0,
- boundaryGap: [0.2, 0.2],
- axisLabel: {
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- }
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- },
- {
- type: 'value',
- scale: true,
- name: '来电转换率',
- min: 0,
- max: 100,
- boundaryGap: [0.2, 0.2],
- axisLabel: {
- formatter: '{value} %',
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- }
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- }
- ],
- series: [{
- name: '正班时间',
- type: 'bar',
- itemStyle: {
- normal: {
- color: '#005395'
- }
- },
- data: [20, 12, 31, 23, 56, 78, 92, 12, 23]
- }, {
- name: '值班时间',
- type: 'bar',
- itemStyle: {
- normal: {
- color: '#1CA58F'
- }
- },
- data: [10, 20, 5, 5, 2, 32, 34, 56, 23]
- }, {
- name: '非工作时间',
- type: 'bar',
- itemStyle: {
- normal: {
- color: '#FFCE3D'
- }
- },
- data: [1, 1, 2, 4, 8, 9, 6, 54, 43]
- },
- {
- name: '来电转换率',
- type: 'line',
- itemStyle: {
- normal: {
- color: '#49A9EE'
- }
- },
- lineStyle: {
- normal: {
- color: '#49A9EE'
- }
- },
- data: [10, 20, 5, 43, 12, 34, 12, 56, 67]
- }
- ]
- };
- if (option && typeof option === "object") {
- myChart.setOption(option);
- myChart.hideLoading();
- }
- }
- //图表 事件趋势
- function barechart1() {
- console.log(echarts)
- var dom = document.getElementById("sjfx");
- console.log(dom)
- var myChart1 = echarts.init(dom);
- var option1 = null;
- console.log(myChart1)
- myChart1.showLoading({
- text: '数据加载中...',
- color: '#c23531',
- textColor: '#fff',
- maskColor: 'rgba(255,255,255,0)',
- zlevel: 0
- });
- myChart1.hideLoading();
- option1 = {
- tooltip: {
- trigger: 'axis',
- axisPointer: { // 坐标轴指示器,坐标轴触发有效
- // type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- lineStyle: {
- color: '#49A9EE',
- type: 'dotted'
- },
- }
- },
- legend: {
- data: ['通话时长'],
- align: 'left',
- // itemWidth:10,
- // itemHeight:10,
- bottom: 0
- },
- grid: {
- left: '.5%',
- right: '0%',
- bottom: '15%',
- top: '10%',
- containLabel: true
- },
- xAxis: [{
- type: 'category',
- // axisTick: {
- // alignWithLabel: true
- // },
- axisLabel: {
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- }
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
- }],
- yAxis: [{
- type: 'value',
- scale: true,
- name: '通话时长 (s)',
- min: 0,
- boundaryGap: [0.2, 0.2],
- axisLabel: {
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- }
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- }, ],
- series: [{
- name: '通话时长',
- type: 'line',
- itemStyle: {
- normal: {
- color: '#005395',
- }
- },
- lineStyle: {
- normal: {
- color: '#005395'
- }
- },
- data: [10, 20, 5, 23, 12, 3, 63, 12, 23, 34, 76, 45]
- }]
- };
- if (option1 && typeof option1 === "object") {
- myChart1.setOption(option1);
- myChart1.hideLoading();
- }
- }
- //图表 来电转换
- function barechart2() {
- console.log(echarts)
- var dom = document.getElementById("sjqs");
- console.log(dom)
- var myChart = echarts.init(dom);
- var option = null;
- console.log(myChart)
- myChart.showLoading({
- text: '数据加载中...',
- color: '#c23531',
- textColor: '#fff',
- maskColor: 'rgba(255,255,255,0)',
- zlevel: 0
- });
- myChart.hideLoading();
- option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: { // 坐标轴指示器,坐标轴触发有效
- type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- }
- },
- legend: {
- data: ['直接处理', '事件派单', '来电转换率'],
- align: 'left',
- // itemWidth:10,
- // itemHeight:10,
- bottom: 0
- },
- grid: {
- left: '.5%',
- right: '0%',
- bottom: '15%',
- containLabel: true
- },
- xAxis: [{
- type: 'category',
- // axisTick: {
- // alignWithLabel: true
- // },
- axisLabel: {
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- }
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- data: ['10-12', '10-12', '10-12', '10-12', '10-12', '10-12', '10-12', '10-12', '10-12']
- }],
- yAxis: [{
- type: 'value',
- scale: true,
- name: '事件数量 (件)',
- min: 0,
- boundaryGap: [0.2, 0.2],
- // axisLabel: {
- // formatter: '{value}'
- // }
- axisLabel: {
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- }
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- },
- {
- type: 'value',
- scale: true,
- name: '来电转换率',
- min: 0,
- max: 100,
- boundaryGap: [0.2, 0.2],
- axisLabel: {
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- },
- formatter: '{value} %'
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- },
- ],
- series: [{
- name: '直接处理',
- type: 'bar',
- itemStyle: {
- normal: {
- color: '#005395'
- }
- },
- data: [20, 12, 31, 23, 56, 78, 92, 12, 23]
- }, {
- name: '事件派单',
- type: 'bar',
- itemStyle: {
- normal: {
- color: '#1CA58F'
- }
- },
- data: [10, 20, 5, 5, 2, 32, 34, 56, 23]
- },
- {
- name: '来电转换率',
- type: 'line',
- itemStyle: {
- normal: {
- color: '#49A9EE'
- }
- },
- lineStyle: {
- normal: {
- color: '#49A9EE'
- }
- },
- data: [10, 20, 5, 43, 12, 34, 12, 56, 67]
- }
- ]
- };
- if (option && typeof option === "object") {
- myChart.setOption(option);
- myChart.hideLoading();
- }
- }
- //图表 来电转换
- function barechart3() {
- console.log(echarts)
- var dom = document.getElementById("sjpd");
- console.log(dom)
- var myChart = echarts.init(dom);
- var option = null;
- console.log(myChart)
- myChart.showLoading({
- text: '数据加载中...',
- color: '#c23531',
- textColor: '#fff',
- maskColor: 'rgba(255,255,255,0)',
- zlevel: 0
- });
- myChart.hideLoading();
- option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: { // 坐标轴指示器,坐标轴触发有效
- type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- }
- },
- legend: {
- data: ['事件派单', '请求重新指派', '派单准确率'],
- align: 'left',
- // itemWidth:10,
- // itemHeight:10,
- bottom: 0
- },
- grid: {
- left: '.5%',
- right: '0%',
- bottom: '15%',
- containLabel: true
- },
- xAxis: [{
- type: 'category',
- // axisTick: {
- // alignWithLabel: true
- // },
- axisLabel: {
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- }
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- data: ['10-12', '10-12', '10-12', '10-12', '10-12', '10-12', '10-12', '10-12', '10-12']
- }],
- yAxis: [{
- type: 'value',
- scale: true,
- name: '事件数量 (件)',
- min: 0,
- boundaryGap: [0.2, 0.2],
- axisLabel: {
- formatter: '{value}',
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- }
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- },
- {
- type: 'value',
- scale: true,
- name: '派单准确率',
- min: 0,
- max: 100,
- boundaryGap: [0.2, 0.2],
- axisLabel: {
- textStyle: {
- color: '#7B7B7B',
- // fontSize: '14',
- },
- formatter: '{value} %'
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#7B7B7B',
- // type: 'dotted'
- },
- },
- }
- ],
- series: [{
- name: '事件派单',
- type: 'bar',
- itemStyle: {
- normal: {
- color: '#005395'
- }
- },
- data: [20, 12, 31, 23, 56, 78, 92, 12, 23]
- }, {
- name: '请求重新指派',
- type: 'bar',
- itemStyle: {
- normal: {
- color: '#1CA58F'
- }
- },
- data: [10, 20, 5, 5, 2, 32, 34, 56, 23]
- },
- {
- name: '派单准确率',
- type: 'line',
- itemStyle: {
- normal: {
- color: '#49A9EE'
- }
- },
- lineStyle: {
- normal: {
- color: '#49A9EE'
- }
- },
- data: [10, 20, 5, 43, 12, 34, 12, 56, 67]
- }
- ]
- };
- if (option && typeof option === "object") {
- myChart.setOption(option);
- myChart.hideLoading();
- }
- }
- setTimeout(function () {
- barechart();
- barechart1();
- }, 1000);
- }])
|