- 
                
                    
- 
                方菁 小试身手Lv3 发表于2018-7-24 19:30 
1、整体简介
 
2、模块详解
1) 本月销售趋势
 
 
2) 销售概览
3) 月销售完成率
4) 整体运营状况
5) 库房库存预警
二、脚本说明
脚本1:指标循环高亮
 
- //指标高亮循环
 
- function checkBtnAndAutoHighlight(){
 
-         var btns = ["@by","@sy"];
 
-         var autoSelectAreas = [["HHH50","HHH58","HHH66","HHH62"],["HHH71","HHH75","HHH83","HHH79"]];
 
-         var texts = [["HHH52","HHH59","HHH67","HHH63"],["HHH72","HHH76","HHH84","HHH80"]];
 
-         var ready = true;
 
-         var tabctrlId = "HHH46";
 
-         var btnDoms = [];
 
-         var textDoms = [];
 
-         if(!g_rptpage.calcParam){
 
-                 ready = false;
 
-         }else{
 
-                 for (var i = 0, l = btns.length; i < l; i++) {
 
-                         var param = g_rptpage.calcParam.getParamByName(btns[i]);
 
-                         if(!param){
 
-                                 ready = false;
 
-                                 break;
 
-                         }
 
-                         btnDoms.push(param.getBaseDom());
 
-                 }
 
-         }
 
-         if(!ready){
 
-                 var func = checkBtnAndAutoHighlight.bind(window);
 
-                 setTimeout(func,50);
 
-         }else{
 
-                 window["_auto_select_timer"] = null; 
 
-                 var bindBtnClick = function(tabctrlId,idx){
 
-                         window["current_active_btn_idx_HHH46"] = idx;
 
-                         g_rptpage.widgets[tabctrlId].setActive(idx);
 
-                         changeTabSelect();
 
-                 };
 
-                 var changeTabSelect = function(){
 
-                         if(window["_auto_select_timer"]){
 
-                                 clearTimeout(window["_auto_select_timer"]);
 
-                                 window["_auto_select_timer"] = null;
 
-                         }
 
-                         window["_current_highlight_area"]=-1;
 
-                         resetAllSelectBorderStyle();
 
-                         resetAllSelectTextStyle();
 
-                         autoSelectAreaInTab();
 
-                 };
 
-                 
 
-                 var setSelectBorderStyle = function(headerId){
 
-                         jQuery("#"+headerId).addClass("auto-select-area-border");
 
-                 };
 
-                 var resetSelectBorderStyle = function(headerId){
 
-                         jQuery("#"+headerId).removeClass("auto-select-area-border");
 
-                 };
 
-                 var selectTextStyle = function(headerId){
 
-                         jQuery("#" + headerId + " span").addClass("auto_select-text-color");        
 
-                 };
 
-                 var resetSelectTextStyle = function(headerId){
 
-                         jQuery("#" + headerId + " span").removeClass("auto_select-text-color");        
 
-                 };
 
-                 var resetAllSelectTextStyle = function(){
 
-                         for(var i=0,l=texts.length;i<l;i++){
 
-                                 for(var j = 0,jl = texts[i].length;j<jl;j++){
 
-                                         resetSelectTextStyle(texts[i][j]);
 
-                                 }
 
-                         }
 
-                 };
 
-                 var resetAllSelectBorderStyle = function(){
 
-                         for(var i=0,l=autoSelectAreas.length;i<l;i++){
 
-                                 for(var j = 0,jl = autoSelectAreas[i].length;j<jl;j++){
 
-                                         resetSelectBorderStyle(autoSelectAreas[i][j]);
 
-                                 }
 
-                         }
 
-                 };
 
-                 var autoSelectAreaInTab = function(){
 
-                         var idx = window["current_active_btn_idx_HHH46"];
 
-                         if(window["_current_highlight_area"]!=-1){
 
-                                 resetSelectBorderStyle(autoSelectAreas[idx][window["_current_highlight_area"]]);
 
-                                 resetSelectTextStyle(texts[idx][window["_current_highlight_area"]]);
 
-                         }
 
-                         window["_current_highlight_area"] = (window["_current_highlight_area"] + 1)%autoSelectAreas[idx].length;
 
-                         setSelectBorderStyle(autoSelectAreas[idx][window["_current_highlight_area"]]);
 
-                         selectTextStyle(texts[idx][window["_current_highlight_area"]]);
 
-                         window["_auto_select_timer"] = setTimeout(autoSelectAreaInTab,2000);
 
-                 };
 
-                 for(var i=0,l=btnDoms.length;i<l;i++){
 
-                         addEvent(btnDoms[i],"click",bindBtnClick.bind(btnDoms[i],tabctrlId,i));
 
-                 }
 
-                 addStyleSheet(".auto-select-area-border{border:1px solid #A1ACFF !important;border-radius:5px !important;}");
 
-                 addStyleSheet(".auto_select-text-color{color:#F8BB38 !important;}");
 
-                 execDomEvent(btnDoms[0],"click");
 
-         }
 
- }
 
 
- checkBtnAndAutoHighlight();
脚本2:数字滚动效果
 
- //数字滚动效果
 
- (function($){
 
-         $.fn.countTo = function (options) {
 
-                 options = options || {};
 
-                 
 
-                 return $(this).each(function () {
 
-                         // set options for current element
 
-                         var settings = $.extend({}, $.fn.countTo.defaults, {
 
-                                 from:            $(this).data('from'),
 
-                                 to:              $(this).data('to'),
 
-                                 speed:           $(this).data('speed'),
 
-                                 refreshInterval: $(this).data('refresh-interval'),
 
-                                 decimals:        $(this).data('decimals')
 
-                         }, options);
 
-                         
 
-                         // how many times to update the value, and how much to increment the value on each update
 
-                         var loops = Math.ceil(settings.speed / settings.refreshInterval),
 
-                                 increment = (settings.to - settings.from) / loops;
 
-                         
 
-                         // references & variables that will change with each update
 
-                         var self = this,
 
-                                 $self = $(this),
 
-                                 loopCount = 0,
 
-                                 value = settings.from,
 
-                                 data = $self.data('countTo') || {};
 
-                         
 
-                         $self.data('countTo', data);
 
-                         
 
-                         // if an existing interval can be found, clear it first
 
-                         if (data.interval) {
 
-                                 clearInterval(data.interval);
 
-                         }
 
-                         data.interval = setInterval(updateTimer, settings.refreshInterval);
 
-                         
 
-                         // initialize the element with the starting value
 
-                         render(value);
 
-                         
 
-                         function updateTimer() {
 
-                                 value += increment;
 
-                                 loopCount++;
 
-                                 
 
-                                 render(value);
 
-                                 
 
-                                 if (typeof(settings.onUpdate) == 'function') {
 
-                                         settings.onUpdate.call(self, value);
 
-                                 }
 
-                                 
 
-                                 if (loopCount >= loops) {
 
-                                         // remove the interval
 
-                                         $self.removeData('countTo');
 
-                                         clearInterval(data.interval);
 
-                                         value = settings.to;
 
-                                         
 
-                                         if (typeof(settings.onComplete) == 'function') {
 
-                                                 settings.onComplete.call(self, value);
 
-                                         }
 
-                                 }
 
-                         }
 
-                         
 
-                         function render(value) {
 
-                                 var formattedValue = settings.formatter.call(self, value, settings);
 
-                                 $self.html(formattedValue);
 
-                         }
 
-                 });
 
-         };
 
-         
 
-         $.fn.countTo.defaults = {
 
-                 from: 0,               // the number the element should start at
 
-                 to: 0,                 // the number the element should end at
 
-                 speed: 1000,           // how long it should take to count between the target numbers
 
-                 refreshInterval: 100,  // how often the element should be updated
 
-                 decimals: 0,           // the number of decimal places to show
 
-                 formatter: formatter,  // handler for formatting the value before rendering
 
-                 onUpdate: null,        // callback method for every time the element is updated
 
-                 onComplete: null       // callback method for when the element finishes updating
 
-         };
 
-         
 
-         function formatter(value, settings) {
 
-                 return value.toFixed(settings.decimals);
 
-         }
 
 
-   // custom formatting example
 
-   $('#count-number').data('countToOptions', {
 
-         formatter: function (value, options) {
 
-           return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');
 
-         }
 
-   });
 
-   
 
-   // start all the timers
 
-   $('.timer').each(count);  
 
-   
 
-   function count(options) {
 
-         var $this = $(this);
 
-         options = $.extend({}, options || {}, $this.data('countToOptions') || {});
 
-         $this.countTo(options);
 
-   }
 
- })(jQuery);
 
 
- function autoIncreHHH88(){
 
-         var txt =jQuery("#HHH88 span").text();
 
-         var from= parseInt(txt);
 
-         var to = from + parseInt(Math.random()*1000) % 10;
 
-         if(to == from){        
 
-                 to = from +1;
 
-         }
 
-         if(to>100000){
 
-                 return ;
 
-         }
 
-         var valueLength = (""+to).length;
 
-         var str = "";
 
-         for(var i=0;i<5 - valueLength;i++){
 
-                 str = str+"0";
 
-         }
 
-         str = str+to;
 
-         jQuery("#HHH88 span").text(str);
 
-         setTimeout(autoIncreHHH88,2000);
 
- }
 
 
- jQuery("#HHH88 span").countTo({from:0,to:1869,numberCount:5,onComplete:function(){
 
-                 setTimeout(autoIncreHHH88,2000);
 
-         },formatter:function(value,option){
 
-                 var numberCount = option.numberCount || (""+to).length;
 
-                 value  = parseInt(value);
 
-                 var valueLength = (""+value).length;
 
-                 var str = "";
 
-                 for(var i=0;i<numberCount - valueLength;i++){
 
-                         str = str+"0";
 
-                 }
 
-                 str = str+value;
 
-                 return str;
 
- }});
 
 
- jQuery("#HHH179 span").countTo({from:0,to:3427,numberCount:5,formatter:function(value,option){
 
-         var numberCount = option.numberCount || (""+to).length;
 
-         value  = parseInt(value);
 
-         var valueLength = (""+value).length;
 
-         var str = "";
 
-         for(var i=0;i<numberCount - valueLength;i++){
 
-                 str = str+"0";
 
-         }
 
-         str = str+value;
 
-         return str;
 
- }});
脚本3:表格内容自动轮播
 
- /***
 
- **表格内容自动轮播脚本
 
- **@param tableDom内容滚动的表格,最好是表格的父DIV
 
- **@param visibleHeight 可视区的高度
 
- ***/
 
- function autoScrollTable(tableDom, visibleHeight) {
 
-         var marqueesHeight = visibleHeight;
 
-         var stopscroll = false;
 
-         var scrollElem = tableDom;
 
-         var preTop = 0;
 
-         var currentTop = 0;
 
-         var stoptime = 0;
 
-         with (scrollElem) {
 
-                 style.height = parseFloat(marqueesHeight) + "px";
 
-                 style.overflow = 'hidden';
 
-                 noWrap = true;
 
-         }
 
-         var scrollUp = function () {
 
-                 if (stopscroll) {
 
-                         setTimeout(scrollUp, 50);
 
-                         return;
 
-                 }
 
-                 currentTop += 1;
 
-                 if (currentTop == (marqueesHeight + 1)) {
 
-                         stoptime += 1;
 
-                         currentTop -= 1;
 
-                         if (stoptime == 1) {
 
-                                 currentTop = 0;
 
-                                 stoptime = 0;
 
-                         }
 
-                 } else {
 
-                         preTop = scrollElem.scrollTop;
 
-                         scrollElem.scrollTop += 1;
 
-                         if (preTop == scrollElem.scrollTop) {
 
-                                 scrollElem.scrollTop = 0;
 
-                                 scrollElem.scrollTop += 1;
 
-                         }
 
-                 }
 
-                 setTimeout(scrollUp, 50);
 
-         };
 
-         var restartScroll = function () {
 
-                 scrollElem.scrollTop = 0;
 
-                 setTimeout(scrollUp, 50);
 
-         };
 
-         jQuery(tableDom).hover(function () {
 
-                 stopscroll = true;
 
-         }, function () {
 
-                 stopscroll = false;
 
-         });
 
-         setTimeout(restartScroll, 2000);
 
- }
 
- autoScrollTable(document.getElementById('GRID2'),document.getElementById("HHH148").clientHeight);
三、配色信息
 
 
  零售行业.rar
(410.07 KB, 下载次数: )
零售行业.rar
(410.07 KB, 下载次数: )
19个回答
                                            您好 我用指标高亮循环的这个脚本会报错 能帮忙看下是什么原因吗
Uncaught ReferenceError: addEvent is not defined
 
gelin 发表于 2020-10-23 15:19
您好 我用指标高亮循环的这个脚本会报错 能帮忙看下是什么原因吗
Uncaught ReferenceError: addEvent is no ...
你好,请问这个问题你解决了吗?是怎么解决的呢?能告诉一下吗?
                                             本帖最后由 bobcardif 于 2022-4-6 17:01 编辑 
学习了                                    
- 
                            esen_3JBLEXE027 数据小白Lv1 
为啥我的表格标题和表格内容一起滚动,有什么办法可以让表格标题不随着内容一起滚动么
 





 
                        