12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013 |
- 'use strict';
- app.controller('jry_emergencyCtrl', ["$scope", "i18nService", "$rootScope", "$state", "$timeout", "$interval", "$modal", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_data", "api_text", 'moment','api_wechatfile',
- function($scope, i18nService, $rootScope, $state, $timeout, $interval, $modal, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_data, api_text, moment,api_wechatfile) {
- console.log($scope);
- $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.enableSelectAll = true;
- $scope.gridOptions.enableRowSelection = true;
- $scope.gridOptions.showGridFooter = true;
- $scope.gridOptions.showColumnFooter = false;
- $scope.gridOptions.fastWatch = true;
- $scope.gridOptions.enableSorting = true;
- $scope.gridOptions.useExternalSorting = true;
- $scope.gridOptions.useExternalFiltering = false;
- $scope.gridOptions.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes = [10, 15, 20, 50, 100];
- $scope.gridOptions.paginationPageSize = 15;
- $scope.gridOptions.multiSelect = true;
- var mun = $scope.gridOptions.paginationPageSize;
- // $scope.gridOptions.rowTemplate = "<div ng-click=\"lookFunction(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: 'item',
- displayName: '序号',
- width: 50,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
- '</div>'
- },
- {
- name: 'alarmSystem',
- displayName: '告警来源',
- width: '10%',
- maxWidth:'120',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.alarmSystem}}</div>' +
- '</div>'
- }, {
- name: 'incidentDescription',
- displayName: '告警内容',
- width: '20%',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.alarmContent}}</div>' +
- '</div>'
- }, {
- name: 'requester.name',
- displayName: '告警类型',
- width: '10%',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.alarmType}}</div>' +
- '</div>'
- }, {
- name: 'alarmStatus',
- displayName: '告警状态',
- width: '8%',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.alarmStatus}}</div>' +
- '</div>'
- }, {
- name: 'state',
- displayName: '工单状态',
- width: '8%',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.state.name}}</div>' +
- '</div>'
- }, {
- name: 'address',
- displayName: '定位',
- width: '13%',
- maxWidth:'120',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" > {{row.entity.alarm.alarmLocation}}</div>' +
- '</div>'
- }, {
- name: 'contactsInformation',
- displayName: '紧急度',
- width: '6%',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.alarmSeverity}}</div>' +
- '</div>'
- },
- {
- name: 'createTime',
- displayName: '告警时间',
- width: '140',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{grid.appScope.transferTime(row.entity.alarm.alarmActiveTime)}}</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: '操作',
- enableSorting: false,
- enableFiltering: false,
- width: 295,
- cellTemplate: '<wechatoperator2 item="row.entity" colobject="col">'
- // '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
- // // '<a ng-click="edit()" ng-show="{{handle}}" tooltip="生成事件" tooltip-placement="left"><i class="icon iconfont icon-bianji bianjifont"></i></a>' +
- // '<a ng-click="edit()" ng-if="handle" class="bianjifont">建单</a>' + '<a ng-click="notAccept ()" class="bianjifont">不受理</a>' + '<a ng-click="being ()" class="bianjifont">暂不处理</a>' +
- // // '<a ng-click="look()" ng-show="{{!handle}}" tooltip="查看" tooltip-placement="right"><i class="ti-eye"></i></a>' +
- // '</div>'
- }
- ];
- // console.log(row);
- $scope.wtwt = function(row) {
- console.log(row)
- }
- $scope.value = 10;
- $scope.decrement = function(row) {
- $scope.value = $scope.value - 1;
- };
- $scope.transferTime = function(time) {
- return moment(time).format('YYYY-MM-DD HH:mm');
- }
- // $scope.record = function() {
- // api_text.record($rootScope.takes).then(function(data){
- // if(data.errno==0){
- // $scope.busy=false;
- // }
- // })
- // };
- $scope.gridOptions.onRegisterApi = function(gridApi) {
- // console.log(row);
- $scope.gridApi = gridApi;
- // var index = 0;
- // var oldheader = {};
- // gridApi.grid.sortColumn = function(gridApi) {
- // if (oldheader.field) {
- // if (oldheader.field == gridApi.field) {
- // // index = 0;
- // } else {
- // index = 0;
- // }
- // }
- // index++;
- // oldheader = gridApi;
- // var fildata = $scope.memoryfilterData;
- // if (index % 3 == 0) {
- // delete $scope.memoryfilterData.incident;
- // fildata = $scope.memoryfilterData;
- // } else if (index % 3 == 1) {
- // angular.extend(fildata, { 'incident': { "sort": gridApi.field } });
- // } else if (index % 3 == 2) {
- // angular.extend(fildata, { 'incident': { "sort": gridApi.field, "order": "asc" } });
- // }
- // $scope.refreshData('expand-right', fildata);
- // }
- gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
- var filtersData = $scope.memoryfilterData;
- filtersData.idx = newPage - 1;
- filtersData.sum = pageSize;
- $scope.fileData.idx=newPage - 1;
- $scope.fileData.sum=pageSize;
- $scope.refreshData('expand-right', $scope.fileData);
- // $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,
- 'alarmIncident': {
- "state": ''
- }
- };
- $scope.selectRowFunction = function(data) {
- console.log(data)
- var formdata = {
- // 'model': {
- // 'incident': {
- // 'requester': data.requester,
- // 'area': data.area,
- // 'place': data.place,
- // 'houseNumber': data.address,
- // 'contacts': data.contacts,
- // 'contactsInformation': data.contactsInformation,
- // // 'category': data.wxIncidentClassifyDTO.category,
- // 'description': data.incidentDescription,
- // 'source': { 'id': 4 },
- // 'sourceType': data.sourceType,
- // 'fileUrl': data.fileUrl
- // },
- // 'networkInformation': data.requester,
- // 'flow': data.id
- // }
- 'model':{
- 'incident':{
- 'description':data.alarm.alarmContent,
- 'alarm':data.alarm
- }
- },
- 'alarmIncident': data
- }
- console.log(formdata)
- // if (formdata.alarmIncident.state == '未建单') {
- // formdata.alarmIncident.state = 0;
- // }
- delete(formdata.alarmIncident.item);
- console.log(formdata);
- // if (data.requester.requesterTypeDTO && data.requester.requesterTypeDTO.id == 2) {
- // angular.extend(formdata.model.incident, { 'priority': { 'id': 2 } });
- // }
- if (formdata.alarmIncident.alarm.alarmExtension) {
- formdata.alarmIncident.alarm.alarmExtension = formdata.alarmIncident.alarm.alarmExtension.replace('{', "");
- formdata.alarmIncident.alarm.alarmExtension = formdata.alarmIncident.alarm.alarmExtension.replace('}', "");
- // formdata.alarmIncident.alarm.alarmExtension = formdata.alarmIncident.alarm.alarmExtension.replace(/,/g, '\n');
- }
- console.log(formdata);
- $state.go('app.incident.chart', { 'model': JSON.stringify(formdata) });
- };
- $scope.lookFunction = function(data) {
- var modelfile = { model: { incident: data } };
- // $state.go('app.incident.detail', { formKey: 'incident_back', pdKey: 'incident', dataId: data.id, taskId: data.taskId, processInstanceId: data.processInstanceId });
- if (data.state == "未转换") {
- angular.extend(modelfile.model.incident, { status: 1 })
- } else {
- angular.extend(modelfile.model.incident, { status: 0 })
- }
- $state.go('app.desk.form_editor', { formKey: 'desk_detail', service: 'api_user_data', model: JSON.stringify(modelfile) });
- };
- // $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)
- if (row.entity.alarm.alarmExtension) {
- row.entity.alarm.alarmExtension = row.entity.alarm.alarmExtension.replace('{', "");
- row.entity.alarm.alarmExtension = row.entity.alarm.alarmExtension.replace('}', "");
- row.entity.alarm.alarmExtension = row.entity.alarm.alarmExtension.replace(/,/g, '\n');
- }
- event.stopPropagation();
- var modelfile = { model: row.entity };
- // if (row.entity.state == "未转换") {
- // angular.extend(modelfile.model.incident, { status: 1 })
- // } else {
- // angular.extend(modelfile.model.incident, { status: 0 })
- // }
- console.log(modelfile)
- $state.go('app.desk.form_editor', { formKey: 'desk_emergency', service: 'api_user_data', model: JSON.stringify(modelfile) });
- };
- var defaultFilterData = {
- // "assignee":$rootScope.user.id,
- // "candidateGroups":$rootScope.user.group[0].id,
- "idx": 0,
- "sum": 15,
- alarmIncident: {
- state: '未处理',
- }
- };
- // 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.submit = function(searchType) {
- // api_apply.wxIncidentReject(1, { "rejectRemark": "不受理" }).then(function(data) {
- // if (data && data.status == 200) {
- // SweetAlert.swal({
- // title: "提交成功",
- // text: '不受理提交成功',
- // type: "success",
- // }, function() {
- // $scope.reload();
- // });
- // } else {
- // SweetAlert.swal({
- // title: "提交失败",
- // text: '不受理提交失败',
- // type: "error"
- // });
- // }
- // });
- // }
- $scope.onChange = function(searchType) {
- // console.log(searchType)
- // $scope.searchstate = searchType;
- // defaultFilterData = $scope.memoryfilterData;
- // defaultFilterData['searchType'] = searchType;
- // defaultFilterData.alarmIncident.state = searchType
- // console.log(defaultFilterData)
- $scope.searchstate=searchType;
- $scope.fileData.alarmIncident.state=searchType;
- $scope.refreshData('expand-right',$scope.fileData);
- }
- $scope.refreshData = function(style, filterData) {
- // $scope.ldloading[style.replace('-', '_')] = true;
- // if (angular.isUndefined(filterData)) {
- // filterData = defaultFilterData;
- // }
- // console.log($scope.searchstate);
- // filterData.alarmIncident.state = $scope.searchstate
- // console.log(filterData);
- console.log(filterData);
- $scope.myData = [];
- $scope.gridOptions['sum'] = filterData.sum;
- api_bpm_data.fetchDataList("alarmIncident", filterData, 'alarmIncident').then(function(data) {
- console.log(data)
- var myData6 = Restangular.stripRestangular(data);
- $scope.gridOptions['totalItems'] = myData6.totalNum;
- $scope.myData = myData6.list;
- for (var i = 0; i < $scope.myData.length; i++) {
- $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
- }
- // $scope.handle = false;
- // $scope.notBeing = false;
- // for (var i = 0; i < $scope.myData.length; i++) {
- // $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
- // // $scope.TIME = $scope.myData[i].alarm['alarmActiveTime'];
- // // $scope.myData[i].alarm.alarmActiveTime = moment($scope.TIME).format("YYYY-MM-DD HH:mm:ss");
- // console.log($scope.myData[i]['state'])
- // if ($scope.myData[i]['state'] == '未处理') {
- // $scope.handle = true;
- // $scope.notBeing = true;
- // }
- // else {
- // $scope.handle = false;
- // }
- // if ($scope.myData[i]['state'] == '暂不处理') {
- // $scope.notBeing = false;
- // $scope.handle = true;
- // }
- // }
- // $scope.ldloading[style.replace('-', '_')] = false;
- }, function() {
- // $scope.ldloading[style.replace('-', '_')] = false;
- });
- };
- $scope.dictionaryData=[];
- $scope.getDictionary=function(){
- var data={
- "key":"alarmincident_state",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.dictionaryData=res;
- $scope.fileData={
- "idx":0,
- "sum":mun,
- "alarmIncident":{
- "state":$scope.dictionaryData[0]
- }
- };
- $scope.searchstate = $scope.dictionaryData[0];
- $scope.refreshData('expand-right', $scope.fileData);
- })
- } ;
- $scope.getDictionary();
- }
- ]);
- app.controller('WechatOperCtrl2', ['$rootScope', '$http', '$scope', '$modal', 'SweetAlert', '$state', 'api_bpm_data', function($rootScope, $http, $scope, $modal, SweetAlert, $state, api_bpm_data) {
- $scope.handle = false;
- var loginUser = $rootScope.user;
- console.log($scope.item);
- if ($scope.item.state.name == '未处理') {
- $scope.handle = true;
- $scope.notBeing = true;
- } else {
- $scope.handle = false;
- }
- if ($scope.item.state.name == '暂不处理') {
- $scope.notBeing = false;
- $scope.handle = true;
- }
- // if ($scope.item.alarm.alarmStatus == '恢复') {
- // $scope.notBeing = false;
- // $scope.handle = false;
- // }
- // console.log($scope.notBeing);
- // 处理 --wt
- $scope.edit = function() {
- $scope.colobject.grid.appScope.selectRowFunction($scope.item);
- // $scope.doEdit($scope.item.id);
- // console.log($scope.item)
- }
- // 不处理 --wt
- $scope.notAccept = function() {
- console.log($scope.item);
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/desk/emergencyReason.html',
- controller: function($scope, $modalInstance, SweetAlert, item, $scope1, style, filterData) {
- $scope.ok = function() {
- console.log(item)
- console.log($scope1.colobject.grid.appScope);
- if ($scope.rejectRemark) {
- item.rejectRemark = $scope.rejectRemark;
- item.oprator = $rootScope.user.name;
- delete(item.item);
- console.log(item);
- // item.state = "不受理";
- item.state.id=1605;
- // item = { alarmIncident: item };
- item={"alarmIncident":item};
- api_bpm_data.updData("alarmIncident",item).then(function(data) {
- console.log(data);
- console.log(item)
- SweetAlert.swal({
- title: "提交成功!",
- confirmButtonColor: "#007AFF"
- });
- $modalInstance.dismiss('cancel');
- $scope1.colobject.grid.appScope.refreshData('expand-right', $scope1.colobject.grid.appScope.fileData);
- })
-
- } else {
- SweetAlert.swal({
- title: "不受理原因为空!",
- confirmButtonColor: "#007AFF"
- });
- }
- // $state.go('app.desk.emergency', {});
- };
- $scope.cancel = function() {
- $modalInstance.dismiss('cancel');
- };
- },
- size: 'sm',
- resolve: {
- item: function() {
- return $scope.item;
- },
- $scope1: function() {
- return $scope;
- },
- style: function() {
- return $rootScope.stylewt;
- },
- filterData: function() {
- return $rootScope.filterDatawt;
- }
- }
- });
- // $scope.colobject.grid.appScope.lookFunction($scope.item);
- // $scope.doEdit($scope.item.id);
- };
- // 暂不处理 --wt
- $scope.being = function() {
- console.log($scope.item);
- console.log($scope.colobject.grid.appScope)
- $scope.item.oprator = $rootScope.user.name;
- // $scope.item.state = '暂不处理'
- $scope.item.state.id=1606;
- delete($scope.item.item);
- console.log($scope.item)
- $scope.item = { alarmIncident: $scope.item };
- api_bpm_data.updData("alarmIncident",$scope.item).then(function(data) {
- console.log(data)
- if (data.status == 200) {
- $scope.notBeing = false;
- SweetAlert.swal({
- title: "提交成功!",
- confirmButtonColor: "#007AFF"
- });
- $scope.colobject.grid.appScope.refreshData('expand-right', $scope.colobject.grid.appScope.fileData);
- }
- })
- }
- console.log($scope.handle)
- }]);
- app.directive('wechatoperator2', function() {
- return {
- restrict: 'E',
- scope: {
- item: '=',
- colobject: '='
- },
- controller: 'WechatOperCtrl2',
- template: '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
- // '<a ng-click="edit()" ng-show="{{handle}}" tooltip="生成事件" tooltip-placement="left"><i class="icon iconfont icon-bianji bianjifont"></i></a>' +
- '<a ng-click="edit()" ng-show="{{handle}}" class="bianjifont">建单</a>' + '<a ng-click="notAccept ()" ng-show="{{handle}}" class="bianjifont">不受理</a>' + '<a ng-click="being ()" ng-show="{{notBeing}}" class="bianjifont">暂不处理</a>' +
- // '<a ng-click="look()" ng-show="{{!handle}}" tooltip="查看" tooltip-placement="right"><i class="ti-eye"></i></a>' +
- '</div>'
- };
- });
|