main.js 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248
  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. app.factory('ReportnewRestangular', function (Restangular) {
  160. return Restangular.withConfig(function (RestangularConfigurer) {
  161. RestangularConfigurer.setBaseUrl(reportIp + '/statistics');
  162. });
  163. })
  164. // 首页仪表盘
  165. app.factory('api_newreport', ['ReportnewRestangular', function (ReportnewRestangular) {
  166. var hcService = ReportnewRestangular.all("data");
  167. return {
  168. // 事件解决率
  169. fetchDataList: function (model, data) {
  170. return hcService.customPOST(data, 'fetchDataList/' + model, {})
  171. },
  172. // 首页仪表盘
  173. addDictionary: function (data) {
  174. return hcService.customPOST(data, 'addDictionary', {})
  175. },
  176. // 首页仪表盘
  177. upDictionary: function (data) {
  178. return hcService.customPOST(data, 'upDictionary', {})
  179. },
  180. }
  181. }]);
  182. /**
  183. * // http: //115.156.150.70:9680/api/webservice/data/fetchDataList/queryUser
  184. */
  185. app.config(['RestangularProvider', function(RestangularProvider) {
  186. RestangularProvider.setBaseUrl('');
  187. }]);
  188. app.factory('serviceip', function(Restangular) {
  189. return Restangular.withConfig(function(RestangularConfigurer) {
  190. RestangularConfigurer.setBaseUrl(serviceip);
  191. });
  192. });
  193. app.factory('WechatRestangular', function(Restangular) {
  194. return Restangular.withConfig(function(RestangularConfigurer) {
  195. RestangularConfigurer.setBaseUrl(serverIp + '/api/common/');
  196. });
  197. });
  198. app.factory('api_wechatfile', ['WechatRestangular', function(WechatRestangular) {
  199. var dataService = WechatRestangular.all("common");
  200. return {
  201. listAttachments: function(type, model) {
  202. return dataService.customGET('listAttachment/' + type + "/" + model, {});
  203. // return dataService.one('listAttachment/' + type + "/" + model);
  204. },
  205. downloadAttachment: function(model) {
  206. return dataService.one('downloadAttachment/' + model, {});
  207. },
  208. attachmentsPreviewUrl: function(attachmentId) {
  209. return dataService.customGET('attachmentsPreviewUrl/' + attachmentId);
  210. },
  211. download: function(attachmentId) {
  212. return dataService.one('getAttachmentContent/' + attachmentId);
  213. },
  214. getDictionary: function(data) {
  215. return dataService.customPOST(data, 'getDictionary', {});
  216. }
  217. };
  218. }]);
  219. /**
  220. * // http: //115.156.150.70:9680/webservice/data/fetchDataList/queryUser
  221. */
  222. //信息中心 --wt
  223. app.factory('msgRestangular', function(Restangular) {
  224. return Restangular.withConfig(function(RestangularConfigurer) {
  225. RestangularConfigurer.setBaseUrl(serverIp + '/messageStation');
  226. });
  227. });
  228. app.factory('api_msg', ['msgRestangular', function(msgRestangular) {
  229. var msgService = msgRestangular.all("data");
  230. return {
  231. msgDataList: function(data) {
  232. return msgService.customPOST(data, 'fetchDataList/messageStation', {});
  233. },
  234. updateDataList: function(data) {
  235. return msgService.customPOST(data, 'updateModel/messageStation', {});
  236. },
  237. };
  238. }]);
  239. // 微信配置查询接口
  240. app.factory('wechatConfig', function (Restangular) {
  241. return Restangular.withConfig(function (RestangularConfigurer) {
  242. RestangularConfigurer.setBaseUrl(reportIp + '/wechat');
  243. });
  244. });
  245. app.factory('api_wechat_operate', ['wechatConfig', function (wechatConfig) {
  246. var dataService = wechatConfig.all("");
  247. return {
  248. //获取微信配置信息
  249. mapToken: function (data, model) {
  250. return dataService.customPOST(data, model);
  251. },
  252. //修改微信配置
  253. // postWxList: function (data) {
  254. // return dataService.customPOST(data, 'addData/wechatConfig');
  255. // }
  256. };
  257. }]);
  258. //报表
  259. app.factory('hkreportRestangular', function(Restangular) {
  260. return Restangular.withConfig(function(RestangularConfigurer) {
  261. RestangularConfigurer.setBaseUrl(reportIp + '/statistics');
  262. });
  263. });
  264. app.factory('api_hkreport', ['hkreportRestangular', function(hkreportRestangular) {
  265. var msgService = hkreportRestangular.all("data");
  266. return {
  267. incidentreport: function(data, key) {
  268. return msgService.customPOST(data, key, {});
  269. }
  270. };
  271. }]);
  272. //
  273. app.factory('webserviceRestangular', function(Restangular) {
  274. return Restangular.withConfig(function(RestangularConfigurer) {
  275. RestangularConfigurer.setBaseUrl(serverIp + '/api/webservice/');
  276. });
  277. });
  278. app.factory('api_webservice', ['webserviceRestangular', function(webserviceRestangular) {
  279. var dataService = webserviceRestangular.all("data");
  280. return {
  281. fetchDataList: function(model, data) {
  282. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  283. }
  284. };
  285. }]);
  286. app.factory('playRestangular', function(Restangular) {
  287. return Restangular.withConfig(function(RestangularConfigurer) {
  288. RestangularConfigurer.setBaseUrl(callIp);
  289. });
  290. });
  291. app.factory('api_playservice', ['playRestangular', function(playRestangular) {
  292. var dataService = playRestangular.all("recording");
  293. return {
  294. playData: function(attachmentId) {
  295. return dataService.customGET('recording?callID=' + attachmentId);
  296. },
  297. };
  298. }]);
  299. app.factory('ConversationRestangular', function(Restangular) {
  300. return Restangular.withConfig(function(RestangularConfigurer) {
  301. RestangularConfigurer.setBaseUrl(serverIp + '/api/conversation/');
  302. });
  303. });
  304. app.factory('api_conversation', ['ConversationRestangular', function(ConversationRestangular) {
  305. var dataService = ConversationRestangular.all("conversation");
  306. return {
  307. roleMenu: function(model) {
  308. return dataService.customGET('roleMenu/' + model, {});
  309. },
  310. pageMenuByCode: function(model) {
  311. return dataService.customGET('pageMenuByCode/' + model, {});
  312. },
  313. pageEvent: function(data, model) {
  314. return dataService.customPOST(data, 'pageEvent', {});
  315. }
  316. };
  317. }]);
  318. app.factory('textRestangular', function(Restangular) {
  319. return Restangular.withConfig(function(RestangularConfigurer) {
  320. // RestangularConfigurer.setBaseUrl(inspectIp + ':8080/IXServer/');
  321. RestangularConfigurer.setBaseUrl(inspectIp + ':8088/IXServer/');
  322. });
  323. });
  324. app.factory('api_text', ['textRestangular', function(textRestangular) {
  325. var loginService = textRestangular.all("comm");
  326. var loginsins = textRestangular.all("tele/agent");
  327. return {
  328. start: function(phone, id) {
  329. var rdata = "dom=0&epwd=&aid=" + id + "&apwd=e10adc3949ba59abbe56e057f20f883e&adn=" + phone;
  330. return loginService.customPOST(rdata, 'start', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  331. },
  332. exit: function(token) {
  333. var rdata = "dom=0&token=" + token;
  334. return loginService.customPOST(rdata, 'exit', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  335. },
  336. login: function(group, token, id) {
  337. var rdata = "dom=0&token=" + token + "&aid=" + id + "&acd=" + group + "&skill=-1&mon=false&silent=false";
  338. return loginsins.customPOST(rdata, 'login', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  339. },
  340. logout: function(token, id) {
  341. var rdata = "dom=0&token=" + token + "&aid=" + id + "";
  342. return loginsins.customPOST(rdata, 'logout', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  343. },
  344. dialout: function(token, gid, teleno) {
  345. var rdata = "dom=0&token=" + token + "&teleno=" + teleno + "&gid=" + gid + "&uud=&async=true";
  346. return loginsins.customPOST(rdata, 'dialout', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  347. },
  348. callout: function(token, teleno) {
  349. var rdata = "dom=0&token=" + token + "&teleno=" + teleno + "&uud=&async=true";
  350. return loginsins.customPOST(rdata, 'dialout', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  351. },
  352. setbusy: function(token) {
  353. var rdata = "dom=0&token=" + token;
  354. return loginsins.customPOST(rdata, 'setbusy', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  355. },
  356. setidle: function(token) {
  357. var rdata = "dom=0&token=" + token;
  358. return loginsins.customPOST(rdata, 'setidle', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  359. },
  360. inittrans: function(telephone, token) {
  361. var rdata = "dom=0&token=" + token + "&teleno=" + telephone + "&uud=&async=true";
  362. return loginsins.customPOST(rdata, 'inittrans', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  363. },
  364. comptrans: function(telephone, token) {
  365. var rdata = "dom=0&token=" + token;
  366. return loginsins.customPOST(rdata, 'comptrans', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  367. },
  368. record: function(token) {
  369. var rdata = "dom=0&token=" + token + "&filename=/tmp/agent.wav&async=true&maxtime=10&termchar=&append=true";
  370. return loginsins.customPOST(rdata, 'record', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  371. },
  372. offhook: function(token) {
  373. var rdata = "dom=0&token=" + token;
  374. return loginsins.customPOST(rdata, 'offhook', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  375. },
  376. onhook: function(token) {
  377. var rdata = "dom=0&token=" + token;
  378. return loginsins.customPOST(rdata, 'onhook', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  379. },
  380. getcdrid: function(token) {
  381. var rdata = "dom=0&token=" + token;
  382. return loginsins.customPOST(rdata, 'getcdrid', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
  383. }
  384. }
  385. }])
  386. app.factory('UserRestangular', function(Restangular) {
  387. return Restangular.withConfig(function(RestangularConfigurer) {
  388. RestangularConfigurer.setBaseUrl(serverIp + '/api/user/');
  389. });
  390. });
  391. app.factory('api_user', ['UserRestangular', function(UserRestangular) {
  392. var basePath = "user/";
  393. return {
  394. };
  395. }]);
  396. app.factory('api_login', ['UserRestangular', function(UserRestangular) {
  397. var loginService = UserRestangular.all("auth");
  398. return {
  399. login: function(username, password) {
  400. return loginService.customPOST({ 'username': username, 'password': password }, 'login', {});
  401. },
  402. // logout: function(sessionid,userid){
  403. // return loginService.customPOST(sessionid + '/' + userid);
  404. // },
  405. sso: function(nickname) {
  406. return loginService.customGET('sso/' + nickname);
  407. },
  408. resetpwd: function(userid) {
  409. return loginService.customGET('resetpwd/' + userid);
  410. },
  411. uppwd: function(data) {
  412. return loginService.customPOST(data, 'uppwd', {});
  413. }
  414. }
  415. }])
  416. app.factory('applyRestangular', function(Restangular) {
  417. return Restangular.withConfig(function(RestangularConfigurer) {
  418. RestangularConfigurer.setBaseUrl(serverIp + '/api/apply/');
  419. });
  420. });
  421. app.factory('api_apply', ['applyRestangular', function(applyRestangular) {
  422. var applyService = applyRestangular.all("bpm");
  423. return {
  424. wxIncidentReject: function(id, data) {
  425. return applyService.customPOST(data, 'wxIncidentReject/' + id, {});
  426. }
  427. }
  428. }])
  429. app.factory('api_user_data', ['UserRestangular', function(UserRestangular) {
  430. var dataService = UserRestangular.all("data");
  431. var userService = UserRestangular.all("auth");
  432. return {
  433. validate: function(data) {
  434. return dataService.customPOST(data, 'validate/role', {});
  435. },
  436. importData: function() {
  437. return dataService.one('/importData');
  438. },
  439. fetchDataList: function(model, data) {
  440. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  441. },
  442. fetchData: function(model, data) {
  443. return dataService.customPOST(data, 'fetchData/' + model, {});
  444. },
  445. addData: function(model, data) {
  446. return dataService.customPOST(data, 'addData/' + model, {});
  447. },
  448. updData: function(model, data) {
  449. return dataService.customPOST(data, 'updData/' + model, {});
  450. },
  451. rmvData: function(model, data) {
  452. return dataService.customPOST(data, 'rmvData/' + model, {});
  453. },
  454. register: function(data) {
  455. return dataService.customPOST(data, 'register', {});
  456. },
  457. downDataModel: function(type, month) {
  458. return dataService.one('downDataModel/' + type + '/' + month);
  459. },
  460. fetchgetData: function(model, data) {
  461. return dataService.customGET('fetchData/' + model + '/' + data, {});
  462. },
  463. roleMenu: function(model) {
  464. return userService.customGET('roleMenu/' + model, {});
  465. },
  466. pageMenuByCode: function(model) {
  467. return userService.customGET('pageMenuByCode/' + model, {});
  468. },
  469. pageEvent: function(data, model) {
  470. return userService.customPOST(data, 'pageEvent', {});
  471. },
  472. pageMenu: function(data, model) {
  473. return userService.customPOST(data, 'pageMenu', {});
  474. // return userService.one('/pageMenu' + data);
  475. },
  476. getMenu: function(data, model) {
  477. return userService.customPOST(data, 'getMenu', {});
  478. }
  479. };
  480. }]);
  481. // app.factory('DpmRestangular', function(Restangular) {
  482. // return Restangular.withConfig(function(RestangularConfigurer) {
  483. // RestangularConfigurer.setBaseUrl(serverIp+':9008/data/');
  484. // });
  485. // });
  486. // app.factory('api_bpm_dbca', ['DpmRestangular', function(DpmRestangular){
  487. // var bpm = DpmRestangular.all("bpm");
  488. // return {
  489. // impFileData: function(pdKey){
  490. // return bpm.customPOST( 'impFileData/' + pdKey);
  491. // },
  492. // };
  493. // }]);
  494. app.factory('BpmRestangular', function(Restangular) {
  495. return Restangular.withConfig(function(RestangularConfigurer) {
  496. // RestangularConfigurer.setBaseUrl("http://168.166.3.41"+':9008/api/');
  497. RestangularConfigurer.setBaseUrl(serverIp + '/api/bpm');
  498. });
  499. });
  500. app.factory('api_statistic', ['BpmRestangular', function(BpmRestangular) {
  501. var statistic = BpmRestangular.all("statistic");
  502. return {
  503. query: function(data, rptId) {
  504. return statistic.customPOST(data, 'unidimensional/' + rptId, {});
  505. },
  506. // exportData: function(reportView, uuid, reportfileName){
  507. // return reportService.one('query/rest/export/xls/?exportname='+reportfileName+'xls');
  508. // }
  509. unidimensionalExport: function(rptId) {
  510. return statistic.one('unidimensionalExport/' + rptId);
  511. }
  512. }
  513. }]);
  514. app.factory('api_bpm', ['BpmRestangular', function(BpmRestangular) {
  515. var process = BpmRestangular.all("process");
  516. return {
  517. deploy: function(data) {
  518. return process.customPOST(data, 're/model/deploy', {});
  519. },
  520. list: function() {
  521. return process.customGET('re/model/list');
  522. },
  523. modelsource: function(pdId) {
  524. return process.customGET('re/model/' + pdId + '/source');
  525. },
  526. // savemodel: function(pdId, data) {
  527. // return process.customPOST(data, 're/model/' + pdId + '/save', {});
  528. // },
  529. savemodel: function(pdId, data) {
  530. return process.customPOST(data, 'saveModel/' + pdId, {});
  531. },
  532. removemodel: function(modelId) {
  533. return process.customGET('re/model/' + modelId + '/remove');
  534. }
  535. };
  536. }]);
  537. app.factory('CommonRestangular', function(Restangular) {
  538. return Restangular.withConfig(function(RestangularConfigurer) {
  539. RestangularConfigurer.setBaseUrl(serverIp + '/api/common');
  540. });
  541. });
  542. app.factory('api_bpm_domain', ['BpmRestangular', 'CommonRestangular', function(BpmRestangular, CommonRestangular) {
  543. var bpmService = BpmRestangular.all("bpm");
  544. var commonService = CommonRestangular.all("common");
  545. return {
  546. fetchtask: function(pdKey, data) {
  547. return bpmService.customPOST(data, 'fetchTask/' + pdKey, {});
  548. },
  549. start: function(pdKey, data) {
  550. return bpmService.customPOST(data, 'start/' + pdKey, {});
  551. },
  552. flowTracing: function(processInstanceId, data) {
  553. return bpmService.customPOST(data, 'flowTracing/' + processInstanceId, {});
  554. },
  555. complete: function(taskId, userId, data) {
  556. return bpmService.customPOST(data, 'completeTask/' + taskId + '/' + userId, {});
  557. },
  558. completeUpgrade: function(data) {
  559. return bpmService.customPOST(data, 'upgradeIncident', {});
  560. },
  561. save: function(taskId, data) {
  562. return bpmService.customPOST(data, 'saveTaskVar/' + taskId, {});
  563. },
  564. claimtask: function(taskId, data) {
  565. return bpmService.customPOST(data, 'claimTask/' + taskId, {});
  566. },
  567. claimAndCompletedTask: function(taskId, data) {
  568. return bpmService.customPOST(data, 'claimAndCompletedTask/' + taskId, {});
  569. },
  570. delegateTask: function(taskId, data) {
  571. return bpmService.customPOST(data, 'delegateTask/' + taskId, {});
  572. },
  573. expectedTime: function(taskId) {
  574. return bpmService.customGET('expectedTime/' + taskId);
  575. },
  576. history: function(processId) {
  577. return bpmService.customGET('history/' + processId);
  578. },
  579. upgrade: function(processInstanceId, taskId, data) {
  580. return bpmService.customPOST(data, 'upgradeIncident/' + processInstanceId + '/' + taskId, {});
  581. },
  582. listAttachments: function(processId, data) {
  583. return bpmService.customPOST(data, 'getAttachmentList/' + processId, {});
  584. },
  585. saveAttachments: function(processId, taskId, userId, data) {
  586. return bpmService.one('saveAttachments/' + processId + '/' + taskId + '/' + userId);
  587. },
  588. uploadAttachment: function(processId, taskId, userId, data) {
  589. return commonService.one('uploadAttachment/' + 'inspection/' + processId);
  590. },
  591. download: function(attachmentId) {
  592. return bpmService.one('getAttachmentContent/' + attachmentId);
  593. },
  594. // download: function(attachmentId){
  595. // return bpmService.customGET('getAttachmentContent/' + attachmentId,{},{'responseType':'arraybuffer'});
  596. // },
  597. attachmentsPreviewUrl: function(attachmentId) {
  598. return bpmService.customGET('attachmentsPreviewUrl/' + attachmentId);
  599. },
  600. startformkey: function(pdKey) {
  601. return bpmService.customGET('startformkey/' + pdKey);
  602. },
  603. taskformkey: function(taskId) {
  604. return bpmService.customGET('taskformkey/' + taskId);
  605. },
  606. workernumber: function(type) {
  607. return bpmService.customGET('restful/' + type);
  608. },
  609. getWatchAreaPosition: function(data) {
  610. return bpmService.customGET('getWatchAreaPosition');
  611. },
  612. getWatchAreaData: function(id) {
  613. return bpmService.customGET('getWatchAreaData/' + id);
  614. }
  615. };
  616. }]);
  617. app.factory('api_bpm_data', ['BpmRestangular', function(BpmRestangular) {
  618. var dataService = BpmRestangular.all("data");
  619. var serviceCatalogue = BpmRestangular.all("ServiceCatalogue");
  620. var inspectionProcessActual = BpmRestangular.all("InspectionProcessActual");
  621. return {
  622. impFileData: function() {
  623. return dataService.one('/impFileData/bpm_scheduleorder');
  624. },
  625. importData: function() {
  626. return dataService.one('/impFileData');
  627. },
  628. fetchDataList: function(model, data) {
  629. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  630. },
  631. fetchData: function(model, dataId) {
  632. return dataService.customGET('fetchData/' + model + '/' + dataId);
  633. },
  634. fetchServiceTasks: function(model, data) {
  635. if (!model) {
  636. model = "ALL"
  637. }
  638. return serviceCatalogue.customPOST(data, 'fetchServiceTasks/' + model, {});
  639. },
  640. fetchInspectServiceTasks: function(model, data) {
  641. if (!model) {
  642. model = "ALL"
  643. }
  644. return inspectionProcessActual.customPOST(data, 'fetchServiceTasks/' + model, {});
  645. },
  646. addData: function(model, data) {
  647. return dataService.customPOST(data, 'addData/' + model, {});
  648. },
  649. updData: function(model, data) {
  650. return dataService.customPOST(data, 'updData/' + model, {});
  651. },
  652. rmvData: function(model, data) {
  653. return dataService.customPOST(data, 'rmvData/' + model, {});
  654. },
  655. getCount: function(data) {
  656. return dataService.customPOST(data, 'getCount', {});
  657. },
  658. downDataModel: function(type, month) {
  659. return dataService.one('downDataModel/' + type + '/' + month);
  660. },
  661. fetchDataByGroupId: function(data) {
  662. return dataService.customPOST(data, 'fetchDataByGroupId', {});
  663. },
  664. // downDataModel: function(type, month, data) {
  665. // return dataService.customPOST(data, 'downDataModel/' + type + '/' + month, {}, { 'Accept': 'application/json, text/javascript, */*' });
  666. // }
  667. };
  668. }]);
  669. app.factory('api_bpm_schedule', ['BpmRestangular', function(BpmRestangular) {
  670. var dataService = BpmRestangular.all("data");
  671. return {
  672. getScheduleClass: function() {
  673. var data = {
  674. "idx": "0",
  675. "sum": "10"
  676. };
  677. return dataService.customPOST(data, 'fetchDataList/scheduleclass', {});
  678. },
  679. fetchList: function(startTime, endTime, userId, queryKey) {
  680. var scheduleOrder = {
  681. "scheduleorder": {
  682. "startTime": startTime,
  683. "endTime": endTime
  684. },
  685. "idx": "0",
  686. "sum": "1000"
  687. };
  688. if (userId) {
  689. scheduleOrder['scheduleorder']['user'] = userId;
  690. }
  691. if (queryKey) {
  692. scheduleOrder['scheduleorder']['description'] = queryKey;
  693. }
  694. return dataService.customPOST(scheduleOrder, 'fetchDataList/scheduleorder', {});
  695. },
  696. fetchData: function(dataId) {
  697. return dataService.customGET('fetchData/scheduleorder/' + dataId);
  698. },
  699. update: function(data) {
  700. return dataService.customPOST(data, 'updData/scheduleorder', {});
  701. },
  702. add: function(data) {
  703. return dataService.customPOST(data, 'addData/scheduleorder', {});
  704. },
  705. remove: function(data) {
  706. return dataService.customPOST(data, 'rmvData/scheduleorder', {});
  707. },
  708. fetchSchedule: function(userId, startTime, endTime) {
  709. var scheduleData = {
  710. "schedulewatch": {
  711. "type": "1",
  712. "user": {
  713. "id": userId
  714. },
  715. "startTime": startTime,
  716. "endTime": endTime
  717. },
  718. "idx": "0",
  719. "sum": "100"
  720. };
  721. return dataService.customPOST(scheduleData, 'fetchDataList/schedulewatch', {});
  722. },
  723. queryRecieveSwitch: function(userId) {
  724. var handleSwitch = {
  725. "schedulewatch": {
  726. "type": "3",
  727. "user": {
  728. "id": userId
  729. }
  730. },
  731. "idx": "0",
  732. "sum": "10"
  733. };
  734. return dataService.customPOST(handleSwitch, 'fetchDataList/schedulewatch', {});
  735. },
  736. queryHandleoutSwitch: function(userId) {
  737. var handleSwitch = {
  738. "schedulewatch": {
  739. "type": "2",
  740. "user": {
  741. "id": userId
  742. }
  743. },
  744. "idx": "0",
  745. "sum": "10"
  746. };
  747. return dataService.customPOST(handleSwitch, 'fetchDataList/schedulewatch', {});
  748. },
  749. handleSchedule: function(data) {
  750. return dataService.customPOST(data, 'updData/schedulewatch', {});
  751. },
  752. querySwitch: function(filterData) {
  753. var switchData = {
  754. "scheduleorder": {
  755. "type": "4"
  756. },
  757. "idx": filterData.idx,
  758. "sum": filterData.sum
  759. };
  760. return dataService.customPOST(switchData, 'fetchDataList/scheduleorder', {});
  761. },
  762. query: function(filterData) {
  763. var switchData = {
  764. "scheduleorder": filterData.scheduleorder,
  765. "idx": filterData.idx,
  766. "sum": filterData.sum
  767. };
  768. return dataService.customPOST(switchData, 'fetchDataList/scheduleorder', {});
  769. }
  770. };
  771. }]);
  772. app.factory('SysinfoRestangular', function(Restangular) {
  773. return Restangular.withConfig(function(RestangularConfigurer) {
  774. RestangularConfigurer.setBaseUrl(serverIp + '/api/sysinfo/');
  775. });
  776. });
  777. app.factory('api_sysinfo', ['SysinfoRestangular', function(SysinfoRestangular) {
  778. var dataService = SysinfoRestangular.all("data");
  779. return {
  780. fetchDataList: function(model, data) {
  781. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  782. },
  783. addData: function(model, data) {
  784. return dataService.customPOST(data, 'addData/' + model, {});
  785. },
  786. getSerialnumber: function(type, model) {
  787. return dataService.customGET('getSerialnumber/' + type + '/' + model);
  788. }
  789. };
  790. }]);
  791. app.factory('ConfigureRestangular', function(Restangular) {
  792. return Restangular.withConfig(function(RestangularConfigurer) {
  793. RestangularConfigurer.setBaseUrl(serverIp + '/api/config/');
  794. });
  795. });
  796. app.factory('api_configure_form', ['ConfigureRestangular', function(ConfigureRestangular) {
  797. var formService = ConfigureRestangular.all("form");
  798. return {
  799. renderForm: function(formKey, userId, processInstanceId) {
  800. if (processInstanceId) {
  801. return formService.customGET('renderForm/' + formKey + "/" + processInstanceId + "/" + userId);
  802. } else {
  803. return formService.customGET('renderForm/' + formKey + "/000000/" + userId);
  804. }
  805. },
  806. renderList: function(formKey) {
  807. return formService.customGET('renderList/' + formKey);
  808. },
  809. renderTabForm: function(classify) {
  810. return formService.customGET('renderTabForm/' + classify);
  811. }
  812. };
  813. }]);
  814. app.factory('api_configure_data', ['ConfigureRestangular', function(ConfigureRestangular) {
  815. var dataService = ConfigureRestangular.all("data");
  816. return {
  817. fetchDataList: function(model, data) {
  818. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  819. },
  820. linkConfigure: function(model, data) {
  821. return dataService.customPOST(data, 'linkConfigure/' + model, {});
  822. },
  823. fetchDataById: function(model, id) {
  824. return dataService.customGET('fetchData/' + id + '/' + model);
  825. },
  826. fetchData: function(model, data) {
  827. return dataService.customPOST(data, 'fetchData/' + model, {});
  828. },
  829. addData: function(model, data) {
  830. return dataService.customPOST(data, 'addData/' + model, {});
  831. },
  832. rmvData: function(model, data) {
  833. return dataService.customPOST(data, 'rmvData/' + model, {});
  834. },
  835. updData: function(model, data) {
  836. return dataService.customPOST(data, 'updData/' + model, {});
  837. },
  838. downModels: function(type, id, name) {
  839. return dataService.one('export/' + type + '/' + id + '/' + name);
  840. }
  841. };
  842. }]);
  843. app.factory('SolutionRestangular', function(Restangular) {
  844. return Restangular.withConfig(function(RestangularConfigurer) {
  845. //RestangularConfigurer.setBaseUrl('http://168.166.203.41:9000/services');
  846. RestangularConfigurer.setBaseUrl(serverIp + '/api/solution');
  847. });
  848. });
  849. app.factory('api_solution', ['SolutionRestangular', function(SolutionRestangular) {
  850. var solutionService = SolutionRestangular.all("solution");
  851. var data = SolutionRestangular.all("solutionData");
  852. var history = SolutionRestangular.all("solutionHistory");
  853. var review = SolutionRestangular.all("solution_review");
  854. var typeservice = SolutionRestangular.all("solutionType");
  855. var groupservice = SolutionRestangular.all("solutionGroup");
  856. return {
  857. findSolutionByKeys: function(data) {
  858. var key = data.key,
  859. status = data.status || 0,
  860. pageIndex = data.pageIndex || 0,
  861. pageSum = data.pageSum,
  862. treeIds = data.treeIds,
  863. userId = data.userId;
  864. if (angular.isUndefined(treeIds)) {
  865. return solutionService.customGET('findSolutionByKeys/' + key + '/' + status + '/' + pageIndex + '/' + pageSum + '/' + userId);
  866. } else {
  867. return solutionService.customGET('findSolutionByKeys/' + key + '/' + status + '/' + pageIndex + '/' + pageSum + '/' + treeIds + '/' + userId);
  868. }
  869. },
  870. // searcher: function(data){
  871. // var queryBuilder=data.key, indexname=data.treeIds, type=data.userId;
  872. // return searchservice.customGET('searcher/' + queryBuilder + '/' + indexname + '/' + type );
  873. // },
  874. addSolution: function() {
  875. return solutionService.one('add');
  876. },
  877. addFile: function(data) {
  878. return solutionService.customPOST(data, 'addSolution', {});
  879. },
  880. addModel: function(type, data) {
  881. return solutionService.customPOST(data, 'addModel/' + type, {});
  882. },
  883. updModel: function(type, data) {
  884. return solutionService.customPOST(data, 'updModel/' + type, {});
  885. },
  886. rmModels: function(id, data) {
  887. return solutionService.customPOST(data, 'rmModels/' + id, {});
  888. },
  889. update: function() {
  890. return solutionService.one('update');
  891. },
  892. upload: function() {
  893. return solutionService.one('upload');
  894. },
  895. uploadResponseUri: function() {
  896. return solutionService.one('/');
  897. },
  898. addNotFile: function(data) {
  899. return solutionService.customPOST(data, 'addNotFile', {});
  900. },
  901. // export: function(data) {
  902. // return solutionService.customGET(data, 'export', {});
  903. // },
  904. export: function(data) {
  905. return solutionService.one('export');
  906. },
  907. updateNotFile: function(data) {
  908. return solutionService.customPOST(data, 'updateNotFile', {});
  909. },
  910. updateSolution: function(data) {
  911. return solutionService.customPOST(data, 'updateSolution', {});
  912. },
  913. searchSolutionByKey: function(key, id) {
  914. return solutionService.customGET('searchSolutionByKey/' + key + '/' + id);
  915. },
  916. findSolutionById: function(id) {
  917. return solutionService.customGET('check/' + id);
  918. },
  919. findSolutions: function(id) {
  920. return solutionService.customGET('check2/' + id);
  921. },
  922. fetchDataList: function(model, data) {
  923. return solutionService.customPOST(data, 'fetchDataList/' + model, {});
  924. },
  925. findSolutionDataByDateById: function(ndate, sid) {
  926. return data.customGET('findSolutionDataByDateById/' + ndate + '/' + sid);
  927. },
  928. findSolutionTypeActions: function(userId) {
  929. return typeservice.customGET('findSolutionTypeActions/' + userId);
  930. },
  931. findSolutionTypesUser: function(data) {
  932. return typeservice.customPOST(data, 'findSolutionTypesUser', {});
  933. },
  934. addTypeUserAll: function(data) {
  935. return typeservice.customPOST(data, 'addTypeUserAll', {});
  936. },
  937. hotRanking: function(num) {
  938. return solutionService.customGET('hotRanking/' + num);
  939. },
  940. scoreRanking: function(num) {
  941. return solutionService.customGET('scoreRanking/' + num);
  942. },
  943. fetchBBSSolutions: function(pageIndex, pageSum, sequence, userId) {
  944. return solutionService.customGET('communicationSolutions/' + pageIndex + '/' + pageSum + '/' + sequence + '/' + userId);
  945. },
  946. queryBBSSolutions: function(pageIndex, pageSum, sequence, userId, key) {
  947. return solutionService.customGET('communicationSolutions/' + pageIndex + '/' + pageSum + '/' + sequence + '/' + userId + '/' + key);
  948. },
  949. updateSolutionStatus: function(data) {
  950. return solutionService.customPOST(data, 'updateSolutionStatus', {});
  951. },
  952. getSolutionNumber: function() {
  953. return solutionService.customGET('getSolutionNumber');
  954. },
  955. addSolutionType: function(data) {
  956. return typeservice.customPOST(data, 'add', {});
  957. },
  958. updateSolutionType: function(data) {
  959. return typeservice.customPOST(data, 'update', {});
  960. },
  961. removeSolutionType: function(id) {
  962. return typeservice.customGET('delete/' + id);
  963. },
  964. getSolutionType: function(id) {
  965. return typeservice.customGET('' + id);
  966. },
  967. getTree: function(typeId, groupId, flag) {
  968. return typeservice.customGET('getTree/' + typeId + '/' + groupId + '/' + flag);
  969. },
  970. checkCommentScoreByUserIds: function(userId, id) {
  971. return review.customGET('findCommentScore/' + userId + '/' + id);
  972. },
  973. addSolutionReview: function(data) {
  974. return solutionService.customPOST(data, 'addScore', {});
  975. },
  976. findSolutionReviewById: function(userid, id, pageIndex, pageSum) {
  977. return solutionService.customGET('findSolutionReviewByType/' + userid + '/' + id + '/' + pageIndex + '/' + pageSum);
  978. },
  979. saveAllUserAuth: function(solutionId, flag) {
  980. return solutionService.customGET('saveAllUserTrees/' + solutionId + '/' + flag);
  981. },
  982. updatermvSolutionType: function(typeId, groupId, userIds, flag) {
  983. return typeservice.customGET('delOrUpdateTrees/' + typeId + '/' + groupId + '/' + userIds + '/' + flag);
  984. },
  985. findSolutionGroup: function(id) {
  986. return groupservice.customGET('findSolutionGroup/' + id);
  987. },
  988. saveSolutionGroup: function(id, data) {
  989. return groupservice.customPOST(data, 'saveSolutionGroup/' + id);
  990. },
  991. // getSolutionDowpath: function(id){
  992. // return solutionService.one('download/'+id);
  993. // }
  994. getSolutionDowpath: function(attachmentId) {
  995. return solutionService.one('download/' + attachmentId + '/file');
  996. }
  997. // getSolutionDowpath: function(attachmentId){
  998. // return solutionService.customGET('download/' + attachmentId);
  999. // }
  1000. };
  1001. }]);
  1002. app.factory('CMDBRestangular', function(Restangular) {
  1003. return Restangular.withConfig(function(RestangularConfigurer) {
  1004. RestangularConfigurer.setBaseUrl(serverIp + '/api/cmdb/cmdb/');
  1005. });
  1006. });
  1007. app.factory('api_cmdb', ['CMDBRestangular', function(CMDBRestangular) {
  1008. var ciService = CMDBRestangular.all("ci");
  1009. var uuidService = CMDBRestangular.all("uuid");
  1010. var edgeService = CMDBRestangular.all("edge");
  1011. var traversal = CMDBRestangular.all("traversal");
  1012. var downloadService = CMDBRestangular.all("download");
  1013. var exportService = CMDBRestangular.all("export");
  1014. var importService = CMDBRestangular.all("import");
  1015. var exportModelService = CMDBRestangular.all("exportModel");
  1016. var importDataService = CMDBRestangular.all("importData");
  1017. var exportDataService = CMDBRestangular.all("exportData");
  1018. var searchService = CMDBRestangular.all("search");
  1019. function serializeData(data) {
  1020. // If this is not an object, defer to native stringification.
  1021. if (!angular.isObject(data)) {
  1022. return ((data == null) ? "" : data.toString());
  1023. }
  1024. var buffer = [];
  1025. // Serialize each key in the object.
  1026. for (var name in data) {
  1027. if (!data.hasOwnProperty(name)) {
  1028. continue;
  1029. }
  1030. var value = data[name];
  1031. buffer.push(
  1032. encodeURIComponent(name) + "=" + encodeURIComponent((value == null) ? "" : value)
  1033. );
  1034. }
  1035. // Serialize the buffer and clean it up for transportation.
  1036. var source = buffer.join("&").replace(/%20/g, "+");
  1037. return (source);
  1038. }
  1039. return {
  1040. create: function(data) {
  1041. return ciService.customPOST(data, '', {});
  1042. },
  1043. importData: function() {
  1044. return importDataService.one('/nodes');
  1045. },
  1046. put: function(data, id) {
  1047. return ciService.customPUT(data, id, {});
  1048. },
  1049. remove: function(id) {
  1050. return ciService.customDELETE(id);
  1051. },
  1052. removeByUUId: function(uuid) {
  1053. return ciService.customDELETE('uuid/' + id, {}, { 'Content-Type': 'application/json' });
  1054. },
  1055. removeRefById: function(id) {
  1056. return ciService.customDELETE(id + '/ref');
  1057. },
  1058. find: function(id) {
  1059. return ciService.customGET(id);
  1060. },
  1061. searchkey: function(type, key, idx, sum) {
  1062. return searchService.customGET(type + '/' + key + '/' + idx + '/' + sum);
  1063. },
  1064. findByUUId: function(uuid) {
  1065. return ciService.customGET('?uuid=' + uuid);
  1066. },
  1067. query: function(data) {
  1068. return ciService.customGET('query', data);
  1069. },
  1070. findRefById: function(id) {
  1071. return ciService.customGET(id + '/refs');
  1072. },
  1073. finduuid: function(type, model) {
  1074. return uuidService.customGET(type + '/' + model);
  1075. },
  1076. types: function() {
  1077. return CMDBRestangular.customGET('types');
  1078. },
  1079. createRef: function(data) {
  1080. return edgeService.customPOST(data, '', {});
  1081. },
  1082. putRef: function(data, id) {
  1083. return edgeService.customPUT(data, '' + id, {});
  1084. },
  1085. removeRef: function(id) {
  1086. return edgeService.customDELETE(id, {}, { 'Content-Type': 'application/json' });
  1087. },
  1088. traversal: function(uuid) {
  1089. return traversal.customGET(uuid);
  1090. },
  1091. traversalRel: function(uuid, relation) {
  1092. return traversal.customGET(uuid + '/' + relation + '/' + 'none');
  1093. },
  1094. export: function(label) {
  1095. return exportService.customGET('nodes/' + label);
  1096. },
  1097. import: function() {
  1098. return importService.one('/nodes');
  1099. },
  1100. download: function(label) {
  1101. return downloadService.one('/label');
  1102. },
  1103. exportData: function(type, model) {
  1104. return exportDataService.one(model + '/' + type);
  1105. },
  1106. downModels: function(type, model) {
  1107. return exportModelService.one(model + '/' + type);
  1108. }
  1109. };
  1110. }]);
  1111. app.factory('MonitorRestangular', function(Restangular) {
  1112. return Restangular.withConfig(function(RestangularConfigurer) {
  1113. RestangularConfigurer.setBaseUrl(serverIp + ':9004/services');
  1114. });
  1115. });
  1116. app.factory('api_monitor', ['MonitorRestangular', function(MonitorRestangular) {
  1117. //http://127.0.0.1:9004/services/ftpFile/monitor/bankTip/
  1118. var process = MonitorRestangular.all("ftpFile/monitor");
  1119. return {
  1120. bankTip: function(id) {
  1121. return process.customGET('bankTip/' + id);
  1122. },
  1123. list: function() {
  1124. return process.customGET('list/1000');
  1125. },
  1126. devList: function(id) {
  1127. return process.customGET('devList/' + id);
  1128. },
  1129. cpuList: function() {
  1130. return process.customGET('cpuList/10');
  1131. },
  1132. memList: function() {
  1133. return process.customGET('memList/10');
  1134. },
  1135. storageList: function() {
  1136. return process.customGET('storageList/10');
  1137. },
  1138. transData: function() {
  1139. return process.customGET('transData/5');
  1140. },
  1141. banklist: function() {
  1142. return process.customGET('banklist');
  1143. },
  1144. app: function(id) {
  1145. return process.customGET('app/' + id);
  1146. },
  1147. beita: function(id) {
  1148. return process.customGET('beita/' + id);
  1149. },
  1150. gongji: function(id) {
  1151. return process.customGET('gongji/' + id);
  1152. }
  1153. };
  1154. }]);
  1155. app.factory('ReportRestangular', function(Restangular) {
  1156. return Restangular.withConfig(function(RestangularConfigurer) {
  1157. //RestangularConfigurer.setBaseUrl('http://127.0.0.1:9005/api/cmdb/');
  1158. RestangularConfigurer.setBaseUrl(reportIp + '/saiku/rest');
  1159. // RestangularConfigurer.setBaseUrl(serverIp + ':8888/saiku/rest');
  1160. //saiku/rest/saiku/api/query/execute/
  1161. });
  1162. });
  1163. app.factory('api_report', ['ReportRestangular', 'Restangular', function(MonitorRestangular, Restangular) {
  1164. var reportService = MonitorRestangular.all("saiku/api");
  1165. var authService = MonitorRestangular.one("saiku/session");
  1166. return {
  1167. getLicenseKey: function() {
  1168. return Restangular.one('assets/').customGET('api/reportToken.js');
  1169. },
  1170. // auth: function(){
  1171. // return authService.customPOST('username=admin&password=admin&language=zh'
  1172. // ,'', {}, {'Content-Type': 'application/x-www-form-urlencoded'});
  1173. // },
  1174. // session: function(){
  1175. // return authService.customGET('');
  1176. // },
  1177. list: function() {
  1178. return reportService.customGET('repository?type=saiku');
  1179. /**
  1180. /saiku/api/repository
  1181. path: /homes/home:admin/itsm_reports
  1182. */
  1183. },
  1184. getMdx: function(path, uuid) {
  1185. var rdata = 'file=' + path + '&formatter=flattened&language=zh';
  1186. return reportService.customPOST(rdata, 'query/' + uuid, {}, { 'Content-Type': 'application/x-www-form-urlencoded' });
  1187. },
  1188. execute: function(data) {
  1189. return reportService.customPOST(data, 'query/execute', {}, { 'Accept': 'application/json, text/javascript, */*' });
  1190. },
  1191. exportData: function(reportView, uuid, reportfileName) {
  1192. return reportService.one('query/rest/export/xls/?exportname=' + reportfileName + 'xls');
  1193. }
  1194. };
  1195. }]);