main.js 85 KB

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