12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247 |
- 'use strict';
- app.controller('event_formCtrl', ["$scope", "$rootScope", "$state", "$timeout", "$interval", "$http", "$cookieStore", "SweetAlert", "Restangular", "api_report", "api_statistic", "moment", "api_event_form", "api_user_data", "api_bpm", "api_category", "$modal", "i18nService", function ($scope, $rootScope, $state, $timeout, $interval, $http, $cookieStore, SweetAlert, Restangular, api_report, api_statistic, moment, api_event_form, api_user_data, api_bpm, api_category, $modal, i18nService) {
- //默认显示事件总数
- $scope.tap = 'SJZS';
- //默认无选中,选择日期
- $scope.searchstate = 'none';
- //默认按日统计
- $scope.dateItem = 'day';
- //按日
- $scope.dayByClick = function () {
- $scope.datepickerPopuptime = 'yyyy-MM-dd';//日期格式化
- $scope.day(7);//近7天
- };
- //按月
- $scope.monthByClick = function () {
- $scope.datepickerPopuptime = 'yyyy-MM';
- $scope.month(1);
- };
- //按年
- $scope.yearByClick = function () {
- $scope.datepickerPopuptime = 'yyyy';
- $scope.year(1);
- };
- //日期显示格式
- $scope.datepickerPopuptime = 'yyyy-MM-dd';
- //按日/月/年统计
- $scope.dateItemClick = function (str) {
- $scope.dateItem = str;
- switch (str) {
- case 'day':
- $scope.dayByClick();
- break;
- case 'month':
- $scope.monthByClick();
- break;
- case 'year':
- $scope.yearByClick();
- break;
- }
- };
- // 事件详情
- $scope.toDetail= function(rowData, own, searchCriteria, type){
- console.log(rowData, own, searchCriteria, type);
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/incident/tpl/order.tpl.html',
- controller: function ($scope, scope, $rootScope, $modalInstance, Alert, api_user_data) {
- console.log(rowData, own, type);
- $scope.type = type;
- $scope.detailsTypeList = [
- {type: 'default', name: '事件详情', columnName: '事件详情'},
- {type: 'handlingPersonnelUser', name: '人员统计', columnName: '人员姓名'},
- {type: 'department', name: '科室统计', columnName: '科室名称'},
- {type: 'building', name: '楼栋统计', columnName: '楼栋名称'},
- {type: 'floor', name: '楼层统计', columnName: '楼栋楼层名称'},
- ];
- $scope.detailsType = "default";
- $scope.own = {
- handlingPersonnelUser: undefined,
- department: undefined,
- area: undefined,
- place: undefined,
- }
- $scope.columnDefs = [
- {
- name: 'acceptDate',
- displayName: '登记时间',
- width: 100,
- cellTemplate: '<div style="width: 100%;">' +
- '<div class="ui-grid-cell-contents">{{grid.appScope.transferTime(row.entity.acceptDate, "YYYY-MM-DD")}}<br>{{grid.appScope.transferTime(row.entity.acceptDate, "HH:mm")}}</div>' +
- '</div>'
- },
- {
- name: 'incidentsign',
- displayName: '单号',
- width: 110,
- cellTemplate: '<div style="width: 100%;">' +
- '<div class="ui-grid-cell-contents table_hover" ng-click="grid.appScope.toIncidentDetail(row.entity)">{{row.entity.incidentsign}}</div>' +
- '</div>'
- },
- {
- name: 'department',
- displayName: '报修科室',
- width: 130,
- cellTemplate: '<div style="width: 100%;">' +
- '<div class="ui-grid-cell-contents" title="{{row.entity.department ? row.entity.department.dept : \"无\"}}">{{row.entity.department ? row.entity.department.dept : "无"}}</div>' +
- '</div>'
- },
- {
- name: 'description',
- displayName: '故障描述',
- width: 125,
- cellTemplate: '<div style="width: 100%;">' +
- '<div class="ui-grid-cell-contents" title="{{row.entity.description}}">{{row.entity.description}}</div>' +
- '</div>'
- },
- {
- name: 'areaPlace',
- displayName: '楼栋楼层',
- width: 125,
- cellTemplate: '<div style="width: 100%;"><div class="ui-grid-cell-contents" ng-bind-html="grid.appScope.areaplace(row.entity)"></div></div>'
- },
- {
- name: 'groupORHandlerUser',
- displayName: '处理人',
- width: 85,
- },
- {
- name: 'row8',
- displayName: '响应时长',
- width: 100,
- },
- {
- name: 'row9',
- displayName: '解决时长',
- width: 100,
- },
- {
- name: 'degree.name',
- displayName: '满意度',
- width: 70,
- },
- ];
- $scope.areaplace = function (data) {
- var str = '';
- str += (data.place ? (data.place.area ? data.place.area.area : '') : '');
- str += (data.place ? (data.place.place ? data.place.place : '') : '');
- return str || '无';
- }
- $scope.gridOptions = {};
- $scope.gridOptions.columnDefs = $scope.columnDefs;
- $scope.gridOptions.rowHeight = 54;
- $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, 20, 50, 100];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = true;
- $scope.gridOptions.onRegisterApi = function (gridApi) {
- gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
- $scope.getData(newPage - 1, pageSize);
- });
- }
- // ---------------start
- $scope.columnDefs1 = [
- {
- name: $scope.detailsType,
- displayName: $scope.detailsTypeList.find(v => v.type == $scope.detailsType).columnName,
- width: "20%",
- cellTemplate: $scope.detailsType === "floor" ? '<div style="width: 100%;">' +
- '<div class="ui-grid-cell-contents">{{row.entity.building}} {{row.entity.floor}}</div>' +
- '</div>' : '<div style="width: 100%;">' +
- '<div class="ui-grid-cell-contents">{{row.entity.'+ $scope.detailsType + '}}</div>' +
- '</div>'
- },
- {
- name: 'sum',
- displayName: '事件数量',
- width: "20%",
- },
- {
- name: 'responseTime',
- displayName: '平均响应时长',
- width: "20%",
- },
- {
- name: 'resolvedTime',
- displayName: '平均解决时长',
- width: "20%",
- },
- {
- name: 'proportion',
- displayName: '占比',
- width: "20%",
- },
- ];
- $scope.gridOptions1 = {};
- $scope.gridOptions1.columnDefs = $scope.columnDefs1;
- $scope.gridOptions1.rowHeight = 54;
- $scope.gridOptions1.data = 'myData1';
- $scope.gridOptions1.enableColumnResizing = true;
- $scope.gridOptions1.enableFiltering = false;
- $scope.gridOptions1.enableGridMenu = true;
- $scope.gridOptions1.enableSelectAll = true;
- $scope.gridOptions1.enableRowSelection = true;
- $scope.gridOptions1.showGridFooter = true;
- $scope.gridOptions1.showColumnFooter = false;
- $scope.gridOptions1.fastWatch = true;
- $scope.gridOptions1.enableSorting = true;
- $scope.gridOptions1.useExternalSorting = true;
- $scope.gridOptions1.useExternalFiltering = false;
- $scope.gridOptions1.useExternalPagination = true;
- $scope.gridOptions1.paginationPageSizes = [10, 20, 50, 100];
- $scope.gridOptions1.paginationPageSize = 10;
- $scope.gridOptions1.multiSelect = true;
- // ---------------end
- $scope.transferTime = function (time, type) {
- if(time){
- return moment(time).format(type);
- }else{
- return '无';
- }
- }
- $scope.toIncidentDetail = function (data) {
- $scope.cancel();
- // $state.go('app.incident.detail', {
- // formKey: 'incident_back',
- // pdKey: 'incident',
- // dataId: data.id,
- // taskId: data.taskId,
- // processInstanceId: data.processInstanceId
- // });
- window.open(location.origin+'/#/app/incident/detail/incident_back/incident/'+data.id+'/'+data.taskId+'/'+data.processInstanceId+'//');
- }
- // 切换tab
- $scope.clickTab = function(item){
- $scope.detailsType = item.type;
- $scope.getData();
- // 故障现象
- if(type == 2 && $scope.detailsType != "default"){
- $scope.columnDefs1.splice(0, 1 , {
- name: $scope.detailsType,
- displayName: $scope.detailsTypeList.find(v => v.type == $scope.detailsType).columnName,
- width: "20%",
- cellTemplate: $scope.detailsType === "floor" ? '<div style="width: 100%;">' +
- '<div class="ui-grid-cell-contents">{{row.entity.building}} {{row.entity.floor}}</div>' +
- '</div>' : '<div style="width: 100%;">' +
- '<div class="ui-grid-cell-contents">{{row.entity.'+ $scope.detailsType + '}}</div>' +
- '</div>'
- })
- }
- }
- //获取列表数据
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- $scope.langs1 = i18nService.getAllLangs();
- $scope.lang1 = 'zh-cn';
- i18nService.setCurrentLang($scope.lang1);
- $scope.myData1 = [];
- $scope.myData = [];
- $scope.getData = function (idx = 0, sum = 10) {
- // 故障现象
- if(type == 2 && $scope.detailsType != "default"){
- $rootScope.isMask = true;
- api_event_form.fetchSjlxDetail({
- "dutyId": own.duty ? own.duty.id : undefined,
- "branchId": own.duty ? undefined: (own.branch ? own.branch.id : undefined),
- "startTime": moment(searchCriteria.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment(searchCriteria.endtimesModel).format('YYYY-MM-DD'),
- "hierarchy": scope.sjSelectedOne.value.id,
- "sortData": scope.name,
- "sortType": scope.type,
- // "sortData": "sum",
- // "sortType": "desc",
- "detailsType": $scope.detailsType,
- "categoryId": rowData.categoryId,
- }).then(function (data) {
- $rootScope.isMask = false;
- if (data.stats) {
- $scope.gridOptions1['totalItems'] = data.totalNum;
- $scope.myData1 = data.typedataList;//表格列表
- } else {
- SweetAlert.swal({
- title: "系统错误",
- text: "请稍后再试!",
- type: "error"
- });
- }
- }, function () {
- $rootScope.isMask = false;
- });
- return;
- }
- var filterData = {
- "idx": idx,
- "sum": sum,
- "incident": {}
- };
- switch(type){
- case 1:
- filterData.incident.state = {value: 'close'};
- filterData.incident.hasHandlingPersonnelUser = 1;
- filterData.incident.acceptDate = moment(rowData.accdate).startOf(searchCriteria.dateItem).format('YYYY-MM-DD HH:mm:ss');
- filterData.incident.acceptDateEnd = moment(rowData.accdate).endOf(searchCriteria.dateItem).format('YYYY-MM-DD HH:mm:ss');
- filterData.incident.duty = own.duty ? own.duty : undefined;
- filterData.incident.branch = own.duty ? undefined : (own.branch ? own.branch.id : undefined);
- break;
- case 2:
- filterData.incident.state = {value: 'close'};
- filterData.incident.hasHandlingPersonnelUser = 1;
- filterData.incident.acceptDate = moment(searchCriteria.starttimesModel).startOf('day').format('YYYY-MM-DD HH:mm:ss');
- filterData.incident.acceptDateEnd = moment(searchCriteria.endtimesModel).endOf('day').format('YYYY-MM-DD HH:mm:ss');
- filterData.incident.duty = own.duty ? own.duty : undefined;
- filterData.incident.branch = own.duty ? undefined : (own.branch ? own.branch.id : undefined);
- filterData.incident.levelCategory = {id: rowData.categoryId};
- break;
- case 3:
- filterData.incident.state = {value: 'close'};
- filterData.incident.hasHandlingPersonnelUser = 1;
- filterData.incident.acceptDate = moment(searchCriteria.starttimesModel).startOf('day').format('YYYY-MM-DD HH:mm:ss');
- filterData.incident.acceptDateEnd = moment(searchCriteria.endtimesModel).endOf('day').format('YYYY-MM-DD HH:mm:ss');
- filterData.incident.duty = own.duty ? own.duty : undefined;
- filterData.incident.branch = own.duty ? undefined : (own.branch ? own.branch.id : undefined);
- filterData.incident.handlingPersonnelUser = {id: rowData.handlingPersonnelUserId};
- break;
- case 4:
- filterData.incident.state = {value: 'close'};
- filterData.incident.hasHandlingPersonnelUser = 1;
- filterData.incident.acceptDate = moment(searchCriteria.starttimesModel).startOf('day').format('YYYY-MM-DD HH:mm:ss');
- filterData.incident.acceptDateEnd = moment(searchCriteria.endtimesModel).endOf('day').format('YYYY-MM-DD HH:mm:ss');
- filterData.incident.handlingPersonnelUser = {id: rowData.userId};
- break;
- }
- filterData.incident.handlingPersonnelUser = $scope.own.handlingPersonnelUser;
- filterData.incident.department = $scope.own.department;
- filterData.incident.area = $scope.own.area;
- filterData.incident.place = $scope.own.place;
- // debugger;
- $rootScope.isMask = true;
- api_user_data.fetchDataList('incident', filterData).then(function (data) {
- $rootScope.isMask = false;
- if (data.list) {
- var myData = Restangular.stripRestangular(data);
- $scope.gridOptions['totalItems'] = myData.totalNum;
- $scope.myData = myData.list;
- for (var i = 0; i < $scope.myData.length; i++) {
- var row8Minutes = moment($scope.myData[i]['responseHandleTime']).diff(moment($scope.myData[i]['acceptDate']), 'minute');
- var row9Minutes = moment($scope.myData[i]['handleTime']).diff(moment($scope.myData[i]['responseHandleTime']), 'minute');
- $scope.myData[i]['row8'] = (row8Minutes / 60 >= 1 ? parseInt(row8Minutes / 60) + '小时' : '') + row8Minutes % 60 + '分';
- $scope.myData[i]['row9'] = (row9Minutes / 60 >= 1 ? parseInt(row9Minutes / 60)+ '小时' : '') + row9Minutes % 60 + '分';
- }
- } else {
- SweetAlert.swal({
- title: "系统错误",
- text: "请稍后再试!",
- type: "error"
- });
- }
- }, function () {
- $rootScope.isMask = false;
- });
- };
- $scope.getData();
- // 获取处理人
- $scope.getUsers = function(keyWord){
- var postData = {
- "idx": 0,
- "sum": 10,
- "user": {
- "selectDetails": "1",
- "simple": true,
- "name": keyWord,
- "selectType": "pinyin_qs",
- engineer: 1,
- }
- };
- if(own.duty){
- postData.user.duty = own.duty;
- }else if(own.branch){
- postData.user.branch = own.branch;
- }
- api_user_data.fetchDataList("user", postData).then(function (data) {
- $scope.users = data.list || [];
- });
- }
- // 获取报修科室
- $scope.getDepts = function(keyWord){
- var postData = {
- "idx": 0,
- "sum": 10,
- "department": {
- dept: keyWord,
- selectType: "pinyin_qs"
- }
- };
- if(own.branch){
- postData.department.branch = own.branch.id;
- }
- api_user_data.fetchDataList("department", postData).then(function (data) {
- $scope.depts = data.list || [];
- });
- }
- // 获取楼栋
- $scope.getAreas = function(keyWord){
- var postData = {
- "idx": 0,
- "sum": 9999,
- "area": {
- area: keyWord,
- selectType: "pinyin_qs"
- }
- };
- if(own.branch){
- postData.area.branch = own.branch.id;
- }
- api_user_data.fetchDataList("area", postData).then(function (data) {
- $scope.areas = data.list || [];
- });
- }
- // 选择楼栋
- $scope.changeArea = function(){
- $scope.own.place = undefined;
- $scope.places = [];
- $scope.getPlaces('', $scope.own.area.id)
- }
- // 获取楼层
- $scope.getPlaces = function(keyWord,areaId){
- if(!areaId){
- $scope.places = [];
- return;
- }
- var postData = {
- "idx": 0,
- "sum": 9999,
- "place": {
- areaId: areaId,
- place: keyWord,
- selectType: "pinyin_qs"
- }
- };
- if(own.branch){
- postData.place.branch = own.branch.id;
- }
- api_user_data.fetchDataList("place", postData).then(function (data) {
- $scope.places = data.list || [];
- });
- }
- $scope.reload = function(){
- $scope.own = {
- handlingPersonnelUser: undefined,
- department: undefined,
- area: undefined,
- place: undefined,
- }
- $scope.places = [];
- $scope.getData();
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- },
- size: 'lg',
- resolve: {
- Alert: function () {
- return SweetAlert;
- },
- api_user_data: function () {
- return api_user_data;
- },
- scope: function () {
- return $scope;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {});
- }
- // 切换院区
- $scope.own = {};
- $scope.changeBranch = function(){
- console.log($scope.own.branch);
- $scope.dutys = [];
- $scope.own.duty = null;
- $scope.own.branch && $scope.getOwnDuty($scope.own.branch.id);
- $scope.groupSelected = [{
- id: -2,
- groupName: '按组选择'
- }, {
- id: -1,
- groupName: '按人选择'
- }];
- $scope.groupSelectedOne = {
- value: $scope.groupSelected[1]//选中
- };
- $scope.own.duty && $scope.tap == 'CLRZ' && $scope.mdxquery();
- }
- // 切换责任科室
- $scope.changeDuty = function(){
- console.log($scope.own.duty);
- $scope.groupSelected = [{
- id: -2,
- groupName: '按组选择'
- }, {
- id: -1,
- groupName: '按人选择'
- }];
- $scope.groupSelectedOne = {
- value: $scope.groupSelected[1]//选中
- };
- $scope.own.duty && $scope.tap == 'CLRZ' && $scope.mdxquery();
- $scope.companySelected = [];
- $scope.companySelectedOne.value = {id:-1,name:''};
- $scope.own.duty && $scope.tap == 'SFGS' && $scope.mdxquery();
- }
- // 获取院区
- $scope.branchs = [];
- $scope.getOwnBranch = function(){
- api_category
- .getOwnBranch({})
- .then(function (response) {
- if (response) {
- if ((response.status = 200)) {
- $scope.branchs = response.data;
- if($rootScope.user.duty){
- $scope.own.branch = {id: $rootScope.user.duty.branch, hosName: $rootScope.user.duty.branchName};
- $scope.getOwnDuty($rootScope.user.duty.branch, true);
- }else if($rootScope.user.branch){
- $scope.own.branch = $rootScope.user.branch;
- $scope.getOwnDuty($rootScope.user.branch.id, true);
- $scope.init();
- }
- }
- }
- });
- }
- $scope.getOwnBranch();
- // 获取责任科室
- $scope.dutys = [];
- $scope.getOwnDuty = function(branchId, isFirst = false, isReload = false){
- api_category
- .getOwnDuty({branchId: branchId})
- .then(function (response) {
- if (response) {
- if ((response.status = 200)) {
- $scope.dutys = response.data;
- if(isFirst && $rootScope.user.duty){
- $scope.own.duty = $rootScope.user.duty;
- // $scope.getGroups($scope.own.duty);
- $scope.init();
- }
- if(isReload){
- if($rootScope.user.duty){
- $scope.own.duty = $rootScope.user.duty;
- }
- switch ($scope.tap) {
- case 'SJZS'://事件总数
- $scope.sortActive = 'accdatetop';
- $scope.name = 'accdate';//表格排序,字段名称
- $scope.mdxquery('accdate', 'desc');
- break;
- case 'SJLX'://故障现象
- $scope.sortActive = 'sumtop';
- $scope.name = 'sum';//表格排序,字段名称
- $scope.mdxquery('sum', 'desc');
- $scope.sjSelectedOne.value = $scope.sjSelected[0];//故障现象级别
- break;
- case 'CLRZ'://处理人/组
- $scope.sortActive = 'sumtop';
- $scope.name = 'sum';//表格排序,字段名称
- $scope.mdxquery('sum', 'desc');
- $scope.groupSelectedOne.value = $scope.groupSelected[1];//选择处理人/组
- break;
- case 'SFGS'://三方公司
- $scope.sortActive = 'i_totaltop';
- $scope.name = 'i_total';//表格排序,字段名称
- $scope.mdxquery('i_total', 'desc');
- $scope.companySelectedOne.value = {id:-1,name:''};//选择三方公司
- break;
- case 'QYDD'://区域地点
- $scope.sortActive = 'sumtop';
- $scope.name = 'sum';//表格排序,字段名称
- $scope.mdxquery('sum', 'desc');
- $scope.areaSelectedOne.value = $scope.areaSelected[0];//区域/地点
- break;
- case 'KSTJ'://科室统计
- $scope.sortActive = 'sumtop';
- $scope.name = 'sum';//表格排序,字段名称
- $scope.mdxquery('sum', 'desc');
- break;
- case 'SJLY'://事件来源
- $scope.sortActive = 'sumtop';
- $scope.name = 'sum';//表格排序,字段名称
- $scope.mdxquery('sum', 'desc');
- break;
- }
- }
- }
- }
- });
- }
- //切换开始/结束日期
- $scope.timesChange = function (str) {
- //切换结束日期的时候为年底或月底,方便传参
- switch (str) {
- case 'month':
- $scope.endtimesModel = moment($scope.endtimesModel).endOf('month').toDate();
- break;
- case 'year':
- $scope.endtimesModel = moment($scope.endtimesModel).endOf('year').toDate();
- break;
- }
- $scope.datepickerUpdate(str);
- };
- //配置项更新
- $scope.datepickerUpdate = function (str) {
- //开始的datepickerOptions
- $scope.datepickerOptionsStart = {
- maxDate: moment($scope.endtimesModel).format('YYYY/MM/DD'),
- minMode: str,
- datepickerMode: str
- };
- //结束的datepickerOptions
- $scope.datepickerOptionsEnd = {
- minDate: moment($scope.starttimesModel).format('YYYY/MM/DD'),
- maxDate: moment().format('YYYY/MM/DD'),
- minMode: str,
- datepickerMode: str
- };
- };
- //日期选择
- //近N周
- $scope.week = function (num) {
- num = num > 1 ? num : 1;
- $scope.searchstate = "week" + num;
- var weeks = new Date().getDay();
- $scope.starttimesModel = moment(new Date().getTime() - num * 86400000 * (weeks + 6)).toDate();
- $scope.endtimesModel = moment(new Date().getTime() - 86400000 * (weeks)).toDate();
- $scope.datepickerUpdate('day');
- }
- //近N月
- $scope.month = function (num) {
- num = num > 1 ? num : 1;
- $scope.searchstate = "month" + num;
- $scope.starttimesModel = moment().startOf('month').add(-num, 'M').toDate();
- $scope.endtimesModel = moment().endOf('month').add(-1, 'M').toDate();
- $scope.datepickerUpdate('month');
- }
- //近N年
- $scope.year = function (num) {
- num = num > 1 ? num : 1;
- $scope.searchstate = "year" + num;
- $scope.starttimesModel = moment().startOf('year').add(-num, 'y').toDate();
- $scope.endtimesModel = moment().endOf('year').add(-1, 'y').toDate();
- $scope.datepickerUpdate('year');
- }
- //近N日
- $scope.day = function (num) {
- num = num > 1 ? num : 1;
- $scope.searchstate = "none";
- $scope.starttimesModel = moment().subtract(num, "days").toDate();
- $scope.endtimesModel = moment().subtract(1, "days").toDate();
- $scope.datepickerUpdate('day');
- }
- //选择上一周,上个月,去年等等快捷方式
- $scope.chooseDate = function (date) {
- switch (date) {
- case 'week1'://上周
- $scope.week(1);
- break;
- case 'month1'://上个月
- $scope.month(1);
- break;
- case 'month3'://近三月
- $scope.month(3);
- break;
- case 'month6'://近六月
- $scope.month(6);
- break;
- case 'year1'://去年
- $scope.year(1);
- break;
- case 'year3'://近三年
- $scope.year(3);
- break;
- case 'year5'://近五年
- $scope.year(5);
- break;
- }
- };
- // 故障现象级别
- $scope.sjSelected = [{
- name: '一级分类',
- id: 1
- }, {
- name: '二级分类',
- id: 2
- }, {
- name: '三级分类',
- id: 3
- }];
- $scope.sjSelectedOne = {
- value: $scope.sjSelected[0]//选中
- };
- // 处理人/组
- $scope.groupSelected = [{
- id: -2,
- groupName: '按组选择'
- }, {
- id: -1,
- groupName: '按人选择'
- }];
- $scope.groupSelectedOne = {
- value: $scope.groupSelected[1]//选中
- };
- $scope.tableGroupSelectedOne = '';//处理组或人
- // 三方公司
- $scope.companySelected = [];
- $scope.companySelectedOne = {
- value: {id:-1,name:""}//选中
- };
- // 区域地点
- $scope.areaSelected = [{
- name: '区域',
- id: 1
- }, {
- name: '地点',
- id: 2
- }];
- $scope.areaSelectedOne = {
- value: $scope.areaSelected[0]//选中
- };
- /**
- *日历
- */
- //打开开始日期选择框
- $scope.startOpen = function ($event) {
- console.log(1)
- $event.preventDefault();
- $event.stopPropagation();
- $scope.endOpened = false;
- $scope.startOpened = !$scope.startOpened;
- };
- //打开结束日期选择框
- $scope.endOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.startOpened = false;
- $scope.endOpened = !$scope.endOpened;
- };
- //重置
- $scope.reload = function () {
- $scope.dateItemClick('day');
- $scope.type = 'desc';//表格排序,排序方式desc,asc
- $scope.direction = 'top';//箭头方向 top,bottom
- if($rootScope.user.duty){
- $scope.own.branch = {id: $rootScope.user.duty.branch, hosName: $rootScope.user.duty.branchName};
- $scope.getOwnDuty($rootScope.user.duty.branch, false, true);
- }else if($rootScope.user.branch){
- $scope.own.branch = $rootScope.user.branch;
- $scope.getOwnDuty($rootScope.user.branch.id, false, true);
- }
- };
- //选择类型,事件总数,故障现象,处理人/组,区域地点
- $scope.active = function (name) {
- $scope.tap = name;
- $scope.reload();
- };
- //事件总数,无限滚动加载
- $scope.topEndComplete = function () {
- console.log('滚动');
- };
- //表格排序------------------------------------------------
- $scope.sortActive = '';//表格排序,箭头高亮选中状态
- $scope.type = '';//表格排序,排序方式desc,asc
- $scope.name = '';//表格排序,字段名称
- $scope.direction = '';//箭头方向 top,bottom
- /**
- * 表格排序
- *
- * @param {string} name 字段名称
- * @param {string} type 排序方式desc,asc
- * @param {string} direction 箭头方向 top,bottom
- */
- $scope.tableSort = function (name, type, direction) {
- if ($scope.name == name) {
- $scope.type = $scope.type == 'desc' ? 'asc' : 'desc';
- $scope.direction = $scope.direction == 'top' ? 'bottom' : 'top';
- } else {
- $scope.type = 'desc';
- $scope.direction = 'top';
- }
- $scope.name = name;
- $scope.sortActive = name + $scope.direction;
- $scope.mdxquery(name, $scope.type);
- };
- //搜索----------------------------------------------------
- //loading
- $scope.isArrays = function (arr) {
- return Array.isArray(arr);
- };
- //事件总数
- $scope.sjzs_list = null;//表格列表
- $scope.sjzs_num = 0;//事件总数数量
- $scope.sjzs_responseTime = '0分';//平均响应时间
- $scope.sjzs_resolvedTime = '0分';//平均解决时间
- $scope.sjzs_satisfactionRatio = 0;//满意度
- //故障现象
- $scope.sjlx_list = null;//表格列表
- $scope.sjlx_num = 0;//事件总数数量
- //处理人/组
- $scope.clrz_list = null;//表格列表
- $scope.clrz_num = 0;//事件总数数量
- $scope.clrz_responseTime = '0分';//平均响应时间
- $scope.clrz_resolvedTime = '0分';//平均解决时间
- $scope.clrz_satisfactionRatio = 0;//满意度
- //三方公司
- $scope.sfgs_list = null;//表格列表
- $scope.sfgs_c_total = 0;//公司总数
- $scope.sfgs_u_total = 0;//人员总数
- $scope.sfgs_p_total = 0;//解决事件总数
- $scope.sfgs_p_time = '0分';//平均解决时长
- //区域地点
- $scope.qydd_list = null;//表格列表
- $scope.qydd_num = 0;//事件总数数量
- //科室统计
- $scope.kstj_list = null;//表格列表
- $scope.kstj_num = 0;//事件总数数量
- //事件来源
- $scope.sjly_list = null;//表格列表
- $scope.sjly_num = 0;//事件总数数量
- /**
- *
- *
- * @param {string} name 排序字段
- * @param {string} type 排序方式 desc,asc
- */
- $scope.mdxquery = function (name, type) {
- if (!name) {
- if($scope.tap == 'SJZS'){
- name = 'accdate';
- }else if($scope.tap == 'SFGS'){
- name = 'i_total';
- }else{
- name = 'sum';
- }
- }
- type = type || 'desc';
- switch ($scope.tap) {
- case 'SJZS'://事件总数
- $scope.sjzs_list = null;
- // 请求列表
- api_event_form.fetchSjzsList({
- "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- "type": $scope.dateItem,
- "sortData": name,
- "sortType": type
- }).then(function (res) {
- if (res.stats == 200) {
- $scope.sjzs_list = res.dataList;//表格列表
- $scope.sjzs_num = res.sum;//事件总数数量
- $scope.sjzs_responseTime = res.responseTime;//平均响应时间
- $scope.sjzs_resolvedTime = res.resolvedTime;//平均解决时间
- $scope.sjzs_satisfactionRatio = res.satisfactionRatio;//满意度
- }
- })
- break;
- case 'SJLX'://故障现象
- $scope.sjlx_list = null;
- // 请求列表
- api_event_form.fetchSjlxList({
- "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- "hierarchy": $scope.sjSelectedOne.value.id,
- "sortData": name,
- "sortType": type
- }).then(function (res) {
- if (res.stats == 200) {
- $scope.sjlx_list = res.typedataList;//表格列表
- $scope.sjlx_num = res.data.sum;//事件总数数量
- }
- })
- // 请求事件总数数量
- // api_event_form.getSjNum({
- // "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- // "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- // "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- // "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- // }).then(function (res) {
- // if (res.stats == 200) {
- // $scope.sjlx_num = res.data[0].sum;//事件总数数量
- // }
- // })
- break;
- case 'CLRZ'://处理人/组
- $scope.clrz_list = null;
- //获取组
- api_user_data.fetchDataList('group', {
- idx: 0,
- sum: 1000,
- group: {
- duty: $scope.own.duty || undefined,
- selectType: "nouser"
- }
- }).then(res => {
- if (res.status == 200) {
- var groupList = [{
- id: -2,
- groupName: '按组选择'
- }, {
- id: -1,
- groupName: '按人选择'
- }];
- groupList.push(...res.list);
- $scope.groupSelected = groupList;//下拉框数据
- // 请求列表
- if ($scope.groupSelectedOne.value.id == -2) {//按组
- var params = {
- "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- "type": 1,
- "sortData": name,
- "sortType": type
- };
- } else if ($scope.groupSelectedOne.value.id == -1) {//按人
- var params = {
- "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- "type": 2,
- "sortData": name,
- "sortType": type
- };
- } else {
- var params = {
- "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- "type": 3,
- "groupid": $scope.groupSelectedOne.value.id,
- "sortData": name,
- "sortType": type
- };
- }
- api_event_form.fetchClrzList(params).then(function (res) {
- if (res.stats == 200) {
- $scope.tableGroupSelectedOne = params.type;//处理人或组
- $scope.clrz_list = res.listData;//表格列表
- $scope.clrz_num = res.sum;//事件总数量
- $scope.clrz_responseTime = res.responseTime;//平均响应时间
- $scope.clrz_resolvedTime = res.resolvedTime;//平均解决时间
- $scope.clrz_satisfactionRatio = res.satisfactionRatio;//满意度
- }
- })
- }
- })
- break;
- case 'SFGS'://三方公司
- $scope.sfgs_list = null;
- //获取三方公司
- api_user_data.fetchDataList('company', {
- idx: 0,
- sum: 1000,
- company: {
- "duty": $scope.own.duty || undefined,
- }
- }).then(res => {
- if (res.status == 200) {
- $scope.companySelected = res.list;//下拉框数据
- // 请求列表
- var postData = {
- "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- "sortData": name,
- "sortType": type
- }
- if($scope.companySelectedOne.value.id > 0){
- postData.companyId = $scope.companySelectedOne.value.id;
- }
- api_event_form.fetchSfgsList(postData).then(function (res) {
- if (res.stats == 200) {
- $scope.sfgs_list = res.dataList;//表格列表
- $scope.sfgs_c_total = res.title.c_total;//公司总数
- $scope.sfgs_u_total = res.title.u_total;//人员总数
- $scope.sfgs_p_total = res.title.p_total;//解决事件总数
- $scope.sfgs_p_time = res.title.p_time;//平均解决时长
- }
- })
- }
- })
- break;
- case 'QYDD'://区域地点
- $scope.qydd_list = null;
- // 请求列表
- api_event_form.fetchQyddList({
- "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- "type": $scope.areaSelectedOne.value.id,
- "sortData": name,
- "sortType": type
- }).then(function (res) {
- if (res.stats == 200) {
- $scope.qydd_list = res.listData;//表格列表
- $scope.qydd_num = res.data.sum;//事件总数数量
- }
- })
- // 请求事件总数数量
- // api_event_form.getSjNum({
- // "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- // "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- // "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- // "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD')
- // }).then(function (res) {
- // if (res.stats == 200) {
- // $scope.qydd_num = res.data[0].sum;//事件总数数量
- // }
- // })
- break;
- case 'KSTJ'://科室统计
- $scope.kstj_list = null;
- // 请求列表
- api_event_form.fetchKstjList({
- "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- "sortData": name,
- "sortType": type
- }).then(function (res) {
- if (res.stats == 200) {
- $scope.kstj_list = res.dataList;//表格列表
- $scope.kstj_num = res.data.sum;//事件总数数量
- }
- })
- break;
- case 'SJLY'://事件来源
- $scope.sjly_list = null;
- // 请求列表
- api_event_form.fetchSjlyList({
- "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- "sortData": name,
- "sortType": type
- }).then(function (res) {
- if (res.stats == 200) {
- $scope.sjly_list = res.listData;//表格列表
- $scope.sjly_num = res.data.sum;//事件总数数量
- }
- })
- // 请求事件总数数量
- // api_event_form.getSjNum({
- // "dutyId": $scope.own.duty ? $scope.own.duty.id : undefined,
- // "branchId": $scope.own.duty ? undefined: ($scope.own.branch ? $scope.own.branch.id : undefined),
- // "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- // "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD')
- // }).then(function (res) {
- // if (res.stats == 200) {
- // $scope.sjly_num = res.data[0].sum;//事件总数数量
- // }
- // })
- break;
- }
- };
- // 请求人
- // api_user_data.fetchDataList('requester', {
- // "idx": 0,
- // "sum": 10
- // }).then(function (response) {
- // if (response) {
- // if (response.status = 200) {
- // $scope.requester = response.list;
- // }
- // }
- // })
- //导出
- $scope.export = function () {
- var postData = {
- "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
- "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
- "sortData": $scope.name,
- "sortType": $scope.type,
- report: {}
- }
- switch ($scope.tap) {
- case 'SJZS'://事件总数
- postData.dutyId = $scope.own.duty ? $scope.own.duty.id : undefined;
- postData.branchId = $scope.own.duty ? undefined : ($scope.own.branch ? $scope.own.branch.id : undefined);
- postData.type = $scope.dateItem;
- postData.key = 'mdv2_incident_repot_sum';
- if($scope.own.duty && $scope.own.duty.addSummary == 1){
- postData.titles = ['时间', '事件数量', '平均响应时间', '平均解决时间', '耗材费用', '工时费用', '总费用'];
- }else{
- postData.titles = ['时间', '事件数量', '平均响应时间', '平均解决时间'];
- }
- break;
- case 'SJLX'://故障现象
- postData.dutyId = $scope.own.duty ? $scope.own.duty.id : undefined;
- postData.branchId = $scope.own.duty ? undefined : ($scope.own.branch ? $scope.own.branch.id : undefined);
- postData.hierarchy = $scope.sjSelectedOne.value.id;
- postData.key = 'mdv2_incident_repot_type';
- if($scope.own.duty && $scope.own.duty.addSummary == 1){
- postData.titles = ['故障现象', '类型数量', '类型占比', '平均响应时间', '平均解决时间', '耗材费用', '工时费用', '总费用'];
- }else{
- postData.titles = ['故障现象', '类型数量', '类型占比', '平均响应时间', '平均解决时间'];
- }
- break;
- case 'CLRZ'://处理人/组
- postData.dutyId = $scope.own.duty ? $scope.own.duty.id : undefined;
- postData.branchId = $scope.own.duty ? undefined : ($scope.own.branch ? $scope.own.branch.id : undefined);
- let CLRZ_TYPE = ''
- if ($scope.groupSelectedOne.value.id == -2) {//按组
- postData.type = 1;
- CLRZ_TYPE = '处理组';
- postData.titles = [CLRZ_TYPE, '协同处理数', '事件数量', '事件占比', '按时响应', '超时响应', '平均响应时间', '超时响应占比', '按时解决', '超时解决', '平均解决时间', '超时解决占比', '满意度(%)'];
- } else if ($scope.groupSelectedOne.value.id == -1) {//按人
- postData.type = 2;
- CLRZ_TYPE = '处理人';
- postData.titles = [CLRZ_TYPE, '协同处理数', '事件数量', '事件占比', '按时响应', '超时响应', '平均响应时间', '超时响应占比', '按时解决', '超时解决', '平均解决时间', '超时解决占比', '满意度(%)', '耗材费用', '工时费用', '总费用'];
- } else {
- postData.type = 3;
- CLRZ_TYPE = '处理人';
- postData.titles = [CLRZ_TYPE, '协同处理数', '事件数量', '事件占比', '按时响应', '超时响应', '平均响应时间', '超时响应占比', '按时解决', '超时解决', '平均解决时间', '超时解决占比', '满意度(%)', '耗材费用', '工时费用', '总费用'];
- }
- postData.key = 'mdv2_incident_repot_handle';
- break;
- case 'SFGS'://三方公司
- postData.dutyId = $scope.own.duty ? $scope.own.duty.id : undefined;
- postData.branchId = $scope.own.duty ? undefined : ($scope.own.branch ? $scope.own.branch.id : undefined);
- postData.key = 'mdv2_incident_repot_company';
- postData.titles = [($scope.sfgs_list[0]&&$scope.sfgs_list[0].userName)?'人员名称':'公司名称', '人员总数', '事件数量', '平均响应时长', '平均解决时长'];
- if($scope.sfgs_list[0]&&$scope.sfgs_list[0].userName){
- postData.titles.splice(1,1);
- }
- break;
- case 'QYDD'://区域地点
- postData.dutyId = $scope.own.duty ? $scope.own.duty.id : undefined;
- postData.branchId = $scope.own.duty ? undefined : ($scope.own.branch ? $scope.own.branch.id : undefined);
- postData.type = $scope.areaSelectedOne.value.id;
- postData.key = 'mdv2_incident_repot_area_place';
- postData.titles = ['区域/地点', '事件数量', '事件占比'];
- break;
- case 'KSTJ'://科室统计
- postData.dutyId = $scope.own.duty ? $scope.own.duty.id : undefined;
- postData.branchId = $scope.own.duty ? undefined : ($scope.own.branch ? $scope.own.branch.id : undefined);
- postData.key = 'mdv2_incident_repot_dept';
- if($scope.own.duty && $scope.own.duty.addSummary == 1){
- postData.titles = ['科室名称', '事件数量', '事件占比', '耗材费用', '工时费用', '总费用'];
- }else{
- postData.titles = ['科室名称', '事件数量', '事件占比'];
- }
- break;
- case 'SJLY'://事件来源
- postData.dutyId = $scope.own.duty ? $scope.own.duty.id : undefined;
- postData.branchId = $scope.own.duty ? undefined : ($scope.own.branch ? $scope.own.branch.id : undefined);
- postData.key = 'mdv2_incident_repot_source';
- postData.titles = ['事件来源', '事件数量', '事件来源占比'];
- break;
- }
- var wt_url = api_bpm.downDataModel('report', 1).getRequestedUrl()
- $http({
- url: wt_url,
- method: 'POST',
- data: JSON.stringify(postData),
- headers: {
- 'Accept': '*/*'
- },
- responseType: 'arraybuffer'
- }).success(function (data, status, headers, config) {
- var fileName = '';
- switch ($scope.tap) {
- case 'SJZS'://事件总数
- fileName = '事件总数';
- break;
- case 'SJLX'://故障现象
- fileName = '故障现象';
- break;
- case 'CLRZ'://处理人/组
- fileName = '处理人/组';
- break;
- case 'SFGS'://三方公司
- fileName = '三方公司';
- break;
- case 'QYDD'://区域地点
- fileName = '区域地点';
- break;
- case 'KSTJ'://科室统计
- fileName = '科室统计';
- break;
- case 'SJLY'://事件来源
- fileName = '事件来源';
- break;
- }
- // var fileName = headers("Content-Disposition").split(";")[1].split("filename=")[1];
- var file = new Blob([data], {
- type: 'application/vnd.ms-excel'
- });
- var fileURL = URL.createObjectURL(file);
- var a = document.createElement('a');
- a.href = fileURL;
- a.target = '_blank';
- a.download = fileName + '.xls';
- document.body.appendChild(a);
- a.click();
- }).error(function (data, status, headers, config) {
- });
- };
- //初始化
- $scope.init = function(){
- $scope.dateItemClick('day');
- $scope.mdxquery('accdate', 'desc');
- $scope.sortActive = 'accdatetop';
- $scope.name = 'accdate';//表格排序,字段名称
- $scope.type = 'desc';//表格排序,排序方式desc,asc
- $scope.direction = 'top';//箭头方向 top,bottom
- }
- }])
|