event_formCtrl.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  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 = 'sumtop';
  215. $scope.name = 'sum';//表格排序,字段名称
  216. $scope.mdxquery('sum', '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_num = 0;//公司总数
  288. $scope.sfgs_num1 = 0;//人员总数
  289. $scope.sfgs_num2 = 0;//解决事件总数
  290. $scope.sfgs_resolvedTime = '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. name = $scope.tap == 'SJZS' ? 'accdate' : 'sum';
  306. }
  307. type = type || 'desc';
  308. switch ($scope.tap) {
  309. case 'SJZS'://事件总数
  310. $scope.sjzs_list = null;
  311. // 请求列表
  312. api_event_form.fetchSjzsList({
  313. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  314. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  315. "type": $scope.dateItem,
  316. "sortData": name,
  317. "sortType": type
  318. }).then(function (res) {
  319. if (res.stats == 200) {
  320. $scope.sjzs_list = res.dataList;//表格列表
  321. $scope.sjzs_num = res.sum;//事件总数数量
  322. $scope.sjzs_responseTime = res.responseTime;//平均响应时间
  323. $scope.sjzs_resolvedTime = res.resolvedTime;//平均解决时间
  324. $scope.sjzs_satisfactionRatio = res.satisfactionRatio;//满意度
  325. }
  326. })
  327. break;
  328. case 'SJLX'://事件类型
  329. $scope.sjlx_list = null;
  330. // 请求列表
  331. api_event_form.fetchSjlxList({
  332. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  333. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  334. "hierarchy": $scope.sjSelectedOne.value.id,
  335. "sortData": name,
  336. "sortType": type
  337. }).then(function (res) {
  338. if (res.stats == 200) {
  339. $scope.sjlx_list = res.typedataList;//表格列表
  340. }
  341. })
  342. // 请求事件总数数量
  343. api_event_form.getSjNum({
  344. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  345. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  346. }).then(function (res) {
  347. if (res.stats == 200) {
  348. $scope.sjlx_num = res.data[0].sum;//事件总数数量
  349. }
  350. })
  351. break;
  352. case 'CLRZ'://处理人/组
  353. $scope.clrz_list = null;
  354. //获取组
  355. api_user_data.fetchDataList('group', {
  356. idx: 0,
  357. sum: 1000,
  358. group: {
  359. selectType: "nouser"
  360. }
  361. }).then(res => {
  362. if (res.status == 200) {
  363. var groupList = [{
  364. id: -2,
  365. groupName: '按组选择'
  366. }, {
  367. id: -1,
  368. groupName: '按人选择'
  369. }];
  370. groupList.push(...res.list);
  371. $scope.groupSelected = groupList;//下拉框数据
  372. // 请求列表
  373. if ($scope.groupSelectedOne.value.id == -2) {//按组
  374. var params = {
  375. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  376. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  377. "type": 1,
  378. "sortData": name,
  379. "sortType": type
  380. };
  381. } else if ($scope.groupSelectedOne.value.id == -1) {//按人
  382. var params = {
  383. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  384. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  385. "type": 2,
  386. "sortData": name,
  387. "sortType": type
  388. };
  389. } else {
  390. var params = {
  391. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  392. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  393. "type": 3,
  394. "groupid": $scope.groupSelectedOne.value.id,
  395. "sortData": name,
  396. "sortType": type
  397. };
  398. }
  399. api_event_form.fetchClrzList(params).then(function (res) {
  400. if (res.stats == 200) {
  401. $scope.tableGroupSelectedOne = params.type;//处理人或组
  402. $scope.clrz_list = res.listData;//表格列表
  403. $scope.clrz_num = res.sum;//事件总数量
  404. $scope.clrz_responseTime = res.responseTime;//平均响应时间
  405. $scope.clrz_resolvedTime = res.resolvedTime;//平均解决时间
  406. $scope.clrz_satisfactionRatio = res.satisfactionRatio;//满意度
  407. }
  408. })
  409. }
  410. })
  411. break;
  412. case 'SFGS'://三方公司
  413. $scope.sfgs_list = null;
  414. //获取三方公司
  415. api_user_data.fetchDataList('company', {
  416. idx: 0,
  417. sum: 1000,
  418. company: {}
  419. }).then(res => {
  420. if (res.status == 200) {
  421. $scope.companySelected = res.list;//下拉框数据
  422. // 请求列表
  423. var postData = {
  424. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  425. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  426. "sortData": name,
  427. "sortType": type
  428. }
  429. if($scope.companySelectedOne.value.id > 0){
  430. postData.companyId = $scope.companySelectedOne.value.id;
  431. }
  432. api_event_form.fetchSfgsList(postData).then(function (res) {
  433. if (res.stats == 200) {
  434. $scope.sfgs_list = res.dataList;//表格列表
  435. $scope.sfgs_num = res.sum;//公司总数
  436. $scope.sfgs_num1 = res.sum1;//人员总数
  437. $scope.sfgs_num2 = res.responseTime;//解决事件总数
  438. $scope.sfgs_resolvedTime = res.resolvedTime;//平均解决时长
  439. }
  440. })
  441. }
  442. })
  443. break;
  444. case 'QYDD'://区域地点
  445. $scope.qydd_list = null;
  446. // 请求列表
  447. api_event_form.fetchQyddList({
  448. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  449. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  450. "type": $scope.areaSelectedOne.value.id,
  451. "sortData": name,
  452. "sortType": type
  453. }).then(function (res) {
  454. if (res.stats == 200) {
  455. $scope.qydd_list = res.listData;//表格列表
  456. }
  457. })
  458. // 请求事件总数数量
  459. api_event_form.getSjNum({
  460. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  461. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD')
  462. }).then(function (res) {
  463. if (res.stats == 200) {
  464. $scope.qydd_num = res.data[0].sum;//事件总数数量
  465. }
  466. })
  467. break;
  468. case 'SJLY'://事件来源
  469. $scope.sjly_list = null;
  470. // 请求列表
  471. api_event_form.fetchSjlyList({
  472. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  473. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  474. "sortData": name,
  475. "sortType": type
  476. }).then(function (res) {
  477. if (res.stats == 200) {
  478. $scope.sjly_list = res.listData;//表格列表
  479. }
  480. })
  481. // 请求事件总数数量
  482. api_event_form.getSjNum({
  483. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  484. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD')
  485. }).then(function (res) {
  486. if (res.stats == 200) {
  487. $scope.sjly_num = res.data[0].sum;//事件总数数量
  488. }
  489. })
  490. break;
  491. }
  492. };
  493. // 请求人
  494. // api_user_data.fetchDataList('requester', {
  495. // "idx": 0,
  496. // "sum": 10
  497. // }).then(function (response) {
  498. // if (response) {
  499. // if (response.status = 200) {
  500. // $scope.requester = response.list;
  501. // }
  502. // }
  503. // })
  504. //导出
  505. $scope.export = function () {
  506. var postData = {
  507. "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
  508. "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
  509. "sortData": $scope.name,
  510. "sortType": $scope.type,
  511. report: {}
  512. }
  513. switch ($scope.tap) {
  514. case 'SJZS'://事件总数
  515. postData.type = $scope.dateItem;
  516. postData.key = 'mdv2_incident_repot_sum';
  517. postData.titles = ['时间', '事件数量', '平均响应时间', '平均解决时间', '完全解决', '部分解决', '其他', '满意度(%)'];
  518. break;
  519. case 'SJLX'://事件类型
  520. postData.hierarchy = $scope.sjSelectedOne.value.id;
  521. postData.key = 'mdv2_incident_repot_type';
  522. postData.titles = ['事件类型', '类型数量', '类型占比', '平均响应时间', '平均解决时间', '完全解决', '部分解决', '其他'];
  523. break;
  524. case 'CLRZ'://处理人/组
  525. if ($scope.groupSelectedOne.value.id == -2) {//按组
  526. postData.type = 1;
  527. } else if ($scope.groupSelectedOne.value.id == -1) {//按人
  528. postData.type = 2;
  529. } else {
  530. postData.type = 3;
  531. }
  532. postData.key = 'mdv2_incident_repot_handle';
  533. postData.titles = ['处理组', '事件数量', '事件占比', '按时响应', '超时响应', '平均响应时间', '超时响应占比', '按时解决', '超时解决', '平均解决时间', '超时解决占比', '满意度(%)'];
  534. break;
  535. case 'SFGS'://三方公司
  536. postData.key = 'mdv2_incident_repot_company';
  537. postData.titles = ['公司名称', '人员总数', '事件数量', '平均响应时长', '平均解决时长'];
  538. break;
  539. case 'QYDD'://区域地点
  540. postData.type = $scope.areaSelectedOne.value.id;
  541. postData.key = 'mdv2_incident_repot_area_place';
  542. postData.titles = ['区域/地点', '事件数量', '事件占比'];
  543. break;
  544. case 'SJLY'://事件来源
  545. postData.key = 'mdv2_incident_repot_source';
  546. postData.titles = ['事件来源', '事件数量', '事件来源占比'];
  547. break;
  548. }
  549. var wt_url = api_bpm.downDataModel('report', 1).getRequestedUrl()
  550. $http({
  551. url: wt_url,
  552. method: 'POST',
  553. data: JSON.stringify(postData),
  554. headers: {
  555. 'Accept': '*/*'
  556. },
  557. responseType: 'arraybuffer'
  558. }).success(function (data, status, headers, config) {
  559. var fileName = '';
  560. switch ($scope.tap) {
  561. case 'SJZS'://事件总数
  562. fileName = '事件总数';
  563. break;
  564. case 'SJLX'://事件类型
  565. fileName = '事件类型';
  566. break;
  567. case 'CLRZ'://处理人/组
  568. fileName = '处理人/组';
  569. break;
  570. case 'SFGS'://三方公司
  571. fileName = '三方公司';
  572. break;
  573. case 'QYDD'://区域地点
  574. fileName = '区域地点';
  575. break;
  576. case 'SJLY'://事件来源
  577. fileName = '事件来源';
  578. break;
  579. }
  580. // var fileName = headers("Content-Disposition").split(";")[1].split("filename=")[1];
  581. var file = new Blob([data], {
  582. type: 'application/vnd.ms-excel'
  583. });
  584. var fileURL = URL.createObjectURL(file);
  585. var a = document.createElement('a');
  586. a.href = fileURL;
  587. a.target = '_blank';
  588. a.download = fileName + '.xls';
  589. document.body.appendChild(a);
  590. a.click();
  591. }).error(function (data, status, headers, config) {
  592. });
  593. };
  594. //初始化
  595. $scope.dateItemClick('day');
  596. $scope.mdxquery('accdate', 'desc');
  597. $scope.sortActive = 'accdatetop';
  598. $scope.name = 'accdate';//表格排序,字段名称
  599. $scope.type = 'desc';//表格排序,排序方式desc,asc
  600. $scope.direction = 'top';//箭头方向 top,bottom
  601. }])