123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413 |
- var app = angular.module('itsmApp', ['itsm-dep']);
- // var serverIp = "http://testncc.hust.edu.cn/s111ervice";
- // var serviceip = "http://pass.hust.edu.cn/cas/logout.jsp?redirectUrl=http://115.156.150.70:8080";
- // var servicewechatip = "http://115.156.150.70:8080/requester/#/tab/dashboard";
- // var reportIp = "http://115.156.150.117";
- // var inspectIp = "http://192.168.77.57";
- // var callIp = "http://192.168.77.57:8088";
- // var serverIp = "http://localhost:80/service";//跟其他有关
- //var serverIp = "http://218.197.116.228:8880/service";//跟其他有关
- //var serverIp = "http://218.197.116.230:8880/service";
- var serverIp = "http://itsm.whut.edu.cn/service";
- // var serverIp = "http://localhost/service";
- // var serverIp = "http://218.197.116.228:8080/service";//跟其他有关
- // var serverIp = "http://dstech.vipgz1.idcfengye.com"; //"http://218.197.181.211";
- // var reportIp = "http://localhost:80/service";//跟报表有关
- //var reportIp = "http://218.197.116.228:8880/service";//跟报表有关
- var reportIp = "http://itsm.whut.edu.cn/service";
- var inspectIp = "http://172.30.3.243:8080";
- // var reportIp = "http://localhost:8880/service";
- //var inspectIp = "http://218.197.116.230:8880";
- // var reportIp = "http://218.197.116.228:8080/service";//跟报表有关
- // var inspectIp = "http://172.30.3.243:8080";
- // var serviceip = "http://pass.hust.edu.cn/cas/logout.jsp?redirectUrl=http://115.156.150.70:8080";
- // var wechatIp = "http://wechat.tunnel.dashitech.com";
- var callIp = "http://172.30.3.243:8080";
- // var callIp = "http://218.197.116.228:8080/service";
- app.run(['$rootScope', '$state', '$stateParams', '$auth', '$http', '$cookieStore', 'Restangular',
- function($rootScope, $state, $stateParams, $auth, $http, $cookieStore, Restangular) {
- // Attach Fastclick for eliminating the 300ms delay between a physical tap and the firing of a click event on mobile browsers
- FastClick.attach(document.body);
- // Set some reference to access them from any scope
- $rootScope.$state = $state;
- $rootScope.$stateParams = $stateParams;
- // GLOBAL APP SCOPE
- // set below basic information
- // $rootScope.audioiIp="http://218.197.181.213:8080"
- $rootScope.app = {
- name: '网络与信息化运维管理系统', // name of your project
- author: '网络与信息化运维管理系统', // author's name or company name
- description: '网络与信息化运维管理系统 V2.0', // brief description
- version: 'V2.0', // current version
- year: ((new Date()).getFullYear()), // automatic current year (for copyright information)
- isMobile: (function() { // true if the browser is a mobile device
- var check = false;
- if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
- check = true;
- };
- return check;
- })(),
- isChrome: false,
- isLoginFixed: false,
- layout: {
- // isLoginFixed: true,
- isNavbarFixed: true, //true if you want to initialize the template with fixed header
- isSidebarFixed: true, // true if you want to initialize the template with fixed sidebar
- isSidebarClosed: false, // true if you want to initialize the template with closed sidebar
- isFooterFixed: false, // true if you want to initialize the template with fixed footer
- theme: 'theme-8', // indicate the theme chosen for your project
- logo: 'assets/images/logo.png' // relative path of the project logo
- }
- };
- // $http.defaults.headers.common["X-Auth-Token"] = $cookieStore.get('Auth-Token') || null;
- // $http.defaults.headers.common["X-Auth-Token"] = $cookieStore.get('Auth-Token') || null;
- Restangular.setErrorInterceptor(function(element, operation, what, url, headers, queryParams) {
- if (!url) {
- // console.log($http);
- // console.log($auth);
- if (element.config.url ==
- "http://testncc.hust.edu.cn/service/bpm/data/getCount"
- ) {
- window.location.href = serviceip;
- document.getElementById("casUserId").value = null;
- }
- }
- // console.log(element);
- })
- Restangular.setFullRequestInterceptor(function(element, operation, what, url, headers, queryParams) {
- var token = $cookieStore.get('Auth-Token') || null;
- var isReportUri = url.indexOf('saiku') > 0;
- if (token && isReportUri) {
- return {
- element: element,
- params: queryParams,
- headers: _.extend({}, headers, { 'X-Auth-Token': $cookieStore.get('Auth-Token') || null })
- };
- } else {
- return {
- element: element,
- params: queryParams,
- headers: headers
- };
- }
- });
- Restangular.addResponseInterceptor(function(data, operation, what, url, response, deferred) {
- var ua = window.navigator.userAgent.toLowerCase();
- ua.match(/chrome/i)
- if (data) {
- if (data.state == "433") {
- $rootScope.logout();
- var Notification = window.Notification;
- Notification.requestPermission();
- sessionStorage.clear();
- data = {};
- var n = new Notification("登录退出", {
- body: "您的账号在其他地方登录,请确认后重新登录",
- icon: '../bower_components/HTML5-Desktop-Notifications/alert.ico',
- onclick: function onNotificationClicked() {
- console.log('Notification clicked.');
- }
- });
- } else if (data.state == "403") {
- $state.go("app.dashboard");
- var Notification = window.Notification;
- Notification.requestPermission();
- var n = new Notification("无权限访问", {
- body: "此页面无权限访问",
- icon: '../bower_components/HTML5-Desktop-Notifications/alert.ico',
- onclick: function onNotificationClicked() {
- console.log('Notification clicked.');
- }
- });
- } else {
- deferred.resolve(data)
- }
- }
- });
- // $rootScope.nickname ='lijin';
- // $rootScope.user = {
- // name: 'Peter',
- // job: 'ng-Dev',
- // picture: 'app/img/user/02.jpg'
- // };
- }
- ]);
- // translate config
- app.config(['$translateProvider',
- function($translateProvider) {
- // prefix and suffix information is required to specify a pattern
- // You can simply use the static-files loader with this pattern:
- $translateProvider.useStaticFilesLoader({
- prefix: 'assets/i18n/',
- suffix: '.json'
- });
- // Since you've now registered more then one translation table, angular-translate has to know which one to use.
- // This is where preferredLanguage(langKey) comes in.
- $translateProvider.preferredLanguage('zh');
- // Store the language in the local storage
- $translateProvider.useLocalStorage();
- }
- ]);
- // Angular-Loading-Bar
- // configuration
- app.config(['cfpLoadingBarProvider',
- function(cfpLoadingBarProvider) {
- cfpLoadingBarProvider.includeBar = true;
- cfpLoadingBarProvider.includeSpinner = false;
- }
- ]);
- /**
- * // http: //115.156.150.70:9680/webservice/data/fetchDataList/queryUser
- */
- //信息中心 --wt
- app.factory('msgRestangular', function (Restangular) {
- return Restangular.withConfig(function (RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/messageStation');
- });
- });
- app.factory('api_msg', ['msgRestangular', function (msgRestangular) {
- var msgService = msgRestangular.all("data");
- return {
- msgDataList: function (data) {
- return msgService.customPOST(data, 'fetchDataList/messageStation', {});
- },
- updateDataList: function (data) {
- return msgService.customPOST(data, 'updateModel/messageStation', {});
- },
- };
- }]);
- /**
- * // http: //115.156.150.70:9680/api/webservice/data/fetchDataList/queryUser
- */
- app.config(['RestangularProvider', function(RestangularProvider) {
- RestangularProvider.setBaseUrl('');
- }]);
- app.factory('serviceip', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serviceip);
- });
- });
- app.factory('WechatRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/common/');
- });
- });
- // 事件分类
- app.factory('eventCategory',function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/bpm/data/');
- });
- });
- app.factory('api_wechatfile', ['WechatRestangular', function(WechatRestangular) {
- var dataService = WechatRestangular.all("common");
- return {
- listAttachments: function(type, model) {
- return dataService.customGET('listAttachment/' + type + "/" + model, {});
- // return dataService.one('listAttachment/' + type + "/" + model);
- },
- downloadAttachment: function(model) {
- return dataService.one('downloadAttachment/' + model, {});
- },
- attachmentsPreviewUrl: function(attachmentId) {
- return dataService.customGET('attachmentsPreviewUrl/' + attachmentId);
- },
- download: function(attachmentId) {
- return dataService.one('getAttachmentContent/' + attachmentId);
- },
- getDictionary: function(data) {
- return dataService.customPOST(data, 'getDictionary', {});
- }
- };
- }]);
- app.factory('webserviceRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/webservice/');
- });
- });
- app.factory('api_webservice', ['webserviceRestangular', function(webserviceRestangular) {
- var dataService = webserviceRestangular.all("data");
- return {
- fetchDataList: function(model, data) {
- return dataService.customPOST(data, 'fetchDataList/' + model, {});
- }
- };
- }]);
- app.factory('playRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(callIp);
- });
- });
- app.factory('api_playservice', ['playRestangular', function(playRestangular) {
- var dataService = playRestangular.all("recording");
- return {
- playData: function(attachmentId) {
- return dataService.customGET('recording?callID=' + attachmentId);
- },
- };
- }]);
- app.factory('ConversationRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/conversation/');
- });
- });
- app.factory('api_conversation', ['ConversationRestangular', function(ConversationRestangular) {
- var dataService = ConversationRestangular.all("conversation");
- return {
- roleMenu: function(model) {
- return dataService.customGET('roleMenu/' + model, {});
- },
- pageMenuByCode: function(model) {
- return dataService.customGET('pageMenuByCode/' + model, {});
- },
- pageEvent: function(data, model) {
- return dataService.customPOST(data, 'pageEvent', {});
- }
- };
- }]);
- // 报表数据请求 --wt
- app.factory('WtReportRestangular', function (Restangular) {
- return Restangular.withConfig(function (RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(reportIp + '/report');
- });
- });
- app.factory('api_wt_report', ['WtReportRestangular', 'Restangular', function (MonitorRestangular, Restangular) {
- var dataService = MonitorRestangular.all("data/fetchDataList");
- var dataService2 = MonitorRestangular.all("data/alarmReport");
- var exportService = MonitorRestangular.all("data");
- return {
- reportData: function (data, model) {
- return dataService.customPOST(data, model);
- },
- exportData1111: function (data, model) {
- return exportService.one("export/" + model);
- // return dataService.one('downDataModel/' + type + '/' + month);
- },
- pieData: function () {
- return dataService2.customGET('month/incidentStatus');
- }
- }
- }]);
- app.factory('textRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- // RestangularConfigurer.setBaseUrl(inspectIp + ':8080/IXServer/');
- RestangularConfigurer.setBaseUrl(inspectIp + '/IXServer/');
- });
- });
- app.factory('api_text', ['textRestangular', function(textRestangular) {
- var loginService = textRestangular.all("comm");
- var loginsins = textRestangular.all("tele/agent");
- return {
- start: function(phone, id) {
- var rdata = "dom=0&epwd=&aid=" + id + "&apwd=e10adc3949ba59abbe56e057f20f883e&adn=" + phone;
- return loginService.customPOST(rdata, 'start', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- exit: function(token) {
- var rdata = "dom=0&token=" + token;
- return loginService.customPOST(rdata, 'exit', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- login: function(group, token, id) {
- var rdata = "dom=0&token=" + token + "&aid=" + id + "&acd=" + group + "&skill=-1&mon=false&silent=false";
- return loginsins.customPOST(rdata, 'login', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- logout: function(token, id) {
- var rdata = "dom=0&token=" + token + "&aid=" + id + "";
- return loginsins.customPOST(rdata, 'logout', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- dialout: function(token, gid, teleno) {
- var rdata = "dom=0&token=" + token + "&teleno=" + teleno + "&gid=" + gid + "&uud=&async=true";
- return loginsins.customPOST(rdata, 'dialout', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- callout: function(token, teleno) {
- var rdata = "dom=0&token=" + token + "&teleno=" + teleno + "&uud=&async=true";
- return loginsins.customPOST(rdata, 'dialout', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- setbusy: function(token) {
- var rdata = "dom=0&token=" + token;
- return loginsins.customPOST(rdata, 'setbusy', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- setidle: function(token) {
- var rdata = "dom=0&token=" + token;
- return loginsins.customPOST(rdata, 'setidle', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- inittrans: function(telephone, token) {
- var rdata = "dom=0&token=" + token + "&teleno=" + telephone + "&uud=&async=true";
- return loginsins.customPOST(rdata, 'inittrans', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- comptrans: function(telephone, token) {
- var rdata = "dom=0&token=" + token;
- return loginsins.customPOST(rdata, 'comptrans', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- record: function(token) {
- var rdata = "dom=0&token=" + token + "&filename=/tmp/agent.wav&async=true&maxtime=10&termchar=&append=true";
- return loginsins.customPOST(rdata, 'record', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- offhook: function(token) {
- var rdata = "dom=0&token=" + token;
- return loginsins.customPOST(rdata, 'offhook', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- onhook: function(token) {
- var rdata = "dom=0&token=" + token;
- return loginsins.customPOST(rdata, 'onhook', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- },
- getcdrid: function(token) {
- var rdata = "dom=0&token=" + token;
- return loginsins.customPOST(rdata, 'getcdrid', {}, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' });
- }
- }
- }])
- app.factory('UserRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp);
- });
- });
- app.factory('api_user', ['UserRestangular', function(UserRestangular) {
- var basePath = UserRestangular.all("user/data");
- return {
- fetchDataList:function(model, data){
- return basePath.customPOST(data, 'fetchDataList/' + model, {});
- },
- };
- }]);
- app.factory('api_report_data', ['UserRestangular', function(UserRestangular) {
- var basePath = UserRestangular.all("report/report/");
- // var jry_basePath = UserRestangular.all("report/data/");
- return {
- // jry_fetchDataList:function(model, data){
- // return jry_basePath.customPOST(data, 'fetchDataList/' + model, {});
- // },
- fetchDataList:function(model, data){
- return basePath.customPOST(data, 'fetchDataList/' + model, {});
- },
- report:function(model, data){
- return basePath.customPOST(data, model, {});
- },
- addModel:function(model, data){
- return basePath.customPOST(data, 'addModel/' +model, {});
- },
- updateModel:function(model, data){
- return basePath.customPOST(data, 'updateModel/' +model, {});
- },
- rmModels:function(model, id){
- return basePath.customPOST(null, 'rmModels/' +id+'/'+model, {});
- },
- };
- }]);
- app.factory('api_login', ['UserRestangular', function(UserRestangular) {
- var loginService = UserRestangular.all("auth");
- return {
- login: function(username, password) {
- return loginService.customPOST( username, 'login', {});
- },
- // logout: function(sessionid,userid){
- // return loginService.customPOST(sessionid + '/' + userid);
- // },
- sso: function(nickname) {
- return loginService.customGET('sso/' + nickname);
- },
- resetpwd: function(userid) {
- return loginService.customGET('resetpwd/' + userid);
- },
- uppwd: function(data) {
- return loginService.customPOST(data, 'uppwd', {});
- }
- }
- }])
- app.factory('applyRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/apply/');
- });
- });
- app.factory('api_apply', ['applyRestangular', function(applyRestangular) {
- var applyService = applyRestangular.all("bpm");
- return {
- wxIncidentReject: function(id, data) {
- return applyService.customPOST(data, 'wxIncidentReject/' + id, {});
- }
- }
- }])
- app.factory('api_user_data', ['UserRestangular', function(UserRestangular) {
- var dataService = UserRestangular.all("user/data");
- var userService = UserRestangular.all("auth");
- return {
- validate: function(data) {
- return dataService.customPOST(data, 'validate/role', {});
- },
- importData: function() {
- return dataService.one('/importData');
- },
- fetchDataList: function(model, data) {
- return dataService.customPOST(data, 'fetchDataList/' + model, {});
- },
- fetchData: function(model, data) {
- return dataService.customPOST(data, 'fetchData/' + model, {});
- },
- addData: function(model, data) {
- return dataService.customPOST(data, 'addData/' + model, {});
- },
- updData: function(model, data) {
- return dataService.customPOST(data, 'updData/' + model, {});
- },
- rmvData: function(model, data) {
- return dataService.customPOST(data, 'rmvData/' + model, {});
- },
- register: function(data) {
- return dataService.customPOST(data, 'register', {});
- },
- downDataModel: function(type, month) {
- return dataService.one('downDataModel/' + type + '/' + month);
- },
- fetchgetData: function(model, data) {
- return dataService.customGET('fetchData/' + model + '/' + data, {});
- },
- roleMenu: function(model) {
- return userService.customGET('roleMenu/' + model, {});
- },
- pageMenuByCode: function(model) {
- return userService.customGET('pageMenuByCode/' + model, {});
- },
- pageEvent: function(data, model) {
- return userService.customPOST(data, 'pageEvent', {});
- },
- pageMenu: function(data, model) {
- return userService.customPOST(data, 'pageMenu', {});
- // return userService.one('/pageMenu' + data);
- },
- getMenu: function(data, model) {
- return userService.customPOST(data, 'getMenu', {});
- }
- };
- }]);
- // app.factory('DpmRestangular', function(Restangular) {
- // return Restangular.withConfig(function(RestangularConfigurer) {
- // RestangularConfigurer.setBaseUrl(serverIp+':9008/data/');
- // });
- // });
- // app.factory('api_bpm_dbca', ['DpmRestangular', function(DpmRestangular){
- // var bpm = DpmRestangular.all("bpm");
- // return {
- // impFileData: function(pdKey){
- // return bpm.customPOST( 'impFileData/' + pdKey);
- // },
- // };
- // }]);
- app.factory('BpmRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- // RestangularConfigurer.setBaseUrl("http://168.166.3.41"+':9008/api/');
- RestangularConfigurer.setBaseUrl(serverIp + '/bpm');
- });
- });
- app.factory('api_statistic', ['BpmRestangular', function(BpmRestangular) {
- var statistic = BpmRestangular.all("statistic");
- var table=BpmRestangular.all("data");
- return {
- query: function(data, rptId) {
- return statistic.customPOST(data, 'unidimensional/' + rptId, {});
- },
- // exportData: function(reportView, uuid, reportfileName){
- // return reportService.one('query/rest/export/xls/?exportname='+reportfileName+'xls');
- // }
- unidimensionalExport: function(rptId) {
- return statistic.one('unidimensionalExport/' + rptId);
- },
- tableData:function(data,rptId){
- return table.customPOST(data,'fetchDataList/' + rptId,{});
- }
- }
- }]);
- app.factory('api_bpm', ['BpmRestangular', function(BpmRestangular) {
- var process = BpmRestangular.all("process");
- var postfix = BpmRestangular.all("bpm");
- return {
- deploy: function(data) {
- return process.customPOST(data, 're/model/deploy', {});
- },
- list: function() {
- return process.customGET('re/model/list');
- },
- modelsource: function(pdId) {
- return process.customGET('re/model/' + pdId + '/source');
- },
- // savemodel: function(pdId, data) {
- // return process.customPOST(data, 're/model/' + pdId + '/save', {});
- // },
- savemodel: function(pdId, data) {
- return process.customPOST(data, 'saveModel/' + pdId, {});
- },
- removemodel: function(modelId) {
- return process.customGET('re/model/' + modelId + '/remove');
- },
- upgrade: function(data,taskId,userId,model) {
- return postfix.customPOST(data, model+'/'+taskId+'/'+userId, {});
- // return postfix.customPOST(id);
- }
- };
- }]);
- app.factory('CommonRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/common');
- });
- });
- app.factory('api_bpm_domain', ['BpmRestangular', 'CommonRestangular', function(BpmRestangular, CommonRestangular) {
- var bpmService = BpmRestangular.all("bpm");
- var commonService = CommonRestangular.all("common");
- return {
- // 附件读取--jry
- jry_listAttachments: function(filekey,processId) {
- return commonService.customGET('listAttachment/'+filekey+'/' + processId);
- },
- //事件附件下载--jry
- jry_download: function() {
- // return commonService.one('downloadAttachment/' + attachmentId);
- return commonService.one('downloadAttachment');
- },
- // 问题列表审核通过附件上传--jry
- jry_saveAttachments: function(processceId, userId, data) {
- return commonService.one('uploadAttachment/problem/'+ processceId);
- },
- fetchtask: function(pdKey, data) {
- return bpmService.customPOST(data, 'fetchTask/' + pdKey, {});
- },
- start: function(pdKey, data) {
- return bpmService.customPOST(data, 'start/' + pdKey, {});
- },
- flowTracing: function(processInstanceId, data) {
- return bpmService.customPOST(data, 'flowTracing/' + processInstanceId, {});
- },
- complete: function(taskId, userId, data) {
- return bpmService.customPOST(data, 'completeTask/' + taskId + '/' + userId, {});
- },
- completeUpgrade: function(data) {
- return bpmService.customPOST(data, 'upgradeIncident', {});
- },
- save: function(taskId, data) {
- return bpmService.customPOST(data, 'saveTaskVar/' + taskId, {});
- },
- claimtask: function(taskId, data) {
- return bpmService.customPOST(data, 'claimTask/' + taskId, {});
- },
- claimAndCompletedTask: function(taskId, data) {
- return bpmService.customPOST(data, 'claimAndCompletedTask/' + taskId, {});
- },
- delegateTask: function(taskId, data) {
- return bpmService.customPOST(data, 'delegateTask/' + taskId, {});
- },
- expectedTime: function(taskId) {
- return bpmService.customGET('expectedTime/' + taskId);
- },
- history: function(processId) {
- return bpmService.customGET('history/' + processId);
- },
- // upgrade: function(processInstanceId, taskId, data) {
- // return bpmService.customPOST(data, 'upgradeIncident/' + processInstanceId + '/' + taskId, {});
- // },
- listAttachments: function(processId, data) {
- return bpmService.customPOST(data, 'getAttachmentList/' + processId, {});
- },
- saveAttachments: function(processId, taskId, userId, data) {
- return bpmService.one('saveAttachments/' + processId + '/' + taskId + '/' + userId);
- },
- uploadAttachment: function(filekey,processId, taskId, userId, data) {
- return commonService.one('uploadAttachment/' + filekey +'/'+ processId);
- },
- download: function(attachmentId) {
- return bpmService.one('getAttachmentContent/' + attachmentId);
- },
- // download: function(attachmentId){
- // return bpmService.customGET('getAttachmentContent/' + attachmentId,{},{'responseType':'arraybuffer'});
- // },
- attachmentsPreviewUrl: function(attachmentId) {
- return bpmService.customGET('attachmentsPreviewUrl/' + attachmentId);
- },
- startformkey: function(pdKey) {
- return bpmService.customGET('startformkey/' + pdKey);
- },
- taskformkey: function(taskId) {
- return bpmService.customGET('taskformkey/' + taskId);
- },
- workernumber: function(type) {
- return bpmService.customGET('restful/' + type);
- },
- getWatchAreaPosition: function(data) {
- return bpmService.customGET('getWatchAreaPosition');
- },
- getWatchAreaData: function(id) {
- return bpmService.customGET('getWatchAreaData/' + id);
- }
- };
- }]);
- app.factory('api_bpm_data', ['BpmRestangular', function(BpmRestangular) {
- var dataService = BpmRestangular.all("data");
- var serviceCatalogue = BpmRestangular.all("ServiceCatalogue");
- var inspectionProcessActual = BpmRestangular.all("InspectionProcessActual");
- return {
- impFileData: function() {
- return dataService.one('/impFileData/bpm_scheduleorder');
- },
- importData: function() {
- return dataService.one('/impFileData');
- },
- fetchDataList: function(model, data) {
- return dataService.customPOST(data, 'fetchDataList/' + model, {});
- },
- fetchData: function(model, dataId) {
- return dataService.customGET('fetchData/' + model + '/' + dataId);
- },
- fetchServiceTasks: function(model, data) {
- if (!model) {
- model = "ALL"
- }
- return serviceCatalogue.customPOST(data, 'fetchServiceTasks/' + model, {});
- },
- fetchInspectServiceTasks: function(model, data) {
- if (!model) {
- model = "ALL"
- }
- return inspectionProcessActual.customPOST(data, 'fetchServiceTasks/' + model, {});
- },
- addData: function(model, data) {
- return dataService.customPOST(data, 'addData/' + model, {});
- },
- updData: function(model, data) {
- return dataService.customPOST(data, 'updData/' + model, {});
- },
- rmvData: function(model, data) {
- return dataService.customPOST(data, 'rmvData/' + model, {});
- },
- getCount: function(data) {
- return dataService.customPOST(data, 'getCount', {});
- },
- downDataModel: function(type, month) {
- return dataService.one('downDataModel/' + type + '/' + month);
- },
- fetchDataByGroupId: function(data) {
- return dataService.customPOST(data, 'fetchDataByGroupId', {});
- },
- // downDataModel: function(type, month, data) {
- // return dataService.customPOST(data, 'downDataModel/' + type + '/' + month, {}, { 'Accept': 'application/json, text/javascript, */*' });
- // }
- };
- }]);
- app.factory('api_bpm_schedule', ['BpmRestangular', function(BpmRestangular) {
- var dataService = BpmRestangular.all("data");
- return {
- getScheduleClass: function() {
- var data = {
- "idx": "0",
- "sum": "10"
- };
- return dataService.customPOST(data, 'fetchDataList/scheduleclass', {});
- },
- fetchList: function(startTime, endTime, userId, queryKey) {
- var scheduleOrder = {
- "scheduleorder": {
- "startTime": startTime,
- "endTime": endTime
- },
- "idx": "0",
- "sum": "1000"
- };
- if (userId) {
- scheduleOrder['scheduleorder']['user'] = userId;
- }
- if (queryKey) {
- scheduleOrder['scheduleorder']['description'] = queryKey;
- }
- return dataService.customPOST(scheduleOrder, 'fetchDataList/scheduleorder', {});
- },
- fetchData: function(dataId) {
- return dataService.customGET('fetchData/scheduleorder/' + dataId);
- },
- update: function(data) {
- return dataService.customPOST(data, 'updData/scheduleorder', {});
- },
- add: function(data) {
- return dataService.customPOST(data, 'addData/scheduleorder', {});
- },
- remove: function(data) {
- return dataService.customPOST(data, 'rmvData/scheduleorder', {});
- },
- fetchSchedule: function(userId, startTime, endTime) {
- var scheduleData = {
- "schedulewatch": {
- "type": "1",
- "user": {
- "id": userId
- },
- "startTime": startTime,
- "endTime": endTime
- },
- "idx": "0",
- "sum": "100"
- };
- return dataService.customPOST(scheduleData, 'fetchDataList/schedulewatch', {});
- },
- queryRecieveSwitch: function(userId) {
- var handleSwitch = {
- "schedulewatch": {
- "type": "3",
- "user": {
- "id": userId
- }
- },
- "idx": "0",
- "sum": "10"
- };
- return dataService.customPOST(handleSwitch, 'fetchDataList/schedulewatch', {});
- },
- queryHandleoutSwitch: function(userId) {
- var handleSwitch = {
- "schedulewatch": {
- "type": "2",
- "user": {
- "id": userId
- }
- },
- "idx": "0",
- "sum": "10"
- };
- return dataService.customPOST(handleSwitch, 'fetchDataList/schedulewatch', {});
- },
- handleSchedule: function(data) {
- return dataService.customPOST(data, 'updData/schedulewatch', {});
- },
- querySwitch: function(filterData) {
- var switchData = {
- "scheduleorder": {
- "type": "4"
- },
- "idx": filterData.idx,
- "sum": filterData.sum
- };
- return dataService.customPOST(switchData, 'fetchDataList/scheduleorder', {});
- },
- query: function(filterData) {
- var switchData = {
- "scheduleorder": filterData.scheduleorder,
- "idx": filterData.idx,
- "sum": filterData.sum
- };
- return dataService.customPOST(switchData, 'fetchDataList/scheduleorder', {});
- }
- };
- }]);
- app.factory('SysinfoRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/sysinfo/');
- });
- });
- app.factory('api_sysinfo', ['SysinfoRestangular', function(SysinfoRestangular) {
- var dataService = SysinfoRestangular.all("data");
- return {
- fetchDataList: function(model, data) {
- return dataService.customPOST(data, 'fetchDataList/' + model, {});
- },
- addData: function(model, data) {
- return dataService.customPOST(data, 'addData/' + model, {});
- },
- getSerialnumber: function(type, model) {
- return dataService.customGET('getSerialnumber/' + type + '/' + model);
- }
- };
- }]);
- app.factory('ConfigureRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp);
- });
- });
- app.factory('api_configure_form', ['ConfigureRestangular', function(ConfigureRestangular) {
- var formService = ConfigureRestangular.all("form");
- // var formService = ConfigureRestangular.all("bpm/data");
- return {
- renderForm: function(formKey, userId, processInstanceId) {
- if (processInstanceId) {
- return formService.customGET('renderForm/' + formKey + "/" + processInstanceId + "/" + userId);
- } else {
- return formService.customGET('renderForm/' + formKey + "/000000/" + userId);
- }
- },
- renderList: function(formKey) {
- return formService.customGET('renderList/' + formKey);
- },
- renderTabForm: function(classify) {
- return formService.customGET('renderTabForm/' + classify);
- }
- };
- }]);
- app.factory('api_configure_data', ['ConfigureRestangular', function(ConfigureRestangular) {
- var dataService = ConfigureRestangular.all("data");
- return {
- fetchDataList: function(model, data) {
- return dataService.customPOST(data, 'fetchDataList/' + model, {});
- },
- linkConfigure: function(model, data) {
- return dataService.customPOST(data, 'linkConfigure/' + model, {});
- },
- fetchDataById: function(model, id) {
- return dataService.customGET('fetchData/' + id + '/' + model);
- },
- fetchData: function(model, data) {
- return dataService.customPOST(data, 'fetchData/' + model, {});
- },
- addData: function(model, data) {
- return dataService.customPOST(data, 'addData/' + model, {});
- },
- rmvData: function(model, data) {
- return dataService.customPOST(data, 'rmvData/' + model, {});
- },
- updData: function(model, data) {
- return dataService.customPOST(data, 'updData/' + model, {});
- },
- downModels: function(type, id, name) {
- return dataService.one('export/' + type + '/' + id + '/' + name);
- }
- };
- }]);
- //知识库新接口--jry
- app.factory('ZSKXJKJRY', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/solution');
- });
- });
- app.factory('api_zsk', ['ZSKXJKJRY', function(ZSKXJKJRY) {
- //http://127.0.0.1:9004/services/ftpFile/monitor/bankTip/
- var dataList = ZSKXJKJRY.all("fetchDataList");
- var quote = ZSKXJKJRY.all('solutionQuote');//知识库引用
- return {
- jry_getIncident_list: function(data) {
- return dataList.customPOST(data,"solutionType",{});
- },
- jry_get_list: function(data,key) {
- return dataList.customPOST(data, key, {});
- },
- jry_form_getType: function(data,key) {
- return dataList.customPOST({"idx":0,"sum":10000}, "solutionType", {});
- },
- solutionData: function (data, key) {
- return dataList.customPOST(data, key, {});
- },
- solutionQuote: function (id) {
- return quote.customGET(id)
- }
- };
- }]);
- //知识库附件下载
- app.factory('jry_baseUrl', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp);
- });
- });
- app.factory('jry_up_down_file', ['jry_baseUrl', function(baseUrl) {
- var upDownFile = baseUrl.all("");
- return {
- //附件上传新接口
- listAttachment: function(upUrl, bindType, bindId) {
- return upDownFile.customGET(upUrl + '/' + bindType + '/' + bindId);
- },
- listAttachments: function(upUrl, bindType, bindId) {
- return upDownFile.customGET(upUrl + '/' + bindType + '/' + bindId);
- },
- saveAttachments: function(upUrl, bindType, bindId) {
- return upDownFile.one(upUrl + '/' + bindType + '/' + bindId);
- },
- downloadAttachment: function(upUrl, token) {
- // return upDownFile.one(upUrl + '/' + token);
- return upDownFile.one(upUrl+"");
- },
- removeAttachment: function(upUrl, token) {
- return upDownFile.one(upUrl + '/' + token);
- }
- };
- }]);
- // 登出
- app.factory('jry_loginOut', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp );
- });
- });
- app.factory('jry_out', ['jry_loginOut', function(jry_loginOut) {
- var jry_getOut = jry_loginOut.all("auth");
- return {
- jry_remove: function(data) {
- return jry_getOut.customPOST(data, 'logout2', {});
- }
- };
- }]);
- app.factory('baseUrl', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- // RestangularConfigurer.setBaseUrl(serverIp + '/api/');
- RestangularConfigurer.setBaseUrl(serverIp);
- });
- });
- app.factory('up_down_file', ['baseUrl', function(baseUrl) {
- var upDownFile = baseUrl.all("");
- return {
- //附件上传新接口
- listAttachment: function(upUrl, bindType, bindId) {
- return upDownFile.customGET(upUrl + '/' + bindType + '/' + bindId);
- },
- listAttachments: function(upUrl, bindType, bindId) {
- return upDownFile.customGET(upUrl + '/' + bindType + '/' + bindId);
- },
- saveAttachments: function(upUrl, bindType, bindId) {
- return upDownFile.one(upUrl + '/' + bindType + '/' + bindId);
- },
- downloadAttachment: function(upUrl, token) {
- return upDownFile.one(upUrl +'');
- },
- removeAttachment: function(upUrl, token) {
- return upDownFile.one(upUrl + '/' + token);
- }
- };
- }]);
- app.factory('SolutionRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- //RestangularConfigurer.setBaseUrl('http://168.166.203.41:9000/services');
- RestangularConfigurer.setBaseUrl(serverIp + '/solution');
- });
- });
- //知识库附件上传--jry
- app.factory('Jry_SolutionRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- //RestangularConfigurer.setBaseUrl('http://168.166.203.41:9000/services');
- RestangularConfigurer.setBaseUrl(serverIp + '/common');
- });
- });
- app.factory('api_solution', ['SolutionRestangular','Jry_SolutionRestangular', function(SolutionRestangular,Jry_SolutionRestangular) {
- var solutionService = SolutionRestangular.all("solution");
- var jry_bj = SolutionRestangular.all("updData");
- var jry_getLSJL = SolutionRestangular.all("fetchDataList");
- var jry_sj = SolutionRestangular.all("getVisionNumber");
- var jry_sjup = SolutionRestangular.all("");
- var jry_FJuploda = Jry_SolutionRestangular.all("common");
- var jry_solutionService = SolutionRestangular.all("addData");
- var data = SolutionRestangular.all("solutionData");
- var history = SolutionRestangular.all("solutionHistory");
- var review = SolutionRestangular.all("solution_review");
- var typeservice = SolutionRestangular.all("solutionType");
- var groupservice = SolutionRestangular.all("solutionGroup");
- return {
- findSolutionByKeys: function(data) {
- var key = data.key,
- status = data.status || 0,
- pageIndex = data.pageIndex || 0,
- pageSum = data.pageSum,
- treeIds = data.treeIds,
- userId = data.userId;
- if (angular.isUndefined(treeIds)) {
- return solutionService.customGET('findSolutionByKeys/' + key + '/' + status + '/' + pageIndex + '/' + pageSum + '/' + userId);
- } else {
- return solutionService.customGET('findSolutionByKeys/' + key + '/' + status + '/' + pageIndex + '/' + pageSum + '/' + treeIds + '/' + userId);
- }
- },
- // searcher: function(data){
- // var queryBuilder=data.key, indexname=data.treeIds, type=data.userId;
- // return searchservice.customGET('searcher/' + queryBuilder + '/' + indexname + '/' + type );
- // },
- addSolution: function() {
- return solutionService.one('add');
- },
- addFile: function(data) {
- return solutionService.customPOST(data, 'addSolution', {});
- },
- jry_addFile: function(data) {
- return jry_solutionService.customPOST(data, 'solution', {});
- },
- addModel: function(type, data) {
- return solutionService.customPOST(data, 'addModel/' + type, {});
- },
- updModel: function(type, data) {
- return solutionService.customPOST(data, 'updModel/' + type, {});
- },
- rmModels: function(id, data) {
- return solutionService.customPOST(data, 'rmModels/' + id, {});
- },
- update: function() {
- return solutionService.one('update');
- },
- upload: function() {
- return solutionService.one('upload');
- },
- jry_upload: function(LCid) {
- return jry_FJuploda.one('uploadAttachment/solution/'+LCid);
- },
- uploadResponseUri: function() {
- return solutionService.one('/');
- },
- addNotFile: function(data) {
- return solutionService.customPOST(data, 'addNotFile', {});
- },
- // export: function(data) {
- // return solutionService.customGET(data, 'export', {});
- // },
- export: function(data) {
- return solutionService.one('export');
- },
- updateNotFile: function(data) {
- return solutionService.customPOST(data, 'updateNotFile', {});
- },
- updateSolution: function(data) {
- return solutionService.customPOST(data, 'updateSolution', {});
- },
- jry_updateSolution: function(data) {
- return jry_bj.customPOST(data, 'solution', {});
- },
- jry_leveSolution: function(data) {
- return jry_sjup.customPOST(data, 'upgrade', {});
- },
- jry_leveVision: function(id) {
- return jry_sj.customGET(id);
- },
- jry_getHistory: function(data) {
- return jry_getLSJL.customPOST(data, 'solution', {});
- },
- searchSolutionByKey: function(key, id) {
- return solutionService.customGET('searchSolutionByKey/' + key + '/' + id);
- },
- findSolutionById: function(id) {
- return solutionService.customGET('check/' + id);
- },
- findSolutions: function(id) {
- return solutionService.customGET('check2/' + id);
- },
- fetchDataList: function(model, data) {
- return solutionService.customPOST(data, 'fetchDataList/' + model, {});
- },
- findSolutionDataByDateById: function(ndate, sid) {
- return data.customGET('findSolutionDataByDateById/' + ndate + '/' + sid);
- },
- findSolutionTypeActions: function(userId) {
- return typeservice.customGET('findSolutionTypeActions/' + userId);
- },
- findSolutionTypesUser: function(data) {
- return typeservice.customPOST(data, 'findSolutionTypesUser', {});
- },
- addTypeUserAll: function(data) {
- return typeservice.customPOST(data, 'addTypeUserAll', {});
- },
- hotRanking: function(num) {
- return solutionService.customGET('hotRanking/' + num);
- },
- scoreRanking: function(num) {
- return solutionService.customGET('scoreRanking/' + num);
- },
- fetchBBSSolutions: function(pageIndex, pageSum, sequence, userId) {
- return solutionService.customGET('communicationSolutions/' + pageIndex + '/' + pageSum + '/' + sequence + '/' + userId);
- },
- queryBBSSolutions: function(pageIndex, pageSum, sequence, userId, key) {
- return solutionService.customGET('communicationSolutions/' + pageIndex + '/' + pageSum + '/' + sequence + '/' + userId + '/' + key);
- },
- updateSolutionStatus: function(data) {
- return solutionService.customPOST(data, 'updateSolutionStatus', {});
- },
- getSolutionNumber: function() {
- return solutionService.customGET('getSolutionNumber');
- },
- addSolutionType: function(data) {
- return typeservice.customPOST(data, 'add', {});
- },
- updateSolutionType: function(data) {
- return typeservice.customPOST(data, 'update', {});
- },
- removeSolutionType: function(id) {
- return typeservice.customGET('delete/' + id);
- },
- getSolutionType: function(id) {
- return typeservice.customGET('' + id);
- },
- getTree: function(typeId, groupId, flag) {
- return typeservice.customGET('getTree/' + typeId + '/' + groupId + '/' + flag);
- },
- checkCommentScoreByUserIds: function(userId, id) {
- return review.customGET('findCommentScore/' + userId + '/' + id);
- },
- addSolutionReview: function(data) {
- return solutionService.customPOST(data, 'addScore', {});
- },
- findSolutionReviewById: function(userid, id, pageIndex, pageSum) {
- return solutionService.customGET('findSolutionReviewByType/' + userid + '/' + id + '/' + pageIndex + '/' + pageSum);
- },
- saveAllUserAuth: function(solutionId, flag) {
- return solutionService.customGET('saveAllUserTrees/' + solutionId + '/' + flag);
- },
- updatermvSolutionType: function(typeId, groupId, userIds, flag) {
- return typeservice.customGET('delOrUpdateTrees/' + typeId + '/' + groupId + '/' + userIds + '/' + flag);
- },
- findSolutionGroup: function(id) {
- return groupservice.customGET('findSolutionGroup/' + id);
- },
- saveSolutionGroup: function(id, data) {
- return groupservice.customPOST(data, 'saveSolutionGroup/' + id);
- },
- // getSolutionDowpath: function(id){
- // return solutionService.one('download/'+id);
- // }
- getSolutionDowpath: function(attachmentId) {
- return solutionService.one('download/' + attachmentId + '/file');
- }
- // getSolutionDowpath: function(attachmentId){
- // return solutionService.customGET('download/' + attachmentId);
- // }
- };
- }]);
- app.factory('CMDBRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/cmdb/cmdb/');
- });
- });
- app.factory('CMDBRestangular2', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + '/cmdb/');
- });
- });
- app.factory('api_cmdb', ['CMDBRestangular','CMDBRestangular2', function(CMDBRestangular,CMDBRestangular2) {
- var jry_ciService = CMDBRestangular2.all("ci");
- var ciService = CMDBRestangular.all("ci");
- var uuidService = CMDBRestangular.all("uuid");
- var edgeService = CMDBRestangular.all("edge");
- var traversal = CMDBRestangular.all("traversal");
- var downloadService = CMDBRestangular.all("download");
- var exportService = CMDBRestangular.all("export");
- var importService = CMDBRestangular.all("import");
- var exportModelService = CMDBRestangular.all("exportModel");
- var importDataService = CMDBRestangular.all("importData");
- var exportDataService = CMDBRestangular.all("exportData");
- var searchService = CMDBRestangular.all("search");
- function serializeData(data) {
- // If this is not an object, defer to native stringification.
- if (!angular.isObject(data)) {
- return ((data == null) ? "" : data.toString());
- }
- var buffer = [];
- // Serialize each key in the object.
- for (var name in data) {
- if (!data.hasOwnProperty(name)) {
- continue;
- }
- var value = data[name];
- buffer.push(
- encodeURIComponent(name) + "=" + encodeURIComponent((value == null) ? "" : value)
- );
- }
- // Serialize the buffer and clean it up for transportation.
- var source = buffer.join("&").replace(/%20/g, "+");
- return (source);
- }
- return {
- jry_query: function(data) {
- return jry_ciService.customGET('query', data);
- },
- create: function(data) {
- return ciService.customPOST(data, '', {});
- },
- importData: function() {
- return importDataService.one('/nodes');
- },
- put: function(data, id) {
- return ciService.customPUT(data, id, {});
- },
- remove: function(id) {
- return ciService.customDELETE(id);
- },
- removeByUUId: function(uuid) {
- return ciService.customDELETE('uuid/' + id, {}, { 'Content-Type': 'application/json' });
- },
- removeRefById: function(id) {
- return ciService.customDELETE(id + '/ref');
- },
- find: function(id) {
- return ciService.customGET(id);
- },
- searchkey: function(type, key, idx, sum) {
- return searchService.customGET(type + '/' + key + '/' + idx + '/' + sum);
- },
- findByUUId: function(uuid) {
- return ciService.customGET('?uuid=' + uuid);
- },
- query: function(data) {
- return ciService.customGET('query', data);
- },
- findRefById: function(id) {
- return ciService.customGET(id + '/refs');
- },
- finduuid: function(type, model) {
- return uuidService.customGET(type + '/' + model);
- },
- types: function() {
- return CMDBRestangular.customGET('types');
- },
- createRef: function(data) {
- return edgeService.customPOST(data, '', {});
- },
- putRef: function(data, id) {
- return edgeService.customPUT(data, '' + id, {});
- },
- removeRef: function(id) {
- return edgeService.customDELETE(id, {}, { 'Content-Type': 'application/json' });
- },
- traversal: function(uuid) {
- return traversal.customGET(uuid);
- },
- traversalRel: function(uuid, relation) {
- return traversal.customGET(uuid + '/' + relation + '/' + 'none');
- },
- export: function(label) {
- return exportService.customGET('nodes/' + label);
- },
- import: function() {
- return importService.one('/nodes');
- },
- download: function(label) {
- return downloadService.one('/label');
- },
- exportData: function(type, model) {
- return exportDataService.one(model + '/' + type);
- },
- downModels: function(type, model) {
- return exportModelService.one(model + '/' + type);
- }
- };
- }]);
- app.factory('MonitorRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- RestangularConfigurer.setBaseUrl(serverIp + ':9004/services');
- });
- });
- app.factory('api_monitor', ['MonitorRestangular', function(MonitorRestangular) {
- //http://127.0.0.1:9004/services/ftpFile/monitor/bankTip/
- var process = MonitorRestangular.all("ftpFile/monitor");
- return {
- bankTip: function(id) {
- return process.customGET('bankTip/' + id);
- },
- list: function() {
- return process.customGET('list/1000');
- },
- devList: function(id) {
- return process.customGET('devList/' + id);
- },
- cpuList: function() {
- return process.customGET('cpuList/10');
- },
- memList: function() {
- return process.customGET('memList/10');
- },
- storageList: function() {
- return process.customGET('storageList/10');
- },
- transData: function() {
- return process.customGET('transData/5');
- },
- banklist: function() {
- return process.customGET('banklist');
- },
- app: function(id) {
- return process.customGET('app/' + id);
- },
- beita: function(id) {
- return process.customGET('beita/' + id);
- },
- gongji: function(id) {
- return process.customGET('gongji/' + id);
- }
- };
- }]);
- app.factory('ReportRestangular', function(Restangular) {
- return Restangular.withConfig(function(RestangularConfigurer) {
- //RestangularConfigurer.setBaseUrl('http://127.0.0.1:9005/api/cmdb/');
- RestangularConfigurer.setBaseUrl(reportIp + 'saiku/rest');
- // RestangularConfigurer.setBaseUrl(serverIp + ':8888/saiku/rest');
- //saiku/rest/saiku/api/query/execute/
- });
- });
- app.factory('api_report', ['ReportRestangular', 'Restangular', function(MonitorRestangular, Restangular) {
- var reportService = MonitorRestangular.all("saiku/api");
- var authService = MonitorRestangular.one("saiku/session");
- return {
- getLicenseKey: function() {
- return Restangular.one('assets/').customGET('/api/reportToken.js');
- },
- // auth: function(){
- // return authService.customPOST('username=admin&password=admin&language=zh'
- // ,'', {}, {'Content-Type': 'application/x-www-form-urlencoded'});
- // },
- // session: function(){
- // return authService.customGET('');
- // },
- list: function() {
- return reportService.customGET('repository?type=saiku');
- /**
- /saiku/api/repository
- path: /homes/home:admin/itsm_reports
- */
- },
- getMdx: function(path, uuid) {
- var rdata = 'file=' + path + '&formatter=flattened&language=zh';
- return reportService.customPOST(rdata, 'query/' + uuid, {}, { 'Content-Type': 'application/x-www-form-urlencoded' });
- },
- execute: function(data) {
- return reportService.customPOST(data, 'query/execute', {}, { 'Accept': 'application/json, text/javascript, */*' });
- },
- exportData: function(reportView, uuid, reportfileName) {
- return reportService.one('query/rest/export/xls/?exportname=' + reportfileName + 'xls');
- }
- };
- }]);
|