123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- 'use strict';
- app.controller('service_formCtrl', ["$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 = 'ZHTJ';
- //默认显示上一周
- $scope.searchstate = 'none';
- //日期选择
- $scope.nowtimes = moment().format('YYYY-MM-DD')//当前日期;
- //上周
- $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.month = function () {
- $scope.searchstate = "month";
- $scope.starttimes = moment().startOf('month').add(-1, 'M').format('YYYY-MM-DD');
- $scope.endtimes = moment().endOf('month').add(-1, 'M').format('YYYY-MM-DD');
- }
- //去年
- $scope.year = function () {
- $scope.searchstate = "year";
- $scope.starttimes = moment().startOf('year').add(-1, 'y').format('YYYY-MM-DD');
- $scope.endtimes = moment().endOf('year').add(-1, 'y').format('YYYY-MM-DD');
- }
- //近N日
- $scope.day = function (num) {
- num = num > 1 ? num : 1;
- $scope.searchstate = "none";
- $scope.starttimes = moment().subtract(num, "days").format("YYYY-MM-DD");
- $scope.endtimes = moment().subtract(1, "days").format("YYYY-MM-DD");
- }
- //默认显示最近7天
- $scope.day(7);
- //选择上一周,上个月,去年
- $scope.chooseDate = function (date) {
- switch (date) {
- case 'week':
- $scope.week();
- break;
- case 'month':
- $scope.month();
- break;
- case 'year':
- $scope.year();
- break;
- }
- };
- /**
- *日历
- */
- //打开开始日期选择框
- $scope.startOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.endOpened = false;
- $scope.startOpened = !$scope.startOpened;
- };
- //打开结束日期选择框
- $scope.endOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.startOpened = false;
- $scope.endOpened = !$scope.endOpened;
- };
- //重置
- $scope.reload = function(){
- $scope.day(7);
- $scope.searchstate = 'none';
- };
- //选择类型,综合统计,电话统计,微信/WEB统计,电话留言统计
- $scope.active = function (name) {
- $scope.tap = name;
- $scope.reload();
- if ($scope.tap == 'ZHTJ') {//综合统计
- console.log('ZHTJ');
- } else if ($scope.tap == 'DHTJ') {//电话统计
- console.log('DHTJ');
- }else if ($scope.tap == 'WEB') {//微信/WEB统计
- console.log('WEB');
- }else if ($scope.tap == 'DHLYTJ') {//电话留言统计
- console.log('DHLYTJ');
- }
- };
- //综合统计,无限滚动加载
- $scope.topEndComplete = function(){
- console.log('滚动');
- };
- // 请求人
- // api_user_data.fetchDataList('requester', {
- // "idx": 0,
- // "sum": 10
- // }).then(function (response) {
- // if (response) {
- // if (response.status = 200) {
- // $scope.requester = response.list;
- // }
- // }
- // })
- }])
|