main.js 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. var app = angular.module('itsmApp', ['itsm-dep']);
  2. // // 华科ip
  3. // //var serverIp = "http://testncc.hust.edu.cn/service";
  4. // var serverIp = "http://itservice.hust.edu.cn/service";
  5. // var serviceip = "http://pass.hust.edu.cn/cas/logout.jsp?redirectUrl=http://itservice.hust.edu.cn";
  6. // //var servicewechatip = "http://115.156.150.70:8080/requester/#/tab/dashboard";
  7. // var servicewechatip = "http://itservice.hust.edu.cn/requester/#/tab/dashboard";
  8. // //var reportIp = "http://115.156.150.117";
  9. // //var reportIp = "http://172.16.4.91";
  10. // var reportIp = "http://172.16.4.91:8080/service";
  11. // var inspectIp = "http://192.168.77.57";
  12. // var callIp = "http://192.168.77.57:8088";
  13. // 本地调试ip
  14. //var serverIp = "http://testncc.hust.edu.cn/service";
  15. var serverIp = "http://localhost/service";
  16. var serviceip = "http://pass.hust.edu.cn/cas/logout.jsp?redirectUrl=http://itservice.hust.edu.cn";
  17. //var servicewechatip = "http://115.156.150.70:8080/requester/#/tab/dashboard";
  18. var servicewechatip = "http://itservice.hust.edu.cn/requester/#/tab/dashboard";
  19. //var reportIp = "http://115.156.150.117";
  20. // var reportIp = "http://172.16.4.91";
  21. // var reportIp = "http://192.168.3.95:8080/service";
  22. var reportIp = location.origin +"/service";
  23. // var reportIp = "http://192.168.3.95:8080/service";
  24. var inspectIp = "http://localhost";
  25. var callIp = "http://localhost";
  26. app.run(['$rootScope', '$state', '$stateParams', '$auth', '$http', '$cookieStore', 'Restangular',
  27. function($rootScope, $state, $stateParams, $auth, $http, $cookieStore, Restangular) {
  28. // Attach Fastclick for eliminating the 300ms delay between a physical tap and the firing of a click event on mobile browsers
  29. FastClick.attach(document.body);
  30. // Set some reference to access them from any scope
  31. $rootScope.$state = $state;
  32. $rootScope.$stateParams = $stateParams;
  33. // GLOBAL APP SCOPE
  34. // set below basic information
  35. // $rootScope.audioiIp="http://218.197.181.213:8080"
  36. $rootScope.app = {
  37. name: '智慧华中大 | 网络与信息化运维管理系统', // name of your project
  38. author: '网络与信息化运维管理系统', // author's name or company name
  39. description: '智慧华中大 | 网络与信息化运维管理系统 V2.0', // brief description
  40. version: 'V2.0', // current version
  41. year: ((new Date()).getFullYear()), // automatic current year (for copyright information)
  42. isMobile: (function() { // true if the browser is a mobile device
  43. var check = false;
  44. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  45. check = true;
  46. };
  47. return check;
  48. })(),
  49. isChrome: false,
  50. isLoginFixed: false,
  51. layout: {
  52. // isLoginFixed: true,
  53. isNavbarFixed: true, //true if you want to initialize the template with fixed header
  54. isSidebarFixed: true, // true if you want to initialize the template with fixed sidebar
  55. isSidebarClosed: false, // true if you want to initialize the template with closed sidebar
  56. isFooterFixed: false, // true if you want to initialize the template with fixed footer
  57. theme: 'theme-8', // indicate the theme chosen for your project
  58. logo: 'assets/images/logo.png' // relative path of the project logo
  59. }
  60. };
  61. // $http.defaults.headers.common["X-Auth-Token"] = $cookieStore.get('Auth-Token') || null;
  62. // $http.defaults.headers.common["X-Auth-Token"] = $cookieStore.get('Auth-Token') || null;
  63. Restangular.setErrorInterceptor(function(element, operation, what, url, headers, queryParams) {
  64. if (!url) {
  65. // console.log($http);
  66. // console.log($auth);
  67. if (element.config.url ==
  68. "http://testncc.hust.edu.cn/service/api/bpm/data/getCount"
  69. ) {
  70. window.location.href = serviceip;
  71. document.getElementById("casUserId").value = null;
  72. }
  73. }
  74. // console.log(element);
  75. })
  76. Restangular.setFullRequestInterceptor(function(element, operation, what, url, headers, queryParams) {
  77. var token = $cookieStore.get('Auth-Token') || null;
  78. var isReportUri = url.indexOf('saiku') > 0;
  79. if (token && isReportUri) {
  80. return {
  81. element: element,
  82. params: queryParams,
  83. headers: _.extend({}, headers, { 'X-Auth-Token': $cookieStore.get('Auth-Token') || null })
  84. };
  85. } else {
  86. return {
  87. element: element,
  88. params: queryParams,
  89. headers: headers
  90. };
  91. }
  92. });
  93. Restangular.addResponseInterceptor(function(data, operation, what, url, response, deferred) {
  94. var ua = window.navigator.userAgent.toLowerCase();
  95. ua.match(/chrome/i)
  96. if (data) {
  97. if (data.state == "433") {
  98. $rootScope.logout();
  99. var Notification = window.Notification;
  100. Notification.requestPermission();
  101. sessionStorage.clear();
  102. data = {};
  103. var n = new Notification("登录退出", {
  104. body: "您的账号在其他地方登录,请确认后重新登录",
  105. icon: '../bower_components/HTML5-Desktop-Notifications/alert.ico',
  106. onclick: function onNotificationClicked() {
  107. console.log('Notification clicked.');
  108. }
  109. });
  110. } else if (data.state == "403") {
  111. $state.go("app.dashboard");
  112. var Notification = window.Notification;
  113. Notification.requestPermission();
  114. var n = new Notification("无权限访问", {
  115. body: "此页面无权限访问",
  116. icon: '../bower_components/HTML5-Desktop-Notifications/alert.ico',
  117. onclick: function onNotificationClicked() {
  118. console.log('Notification clicked.');
  119. }
  120. });
  121. } else {
  122. deferred.resolve(data)
  123. }
  124. }
  125. });
  126. // $rootScope.nickname ='lijin';
  127. // $rootScope.user = {
  128. // name: 'Peter',
  129. // job: 'ng-Dev',
  130. // picture: 'app/img/user/02.jpg'
  131. // };
  132. }
  133. ]);
  134. // translate config
  135. app.config(['$translateProvider',
  136. function($translateProvider) {
  137. // prefix and suffix information is required to specify a pattern
  138. // You can simply use the static-files loader with this pattern:
  139. $translateProvider.useStaticFilesLoader({
  140. prefix: 'assets/i18n/',
  141. suffix: '.json'
  142. });
  143. // Since you've now registered more then one translation table, angular-translate has to know which one to use.
  144. // This is where preferredLanguage(langKey) comes in.
  145. $translateProvider.preferredLanguage('zh');
  146. // Store the language in the local storage
  147. $translateProvider.useLocalStorage();
  148. }
  149. ]);
  150. // Angular-Loading-Bar
  151. // configuration
  152. app.config(['cfpLoadingBarProvider',
  153. function(cfpLoadingBarProvider) {
  154. cfpLoadingBarProvider.includeBar = true;
  155. cfpLoadingBarProvider.includeSpinner = false;
  156. }
  157. ]);
  158. /**
  159. * // http: //115.156.150.70:9680/api/webservice/data/fetchDataList/queryUser
  160. */
  161. app.config(['RestangularProvider', function(RestangularProvider) {
  162. RestangularProvider.setBaseUrl('');
  163. }]);
  164. app.factory('serviceip', function(Restangular) {
  165. return Restangular.withConfig(function(RestangularConfigurer) {
  166. RestangularConfigurer.setBaseUrl(serviceip);
  167. });
  168. });
  169. app.factory('WechatRestangular', function(Restangular) {
  170. return Restangular.withConfig(function(RestangularConfigurer) {
  171. RestangularConfigurer.setBaseUrl(serverIp + '/api/common/');
  172. });
  173. });
  174. app.factory('api_wechatfile', ['WechatRestangular', function(WechatRestangular) {
  175. var dataService = WechatRestangular.all("common");
  176. return {
  177. listAttachments: function(type, model) {
  178. return dataService.customGET('listAttachment/' + type + "/" + model, {});
  179. // return dataService.one('listAttachment/' + type + "/" + model);
  180. },
  181. downloadAttachment: function(model) {
  182. return dataService.one('downloadAttachment/' + model, {});
  183. },
  184. attachmentsPreviewUrl: function(attachmentId) {
  185. return dataService.customGET('attachmentsPreviewUrl/' + attachmentId);
  186. },
  187. download: function(attachmentId) {
  188. return dataService.one('getAttachmentContent/' + attachmentId);
  189. },
  190. getDictionary: function(data) {
  191. return dataService.customPOST(data, 'getDictionary', {});
  192. }
  193. };
  194. }]);
  195. /**
  196. * // http: //115.156.150.70:9680/webservice/data/fetchDataList/queryUser
  197. */
  198. //信息中心 --wt
  199. app.factory('msgRestangular', function(Restangular) {
  200. return Restangular.withConfig(function(RestangularConfigurer) {
  201. RestangularConfigurer.setBaseUrl(serverIp + '/messageStation');
  202. });
  203. });
  204. app.factory('api_msg', ['msgRestangular', function(msgRestangular) {
  205. var msgService = msgRestangular.all("data");
  206. return {
  207. msgDataList: function(data) {
  208. return msgService.customPOST(data, 'fetchDataList/messageStation', {});
  209. },
  210. updateDataList: function(data) {
  211. return msgService.customPOST(data, 'updateModel/messageStation', {});
  212. },
  213. };
  214. }]);
  215. //报表
  216. app.factory('hkreportRestangular', function(Restangular) {
  217. return Restangular.withConfig(function(RestangularConfigurer) {
  218. RestangularConfigurer.setBaseUrl(reportIp + '/report');
  219. });
  220. });
  221. app.factory('api_hkreport', ['hkreportRestangular', function(hkreportRestangular) {
  222. var msgService = hkreportRestangular.all("data");
  223. return {
  224. incidentreport: function(data, key) {
  225. return msgService.customPOST(data, key, {});
  226. }
  227. };
  228. }]);
  229. //
  230. app.factory('webserviceRestangular', function(Restangular) {
  231. return Restangular.withConfig(function(RestangularConfigurer) {
  232. RestangularConfigurer.setBaseUrl(serverIp + '/api/webservice/');
  233. });
  234. });
  235. app.factory('api_webservice', ['webserviceRestangular', function(webserviceRestangular) {
  236. var dataService = webserviceRestangular.all("data");
  237. return {
  238. fetchDataList: function(model, data) {
  239. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  240. }
  241. };
  242. }]);
  243. app.factory('playRestangular', function(Restangular) {
  244. return Restangular.withConfig(function(RestangularConfigurer) {
  245. RestangularConfigurer.setBaseUrl(callIp);
  246. });
  247. });
  248. app.factory('api_playservice', ['playRestangular', function(playRestangular) {
  249. var dataService = playRestangular.all("recording");
  250. return {
  251. playData: function(attachmentId) {
  252. return dataService.customGET('recording?callID=' + attachmentId);
  253. },
  254. };
  255. }]);
  256. app.factory('ConversationRestangular', function(Restangular) {
  257. return Restangular.withConfig(function(RestangularConfigurer) {
  258. RestangularConfigurer.setBaseUrl(serverIp + '/api/conversation/');
  259. });
  260. });
  261. app.factory('api_conversation', ['ConversationRestangular', function(ConversationRestangular) {
  262. var dataService = ConversationRestangular.all("conversation");
  263. return {
  264. roleMenu: function(model) {
  265. return dataService.customGET('roleMenu/' + model, {});
  266. },
  267. pageMenuByCode: function(model) {
  268. return dataService.customGET('pageMenuByCode/' + model, {});
  269. },
  270. pageEvent: function(data, model) {
  271. return dataService.customPOST(data, 'pageEvent', {});
  272. }
  273. };
  274. }]);
  275. app.factory('textRestangular', function(Restangular) {
  276. return Restangular.withConfig(function(RestangularConfigurer) {
  277. // RestangularConfigurer.setBaseUrl(inspectIp + ':8080/IXServer/');
  278. RestangularConfigurer.setBaseUrl(inspectIp + ':8088/IXServer/');
  279. });
  280. });
  281. app.factory('api_text', ['textRestangular', function(textRestangular) {
  282. var loginService = textRestangular.all("comm");
  283. var loginsins = textRestangular.all("tele/agent");
  284. return {
  285. start: function(phone, id) {
  286. var rdata = "dom=0&epwd=&aid=" + id + "&apwd=e10adc3949ba59abbe56e057f20f883e&adn=" + phone;
  287. return loginService.customPOST(rdata, 'start', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  288. },
  289. exit: function(token) {
  290. var rdata = "dom=0&token=" + token;
  291. return loginService.customPOST(rdata, 'exit', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  292. },
  293. login: function(group, token, id) {
  294. var rdata = "dom=0&token=" + token + "&aid=" + id + "&acd=" + group + "&skill=-1&mon=false&silent=false";
  295. return loginsins.customPOST(rdata, 'login', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  296. },
  297. logout: function(token, id) {
  298. var rdata = "dom=0&token=" + token + "&aid=" + id + "";
  299. return loginsins.customPOST(rdata, 'logout', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  300. },
  301. dialout: function(token, gid, teleno) {
  302. var rdata = "dom=0&token=" + token + "&teleno=" + teleno + "&gid=" + gid + "&uud=&async=true";
  303. return loginsins.customPOST(rdata, 'dialout', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  304. },
  305. callout: function(token, teleno) {
  306. var rdata = "dom=0&token=" + token + "&teleno=" + teleno + "&uud=&async=true";
  307. return loginsins.customPOST(rdata, 'dialout', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  308. },
  309. setbusy: function(token) {
  310. var rdata = "dom=0&token=" + token;
  311. return loginsins.customPOST(rdata, 'setbusy', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  312. },
  313. setidle: function(token) {
  314. var rdata = "dom=0&token=" + token;
  315. return loginsins.customPOST(rdata, 'setidle', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  316. },
  317. inittrans: function(telephone, token) {
  318. var rdata = "dom=0&token=" + token + "&teleno=" + telephone + "&uud=&async=true";
  319. return loginsins.customPOST(rdata, 'inittrans', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  320. },
  321. comptrans: function(telephone, token) {
  322. var rdata = "dom=0&token=" + token;
  323. return loginsins.customPOST(rdata, 'comptrans', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  324. },
  325. record: function(token) {
  326. var rdata = "dom=0&token=" + token + "&filename=/tmp/agent.wav&async=true&maxtime=10&termchar=&append=true";
  327. return loginsins.customPOST(rdata, 'record', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  328. },
  329. offhook: function(token) {
  330. var rdata = "dom=0&token=" + token;
  331. return loginsins.customPOST(rdata, 'offhook', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  332. },
  333. onhook: function(token) {
  334. var rdata = "dom=0&token=" + token;
  335. return loginsins.customPOST(rdata, 'onhook', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  336. },
  337. getcdrid: function(token) {
  338. var rdata = "dom=0&token=" + token;
  339. return loginsins.customPOST(rdata, 'getcdrid', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  340. }
  341. }
  342. }])
  343. app.factory('UserRestangular', function(Restangular) {
  344. return Restangular.withConfig(function(RestangularConfigurer) {
  345. RestangularConfigurer.setBaseUrl(serverIp + '/api/user/');
  346. });
  347. });
  348. app.factory('api_user', ['UserRestangular', function(UserRestangular) {
  349. var basePath = "user/";
  350. return {
  351. };
  352. }]);
  353. app.factory('api_login', ['UserRestangular', function(UserRestangular) {
  354. var loginService = UserRestangular.all("auth");
  355. return {
  356. login: function(username, password) {
  357. return loginService.customPOST({ 'username': username, 'password': password }, 'login', {});
  358. },
  359. // logout: function(sessionid,userid){
  360. // return loginService.customPOST(sessionid + '/' + userid);
  361. // },
  362. sso: function(nickname) {
  363. return loginService.customGET('sso/' + nickname);
  364. },
  365. resetpwd: function(userid) {
  366. return loginService.customGET('resetpwd/' + userid);
  367. },
  368. uppwd: function(data) {
  369. return loginService.customPOST(data, 'uppwd', {});
  370. }
  371. }
  372. }])
  373. app.factory('applyRestangular', function(Restangular) {
  374. return Restangular.withConfig(function(RestangularConfigurer) {
  375. RestangularConfigurer.setBaseUrl(serverIp + '/api/apply/');
  376. });
  377. });
  378. app.factory('api_apply', ['applyRestangular', function(applyRestangular) {
  379. var applyService = applyRestangular.all("bpm");
  380. return {
  381. wxIncidentReject: function(id, data) {
  382. return applyService.customPOST(data, 'wxIncidentReject/' + id, {});
  383. }
  384. }
  385. }])
  386. app.factory('api_user_data', ['UserRestangular', function(UserRestangular) {
  387. var dataService = UserRestangular.all("data");
  388. var userService = UserRestangular.all("auth");
  389. return {
  390. validate: function(data) {
  391. return dataService.customPOST(data, 'validate/role', {});
  392. },
  393. importData: function() {
  394. return dataService.one('/importData');
  395. },
  396. fetchDataList: function(model, data) {
  397. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  398. },
  399. fetchData: function(model, data) {
  400. return dataService.customPOST(data, 'fetchData/' + model, {});
  401. },
  402. addData: function(model, data) {
  403. return dataService.customPOST(data, 'addData/' + model, {});
  404. },
  405. updData: function(model, data) {
  406. return dataService.customPOST(data, 'updData/' + model, {});
  407. },
  408. rmvData: function(model, data) {
  409. return dataService.customPOST(data, 'rmvData/' + model, {});
  410. },
  411. register: function(data) {
  412. return dataService.customPOST(data, 'register', {});
  413. },
  414. downDataModel: function(type, month) {
  415. return dataService.one('downDataModel/' + type + '/' + month);
  416. },
  417. fetchgetData: function(model, data) {
  418. return dataService.customGET('fetchData/' + model + '/' + data, {});
  419. },
  420. roleMenu: function(model) {
  421. return userService.customGET('roleMenu/' + model, {});
  422. },
  423. pageMenuByCode: function(model) {
  424. return userService.customGET('pageMenuByCode/' + model, {});
  425. },
  426. pageEvent: function(data, model) {
  427. return userService.customPOST(data, 'pageEvent', {});
  428. },
  429. pageMenu: function(data, model) {
  430. return userService.customPOST(data, 'pageMenu', {});
  431. // return userService.one('/pageMenu' + data);
  432. },
  433. getMenu: function(data, model) {
  434. return userService.customPOST(data, 'getMenu', {});
  435. }
  436. };
  437. }]);
  438. // app.factory('DpmRestangular', function(Restangular) {
  439. // return Restangular.withConfig(function(RestangularConfigurer) {
  440. // RestangularConfigurer.setBaseUrl(serverIp+':9008/data/');
  441. // });
  442. // });
  443. // app.factory('api_bpm_dbca', ['DpmRestangular', function(DpmRestangular){
  444. // var bpm = DpmRestangular.all("bpm");
  445. // return {
  446. // impFileData: function(pdKey){
  447. // return bpm.customPOST( 'impFileData/' + pdKey);
  448. // },
  449. // };
  450. // }]);
  451. app.factory('BpmRestangular', function(Restangular) {
  452. return Restangular.withConfig(function(RestangularConfigurer) {
  453. // RestangularConfigurer.setBaseUrl("http://168.166.3.41"+':9008/api/');
  454. RestangularConfigurer.setBaseUrl(serverIp + '/api/bpm');
  455. });
  456. });
  457. app.factory('api_statistic', ['BpmRestangular', function(BpmRestangular) {
  458. var statistic = BpmRestangular.all("statistic");
  459. return {
  460. query: function(data, rptId) {
  461. return statistic.customPOST(data, 'unidimensional/' + rptId, {});
  462. },
  463. // exportData: function(reportView, uuid, reportfileName){
  464. // return reportService.one('query/rest/export/xls/?exportname='+reportfileName+'xls');
  465. // }
  466. unidimensionalExport: function(rptId) {
  467. return statistic.one('unidimensionalExport/' + rptId);
  468. }
  469. }
  470. }]);
  471. app.factory('api_bpm', ['BpmRestangular', function(BpmRestangular) {
  472. var process = BpmRestangular.all("process");
  473. return {
  474. deploy: function(data) {
  475. return process.customPOST(data, 're/model/deploy', {});
  476. },
  477. list: function() {
  478. return process.customGET('re/model/list');
  479. },
  480. modelsource: function(pdId) {
  481. return process.customGET('re/model/' + pdId + '/source');
  482. },
  483. // savemodel: function(pdId, data) {
  484. // return process.customPOST(data, 're/model/' + pdId + '/save', {});
  485. // },
  486. savemodel: function(pdId, data) {
  487. return process.customPOST(data, 'saveModel/' + pdId, {});
  488. },
  489. removemodel: function(modelId) {
  490. return process.customGET('re/model/' + modelId + '/remove');
  491. }
  492. };
  493. }]);
  494. app.factory('CommonRestangular', function(Restangular) {
  495. return Restangular.withConfig(function(RestangularConfigurer) {
  496. RestangularConfigurer.setBaseUrl(serverIp + '/api/common');
  497. });
  498. });
  499. app.factory('api_bpm_domain', ['BpmRestangular', 'CommonRestangular', function(BpmRestangular, CommonRestangular) {
  500. var bpmService = BpmRestangular.all("bpm");
  501. var commonService = CommonRestangular.all("common");
  502. return {
  503. fetchtask: function(pdKey, data) {
  504. return bpmService.customPOST(data, 'fetchTask/' + pdKey, {});
  505. },
  506. start: function(pdKey, data) {
  507. return bpmService.customPOST(data, 'start/' + pdKey, {});
  508. },
  509. flowTracing: function(processInstanceId, data) {
  510. return bpmService.customPOST(data, 'flowTracing/' + processInstanceId, {});
  511. },
  512. complete: function(taskId, userId, data) {
  513. return bpmService.customPOST(data, 'completeTask/' + taskId + '/' + userId, {});
  514. },
  515. completeUpgrade: function(data) {
  516. return bpmService.customPOST(data, 'upgradeIncident', {});
  517. },
  518. save: function(taskId, data) {
  519. return bpmService.customPOST(data, 'saveTaskVar/' + taskId, {});
  520. },
  521. claimtask: function(taskId, data) {
  522. return bpmService.customPOST(data, 'claimTask/' + taskId, {});
  523. },
  524. claimAndCompletedTask: function(taskId, data) {
  525. return bpmService.customPOST(data, 'claimAndCompletedTask/' + taskId, {});
  526. },
  527. delegateTask: function(taskId, data) {
  528. return bpmService.customPOST(data, 'delegateTask/' + taskId, {});
  529. },
  530. expectedTime: function(taskId) {
  531. return bpmService.customGET('expectedTime/' + taskId);
  532. },
  533. history: function(processId) {
  534. return bpmService.customGET('history/' + processId);
  535. },
  536. upgrade: function(processInstanceId, taskId, data) {
  537. return bpmService.customPOST(data, 'upgradeIncident/' + processInstanceId + '/' + taskId, {});
  538. },
  539. listAttachments: function(processId, data) {
  540. return bpmService.customPOST(data, 'getAttachmentList/' + processId, {});
  541. },
  542. saveAttachments: function(processId, taskId, userId, data) {
  543. return bpmService.one('saveAttachments/' + processId + '/' + taskId + '/' + userId);
  544. },
  545. uploadAttachment: function(processId, taskId, userId, data) {
  546. return commonService.one('uploadAttachment/' + 'inspection/' + processId);
  547. },
  548. download: function(attachmentId) {
  549. return bpmService.one('getAttachmentContent/' + attachmentId);
  550. },
  551. // download: function(attachmentId){
  552. // return bpmService.customGET('getAttachmentContent/' + attachmentId,{},{'responseType':'arraybuffer'});
  553. // },
  554. attachmentsPreviewUrl: function(attachmentId) {
  555. return bpmService.customGET('attachmentsPreviewUrl/' + attachmentId);
  556. },
  557. startformkey: function(pdKey) {
  558. return bpmService.customGET('startformkey/' + pdKey);
  559. },
  560. taskformkey: function(taskId) {
  561. return bpmService.customGET('taskformkey/' + taskId);
  562. },
  563. workernumber: function(type) {
  564. return bpmService.customGET('restful/' + type);
  565. },
  566. getWatchAreaPosition: function(data) {
  567. return bpmService.customGET('getWatchAreaPosition');
  568. },
  569. getWatchAreaData: function(id) {
  570. return bpmService.customGET('getWatchAreaData/' + id);
  571. }
  572. };
  573. }]);
  574. app.factory('api_bpm_data', ['BpmRestangular', function(BpmRestangular) {
  575. var dataService = BpmRestangular.all("data");
  576. var serviceCatalogue = BpmRestangular.all("ServiceCatalogue");
  577. var inspectionProcessActual = BpmRestangular.all("InspectionProcessActual");
  578. return {
  579. impFileData: function() {
  580. return dataService.one('/impFileData/bpm_scheduleorder');
  581. },
  582. importData: function() {
  583. return dataService.one('/impFileData');
  584. },
  585. fetchDataList: function(model, data) {
  586. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  587. },
  588. fetchData: function(model, dataId) {
  589. return dataService.customGET('fetchData/' + model + '/' + dataId);
  590. },
  591. fetchServiceTasks: function(model, data) {
  592. if (!model) {
  593. model = "ALL"
  594. }
  595. return serviceCatalogue.customPOST(data, 'fetchServiceTasks/' + model, {});
  596. },
  597. fetchInspectServiceTasks: function(model, data) {
  598. if (!model) {
  599. model = "ALL"
  600. }
  601. return inspectionProcessActual.customPOST(data, 'fetchServiceTasks/' + model, {});
  602. },
  603. addData: function(model, data) {
  604. return dataService.customPOST(data, 'addData/' + model, {});
  605. },
  606. updData: function(model, data) {
  607. return dataService.customPOST(data, 'updData/' + model, {});
  608. },
  609. rmvData: function(model, data) {
  610. return dataService.customPOST(data, 'rmvData/' + model, {});
  611. },
  612. getCount: function(data) {
  613. return dataService.customPOST(data, 'getCount', {});
  614. },
  615. downDataModel: function(type, month) {
  616. return dataService.one('downDataModel/' + type + '/' + month);
  617. },
  618. fetchDataByGroupId: function(data) {
  619. return dataService.customPOST(data, 'fetchDataByGroupId', {});
  620. },
  621. // downDataModel: function(type, month, data) {
  622. // return dataService.customPOST(data, 'downDataModel/' + type + '/' + month, {}, { 'Accept': 'application/json, text/javascript, */*' });
  623. // }
  624. };
  625. }]);
  626. app.factory('api_bpm_schedule', ['BpmRestangular', function(BpmRestangular) {
  627. var dataService = BpmRestangular.all("data");
  628. return {
  629. getScheduleClass: function() {
  630. var data = {
  631. "idx": "0",
  632. "sum": "10"
  633. };
  634. return dataService.customPOST(data, 'fetchDataList/scheduleclass', {});
  635. },
  636. fetchList: function(startTime, endTime, userId, queryKey) {
  637. var scheduleOrder = {
  638. "scheduleorder": {
  639. "startTime": startTime,
  640. "endTime": endTime
  641. },
  642. "idx": "0",
  643. "sum": "1000"
  644. };
  645. if (userId) {
  646. scheduleOrder['scheduleorder']['user'] = userId;
  647. }
  648. if (queryKey) {
  649. scheduleOrder['scheduleorder']['description'] = queryKey;
  650. }
  651. return dataService.customPOST(scheduleOrder, 'fetchDataList/scheduleorder', {});
  652. },
  653. fetchData: function(dataId) {
  654. return dataService.customGET('fetchData/scheduleorder/' + dataId);
  655. },
  656. update: function(data) {
  657. return dataService.customPOST(data, 'updData/scheduleorder', {});
  658. },
  659. add: function(data) {
  660. return dataService.customPOST(data, 'addData/scheduleorder', {});
  661. },
  662. remove: function(data) {
  663. return dataService.customPOST(data, 'rmvData/scheduleorder', {});
  664. },
  665. fetchSchedule: function(userId, startTime, endTime) {
  666. var scheduleData = {
  667. "schedulewatch": {
  668. "type": "1",
  669. "user": {
  670. "id": userId
  671. },
  672. "startTime": startTime,
  673. "endTime": endTime
  674. },
  675. "idx": "0",
  676. "sum": "100"
  677. };
  678. return dataService.customPOST(scheduleData, 'fetchDataList/schedulewatch', {});
  679. },
  680. queryRecieveSwitch: function(userId) {
  681. var handleSwitch = {
  682. "schedulewatch": {
  683. "type": "3",
  684. "user": {
  685. "id": userId
  686. }
  687. },
  688. "idx": "0",
  689. "sum": "10"
  690. };
  691. return dataService.customPOST(handleSwitch, 'fetchDataList/schedulewatch', {});
  692. },
  693. queryHandleoutSwitch: function(userId) {
  694. var handleSwitch = {
  695. "schedulewatch": {
  696. "type": "2",
  697. "user": {
  698. "id": userId
  699. }
  700. },
  701. "idx": "0",
  702. "sum": "10"
  703. };
  704. return dataService.customPOST(handleSwitch, 'fetchDataList/schedulewatch', {});
  705. },
  706. handleSchedule: function(data) {
  707. return dataService.customPOST(data, 'updData/schedulewatch', {});
  708. },
  709. querySwitch: function(filterData) {
  710. var switchData = {
  711. "scheduleorder": {
  712. "type": "4"
  713. },
  714. "idx": filterData.idx,
  715. "sum": filterData.sum
  716. };
  717. return dataService.customPOST(switchData, 'fetchDataList/scheduleorder', {});
  718. },
  719. query: function(filterData) {
  720. var switchData = {
  721. "scheduleorder": filterData.scheduleorder,
  722. "idx": filterData.idx,
  723. "sum": filterData.sum
  724. };
  725. return dataService.customPOST(switchData, 'fetchDataList/scheduleorder', {});
  726. }
  727. };
  728. }]);
  729. app.factory('SysinfoRestangular', function(Restangular) {
  730. return Restangular.withConfig(function(RestangularConfigurer) {
  731. RestangularConfigurer.setBaseUrl(serverIp + '/api/sysinfo/');
  732. });
  733. });
  734. app.factory('api_sysinfo', ['SysinfoRestangular', function(SysinfoRestangular) {
  735. var dataService = SysinfoRestangular.all("data");
  736. return {
  737. fetchDataList: function(model, data) {
  738. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  739. },
  740. addData: function(model, data) {
  741. return dataService.customPOST(data, 'addData/' + model, {});
  742. },
  743. getSerialnumber: function(type, model) {
  744. return dataService.customGET('getSerialnumber/' + type + '/' + model);
  745. }
  746. };
  747. }]);
  748. app.factory('ConfigureRestangular', function(Restangular) {
  749. return Restangular.withConfig(function(RestangularConfigurer) {
  750. RestangularConfigurer.setBaseUrl(serverIp + '/api/config/');
  751. });
  752. });
  753. app.factory('api_configure_form', ['ConfigureRestangular', function(ConfigureRestangular) {
  754. var formService = ConfigureRestangular.all("form");
  755. return {
  756. renderForm: function(formKey, userId, processInstanceId) {
  757. if (processInstanceId) {
  758. return formService.customGET('renderForm/' + formKey + "/" + processInstanceId + "/" + userId);
  759. } else {
  760. return formService.customGET('renderForm/' + formKey + "/000000/" + userId);
  761. }
  762. },
  763. renderList: function(formKey) {
  764. return formService.customGET('renderList/' + formKey);
  765. },
  766. renderTabForm: function(classify) {
  767. return formService.customGET('renderTabForm/' + classify);
  768. }
  769. };
  770. }]);
  771. app.factory('api_configure_data', ['ConfigureRestangular', function(ConfigureRestangular) {
  772. var dataService = ConfigureRestangular.all("data");
  773. return {
  774. fetchDataList: function(model, data) {
  775. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  776. },
  777. linkConfigure: function(model, data) {
  778. return dataService.customPOST(data, 'linkConfigure/' + model, {});
  779. },
  780. fetchDataById: function(model, id) {
  781. return dataService.customGET('fetchData/' + id + '/' + model);
  782. },
  783. fetchData: function(model, data) {
  784. return dataService.customPOST(data, 'fetchData/' + model, {});
  785. },
  786. addData: function(model, data) {
  787. return dataService.customPOST(data, 'addData/' + model, {});
  788. },
  789. rmvData: function(model, data) {
  790. return dataService.customPOST(data, 'rmvData/' + model, {});
  791. },
  792. updData: function(model, data) {
  793. return dataService.customPOST(data, 'updData/' + model, {});
  794. },
  795. downModels: function(type, id, name) {
  796. return dataService.one('export/' + type + '/' + id + '/' + name);
  797. }
  798. };
  799. }]);
  800. app.factory('SolutionRestangular', function(Restangular) {
  801. return Restangular.withConfig(function(RestangularConfigurer) {
  802. //RestangularConfigurer.setBaseUrl('http://168.166.203.41:9000/services');
  803. RestangularConfigurer.setBaseUrl(serverIp + '/api/solution');
  804. });
  805. });
  806. app.factory('api_solution', ['SolutionRestangular', function(SolutionRestangular) {
  807. var solutionService = SolutionRestangular.all("solution");
  808. var data = SolutionRestangular.all("solutionData");
  809. var history = SolutionRestangular.all("solutionHistory");
  810. var review = SolutionRestangular.all("solution_review");
  811. var typeservice = SolutionRestangular.all("solutionType");
  812. var groupservice = SolutionRestangular.all("solutionGroup");
  813. return {
  814. findSolutionByKeys: function(data) {
  815. var key = data.key,
  816. status = data.status || 0,
  817. pageIndex = data.pageIndex || 0,
  818. pageSum = data.pageSum,
  819. treeIds = data.treeIds,
  820. userId = data.userId;
  821. if (angular.isUndefined(treeIds)) {
  822. return solutionService.customGET('findSolutionByKeys/' + key + '/' + status + '/' + pageIndex + '/' + pageSum + '/' + userId);
  823. } else {
  824. return solutionService.customGET('findSolutionByKeys/' + key + '/' + status + '/' + pageIndex + '/' + pageSum + '/' + treeIds + '/' + userId);
  825. }
  826. },
  827. // searcher: function(data){
  828. // var queryBuilder=data.key, indexname=data.treeIds, type=data.userId;
  829. // return searchservice.customGET('searcher/' + queryBuilder + '/' + indexname + '/' + type );
  830. // },
  831. addSolution: function() {
  832. return solutionService.one('add');
  833. },
  834. addFile: function(data) {
  835. return solutionService.customPOST(data, 'addSolution', {});
  836. },
  837. addModel: function(type, data) {
  838. return solutionService.customPOST(data, 'addModel/' + type, {});
  839. },
  840. updModel: function(type, data) {
  841. return solutionService.customPOST(data, 'updModel/' + type, {});
  842. },
  843. rmModels: function(id, data) {
  844. return solutionService.customPOST(data, 'rmModels/' + id, {});
  845. },
  846. update: function() {
  847. return solutionService.one('update');
  848. },
  849. upload: function() {
  850. return solutionService.one('upload');
  851. },
  852. uploadResponseUri: function() {
  853. return solutionService.one('/');
  854. },
  855. addNotFile: function(data) {
  856. return solutionService.customPOST(data, 'addNotFile', {});
  857. },
  858. // export: function(data) {
  859. // return solutionService.customGET(data, 'export', {});
  860. // },
  861. export: function(data) {
  862. return solutionService.one('export');
  863. },
  864. updateNotFile: function(data) {
  865. return solutionService.customPOST(data, 'updateNotFile', {});
  866. },
  867. updateSolution: function(data) {
  868. return solutionService.customPOST(data, 'updateSolution', {});
  869. },
  870. searchSolutionByKey: function(key, id) {
  871. return solutionService.customGET('searchSolutionByKey/' + key + '/' + id);
  872. },
  873. findSolutionById: function(id) {
  874. return solutionService.customGET('check/' + id);
  875. },
  876. findSolutions: function(id) {
  877. return solutionService.customGET('check2/' + id);
  878. },
  879. fetchDataList: function(model, data) {
  880. return solutionService.customPOST(data, 'fetchDataList/' + model, {});
  881. },
  882. findSolutionDataByDateById: function(ndate, sid) {
  883. return data.customGET('findSolutionDataByDateById/' + ndate + '/' + sid);
  884. },
  885. findSolutionTypeActions: function(userId) {
  886. return typeservice.customGET('findSolutionTypeActions/' + userId);
  887. },
  888. findSolutionTypesUser: function(data) {
  889. return typeservice.customPOST(data, 'findSolutionTypesUser', {});
  890. },
  891. addTypeUserAll: function(data) {
  892. return typeservice.customPOST(data, 'addTypeUserAll', {});
  893. },
  894. hotRanking: function(num) {
  895. return solutionService.customGET('hotRanking/' + num);
  896. },
  897. scoreRanking: function(num) {
  898. return solutionService.customGET('scoreRanking/' + num);
  899. },
  900. fetchBBSSolutions: function(pageIndex, pageSum, sequence, userId) {
  901. return solutionService.customGET('communicationSolutions/' + pageIndex + '/' + pageSum + '/' + sequence + '/' + userId);
  902. },
  903. queryBBSSolutions: function(pageIndex, pageSum, sequence, userId, key) {
  904. return solutionService.customGET('communicationSolutions/' + pageIndex + '/' + pageSum + '/' + sequence + '/' + userId + '/' + key);
  905. },
  906. updateSolutionStatus: function(data) {
  907. return solutionService.customPOST(data, 'updateSolutionStatus', {});
  908. },
  909. getSolutionNumber: function() {
  910. return solutionService.customGET('getSolutionNumber');
  911. },
  912. addSolutionType: function(data) {
  913. return typeservice.customPOST(data, 'add', {});
  914. },
  915. updateSolutionType: function(data) {
  916. return typeservice.customPOST(data, 'update', {});
  917. },
  918. removeSolutionType: function(id) {
  919. return typeservice.customGET('delete/' + id);
  920. },
  921. getSolutionType: function(id) {
  922. return typeservice.customGET('' + id);
  923. },
  924. getTree: function(typeId, groupId, flag) {
  925. return typeservice.customGET('getTree/' + typeId + '/' + groupId + '/' + flag);
  926. },
  927. checkCommentScoreByUserIds: function(userId, id) {
  928. return review.customGET('findCommentScore/' + userId + '/' + id);
  929. },
  930. addSolutionReview: function(data) {
  931. return solutionService.customPOST(data, 'addScore', {});
  932. },
  933. findSolutionReviewById: function(userid, id, pageIndex, pageSum) {
  934. return solutionService.customGET('findSolutionReviewByType/' + userid + '/' + id + '/' + pageIndex + '/' + pageSum);
  935. },
  936. saveAllUserAuth: function(solutionId, flag) {
  937. return solutionService.customGET('saveAllUserTrees/' + solutionId + '/' + flag);
  938. },
  939. updatermvSolutionType: function(typeId, groupId, userIds, flag) {
  940. return typeservice.customGET('delOrUpdateTrees/' + typeId + '/' + groupId + '/' + userIds + '/' + flag);
  941. },
  942. findSolutionGroup: function(id) {
  943. return groupservice.customGET('findSolutionGroup/' + id);
  944. },
  945. saveSolutionGroup: function(id, data) {
  946. return groupservice.customPOST(data, 'saveSolutionGroup/' + id);
  947. },
  948. // getSolutionDowpath: function(id){
  949. // return solutionService.one('download/'+id);
  950. // }
  951. getSolutionDowpath: function(attachmentId) {
  952. return solutionService.one('download/' + attachmentId + '/file');
  953. }
  954. // getSolutionDowpath: function(attachmentId){
  955. // return solutionService.customGET('download/' + attachmentId);
  956. // }
  957. };
  958. }]);
  959. app.factory('CMDBRestangular', function(Restangular) {
  960. return Restangular.withConfig(function(RestangularConfigurer) {
  961. RestangularConfigurer.setBaseUrl(serverIp + '/api/cmdb/cmdb/');
  962. });
  963. });
  964. app.factory('api_cmdb', ['CMDBRestangular', function(CMDBRestangular) {
  965. var ciService = CMDBRestangular.all("ci");
  966. var uuidService = CMDBRestangular.all("uuid");
  967. var edgeService = CMDBRestangular.all("edge");
  968. var traversal = CMDBRestangular.all("traversal");
  969. var downloadService = CMDBRestangular.all("download");
  970. var exportService = CMDBRestangular.all("export");
  971. var importService = CMDBRestangular.all("import");
  972. var exportModelService = CMDBRestangular.all("exportModel");
  973. var importDataService = CMDBRestangular.all("importData");
  974. var exportDataService = CMDBRestangular.all("exportData");
  975. var searchService = CMDBRestangular.all("search");
  976. function serializeData(data) {
  977. // If this is not an object, defer to native stringification.
  978. if (!angular.isObject(data)) {
  979. return ((data == null) ? "" : data.toString());
  980. }
  981. var buffer = [];
  982. // Serialize each key in the object.
  983. for (var name in data) {
  984. if (!data.hasOwnProperty(name)) {
  985. continue;
  986. }
  987. var value = data[name];
  988. buffer.push(
  989. encodeURIComponent(name) + "=" + encodeURIComponent((value == null) ? "" : value)
  990. );
  991. }
  992. // Serialize the buffer and clean it up for transportation.
  993. var source = buffer.join("&").replace(/%20/g, "+");
  994. return (source);
  995. }
  996. return {
  997. create: function(data) {
  998. return ciService.customPOST(data, '', {});
  999. },
  1000. importData: function() {
  1001. return importDataService.one('/nodes');
  1002. },
  1003. put: function(data, id) {
  1004. return ciService.customPUT(data, id, {});
  1005. },
  1006. remove: function(id) {
  1007. return ciService.customDELETE(id);
  1008. },
  1009. removeByUUId: function(uuid) {
  1010. return ciService.customDELETE('uuid/' + id, {}, { 'Content-Type': 'application/json' });
  1011. },
  1012. removeRefById: function(id) {
  1013. return ciService.customDELETE(id + '/ref');
  1014. },
  1015. find: function(id) {
  1016. return ciService.customGET(id);
  1017. },
  1018. searchkey: function(type, key, idx, sum) {
  1019. return searchService.customGET(type + '/' + key + '/' + idx + '/' + sum);
  1020. },
  1021. findByUUId: function(uuid) {
  1022. return ciService.customGET('?uuid=' + uuid);
  1023. },
  1024. query: function(data) {
  1025. return ciService.customGET('query', data);
  1026. },
  1027. findRefById: function(id) {
  1028. return ciService.customGET(id + '/refs');
  1029. },
  1030. finduuid: function(type, model) {
  1031. return uuidService.customGET(type + '/' + model);
  1032. },
  1033. types: function() {
  1034. return CMDBRestangular.customGET('types');
  1035. },
  1036. createRef: function(data) {
  1037. return edgeService.customPOST(data, '', {});
  1038. },
  1039. putRef: function(data, id) {
  1040. return edgeService.customPUT(data, '' + id, {});
  1041. },
  1042. removeRef: function(id) {
  1043. return edgeService.customDELETE(id, {}, { 'Content-Type': 'application/json' });
  1044. },
  1045. traversal: function(uuid) {
  1046. return traversal.customGET(uuid);
  1047. },
  1048. traversalRel: function(uuid, relation) {
  1049. return traversal.customGET(uuid + '/' + relation + '/' + 'none');
  1050. },
  1051. export: function(label) {
  1052. return exportService.customGET('nodes/' + label);
  1053. },
  1054. import: function() {
  1055. return importService.one('/nodes');
  1056. },
  1057. download: function(label) {
  1058. return downloadService.one('/label');
  1059. },
  1060. exportData: function(type, model) {
  1061. return exportDataService.one(model + '/' + type);
  1062. },
  1063. downModels: function(type, model) {
  1064. return exportModelService.one(model + '/' + type);
  1065. }
  1066. };
  1067. }]);
  1068. app.factory('MonitorRestangular', function(Restangular) {
  1069. return Restangular.withConfig(function(RestangularConfigurer) {
  1070. RestangularConfigurer.setBaseUrl(serverIp + ':9004/services');
  1071. });
  1072. });
  1073. app.factory('api_monitor', ['MonitorRestangular', function(MonitorRestangular) {
  1074. //http://127.0.0.1:9004/services/ftpFile/monitor/bankTip/
  1075. var process = MonitorRestangular.all("ftpFile/monitor");
  1076. return {
  1077. bankTip: function(id) {
  1078. return process.customGET('bankTip/' + id);
  1079. },
  1080. list: function() {
  1081. return process.customGET('list/1000');
  1082. },
  1083. devList: function(id) {
  1084. return process.customGET('devList/' + id);
  1085. },
  1086. cpuList: function() {
  1087. return process.customGET('cpuList/10');
  1088. },
  1089. memList: function() {
  1090. return process.customGET('memList/10');
  1091. },
  1092. storageList: function() {
  1093. return process.customGET('storageList/10');
  1094. },
  1095. transData: function() {
  1096. return process.customGET('transData/5');
  1097. },
  1098. banklist: function() {
  1099. return process.customGET('banklist');
  1100. },
  1101. app: function(id) {
  1102. return process.customGET('app/' + id);
  1103. },
  1104. beita: function(id) {
  1105. return process.customGET('beita/' + id);
  1106. },
  1107. gongji: function(id) {
  1108. return process.customGET('gongji/' + id);
  1109. }
  1110. };
  1111. }]);
  1112. app.factory('ReportRestangular', function(Restangular) {
  1113. return Restangular.withConfig(function(RestangularConfigurer) {
  1114. //RestangularConfigurer.setBaseUrl('http://127.0.0.1:9005/api/cmdb/');
  1115. RestangularConfigurer.setBaseUrl(reportIp + '/saiku/rest');
  1116. // RestangularConfigurer.setBaseUrl(serverIp + ':8888/saiku/rest');
  1117. //saiku/rest/saiku/api/query/execute/
  1118. });
  1119. });
  1120. app.factory('api_report', ['ReportRestangular', 'Restangular', function(MonitorRestangular, Restangular) {
  1121. var reportService = MonitorRestangular.all("saiku/api");
  1122. var authService = MonitorRestangular.one("saiku/session");
  1123. return {
  1124. getLicenseKey: function() {
  1125. return Restangular.one('assets/').customGET('api/reportToken.js');
  1126. },
  1127. // auth: function(){
  1128. // return authService.customPOST('username=admin&password=admin&language=zh'
  1129. // ,'', {}, {'Content-Type': 'application/x-www-form-urlencoded'});
  1130. // },
  1131. // session: function(){
  1132. // return authService.customGET('');
  1133. // },
  1134. list: function() {
  1135. return reportService.customGET('repository?type=saiku');
  1136. /**
  1137. /saiku/api/repository
  1138. path: /homes/home:admin/itsm_reports
  1139. */
  1140. },
  1141. getMdx: function(path, uuid) {
  1142. var rdata = 'file=' + path + '&formatter=flattened&language=zh';
  1143. return reportService.customPOST(rdata, 'query/' + uuid, {}, { 'Content-Type': 'application/x-www-form-urlencoded' });
  1144. },
  1145. execute: function(data) {
  1146. return reportService.customPOST(data, 'query/execute', {}, { 'Accept': 'application/json, text/javascript, */*' });
  1147. },
  1148. exportData: function(reportView, uuid, reportfileName) {
  1149. return reportService.one('query/rest/export/xls/?exportname=' + reportfileName + 'xls');
  1150. }
  1151. };
  1152. }]);