123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- app.controller('reServiceManagerCtrl', ["$rootScope","$scope","i18nService", "$state", "$timeout", "$interval", "SweetAlert", "$modal", "FileUploader", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular","api_user_data","api_solution","api_bpm_domain","api_bpm_data", function ($rootScope, $scope,i18nService, $state, $timeout, $interval, SweetAlert, $modal, FileUploader, i18nService, uiGridConstants, uiGridGroupingConstants, Restangular, api_user_data, api_solution,api_bpm_domain,api_bpm_data) {
- $scope.langs=i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- var loginUser=$rootScope.user;
- // console.log(' loginUser='+JSON.stringify( loginUser));
- //for test
- // loginUser = {
- // id:2,
- // name:'李进'
- // };
- //console.log(loginUser);
- $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.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes = [10];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = true;
- //var mun = $scope.gridOptions.paginationPageSize;s
- $scope.gridOptions.rowIdentity = function(row) {
- return row.id;
- };
- $scope.gridOptions.getRowIdentity = function(row) {
- return row.id;
- };
-
- $scope.transferTime = function(time){
- return moment(time).format('YYYY-MM-DD ');
- }
-
- $scope.transferStatus = function(status){}
- $scope.gridOptions.columnDefs = [
- /*{
- name: 'item',
- displayName: '编号',
- width: '5%',
- enableFiltering: false
- }, //编号*/
- {
- name: '查看',
- width: '5%',
- enableFiltering: false,
- cellTemplate: '<div class="links cl-effect-1">' +
- '<a class="ui-grid-cell-contents" ng-click="grid.appScope.lookReService(row.entity)" tooltip="查看" tooltip-placement="left"><i class="ti-eye"></i></a>' +
- '</div>'
- }, //查看
- {
- name: '编辑',
- width: '5%',
- enableFiltering: false,
- cellTemplate: '<div class="links cl-effect-1">'+'<a class="ui-grid-cell-contents" ng-click="grid.appScope.editorReService(row.entity)" tooltip="编辑" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>'+'</div>'
- }, //编辑
- {
- name: 'category.recate',
- displayName: '服务目录',
- width: '10%'
- }, //标题
- {
- name: 'stateName',
- displayName: '状态',
- width: '10%'
- }, //状态
- {
- name: 'handlerUser.name',
- displayName: '处理人',
- width: '10%'
- }, //开始时间
- {
- name: 'startDate',
- displayName: '创建时间',
- width: '20%'
- }, //开始时间
- ];
-
- $scope.allfilterData={
- key:'null',
- status:0,
- pageIndex:0,
- pageSum:10,
- //treeIds:'[]',
- userId:loginUser.id
- }
-
- $scope.gridOptions.onRegisterApi = function(gridApi){
- $scope.gridApi = gridApi;
- gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
- var filtersData = $scope.allfilterData;
- // console.log(filtersData)
- filterData.pageIndex = newPage-1;
- var data = {pageIndex:newPage-1};
- var dataFilter = angular.extend(data,filterData);
- dataFilter.status=filtersData.status;
- // console.log(dataFilter)
- $scope.refreshListData('expand-right',dataFilter);
- });
-
- gridApi.selection.on.rowSelectionChanged($scope, function(data){
- $scope.selected.item = data.entity;
- });
-
- };
- this.selectRowFunction = function(data){};
-
-
-
-
- //分类显示
- $scope.onChange = function(searchType) {
- defaultFilterData.status = JSON.parse(sessionStorage.branchReService).id;
- defaultFilterData['searchType'] = searchType;
- if(defaultFilterData.searchType){
- $scope.refreshListData('expand-right', defaultFilterData);
- }
- }
- //数据加载
- $scope.refreshListData = function(style,filterData){
- //$scope.ldloading[style.replace('-', '_')] = true;
- if(angular.isUndefined(filterData)){
- filterData = defaultFilterData;
- }
- if(angular.isDefined($scope.searchTypes)){
- filterData['searchType'] = $scope.searchTypes;
- }
- $scope.myData = [];
- api_bpm_data.fetchServiceTasks(filterData.status,filterData).then(function(data){
- var myData = Restangular.stripRestangular(data);
- $scope.gridOptions.totalItems = myData.resultCount;
- if(angular.isArray(myData.data)){
- $scope.myData = myData.data;
- console.log(myData.data);
- }else{
- SweetAlert.swal({
- title: "数据为空",
- text: myData.data,
- type: "warning"
- });
- }
- });
- }
-
- $scope.newincident = function(data) {
- };
-
- $scope.editorReService = function(data) {
- $state.go('app.reService.editor', {
- formKey: 'inspection_confirm',
- pdKey: 'reService',
- taskId: data.taskId,
- processInstanceId: data.processInstanceId
- });
- }
-
- $scope.lookReService = function(data){
- $state.go('app.reService.detail', {
- formKey: 'inspection_detail',
- pdKey: 'serviceCatalogueProcessActual',
- dataId: data.id,
- processInstanceId: data.processInstanceId
- });
- }
- $scope.editSolution = function(id){}
-
- var apple_selected, tree, treedata_avm, treedata_geography;
- //$scope.selectedTreeNode = {};
-
- $scope.my_tree_handler = function (branch) {
- sessionStorage['branchReService']=JSON.stringify(branch);
- defaultFilterData.status = branch.id;
- //$scope.selectedTreeNode = branch;
- $scope.refreshListData('expand-right', defaultFilterData);
- };
-
- $scope.my_data = [];
- $scope.tree_data = [];
- $scope.my_tree = tree = {};
- function convertListToTree(data, treeMap){
- var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
- var root = null; //Initially set our loop to null
- var parentNode = null;
- //loop over data
- for(var i = 0; i < data.length; i++) {
- var datum = data[i];
- //each node will have children, so let's give it a "children" poperty
- datum.children = [];
- //add an entry for this node to the map so that any future children can
- //lookup the parent
- idToNodeMap[datum.id] = datum;
- //Does this node have a parent?
- if(typeof datum.parent === "undefined" || datum.parent == null) {
- //Doesn't look like it, so this node is the root of the tree
- root = datum;
- treeMap[datum.id] = root;
- } else {
- //This node has a parent, so let's look it up using the id
- parentNode = idToNodeMap[datum.parent];
- //We don't need this property, so let's delete it.
- delete datum.parent;
- //Let's add the current node as a child of the parent node.
- parentNode.children.push(datum);
- }
- }
- return root;
- }
- function convertParentToChildList(data){
- var treeMap = {};
- var list=[];
- convertListToTree(data, treeMap);
- angular.forEach(treeMap,function(item){
- list.push(item);
- });
- return list;
- }
- //var uploader = $scope.uploader = new FileUploader({});
-
- //$scope.removeKnowledgeType = function(){}
- //
- //$scope.editKnowledgeType = function(flag,size){}
- //
- //$scope.createKnowledge = function(size){}
- $scope.my_tree = tree = {};
-
- //树型控件加载
- $scope.try_async_load = function () {
- $scope.my_data = [];
- $scope.doing_async = true;
- api_bpm_data.fetchDataList('requestcategory',{ "idx": 0,"sum": 1000}).then(function(response){
- if(response.status==200){
- var data = response.list;
- var objects = [];
- for (var i = 0; i < data.length; i++) {
- var object = {};
- object.id = data[i].id;
- if(data[i].parent&&data[i].parent.id != 0){
- object.parent = data[i].parent.id;
- }
-
- object.label = data[i].recate;
- object.actions = data[i].actions; //权限部分
- object.group = "1";
- object.user = "2";
- object.state = {
- "opened": true
- };
- object.typeName = "type";
-
- objects.push(object);
- }
- $scope.my_data = convertParentToChildList(objects);
- $scope.tree_data = angular.copy($scope.my_data);
- if($scope.my_data.length>0){
- $scope.doing_async = false;
- }
- }else{
- SweetAlert.swal({
- title: "系统错误!",
- text: "请刷新重试!",
- type: "error"
- });
- }
- });
- $scope.showAddSolutionType = false; //添加知识类型 按钮
- $scope.showReviewKnowledgeType = false; //审核知识类型 按钮
-
- };
-
- var defaultFilterData = {
- assignee : loginUser.id,
- idx : 0 ,
- sum : 10 ,
- status: ''
- }
-
- $scope.refreshListData('expand-right', defaultFilterData);
- $scope.try_async_load();
- //
- //$scope.ldloading={};
- //
- //$scope.statuses = [];
- //
- //$scope.$watch('searchSolutionInput',function(oldvalue,newvalue){});
- //
- //$scope.filterSolutionStatus = function(filterStatus){}
- //
- //$scope.searchSolution = function(){}
- //
- $scope.reload = function(){}
- $scope.reload();
- }]);
-
|