123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017 |
- '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) {
- if(time){
- return moment(time).format('YYYY-MM-DD HH:mm');
- }else{
- return '无';
- }
- }
- // $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>'
- };
- });
|