main.js 85 KB

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