main.js 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170
  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('api_statistic', ['BpmRestangular', function (BpmRestangular) {
  632. var statistic = BpmRestangular.all("statistic");
  633. var table = BpmRestangular.all("data");
  634. return {
  635. query: function (data, rptId) {
  636. return statistic.customPOST(data, 'unidimensional/' + rptId, {});
  637. },
  638. // exportData: function(reportView, uuid, reportfileName){
  639. // return reportService.one('query/rest/export/xls/?exportname='+reportfileName+'xls');
  640. // }
  641. getTask: function (userid, idx, sum) {
  642. return table.customGET('getTask/' + userid + '/' + idx + '/' + sum);
  643. },
  644. unidimensionalExport: function (rptId) {
  645. return statistic.one('unidimensionalExport/' + rptId);
  646. },
  647. tableData: function (data, rptId) {
  648. return table.customPOST(data, 'fetchDataList/' + rptId, {});
  649. }
  650. }
  651. }]);
  652. app.factory('api_bpm', ['BpmRestangular', function (BpmRestangular) {
  653. var process = BpmRestangular.all("process");
  654. var postfix = BpmRestangular.all("bpm");
  655. var getData = BpmRestangular.all('data');
  656. var InspectionProcessActual = BpmRestangular.all('InspectionProcessActual');
  657. return {
  658. //巡检列表批量指派
  659. assign: function (data) {
  660. return InspectionProcessActual.customPOST(data, 'batchAssign', {});
  661. },
  662. //获取巡检报告
  663. report: function (data) {
  664. return InspectionProcessActual.customPOST(data, 'report', {});
  665. },
  666. deploy: function (data) {
  667. return process.customPOST(data, 're/model/deploy', {});
  668. },
  669. list: function () {
  670. return process.customGET('re/model/list');
  671. },
  672. modelsource: function (pdId) {
  673. return process.customGET('re/model/' + pdId + '/source');
  674. },
  675. // savemodel: function(pdId, data) {
  676. // return process.customPOST(data, 're/model/' + pdId + '/save', {});
  677. // },
  678. savemodel: function (pdId, data) {
  679. return process.customPOST(data, 'saveModel/' + pdId, {});
  680. },
  681. removemodel: function (modelId) {
  682. return process.customGET('re/model/' + modelId + '/remove');
  683. },
  684. upgrade: function (data, taskId, userId, model) {
  685. return postfix.customPOST(data, model + '/' + taskId + '/' + userId, {});
  686. // return postfix.customPOST(id);
  687. },
  688. fetchDataList: function (model, data) {
  689. return getData.customPOST(data, 'fetchDataList/' + model, {});
  690. },
  691. addData: function (model, data) {
  692. return getData.customPOST(data, 'addData/' + model, {});
  693. },
  694. updData: function (model, data) {
  695. return getData.customPOST(data, 'updData/' + model, {});
  696. },
  697. //判断事件分类层级
  698. tellCategory: function (id) {
  699. return getData.customGET('tellCategory' + '/' + id);
  700. },
  701. //知识库导出
  702. downDataModel: function (type,month) {
  703. return getData.one('downDataModel/' + type + '/' + month);
  704. }
  705. };
  706. }]);
  707. app.factory('CommonRestangular', function (Restangular) {
  708. return Restangular.withConfig(function (RestangularConfigurer) {
  709. RestangularConfigurer.setBaseUrl(serverIp + '/common');
  710. });
  711. });
  712. app.factory('api_bpm_domain', ['BpmRestangular', 'CommonRestangular', function (BpmRestangular, CommonRestangular) {
  713. var bpmService = BpmRestangular.all("bpm");
  714. var commonService = CommonRestangular.all("common");
  715. return {
  716. //指派
  717. delegateTask: function (pdKey, data) {
  718. return bpmService.customPOST(data, 'delegateTask/' + pdKey, {});
  719. },
  720. fetchtask: function (pdKey, data) {
  721. return bpmService.customPOST(data, 'fetchTask/' + pdKey, {});
  722. },
  723. start: function (pdKey, data) {
  724. return bpmService.customPOST(data, 'start/' + pdKey, {});
  725. },
  726. flowTracing: function (processInstanceId, data) {
  727. return bpmService.customPOST(data, 'flowTracing/' + processInstanceId, {});
  728. },
  729. flowTracingCustom: function (processInstanceId, data) {
  730. return bpmService.customPOST(data, 'flowTracingCustom/' + processInstanceId, {});
  731. },
  732. complete: function (taskId, userId, data) {
  733. return bpmService.customPOST(data, 'completeTask/' + taskId + '/' + userId, {});
  734. },
  735. completeUpgrade: function (data) {
  736. return bpmService.customPOST(data, 'upgradeIncident', {});
  737. },
  738. save: function (taskId, data) {
  739. return bpmService.customPOST(data, 'saveTaskVar/' + taskId, {});
  740. },
  741. claimtask: function (taskId, data) {
  742. return bpmService.customPOST(data, 'claimTask/' + taskId, {});
  743. },
  744. claimAndCompletedTask: function (taskId, data) {
  745. return bpmService.customPOST(data, 'claimAndCompletedTask/' + taskId, {});
  746. },
  747. delegateTask: function (taskId, data) {
  748. return bpmService.customPOST(data, 'delegateTask/' + taskId, {});
  749. },
  750. expectedTime: function (taskId) {
  751. return bpmService.customGET('expectedTime/' + taskId);
  752. },
  753. history: function (processId) {
  754. return bpmService.customGET('history/' + processId);
  755. },
  756. // upgrade: function(processInstanceId, taskId, data) {
  757. // return bpmService.customPOST(data, 'upgradeIncident/' + processInstanceId + '/' + taskId, {});
  758. // },
  759. listAttachments: function (processId, data) {
  760. return commonService.customGET('listAttachment/incident/' + processId, {});
  761. },
  762. listAttachment: function (modal, processId) {
  763. return commonService.customGET('listAttachment/' + modal + '/' + processId);
  764. },
  765. saveAttachments: function (processId, taskId, userId, data) {
  766. return bpmService.one('saveAttachments/' + processId + '/' + taskId + '/' + userId);
  767. },
  768. uploadAttachment: function (processId, taskId, userId, data) {
  769. return commonService.one('uploadAttachment/' + 'incident/' + processId);
  770. },
  771. uploadAttachmentJryModel: function (model, processId, taskId, userId, data) {
  772. return commonService.one('uploadAttachment/' + model + '/' + processId);
  773. },
  774. download: function (attachmentId) {
  775. return bpmService.one('getAttachmentContent/' + attachmentId);
  776. },
  777. // download: function(attachmentId){
  778. // return bpmService.customGET('getAttachmentContent/' + attachmentId,{},{'responseType':'arraybuffer'});
  779. // },
  780. attachmentsPreviewUrl: function (attachmentId) {
  781. return bpmService.customGET('attachmentsPreviewUrl/' + attachmentId);
  782. },
  783. startformkey: function (pdKey) {
  784. return bpmService.customGET('startformkey/' + pdKey);
  785. },
  786. taskformkey: function (taskId) {
  787. return bpmService.customGET('taskformkey/' + taskId);
  788. },
  789. workernumber: function (type) {
  790. return bpmService.customGET('restful/' + type);
  791. },
  792. getWatchAreaPosition: function (data) {
  793. return bpmService.customGET('getWatchAreaPosition');
  794. },
  795. getWatchAreaData: function (id) {
  796. return bpmService.customGET('getWatchAreaData/' + id);
  797. },
  798. // 业务系统附件上传
  799. upload: function (type, processId) {
  800. return commonService.one(type + processId);
  801. },
  802. };
  803. }]);
  804. app.factory('api_bpm_domain1', ['BpmRestangular', 'CommonRestangular', function (BpmRestangular, CommonRestangular) {
  805. var bpmService = BpmRestangular.all("bpm");
  806. var commonService = CommonRestangular.all("common");
  807. return {
  808. //指派
  809. delegateTask: function (pdKey, data) {
  810. return bpmService.customPOST(data, 'delegateTask/' + pdKey, {});
  811. },
  812. fetchtask: function (pdKey, data) {
  813. return bpmService.customPOST(data, 'fetchTask/' + pdKey, {});
  814. },
  815. start: function (pdKey, data) {
  816. return bpmService.customPOST(data, 'start/' + pdKey, {});
  817. },
  818. flowTracing: function (processInstanceId, data) {
  819. return bpmService.customPOST(data, 'flowTracing/' + processInstanceId, {});
  820. },
  821. flowTracingCustom: function (processInstanceId, data) {
  822. return bpmService.customPOST(data, 'flowTracingCustom/' + processInstanceId, {});
  823. },
  824. complete: function (taskId, userId, data) {
  825. return bpmService.customPOST(data, 'completeTask/' + taskId + '/' + userId, {});
  826. },
  827. completeUpgrade: function (data) {
  828. return bpmService.customPOST(data, 'upgradeIncident', {});
  829. },
  830. save: function (taskId, data) {
  831. return bpmService.customPOST(data, 'saveTaskVar/' + taskId, {});
  832. },
  833. claimtask: function (taskId, data) {
  834. return bpmService.customPOST(data, 'claimTask/' + taskId, {});
  835. },
  836. claimAndCompletedTask: function (taskId, data) {
  837. return bpmService.customPOST(data, 'claimAndCompletedTask/' + taskId, {});
  838. },
  839. delegateTask: function (taskId, data) {
  840. return bpmService.customPOST(data, 'delegateTask/' + taskId, {});
  841. },
  842. expectedTime: function (taskId) {
  843. return bpmService.customGET('expectedTime/' + taskId);
  844. },
  845. history: function (processId) {
  846. return bpmService.customGET('history/' + processId);
  847. },
  848. // upgrade: function(processInstanceId, taskId, data) {
  849. // return bpmService.customPOST(data, 'upgradeIncident/' + processInstanceId + '/' + taskId, {});
  850. // },
  851. listAttachments: function (processId, data) {
  852. return commonService.customGET('listAttachment/inspection/' + processId, {});
  853. },
  854. listAttachment: function (modal, processId) {
  855. return commonService.customGET('listAttachment/' + modal + '/' + processId);
  856. },
  857. saveAttachments: function (processId, taskId, userId, data) {
  858. return bpmService.one('saveAttachments/' + processId + '/' + taskId + '/' + userId);
  859. },
  860. uploadAttachment: function (processId, taskId, userId, data) {
  861. return commonService.one('uploadAttachment/' + 'inspection/' + processId);
  862. },
  863. uploadAttachmentJryModel: function (model, processId, taskId, userId, data) {
  864. return commonService.one('uploadAttachment/' + model + '/' + processId);
  865. },
  866. download: function (attachmentId) {
  867. return bpmService.one('getAttachmentContent/' + attachmentId);
  868. },
  869. // download: function(attachmentId){
  870. // return bpmService.customGET('getAttachmentContent/' + attachmentId,{},{'responseType':'arraybuffer'});
  871. // },
  872. attachmentsPreviewUrl: function (attachmentId) {
  873. return bpmService.customGET('attachmentsPreviewUrl/' + attachmentId);
  874. },
  875. startformkey: function (pdKey) {
  876. return bpmService.customGET('startformkey/' + pdKey);
  877. },
  878. taskformkey: function (taskId) {
  879. return bpmService.customGET('taskformkey/' + taskId);
  880. },
  881. workernumber: function (type) {
  882. return bpmService.customGET('restful/' + type);
  883. },
  884. getWatchAreaPosition: function (data) {
  885. return bpmService.customGET('getWatchAreaPosition');
  886. },
  887. getWatchAreaData: function (id) {
  888. return bpmService.customGET('getWatchAreaData/' + id);
  889. },
  890. // 业务系统附件上传
  891. upload: function (type, processId) {
  892. return commonService.one(type + processId);
  893. },
  894. };
  895. }]);
  896. // 事件富文本框上传
  897. app.factory('api_common_incident', ['BpmRestangular', 'CommonRestangular', function (BpmRestangular, CommonRestangular) {
  898. var commonService = CommonRestangular.all("common");
  899. return {
  900. upload: function (processId) {
  901. return commonService.one('uploadAttachment/incident/' + processId);
  902. },
  903. uploadResponseUri: function () {
  904. return imgBaseUrl + '/';
  905. },
  906. }
  907. }]);
  908. app.factory('api_bpm_data', ['BpmRestangular', function (BpmRestangular) {
  909. var dataService = BpmRestangular.all("data");
  910. var serviceCatalogue = BpmRestangular.all("ServiceCatalogue");
  911. var inspectionProcessActual = BpmRestangular.all("InspectionProcessActual");
  912. var solutionService = BpmRestangular.all("solution");
  913. return {
  914. // 获取首页今日上班清空
  915. getManagerIndexInfo: function (data) {
  916. return dataService.customPOST(data, 'getManagerIndexInfo');
  917. },
  918. // 不受理数据请求 --jry
  919. notAcceptData: function (data) {
  920. return dataService.customPOST(data, 'updData/alarmIncident');
  921. },
  922. // 获取认证计费数据
  923. sumInfo: function (account) {
  924. return dataService.customPOST({}, 'sumInfo/'+account);
  925. },
  926. impFileData: function () {
  927. return dataService.one('/impFileData/bpm_scheduleorder');
  928. },
  929. importData: function () {
  930. return dataService.one('/impFileData');
  931. },
  932. fetchDataList: function (model, data) {
  933. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  934. },
  935. fetchData: function (model, dataId) {
  936. return dataService.customGET('fetchData/' + model + '/' + dataId);
  937. },
  938. fetchServiceTasks: function (model, data) {
  939. if (!model) {
  940. model = "ALL"
  941. }
  942. return serviceCatalogue.customPOST(data, 'fetchServiceTasks/' + model, {});
  943. },
  944. fetchInspectServiceTasks: function (model, data) {
  945. if (!model) {
  946. model = "ALL"
  947. }
  948. return inspectionProcessActual.customPOST(data, 'fetchServiceTasks/' + model, {});
  949. },
  950. addData: function (model, data) {
  951. return dataService.customPOST(data, 'addData/' + model, {});
  952. },
  953. updData: function (model, data) {
  954. return dataService.customPOST(data, 'updData/' + model, {});
  955. },
  956. rmvData: function (model, data) {
  957. return dataService.customPOST(data, 'rmvData/' + model, {});
  958. },
  959. getCount: function (data) {
  960. return dataService.customPOST(data, 'getCount2', {});
  961. },
  962. downDataModel: function (type, month) {
  963. return dataService.one('downDataModel/' + type + '/' + month);
  964. },
  965. fetchDataByGroupId: function (data) {
  966. return dataService.customPOST(data, 'fetchDataByGroupId', {});
  967. },
  968. // downDataModel: function(type, month, data) {
  969. // return dataService.customPOST(data, 'downDataModel/' + type + '/' + month, {}, { 'Accept': 'application/json, text/javascript, */*' });
  970. // }
  971. };
  972. }]);
  973. app.factory('api_bpm_schedule', ['BpmRestangular', function (BpmRestangular) {
  974. var dataService = BpmRestangular.all("data");
  975. return {
  976. //删除事件
  977. del: function (id) {
  978. return dataService.customPOST({}, 'deleteIncident/' + id, {});
  979. },
  980. getScheduleClass: function () {
  981. var data = {
  982. "idx": "0",
  983. "sum": "10"
  984. };
  985. return dataService.customPOST(data, 'fetchDataList/scheduleclass', {});
  986. },
  987. fetchList: function (startTime, endTime, userId, queryKey) {
  988. var scheduleOrder = {
  989. "scheduleorder": {
  990. "startTime": startTime,
  991. "endTime": endTime
  992. },
  993. "idx": "0",
  994. "sum": "1000"
  995. };
  996. if (userId) {
  997. scheduleOrder['scheduleorder']['user'] = userId;
  998. }
  999. if (queryKey) {
  1000. scheduleOrder['scheduleorder']['description'] = queryKey;
  1001. }
  1002. return dataService.customPOST(scheduleOrder, 'fetchDataList/scheduleorder', {});
  1003. },
  1004. fetchData: function (dataId) {
  1005. return dataService.customGET('fetchData/scheduleorder/' + dataId);
  1006. },
  1007. update: function (data) {
  1008. return dataService.customPOST(data, 'updData/scheduleorder', {});
  1009. },
  1010. add: function (data) {
  1011. return dataService.customPOST(data, 'addData/scheduleorder', {});
  1012. },
  1013. remove: function (data) {
  1014. return dataService.customPOST(data, 'rmvData/scheduleorder', {});
  1015. },
  1016. fetchSchedule: function (userId, startTime, endTime) {
  1017. var scheduleData = {
  1018. "schedulewatch": {
  1019. "type": "1",
  1020. "user": {
  1021. "id": userId
  1022. },
  1023. "startTime": startTime,
  1024. "endTime": endTime
  1025. },
  1026. "idx": "0",
  1027. "sum": "100"
  1028. };
  1029. return dataService.customPOST(scheduleData, 'fetchDataList/schedulewatch', {});
  1030. },
  1031. queryRecieveSwitch: function (userId) {
  1032. var handleSwitch = {
  1033. "schedulewatch": {
  1034. "type": "3",
  1035. "user": {
  1036. "id": userId
  1037. }
  1038. },
  1039. "idx": "0",
  1040. "sum": "10"
  1041. };
  1042. return dataService.customPOST(handleSwitch, 'fetchDataList/schedulewatch', {});
  1043. },
  1044. queryHandleoutSwitch: function (userId) {
  1045. var handleSwitch = {
  1046. "schedulewatch": {
  1047. "type": "2",
  1048. "user": {
  1049. "id": userId
  1050. }
  1051. },
  1052. "idx": "0",
  1053. "sum": "10"
  1054. };
  1055. return dataService.customPOST(handleSwitch, 'fetchDataList/schedulewatch', {});
  1056. },
  1057. handleSchedule: function (data) {
  1058. return dataService.customPOST(data, 'updData/schedulewatch', {});
  1059. },
  1060. querySwitch: function (filterData) {
  1061. var switchData = {
  1062. "scheduleorder": {
  1063. "type": "4"
  1064. },
  1065. "idx": filterData.idx,
  1066. "sum": filterData.sum
  1067. };
  1068. return dataService.customPOST(switchData, 'fetchDataList/scheduleorder', {});
  1069. },
  1070. query: function (filterData) {
  1071. var switchData = {
  1072. "scheduleorder": filterData.scheduleorder,
  1073. "idx": filterData.idx,
  1074. "sum": filterData.sum
  1075. };
  1076. return dataService.customPOST(switchData, 'fetchDataList/scheduleorder', {});
  1077. }
  1078. };
  1079. }]);
  1080. app.factory('SysinfoRestangular', function (Restangular) {
  1081. return Restangular.withConfig(function (RestangularConfigurer) {
  1082. RestangularConfigurer.setBaseUrl(serverIp + '/sysinfo/');
  1083. });
  1084. });
  1085. app.factory('api_sysinfo', ['SysinfoRestangular', function (SysinfoRestangular) {
  1086. var dataService = SysinfoRestangular.all("data");
  1087. return {
  1088. fetchDataList: function (model, data) {
  1089. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  1090. },
  1091. addData: function (model, data) {
  1092. return dataService.customPOST(data, 'addData/' + model, {});
  1093. },
  1094. getSerialnumber: function (type, model) {
  1095. return dataService.customGET('getSerialnumber/' + type + '/' + model);
  1096. }
  1097. };
  1098. }]);
  1099. app.factory('ConfigureRestangular', function (Restangular) {
  1100. return Restangular.withConfig(function (RestangularConfigurer) {
  1101. RestangularConfigurer.setBaseUrl(serverIp);
  1102. });
  1103. });
  1104. app.factory('api_configure_form', ['ConfigureRestangular', function (ConfigureRestangular) {
  1105. var formService = ConfigureRestangular.all("form");
  1106. // var formService = ConfigureRestangular.all("bpm/data");
  1107. return {
  1108. renderForm: function (formKey, userId, processInstanceId, id) {
  1109. if (processInstanceId) {
  1110. return formService.customGET('renderForm/' + formKey + "/" + processInstanceId + "/" + userId + "/" + id);
  1111. } else {
  1112. var ids = 0
  1113. return formService.customGET('renderForm/' + formKey + "/000000/" + userId + "/" + ids);
  1114. }
  1115. },
  1116. renderFormNoId: function (formKey, userId, processInstanceId) {
  1117. return formService.customGET('renderForm/' + formKey + "/" + processInstanceId + "/" + userId);
  1118. },
  1119. renderList: function (formKey) {
  1120. return formService.customGET('renderList/' + formKey);
  1121. },
  1122. renderTabForm: function (classify) {
  1123. return formService.customGET('renderTabForm/' + classify);
  1124. }
  1125. };
  1126. }]);
  1127. // app.factory('ConfigureRestangular', function(Restangular) {
  1128. // return Restangular.withConfig(function(RestangularConfigurer) {
  1129. // RestangularConfigurer.setBaseUrl(serverIp + '/config/');
  1130. // });
  1131. // });
  1132. app.factory('api_configure_data', ['ConfigureRestangular', function (ConfigureRestangular) {
  1133. var dataService = ConfigureRestangular.all("data");
  1134. return {
  1135. fetchDataList: function (model, data) {
  1136. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  1137. },
  1138. linkConfigure: function (model, data) {
  1139. return dataService.customPOST(data, 'linkConfigure/' + model, {});
  1140. },
  1141. fetchDataById: function (model, id) {
  1142. return dataService.customGET('fetchData/' + id + '/' + model);
  1143. },
  1144. fetchData: function (model, data) {
  1145. return dataService.customPOST(data, 'fetchData/' + model, {});
  1146. },
  1147. addData: function (model, data) {
  1148. return dataService.customPOST(data, 'addData/' + model, {});
  1149. },
  1150. rmvData: function (model, data) {
  1151. return dataService.customPOST(data, 'rmvData/' + model, {});
  1152. },
  1153. updData: function (model, data) {
  1154. return dataService.customPOST(data, 'updData/' + model, {});
  1155. },
  1156. downModels: function (model, data) {
  1157. return dataService.one(model);
  1158. },
  1159. };
  1160. }]);
  1161. //知识库新接口--jry
  1162. app.factory('ZSKXJKJRY', function (Restangular) {
  1163. return Restangular.withConfig(function (RestangularConfigurer) {
  1164. RestangularConfigurer.setBaseUrl(serverIp + '/solution');
  1165. });
  1166. });
  1167. app.factory('api_zsk', ['ZSKXJKJRY', function (ZSKXJKJRY) {
  1168. //http://127.0.0.1:9004/services/ftpFile/monitor/bankTip/
  1169. var dataList = ZSKXJKJRY.all("fetchDataList");
  1170. var quote = ZSKXJKJRY.all('solutionQuote')
  1171. return {
  1172. jry_get_list: function (data, key) {
  1173. return dataList.customPOST(data, key, {});
  1174. },
  1175. // 知识库分类模糊搜索(暂无,哈哈)
  1176. searchSolutionType: function (data, key) {
  1177. return dataList.customPOST(key, data, {});
  1178. },
  1179. jry_form_getType: function (data, key) {
  1180. return dataList.customPOST({
  1181. "idx": 0,
  1182. "sum": 10000
  1183. }, "solutionType", {});
  1184. },
  1185. solutionData: function (data, key) {
  1186. return dataList.customPOST(data, key, {});
  1187. },
  1188. solutionQuote: function (id) {
  1189. return quote.customGET(id)
  1190. }
  1191. };
  1192. }]);
  1193. app.factory('baseUrl', function (Restangular) {
  1194. return Restangular.withConfig(function (RestangularConfigurer) {
  1195. RestangularConfigurer.setBaseUrl(serverIp + '/');
  1196. });
  1197. });
  1198. app.factory('up_down_file', ['baseUrl', function (baseUrl) {
  1199. var upDownFile = baseUrl.all("");
  1200. return {
  1201. //附件上传新接口
  1202. listAttachment: function (upUrl, bindType, bindId) {
  1203. return upDownFile.customGET(upUrl + '/' + bindType + '/' + bindId);
  1204. },
  1205. listAttachments: function (upUrl, bindType, bindId) {
  1206. return upDownFile.customGET(upUrl + '/' + bindType + '/' + bindId);
  1207. },
  1208. saveAttachments: function (upUrl, bindType, bindId) {
  1209. return upDownFile.one(upUrl + '/' + bindType + '/' + bindId);
  1210. },
  1211. downloadAttachment: function (upUrl, token) {
  1212. return upDownFile.one(upUrl + '/' + token);
  1213. },
  1214. removeAttachment: function (upUrl, token) {
  1215. return upDownFile.one(upUrl + '/' + token);
  1216. }
  1217. };
  1218. }]);
  1219. app.factory('SolutionRestangular', function (Restangular) {
  1220. return Restangular.withConfig(function (RestangularConfigurer) {
  1221. //RestangularConfigurer.setBaseUrl('http://168.166.203.41:9000/services');
  1222. RestangularConfigurer.setBaseUrl(serverIp + '/solution');
  1223. });
  1224. });
  1225. //知识库附件上传--jry
  1226. app.factory('Jry_SolutionRestangular', function (Restangular) {
  1227. return Restangular.withConfig(function (RestangularConfigurer) {
  1228. //RestangularConfigurer.setBaseUrl('http://168.166.203.41:9000/services');
  1229. RestangularConfigurer.setBaseUrl(serverIp + '/common');
  1230. });
  1231. });
  1232. app.factory('api_solution', ['SolutionRestangular', 'Jry_SolutionRestangular', function (SolutionRestangular, Jry_SolutionRestangular) {
  1233. var solutionService = SolutionRestangular.all("solution");
  1234. var jry_bj = SolutionRestangular.all("updData");
  1235. var jry_rm = SolutionRestangular.all("rmvData");
  1236. var jry_getLSJL = SolutionRestangular.all("fetchDataList");
  1237. var jry_sj = SolutionRestangular.all("getVisionNumber");
  1238. var jry_sjup = SolutionRestangular.all("");
  1239. var jry_FJuploda = Jry_SolutionRestangular.all("common");
  1240. var jry_solutionService = SolutionRestangular.all("addData");
  1241. var data = SolutionRestangular.all("solutionData");
  1242. var history = SolutionRestangular.all("solutionHistory");
  1243. var review = SolutionRestangular.all("solution_review");
  1244. var typeservice = SolutionRestangular.all("solutionType");
  1245. var groupservice = SolutionRestangular.all("solutionGroup");
  1246. return {
  1247. findSolutionByKeys: function (data) {
  1248. var key = data.key,
  1249. status = data.status || 0,
  1250. pageIndex = data.pageIndex || 0,
  1251. pageSum = data.pageSum,
  1252. treeIds = data.treeIds,
  1253. userId = data.userId;
  1254. if (angular.isUndefined(treeIds)) {
  1255. return solutionService.customGET('findSolutionByKeys/' + key + '/' + status + '/' + pageIndex + '/' + pageSum + '/' + userId);
  1256. } else {
  1257. return solutionService.customGET('findSolutionByKeys/' + key + '/' + status + '/' + pageIndex + '/' + pageSum + '/' + treeIds + '/' + userId);
  1258. }
  1259. },
  1260. // searcher: function(data){
  1261. // var queryBuilder=data.key, indexname=data.treeIds, type=data.userId;
  1262. // return searchservice.customGET('searcher/' + queryBuilder + '/' + indexname + '/' + type );
  1263. // },
  1264. addSolution: function () {
  1265. return solutionService.one('add');
  1266. },
  1267. addFile: function (data) {
  1268. return solutionService.customPOST(data, 'addSolution', {});
  1269. },
  1270. jry_addFile: function (data) {
  1271. return jry_solutionService.customPOST(data, 'solution', {});
  1272. },
  1273. addData: function (model, data) {
  1274. return jry_solutionService.customPOST(data, model, {});
  1275. },
  1276. addModel: function (type, data) {
  1277. return solutionService.customPOST(data, 'addModel/' + type, {});
  1278. },
  1279. updModel: function (type, data) {
  1280. return solutionService.customPOST(data, 'updModel/' + type, {});
  1281. },
  1282. rmModels: function (id, data) {
  1283. return solutionService.customPOST(data, 'rmModels/' + id, {});
  1284. },
  1285. update: function () {
  1286. return solutionService.one('update');
  1287. },
  1288. upload: function () {
  1289. return solutionService.one('upload');
  1290. },
  1291. jry_upload: function (LCid) {
  1292. return jry_FJuploda.one('uploadAttachment/solution/' + LCid);
  1293. },
  1294. jry_upload1: function (LCid) {
  1295. return jry_FJuploda.one('uploadAttachment/knowledge/' + LCid);
  1296. },
  1297. uploadResponseUri: function () {
  1298. return solutionService.one('/');
  1299. },
  1300. addNotFile: function (data) {
  1301. return solutionService.customPOST(data, 'addNotFile', {});
  1302. },
  1303. // export: function(data) {
  1304. // return solutionService.customGET(data, 'export', {});
  1305. // },
  1306. export: function (data) {
  1307. return solutionService.one('export');
  1308. },
  1309. updateNotFile: function (data) {
  1310. return solutionService.customPOST(data, 'updateNotFile', {});
  1311. },
  1312. updateSolution: function (data) {
  1313. return solutionService.customPOST(data, 'updateSolution', {});
  1314. },
  1315. jry_updateSolution: function (data) {
  1316. return jry_bj.customPOST(data, 'solution', {});
  1317. },
  1318. updData: function (model, data) {
  1319. return jry_bj.customPOST(data, model, {});
  1320. },
  1321. rmvData: function (model, data) {
  1322. return jry_rm.customPOST(data, model, {});
  1323. },
  1324. jry_leveSolution: function (data) {
  1325. return jry_sjup.customPOST(data, 'upgrade', {});
  1326. },
  1327. jry_leveVision: function (id) {
  1328. return jry_sj.customGET(id);
  1329. },
  1330. jry_getHistory: function (data) {
  1331. return jry_getLSJL.customPOST(data, 'solution', {});
  1332. },
  1333. wt_type: function (data) {
  1334. return jry_getLSJL.customPOST(data, 'solutionType', {});
  1335. },
  1336. searchSolutionByKey: function (key, id) {
  1337. return solutionService.customGET('searchSolutionByKey/' + key + '/' + id);
  1338. },
  1339. findSolutionById: function (id) {
  1340. return solutionService.customGET('check/' + id);
  1341. },
  1342. findSolutions: function (id) {
  1343. return solutionService.customGET('check2/' + id);
  1344. },
  1345. jry_fetchDataList: function (model, data) {
  1346. return jry_sjup.customPOST(data, 'fetchDataList/' + model, {});
  1347. },
  1348. fetchDataList: function (model, data) {
  1349. return solutionService.customPOST(data, 'fetchDataList/' + model, {});
  1350. },
  1351. findSolutionDataByDateById: function (ndate, sid) {
  1352. return data.customGET('findSolutionDataByDateById/' + ndate + '/' + sid);
  1353. },
  1354. findSolutionTypeActions: function (userId) {
  1355. return typeservice.customGET('findSolutionTypeActions/' + userId);
  1356. },
  1357. findSolutionTypesUser: function (data) {
  1358. return typeservice.customPOST(data, 'findSolutionTypesUser', {});
  1359. },
  1360. addTypeUserAll: function (data) {
  1361. return typeservice.customPOST(data, 'addTypeUserAll', {});
  1362. },
  1363. hotRanking: function (num) {
  1364. return solutionService.customGET('hotRanking/' + num);
  1365. },
  1366. scoreRanking: function (num) {
  1367. return solutionService.customGET('scoreRanking/' + num);
  1368. },
  1369. fetchBBSSolutions: function (pageIndex, pageSum, sequence, userId) {
  1370. return solutionService.customGET('communicationSolutions/' + pageIndex + '/' + pageSum + '/' + sequence + '/' + userId);
  1371. },
  1372. queryBBSSolutions: function (pageIndex, pageSum, sequence, userId, key) {
  1373. return solutionService.customGET('communicationSolutions/' + pageIndex + '/' + pageSum + '/' + sequence + '/' + userId + '/' + key);
  1374. },
  1375. updateSolutionStatus: function (data) {
  1376. return solutionService.customPOST(data, 'updateSolutionStatus', {});
  1377. },
  1378. getSolutionNumber: function () {
  1379. return solutionService.customGET('getSolutionNumber');
  1380. },
  1381. addSolutionType: function (data) {
  1382. return typeservice.customPOST(data, 'add', {});
  1383. },
  1384. updateSolutionType: function (data) {
  1385. return typeservice.customPOST(data, 'update', {});
  1386. },
  1387. removeSolutionType: function (id) {
  1388. return typeservice.customGET('delete/' + id);
  1389. },
  1390. getSolutionType: function (id) {
  1391. return typeservice.customGET('' + id);
  1392. },
  1393. getTree: function (typeId, groupId, flag) {
  1394. return typeservice.customGET('getTree/' + typeId + '/' + groupId + '/' + flag);
  1395. },
  1396. checkCommentScoreByUserIds: function (userId, id) {
  1397. return review.customGET('findCommentScore/' + userId + '/' + id);
  1398. },
  1399. addSolutionReview: function (data) {
  1400. return solutionService.customPOST(data, 'addScore', {});
  1401. },
  1402. findSolutionReviewById: function (userid, id, pageIndex, pageSum) {
  1403. return solutionService.customGET('findSolutionReviewByType/' + userid + '/' + id + '/' + pageIndex + '/' + pageSum);
  1404. },
  1405. saveAllUserAuth: function (solutionId, flag) {
  1406. return solutionService.customGET('saveAllUserTrees/' + solutionId + '/' + flag);
  1407. },
  1408. updatermvSolutionType: function (typeId, groupId, userIds, flag) {
  1409. return typeservice.customGET('delOrUpdateTrees/' + typeId + '/' + groupId + '/' + userIds + '/' + flag);
  1410. },
  1411. findSolutionGroup: function (id) {
  1412. return groupservice.customGET('findSolutionGroup/' + id);
  1413. },
  1414. saveSolutionGroup: function (id, data) {
  1415. return groupservice.customPOST(data, 'saveSolutionGroup/' + id);
  1416. },
  1417. // getSolutionDowpath: function(id){
  1418. // return solutionService.one('download/'+id);
  1419. // }
  1420. getSolutionDowpath: function (attachmentId) {
  1421. return solutionService.one('download/' + attachmentId + '/file');
  1422. }
  1423. // getSolutionDowpath: function(attachmentId){
  1424. // return solutionService.customGET('download/' + attachmentId);
  1425. // }
  1426. };
  1427. }]);
  1428. // 业务系统
  1429. app.factory('CMDBRestangular2', function (Restangular) {
  1430. return Restangular.withConfig(function (RestangularConfigurer) {
  1431. RestangularConfigurer.setBaseUrl(serverIp + '/cmdb');
  1432. });
  1433. });
  1434. // 业务系统
  1435. app.factory('api_cmdb2', ['CMDBRestangular2', function (CMDBRestangular) {
  1436. var ywxtService = CMDBRestangular.all("operationSystem");
  1437. var ywxtService1 = CMDBRestangular.all("");
  1438. return {
  1439. // 获取绑定到事件上的耗材
  1440. getHc:function(sourceId){
  1441. return ywxtService1.customPOST({
  1442. data: { type: 2, source: "1627", sourceId: sourceId },
  1443. }, 'storeList');
  1444. },
  1445. // 导入模板
  1446. importDataTpl: function (type, data) {
  1447. return ywxtService1.one(type, data, {});
  1448. },
  1449. // 列表数据
  1450. fetchDataList: function (pdKey, data) {
  1451. return ywxtService.customPOST(data, 'fetchDataList/' + pdKey, {})
  1452. },
  1453. // 列表数据
  1454. fetchDataList1: function (pdKey, data) {
  1455. return ywxtService1.customPOST(data, 'fetchDataList/' + pdKey, {})
  1456. },
  1457. // 管理单位
  1458. management_unit: function () {
  1459. return ywxtService.customGET('queryManagementUnit', {});
  1460. },
  1461. // 新增
  1462. add_preservation: function (til, data) {
  1463. return ywxtService.customPOST(data, 'addModel/' + til, {})
  1464. },
  1465. // 新增
  1466. add_preservation1: function (til, data) {
  1467. return ywxtService1.customPOST(data, 'addData/' + til, {})
  1468. },
  1469. // 删除
  1470. remov: function (til, data) {
  1471. return ywxtService.customPOST(data, 'rmModels/' + til, {})
  1472. },
  1473. // 删除
  1474. remov1: function (til, data) {
  1475. return ywxtService1.customPOST(data, 'rmModels/' + til, {})
  1476. },
  1477. // 导出数据
  1478. exportData: function (type, data) {
  1479. return ywxtService.one(type, data, {});
  1480. },
  1481. // 导出数据
  1482. exportData1: function (type, data) {
  1483. return ywxtService1.one(type, data, {});
  1484. },
  1485. // 编辑
  1486. edit_preservation: function (til, data) {
  1487. return ywxtService.customPOST(data, 'updModel/' + til, {})
  1488. },
  1489. // 编辑
  1490. edit_preservation1: function (til, data) {
  1491. return ywxtService1.customPOST(data, 'updData/' + til, {})
  1492. },
  1493. // 修改管理单位
  1494. upd_preservation: function (til, data) {
  1495. return ywxtService1.customPOST(data, 'updData/' + til, {})
  1496. },
  1497. // 删除管理单位
  1498. del_preservation: function (til, data) {
  1499. return ywxtService.customPOST(data, 'rmModels/' + til, {})
  1500. },
  1501. }
  1502. }]);
  1503. // 耗材
  1504. app.factory('CMDBRestangular3', function (Restangular) {
  1505. return Restangular.withConfig(function (RestangularConfigurer) {
  1506. RestangularConfigurer.setBaseUrl(serverIp + '/bpm');
  1507. });
  1508. });
  1509. // 耗材
  1510. app.factory('api_cmdb3', ['CMDBRestangular3', function (CMDBRestangular) {
  1511. var hcService = CMDBRestangular.all("data");
  1512. return {
  1513. // 列表数据
  1514. fetchDataList: function (pdKey, data) {
  1515. return hcService.customPOST(data, 'fetchDataList/' + pdKey, {})
  1516. },
  1517. //编辑保存
  1518. preservation: function (pdKey, data) {
  1519. return hcService.customPOST(data, 'updData/' + pdKey, {})
  1520. },
  1521. //新增
  1522. addData: function (pdKey, data) {
  1523. return hcService.customPOST(data, 'addData/' + pdKey, {})
  1524. },
  1525. // 导出数据
  1526. exportData: function (type, data) {
  1527. return hcService.one(type, data, {});
  1528. },
  1529. // 关联流程
  1530. relation: function (pdKey, data) {
  1531. return hcService.customPOST(data, 'getListBySign/' + pdKey, {})
  1532. }
  1533. }
  1534. }]);
  1535. // 耗材查询分类
  1536. app.factory('CMDBRestangular4', function (Restangular) {
  1537. return Restangular.withConfig(function (RestangularConfigurer) {
  1538. RestangularConfigurer.setBaseUrl(serverIp + '/common');
  1539. });
  1540. })
  1541. // 耗材查询分类
  1542. app.factory('api_cmdb4', ['CMDBRestangular4', function (CMDBRestangular) {
  1543. var hcService = CMDBRestangular.all("common");
  1544. return {
  1545. // 耗材查询分类
  1546. fetchDataList: function (data) {
  1547. return hcService.customPOST(data, 'getDictionary', {})
  1548. },
  1549. // 耗材分类新增
  1550. addDictionary: function (data) {
  1551. return hcService.customPOST(data, 'addDictionary', {})
  1552. },
  1553. // 耗材分类删除修改
  1554. upDictionary: function (data) {
  1555. return hcService.customPOST(data, 'upDictionary', {})
  1556. },
  1557. }
  1558. }]);
  1559. app.factory('CMDBRestangular', function (Restangular) {
  1560. return Restangular.withConfig(function (RestangularConfigurer) {
  1561. RestangularConfigurer.setBaseUrl(serverIp + '/cmdb/');
  1562. });
  1563. });
  1564. app.factory('api_cmdb', ['CMDBRestangular', function (CMDBRestangular) {
  1565. var ciService = CMDBRestangular.all("ci");
  1566. var uuidService = CMDBRestangular.all("uuid");
  1567. var edgeService = CMDBRestangular.all("edge");
  1568. var traversal = CMDBRestangular.all("traversal");
  1569. var downloadService = CMDBRestangular.all("download");
  1570. var exportService = CMDBRestangular.all("export");
  1571. var importService = CMDBRestangular.all("import");
  1572. var exportModelService = CMDBRestangular.all("exportModel");
  1573. var importDataService = CMDBRestangular.all("importData");
  1574. var exportDataService = CMDBRestangular.all("exportData");
  1575. var searchService = CMDBRestangular.all("search");
  1576. function serializeData(data) {
  1577. // If this is not an object, defer to native stringification.
  1578. if (!angular.isObject(data)) {
  1579. return ((data == null) ? "" : data.toString());
  1580. }
  1581. var buffer = [];
  1582. // Serialize each key in the object.
  1583. for (var name in data) {
  1584. if (!data.hasOwnProperty(name)) {
  1585. continue;
  1586. }
  1587. var value = data[name];
  1588. buffer.push(
  1589. encodeURIComponent(name) + "=" + encodeURIComponent((value == null) ? "" : value)
  1590. );
  1591. }
  1592. // Serialize the buffer and clean it up for transportation.
  1593. var source = buffer.join("&").replace(/%20/g, "+");
  1594. return (source);
  1595. }
  1596. return {
  1597. create: function (data) {
  1598. return ciService.customPOST(data, '', {});
  1599. },
  1600. importData: function () {
  1601. return importDataService.one('/nodes');
  1602. },
  1603. put: function (data, id) {
  1604. return ciService.customPUT(data, id, {});
  1605. },
  1606. remove: function (id) {
  1607. return ciService.customDELETE(id);
  1608. },
  1609. removeByUUId: function (uuid) {
  1610. return ciService.customDELETE('uuid/' + id, {}, {
  1611. 'Content-Type': 'application/json'
  1612. });
  1613. },
  1614. removeRefById: function (id) {
  1615. return ciService.customDELETE(id + '/ref');
  1616. },
  1617. find: function (id) {
  1618. return ciService.customGET(id);
  1619. },
  1620. searchkey: function (type, key, idx, sum) {
  1621. return searchService.customGET(type + '/' + key + '/' + idx + '/' + sum);
  1622. },
  1623. findByUUId: function (uuid) {
  1624. return ciService.customGET('?uuid=' + uuid);
  1625. },
  1626. query: function (data) {
  1627. return ciService.customGET('query', data);
  1628. },
  1629. findRefById: function (id) {
  1630. return ciService.customGET(id + '/refs');
  1631. },
  1632. finduuid: function (type, model) {
  1633. return uuidService.customGET(type + '/' + model);
  1634. },
  1635. types: function () {
  1636. return CMDBRestangular.customGET('types');
  1637. },
  1638. createRef: function (data) {
  1639. return edgeService.customPOST(data, '', {});
  1640. },
  1641. putRef: function (data, id) {
  1642. return edgeService.customPUT(data, '' + id, {});
  1643. },
  1644. removeRef: function (id) {
  1645. return edgeService.customDELETE(id, {}, {
  1646. 'Content-Type': 'application/json'
  1647. });
  1648. },
  1649. traversal: function (uuid) {
  1650. return traversal.customGET(uuid);
  1651. },
  1652. traversalRel: function (uuid, relation) {
  1653. return traversal.customGET(uuid + '/' + relation + '/' + 'none');
  1654. },
  1655. export: function (label) {
  1656. return exportService.customGET('nodes/' + label);
  1657. },
  1658. import: function () {
  1659. return importService.one('/nodes');
  1660. },
  1661. download: function (label) {
  1662. return downloadService.one('/label');
  1663. },
  1664. exportData: function (type, model) {
  1665. return exportDataService.one(model + '/' + type);
  1666. },
  1667. downModels: function (type, model) {
  1668. return exportModelService.one(model + '/' + type);
  1669. }
  1670. };
  1671. }]);
  1672. app.factory('CMDBNEWRestangular', function (Restangular) {
  1673. return Restangular.withConfig(function (RestangularConfigurer) {
  1674. RestangularConfigurer.setBaseUrl(serverIp + '/cmdb/');
  1675. });
  1676. });
  1677. app.factory('api_cmdb_new', ['CMDBNEWRestangular', function (CMDBNEWRestangular) {
  1678. var assetService = CMDBNEWRestangular.all("asset");
  1679. var operationSystemService = CMDBNEWRestangular.all('operationSystem')
  1680. return {
  1681. checkFile: function (model) {
  1682. return assetService.one('/checkFile/' + model);
  1683. },
  1684. getApplicationId: function (type) {
  1685. return assetService.customGET('getApplicationId/' + type);
  1686. },
  1687. fetchDataList: function (model, data) {
  1688. return operationSystemService.customPOST(data, 'fetchDataList/' + model, {});
  1689. },
  1690. fetchDataList: function (model, data) {
  1691. return operationSystemService.customPOST(data, 'fetchDataList/' + model, {});
  1692. }
  1693. }
  1694. }]);
  1695. app.factory('MonitorRestangular', function (Restangular) {
  1696. return Restangular.withConfig(function (RestangularConfigurer) {
  1697. RestangularConfigurer.setBaseUrl(serverIp + ':9004/services');
  1698. });
  1699. });
  1700. app.factory('api_monitor', ['MonitorRestangular', function (MonitorRestangular) {
  1701. //http://127.0.0.1:9004/services/ftpFile/monitor/bankTip/
  1702. var process = MonitorRestangular.all("ftpFile/monitor");
  1703. return {
  1704. bankTip: function (id) {
  1705. return process.customGET('bankTip/' + id);
  1706. },
  1707. list: function () {
  1708. return process.customGET('list/1000');
  1709. },
  1710. devList: function (id) {
  1711. return process.customGET('devList/' + id);
  1712. },
  1713. cpuList: function () {
  1714. return process.customGET('cpuList/10');
  1715. },
  1716. memList: function () {
  1717. return process.customGET('memList/10');
  1718. },
  1719. storageList: function () {
  1720. return process.customGET('storageList/10');
  1721. },
  1722. transData: function () {
  1723. return process.customGET('transData/5');
  1724. },
  1725. banklist: function () {
  1726. return process.customGET('banklist');
  1727. },
  1728. app: function (id) {
  1729. return process.customGET('app/' + id);
  1730. },
  1731. beita: function (id) {
  1732. return process.customGET('beita/' + id);
  1733. },
  1734. gongji: function (id) {
  1735. return process.customGET('gongji/' + id);
  1736. }
  1737. };
  1738. }]);
  1739. /**
  1740. * 报表
  1741. */
  1742. app.factory('NxreportRestangular', function (Restangular) {
  1743. return Restangular.withConfig(function (RestangularConfigurer) {
  1744. RestangularConfigurer.setBaseUrl(serverIp);
  1745. });
  1746. });
  1747. app.factory('api_report_nx', ['NxreportRestangular', 'Restangular', function (NxreportRestangular, Restangular) {
  1748. var reportService = NxreportRestangular.all("reportPoc");
  1749. return {
  1750. fetchDataList: function (model, data) { //事件分类
  1751. return reportService.customPOST(data, 'fetchDataList/' + model, {})
  1752. },
  1753. // getPdf: function(data) { //事件分类
  1754. // return reportService.customPOST(data, 'getPdf', {})
  1755. // },
  1756. getPdf: function (model) {
  1757. // return reportService.one('getPdf', {});
  1758. return reportService.one('getPdf', model, {});
  1759. },
  1760. };
  1761. }]);
  1762. // app.factory('NxreportRestangular', function(Restangular) {
  1763. // return Restangular.withConfig(function(RestangularConfigurer) {
  1764. // RestangularConfigurer.setBaseUrl(serverIp);
  1765. // });
  1766. // });
  1767. // app.factory('api_report_nx', ['NxreportRestangular', function(NxreportRestangular) {
  1768. // var nxreport = NxreportRestangular.all("reportPoc");
  1769. // return {
  1770. // fetchDataList: function(data, rptId) {
  1771. // return nxreport.customPOST(data, 'fetchDataList/incidentClassify', {});
  1772. // }
  1773. // }
  1774. // }]);
  1775. app.factory('ReportRestangular', function (Restangular) {
  1776. return Restangular.withConfig(function (RestangularConfigurer) {
  1777. //RestangularConfigurer.setBaseUrl('http://127.0.0.1:9005/api/cmdb/');
  1778. RestangularConfigurer.setBaseUrl(reportIp + ':8080/saiku/rest');
  1779. // RestangularConfigurer.setBaseUrl(serverIp + ':8888/saiku/rest');
  1780. //saiku/rest/saiku/api/query/execute/
  1781. });
  1782. });
  1783. app.factory('api_report', ['ReportRestangular', 'Restangular', function (MonitorRestangular, Restangular) {
  1784. // var reportService = MonitorRestangular.all("saiku/api");
  1785. var authService = MonitorRestangular.one("saiku/session");
  1786. return {
  1787. getLicenseKey: function () {
  1788. // return Restangular.one('assets/').customGET('api/reportToken.js');
  1789. },
  1790. // auth: function(){
  1791. // return authService.customPOST('username=admin&password=admin&language=zh'
  1792. // ,'', {}, {'Content-Type': 'application/x-www-form-urlencoded'});
  1793. // },
  1794. // session: function(){
  1795. // return authService.customGET('');
  1796. // },
  1797. list: function () {
  1798. return reportService.customGET('repository?type=saiku');
  1799. /**
  1800. /saiku/api/repository
  1801. path: /homes/home:admin/itsm_reports
  1802. */
  1803. },
  1804. getMdx: function (path, uuid) {
  1805. var rdata = 'file=' + path + '&formatter=flattened&language=zh';
  1806. return reportService.customPOST(rdata, 'query/' + uuid, {}, {
  1807. 'Content-Type': 'application/x-www-form-urlencoded'
  1808. });
  1809. },
  1810. execute: function (data) {
  1811. return reportService.customPOST(data, 'query/execute', {}, {
  1812. 'Accept': 'application/json, text/javascript, */*'
  1813. });
  1814. },
  1815. exportData: function (reportView, uuid, reportfileName) {
  1816. return reportService.one('query/rest/export/xls/?exportname=' + reportfileName + 'xls');
  1817. }
  1818. };
  1819. }]);
  1820. // 首页仪表盘
  1821. app.factory('ReportnewRestangular', function (Restangular) {
  1822. return Restangular.withConfig(function (RestangularConfigurer) {
  1823. RestangularConfigurer.setBaseUrl(serverIp + '/report');
  1824. });
  1825. })
  1826. // 首页仪表盘
  1827. app.factory('api_newreport', ['ReportnewRestangular', function (ReportnewRestangular) {
  1828. var hcService = ReportnewRestangular.all("data");
  1829. return {
  1830. // 事件解决率
  1831. fetchDataList: function (model, data) {
  1832. return hcService.customPOST(data, 'fetchDataList/' + model, {})
  1833. },
  1834. // 首页仪表盘
  1835. addDictionary: function (data) {
  1836. return hcService.customPOST(data, 'addDictionary', {})
  1837. },
  1838. // 首页仪表盘
  1839. upDictionary: function (data) {
  1840. return hcService.customPOST(data, 'upDictionary', {})
  1841. },
  1842. }
  1843. }]);
  1844. // 月度任务导出
  1845. app.factory('TaskRestangular', function (Restangular) {
  1846. return Restangular.withConfig(function (RestangularConfigurer) {
  1847. // RestangularConfigurer.setBaseUrl("http://168.166.3.41"+':9008/api/');
  1848. RestangularConfigurer.setBaseUrl(serverIp + '/task');
  1849. });
  1850. });
  1851. app.factory('api_task_export', ['TaskRestangular', function (TaskRestangular) {
  1852. var dataService = TaskRestangular.all("data");
  1853. return {
  1854. taskExport: function (model, dataId) {
  1855. return dataService.one(model + '/' + dataId);
  1856. },
  1857. // 任务清单
  1858. yearListSee: function (year, month) {
  1859. return dataService.customGET('previewTask/' + year + '/' + month);
  1860. },
  1861. // 任务清单导出
  1862. yearListExport: function (year, month) {
  1863. return dataService.one('exportTask' + '/' + year + '/' + month);
  1864. }
  1865. };
  1866. }]);
  1867. // 文档管理接口
  1868. app.factory('DocRestangular', function (Restangular) {
  1869. return Restangular.withConfig(function (RestangularConfigurer) {
  1870. // RestangularConfigurer.setBaseUrl("http://168.166.3.41"+':9008/api/');
  1871. RestangularConfigurer.setBaseUrl(serverIp + '/doc');
  1872. });
  1873. });
  1874. app.factory('api_doc_data', ['DocRestangular', function (DocRestangular) {
  1875. var dataService = DocRestangular.all("data");
  1876. return {
  1877. // 删除历史版本
  1878. delileVersion: function (data) {
  1879. return dataService.customPOST(data, 'delileVersion', {});
  1880. },
  1881. // 引入文件
  1882. insertIndexFile: function (data) {
  1883. return dataService.customPOST(data, 'insertIndexFile', {});
  1884. },
  1885. // 搜索统一接口
  1886. selectContent: function (data) {
  1887. return dataService.customPOST(data, 'selectContent', {});
  1888. },
  1889. // 文件历史读取
  1890. fileVersion: function (data) {
  1891. return dataService.customPOST(data, 'fileVersion', {});
  1892. },
  1893. // 文件下载
  1894. download: function (data) {
  1895. return dataService.one('downloadFile')
  1896. },
  1897. // 文件更新
  1898. newDoc: function (fileId) {
  1899. return dataService.one('updateFile')
  1900. },
  1901. // 文件导入
  1902. uploadDoc: function (docId) {
  1903. return dataService.one('importFile', docId)
  1904. },
  1905. // 文件导入附带上传者id
  1906. jry_uploadDoc: function (docId, userId) {
  1907. return dataService.one('importFile' + '/' + docId + '/' + userId)
  1908. },
  1909. //文件更换目录
  1910. jry_filesChange: function (id, data) {
  1911. return dataService.customPOST(data, 'refolder/' + id, {});
  1912. },
  1913. // 索引更换目录
  1914. jry_indexesChange: function (oldId, newId, data) {
  1915. return dataService.customPOST(data, 'refolder/' + oldId + '/' + newId, {});
  1916. },
  1917. fetchDataList: function (model, data) {
  1918. return dataService.customPOST(data, 'fetchDataList/' + model, {});
  1919. },
  1920. data: function (model, data) {
  1921. return dataService.customPOST(data, model, {});
  1922. },
  1923. };
  1924. }]);
  1925. // 消息通知管理
  1926. app.factory('notificationApi', function (Restangular) {
  1927. return Restangular.withConfig(function (RestangularConfigurer) {
  1928. RestangularConfigurer.setBaseUrl(serverIp + '/bpm');
  1929. });
  1930. });
  1931. app.factory('api_notification_data', ['notificationApi', function (notificationApi) {
  1932. var dataService = notificationApi.all("data");
  1933. return {
  1934. // 获取消息通知列表
  1935. fetchDataList: function (data) {
  1936. return dataService.customPOST(data, 'fetchDataList/messageManager');
  1937. },
  1938. // 修改消息通知
  1939. updData: function (data) {
  1940. return dataService.customPOST(data, 'updData/messageManager');
  1941. }
  1942. };
  1943. }]);
  1944. // 事件报表-seimin
  1945. app.factory('eventFormApi', function (Restangular) {
  1946. return Restangular.withConfig(function (RestangularConfigurer) {
  1947. RestangularConfigurer.setBaseUrl(serverIp + '/report');
  1948. });
  1949. });
  1950. app.factory('api_event_form', ['eventFormApi', function (eventFormApi) {
  1951. var dataService = eventFormApi.all("data");
  1952. return {
  1953. // 事件总数
  1954. fetchSjzsList: function (data) {
  1955. return dataService.customPOST(data, 'mdv2_incident_repot_sum');
  1956. },
  1957. // 事件类型
  1958. fetchSjlxList: function (data) {
  1959. return dataService.customPOST(data, 'mdv2_incident_repot_type');
  1960. },
  1961. // 处理人/组
  1962. fetchClrzList: function (data) {
  1963. return dataService.customPOST(data, 'mdv2_incident_repot_handle');
  1964. },
  1965. // 三方公司
  1966. fetchSfgsList: function (data) {
  1967. return dataService.customPOST(data, 'mdv2_incident_repot_company');
  1968. },
  1969. // 区域地点
  1970. fetchQyddList: function (data) {
  1971. return dataService.customPOST(data, 'mdv2_incident_repot_area_place');
  1972. },
  1973. // 事件来源
  1974. fetchSjlyList: function (data) {
  1975. return dataService.customPOST(data, 'mdv2_incident_repot_source');
  1976. },
  1977. // 查询事件总数(单个页面只有事件数量)
  1978. getSjNum: function (data) {
  1979. return dataService.customPOST(data, 'mdv2_incident_sum');
  1980. },
  1981. // 综合统计
  1982. fetchZhtjList: function (data) {
  1983. return dataService.customPOST(data, 'mdv2_service_repot_all');
  1984. },
  1985. // 电话统计
  1986. fetchDhtjList: function (data) {
  1987. return dataService.customPOST(data, 'mdv2_service_repot_phone');
  1988. },
  1989. // 微信/WEB统计
  1990. fetchWebList: function (data) {
  1991. return dataService.customPOST(data, 'mdv2_service_repot_wechat_web');
  1992. },
  1993. // 电话留言统计
  1994. fetchDhlytjList: function (data) {
  1995. return dataService.customPOST(data, 'mdv2_service_repot_msg');
  1996. }
  1997. };
  1998. }]);
  1999. // 服务台分析-seimin
  2000. app.factory('deckReportApi', function (Restangular) {
  2001. return Restangular.withConfig(function (RestangularConfigurer) {
  2002. RestangularConfigurer.setBaseUrl(serverIp + '/report');
  2003. });
  2004. });
  2005. app.factory('api_deck_report', ['deckReportApi', function (deckReportApi) {
  2006. var dataService = deckReportApi.all("data");
  2007. return {
  2008. // 来电总数
  2009. fetchLdzsNumList: function (data) {
  2010. return dataService.customPOST(data, 'service_phone_total');
  2011. },
  2012. };
  2013. }]);
  2014. // 登录后判断版本-seimin
  2015. app.factory('isCategoryApi', function (Restangular) {
  2016. return Restangular.withConfig(function (RestangularConfigurer) {
  2017. RestangularConfigurer.setBaseUrl(serverIp + '/sysinfo');
  2018. });
  2019. });
  2020. app.factory('api_is_category', ['isCategoryApi', function (isCategoryApi) {
  2021. var dataService = isCategoryApi.all("data");
  2022. return {
  2023. //判断处理人、处理科室seimin
  2024. isCategory: function (data) {
  2025. return dataService.customPOST(data, 'fetchDataList/systemConfiguration');
  2026. }
  2027. };
  2028. }]);
  2029. // 搜索科室列表-seimin
  2030. app.factory('searchKs', function (Restangular) {
  2031. return Restangular.withConfig(function (RestangularConfigurer) {
  2032. RestangularConfigurer.setBaseUrl(serverIp + '/user');
  2033. });
  2034. });
  2035. app.factory('api_search_ks', ['searchKs', function (searchKs) {
  2036. var dataService = searchKs.all("data");
  2037. return {
  2038. //获取科室列表
  2039. getKsList: function (data) {
  2040. return dataService.customPOST(data, 'fetchDataList/department');
  2041. }
  2042. };
  2043. }]);
  2044. // 搜索故障地点seimin
  2045. app.factory('searchArea', function (Restangular) {
  2046. return Restangular.withConfig(function (RestangularConfigurer) {
  2047. RestangularConfigurer.setBaseUrl(serverIp + '/apply');
  2048. });
  2049. });
  2050. app.factory('api_search_area', ['searchArea', function (searchArea) {
  2051. var dataService = searchArea.all("bpm");
  2052. return {
  2053. //获取故障地点
  2054. getAreaList: function (data) {
  2055. return dataService.customPOST(data, 'searchFaultLocation');
  2056. }
  2057. };
  2058. }]);
  2059. // 微信配置查询接口seimin
  2060. app.factory('wechatConfig', function (Restangular) {
  2061. return Restangular.withConfig(function (RestangularConfigurer) {
  2062. RestangularConfigurer.setBaseUrl(serverIp + '/wechat');
  2063. });
  2064. });
  2065. app.factory('api_wechat_operate', ['wechatConfig', function (wechatConfig) {
  2066. var dataService = wechatConfig.all("data");
  2067. return {
  2068. //获取微信配置信息
  2069. getWechatList: function (data) {
  2070. return dataService.customPOST(data, 'fetchDataList/wechatConfig');
  2071. },
  2072. //修改微信配置
  2073. postWxList: function (data) {
  2074. return dataService.customPOST(data, 'addData/wechatConfig');
  2075. }
  2076. };
  2077. }]);
  2078. // 微信配置获取角色seimin
  2079. app.factory('wxRole', function (Restangular) {
  2080. return Restangular.withConfig(function (RestangularConfigurer) {
  2081. RestangularConfigurer.setBaseUrl(serverIp + '/user');
  2082. });
  2083. });
  2084. app.factory('api_wx_role', ['wxRole', function (wxRole) {
  2085. var dataService = wxRole.all("data");
  2086. return {
  2087. //获取微信配置获取角色
  2088. getWxRole: function (data) {
  2089. return dataService.customPOST(data, 'fetchDataList/role');
  2090. }
  2091. };
  2092. }]);
  2093. // CMDB打印
  2094. app.factory('cmdbPrit', function (Restangular) {
  2095. return Restangular.withConfig(function (RestangularConfigurer) {
  2096. RestangularConfigurer.setBaseUrl(serverIp + '/cmdb');
  2097. });
  2098. });
  2099. app.factory('api_cmdb_print', ['cmdbPrit', function (cmdbPrit) {
  2100. var dataService = cmdbPrit.all("ci");
  2101. return {
  2102. //CMDB打印
  2103. getCmdbPrit: function (data) {
  2104. return dataService.customGET('qrcode/' + data);
  2105. }
  2106. };
  2107. }]);