event_formCtrl.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. 'use strict';
  2. 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", function ($scope, $rootScope, $state, $timeout, $interval, $http, $cookieStore, SweetAlert, Restangular, api_report, api_statistic, moment, api_event_form, api_user_data, api_bpm) {
  3. //默认显示事件总数
  4. $scope.tap = 'SJZS';
  5. //默认无选中,选择日期
  6. $scope.searchstate = 'none';
  7. //默认按日统计
  8. $scope.dateItem = 'day';
  9. //按日
  10. $scope.dayByClick = function () {
  11. $scope.datepickerPopuptime = 'yyyy-MM-dd';//日期格式化
  12. $scope.day(7);//近7天
  13. };
  14. //按月
  15. $scope.monthByClick = function () {
  16. $scope.datepickerPopuptime = 'yyyy-MM';
  17. $scope.month(1);
  18. };
  19. //按年
  20. $scope.yearByClick = function () {
  21. $scope.datepickerPopuptime = 'yyyy';
  22. $scope.year(1);
  23. };
  24. //日期显示格式
  25. $scope.datepickerPopuptime = 'yyyy-MM-dd';
  26. //按日/月/年统计
  27. $scope.dateItemClick = function (str) {
  28. $scope.dateItem = str;
  29. switch (str) {
  30. case 'day':
  31. $scope.dayByClick();
  32. break;
  33. case 'month':
  34. $scope.monthByClick();
  35. break;
  36. case 'year':
  37. $scope.yearByClick();
  38. break;
  39. }
  40. };
  41. //切换开始/结束日期
  42. $scope.timesChange = function (str) {
  43. //切换结束日期的时候为年底或月底,方便传参
  44. switch (str) {
  45. case 'month':
  46. $scope.endtimesModel = moment($scope.endtimesModel).endOf('month').toDate();
  47. break;
  48. case 'year':
  49. $scope.endtimesModel = moment($scope.endtimesModel).endOf('year').toDate();
  50. break;
  51. }
  52. $scope.datepickerUpdate(str);
  53. };
  54. //配置项更新
  55. $scope.datepickerUpdate = function (str) {
  56. //开始的datepickerOptions
  57. $scope.datepickerOptionsStart = {
  58. maxDate: moment($scope.endtimesModel).format('YYYY/MM/DD'),
  59. minMode: str,
  60. datepickerMode: str
  61. };
  62. //结束的datepickerOptions
  63. $scope.datepickerOptionsEnd = {
  64. minDate: moment($scope.starttimesModel).format('YYYY/MM/DD'),
  65. maxDate: moment().format('YYYY/MM/DD'),
  66. minMode: str,
  67. datepickerMode: str
  68. };
  69. };
  70. //日期选择
  71. //近N周
  72. $scope.week = function (num) {
  73. num = num > 1 ? num : 1;
  74. $scope.searchstate = "week" + num;
  75. var weeks = new Date().getDay();
  76. $scope.starttimesModel = moment(new Date().getTime() - num * 86400000 * (weeks + 6)).toDate();
  77. $scope.endtimesModel = moment(new Date().getTime() - 86400000 * (weeks)).toDate();
  78. $scope.datepickerUpdate('day');
  79. }
  80. //近N月
  81. $scope.month = function (num) {
  82. num = num > 1 ? num : 1;
  83. $scope.searchstate = "month" + num;
  84. $scope.starttimesModel = moment().startOf('month').add(-num, 'M').toDate();
  85. $scope.endtimesModel = moment().endOf('month').add(-1, 'M').toDate();
  86. $scope.datepickerUpdate('month');
  87. }
  88. //近N年
  89. $scope.year = function (num) {
  90. num = num > 1 ? num : 1;
  91. $scope.searchstate = "year" + num;
  92. $scope.starttimesModel = moment().startOf('year').add(-num, 'y').toDate();
  93. $scope.endtimesModel = moment().endOf('year').add(-1, 'y').toDate();
  94. $scope.datepickerUpdate('year');
  95. }
  96. //近N日
  97. $scope.day = function (num) {
  98. num = num > 1 ? num : 1;
  99. $scope.searchstate = "none";
  100. $scope.starttimesModel = moment().subtract(num, "days").toDate();
  101. $scope.endtimesModel = moment().subtract(1, "days").toDate();
  102. $scope.datepickerUpdate('day');
  103. }
  104. //选择上一周,上个月,去年等等快捷方式
  105. $scope.chooseDate = function (date) {
  106. switch (date) {
  107. case 'week1'://上周
  108. $scope.week(1);
  109. break;
  110. case 'month1'://上个月
  111. $scope.month(1);
  112. break;
  113. case 'month3'://近三月
  114. $scope.month(3);
  115. break;
  116. case 'month6'://近六月
  117. $scope.month(6);
  118. break;
  119. case 'year1'://去年
  120. $scope.year(1);
  121. break;
  122. case 'year3'://近三年
  123. $scope.year(3);
  124. break;
  125. case 'year5'://近五年
  126. $scope.year(5);
  127. break;
  128. }
  129. };
  130. // 事件分类级别
  131. $scope.sjSelected = [{
  132. name: '一级分类',
  133. id: 1
  134. }, {
  135. name: '二级分类',
  136. id: 2
  137. }, {
  138. name: '三级分类',
  139. id: 3
  140. }];
  141. $scope.sjSelectedOne = {
  142. value: $scope.sjSelected[0]//选中
  143. };
  144. // 处理人/组
  145. $scope.groupSelected = [{
  146. id: -2,
  147. groupName: '按组选择'
  148. }, {
  149. id: -1,
  150. groupName: '按人选择'
  151. }];
  152. $scope.groupSelectedOne = {
  153. value: $scope.groupSelected[0]//选中
  154. };
  155. $scope.tableGroupSelectedOne = '';//处理组或人
  156. // 三方公司
  157. $scope.companySelected = [];
  158. $scope.companySelectedOne = {
  159. value: {id:-1,name:""}//选中
  160. };
  161. // 区域地点
  162. $scope.areaSelected = [{
  163. name: '区域',
  164. id: 1
  165. }, {
  166. name: '地点',
  167. id: 2
  168. }];
  169. $scope.areaSelectedOne = {
  170. value: $scope.areaSelected[0]//选中
  171. };
  172. /**
  173. *日历
  174. */
  175. //打开开始日期选择框
  176. $scope.startOpen = function ($event) {
  177. console.log(1)
  178. $event.preventDefault();
  179. $event.stopPropagation();
  180. $scope.endOpened = false;
  181. $scope.startOpened = !$scope.startOpened;
  182. };
  183. //打开结束日期选择框
  184. $scope.endOpen = function ($event) {
  185. $event.preventDefault();
  186. $event.stopPropagation();
  187. $scope.startOpened = false;
  188. $scope.endOpened = !$scope.endOpened;
  189. };
  190. //重置
  191. $scope.reload = function () {
  192. $scope.dateItemClick('day');
  193. $scope.type = 'desc';//表格排序,排序方式desc,asc
  194. $scope.direction = 'top';//箭头方向 top,bottom
  195. switch ($scope.tap) {
  196. case 'SJZS'://事件总数
  197. $scope.sortActive = 'accdatetop';
  198. $scope.name = 'accdate';//表格排序,字段名称
  199. $scope.mdxquery('accdate', 'desc');
  200. break;
  201. case 'SJLX'://事件类型
  202. $scope.sortActive = 'sumtop';
  203. $scope.name = 'sum';//表格排序,字段名称
  204. $scope.mdxquery('sum', 'desc');
  205. $scope.sjSelectedOne.value = $scope.sjSelected[0];//事件分类级别
  206. break;
  207. case 'CLRZ'://处理人/组
  208. $scope.sortActive = 'sumtop';
  209. $scope.name = 'sum';//表格排序,字段名称
  210. $scope.mdxquery('sum', 'desc');
  211. $scope.groupSelectedOne.value = $scope.groupSelected[0];//选择处理人/组
  212. break;
  213. case 'SFGS'://三方公司
  214. $scope.sortActive = 'i_totaltop';
  215. $scope.name = 'i_total';//表格排序,字段名称
  216. $scope.mdxquery('i_total', 'desc');
  217. $scope.companySelectedOne.value = {id:-1,name:''};//选择三方公司
  218. break;
  219. case 'QYDD'://区域地点
  220. $scope.sortActive = 'sumtop';
  221. $scope.name = 'sum';//表格排序,字段名称
  222. $scope.mdxquery('sum', 'desc');
  223. $scope.areaSelectedOne.value = $scope.areaSelected[0];//区域/地点
  224. break;
  225. case 'SJLY'://事件来源
  226. $scope.sortActive = 'sumtop';
  227. $scope.name = 'sum';//表格排序,字段名称
  228. $scope.mdxquery('sum', 'desc');
  229. break;
  230. }
  231. };
  232. //选择类型,事件总数,事件类型,处理人/组,区域地点
  233. $scope.active = function (name) {
  234. $scope.tap = name;
  235. $scope.reload();
  236. };
  237. //事件总数,无限滚动加载
  238. $scope.topEndComplete = function () {
  239. console.log('滚动');
  240. };
  241. //表格排序------------------------------------------------
  242. $scope.sortActive = '';//表格排序,箭头高亮选中状态
  243. $scope.type = '';//表格排序,排序方式desc,asc
  244. $scope.name = '';//表格排序,字段名称
  245. $scope.direction = '';//箭头方向 top,bottom
  246. /**
  247. * 表格排序
  248. *
  249. * @param {string} name 字段名称
  250. * @param {string} type 排序方式desc,asc
  251. * @param {string} direction 箭头方向 top,bottom
  252. */
  253. $scope.tableSort = function (name, type, direction) {
  254. if ($scope.name == name) {
  255. $scope.type = $scope.type == 'desc' ? 'asc' : 'desc';
  256. $scope.direction = $scope.direction == 'top' ? 'bottom' : 'top';
  257. } else {
  258. $scope.type = 'desc';
  259. $scope.direction = 'top';
  260. }
  261. $scope.name = name;
  262. $scope.sortActive = name + $scope.direction;
  263. $scope.mdxquery(name, $scope.type);
  264. };
  265. //搜索----------------------------------------------------
  266. //loading
  267. $scope.isArrays = function (arr) {
  268. return Array.isArray(arr);
  269. };
  270. //事件总数
  271. $scope.sjzs_list = null;//表格列表
  272. $scope.sjzs_num = 0;//事件总数数量
  273. $scope.sjzs_responseTime = '0分';//平均响应时间
  274. $scope.sjzs_resolvedTime = '0分';//平均解决时间
  275. $scope.sjzs_satisfactionRatio = 0;//满意度
  276. //事件类型
  277. $scope.sjlx_list = null;//表格列表
  278. $scope.sjlx_num = 0;//事件总数数量
  279. //处理人/组
  280. $scope.clrz_list = null;//表格列表
  281. $scope.clrz_num = 0;//事件总数数量
  282. $scope.clrz_responseTime = '0分';//平均响应时间
  283. $scope.clrz_resolvedTime = '0分';//平均解决时间
  284. $scope.clrz_satisfactionRatio = 0;//满意度
  285. //三方公司
  286. $scope.sfgs_list = null;//表格列表
  287. $scope.sfgs_c_total = 0;//公司总数
  288. $scope.sfgs_u_total = 0;//人员总数
  289. $scope.sfgs_p_total = 0;//解决事件总数
  290. $scope.sfgs_p_time = '0分';//平均解决时长
  291. //区域地点
  292. $scope.qydd_list = null;//表格列表
  293. $scope.qydd_num = 0;//事件总数数量
  294. //事件来源
  295. $scope.sjly_list = null;//表格列表
  296. $scope.sjly_num = 0;//事件总数数量
  297. /**
  298. *
  299. *
  300. * @param {string} name 排序字段
  301. * @param {string} type 排序方式 desc,asc
  302. */
  303. $scope.mdxquery = function (name, type) {
  304. if (!name) {
  305. if($scope.tap == 'SJZS'){
  306. name = 'accdate';
  307. }else if($scope.tap == 'SFGS'){
  308. name = 'i_total';
  309. }else{
  310. name = 'sum';
  311. }
  312. }
  313. type = type || 'desc';
  314. switch ($scope.tap) {
  315. case 'SJZS'://事件总数
  316. $scope.sjzs_list = null;
  317. // 请求列表
  318. api_event_form.fetchSjzsList({
  319. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  320. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  321. "type": $scope.dateItem,
  322. "sortData": name,
  323. "sortType": type
  324. }).then(function (res) {
  325. if (res.stats == 200) {
  326. $scope.sjzs_list = res.dataList;//表格列表
  327. $scope.sjzs_num = res.sum;//事件总数数量
  328. $scope.sjzs_responseTime = res.responseTime;//平均响应时间
  329. $scope.sjzs_resolvedTime = res.resolvedTime;//平均解决时间
  330. $scope.sjzs_satisfactionRatio = res.satisfactionRatio;//满意度
  331. }
  332. })
  333. break;
  334. case 'SJLX'://事件类型
  335. $scope.sjlx_list = null;
  336. // 请求列表
  337. api_event_form.fetchSjlxList({
  338. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  339. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  340. "hierarchy": $scope.sjSelectedOne.value.id,
  341. "sortData": name,
  342. "sortType": type
  343. }).then(function (res) {
  344. if (res.stats == 200) {
  345. $scope.sjlx_list = res.typedataList;//表格列表
  346. }
  347. })
  348. // 请求事件总数数量
  349. api_event_form.getSjNum({
  350. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  351. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  352. }).then(function (res) {
  353. if (res.stats == 200) {
  354. $scope.sjlx_num = res.data[0].sum;//事件总数数量
  355. }
  356. })
  357. break;
  358. case 'CLRZ'://处理人/组
  359. $scope.clrz_list = null;
  360. //获取组
  361. api_user_data.fetchDataList('group', {
  362. idx: 0,
  363. sum: 1000,
  364. group: {
  365. selectType: "nouser"
  366. }
  367. }).then(res => {
  368. if (res.status == 200) {
  369. var groupList = [{
  370. id: -2,
  371. groupName: '按组选择'
  372. }, {
  373. id: -1,
  374. groupName: '按人选择'
  375. }];
  376. groupList.push(...res.list);
  377. $scope.groupSelected = groupList;//下拉框数据
  378. // 请求列表
  379. if ($scope.groupSelectedOne.value.id == -2) {//按组
  380. var params = {
  381. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  382. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  383. "type": 1,
  384. "sortData": name,
  385. "sortType": type
  386. };
  387. } else if ($scope.groupSelectedOne.value.id == -1) {//按人
  388. var params = {
  389. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  390. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  391. "type": 2,
  392. "sortData": name,
  393. "sortType": type
  394. };
  395. } else {
  396. var params = {
  397. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  398. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  399. "type": 3,
  400. "groupid": $scope.groupSelectedOne.value.id,
  401. "sortData": name,
  402. "sortType": type
  403. };
  404. }
  405. api_event_form.fetchClrzList(params).then(function (res) {
  406. if (res.stats == 200) {
  407. $scope.tableGroupSelectedOne = params.type;//处理人或组
  408. $scope.clrz_list = res.listData;//表格列表
  409. $scope.clrz_num = res.sum;//事件总数量
  410. $scope.clrz_responseTime = res.responseTime;//平均响应时间
  411. $scope.clrz_resolvedTime = res.resolvedTime;//平均解决时间
  412. $scope.clrz_satisfactionRatio = res.satisfactionRatio;//满意度
  413. }
  414. })
  415. }
  416. })
  417. break;
  418. case 'SFGS'://三方公司
  419. $scope.sfgs_list = null;
  420. //获取三方公司
  421. api_user_data.fetchDataList('company', {
  422. idx: 0,
  423. sum: 1000,
  424. company: {}
  425. }).then(res => {
  426. if (res.status == 200) {
  427. $scope.companySelected = res.list;//下拉框数据
  428. // 请求列表
  429. var postData = {
  430. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  431. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  432. "sortData": name,
  433. "sortType": type
  434. }
  435. if($scope.companySelectedOne.value.id > 0){
  436. postData.companyId = $scope.companySelectedOne.value.id;
  437. }
  438. api_event_form.fetchSfgsList(postData).then(function (res) {
  439. if (res.stats == 200) {
  440. $scope.sfgs_list = res.dataList;//表格列表
  441. $scope.sfgs_c_total = res.title.c_total;//公司总数
  442. $scope.sfgs_u_total = res.title.u_total;//人员总数
  443. $scope.sfgs_p_total = res.title.p_total;//解决事件总数
  444. $scope.sfgs_p_time = res.title.p_time;//平均解决时长
  445. }
  446. })
  447. }
  448. })
  449. break;
  450. case 'QYDD'://区域地点
  451. $scope.qydd_list = null;
  452. // 请求列表
  453. api_event_form.fetchQyddList({
  454. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  455. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  456. "type": $scope.areaSelectedOne.value.id,
  457. "sortData": name,
  458. "sortType": type
  459. }).then(function (res) {
  460. if (res.stats == 200) {
  461. $scope.qydd_list = res.listData;//表格列表
  462. }
  463. })
  464. // 请求事件总数数量
  465. api_event_form.getSjNum({
  466. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  467. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD')
  468. }).then(function (res) {
  469. if (res.stats == 200) {
  470. $scope.qydd_num = res.data[0].sum;//事件总数数量
  471. }
  472. })
  473. break;
  474. case 'SJLY'://事件来源
  475. $scope.sjly_list = null;
  476. // 请求列表
  477. api_event_form.fetchSjlyList({
  478. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  479. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  480. "sortData": name,
  481. "sortType": type
  482. }).then(function (res) {
  483. if (res.stats == 200) {
  484. $scope.sjly_list = res.listData;//表格列表
  485. }
  486. })
  487. // 请求事件总数数量
  488. api_event_form.getSjNum({
  489. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  490. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD')
  491. }).then(function (res) {
  492. if (res.stats == 200) {
  493. $scope.sjly_num = res.data[0].sum;//事件总数数量
  494. }
  495. })
  496. break;
  497. }
  498. };
  499. // 请求人
  500. // api_user_data.fetchDataList('requester', {
  501. // "idx": 0,
  502. // "sum": 10
  503. // }).then(function (response) {
  504. // if (response) {
  505. // if (response.status = 200) {
  506. // $scope.requester = response.list;
  507. // }
  508. // }
  509. // })
  510. //导出
  511. $scope.export = function () {
  512. var postData = {
  513. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  514. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  515. "sortData": $scope.name,
  516. "sortType": $scope.type,
  517. report: {}
  518. }
  519. switch ($scope.tap) {
  520. case 'SJZS'://事件总数
  521. postData.type = $scope.dateItem;
  522. postData.key = 'mdv2_incident_repot_sum';
  523. postData.titles = ['时间', '事件数量', '平均响应时间', '平均解决时间', '完全解决', '部分解决', '其他', '满意度(%)'];
  524. break;
  525. case 'SJLX'://事件类型
  526. postData.hierarchy = $scope.sjSelectedOne.value.id;
  527. postData.key = 'mdv2_incident_repot_type';
  528. postData.titles = ['事件类型', '类型数量', '类型占比', '平均响应时间', '平均解决时间', '完全解决', '部分解决', '其他'];
  529. break;
  530. case 'CLRZ'://处理人/组
  531. if ($scope.groupSelectedOne.value.id == -2) {//按组
  532. postData.type = 1;
  533. } else if ($scope.groupSelectedOne.value.id == -1) {//按人
  534. postData.type = 2;
  535. } else {
  536. postData.type = 3;
  537. }
  538. postData.key = 'mdv2_incident_repot_handle';
  539. postData.titles = ['处理组', '事件数量', '事件占比', '按时响应', '超时响应', '平均响应时间', '超时响应占比', '按时解决', '超时解决', '平均解决时间', '超时解决占比', '满意度(%)'];
  540. break;
  541. case 'SFGS'://三方公司
  542. postData.key = 'mdv2_incident_repot_company';
  543. postData.titles = [($scope.sfgs_list[0]&&$scope.sfgs_list[0].userName)?'人员名称':'公司名称', '人员总数', '事件数量', '平均响应时长', '平均解决时长', '迟到次数'];
  544. if($scope.sfgs_list[0]&&$scope.sfgs_list[0].userName){
  545. postData.titles.splice(1,1);
  546. }
  547. break;
  548. case 'QYDD'://区域地点
  549. postData.type = $scope.areaSelectedOne.value.id;
  550. postData.key = 'mdv2_incident_repot_area_place';
  551. postData.titles = ['区域/地点', '事件数量', '事件占比'];
  552. break;
  553. case 'SJLY'://事件来源
  554. postData.key = 'mdv2_incident_repot_source';
  555. postData.titles = ['事件来源', '事件数量', '事件来源占比'];
  556. break;
  557. }
  558. var wt_url = api_bpm.downDataModel('report', 1).getRequestedUrl()
  559. $http({
  560. url: wt_url,
  561. method: 'POST',
  562. data: JSON.stringify(postData),
  563. headers: {
  564. 'Accept': '*/*'
  565. },
  566. responseType: 'arraybuffer'
  567. }).success(function (data, status, headers, config) {
  568. var fileName = '';
  569. switch ($scope.tap) {
  570. case 'SJZS'://事件总数
  571. fileName = '事件总数';
  572. break;
  573. case 'SJLX'://事件类型
  574. fileName = '事件类型';
  575. break;
  576. case 'CLRZ'://处理人/组
  577. fileName = '处理人/组';
  578. break;
  579. case 'SFGS'://三方公司
  580. fileName = '三方公司';
  581. break;
  582. case 'QYDD'://区域地点
  583. fileName = '区域地点';
  584. break;
  585. case 'SJLY'://事件来源
  586. fileName = '事件来源';
  587. break;
  588. }
  589. // var fileName = headers("Content-Disposition").split(";")[1].split("filename=")[1];
  590. var file = new Blob([data], {
  591. type: 'application/vnd.ms-excel'
  592. });
  593. var fileURL = URL.createObjectURL(file);
  594. var a = document.createElement('a');
  595. a.href = fileURL;
  596. a.target = '_blank';
  597. a.download = fileName + '.xls';
  598. document.body.appendChild(a);
  599. a.click();
  600. }).error(function (data, status, headers, config) {
  601. });
  602. };
  603. //初始化
  604. $scope.dateItemClick('day');
  605. $scope.mdxquery('accdate', 'desc');
  606. $scope.sortActive = 'accdatetop';
  607. $scope.name = 'accdate';//表格排序,字段名称
  608. $scope.type = 'desc';//表格排序,排序方式desc,asc
  609. $scope.direction = 'top';//箭头方向 top,bottom
  610. }])