Browse Source

事件列表播放录音

seimin 1 month ago
parent
commit
7d589262b3
1 changed files with 70 additions and 1 deletions
  1. 70 1
      assets/js/controllers/incident/incidentCtrl.js

+ 70 - 1
assets/js/controllers/incident/incidentCtrl.js

@@ -443,6 +443,71 @@ app.controller('incidentListCtrl', ["$scope", "$http", "i18nService", "$rootScop
443 443
             }
444 444
         })
445 445
     };
446
+    $scope.play = function (data) {
447
+        console.log(data.callID)
448
+        var modalInstance = $modal.open({
449
+            backdrop: "static",
450
+            templateUrl: 'assets/views/incident/tpl/audio.html',
451
+            controller: function ($rootScope, $scope, $modalInstance, $sce, $http, api_bpm_data) {
452
+                // $rootScope.setbusy();
453
+                $scope.datasurl = "";
454
+                api_bpm_data.fetchDataList("callrecord", {idx: 0, sum: 1, callrecord: {callAccept: data.callID}}).then(function(data) {
455
+                    if(data.status == 200){
456
+                        data.list = data.list || [];
457
+                        if(data.list.length){
458
+                            $scope.audioUrl = $sce.trustAsResourceUrl(callIp+data.list[0].recordingFileName);
459
+                        }
460
+                    }
461
+                });
462
+                // $http({
463
+                //     url: callIp + "/recording/recording?callID=" + data.callID,
464
+                //     method: 'GET',
465
+                //     headers: {},
466
+                // }).success(function (data, status, headers, config) {
467
+                //     $scope.data = {
468
+                //         "name": "视频",
469
+                //         "url": $sce.trustAsResourceUrl("http://" + data.rrpath)
470
+                //     };
471
+                //     $scope.datasurl = data.rrpath;
472
+                // }).error(function (data, status, headers, config) { });
473
+                $scope.download = function (contentId, filename) {
474
+                    $http({
475
+                        url: "http://" + $scope.datasurl,
476
+                        method: 'GET',
477
+                        headers: {
478
+                            'Content-type': 'application/octet-stream',
479
+                        },
480
+                        responseType: 'arraybuffer'
481
+                    }).success(function (data, status, headers, config) {
482
+                        var file = new Blob([data], {
483
+                            type: 'application/octet-stream'
484
+                        });
485
+                        //trick to download store a file having its URL
486
+                        var fileURL = URL.createObjectURL(file);
487
+                        var a = document.createElement('a');
488
+                        a.href = fileURL;
489
+                        a.target = '_blank';
490
+                        a.download = filename;
491
+                        document.body.appendChild(a);
492
+                        a.click();
493
+                    }).error(function (data, status, headers, config) {
494
+                        // console.log(data);
495
+                    });
496
+                }
497
+                $scope.cancel = function () {
498
+                    $modalInstance.dismiss('cancel');
499
+                };
500
+                $modalInstance.close();
501
+
502
+
503
+            },
504
+        });
505
+        modalInstance.result.then(function (result) {
506
+            // $rootScope.setidle();
507
+        }, function (reason) {
508
+            // $rootScope.setidle();
509
+        });
510
+    };
446 511
     $scope.transferTime = function (time) {
447 512
         return moment(time).format('YYYY-MM-DD HH:mm');
448 513
     }
@@ -3355,6 +3420,10 @@ app.controller('IncidentOperCtrl', ['$rootScope', '$http', '$scope', '$modal', '
3355 3420
         $scope.colobject.grid.appScope.play($scope.item);
3356 3421
         // $scope.doEdit($scope.item.id);
3357 3422
     }
3423
+    $scope.play = function () { //record
3424
+        $scope.colobject.grid.appScope.play($scope.item);
3425
+        // $scope.doEdit($scope.item.id);
3426
+    }
3358 3427
     $scope.handler = function () {
3359 3428
         $scope.colobject.grid.appScope.acceptTaskAction($scope.item);
3360 3429
         $scope.doComment($scope.item.id);
@@ -3422,7 +3491,7 @@ app.directive('incidentoperator', function () {
3422 3491
             // '<a ng-click="delSj()" ng-show="{{delFlag&&item.state.value!== \'deleted\'}}" class="assign" >删除</a>' +
3423 3492
             // '<a ng-click="print()" ng-show="dayin" class="bianjifont" >打印</a>' +
3424 3493
             // '<a ng-click="jry_evaluate()"  ng-show="jry_evaluateShow()" class="luyinfont" >评价</a>' +
3425
-            '<a ng-click="record()"  ng-show="{{item.callID}}" class="luyinfont" >录音</a>' +
3494
+            '<a ng-click="play(item)"  ng-show="{{item.callID}}" class="luyinfont" >录音</a>' +
3426 3495
             '<a ng-click="toSms()" ng-show="{{item.huifang&&huifang}}" class="assign" >发送短信</a>' +
3427 3496
             '<a ng-click="toHandlerLog()" ng-show="{{item.huifang&&huifang}}" class="assign" >新增沟通记录</a>' +
3428 3497
             // '<a ng-click="rotate()" ng-show="{{item.state.id==4}}" class="rotate" >转派</a>' +