main.js 78 KB

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