main.js 57 KB

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