12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190 |
- app.controller('incidentSetUp', ["$rootScope", "$scope", "$state", "$timeout", "$interval", "SweetAlert", "$modal", "Restangular", "api_bpm_data", "api_solution", "api_user_data","api_wechatfile","api_sysinfo","api_statistic","api_bpm","jry_api_bpm", function($rootScope, $scope, $state, $timeout, $interval, SweetAlert, $modal, Restangular, api_bpm_data, api_solution, api_user_data,api_wechatfile,api_sysinfo,api_statistic,api_bpm,jry_api_bpm) {
- var loginUser = $rootScope.user;
- $scope.xinzeng=false;
- $scope.shanchu=false;
- $scope.bianji=false;
- for(var i=0;i<loginUser.menu.length;i++){
- if(loginUser.menu[i].link=="shijianshezhi_xinzeng"){
- $scope.xinzeng=true
- }
- if(loginUser.menu[i].link=="shijianshezhi_shanchu"){
- $scope.shanchu=true
- }
- if(loginUser.menu[i].link=="shijianshezhi_bianji"){
- $scope.bianji=true
- }
- }
- $scope.listData=[
- {"name":"事件分类"},
- {"name":"事件紧急度"},
- {"name":"事件影响度"},
- {"name":"事件优先级"},
- {"name":"优先级规则"},
- {"name":"工单权重"},
- {"name":"服务级别协议"},
- {"name":"事件来源"},
- {"name":"关闭代码"},
- {"name":"事件状态"},
- {"name":"满意度评价"},
- {"name":"结果类型"}
- ]
- $scope.leftListIdx=0;
- $scope.leftListName="事件分类";
- $scope.leftListCli=function(idx,data){
- $scope.leftListIdx=idx;
- $scope.leftListName=data.name
- }
- // 事件分类开始
- // $scope.langs=i18nService.getAllLangs();
- // $scope.lang = 'zh-cn';
- var loginUser = $rootScope.user;
- //组
- api_user_data.fetchDataList('group', { "idx": 0, "sum": 1000 }).then(function(data) {
- $scope.group = data.list;
- });
- //优先级
- // api_bpm_data.fetchDataList('priority', { "idx": 0, "sum": 10 }).then(function(data) {
- // $scope.priority = data.list;
- // });
- api_wechatfile.getDictionary({"key":"incident_priority","type":"list"}).then(function(data){
- $scope.priority=data
- })
- // 工单权重
- api_wechatfile.getDictionary({"key":"incident_complexity","type":"list"}).then(function(data){
- $scope.complexity=data
- })
- /* ----- tree----- */
- var apple_selected, tree, treedata_avm, treedata_geography;
- //$scope.selectedTreeNode = {};ssss
- var i = 0;
- $scope.out = [];
- $scope.outdata = [];
- var systemtype = [];
- $scope.subdata={};
- $scope.addcate = false;
- $scope.changecate = false;
- // $scope.refreshListData = function(){
- // var data ={"idx":0,"sum":1000};
- // api_bpm_data.fetchDataList('incidentcategory',data).then(function(response){
- // if(response){
- // if(response.status=200){
- // $scope.outdata = response.list;
- // }
- // }
- // })
- // }
- // $scope.refreshListData();
- $scope.filterTree = function (data,id) {
- data = angular.copy(data);
- var newTree = data.filter(x => x.id !== id)
- newTree.forEach(x => x.children && (x.children = $scope.filterTree(x.children,id)))
- return newTree
- }
- var childdata = {};
- $scope.thisParent={};//当前点击节点的父节点
- $scope.userOrGroupType={};//当前节点运维组/运维人员
- $scope.dataSave = [];//储存$scope.tree_data
- $scope.my_tree_handler = function(branch) {
- console.log($scope.dataSave)
- if($scope.dataSave.length === 0){
- $scope.dataSave = angular.copy($scope.tree_data);
- }
- console.log(branch)
- if(branch.parent){
- $scope.tree_data = $scope.filterTree($scope.dataSave,branch.id);
- console.log($scope.tree_data,'过滤后');
- }
- $scope.changecate = true;
- $scope.addcate = false;
- filterData.treeIds = branch.id;
- $scope.selectedTreeNode = branch;
- $scope.output = branch;
- $scope.thisParent=branch.parent||null;
- if($scope.thisParent){
- $scope.thisParent.label=$scope.thisParent.category;
- $scope.thisParent.isExpanded=true;
- $scope.thisParent.selected=true;
- $scope.subdata['parent']=$scope.thisParent
- };
- // console.log($scope.thisParent,$scope.subdata)
- if(branch.hasPlace==1){
- $scope.subdata.hasPlace=true
- }else{
- $scope.subdata.hasPlace=false
- }
-
- convertchildToTree(branch);
- console.log(branch)
- if(branch.userOrGroupType){
- $scope.userOrGroupType['type']=branch.userOrGroupType;
- $scope.userGroupChecked['groupCheck']=branch.group||{};
- $scope.userGroupChecked['userCheck']=branch.handleUser||{};
- }else{
- $scope.userOrGroupType['type']=0;
- $scope.userGroupChecked={}
- }
- // $scope.subdata=branch;
- $scope.subdata.category=branch.label;
- var eqflag = false;
- angular.forEach($scope.outdata, function(item) {
- if (item.id == $scope.output.id) eqflag = true;
- });
- if (eqflag) {
- } else {
- $scope.outdata.push({
- 'name': $scope.output.label,
- 'id': $scope.output.id
- });
- var postData = {
- typeList: []
- };
- if ($scope.outdata.length > 0) {
- angular.forEach($scope.outdata, function(data) {
- postData.typeList.push({ id: data.id });
- })
- }
- // api_solution.findSolutionTypesUser(postData).then(function(response){
- // //Restangular.
- // $scope.userdata = response.data;
- // });
- }
- };
-
- $scope.addType = function(element) {
- $scope.tree_data = angular.copy($scope.dataSave);
- $scope.addcate = true
- $scope.changecate = false
- // var modalInstance = $modal.open({
- // templateUrl: 'assets/views/system/tpl/systemclose.html',
- // controller: function($scope, $modalInstance, api_bpm_data){
- // // api_bpm_data.fetchDataList('closecode',filterData).then(function(data){
- // // var myData = Restangular.stripRestangular(data);
- // // }
- // }
- // });
- }
- /* -----start remove incidet category----- */
- $scope.remove = function(element) {
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/delete.html',
- controller: function($scope, scope, $modalInstance, api_bpm_data) {
- // $scope.title = '优先级删除';
- // $scope.connect = '确定要删除此优先级?';
- $scope.title = "事件分类删除?";
- $scope.connect = "确定要删除此事件分类?";
- $scope.ok = function() {
- $modalInstance.close(element);
- };
- $scope.cancel = function() {
- $modalInstance.dismiss('cancel');
- };
- },
- size: 'sm',
- resolve: {
- scope: function() {
- return $scope;
- }
- }
- });
- modalInstance.result.then(function(selectedItem) {
- if (selectedItem) {
- var rmvList = [];
- rmvList.push(selectedItem.id);
- if (selectedItem.children.length > 0) {
- SweetAlert.swal({
- title: "删除失败!",
- text: "请先删除选中的分类的子级",
- type: "error"
- })
- } else {
- api_bpm_data.rmvData('incidentcategory', rmvList).then(function(response) {
- if (response.data) {
- SweetAlert.swal({
- title: "删除成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- }, function() {
- $scope.try_async_load();
- $scope.$apply($scope.my_data);
- });
- } else {
- SweetAlert.swal({
- title: "操作异常!",
- text: "系统异常,请稍后重试,或者联系管理员!",
- type: "error"
- });
- }
- })
- }
- }
- })
- }
- /* -----end remove incidet category----- */
- function convertchildToTree(datum) {
- $scope.subdata = {};
- if (datum.parent) {
- $scope.subdata = { 'id': datum.id, 'category': datum.label, 'group': datum.group||{}, 'hasPlace': datum.hasPlace, 'hasSimple': datum.hasSimple, 'priority': datum.priority, 'complexity': datum.complexity, 'parent': datum.parent }
- } else {
- $scope.subdata = { 'id': datum.id, 'category': datum.label, 'group': datum.group||{}, 'hasSimple': datum.hasSimple, 'hasPlace': datum.hasPlace, 'priority': datum.priority, 'complexity': datum.complexity }
- }
- }
- 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
- //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?
- // console.log("datum="+JSON.stringify(datum))
- if (typeof datum.parent === "undefined") {
- //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.id];
- //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;
- }
- $scope.onFilterCallback = function(item){
- // $scope.addcategory.parent=item.label;
- $scope.selectedChangeCategory=item;
- console.log(item)
- }
- $scope.parentdata = {};
- $scope.try_async_load = function() {
- $scope.my_data = [];
- $scope.doing_async = true;
- var data = { "idx": 0, "sum": 1000 };
- api_bpm_data.fetchDataList('incidentcategory', data).then(function(response) {
- var data = response.list;
- var objects = [];
- $scope.parentdata = data;
- for (var i = 0; i < data.length; i++) {
- var object = {};
- object.id = data[i].id;
- if (angular.isDefined(data[i].parent)) {
- object.parent = data[i].parent;
- }
- if (angular.isDefined(data[i].hasPlace)) {
- object.hasPlace = data[i].hasPlace;
- }
- if (angular.isDefined(data[i].hasSimple)) {
- object.hasSimple = data[i].hasSimple;
- }
- if (angular.isDefined(data[i].group)) {
- object.group = data[i].group||{};
- }
- if (angular.isDefined(data[i].priority)) {
- object.priority = data[i].priority;
- }
- if (angular.isDefined(data[i].complexity)) {
- object.complexity = data[i].complexity;
- }
- if (angular.isDefined(data[i].handleUser)) {
- object.handleUser = data[i].handleUser||{};
- }
- if(angular.isDefined(data[i].userOrGroupType)){
- object.userOrGroupType=data[i].userOrGroupType;
- }
- object.label = data[i].category;
- // object.actions = data[i][3]; //权限部分
- // object.group = "1";
- // object.user = "2";
- object.state = {
- "opened": true
- };
- object.typeName = "type";
- // if()
- // if (object.actions.indexOf("2") >= 0) { //知识库类型 具有增加权限--系统管理员
- $scope.showAddSolutionType = true;
- // }
- // if (object.actions.indexOf("5") >= 0) { //知识库类型 具有授权权限--系统管理员
- $scope.showReviewKnowledgeType = true;
- // }
- 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;
- }
- });
- };
- $scope.closethis = function(formdata) {
- formdata.category = "";
- formdata.parent.category = "";
- };
- /* -----start submit incidet category----- */
- $scope.userGroupChecked={};//选中人/组数据
- $scope.submitchange = function(formdata) {
- // if (formdata.hasArea) {
- // formdata.hasArea = 1;
- // formdata.hasPlace = 1;
- // } else {
- // formdata.hasArea = 0;
- // formdata.hasPlace = 0;
- // }
-
- if (formdata.hasPlace==true) {
- formdata.hasPlace = 1;
- } else {
- formdata.hasPlace = 0;
- }
- // }
- if (formdata.hasSimple == true) {
- formdata.hasSimple = 1;
- } else {
- formdata.hasSimple = 0;
- }
- // if ($scope.selectedTreeNode.parent) {
- // formdata.parent = { "id": $scope.selectedTreeNode.parent.id };
- // }
- // console.log($scope.thisParent)
-
- if($scope.selectedChangeCategory){
- formdata['parentCategory'] ={'id':$scope.selectedChangeCategory.id};
- delete formdata.parent
- }else if($scope.thisParent){
- formdata['parentCategory'] ={'id':$scope.thisParent.id};
- delete formdata.parent
- }
- // console.log(formdata)
- if($scope.userOrGroupType.type){
- formdata.userOrGroupType=$scope.userOrGroupType.type
- }
- if($scope.userGroupChecked&&$scope.userGroupChecked.groupCheck){
- formdata.group={id:$scope.userGroupChecked.groupCheck.id};
- // delete formdata.handleUser;
- }
- if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck){
- formdata.handleUser={id:$scope.userGroupChecked.userCheck.id};
- // delete formdata.group;
- }
- if($scope.subdata.complexity){
- formdata.complexity=$scope.subdata.complexity
- }
- if($scope.subdata.priority){
- formdata.priority=$scope.subdata.priority
- }
- var filedata = { "incidentcategory": formdata }
- console.log(filedata);
- // return;
- api_bpm_data.updData('incidentcategory', filedata).then(function(response) {
- if (response) {
- if (response.status == 200) {
- $scope.try_async_load()
- SweetAlert.swal({
- title: "修改成功!",
- type: "success"
- }, function() {
- $scope.$apply($scope.my_data);
- })
- } else {
- SweetAlert.swal({
- title: "修改失败!",
- type: "error"
- })
- }
- }
- });
- };
- $scope.adddata = {};
- $scope.addparent = false;
- // 新增保存提交
- $scope.userGroupCheckedAdd={};//选中人/组数据
- $scope.userOrGroupTypeAdd={};//运维组/运维人员
- $scope.submitadd = function(formdata) {
- // var paret = {};
- // var filedata = {};
- // filedata = angular.copy(formdata);
- // delete filedata.addp
- // if (angular.isDefined(formdata.parent) && addparent) {
- // angular.forEach($scope.parentdata, function(data) {
- // if (formdata.parent.category.id == data.id) {
- // filedata = { "incidentcategory": { "category": formdata.category, "parent": { "id": data.id } } }
- // }
- // })
- // } else {
- // filedata = { "incidentcategory": { "category": formdata.category } }
- // }
- // filedata = { "incidentcategory": { "category": formdata.category, "parent": { "id": formdata.parentNode.id } } }
- // if (formdata.hasArea && formdata.hasArea == true) {
- // if (formdata.hasArea) {
- // formdata.hasArea = 1;
- // formdata.hasPlace = 1;
- // } else {
- // formdata.hasArea = 0;
- // formdata.hasPlace = 0;
- // }
- if (formdata.hasPlace == true) {
- formdata.hasPlace = 1;
- } else {
- formdata.hasPlace = 0;
- }
- if (formdata.hasSimple == true) {
- formdata.hasSimple = 1;
- } else {
- formdata.hasSimple = 0;
- }
- if (formdata.parent) {
- formdata['parentCategory'] = { "id": formdata.parent.id };
- delete formdata.parent
- }
- if($scope.userOrGroupTypeAdd.type){
- formdata.userOrGroupType=$scope.userOrGroupTypeAdd.type
- }
- if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.groupCheck){
- formdata.group={id:$scope.userGroupCheckedAdd.groupCheck.id};
- // delete formdata.handleUser;
- }
- if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.userCheck){
- formdata.handleUser={id:$scope.userGroupCheckedAdd.userCheck.id};
- // delete formdata.group;
- }
-
- var filedata = { "incidentcategory": formdata }
- console.log(filedata);
- // return;
- api_bpm_data.addData('incidentcategory', filedata).then(function(response) {
- if (response) {
- if (response.status == 200) {
- $scope.userdata = [];
- $scope.outdata = [];
- $scope.try_async_load();
- SweetAlert.swal({
- title: "增加成功!",
- type: "success"
- })
- } else if (response.status == 408) {
- SweetAlert.swal({
- title: "增加失败!",
- text: response.error,
- type: "error"
- })
- } else {
- SweetAlert.swal({
- title: "增加失败!",
- type: "error"
- })
- }
- }
- });
- };
- /* -----end submit incidet category----- */
- $scope.try_async_load();
- // $scope.ldloading={};
- var filterData = {
- key: 'null',
- status: 0,
- pageIndex: 0,
- pageSum: 10,
- //treeIds:'[]',
- userId: loginUser.id
- }
- // 事件分类结束
- // 事件紧急度开始
- $scope.incident_emergencyData=[];
- $scope.getIncident_emergency=function(){
- var data={
- "key":"incident_emergency",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_emergencyData=res;
- })
- }
- $scope.getIncident_emergency();
- $scope.incident_emergencySave=function(){
- for(var i=0;i<$scope.incident_emergencyData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_emergencyData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_emergency();
- },2000)
- }
- $scope.incident_emergencyReturn=function(){
- $scope.incident_emergencyData[0].name="紧急";
- $scope.incident_emergencyData[1].name="高";
- $scope.incident_emergencyData[2].name="中";
- $scope.incident_emergencyData[3].name="低";
- for(var i=0;i<$scope.incident_emergencyData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_emergencyData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_emergency();
- },2000)
- }
- // 事件紧急度结束
- // 事件影响度开始
- $scope.incident_influenceData=[];
- $scope.getIncident_influence=function(){
- var data={
- "key":"incident_influence",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_influenceData=res;
- })
- }
- $scope.getIncident_influence();
- $scope.incident_influenceSave=function(){
- for(var i=0;i<$scope.incident_influenceData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_influenceData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_influence();
- },2000)
- }
- $scope.incident_influenceReturn=function(){
- $scope.incident_influenceData[0].name="高";
- $scope.incident_influenceData[1].name="中";
- $scope.incident_influenceData[2].name="低";
- for(var i=0;i<$scope.incident_influenceData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_influenceData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_influence();
- },2000)
- }
- // 事件影响度结束
- // 事件状态开始
- $scope.incident_classificationData=[];
- $scope.getIncident_classification=function(){
- var data={
- "key":"incident_status",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_classificationData=res;
- })
- }
- $scope.getIncident_classification();
- $scope.incident_classificationSave=function(){
- for(var i=0;i<$scope.incident_classificationData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_classificationData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_classification();
- },2000)
- }
- $scope.incident_classificationReturn=function(){
- $scope.incident_classificationData[0].name="待接单";
- $scope.incident_classificationData[1].name="处理中";
- $scope.incident_classificationData[2].name="已解决";
- $scope.incident_classificationData[3].name="已关闭";
- $scope.incident_classificationData[4].name="暂存";
- $scope.incident_classificationData[5].name="重新指派";
- for(var i=0;i<$scope.incident_classificationData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_classificationData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_classification();
- },2000)
- }
- // 事件状态结束
- // 满意度评价开始
- $scope.incident_evaluateData=[];
- $scope.getIncident_evaluate=function(){
- var data={
- "key":"incident_degree",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_evaluateData=res;
- })
- }
- $scope.getIncident_evaluate();
- $scope.incident_evaluateSave=function(){
- for(var i=0;i<$scope.incident_evaluateData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_evaluateData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_evaluate();
- },2000)
- }
- $scope.incident_evaluateReturn=function(){
- $scope.incident_evaluateData[0].name="非常满意";
- $scope.incident_evaluateData[1].name="较满意";
- $scope.incident_evaluateData[2].name="满意";
- $scope.incident_evaluateData[3].name="一般";
- $scope.incident_evaluateData[4].name="不满意";
- for(var i=0;i<$scope.incident_evaluateData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_evaluateData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_evaluate();
- },2000)
- }
- // 满意度评价结束
- // 结果类型开始
- $scope.incident_resultData=[];
- $scope.getIncident_result=function(){
- var data={
- "key":"incident_handleresult",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_resultData=res;
- })
- }
- $scope.getIncident_result();
- $scope.incident_resultSave=function(){
- for(var i=0;i<$scope.incident_resultData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_resultData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_result();
- },2000)
- }
- $scope.incident_resultReturn=function(){
- $scope.incident_resultData[0].name="全部解决";
- $scope.incident_resultData[1].name="部分解决";
- $scope.incident_resultData[2].name="未解决";
- $scope.incident_resultData[3].name="其它";
- for(var i=0;i<$scope.incident_resultData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_resultData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_result();
- },2000)
- }
- // 结果类型结束
- // 事件优先级开始
- $scope.incident_priorityData=[];
- $scope.getIncident_priority=function(){
- var data={
- "key":"incident_priority",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_priorityData=res;
- })
- }
- $scope.getIncident_priority();
- $scope.incident_prioritySave=function(){
- for(var i=0;i<$scope.incident_priorityData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_priorityData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_priority();
- },2000)
- }
- $scope.incident_priorityReturn=function(){
- $scope.incident_priorityData[0].name="重大";
- $scope.incident_priorityData[1].name="高";
- $scope.incident_priorityData[2].name="较高";
- $scope.incident_priorityData[3].name="普通";
- for(var i=0;i<$scope.incident_priorityData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_priorityData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_priority();
- },2000)
- }
- // 事件优先级结束
- // 事件工单权重开始
- $scope.incident_complexityData=[];
- $scope.getIncident_complexity=function(){
- var data={
- "key":"incident_complexity",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_complexityData=res;
- })
- }
- $scope.getIncident_complexity();
- $scope.incident_complexitySave=function(){
- for(var i=0;i<$scope.incident_complexityData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_complexityData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_complexity();
- },2000)
- }
- // 没有恢复默认
- // $scope.incident_complexityReturn=function(){
- // $scope.incident_complexityData[0].name="重大";
- // $scope.incident_complexityData[1].name="高";
- // $scope.incident_complexityData[2].name="较高";
- // $scope.incident_complexityData[3].name="普通";
- // for(var i=0;i<$scope.incident_complexityData.length;i++){
- // api_sysinfo.addData('dictionary', $scope.incident_complexityData[i]).then(function(res) {
- // })
- // }
- // SweetAlert.swal({
- // title: "恢复成功!",
- // type: "success",
- // confirmButtonColor: "#007AFF"
- // });
- // $timeout(function(){
- // $scope.getIncident_complexity();
- // },2000)
- // }
- // 事件工单权重结束
- // 服务级别协议开始
- $scope.incident_SLA_Data=[];
- $scope.getIncident_SLA=function(){
- var data={
- "idx":0,
- "sum":10
- };
- jry_api_bpm.jry_getFetchDataList(data,"servicelevelagreement").then(function(res){
- $scope.incident_SLA_Data=res.list
- })
- };
- $scope.getIncident_SLA();
- $scope.incident_SLASave=function(){
- for(var i=0;i<$scope.incident_SLA_Data.length;i++){
- $scope.incident_SLA_Data[i].availabilityDate=$scope.incident_SLA_Data[i].availabilityDate+" 08:00:00";
- $scope.incident_SLA_Data[i].terminationDate=$scope.incident_SLA_Data[i].terminationDate+" 08:00:00";
- var data={
- "servicelevelagreement":$scope.incident_SLA_Data[i]
- }
- jry_api_bpm.jry_editFn(data,"servicelevelagreement").then(function(){
- })
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_SLA();
- },2000)
- }
- }
- $scope.incident_SLAReturn=function(){
- $scope.incident_SLA_Data[0].resolveTime=450;
- $scope.incident_SLA_Data[1].resolveTime=480;
- $scope.incident_SLA_Data[2].resolveTime=480;
- $scope.incident_SLA_Data[3].resolveTime=960;
- $scope.incident_SLA_Data[0].responseTime=30;
- $scope.incident_SLA_Data[1].responseTime=45;
- $scope.incident_SLA_Data[2].responseTime=60;
- $scope.incident_SLA_Data[3].responseTime=240;
- for(var i=0;i<$scope.incident_SLA_Data.length;i++){
- $scope.incident_SLA_Data[i].availabilityDate=$scope.incident_SLA_Data[i].availabilityDate+" 08:00:00";
- $scope.incident_SLA_Data[i].terminationDate=$scope.incident_SLA_Data[i].terminationDate+" 08:00:00";
- var data={
- "servicelevelagreement":$scope.incident_SLA_Data[i]
- }
- jry_api_bpm.jry_editFn(data,"servicelevelagreement").then(function(){
- })
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_SLA();
- },2000)
- }
- }
- // 服务级别协议结束
- // 事件来源开始
- $scope.incident_sourceData=[];
- $scope.getIncident_source=function(){
- var data={
- "key":"incident_source",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_sourceData=res;
- })
- }
- $scope.getIncident_source();
- $scope.incident_sourceSave=function(){
- for(var i=0;i<$scope.incident_sourceData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_sourceData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_source();
- },2000)
- }
- $scope.incident_sourceReturn=function(){
- $scope.incident_sourceData[0].name="电话";
- $scope.incident_sourceData[1].name="留言";
- $scope.incident_sourceData[2].name="微信/web";
- $scope.incident_sourceData[3].name="主动发现";
- $scope.incident_sourceData[4].name="领导指派";
- $scope.incident_sourceData[5].name="其他";
- $scope.incident_sourceData[0].value="phone";
- $scope.incident_sourceData[1].value="record";
- $scope.incident_sourceData[2].value="im";
- $scope.incident_sourceData[3].value="discover";
- $scope.incident_sourceData[4].value="leader";
- $scope.incident_sourceData[5].value="other";
- for(var i=0;i<$scope.incident_sourceData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_sourceData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_source();
- },2000)
- }
- // 事件来源结束
- // 关闭代码开始
- $scope.incident_closecodeData=[];
- $scope.getIncident_closecode=function(){
- var data={
- "key":"incident_closecode",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_closecodeData=res;
- })
- }
- $scope.getIncident_closecode();
- $scope.incident_closecodeSave=function(){
- for(var i=0;i<$scope.incident_closecodeData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_closecodeData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_closecode();
- },2000)
- }
- $scope.incident_closecodeReturn=function(){
- $scope.incident_closecodeData[0].value="060";
- $scope.incident_closecodeData[1].value="061";
- $scope.incident_closecodeData[2].value="062";
- $scope.incident_closecodeData[3].value="063";
- $scope.incident_closecodeData[4].value="064";
- $scope.incident_closecodeData[5].value="065";
- $scope.incident_closecodeData[0].desc="事件已经完全解决";
- $scope.incident_closecodeData[1].desc="事件未能完全解决";
- $scope.incident_closecodeData[2].desc="由服务提供商对事件进行处理";
- $scope.incident_closecodeData[3].desc="事件自行消失";
- $scope.incident_closecodeData[4].desc="事件请求不在服务范围内";
- $scope.incident_closecodeData[5].desc="通过问题或变更流程处理";
- $scope.incident_closecodeData[0].desc="完全解决";
- $scope.incident_closecodeData[1].desc="临时解决";
- $scope.incident_closecodeData[2].desc="供应商解决";
- $scope.incident_closecodeData[3].desc="事件消失";
- $scope.incident_closecodeData[4].desc="拒绝";
- $scope.incident_closecodeData[5].desc="进入其他流程处理";
- for(var i=0;i<$scope.incident_closecodeData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_closecodeData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_closecode();
- },2000)
- }
- // 关闭代码结束
- // 优先级规则开始
- $scope.incident_prioritymatrixAdd=function(){
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/system/tpl/systemprioritymatrix.html',
- controller: function($scope, $modalInstance, api_bpm_data) {
- $scope.prioritymatrixdata={};
- var prioritymatrixInfluenceData={
- "key":"incident_influence",
- "type":"list"
- }
- $scope.prioritymatrixInfluenceData=[];
- api_wechatfile.getDictionary(prioritymatrixInfluenceData).then(function(res){
- $scope.prioritymatrixInfluenceData=res;
- })
- var prioritymatrixEmergencyData={
- "key":"incident_emergency",
- "type":"list"
- }
- $scope.prioritymatrixEmergencyData=[];
- api_wechatfile.getDictionary(prioritymatrixEmergencyData).then(function(res){
- $scope.prioritymatrixEmergencyData=res;
- })
- var prioritymatrixPriorityData={
- "key":"incident_priority",
- "type":"list"
- }
- $scope.prioritymatrixPriorityData=[];
- api_wechatfile.getDictionary(prioritymatrixPriorityData).then(function(res){
- $scope.prioritymatrixPriorityData=res;
- })
- $scope.cancel = function() {
- $modalInstance.dismiss('cancel');
- };
- $scope.savercode = function(prioritymatrixdata) {
- $modalInstance.close(prioritymatrixdata);
- };
- }
- });
- modalInstance.result.then(function(selectedItem) {
- // console.log('selectedItem='+JSON.stringify(selectedItem));
- if (selectedItem) {
- console.log(selectedItem);
- var fildata = { "prioritymatrix": { "priority": { "id": selectedItem.priority.id }, "emergency": { "id": selectedItem.emergency.id }, "influence": { "id": selectedItem.influence.id } } }
- api_bpm_data.addData('prioritymatrix', fildata).then(function(response) {
- if (response) {
- if (response.status == 200) {
- SweetAlert.swal({
- title: "新增成功!",
- type: "success"
- }, function() {
- $scope.getPrioritymatrix()
- })
- } else {
- SweetAlert.swal({
- title: "新增失败!",
- text: "已有此类优先级规则!",
- type: "error"
- })
- }
- }
- })
- }
- });
- }
- $scope.prioritymatrixData=[];
- $scope.getPrioritymatrix=function(){
- var data={
- "idx":0,
- "sum":999
- }
- api_statistic.tableData(data,"prioritymatrix").then(function(res){
- $scope.prioritymatrixData=res.list
- })
- }
- $scope.incident_prioritymatrixSave=function(){
- SweetAlert.swal({
- title: "修改成功!",
- type: "success"
- })
- for(var i=0;i<$scope.prioritymatrixData.length;i++){
- api_bpm.updData("prioritymatrix",{"prioritymatrix":$scope.prioritymatrixData[i]}).then(function(res){
- if(res.status!=200){
- SweetAlert.swal({
- title: "修改失败!",
- text: "已有此类优先级规则,或者规则不合理!",
- type: "error"
- })
- }
- })
- }
- $timeout(function(){
- $scope.getPrioritymatrix()
- },2000)
- }
- $scope.removePrioritymatrix=function(data){
- SweetAlert.swal({
- title: "确认删除?",
- text: "删除的数据不可恢复,请确认继续操作!",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "继续删除",
- cancelButtonText: "取消操作",
- closeOnConfirm: false,
- closeOnCancel: false
- }, function (isConfirm) {
- if (isConfirm) {
- api_bpm_data.rmvData("prioritymatrix",[data.id]).then(function(res){
- console.log(res);
- if(res.status==200){
- SweetAlert.swal({
- title: "删除成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- }, function() {
- $scope.getPrioritymatrix()
- });
- }else{
- SweetAlert.swal({
- title: "删除失败",
- text: "系统错误,请稍后重试!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- }
- })
- } else {
- SweetAlert.swal("操作取消", "数据安全", "error");
- }
- });
- }
- $scope.getPrioritymatrix()
- // 优先级规则结束
- // 获取组数据
- $scope.getGroupList=function(){
- var postData={
- idx: 0,
- sum: 1000,
- group: {selectType: "nouser"}
- }
- api_user_data.fetchDataList('group',postData).then(res=>{
- $scope.groupList=res.list;
- })
- }
- $scope.getGroupList()
- // 获取人数据
- $scope.getUserList=function(){
- var postData={
- idx: 0,
- sum: 1000,
- user: {
- name:'',
- selectType: "pinyin_qs",
- }
- }
- api_user_data.fetchDataList('user',postData).then(res=>{
- $scope.userList=res.list;
- })
- }
- $scope.getUserList()
- }]);
|