123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- /**本地缓存 */
- var SessionOperation = {
- type:'session',
- setType:function(){
- if(this.type == 'session'){
- return window.sessionStorage;
- }
- if(this.type == 'local'){
- return window.localStorage;
- }
- console.log('类型错误!');
- },
- set:function($key,$value){
- this.setType().setItem($key,$value);
- },
- get:function($key){
- return this.setType().getItem($key)
- },
- clearAll:function(){
- if(this.type == 'session'){
- window.sessionStorage.clear();
- }
- if(this.type == 'local'){
- window.localStorage.clear();
- }
- console.log('类型错误!');
- },
- setToken:function(token){
- this.set("TOKEN", token);
- },
- getToken:function(){
- return this.get("TOKEN");
- },
- setUserId:function(userId){
- this.set("userId", userId);
- },
- getUserId:function(){
- return this.get("userId");
- },
- setPersonnelId:function(personnelId){
- this.set("personnelId", personnelId);
- },
- getPersonnelId:function(){
- return this.get("personnelId");
- },
- setUserDeps:function(userDeps){
- this.set("UserDeps", userDeps);
- },
- getUserDeps:function(){
- return this.get("UserDeps");
- },
- setRealName:function(realname){
- this.set("RealName", realname);
- },
- getRealName:function(){
- return this.get("RealName");
- },
- setUserName:function(username){
- this.set("UserName", username);
- },
- getUserName:function(){
- return this.get("UserName");
- },
- setOrgnizeId(id){
- this.set("OrgnizeId", id);
- },
- getOrgnizeId(){
- return this.get("OrgnizeId");
- },
- setOrgnizeName(name){
- this.set("OrgnizeName", name);
- },
- getOrgnizeName(){
- return this.get("OrgnizeName");
- }
- };
- function getQueryVariable(variable){
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i=0;i<vars.length;i++) {
- var pair = vars[i].split("=");
- if(pair[0] == variable){
- return pair[1];
- }
- }
- return(false);
- }
- //map型看板滚动
- //-------------------开始-----------------------
- function beginFun(chartsID,dataMap,autoTime,timeName,grid){
- return function(){autoInitDate(chartsID,dataMap,autoTime,timeName,grid)}
- }
- function autoInitDate(chartsID,dataMap,autoTime,timeName,grid){
- let DataList = [];
- for(let key in dataMap) {
- DataList.push([key, dataMap[key]]);
- }
- if(DataList.length < 1){
- return;
- }
- let lsit = DataList.slice(pageIndex, pageSize);
- pageIndex = pageSize;
- pageSize = pageSize + initSize;
- let map = {}
- for(let key in lsit) {
- map[lsit[key][0]] = lsit[key][1];
- }
- ChartsService.initCommonBar(chartsID,map,grid);
- if(DataList.length <= initSize){
- return;
- }
- timeName = setInterval(beginFun2(chartsID,DataList,timeName,grid),autoTime);
-
- }
- function beginFun3(chartsID,dataMap,autoTime,timeName,grid){
- return function(){autoInitDate2(chartsID,dataMap,autoTime,timeName,grid)}
- }
- function autoInitDate2(chartsID,dataMap,autoTime,timeName,grid){
- let DataList = [];
- for(let key in dataMap) {
- DataList.push([key, dataMap[key]]);
- }
- if(DataList.length < 1){
- return;
- }
- let lsit = DataList.slice(pageIndex, pageSize);
- pageIndex = pageSize;
- pageSize = pageSize + initSize;
- let map = {}
- for(let key in lsit) {
- map[lsit[key][0]] = lsit[key][1];
- }
- ChartsService.initCommonBar2(chartsID,map,grid);
- if(DataList.length <= initSize){
- return;
- }
- timeName = setInterval(beginFun2(chartsID,DataList,timeName,grid),autoTime);
-
- }
- function beginFun2(chartsID,DataList,timeName,grid){
-
- return function(){autoLoadDate(chartsID,DataList,timeName,grid)}
- }
- function autoLoadDate(chartsID,DataList,timeName,grid){
-
- if(DataList.length <= initSize){
- clearInterval(timeName);
- }
- if(pageIndex >= DataList.length){
- pageSize = initSize;
- pageIndex = 0;
- }
- let lsit = DataList.slice(pageIndex, pageSize);
- // console.log(pageIndex+"---1---"+pageSize);
- pageIndex = pageSize;
- pageSize = pageSize + initSize;
- let map = {}
- for(let key in lsit) {
- map[lsit[key][0]] = lsit[key][1];
- }
- ChartsService.initCommonBar(chartsID,map,grid);
- }
- function beginFunA(chartsID,dataMap,autoTime,timeName,grid){
- return function(){autoInitDateA(chartsID,dataMap,autoTime,timeName,grid)}
- }
- function autoInitDateA(chartsID,dataMap,autoTime,timeName,grid){
- let DataListA = [];
- for(let key in dataMap) {
- DataListA.push([key, dataMap[key]]);
- }
- if(DataListA.length < 1){
- return;
- }
- let lsitA = DataListA.slice(pageIndexA, pageSizeA);
- pageIndexA = pageSizeA;
- pageSizeA = pageSizeA + initSize;
- let map = {}
- for(let key in lsitA) {
- map[lsitA[key][0]] = lsitA[key][1];
- }
- ChartsService.initCommonBar(chartsID,map,grid);
- if(DataListA.length <= initSize){
- return;
- }
- timeName = setInterval(beginFun2A(chartsID,DataListA,timeName,grid),autoTime);
-
- }
- function beginFun2A(chartsID,DataListA,timeName,grid){
-
- return function(){autoLoadDateA(chartsID,DataListA,timeName,grid)}
- }
- function autoLoadDateA(chartsID,DataListA,timeName,grid){
-
- if(DataListA.length <= initSize){
- clearInterval(timeName);
- }
- if(pageIndexA >= DataListA.length){
- pageSizeA = initSize;
- pageIndexA = 0;
- }
- let lsitA = DataListA.slice(pageIndexA, pageSizeA);
- // console.log(pageIndexA+"---2---"+pageSizeA);
- pageIndexA = pageSizeA;
- pageSizeA = pageSizeA + initSize;
- let map = {}
- for(let key in lsitA) {
- map[lsitA[key][0]] = lsitA[key][1];
- }
- ChartsService.initCommonBar(chartsID,map,grid);
- }
- //map型看板滚动
- //-------------------结束-----------------------
|