Explorar o código

修复时间单元格不生效的问题

xjj hai 1 ano
pai
achega
4556df0de7
Modificáronse 2 ficheiros con 16 adicións e 9 borrados
  1. 7 6
      src/controllers/filter.js
  2. 9 3
      src/function/functionImplementation.js

+ 7 - 6
src/controllers/filter.js

@@ -711,18 +711,18 @@ function initialFilterHandler(){
                         else{
                             text = x;
                         }
-
+                        let str = (v + "#$$$#" + x)
                         //是否选中状态
                         let dataHtml;
-                        if((v + "#$$$#" + x) in vmap_uncheck){
-                            dataHtml =  '<div class="textBox luckysheet-mousedown-cancel cf" data-check="false" data-filter="'+ (v + "#$$$#" + x) +'" title="'+ text +'">' +
+                        if(str in vmap_uncheck){
+                            dataHtml =  '<div class="textBox luckysheet-mousedown-cancel cf" data-check="false" data-filter="'+ str.replace(/"/g,"&*&*").replace(/[\n\r]+/g,"") +'" title="'+ text.replace(/"/g,"&*&*") +'">' +
                                                 '<input class="luckysheet-mousedown-cancel" type="checkbox"/>' +
                                                 '<label class="luckysheet-mousedown-cancel">' + text + '</label>' +
                                                 '<span class="luckysheet-mousedown-cancel count">( ' + vmap[v][x] + ' )</span>' +
                                             '</div>';
                         }
                         else{
-                            dataHtml =  '<div class="textBox luckysheet-mousedown-cancel cf" data-check="true" data-filter="'+ (v + "#$$$#" + x) +'" title="'+ text +'">' +
+                            dataHtml =  '<div class="textBox luckysheet-mousedown-cancel cf" data-check="true" data-filter="'+ str.replace(/"/g,"&*&*").replace(/[\n\r]+/g,"") +'" title="'+ text +'">' +
                                                 '<input class="luckysheet-mousedown-cancel" type="checkbox" checked="checked"/>' +
                                                 '<label class="luckysheet-mousedown-cancel">' + text + '</label>' +
                                                 '<span class="luckysheet-mousedown-cancel count">( ' + vmap[v][x] + ' )</span>' +
@@ -1722,7 +1722,7 @@ function initialFilterHandler(){
                 }
 
                 if($(e).closest(".textBox").length > 0){
-                    let itemV = $(e).closest(".textBox").data("filter");
+                    let itemV = $(e).closest(".textBox").data("filter").replace(/\&\*\&\*/g,'"').replace(/[\n\r]+/g,"");
 
                     filterdata[itemV] = "1";
                 }
@@ -1755,7 +1755,8 @@ function initialFilterHandler(){
                 else{
                     value = cell.v + "#$$$#" + cell.m;
                 }
-
+                value = value.replace(/[\r\n]+/g,"")
+                
                 if(value in filterdata){
                     rowhidden[r] = 0;
                 }

+ 9 - 3
src/function/functionImplementation.js

@@ -11639,9 +11639,15 @@ const functionImplementation = {
             if(!dayjs(start_date).isValid()){
                 return formula.error.v;
             }
-
-            //计算
-            var date = dayjs(start_date).add(months, 'months');
+            var date = ""
+            // 判断传入的值的类型
+            if(typeof v == 'string') {
+                // v为类似与2020-01-01的字符串
+                date = dayjs(start_date).add(months, 'months');
+            } else {
+                // v为与1900-1-1 0:00:00这个时刻的差值(以天为单位)
+                date = dayjs("1900-01-01 00:00:00").add(start_date,'day').add(months, 'months');
+            }
             var mask = genarate(dayjs(date).format("YYYY-MM-DD h:mm:ss"));
 
             var result = mask[2];