123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- 'use strict';
- app.controller('calllogCtrl', ["$scope", "i18nService", "$rootScope", "$state", "$timeout", "$interval", "$modal", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_data", "api_text", "api_user_data", function($scope, i18nService, $rootScope, $state, $timeout, $interval, $modal, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_data, api_text, api_user_data) {
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- // $(window).resize(function() {
- // // console.log("1111")
- // });
- var loginUser = $rootScope.user;
- // var voiceurl=$rootScope.audioiIp;
- // delete $rootScope.user.authority;
- var pdKey = $state.current.pdKey;
- $scope.gridOptions = {};
- $scope.gridOptions.data = 'myData';
- $scope.gridOptions.enableColumnResizing = true;
- $scope.gridOptions.enableFiltering = false;
- $scope.gridOptions.enableGridMenu = false;
- $scope.gridOptions.enableRowSelection = true;
- $scope.gridOptions.showGridFooter = true;
- $scope.gridOptions.showColumnFooter = false;
- $scope.gridOptions.fastWatch = true;
- // $scope.gridOptions.useExternalFiltering=true;
- $scope.gridOptions.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes = [10];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = true;
- var mun = $scope.gridOptions.paginationPageSize;
- $scope.gridOptions.rowIdentity = function(row) {
- return row.id;
- };
- $scope.gridOptions.getRowIdentity = function(row) {
- return row.id;
- };
- $scope.translateone = function(item) {
- if (item) {
- return '是';
- } else {
- return '否';
- }
- }
- $scope.translatetwo = function(item) {
- if (item) {
- return '呼入';
- } else {
- return '呼出';
- }
- }
- $scope.transferTime = function(time) {
- return moment(time).format('YYYY-MM-DD HH:mm:ss');
- }
- $scope.gridOptions.columnDefs = [{
- name: 'item',
- displayName: '序号',
- width: 50
- }, {
- name: 'ano',
- displayName: '主叫号码',
- width: '10%'
- },
- {
- name: 'bno',
- displayName: '拨打号码',
- width: '10%'
- },
- {
- name: 'begTime',
- displayName: '开始时间',
- width: '15%',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{grid.appScope.transferTime(row.entity.begTime)}} </div>' +
- '</div>'
- }, {
- name: 'endTime',
- displayName: '结束时间',
- width: '15%',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{grid.appScope.transferTime(row.entity.endTime)}}</div>' +
- '</div>'
- }, , {
- name: 'duration',
- displayName: '通话时长(秒)',
- width: '10%'
- }, {
- name: 'isRouteAgent',
- displayName: '是否被座席接听',
- width: '10%',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{grid.appScope.translateone(row.entity.isRouteAgent)}}</div>' +
- '</div>'
- }, {
- name: 'routedDN',
- displayName: '座席工号',
- width: '15%'
- }, {
- name: 'type',
- displayName: '呼入/呼出',
- width: '10%',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{grid.appScope.translatetwo(row.entity.type)}}</div>' +
- '</div>'
- // },
- // {
- // name: '生成事件',
- // width: 80,
- // cellTemplate: '<div class="links cl-effect-1">' +
- // '<a ng-click="grid.appScope.selectRowFunction(row.entity)" tooltip="新建事件" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>' +
- // '</div>'
- }
- // { name: '操作', cellTemplate: '<wechatoperator item="row.entity" colobject="col">', enableFiltering: false }
- ];
- $scope.value = 10;
- $scope.decrement = function() {
- $scope.value = $scope.value - 1;
- };
- $scope.selected = {
- items: []
- }
- $scope.memoryfilterData = defaultFilterData = {
- // "assignee":$rootScope.user.id,
- // "candidateGroups":$rootScope.user.group[0].id,
- "idx": 0,
- "sum": 10
- };
- $scope.type = [{ id: 1, name: '呼入' }, { id: 0, name: '呼出' }]
- var defaultFilterData = {
- // "assignee":$rootScope.user.id,
- // "candidateGroups":$rootScope.user.group[0].id,
- "idx": 0,
- "sum": 10
- };
- $scope.searchkeys = {};
- $scope.chicecalllog = function(item) {
- var fildata = { hjzxCall: {} };
- if (item.ano && item.ano != "") {
- fildata.hjzxCall.ano = item.ano;
- }
- if (item.bno && item.bno != "") {
- fildata.hjzxCall.bno = item.bno;
- }
- if (item.routedDN && item.routedDN != "") {
- fildata.hjzxCall.routedDN = item.routedDN;
- }
- if (item.type && item.type != "") {
- fildata.hjzxCall.type = item.type.id;
- }
- $scope.gridOptions.paginationCurrentPage = 1;
- $scope.refreshData('expand-right', fildata);
- }
- $scope.clear = function() {
- $scope.searchkeys = {};
- $scope.gridOptions.paginationCurrentPage = 1;
- $scope.memoryfilterData = defaultFilterData;
- $scope.refreshData('expand-right');
- }
- $scope.gridOptions.onRegisterApi = function(gridApi) {
- $scope.gridApi = gridApi;
- gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
- var filtersData = $scope.memoryfilterData;
- filtersData.idx = newPage - 1;
- filtersData.sum = pageSize;
- defaultFilterData = filtersData;
- $scope.refreshData('expand-right', filtersData);
- });
- gridApi.selection.on.rowSelectionChanged($scope, function(scope) {
- var j = 0;
- for (var i = 0; i <= scope.grid.appScope.selected.items.length; i++) {
- if (scope.grid.appScope.selected.items[i] == scope.entity) {
- j++;
- break;
- }
- }
- // console.log("j="+j)
- if (j == 1) {
- scope.grid.appScope.selected.items.splice(i, 1);
- } else {
- scope.grid.appScope.selected.items.push(scope.entity)
- }
- });
- gridApi.core.on.filterChanged($scope, function() {
- var grid = this.grid;
- var filtersData = $scope.memoryfilterData;
- angular.forEach(grid.columns, function(item) {
- if (item.enableFiltering) {
- if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
- if (angular.isUndefined(filtersData['user'])) {
- filtersData['notice'] = {};
- filtersData['notice'][item.field] = item.filters[0].term;
- } else {
- filtersData.notice[item.field] = item.filters[0].term;
- }
- }
- }
- });
- $scope.memoryfilterData = filtersData;
- $scope.refreshData('expand-right', filtersData);
- });
- };
- $scope.ldloading = {};
- $scope.refreshData = function(style, filterData) {
- $scope.ldloading[style.replace('-', '_')] = true;
- var faldata = { idx: 0, sum: 10 };
- if (filterData) {
- faldata = angular.extend(faldata, filterData)
- }
- $scope.memoryfilterData = faldata;
- api_bpm_data.fetchDataList("hjzxCall", faldata).then(function(data) {
- var myData = Restangular.stripRestangular(data);
- $scope.gridOptions['totalItems'] = myData.totalNum;
- $scope.myData = myData.list;
- for (var i = 0; i < $scope.myData.length; i++) {
- $scope.myData[i]['item'] = i + 1 + $scope.memoryfilterData.idx * $scope.memoryfilterData.sum
- }
- // console.log($scope.myData)
- $scope.ldloading[style.replace('-', '_')] = false;
- }, function() {
- $scope.ldloading[style.replace('-', '_')] = false;
- });
- };
- $scope.refreshData('expand-right');
- }]);
|