Browse Source

【bug】报表选择图表过滤忽略大小写

zhuth 6 years ago
parent
commit
cd3e7d1dbe
1 changed files with 3 additions and 5 deletions
  1. 3 5
      src/components/dashboardDesigner/chooseChartBox.jsx

+ 3 - 5
src/components/dashboardDesigner/chooseChartBox.jsx

@@ -234,17 +234,15 @@ class ChooseChartBox extends React.Component {
                         ...c,
                         width: 100
                     }))}
-                    dataSource={chart.list.filter(l => l.creatorCode === main.currentUser.code).map((l, i) => {
+                    dataSource={chart.list.map((l, i) => {
                         let o = Object.assign({}, l);
                         if(filterItem.type === 'date') {
                             if(filterLabel===""){
-                                console.log(filterLabel);
                                 return { ...o, key: i };
                             }else if(filterLabel.indexOf('#')>-1){
                                 let start = filterLabel.split('#')[0]
                                 let end = filterLabel.split('#')[1]
                                 let nowTime = new Date(o[filterItem.name]).getTime();
-                                console.log(start, end, nowTime);
                                 if(nowTime>=start && nowTime<=end){
                                     return { ...o, key: i};
                                 }
@@ -253,9 +251,9 @@ class ChooseChartBox extends React.Component {
                                 return null 
                             }
                         }else {
-                            return ((o[filterItem.name] + '').search(filterLabel) > -1) ? { ...o, key: i } : null
+                            return ((o[filterItem.name] + '').search(new RegExp('(' + filterLabel + '){1}', 'ig')) > -1) ? { ...o, key: i } : null
                         }
-                    }).filter(a => a!==null)}
+                    }).filter(a => a!==null && a.creatorCode === main.currentUser.code)}
                     size='small'
                     scroll={{ x: columns ? columns.length * 100 : tableBodyWidth, y: tableBodyHeight }}
                     pagination={{ defaultPageSize: Math.floor(tableBodyHeight/tableRowHeight) || 10 }}