main.js 77 KB

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