main.js 85 KB

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