123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- 'use strict';
- app.controller('chartCtrl', ["$scope", "i18nService","$rootScope", "$state", "$timeout", "$interval", "$modal", "SweetAlert" , "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_data","api_text", function ( $scope,i18nService,$rootScope , $state, $timeout, $interval, $modal, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_data,api_text) {
- $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 = true;
- $scope.gridOptions.enableRowSelection = true;
- $scope.gridOptions.showGridFooter = true;
- $scope.gridOptions.showColumnFooter = true;
- $scope.gridOptions.fastWatch = true;
- // $scope.gridOptions.useExternalFiltering=true;
- $scope.gridOptions.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes =[10, 20, 50,100];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = true;
-
- var mun=$scope.gridOptions.paginationPageSize;
- // $scope.gridOptions.rowTemplate= "<div ng-click=\"onDblClick(row)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.uid\" ui-grid-one-bind-id-grid=\"rowRenderIndex + '-' + col.uid + '-cell'\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" role=\"{{col.isRowHeader ? 'rowheader' : 'gridcell'}}\" ui-grid-cell></div>";
- //
-
- $scope.gridOptions.rowIdentity = function(row) {
- return row.id;
- };
- $scope.gridOptions.getRowIdentity = function(row) {
- return row.id;
- };
-
- $scope.gridOptions.columnDefs = [
- { name:'incidentTheme', displayName:'事件主题', width:120,cellTemplate:'<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-click="grid.appScope.lookFunction(row.entity)">{{row.entity.incidentTheme}}</div>'+
- '</div>' },
- // { name:'incidentDescription', displayName:'事件描述', width:160,cellTemplate:'<div>' +
- // '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-click="grid.appScope.lookFunction(row.entity)">{{row.entity.incidentDescription}}</div>'+
- // '</div>' },
- { name:'address', displayName:'地点', width:140,cellTemplate:'<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-click="grid.appScope.lookFunction(row.entity)">{{row.entity.address}}</div>'+
- '</div>' },
- { name:'wxIncidentClassifyDTO.name', displayName:'事件类型', width:120,cellTemplate:'<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-click="grid.appScope.lookFunction(row.entity)">{{row.entity.wxIncidentClassifyDTO.name}}</div>'+
- '</div>' },
- { name:'requester.name', displayName:'请求人', width:120,cellTemplate:'<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-click="grid.appScope.lookFunction(row.entity)">{{row.entity.requester.name}}</div>'+
- '</div>' },
- { name:'state', displayName:'状态', width:120,cellTemplate:'<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-click="grid.appScope.lookFunction(row.entity)">{{row.entity.state}}</div>'+
- '</div>' },
- { name:'state', displayName:'创建时间', width:140,cellTemplate:'<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-click="grid.appScope.lookFunction(row.entity)">{{row.entity.createTime}}</div>'+
- '</div>' },
- { name:'生成事件',enableSorting: false, cellTemplate:'<wxincidentoperator item="row.entity" colobject="col">', width:80,enableFiltering:false}
- // { name:'生成事件', width:80,cellTemplate:'<div class="links cl-effect-1">' +
- // '<a ng-show="{{handlerPower}}" ng-click="grid.appScope.selectRowFunction(row.entity)" tooltip="新建事件" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>'+
- // '</div>' }
- ];
- $scope.value = 10;
- $scope.decrement = function() {
- $scope.value = $scope.value - 1;
- };
- // $scope.record = function() {
- // api_text.record($rootScope.takes).then(function(data){
- // if(data.errno==0){
- // $scope.busy=false;
- // }
- // })
- // };
-
- $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;
- $scope.refreshData('expand-right',filtersData);
- // $scope.refreshData('expand-right', {"assignee":$rootScope.user.id, "candidateGroups":$rootScope.user.group[0].id, "idx":newPage-1,"sum":pageSize});
- });
- $scope.selected = {
- items:[]
- }
-
- };
- $scope.memoryfilterData = defaultFilterData = {
- // "assignee":$rootScope.user.id,
- // "candidateGroups":$rootScope.user.group[0].id,
- "idx":0,
- "sum":mun
- };
-
- $scope.selectRowFunction = function(data){
- var wxincidentdata={}
- api_bpm_data.fetchDataList('incidentsource',{"idx":0,"sum":1000}).then(function(requeste){
- if(requeste.status==200){
- angular.forEach(requeste.list,function(item){
- if(item.code=="im"){
- wxincidentdata=item.id;
- }
- })
- var formdata={
- 'model':{
- 'incident':{
- 'requester':data.requester,
- 'area':data.area,
- 'place':data.place,
- 'houseNumber':data.address,
- 'category':data.wxIncidentClassifyDTO.category,
- 'source':{'id':wxincidentdata},
- 'description':data.incidentDescription
- },
- 'flow':data.id
- }
- }
- $state.go('app.incident.chart',{'model':JSON.stringify(formdata)});
- }
- })
- // var formdata={
- // 'model':{
- // 'incident':{
- // 'requester':data.requester,
- // 'area':data.area,
- // 'place':data.place,
- // 'category':data.wxIncidentClassifyDTO.category,
- // 'source':{'id':wxincidentdata},
- // 'description':data.incidentDescription
- // },
- // 'flow':data.id
- // }
- // }
- // $state.go('app.incident.chart',{'model':JSON.stringify(formdata)});
- };
- $scope.lookFunction = function(data){
- $state.go('app.incident.detail', { formKey:'incident_back', pdKey:'incident', dataId: data.id,taskId:data.taskId,processInstanceId: data.processInstanceId});
- };
- // $scope.followFunction = function(data){
- // //console.log('data='+JSON.stringify(data));
- // $state.go('app.detail', { formKey:'statusform', pdKey:'incident', dataId: data.id,processInstanceId: data.processInstanceId});
-
- // };
- $scope.onDblClick = function(row){
- console.log(row.entity);
- if($rootScope.user.id==row.entity.handlerUser.id){$state.go('app.incident.editor',{taskId:row.entity.taskId,processInstanceId: row.entity.processInstanceId});}
- else{$state.go('app.detail', { formKey:'incident_back', pdKey:'incident', dataId: row.entity.id});}
- };
-
-
-
- var defaultFilterData = {
- // "assignee":$rootScope.user.id,
- // "candidateGroups":$rootScope.user.group[0].id,
- "idx":0,
- "sum":mun
- };
- // if(angular.isDefined($rootScope.search)&&angular.isDefined($rootScope.search.incident)){
- // defaultFilterData['searchType']=$rootScope.search.incident;
- // $scope.searchTypes=$rootScope.search.incident;
- // }
- // if($rootScope['cmdbs']!='incident'){$rootScope.idx=1}
- // if(angular.isDefined($rootScope.idx)&&$rootScope.cmdbs!="false"){
- // $rootScope['cmdbs']='incident';
- // defaultFilterData.idx=$rootScope.idx-1;
- // }else{$rootScope.cmdbs="";}
- $scope.ldloading = {};
- // $scope.Change= function(upTypes){
- // if(angular.isDefined(upTypes)&&upTypes=='upincident'){
- // $state.go('app.problem.incident',{});
- // }
- // else if(angular.isDefined(upTypes)&&upTypes=='upchange'){
- // $state.go('app.change.incident',{});
- // }
-
- // }
- // $scope.onChange= function(searchType){
- // defaultFilterData['searchType'] = searchType;
- // $scope.refreshData('expand-right', defaultFilterData);
- // }
- $scope.handlerPower=
- $scope.refreshData = function(style,filterData){
- $scope.ldloading[style.replace('-', '_')] = true;
- if(angular.isUndefined(filterData)){
- filterData = defaultFilterData;
- }
- $scope.myData = [];
- $scope.gridOptions['sum']=filterData.sum;
- api_bpm_data.fetchDataList("wxincident",filterData).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+filterData.idx*filterData.sum
- // if(){
- // $scope.myData[i]['handlerPower']=true
- // }
- }
- console.log($scope.myData)
- $scope.ldloading[style.replace('-', '_')] = false;
- },function(){
- $scope.ldloading[style.replace('-', '_')] = false;
- });
- };
- $scope.refreshData('expand-right', defaultFilterData);
- }]);
- app.controller('WxincidentOperCtrl', ['$rootScope','$http', '$scope', '$modal',function ($rootScope,$http, $scope, $modal) {
- // console.log('$rootScope.user3='+JSON.stringify($scope.item));
- if($scope.item.state== '已转换'){
- }else{
- $scope.item.handlerPower=true;
- }
-
- $scope.handler = function(){
- $scope.colobject.grid.appScope.selectRowFunction($scope.item);
- // $scope.doComment($scope.item.id);
- }
-
- }]);
- app.directive('wxincidentoperator', function () {
- return {
- restrict: 'E',
- scope:
- {
- item: '=',
- colobject: '='
- },
- controller: 'WxincidentOperCtrl',
- template: '<div class="links cl-effect-1">' +
- '<a ng-click="handler()" class="ui-grid-cell-contents" ng-show="{{item.handlerPower}}" tooltip="编辑" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>'+
- '</div>'
- };
- });
|