main.js 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998
  1. var app = angular.module('itsmApp', ['itsm-dep']);
  2. var domainName = document.domain;//域名
  3. var protocolName = document.location.protocol;//http协议
  4. // var appchild = angular.module('itsmApp', ['itsm-dep']);
  5. //本地测试
  6. // var serverIp = "http://localhost/service";
  7. // var reportIp = "http://localhost/service";
  8. // var inspectIp = "http://localhost/service";
  9. // var imgBaseUrl = "http://localhost";
  10. // var callIp = "http://192.168.3.122:29005";
  11. //线上
  12. var serverIp = protocolName + "//" + domainName + "/service";
  13. var reportIp = protocolName + "//" + domainName + "/service";
  14. var inspectIp = protocolName + "//" + domainName + "/service";
  15. var imgBaseUrl = protocolName + "//" + domainName;
  16. var callIp = protocolName + "//192.168.3.122:29005";
  17. // 信用社
  18. // var serverIp = "http://192.168.2.63:80/service"; //跟其他有关
  19. // var reportIp = "http://192.168.2.63:80/service"; //跟报表有关
  20. // var inspectIp = "http://192.168.2.63:80/service";
  21. // var callIp = "http://192.168.2.63:80/service";
  22. //101测试
  23. // var serverIp = "http://192.168.3.101/service";
  24. // var reportIp = "http://192.168.3.101/service";
  25. // var inspectIp = "http://192.168.3.101/service";
  26. // var imgBaseUrl = "http://192.168.3.101";//富文本框上传图片路径
  27. // var callIp = "http://192.168.3.122:29005";
  28. // 139
  29. // var serverIp = "http://itsmpoc.dashitech.com/service";
  30. // var reportIp = "http://itsmpoc.dashitech.com/service"; //跟报表有关
  31. // var inspectIp = "http://itsmpoc.dashitech.com/service";
  32. // var callIp = "http://192.168.3.122:29005";
  33. app.run(['$rootScope', '$state', '$stateParams', '$auth', '$http', '$cookieStore', 'Restangular', 'api_login',
  34. function ($rootScope, $state, $stateParams, $auth, $http, $cookieStore, Restangular, api_login) {
  35. // Attach Fastclick for eliminating the 300ms delay between a physical tap and the firing of a click event on mobile browsers
  36. FastClick.attach(document.body);
  37. // Set some reference to access them from any scope
  38. $rootScope.$state = $state;
  39. $rootScope.$stateParams = $stateParams;
  40. // GLOBAL APP SCOPE
  41. // set below basic information
  42. // $rootScope.audioiIp="http://218.197.181.213:8080"
  43. $rootScope.app = {
  44. name: '', // name of your project
  45. author: '', // author's name or company name
  46. description: '', // brief description
  47. version: 'V2.0', // current version
  48. year: ((new Date()).getFullYear()), // automatic current year (for copyright information)
  49. isMobile: (function () { // true if the browser is a mobile device
  50. var check = false;
  51. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  52. check = true;
  53. };
  54. return check;
  55. })(),
  56. isChrome: false,
  57. isLoginFixed: false,
  58. layout: {
  59. // isLoginFixed: true,
  60. isNavbarFixed: true, //true if you want to initialize the template with fixed header
  61. isSidebarFixed: true, // true if you want to initialize the template with fixed sidebar
  62. isSidebarClosed: false, // true if you want to initialize the template with closed sidebar
  63. isFooterFixed: false, // true if you want to initialize the template with fixed footer
  64. theme: 'theme-8', // indicate the theme chosen for your project
  65. logo: 'assets/images/logo.png' // relative path of the project logo
  66. }
  67. };
  68. // 获取项目名称----网络与信息化运维管理系统
  69. $rootScope.getProjectName = function () {
  70. api_login.getProjectName().then(function (res) {
  71. $rootScope.app.name = $rootScope.app.author = $rootScope.app.description = res.sysName;
  72. })
  73. }
  74. $rootScope.getProjectName();
  75. // $http.defaults.headers.common["X-Auth-Token"] = $cookieStore.get('Auth-Token') || null;
  76. // $http.defaults.headers.common["X-Auth-Token"] = $cookieStore.get('Auth-Token') || null;
  77. Restangular.setErrorInterceptor(function (element, operation, what, url, headers, queryParams) {
  78. if (!url) {
  79. // console.log($http);
  80. // console.log($auth);
  81. if (element.config.url ==
  82. "http://testncc.hust.edu.cn/service/bpm/data/getCount"
  83. ) {
  84. window.location.href = serviceip;
  85. document.getElementById("casUserId").value = null;
  86. }
  87. }
  88. // console.log(element);
  89. })
  90. Restangular.setFullRequestInterceptor(function (element, operation, what, url, headers, queryParams) {
  91. var token = $cookieStore.get('Auth-Token') || null;
  92. var isReportUri = url.indexOf('saiku') > 0;
  93. if (token && isReportUri) {
  94. return {
  95. element: element,
  96. params: queryParams,
  97. headers: _.extend({}, headers, {
  98. 'X-Auth-Token': $cookieStore.get('Auth-Token') || null
  99. })
  100. };
  101. } else {
  102. return {
  103. element: element,
  104. params: queryParams,
  105. headers: headers
  106. };
  107. }
  108. });
  109. Restangular.addResponseInterceptor(function (data, operation, what, url, response, deferred) {
  110. var ua = window.navigator.userAgent.toLowerCase();
  111. ua.match(/chrome/i)
  112. if (data) {
  113. if (data.state == "433") {
  114. $rootScope.logout();
  115. var Notification = window.Notification;
  116. Notification.requestPermission();
  117. sessionStorage.clear();
  118. data = {};
  119. var n = new Notification("登录退出", {
  120. body: "您的账号在其他地方登录,请确认后重新登录",
  121. icon: '../bower_components/HTML5-Desktop-Notifications/alert.ico',
  122. onclick: function onNotificationClicked() {
  123. console.log('Notification clicked.');
  124. }
  125. });
  126. } else if (data.state == "403") {
  127. $state.go("app.dashboard");
  128. var Notification = window.Notification;
  129. Notification.requestPermission();
  130. var n = new Notification("无权限访问", {
  131. body: "此页面无权限访问",
  132. icon: '../bower_components/HTML5-Desktop-Notifications/alert.ico',
  133. onclick: function onNotificationClicked() {
  134. console.log('Notification clicked.');
  135. }
  136. });
  137. } else {
  138. deferred.resolve(data)
  139. }
  140. }
  141. });
  142. // $rootScope.nickname ='lijin';
  143. // $rootScope.user = {
  144. // name: 'Peter',
  145. // job: 'ng-Dev',
  146. // picture: 'app/img/user/02.jpg'
  147. // };
  148. }
  149. ]);
  150. // translate config
  151. app.config(['$translateProvider',
  152. function ($translateProvider) {
  153. // prefix and suffix information is required to specify a pattern
  154. // You can simply use the static-files loader with this pattern:
  155. $translateProvider.useStaticFilesLoader({
  156. prefix: 'assets/i18n/',
  157. suffix: '.json'
  158. });
  159. // Since you've now registered more then one translation table, angular-translate has to know which one to use.
  160. // This is where preferredLanguage(langKey) comes in.
  161. $translateProvider.preferredLanguage('zh');
  162. // Store the language in the local storage
  163. $translateProvider.useLocalStorage();
  164. }
  165. ]);
  166. // Angular-Loading-Bar
  167. // configuration
  168. app.config(['cfpLoadingBarProvider',
  169. function (cfpLoadingBarProvider) {
  170. cfpLoadingBarProvider.includeBar = true;
  171. cfpLoadingBarProvider.includeSpinner = false;
  172. }
  173. ]);
  174. /**
  175. * // http: //115.156.150.70:9680/webservice/data/fetchDataList/queryUser
  176. */
  177. //信息中心 --wt
  178. app.factory('msgRestangular', function (Restangular) {
  179. return Restangular.withConfig(function (RestangularConfigurer) {
  180. RestangularConfigurer.setBaseUrl(serverIp + '/messageStation');
  181. });
  182. });
  183. app.factory('api_msg', ['msgRestangular', function (msgRestangular) {
  184. var msgService = msgRestangular.all("data");
  185. return {
  186. msgDataList: function (data) {
  187. return msgService.customPOST(data, 'fetchDataList/messageStation', {});
  188. },
  189. updateDataList: function (data) {
  190. return msgService.customPOST(data, 'updateModel/messageStation', {});
  191. },
  192. };
  193. }]);
  194. /**
  195. * // http: //115.156.150.70:9680/api/webservice/data/fetchDataList/queryUser
  196. */
  197. app.config(['RestangularProvider', function (RestangularProvider) {
  198. RestangularProvider.setBaseUrl('');
  199. }]);
  200. app.factory('serviceip', function (Restangular) {
  201. return Restangular.withConfig(function (RestangularConfigurer) {
  202. RestangularConfigurer.setBaseUrl(serviceip);
  203. });
  204. });
  205. app.factory('WechatRestangular', function (Restangular) {
  206. return Restangular.withConfig(function (RestangularConfigurer) {
  207. RestangularConfigurer.setBaseUrl(serverIp + '/common/');
  208. });
  209. });
  210. // 事件分类
  211. app.factory('eventCategory', function (Restangular) {
  212. return Restangular.withConfig(function (RestangularConfigurer) {
  213. RestangularConfigurer.setBaseUrl(serverIp + '/bpm/data/');
  214. });
  215. });
  216. app.factory('jry_api_bpm', ['eventCategory', function (eventCategory) {
  217. var jry_incidentService = eventCategory.all("fetchDataList");
  218. var jry_add = eventCategory.all("addData");
  219. var jry_updata = eventCategory.all("updData");
  220. var jry_movdata = eventCategory.all("rmvData");
  221. var jry_fetchDeptByPhone = eventCategory.all("fetchDeptByPhone");//呼叫中心电话查详情
  222. return {
  223. //呼叫中心电话查详情
  224. jry_fetchDeptByPhone: function (key, data) {
  225. return jry_fetchDeptByPhone.customPOST(data, key, {});
  226. },
  227. jry_getFaultScri: function (key, data) {
  228. return jry_incidentService.customPOST(data, key, {});
  229. },
  230. jry_getIncidentScri: function (data) {
  231. return jry_incidentService.customPOST(data, 'incidentdescribe', {});
  232. },
  233. jry_getFetchDataList: function (data, key) {
  234. return jry_incidentService.customPOST(data, key, {});
  235. },
  236. jry_addFn: function (data, key) {
  237. return jry_add.customPOST(data, key, {});
  238. },
  239. jry_editFn: function (data, key) {
  240. return jry_updata.customPOST(data, key, {});
  241. },
  242. jry_movFn: function (data, key) {
  243. return jry_movdata.customPOST(data, key, {});
  244. }
  245. };
  246. }]);
  247. app.factory('api_wechatfile', ['WechatRestangular', function (WechatRestangular) {
  248. var dataService = WechatRestangular.all("common");
  249. return {
  250. jry_download: function (attachmentId) {
  251. return dataService.one('downloadAttachment/' + attachmentId);
  252. },
  253. listAttachments: function (type, model) {
  254. return dataService.customGET('listAttachment/' + type + "/" + model, {});
  255. // return dataService.one('listAttachment/' + type + "/" + model);
  256. },
  257. listAttachment: function (type, model) {
  258. return dataService.customGET('listAttachment/' + type + "/" + model, {});
  259. // return dataService.one('listAttachment/' + type + "/" + model);
  260. },
  261. downloadAttachment: function (model) {
  262. return dataService.one('downloadAttachment/' + model, {});
  263. },
  264. attachmentsPreviewUrl: function (attachmentId) {
  265. return dataService.customGET('attachmentsPreviewUrl/' + attachmentId);
  266. },
  267. download: function (attachmentId) {
  268. return dataService.one('getAttachmentContent/' + attachmentId);
  269. },
  270. getDictionary: function (data) {
  271. return dataService.customPOST(data, 'getDictionary', {});
  272. },
  273. getDictionaryForList: function (data) {
  274. return dataService.customPOST(data, 'getDictionaryForList', {});
  275. },
  276. addDictionary: function (data) {
  277. return dataService.customPOST(data, 'addDictionary', {});
  278. }
  279. };
  280. }]);
  281. app.factory('webserviceRestangular', function (Restangular) {
  282. return Restangular.withConfig(function (RestangularConfigurer) {
  283. RestangularConfigurer.setBaseUrl(serverIp + '/webservice/');
  284. });
  285. });
  286. app.factory('api_webservice', ['webserviceRestangular', function (webserviceRestangular) {
  287. var dataService = webserviceRestangular.all("data");
  288. return {
  289. fetchDataList: function (model, data) {
  290. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  291. }
  292. };
  293. }]);
  294. app.factory('playRestangular', function (Restangular) {
  295. return Restangular.withConfig(function (RestangularConfigurer) {
  296. RestangularConfigurer.setBaseUrl(callIp);
  297. });
  298. });
  299. app.factory('api_playservice', ['playRestangular', function (playRestangular) {
  300. var dataService = playRestangular.all("recording");
  301. return {
  302. playData: function (attachmentId) {
  303. return dataService.customGET('recording?callID=' + attachmentId);
  304. },
  305. };
  306. }]);
  307. app.factory('ConversationRestangular', function (Restangular) {
  308. return Restangular.withConfig(function (RestangularConfigurer) {
  309. RestangularConfigurer.setBaseUrl(serverIp + '/conversation/');
  310. });
  311. });
  312. app.factory('api_conversation', ['ConversationRestangular', function (ConversationRestangular) {
  313. var dataService = ConversationRestangular.all("conversation");
  314. return {
  315. roleMenu: function (model) {
  316. return dataService.customGET('roleMenu/' + model, {});
  317. },
  318. pageMenuByCode: function (model) {
  319. return dataService.customGET('pageMenuByCode/' + model, {});
  320. },
  321. pageEvent: function (data, model) {
  322. return dataService.customPOST(data, 'pageEvent', {});
  323. }
  324. };
  325. }]);
  326. app.factory('textRestangular', function (Restangular) {
  327. return Restangular.withConfig(function (RestangularConfigurer) {
  328. // RestangularConfigurer.setBaseUrl(inspectIp + ':8080/IXServer/');
  329. RestangularConfigurer.setBaseUrl(inspectIp + ':8088/IXServer/');
  330. });
  331. });
  332. app.factory('api_text', ['textRestangular', function (textRestangular) {
  333. var loginService = textRestangular.all("comm");
  334. var loginsins = textRestangular.all("tele/agent");
  335. return {
  336. start: function (phone, id) {
  337. var rdata = "dom=0&epwd=&aid=" + id + "&apwd=e10adc3949ba59abbe56e057f20f883e&adn=" + phone;
  338. return loginService.customPOST(rdata, 'start', {}, {
  339. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  340. });
  341. },
  342. exit: function (token) {
  343. var rdata = "dom=0&token=" + token;
  344. return loginService.customPOST(rdata, 'exit', {}, {
  345. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  346. });
  347. },
  348. login: function (group, token, id) {
  349. var rdata = "dom=0&token=" + token + "&aid=" + id + "&acd=" + group + "&skill=-1&mon=false&silent=false";
  350. return loginsins.customPOST(rdata, 'login', {}, {
  351. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  352. });
  353. },
  354. logout: function (token, id) {
  355. var rdata = "dom=0&token=" + token + "&aid=" + id + "";
  356. return loginsins.customPOST(rdata, 'logout', {}, {
  357. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  358. });
  359. },
  360. dialout: function (token, gid, teleno) {
  361. var rdata = "dom=0&token=" + token + "&teleno=" + teleno + "&gid=" + gid + "&uud=&async=true";
  362. return loginsins.customPOST(rdata, 'dialout', {}, {
  363. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  364. });
  365. },
  366. callout: function (token, teleno) {
  367. var rdata = "dom=0&token=" + token + "&teleno=" + teleno + "&uud=&async=true";
  368. return loginsins.customPOST(rdata, 'dialout', {}, {
  369. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  370. });
  371. },
  372. setbusy: function (token) {
  373. var rdata = "dom=0&token=" + token;
  374. return loginsins.customPOST(rdata, 'setbusy', {}, {
  375. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  376. });
  377. },
  378. setidle: function (token) {
  379. var rdata = "dom=0&token=" + token;
  380. return loginsins.customPOST(rdata, 'setidle', {}, {
  381. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  382. });
  383. },
  384. inittrans: function (telephone, token) {
  385. var rdata = "dom=0&token=" + token + "&teleno=" + telephone + "&uud=&async=true";
  386. return loginsins.customPOST(rdata, 'inittrans', {}, {
  387. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  388. });
  389. },
  390. comptrans: function (telephone, token) {
  391. var rdata = "dom=0&token=" + token;
  392. return loginsins.customPOST(rdata, 'comptrans', {}, {
  393. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  394. });
  395. },
  396. record: function (token) {
  397. var rdata = "dom=0&token=" + token + "&filename=/tmp/agent.wav&async=true&maxtime=10&termchar=&append=true";
  398. return loginsins.customPOST(rdata, 'record', {}, {
  399. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  400. });
  401. },
  402. offhook: function (token) {
  403. var rdata = "dom=0&token=" + token;
  404. return loginsins.customPOST(rdata, 'offhook', {}, {
  405. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  406. });
  407. },
  408. onhook: function (token) {
  409. var rdata = "dom=0&token=" + token;
  410. return loginsins.customPOST(rdata, 'onhook', {}, {
  411. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  412. });
  413. },
  414. getcdrid: function (token) {
  415. var rdata = "dom=0&token=" + token;
  416. return loginsins.customPOST(rdata, 'getcdrid', {}, {
  417. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  418. });
  419. }
  420. }
  421. }])
  422. app.factory('UserRestangular', function (Restangular) {
  423. return Restangular.withConfig(function (RestangularConfigurer) {
  424. RestangularConfigurer.setBaseUrl(serverIp);
  425. });
  426. });
  427. app.factory('api_user', ['UserRestangular', function (UserRestangular) {
  428. var basePath = "user/";
  429. return {
  430. };
  431. }]);
  432. app.factory('api_report_data', ['UserRestangular', function (UserRestangular) {
  433. var basePath = UserRestangular.all("report/report/");
  434. var datas = UserRestangular.all("data");
  435. var form = UserRestangular.all("form");
  436. var formData = UserRestangular.all("formData");
  437. var reports = UserRestangular.all("report/data");
  438. return {
  439. fetchDataList: function (model, data) {
  440. return basePath.customPOST(data, 'fetchDataList/' + model, {});
  441. },
  442. fetchDataList1: function (model, data) {
  443. return datas.customPOST(data, 'fetchDataList/' + model, {});
  444. },
  445. report: function (model, data) {
  446. return basePath.customPOST(data, model, {});
  447. },
  448. addModel: function (model, data) {
  449. return basePath.customPOST(data, 'addModel/' + model, {});
  450. },
  451. updateModel: function (model, data) {
  452. return basePath.customPOST(data, 'updateModel/' + model, {});
  453. },
  454. rmModels: function (model, id) {
  455. return basePath.customPOST(null, 'rmModels/' + id + '/' + model, {});
  456. },
  457. updData: function (model, data) {
  458. return datas.customPOST(data, 'updData/' + model, {});
  459. },
  460. addData: function (model, data) {
  461. return datas.customPOST(data, 'addData/' + model, {});
  462. },
  463. rmvData: function (model, data) {
  464. return datas.customPOST(data, 'rmvData/' + model, {});
  465. },
  466. renderTabForm: function (model) {
  467. return form.customGET('renderTabForm/' + model);
  468. },
  469. updateForm: function (model, data) {
  470. return form.customPOST(data, 'updateForm/' + model, {});
  471. },
  472. formData: function (model, data) {
  473. return formData.customPOST(data, 'rmvData/' + model, {});
  474. },
  475. reportsData: function (model, data) {
  476. return reports.customPOST(data, model, {});
  477. }
  478. };
  479. }]);
  480. app.factory('api_login', ['UserRestangular', function (UserRestangular) {
  481. var loginService = UserRestangular.all("auth");
  482. return {
  483. getProjectName: function () {
  484. return loginService.customGET('getSysName');
  485. },
  486. login: function (username, password) {
  487. return loginService.customPOST(username, 'loginEncrypt', {});
  488. },
  489. // logout: function(sessionid,userid){
  490. // return loginService.customPOST(sessionid + '/' + userid);
  491. // },
  492. license: function (data) {
  493. return loginService.customPOST(data, 'license', {});
  494. },
  495. getLicense: function (data) {
  496. return loginService.customPOST(data, 'getLicense', {});
  497. },
  498. sso: function (nickname) {
  499. return loginService.customGET('sso/' + nickname);
  500. },
  501. resetpwd: function (userid) {
  502. return loginService.customGET('resetpwd/' + userid);
  503. },
  504. uppwd: function (data) {
  505. return loginService.customPOST(data, 'uppwd', {});
  506. }
  507. }
  508. }])
  509. app.factory('applyRestangular', function (Restangular) {
  510. return Restangular.withConfig(function (RestangularConfigurer) {
  511. RestangularConfigurer.setBaseUrl(serverIp + '/apply/');
  512. });
  513. });
  514. app.factory('api_apply', ['applyRestangular', function (applyRestangular) {
  515. var applyService = applyRestangular.all("bpm");
  516. return {
  517. wxIncidentReject: function (id, data) {
  518. return applyService.customPOST(data, 'wxIncidentReject/' + id, {});
  519. }
  520. }
  521. }])
  522. app.factory('api_user_data', ['UserRestangular', function (UserRestangular) {
  523. var dataService = UserRestangular.all("user/data");
  524. var userService = UserRestangular.all("auth");
  525. return {
  526. validate: function (data) {
  527. return dataService.customPOST(data, 'validate/role', {});
  528. },
  529. importData: function () {
  530. return dataService.one('/importData');
  531. },
  532. importData1: function (type) {
  533. return dataService.one('/importData/'+type);
  534. },
  535. fetchDataList: function (model, data) {
  536. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  537. },
  538. fetchData: function (model, data) {
  539. return dataService.customPOST(data, 'fetchData/' + model, {});
  540. },
  541. addData: function (model, data) {
  542. return dataService.customPOST(data, 'addData/' + model, {});
  543. },
  544. updData: function (model, data) {
  545. return dataService.customPOST(data, 'updData/' + model, {});
  546. },
  547. rmvData: function (model, data) {
  548. return dataService.customPOST(data, 'rmvData/' + model, {});
  549. },
  550. register: function (data) {
  551. return dataService.customPOST(data, 'register', {});
  552. },
  553. downDataModel: function (type, month) {
  554. return dataService.one('downDataModel/' + type + '/' + month);
  555. },
  556. fetchgetData: function (model, data) {
  557. return dataService.customGET('fetchData/' + model + '/' + data, {});
  558. },
  559. roleMenu: function (model) {
  560. return userService.customGET('roleMenu/' + model, {});
  561. },
  562. pageMenuByCode: function (model) {
  563. return userService.customGET('pageMenuByCode/' + model, {});
  564. },
  565. pageEvent: function (data, model) {
  566. return userService.customPOST(data, 'pageEvent', {});
  567. },
  568. pageMenu: function (data, model) {
  569. return userService.customPOST(data, 'pageMenu', {});
  570. // return userService.one('/pageMenu' + data);
  571. },
  572. getMenu: function (data, model) {
  573. return userService.customPOST(data, 'getMenu', {});
  574. }
  575. };
  576. }]);
  577. // app.factory('DpmRestangular', function(Restangular) {
  578. // return Restangular.withConfig(function(RestangularConfigurer) {
  579. // RestangularConfigurer.setBaseUrl(serverIp+':9008/data/');
  580. // });
  581. // });
  582. // app.factory('api_bpm_dbca', ['DpmRestangular', function(DpmRestangular){
  583. // var bpm = DpmRestangular.all("bpm");
  584. // return {
  585. // impFileData: function(pdKey){
  586. // return bpm.customPOST( 'impFileData/' + pdKey);
  587. // },
  588. // };
  589. // }]);
  590. app.factory('BpmRestangular', function (Restangular) {
  591. return Restangular.withConfig(function (RestangularConfigurer) {
  592. // RestangularConfigurer.setBaseUrl("http://168.166.3.41"+':9008/api/');
  593. RestangularConfigurer.setBaseUrl(serverIp + '/bpm');
  594. });
  595. });
  596. app.factory('api_statistic', ['BpmRestangular', function (BpmRestangular) {
  597. var statistic = BpmRestangular.all("statistic");
  598. var table = BpmRestangular.all("data");
  599. return {
  600. query: function (data, rptId) {
  601. return statistic.customPOST(data, 'unidimensional/' + rptId, {});
  602. },
  603. // exportData: function(reportView, uuid, reportfileName){
  604. // return reportService.one('query/rest/export/xls/?exportname='+reportfileName+'xls');
  605. // }
  606. getTask: function (userid, idx, sum) {
  607. return table.customGET('getTask/' + userid + '/' + idx + '/' + sum);
  608. },
  609. unidimensionalExport: function (rptId) {
  610. return statistic.one('unidimensionalExport/' + rptId);
  611. },
  612. tableData: function (data, rptId) {
  613. return table.customPOST(data, 'fetchDataList/' + rptId, {});
  614. }
  615. }
  616. }]);
  617. app.factory('api_bpm', ['BpmRestangular', function (BpmRestangular) {
  618. var process = BpmRestangular.all("process");
  619. var postfix = BpmRestangular.all("bpm");
  620. var getData = BpmRestangular.all('data')
  621. return {
  622. deploy: function (data) {
  623. return process.customPOST(data, 're/model/deploy', {});
  624. },
  625. list: function () {
  626. return process.customGET('re/model/list');
  627. },
  628. modelsource: function (pdId) {
  629. return process.customGET('re/model/' + pdId + '/source');
  630. },
  631. // savemodel: function(pdId, data) {
  632. // return process.customPOST(data, 're/model/' + pdId + '/save', {});
  633. // },
  634. savemodel: function (pdId, data) {
  635. return process.customPOST(data, 'saveModel/' + pdId, {});
  636. },
  637. removemodel: function (modelId) {
  638. return process.customGET('re/model/' + modelId + '/remove');
  639. },
  640. upgrade: function (data, taskId, userId, model) {
  641. return postfix.customPOST(data, model + '/' + taskId + '/' + userId, {});
  642. // return postfix.customPOST(id);
  643. },
  644. fetchDataList: function (model, data) {
  645. return getData.customPOST(data, 'fetchDataList/' + model, {});
  646. },
  647. addData: function (model, data) {
  648. return getData.customPOST(data, 'addData/' + model, {});
  649. },
  650. updData: function (model, data) {
  651. return getData.customPOST(data, 'updData/' + model, {});
  652. },
  653. //判断事件分类层级
  654. tellCategory: function (id) {
  655. return getData.customGET('tellCategory' + '/' + id);
  656. }
  657. };
  658. }]);
  659. app.factory('CommonRestangular', function (Restangular) {
  660. return Restangular.withConfig(function (RestangularConfigurer) {
  661. RestangularConfigurer.setBaseUrl(serverIp + '/common');
  662. });
  663. });
  664. app.factory('api_bpm_domain', ['BpmRestangular', 'CommonRestangular', function (BpmRestangular, CommonRestangular) {
  665. var bpmService = BpmRestangular.all("bpm");
  666. var commonService = CommonRestangular.all("common");
  667. return {
  668. //指派
  669. delegateTask: function (pdKey, data) {
  670. return bpmService.customPOST(data, 'delegateTask/' + pdKey, {});
  671. },
  672. fetchtask: function (pdKey, data) {
  673. return bpmService.customPOST(data, 'fetchTask/' + pdKey, {});
  674. },
  675. start: function (pdKey, data) {
  676. return bpmService.customPOST(data, 'start/' + pdKey, {});
  677. },
  678. flowTracing: function (processInstanceId, data) {
  679. return bpmService.customPOST(data, 'flowTracing/' + processInstanceId, {});
  680. },
  681. flowTracingCustom: function (processInstanceId, data) {
  682. return bpmService.customPOST(data, 'flowTracingCustom/' + processInstanceId, {});
  683. },
  684. complete: function (taskId, userId, data) {
  685. return bpmService.customPOST(data, 'completeTask/' + taskId + '/' + userId, {});
  686. },
  687. completeUpgrade: function (data) {
  688. return bpmService.customPOST(data, 'upgradeIncident', {});
  689. },
  690. save: function (taskId, data) {
  691. return bpmService.customPOST(data, 'saveTaskVar/' + taskId, {});
  692. },
  693. claimtask: function (taskId, data) {
  694. return bpmService.customPOST(data, 'claimTask/' + taskId, {});
  695. },
  696. claimAndCompletedTask: function (taskId, data) {
  697. return bpmService.customPOST(data, 'claimAndCompletedTask/' + taskId, {});
  698. },
  699. delegateTask: function (taskId, data) {
  700. return bpmService.customPOST(data, 'delegateTask/' + taskId, {});
  701. },
  702. expectedTime: function (taskId) {
  703. return bpmService.customGET('expectedTime/' + taskId);
  704. },
  705. history: function (processId) {
  706. return bpmService.customGET('history/' + processId);
  707. },
  708. // upgrade: function(processInstanceId, taskId, data) {
  709. // return bpmService.customPOST(data, 'upgradeIncident/' + processInstanceId + '/' + taskId, {});
  710. // },
  711. listAttachments: function (processId, data) {
  712. return commonService.customGET('listAttachment/incident/' + processId, {});
  713. },
  714. listAttachment: function (modal, processId) {
  715. return commonService.customGET('listAttachment/' + modal + '/' + processId);
  716. },
  717. saveAttachments: function (processId, taskId, userId, data) {
  718. return bpmService.one('saveAttachments/' + processId + '/' + taskId + '/' + userId);
  719. },
  720. uploadAttachment: function (processId, taskId, userId, data) {
  721. return commonService.one('uploadAttachment/' + 'incident/' + processId);
  722. },
  723. uploadAttachmentJryModel: function (model, processId, taskId, userId, data) {
  724. return commonService.one('uploadAttachment/' + model + '/' + processId);
  725. },
  726. download: function (attachmentId) {
  727. return bpmService.one('getAttachmentContent/' + attachmentId);
  728. },
  729. // download: function(attachmentId){
  730. // return bpmService.customGET('getAttachmentContent/' + attachmentId,{},{'responseType':'arraybuffer'});
  731. // },
  732. attachmentsPreviewUrl: function (attachmentId) {
  733. return bpmService.customGET('attachmentsPreviewUrl/' + attachmentId);
  734. },
  735. startformkey: function (pdKey) {
  736. return bpmService.customGET('startformkey/' + pdKey);
  737. },
  738. taskformkey: function (taskId) {
  739. return bpmService.customGET('taskformkey/' + taskId);
  740. },
  741. workernumber: function (type) {
  742. return bpmService.customGET('restful/' + type);
  743. },
  744. getWatchAreaPosition: function (data) {
  745. return bpmService.customGET('getWatchAreaPosition');
  746. },
  747. getWatchAreaData: function (id) {
  748. return bpmService.customGET('getWatchAreaData/' + id);
  749. },
  750. // 业务系统附件上传
  751. upload: function (type, processId) {
  752. return commonService.one(type + processId);
  753. },
  754. };
  755. }]);
  756. // 事件富文本框上传
  757. app.factory('api_common_incident', ['BpmRestangular', 'CommonRestangular', function (BpmRestangular, CommonRestangular) {
  758. var commonService = CommonRestangular.all("common");
  759. return {
  760. upload: function (processId) {
  761. return commonService.one('uploadAttachment/incident/' + processId);
  762. },
  763. uploadResponseUri: function () {
  764. return imgBaseUrl + '/';
  765. },
  766. }
  767. }]);
  768. app.factory('api_bpm_data', ['BpmRestangular', function (BpmRestangular) {
  769. var dataService = BpmRestangular.all("data");
  770. var serviceCatalogue = BpmRestangular.all("ServiceCatalogue");
  771. var inspectionProcessActual = BpmRestangular.all("InspectionProcessActual");
  772. var solutionService = BpmRestangular.all("solution");
  773. return {
  774. // 获取首页今日上班清空
  775. getManagerIndexInfo: function (data) {
  776. return dataService.customPOST(data, 'getManagerIndexInfo');
  777. },
  778. // 不受理数据请求 --jry
  779. notAcceptData: function (data) {
  780. return dataService.customPOST(data, 'updData/alarmIncident');
  781. },
  782. // 获取认证计费数据
  783. sumInfo: function (account) {
  784. return dataService.customPOST({}, 'sumInfo/'+account);
  785. },
  786. impFileData: function () {
  787. return dataService.one('/impFileData/bpm_scheduleorder');
  788. },
  789. importData: function () {
  790. return dataService.one('/impFileData');
  791. },
  792. fetchDataList: function (model, data) {
  793. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  794. },
  795. fetchData: function (model, dataId) {
  796. return dataService.customGET('fetchData/' + model + '/' + dataId);
  797. },
  798. fetchServiceTasks: function (model, data) {
  799. if (!model) {
  800. model = "ALL"
  801. }
  802. return serviceCatalogue.customPOST(data, 'fetchServiceTasks/' + model, {});
  803. },
  804. fetchInspectServiceTasks: function (model, data) {
  805. if (!model) {
  806. model = "ALL"
  807. }
  808. return inspectionProcessActual.customPOST(data, 'fetchServiceTasks/' + model, {});
  809. },
  810. addData: function (model, data) {
  811. return dataService.customPOST(data, 'addData/' + model, {});
  812. },
  813. updData: function (model, data) {
  814. return dataService.customPOST(data, 'updData/' + model, {});
  815. },
  816. rmvData: function (model, data) {
  817. return dataService.customPOST(data, 'rmvData/' + model, {});
  818. },
  819. getCount: function (data) {
  820. return dataService.customPOST(data, 'getCount2', {});
  821. },
  822. downDataModel: function (type, month) {
  823. return dataService.one('downDataModel/' + type + '/' + month);
  824. },
  825. fetchDataByGroupId: function (data) {
  826. return dataService.customPOST(data, 'fetchDataByGroupId', {});
  827. },
  828. // downDataModel: function(type, month, data) {
  829. // return dataService.customPOST(data, 'downDataModel/' + type + '/' + month, {}, { 'Accept': 'application/json, text/javascript, */*' });
  830. // }
  831. };
  832. }]);
  833. app.factory('api_bpm_schedule', ['BpmRestangular', function (BpmRestangular) {
  834. var dataService = BpmRestangular.all("data");
  835. return {
  836. getScheduleClass: function () {
  837. var data = {
  838. "idx": "0",
  839. "sum": "10"
  840. };
  841. return dataService.customPOST(data, 'fetchDataList/scheduleclass', {});
  842. },
  843. fetchList: function (startTime, endTime, userId, queryKey) {
  844. var scheduleOrder = {
  845. "scheduleorder": {
  846. "startTime": startTime,
  847. "endTime": endTime
  848. },
  849. "idx": "0",
  850. "sum": "1000"
  851. };
  852. if (userId) {
  853. scheduleOrder['scheduleorder']['user'] = userId;
  854. }
  855. if (queryKey) {
  856. scheduleOrder['scheduleorder']['description'] = queryKey;
  857. }
  858. return dataService.customPOST(scheduleOrder, 'fetchDataList/scheduleorder', {});
  859. },
  860. fetchData: function (dataId) {
  861. return dataService.customGET('fetchData/scheduleorder/' + dataId);
  862. },
  863. update: function (data) {
  864. return dataService.customPOST(data, 'updData/scheduleorder', {});
  865. },
  866. add: function (data) {
  867. return dataService.customPOST(data, 'addData/scheduleorder', {});
  868. },
  869. remove: function (data) {
  870. return dataService.customPOST(data, 'rmvData/scheduleorder', {});
  871. },
  872. fetchSchedule: function (userId, startTime, endTime) {
  873. var scheduleData = {
  874. "schedulewatch": {
  875. "type": "1",
  876. "user": {
  877. "id": userId
  878. },
  879. "startTime": startTime,
  880. "endTime": endTime
  881. },
  882. "idx": "0",
  883. "sum": "100"
  884. };
  885. return dataService.customPOST(scheduleData, 'fetchDataList/schedulewatch', {});
  886. },
  887. queryRecieveSwitch: function (userId) {
  888. var handleSwitch = {
  889. "schedulewatch": {
  890. "type": "3",
  891. "user": {
  892. "id": userId
  893. }
  894. },
  895. "idx": "0",
  896. "sum": "10"
  897. };
  898. return dataService.customPOST(handleSwitch, 'fetchDataList/schedulewatch', {});
  899. },
  900. queryHandleoutSwitch: function (userId) {
  901. var handleSwitch = {
  902. "schedulewatch": {
  903. "type": "2",
  904. "user": {
  905. "id": userId
  906. }
  907. },
  908. "idx": "0",
  909. "sum": "10"
  910. };
  911. return dataService.customPOST(handleSwitch, 'fetchDataList/schedulewatch', {});
  912. },
  913. handleSchedule: function (data) {
  914. return dataService.customPOST(data, 'updData/schedulewatch', {});
  915. },
  916. querySwitch: function (filterData) {
  917. var switchData = {
  918. "scheduleorder": {
  919. "type": "4"
  920. },
  921. "idx": filterData.idx,
  922. "sum": filterData.sum
  923. };
  924. return dataService.customPOST(switchData, 'fetchDataList/scheduleorder', {});
  925. },
  926. query: function (filterData) {
  927. var switchData = {
  928. "scheduleorder": filterData.scheduleorder,
  929. "idx": filterData.idx,
  930. "sum": filterData.sum
  931. };
  932. return dataService.customPOST(switchData, 'fetchDataList/scheduleorder', {});
  933. }
  934. };
  935. }]);
  936. app.factory('SysinfoRestangular', function (Restangular) {
  937. return Restangular.withConfig(function (RestangularConfigurer) {
  938. RestangularConfigurer.setBaseUrl(serverIp + '/sysinfo/');
  939. });
  940. });
  941. app.factory('api_sysinfo', ['SysinfoRestangular', function (SysinfoRestangular) {
  942. var dataService = SysinfoRestangular.all("data");
  943. return {
  944. fetchDataList: function (model, data) {
  945. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  946. },
  947. addData: function (model, data) {
  948. return dataService.customPOST(data, 'addData/' + model, {});
  949. },
  950. getSerialnumber: function (type, model) {
  951. return dataService.customGET('getSerialnumber/' + type + '/' + model);
  952. }
  953. };
  954. }]);
  955. app.factory('ConfigureRestangular', function (Restangular) {
  956. return Restangular.withConfig(function (RestangularConfigurer) {
  957. RestangularConfigurer.setBaseUrl(serverIp);
  958. });
  959. });
  960. app.factory('api_configure_form', ['ConfigureRestangular', function (ConfigureRestangular) {
  961. var formService = ConfigureRestangular.all("form");
  962. // var formService = ConfigureRestangular.all("bpm/data");
  963. return {
  964. renderForm: function (formKey, userId, processInstanceId, id) {
  965. if (processInstanceId) {
  966. return formService.customGET('renderForm/' + formKey + "/" + processInstanceId + "/" + userId + "/" + id);
  967. } else {
  968. var ids = 0
  969. return formService.customGET('renderForm/' + formKey + "/000000/" + userId + "/" + ids);
  970. }
  971. },
  972. renderFormNoId: function (formKey, userId, processInstanceId) {
  973. return formService.customGET('renderForm/' + formKey + "/" + processInstanceId + "/" + userId);
  974. },
  975. renderList: function (formKey) {
  976. return formService.customGET('renderList/' + formKey);
  977. },
  978. renderTabForm: function (classify) {
  979. return formService.customGET('renderTabForm/' + classify);
  980. }
  981. };
  982. }]);
  983. // app.factory('ConfigureRestangular', function(Restangular) {
  984. // return Restangular.withConfig(function(RestangularConfigurer) {
  985. // RestangularConfigurer.setBaseUrl(serverIp + '/config/');
  986. // });
  987. // });
  988. app.factory('api_configure_data', ['ConfigureRestangular', function (ConfigureRestangular) {
  989. var dataService = ConfigureRestangular.all("data");
  990. return {
  991. fetchDataList: function (model, data) {
  992. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  993. },
  994. linkConfigure: function (model, data) {
  995. return dataService.customPOST(data, 'linkConfigure/' + model, {});
  996. },
  997. fetchDataById: function (model, id) {
  998. return dataService.customGET('fetchData/' + id + '/' + model);
  999. },
  1000. fetchData: function (model, data) {
  1001. return dataService.customPOST(data, 'fetchData/' + model, {});
  1002. },
  1003. addData: function (model, data) {
  1004. return dataService.customPOST(data, 'addData/' + model, {});
  1005. },
  1006. rmvData: function (model, data) {
  1007. return dataService.customPOST(data, 'rmvData/' + model, {});
  1008. },
  1009. updData: function (model, data) {
  1010. return dataService.customPOST(data, 'updData/' + model, {});
  1011. },
  1012. downModels: function (model, data) {
  1013. return dataService.one(model);
  1014. },
  1015. };
  1016. }]);
  1017. //知识库新接口--jry
  1018. app.factory('ZSKXJKJRY', function (Restangular) {
  1019. return Restangular.withConfig(function (RestangularConfigurer) {
  1020. RestangularConfigurer.setBaseUrl(serverIp + '/solution');
  1021. });
  1022. });
  1023. app.factory('api_zsk', ['ZSKXJKJRY', function (ZSKXJKJRY) {
  1024. //http://127.0.0.1:9004/services/ftpFile/monitor/bankTip/
  1025. var dataList = ZSKXJKJRY.all("fetchDataList");
  1026. var quote = ZSKXJKJRY.all('solutionQuote')
  1027. return {
  1028. jry_get_list: function (data, key) {
  1029. return dataList.customPOST(data, key, {});
  1030. },
  1031. // 知识库分类模糊搜索(暂无,哈哈)
  1032. searchSolutionType: function (data, key) {
  1033. return dataList.customPOST(key, data, {});
  1034. },
  1035. jry_form_getType: function (data, key) {
  1036. return dataList.customPOST({
  1037. "idx": 0,
  1038. "sum": 10000
  1039. }, "solutionType", {});
  1040. },
  1041. solutionData: function (data, key) {
  1042. return dataList.customPOST(data, key, {});
  1043. },
  1044. solutionQuote: function (id) {
  1045. return quote.customGET(id)
  1046. }
  1047. };
  1048. }]);
  1049. app.factory('baseUrl', function (Restangular) {
  1050. return Restangular.withConfig(function (RestangularConfigurer) {
  1051. RestangularConfigurer.setBaseUrl(serverIp + '/');
  1052. });
  1053. });
  1054. app.factory('up_down_file', ['baseUrl', function (baseUrl) {
  1055. var upDownFile = baseUrl.all("");
  1056. return {
  1057. //附件上传新接口
  1058. listAttachment: function (upUrl, bindType, bindId) {
  1059. return upDownFile.customGET(upUrl + '/' + bindType + '/' + bindId);
  1060. },
  1061. listAttachments: function (upUrl, bindType, bindId) {
  1062. return upDownFile.customGET(upUrl + '/' + bindType + '/' + bindId);
  1063. },
  1064. saveAttachments: function (upUrl, bindType, bindId) {
  1065. return upDownFile.one(upUrl + '/' + bindType + '/' + bindId);
  1066. },
  1067. downloadAttachment: function (upUrl, token) {
  1068. return upDownFile.one(upUrl + '/' + token);
  1069. },
  1070. removeAttachment: function (upUrl, token) {
  1071. return upDownFile.one(upUrl + '/' + token);
  1072. }
  1073. };
  1074. }]);
  1075. app.factory('SolutionRestangular', function (Restangular) {
  1076. return Restangular.withConfig(function (RestangularConfigurer) {
  1077. //RestangularConfigurer.setBaseUrl('http://168.166.203.41:9000/services');
  1078. RestangularConfigurer.setBaseUrl(serverIp + '/solution');
  1079. });
  1080. });
  1081. //知识库附件上传--jry
  1082. app.factory('Jry_SolutionRestangular', function (Restangular) {
  1083. return Restangular.withConfig(function (RestangularConfigurer) {
  1084. //RestangularConfigurer.setBaseUrl('http://168.166.203.41:9000/services');
  1085. RestangularConfigurer.setBaseUrl(serverIp + '/common');
  1086. });
  1087. });
  1088. app.factory('api_solution', ['SolutionRestangular', 'Jry_SolutionRestangular', function (SolutionRestangular, Jry_SolutionRestangular) {
  1089. var solutionService = SolutionRestangular.all("solution");
  1090. var jry_bj = SolutionRestangular.all("updData");
  1091. var jry_rm = SolutionRestangular.all("rmvData");
  1092. var jry_getLSJL = SolutionRestangular.all("fetchDataList");
  1093. var jry_sj = SolutionRestangular.all("getVisionNumber");
  1094. var jry_sjup = SolutionRestangular.all("");
  1095. var jry_FJuploda = Jry_SolutionRestangular.all("common");
  1096. var jry_solutionService = SolutionRestangular.all("addData");
  1097. var data = SolutionRestangular.all("solutionData");
  1098. var history = SolutionRestangular.all("solutionHistory");
  1099. var review = SolutionRestangular.all("solution_review");
  1100. var typeservice = SolutionRestangular.all("solutionType");
  1101. var groupservice = SolutionRestangular.all("solutionGroup");
  1102. return {
  1103. findSolutionByKeys: function (data) {
  1104. var key = data.key,
  1105. status = data.status || 0,
  1106. pageIndex = data.pageIndex || 0,
  1107. pageSum = data.pageSum,
  1108. treeIds = data.treeIds,
  1109. userId = data.userId;
  1110. if (angular.isUndefined(treeIds)) {
  1111. return solutionService.customGET('findSolutionByKeys/' + key + '/' + status + '/' + pageIndex + '/' + pageSum + '/' + userId);
  1112. } else {
  1113. return solutionService.customGET('findSolutionByKeys/' + key + '/' + status + '/' + pageIndex + '/' + pageSum + '/' + treeIds + '/' + userId);
  1114. }
  1115. },
  1116. // searcher: function(data){
  1117. // var queryBuilder=data.key, indexname=data.treeIds, type=data.userId;
  1118. // return searchservice.customGET('searcher/' + queryBuilder + '/' + indexname + '/' + type );
  1119. // },
  1120. addSolution: function () {
  1121. return solutionService.one('add');
  1122. },
  1123. addFile: function (data) {
  1124. return solutionService.customPOST(data, 'addSolution', {});
  1125. },
  1126. jry_addFile: function (data) {
  1127. return jry_solutionService.customPOST(data, 'solution', {});
  1128. },
  1129. addData: function (model, data) {
  1130. return jry_solutionService.customPOST(data, model, {});
  1131. },
  1132. addModel: function (type, data) {
  1133. return solutionService.customPOST(data, 'addModel/' + type, {});
  1134. },
  1135. updModel: function (type, data) {
  1136. return solutionService.customPOST(data, 'updModel/' + type, {});
  1137. },
  1138. rmModels: function (id, data) {
  1139. return solutionService.customPOST(data, 'rmModels/' + id, {});
  1140. },
  1141. update: function () {
  1142. return solutionService.one('update');
  1143. },
  1144. upload: function () {
  1145. return solutionService.one('upload');
  1146. },
  1147. jry_upload: function (LCid) {
  1148. return jry_FJuploda.one('uploadAttachment/solution/' + LCid);
  1149. },
  1150. jry_upload1: function (LCid) {
  1151. return jry_FJuploda.one('uploadAttachment/knowledge/' + LCid);
  1152. },
  1153. uploadResponseUri: function () {
  1154. return solutionService.one('/');
  1155. },
  1156. addNotFile: function (data) {
  1157. return solutionService.customPOST(data, 'addNotFile', {});
  1158. },
  1159. // export: function(data) {
  1160. // return solutionService.customGET(data, 'export', {});
  1161. // },
  1162. export: function (data) {
  1163. return solutionService.one('export');
  1164. },
  1165. updateNotFile: function (data) {
  1166. return solutionService.customPOST(data, 'updateNotFile', {});
  1167. },
  1168. updateSolution: function (data) {
  1169. return solutionService.customPOST(data, 'updateSolution', {});
  1170. },
  1171. jry_updateSolution: function (data) {
  1172. return jry_bj.customPOST(data, 'solution', {});
  1173. },
  1174. updData: function (model, data) {
  1175. return jry_bj.customPOST(data, model, {});
  1176. },
  1177. rmvData: function (model, data) {
  1178. return jry_rm.customPOST(data, model, {});
  1179. },
  1180. jry_leveSolution: function (data) {
  1181. return jry_sjup.customPOST(data, 'upgrade', {});
  1182. },
  1183. jry_leveVision: function (id) {
  1184. return jry_sj.customGET(id);
  1185. },
  1186. jry_getHistory: function (data) {
  1187. return jry_getLSJL.customPOST(data, 'solution', {});
  1188. },
  1189. wt_type: function (data) {
  1190. return jry_getLSJL.customPOST(data, 'solutionType', {});
  1191. },
  1192. searchSolutionByKey: function (key, id) {
  1193. return solutionService.customGET('searchSolutionByKey/' + key + '/' + id);
  1194. },
  1195. findSolutionById: function (id) {
  1196. return solutionService.customGET('check/' + id);
  1197. },
  1198. findSolutions: function (id) {
  1199. return solutionService.customGET('check2/' + id);
  1200. },
  1201. jry_fetchDataList: function (model, data) {
  1202. return jry_sjup.customPOST(data, 'fetchDataList/' + model, {});
  1203. },
  1204. fetchDataList: function (model, data) {
  1205. return solutionService.customPOST(data, 'fetchDataList/' + model, {});
  1206. },
  1207. findSolutionDataByDateById: function (ndate, sid) {
  1208. return data.customGET('findSolutionDataByDateById/' + ndate + '/' + sid);
  1209. },
  1210. findSolutionTypeActions: function (userId) {
  1211. return typeservice.customGET('findSolutionTypeActions/' + userId);
  1212. },
  1213. findSolutionTypesUser: function (data) {
  1214. return typeservice.customPOST(data, 'findSolutionTypesUser', {});
  1215. },
  1216. addTypeUserAll: function (data) {
  1217. return typeservice.customPOST(data, 'addTypeUserAll', {});
  1218. },
  1219. hotRanking: function (num) {
  1220. return solutionService.customGET('hotRanking/' + num);
  1221. },
  1222. scoreRanking: function (num) {
  1223. return solutionService.customGET('scoreRanking/' + num);
  1224. },
  1225. fetchBBSSolutions: function (pageIndex, pageSum, sequence, userId) {
  1226. return solutionService.customGET('communicationSolutions/' + pageIndex + '/' + pageSum + '/' + sequence + '/' + userId);
  1227. },
  1228. queryBBSSolutions: function (pageIndex, pageSum, sequence, userId, key) {
  1229. return solutionService.customGET('communicationSolutions/' + pageIndex + '/' + pageSum + '/' + sequence + '/' + userId + '/' + key);
  1230. },
  1231. updateSolutionStatus: function (data) {
  1232. return solutionService.customPOST(data, 'updateSolutionStatus', {});
  1233. },
  1234. getSolutionNumber: function () {
  1235. return solutionService.customGET('getSolutionNumber');
  1236. },
  1237. addSolutionType: function (data) {
  1238. return typeservice.customPOST(data, 'add', {});
  1239. },
  1240. updateSolutionType: function (data) {
  1241. return typeservice.customPOST(data, 'update', {});
  1242. },
  1243. removeSolutionType: function (id) {
  1244. return typeservice.customGET('delete/' + id);
  1245. },
  1246. getSolutionType: function (id) {
  1247. return typeservice.customGET('' + id);
  1248. },
  1249. getTree: function (typeId, groupId, flag) {
  1250. return typeservice.customGET('getTree/' + typeId + '/' + groupId + '/' + flag);
  1251. },
  1252. checkCommentScoreByUserIds: function (userId, id) {
  1253. return review.customGET('findCommentScore/' + userId + '/' + id);
  1254. },
  1255. addSolutionReview: function (data) {
  1256. return solutionService.customPOST(data, 'addScore', {});
  1257. },
  1258. findSolutionReviewById: function (userid, id, pageIndex, pageSum) {
  1259. return solutionService.customGET('findSolutionReviewByType/' + userid + '/' + id + '/' + pageIndex + '/' + pageSum);
  1260. },
  1261. saveAllUserAuth: function (solutionId, flag) {
  1262. return solutionService.customGET('saveAllUserTrees/' + solutionId + '/' + flag);
  1263. },
  1264. updatermvSolutionType: function (typeId, groupId, userIds, flag) {
  1265. return typeservice.customGET('delOrUpdateTrees/' + typeId + '/' + groupId + '/' + userIds + '/' + flag);
  1266. },
  1267. findSolutionGroup: function (id) {
  1268. return groupservice.customGET('findSolutionGroup/' + id);
  1269. },
  1270. saveSolutionGroup: function (id, data) {
  1271. return groupservice.customPOST(data, 'saveSolutionGroup/' + id);
  1272. },
  1273. // getSolutionDowpath: function(id){
  1274. // return solutionService.one('download/'+id);
  1275. // }
  1276. getSolutionDowpath: function (attachmentId) {
  1277. return solutionService.one('download/' + attachmentId + '/file');
  1278. }
  1279. // getSolutionDowpath: function(attachmentId){
  1280. // return solutionService.customGET('download/' + attachmentId);
  1281. // }
  1282. };
  1283. }]);
  1284. // 业务系统
  1285. app.factory('CMDBRestangular2', function (Restangular) {
  1286. return Restangular.withConfig(function (RestangularConfigurer) {
  1287. RestangularConfigurer.setBaseUrl(serverIp + '/cmdb');
  1288. });
  1289. });
  1290. // 业务系统
  1291. app.factory('api_cmdb2', ['CMDBRestangular2', function (CMDBRestangular) {
  1292. var ywxtService = CMDBRestangular.all("operationSystem");
  1293. var ywxtService1 = CMDBRestangular.all("");
  1294. return {
  1295. // 导入模板
  1296. importDataTpl: function (type, data) {
  1297. return ywxtService1.one(type, data, {});
  1298. },
  1299. // 列表数据
  1300. fetchDataList: function (pdKey, data) {
  1301. return ywxtService.customPOST(data, 'fetchDataList/' + pdKey, {})
  1302. },
  1303. // 列表数据
  1304. fetchDataList1: function (pdKey, data) {
  1305. return ywxtService1.customPOST(data, 'fetchDataList/' + pdKey, {})
  1306. },
  1307. // 管理单位
  1308. management_unit: function () {
  1309. return ywxtService.customGET('queryManagementUnit', {});
  1310. },
  1311. // 新增
  1312. add_preservation: function (til, data) {
  1313. return ywxtService.customPOST(data, 'addModel/' + til, {})
  1314. },
  1315. // 新增
  1316. add_preservation1: function (til, data) {
  1317. return ywxtService1.customPOST(data, 'addData/' + til, {})
  1318. },
  1319. // 删除
  1320. remov: function (til, data) {
  1321. return ywxtService.customPOST(data, 'rmModels/' + til, {})
  1322. },
  1323. // 删除
  1324. remov1: function (til, data) {
  1325. return ywxtService1.customPOST(data, 'rmModels/' + til, {})
  1326. },
  1327. // 导出数据
  1328. exportData: function (type, data) {
  1329. return ywxtService.one(type, data, {});
  1330. },
  1331. // 导出数据
  1332. exportData1: function (type, data) {
  1333. return ywxtService1.one(type, data, {});
  1334. },
  1335. // 编辑
  1336. edit_preservation: function (til, data) {
  1337. return ywxtService.customPOST(data, 'updModel/' + til, {})
  1338. },
  1339. // 编辑
  1340. edit_preservation1: function (til, data) {
  1341. return ywxtService1.customPOST(data, 'updData/' + til, {})
  1342. },
  1343. // 修改管理单位
  1344. upd_preservation: function (til, data) {
  1345. return ywxtService1.customPOST(data, 'updData/' + til, {})
  1346. },
  1347. // 删除管理单位
  1348. del_preservation: function (til, data) {
  1349. return ywxtService.customPOST(data, 'rmModels/' + til, {})
  1350. },
  1351. }
  1352. }]);
  1353. // 耗材
  1354. app.factory('CMDBRestangular3', function (Restangular) {
  1355. return Restangular.withConfig(function (RestangularConfigurer) {
  1356. RestangularConfigurer.setBaseUrl(serverIp + '/bpm');
  1357. });
  1358. });
  1359. // 耗材
  1360. app.factory('api_cmdb3', ['CMDBRestangular3', function (CMDBRestangular) {
  1361. var hcService = CMDBRestangular.all("data");
  1362. return {
  1363. // 列表数据
  1364. fetchDataList: function (pdKey, data) {
  1365. return hcService.customPOST(data, 'fetchDataList/' + pdKey, {})
  1366. },
  1367. //编辑保存
  1368. preservation: function (pdKey, data) {
  1369. return hcService.customPOST(data, 'updData/' + pdKey, {})
  1370. },
  1371. // 导出数据
  1372. exportData: function (type, data) {
  1373. return hcService.one(type, data, {});
  1374. },
  1375. // 关联流程
  1376. relation: function (pdKey, data) {
  1377. return hcService.customPOST(data, 'getListBySign/' + pdKey, {})
  1378. }
  1379. }
  1380. }]);
  1381. // 耗材查询分类
  1382. app.factory('CMDBRestangular4', function (Restangular) {
  1383. return Restangular.withConfig(function (RestangularConfigurer) {
  1384. RestangularConfigurer.setBaseUrl(serverIp + '/common');
  1385. });
  1386. })
  1387. // 耗材查询分类
  1388. app.factory('api_cmdb4', ['CMDBRestangular4', function (CMDBRestangular) {
  1389. var hcService = CMDBRestangular.all("common");
  1390. return {
  1391. // 耗材查询分类
  1392. fetchDataList: function (data) {
  1393. return hcService.customPOST(data, 'getDictionary', {})
  1394. },
  1395. // 耗材分类新增
  1396. addDictionary: function (data) {
  1397. return hcService.customPOST(data, 'addDictionary', {})
  1398. },
  1399. // 耗材分类删除修改
  1400. upDictionary: function (data) {
  1401. return hcService.customPOST(data, 'upDictionary', {})
  1402. },
  1403. }
  1404. }]);
  1405. app.factory('CMDBRestangular', function (Restangular) {
  1406. return Restangular.withConfig(function (RestangularConfigurer) {
  1407. RestangularConfigurer.setBaseUrl(serverIp + '/cmdb/');
  1408. });
  1409. });
  1410. app.factory('api_cmdb', ['CMDBRestangular', function (CMDBRestangular) {
  1411. var ciService = CMDBRestangular.all("ci");
  1412. var uuidService = CMDBRestangular.all("uuid");
  1413. var edgeService = CMDBRestangular.all("edge");
  1414. var traversal = CMDBRestangular.all("traversal");
  1415. var downloadService = CMDBRestangular.all("download");
  1416. var exportService = CMDBRestangular.all("export");
  1417. var importService = CMDBRestangular.all("import");
  1418. var exportModelService = CMDBRestangular.all("exportModel");
  1419. var importDataService = CMDBRestangular.all("importData");
  1420. var exportDataService = CMDBRestangular.all("exportData");
  1421. var searchService = CMDBRestangular.all("search");
  1422. function serializeData(data) {
  1423. // If this is not an object, defer to native stringification.
  1424. if (!angular.isObject(data)) {
  1425. return ((data == null) ? "" : data.toString());
  1426. }
  1427. var buffer = [];
  1428. // Serialize each key in the object.
  1429. for (var name in data) {
  1430. if (!data.hasOwnProperty(name)) {
  1431. continue;
  1432. }
  1433. var value = data[name];
  1434. buffer.push(
  1435. encodeURIComponent(name) + "=" + encodeURIComponent((value == null) ? "" : value)
  1436. );
  1437. }
  1438. // Serialize the buffer and clean it up for transportation.
  1439. var source = buffer.join("&").replace(/%20/g, "+");
  1440. return (source);
  1441. }
  1442. return {
  1443. create: function (data) {
  1444. return ciService.customPOST(data, '', {});
  1445. },
  1446. importData: function () {
  1447. return importDataService.one('/nodes');
  1448. },
  1449. put: function (data, id) {
  1450. return ciService.customPUT(data, id, {});
  1451. },
  1452. remove: function (id) {
  1453. return ciService.customDELETE(id);
  1454. },
  1455. removeByUUId: function (uuid) {
  1456. return ciService.customDELETE('uuid/' + id, {}, {
  1457. 'Content-Type': 'application/json'
  1458. });
  1459. },
  1460. removeRefById: function (id) {
  1461. return ciService.customDELETE(id + '/ref');
  1462. },
  1463. find: function (id) {
  1464. return ciService.customGET(id);
  1465. },
  1466. searchkey: function (type, key, idx, sum) {
  1467. return searchService.customGET(type + '/' + key + '/' + idx + '/' + sum);
  1468. },
  1469. findByUUId: function (uuid) {
  1470. return ciService.customGET('?uuid=' + uuid);
  1471. },
  1472. query: function (data) {
  1473. return ciService.customGET('query', data);
  1474. },
  1475. findRefById: function (id) {
  1476. return ciService.customGET(id + '/refs');
  1477. },
  1478. finduuid: function (type, model) {
  1479. return uuidService.customGET(type + '/' + model);
  1480. },
  1481. types: function () {
  1482. return CMDBRestangular.customGET('types');
  1483. },
  1484. createRef: function (data) {
  1485. return edgeService.customPOST(data, '', {});
  1486. },
  1487. putRef: function (data, id) {
  1488. return edgeService.customPUT(data, '' + id, {});
  1489. },
  1490. removeRef: function (id) {
  1491. return edgeService.customDELETE(id, {}, {
  1492. 'Content-Type': 'application/json'
  1493. });
  1494. },
  1495. traversal: function (uuid) {
  1496. return traversal.customGET(uuid);
  1497. },
  1498. traversalRel: function (uuid, relation) {
  1499. return traversal.customGET(uuid + '/' + relation + '/' + 'none');
  1500. },
  1501. export: function (label) {
  1502. return exportService.customGET('nodes/' + label);
  1503. },
  1504. import: function () {
  1505. return importService.one('/nodes');
  1506. },
  1507. download: function (label) {
  1508. return downloadService.one('/label');
  1509. },
  1510. exportData: function (type, model) {
  1511. return exportDataService.one(model + '/' + type);
  1512. },
  1513. downModels: function (type, model) {
  1514. return exportModelService.one(model + '/' + type);
  1515. }
  1516. };
  1517. }]);
  1518. app.factory('CMDBNEWRestangular', function (Restangular) {
  1519. return Restangular.withConfig(function (RestangularConfigurer) {
  1520. RestangularConfigurer.setBaseUrl(serverIp + '/cmdb/');
  1521. });
  1522. });
  1523. app.factory('api_cmdb_new', ['CMDBNEWRestangular', function (CMDBNEWRestangular) {
  1524. var assetService = CMDBNEWRestangular.all("asset");
  1525. var operationSystemService = CMDBNEWRestangular.all('operationSystem')
  1526. return {
  1527. checkFile: function (model) {
  1528. return assetService.one('/checkFile/' + model);
  1529. },
  1530. getApplicationId: function (type) {
  1531. return assetService.customGET('getApplicationId/' + type);
  1532. },
  1533. fetchDataList: function (model, data) {
  1534. return operationSystemService.customPOST(data, 'fetchDataList/' + model, {});
  1535. },
  1536. fetchDataList: function (model, data) {
  1537. return operationSystemService.customPOST(data, 'fetchDataList/' + model, {});
  1538. }
  1539. }
  1540. }]);
  1541. app.factory('MonitorRestangular', function (Restangular) {
  1542. return Restangular.withConfig(function (RestangularConfigurer) {
  1543. RestangularConfigurer.setBaseUrl(serverIp + ':9004/services');
  1544. });
  1545. });
  1546. app.factory('api_monitor', ['MonitorRestangular', function (MonitorRestangular) {
  1547. //http://127.0.0.1:9004/services/ftpFile/monitor/bankTip/
  1548. var process = MonitorRestangular.all("ftpFile/monitor");
  1549. return {
  1550. bankTip: function (id) {
  1551. return process.customGET('bankTip/' + id);
  1552. },
  1553. list: function () {
  1554. return process.customGET('list/1000');
  1555. },
  1556. devList: function (id) {
  1557. return process.customGET('devList/' + id);
  1558. },
  1559. cpuList: function () {
  1560. return process.customGET('cpuList/10');
  1561. },
  1562. memList: function () {
  1563. return process.customGET('memList/10');
  1564. },
  1565. storageList: function () {
  1566. return process.customGET('storageList/10');
  1567. },
  1568. transData: function () {
  1569. return process.customGET('transData/5');
  1570. },
  1571. banklist: function () {
  1572. return process.customGET('banklist');
  1573. },
  1574. app: function (id) {
  1575. return process.customGET('app/' + id);
  1576. },
  1577. beita: function (id) {
  1578. return process.customGET('beita/' + id);
  1579. },
  1580. gongji: function (id) {
  1581. return process.customGET('gongji/' + id);
  1582. }
  1583. };
  1584. }]);
  1585. /**
  1586. * 报表
  1587. */
  1588. app.factory('NxreportRestangular', function (Restangular) {
  1589. return Restangular.withConfig(function (RestangularConfigurer) {
  1590. RestangularConfigurer.setBaseUrl(serverIp);
  1591. });
  1592. });
  1593. app.factory('api_report_nx', ['NxreportRestangular', 'Restangular', function (NxreportRestangular, Restangular) {
  1594. var reportService = NxreportRestangular.all("reportPoc");
  1595. return {
  1596. fetchDataList: function (model, data) { //事件分类
  1597. return reportService.customPOST(data, 'fetchDataList/' + model, {})
  1598. },
  1599. // getPdf: function(data) { //事件分类
  1600. // return reportService.customPOST(data, 'getPdf', {})
  1601. // },
  1602. getPdf: function (model) {
  1603. // return reportService.one('getPdf', {});
  1604. return reportService.one('getPdf', model, {});
  1605. },
  1606. };
  1607. }]);
  1608. // app.factory('NxreportRestangular', function(Restangular) {
  1609. // return Restangular.withConfig(function(RestangularConfigurer) {
  1610. // RestangularConfigurer.setBaseUrl(serverIp);
  1611. // });
  1612. // });
  1613. // app.factory('api_report_nx', ['NxreportRestangular', function(NxreportRestangular) {
  1614. // var nxreport = NxreportRestangular.all("reportPoc");
  1615. // return {
  1616. // fetchDataList: function(data, rptId) {
  1617. // return nxreport.customPOST(data, 'fetchDataList/incidentClassify', {});
  1618. // }
  1619. // }
  1620. // }]);
  1621. app.factory('ReportRestangular', function (Restangular) {
  1622. return Restangular.withConfig(function (RestangularConfigurer) {
  1623. //RestangularConfigurer.setBaseUrl('http://127.0.0.1:9005/api/cmdb/');
  1624. RestangularConfigurer.setBaseUrl(reportIp + ':8080/saiku/rest');
  1625. // RestangularConfigurer.setBaseUrl(serverIp + ':8888/saiku/rest');
  1626. //saiku/rest/saiku/api/query/execute/
  1627. });
  1628. });
  1629. app.factory('api_report', ['ReportRestangular', 'Restangular', function (MonitorRestangular, Restangular) {
  1630. // var reportService = MonitorRestangular.all("saiku/api");
  1631. var authService = MonitorRestangular.one("saiku/session");
  1632. return {
  1633. getLicenseKey: function () {
  1634. // return Restangular.one('assets/').customGET('api/reportToken.js');
  1635. },
  1636. // auth: function(){
  1637. // return authService.customPOST('username=admin&password=admin&language=zh'
  1638. // ,'', {}, {'Content-Type': 'application/x-www-form-urlencoded'});
  1639. // },
  1640. // session: function(){
  1641. // return authService.customGET('');
  1642. // },
  1643. list: function () {
  1644. return reportService.customGET('repository?type=saiku');
  1645. /**
  1646. /saiku/api/repository
  1647. path: /homes/home:admin/itsm_reports
  1648. */
  1649. },
  1650. getMdx: function (path, uuid) {
  1651. var rdata = 'file=' + path + '&formatter=flattened&language=zh';
  1652. return reportService.customPOST(rdata, 'query/' + uuid, {}, {
  1653. 'Content-Type': 'application/x-www-form-urlencoded'
  1654. });
  1655. },
  1656. execute: function (data) {
  1657. return reportService.customPOST(data, 'query/execute', {}, {
  1658. 'Accept': 'application/json, text/javascript, */*'
  1659. });
  1660. },
  1661. exportData: function (reportView, uuid, reportfileName) {
  1662. return reportService.one('query/rest/export/xls/?exportname=' + reportfileName + 'xls');
  1663. }
  1664. };
  1665. }]);
  1666. // 首页仪表盘
  1667. app.factory('ReportnewRestangular', function (Restangular) {
  1668. return Restangular.withConfig(function (RestangularConfigurer) {
  1669. RestangularConfigurer.setBaseUrl(serverIp + '/report');
  1670. });
  1671. })
  1672. // 首页仪表盘
  1673. app.factory('api_newreport', ['ReportnewRestangular', function (ReportnewRestangular) {
  1674. var hcService = ReportnewRestangular.all("data");
  1675. return {
  1676. // 事件解决率
  1677. fetchDataList: function (model, data) {
  1678. return hcService.customPOST(data, 'fetchDataList/' + model, {})
  1679. },
  1680. // 首页仪表盘
  1681. addDictionary: function (data) {
  1682. return hcService.customPOST(data, 'addDictionary', {})
  1683. },
  1684. // 首页仪表盘
  1685. upDictionary: function (data) {
  1686. return hcService.customPOST(data, 'upDictionary', {})
  1687. },
  1688. }
  1689. }]);
  1690. // 月度任务导出
  1691. app.factory('TaskRestangular', function (Restangular) {
  1692. return Restangular.withConfig(function (RestangularConfigurer) {
  1693. // RestangularConfigurer.setBaseUrl("http://168.166.3.41"+':9008/api/');
  1694. RestangularConfigurer.setBaseUrl(serverIp + '/task');
  1695. });
  1696. });
  1697. app.factory('api_task_export', ['TaskRestangular', function (TaskRestangular) {
  1698. var dataService = TaskRestangular.all("data");
  1699. return {
  1700. taskExport: function (model, dataId) {
  1701. return dataService.one(model + '/' + dataId);
  1702. },
  1703. // 任务清单
  1704. yearListSee: function (year, month) {
  1705. return dataService.customGET('previewTask/' + year + '/' + month);
  1706. },
  1707. // 任务清单导出
  1708. yearListExport: function (year, month) {
  1709. return dataService.one('exportTask' + '/' + year + '/' + month);
  1710. }
  1711. };
  1712. }]);
  1713. // 文档管理接口
  1714. app.factory('DocRestangular', function (Restangular) {
  1715. return Restangular.withConfig(function (RestangularConfigurer) {
  1716. // RestangularConfigurer.setBaseUrl("http://168.166.3.41"+':9008/api/');
  1717. RestangularConfigurer.setBaseUrl(serverIp + '/doc');
  1718. });
  1719. });
  1720. app.factory('api_doc_data', ['DocRestangular', function (DocRestangular) {
  1721. var dataService = DocRestangular.all("data");
  1722. return {
  1723. // 删除历史版本
  1724. delileVersion: function (data) {
  1725. return dataService.customPOST(data, 'delileVersion', {});
  1726. },
  1727. // 引入文件
  1728. insertIndexFile: function (data) {
  1729. return dataService.customPOST(data, 'insertIndexFile', {});
  1730. },
  1731. // 搜索统一接口
  1732. selectContent: function (data) {
  1733. return dataService.customPOST(data, 'selectContent', {});
  1734. },
  1735. // 文件历史读取
  1736. fileVersion: function (data) {
  1737. return dataService.customPOST(data, 'fileVersion', {});
  1738. },
  1739. // 文件下载
  1740. download: function (data) {
  1741. return dataService.one('downloadFile')
  1742. },
  1743. // 文件更新
  1744. newDoc: function (fileId) {
  1745. return dataService.one('updateFile')
  1746. },
  1747. // 文件导入
  1748. uploadDoc: function (docId) {
  1749. return dataService.one('importFile', docId)
  1750. },
  1751. // 文件导入附带上传者id
  1752. jry_uploadDoc: function (docId, userId) {
  1753. return dataService.one('importFile' + '/' + docId + '/' + userId)
  1754. },
  1755. //文件更换目录
  1756. jry_filesChange: function (id, data) {
  1757. return dataService.customPOST(data, 'refolder/' + id, {});
  1758. },
  1759. // 索引更换目录
  1760. jry_indexesChange: function (oldId, newId, data) {
  1761. return dataService.customPOST(data, 'refolder/' + oldId + '/' + newId, {});
  1762. },
  1763. fetchDataList: function (model, data) {
  1764. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  1765. },
  1766. data: function (model, data) {
  1767. return dataService.customPOST(data, model, {});
  1768. },
  1769. };
  1770. }]);
  1771. // 消息通知管理
  1772. app.factory('notificationApi', function (Restangular) {
  1773. return Restangular.withConfig(function (RestangularConfigurer) {
  1774. RestangularConfigurer.setBaseUrl(serverIp + '/bpm');
  1775. });
  1776. });
  1777. app.factory('api_notification_data', ['notificationApi', function (notificationApi) {
  1778. var dataService = notificationApi.all("data");
  1779. return {
  1780. // 获取消息通知列表
  1781. fetchDataList: function (data) {
  1782. return dataService.customPOST(data, 'fetchDataList/messageManager');
  1783. },
  1784. // 修改消息通知
  1785. updData: function (data) {
  1786. return dataService.customPOST(data, 'updData/messageManager');
  1787. }
  1788. };
  1789. }]);
  1790. // 事件报表-seimin
  1791. app.factory('eventFormApi', function (Restangular) {
  1792. return Restangular.withConfig(function (RestangularConfigurer) {
  1793. RestangularConfigurer.setBaseUrl(serverIp + '/report');
  1794. });
  1795. });
  1796. app.factory('api_event_form', ['eventFormApi', function (eventFormApi) {
  1797. var dataService = eventFormApi.all("data");
  1798. return {
  1799. // 事件总数
  1800. fetchSjzsList: function (data) {
  1801. return dataService.customPOST(data, 'mdv2_incident_repot_sum');
  1802. },
  1803. // 事件类型
  1804. fetchSjlxList: function (data) {
  1805. return dataService.customPOST(data, 'mdv2_incident_repot_type');
  1806. },
  1807. // 处理人/组
  1808. fetchClrzList: function (data) {
  1809. return dataService.customPOST(data, 'mdv2_incident_repot_handle');
  1810. },
  1811. // 区域地点
  1812. fetchQyddList: function (data) {
  1813. return dataService.customPOST(data, 'mdv2_incident_repot_area_place');
  1814. },
  1815. // 事件来源
  1816. fetchSjlyList: function (data) {
  1817. return dataService.customPOST(data, 'mdv2_incident_repot_source');
  1818. },
  1819. // 查询事件总数(单个页面只有事件数量)
  1820. getSjNum: function (data) {
  1821. return dataService.customPOST(data, 'mdv2_incident_sum');
  1822. },
  1823. // 综合统计
  1824. fetchZhtjList: function (data) {
  1825. return dataService.customPOST(data, 'mdv2_service_repot_all');
  1826. },
  1827. // 电话统计
  1828. fetchDhtjList: function (data) {
  1829. return dataService.customPOST(data, 'mdv2_service_repot_phone');
  1830. },
  1831. // 微信/WEB统计
  1832. fetchWebList: function (data) {
  1833. return dataService.customPOST(data, 'mdv2_service_repot_wechat_web');
  1834. },
  1835. // 电话留言统计
  1836. fetchDhlytjList: function (data) {
  1837. return dataService.customPOST(data, 'mdv2_service_repot_msg');
  1838. }
  1839. };
  1840. }]);
  1841. // 登录后判断版本-seimin
  1842. app.factory('isCategoryApi', function (Restangular) {
  1843. return Restangular.withConfig(function (RestangularConfigurer) {
  1844. RestangularConfigurer.setBaseUrl(serverIp + '/sysinfo');
  1845. });
  1846. });
  1847. app.factory('api_is_category', ['isCategoryApi', function (isCategoryApi) {
  1848. var dataService = isCategoryApi.all("data");
  1849. return {
  1850. //判断处理人、处理科室seimin
  1851. isCategory: function (data) {
  1852. return dataService.customPOST(data, 'fetchDataList/systemConfiguration');
  1853. }
  1854. };
  1855. }]);
  1856. // 搜索科室列表-seimin
  1857. app.factory('searchKs', function (Restangular) {
  1858. return Restangular.withConfig(function (RestangularConfigurer) {
  1859. RestangularConfigurer.setBaseUrl(serverIp + '/user');
  1860. });
  1861. });
  1862. app.factory('api_search_ks', ['searchKs', function (searchKs) {
  1863. var dataService = searchKs.all("data");
  1864. return {
  1865. //获取科室列表
  1866. getKsList: function (data) {
  1867. return dataService.customPOST(data, 'fetchDataList/department');
  1868. }
  1869. };
  1870. }]);
  1871. // 搜索故障地点seimin
  1872. app.factory('searchArea', function (Restangular) {
  1873. return Restangular.withConfig(function (RestangularConfigurer) {
  1874. RestangularConfigurer.setBaseUrl(serverIp + '/apply');
  1875. });
  1876. });
  1877. app.factory('api_search_area', ['searchArea', function (searchArea) {
  1878. var dataService = searchArea.all("bpm");
  1879. return {
  1880. //获取故障地点
  1881. getAreaList: function (data) {
  1882. return dataService.customPOST(data, 'searchFaultLocation');
  1883. }
  1884. };
  1885. }]);
  1886. // 微信配置查询接口seimin
  1887. app.factory('wechatConfig', function (Restangular) {
  1888. return Restangular.withConfig(function (RestangularConfigurer) {
  1889. RestangularConfigurer.setBaseUrl(serverIp + '/wechat');
  1890. });
  1891. });
  1892. app.factory('api_wechat_operate', ['wechatConfig', function (wechatConfig) {
  1893. var dataService = wechatConfig.all("data");
  1894. return {
  1895. //获取微信配置信息
  1896. getWechatList: function (data) {
  1897. return dataService.customPOST(data, 'fetchDataList/wechatConfig');
  1898. },
  1899. //修改微信配置
  1900. postWxList: function (data) {
  1901. return dataService.customPOST(data, 'addData/wechatConfig');
  1902. }
  1903. };
  1904. }]);
  1905. // 微信配置获取角色seimin
  1906. app.factory('wxRole', function (Restangular) {
  1907. return Restangular.withConfig(function (RestangularConfigurer) {
  1908. RestangularConfigurer.setBaseUrl(serverIp + '/user');
  1909. });
  1910. });
  1911. app.factory('api_wx_role', ['wxRole', function (wxRole) {
  1912. var dataService = wxRole.all("data");
  1913. return {
  1914. //获取微信配置获取角色
  1915. getWxRole: function (data) {
  1916. return dataService.customPOST(data, 'fetchDataList/role');
  1917. }
  1918. };
  1919. }]);
  1920. // CMDB打印
  1921. app.factory('cmdbPrit', function (Restangular) {
  1922. return Restangular.withConfig(function (RestangularConfigurer) {
  1923. RestangularConfigurer.setBaseUrl(serverIp + '/cmdb');
  1924. });
  1925. });
  1926. app.factory('api_cmdb_print', ['cmdbPrit', function (cmdbPrit) {
  1927. var dataService = cmdbPrit.all("ci");
  1928. return {
  1929. //CMDB打印
  1930. getCmdbPrit: function (data) {
  1931. return dataService.customGET('qrcode/' + data);
  1932. }
  1933. };
  1934. }]);