main.js 85 KB

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