main.js 84 KB

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