123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- "use strict";
- app.controller("servicePerformanceCtrl", [
- "$scope",
- "$rootScope",
- "$state",
- "$timeout",
- "$interval",
- "$http",
- "$cookieStore",
- "moment",
- "SweetAlert",
- "Restangular",
- "api_report",
- "api_statistic",
- "api_bpm_data",
- "api_user_data",
- "$modal",
- function (
- $scope,
- $rootScope,
- $state,
- $timeout,
- $interval,
- $http,
- $cookieStore,
- moment,
- SweetAlert,
- Restangular,
- api_report,
- api_statistic,
- api_bpm_data,
- api_user_data,
- $modal
- ) {
- $scope.parameters = {};
- $scope.category = {};
- $scope.reportName = "计费";
- $scope.allheight = 100;
- $scope.isMaskground = false;
- $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.starttimes = moment(
- new Date(moment().startOf("month")).setMonth(new Date().getMonth() - 1)
- ).format("YYYY-MM-DD HH:mm:ss");
- $scope.endtimes = moment(
- new Date(moment().startOf("month")).setMonth(new Date().getMonth()) - 1
- ).format("YYYY-MM-DD HH:mm:ss");
- $scope.parameters.paramDateFrom = $scope.starttimes;
- $scope.parameters.paramDateTo = $scope.endtimes;
- $scope.reshdata = function() {
- api_bpm_data
- .serviceCount({
- type: 'serviceCountList',
- startTime: $scope.starttimes,
- finishTime: $scope.endtimes,
- })
- .then(function (response) {
- if (response) {
- if ((response.status = 200)) {
- $scope.isMaskground = false;
- $scope.charginrow = response.data;
- var totalScore = $scope.charginrow.reduce((pre,cur)=>{
- return pre + cur.score;
- },0)
- angular.forEach($scope.charginrow, function(item) {
- if(totalScore){
- item.percent = (item.score * 100 / totalScore).toFixed(2) + '%';
- }else{
- item.percent = '0%';
- }
- })
- if (response.list && response.list.length == 0) {
- $scope.shows = true;
- $scope.empty = "数据为空!";
- }
- }
- }
- });
- }
- $scope.reshdata();
- $scope.reset = function () {
- $scope.parameters = {};
- $scope.starttimes = moment(
- new Date(moment().startOf("month")).setMonth(new Date().getMonth() - 1)
- ).format("YYYY-MM-DD HH:mm:ss");
- $scope.endtimes = moment(
- new Date(moment().startOf("month")).setMonth(new Date().getMonth()) - 1
- ).format("YYYY-MM-DD HH:mm:ss");
- $scope.parameters.paramDateFrom = $scope.starttimes;
- $scope.parameters.paramDateTo = $scope.endtimes;
- $scope.mdxquerym();
- };
- $scope.mdxquerym = function () {
- $scope.starttimes = moment($scope.parameters.paramDateFrom).format(
- "YYYY-MM-DD HH:mm:ss"
- );
- $scope.endtimes = moment($scope.parameters.paramDateTo).format(
- "YYYY-MM-DD HH:mm:ss"
- );
- $scope.isMaskground = true;
- $scope.shows = false;
- $scope.reshdata();
- };
- // 弹窗1
- $scope.servicePerformanceDetail = function(data){
- if(!data.incidentId){
- return;
- }
- $modal.open({
- resolve: {
- scope: function () {
- return $scope;
- },
- },
- size: "lg",
- templateUrl: 'assets/views/customform/tpl/servicePerformanceDetail1.html',
- controller: function ($scope, scope, $modalInstance, api_user_data, SweetAlert, api_wechatfile) {
- $scope.title = "提示";
- $scope.reshdata = function() {
- $scope.isMaskground = true;
- api_bpm_data
- .serviceCount({
- type: 'serviceDaysList',
- userId: data.userId,
- startTime: scope.starttimes,
- finishTime: scope.endtimes,
- })
- .then(function (response) {
- if (response) {
- if ((response.status = 200)) {
- $scope.isMaskground = false;
- $scope.charginrow = response.data;
- if (response.list && response.list.length == 0) {
- $scope.shows = true;
- $scope.empty = "数据为空!";
- }
- }
- }
- });
- }
- $scope.reshdata();
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- // 弹窗2
- $scope.servicePerformanceDetail = function(data){
- $scope.cancel();
- $modal.open({
- resolve: {
- scope: function () {
- return scope;
- },
- },
- size: "lg",
- templateUrl: 'assets/views/customform/tpl/servicePerformanceDetail2.html',
- controller: function ($scope, scope, $modalInstance, api_user_data, SweetAlert, api_wechatfile) {
- $scope.title = "提示";
- $scope.reshdata = function() {
- $scope.isMaskground = true;
- api_bpm_data
- .serviceCount({
- type: 'serviceIncidentList',
- userId: data.userId,
- startTime: data.acceptdate,
- finishTime: data.acceptdate,
- })
- .then(function (response) {
- if (response) {
- if ((response.status = 200)) {
- $scope.isMaskground = false;
- $scope.charginrow = response.data;
- if (response.list && response.list.length == 0) {
- $scope.shows = true;
- $scope.empty = "数据为空!";
- }
- }
- }
- });
- }
- $scope.reshdata();
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- // 弹窗3
- $scope.servicePerformanceDetail = function(data){
- $scope.cancel();
- $modal.open({
- resolve: {
- scope: function () {
- return scope;
- },
- },
- size: "lg",
- templateUrl: 'assets/views/customform/tpl/servicePerformanceDetail3.html',
- controller: function ($scope, scope, $modalInstance, api_user_data, SweetAlert, api_wechatfile) {
- $scope.title = data.category + "-" + data.score;
- $scope.reshdata = function() {
- $scope.isMaskground = true;
- api_bpm_data
- .serviceCount({
- type: 'serviceDetailsList',
- categoryId: data.categoryId,
- userId: data.userId,
- startTime: moment(data.acceptdate).format('YYYY-MM-DD'),
- finishTime: moment(data.acceptdate).format('YYYY-MM-DD'),
- })
- .then(function (response) {
- if (response) {
- if ((response.status = 200)) {
- $scope.isMaskground = false;
- $scope.charginrow = response.data;
- if (response.list && response.list.length == 0) {
- $scope.shows = true;
- $scope.empty = "数据为空!";
- }
- }
- }
- });
- }
- $scope.reshdata();
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- });
- }
- },
- });
- }
- },
- });
- }
- },
- ]);
|