Browse Source

listFilter时间类型值的保存回写

zhuth 6 years ago
parent
commit
8a6ab8285f
2 changed files with 7 additions and 3 deletions
  1. 3 2
      src/components/chart/list.jsx
  2. 4 1
      src/components/common/listFilter/index.jsx

+ 3 - 2
src/components/chart/list.jsx

@@ -101,8 +101,9 @@ class ChartList extends React.Component {
                         }else {
                         }else {
                             visible = !!currentGroup ? l.groupCode === currentGroup.code : true;
                             visible = !!currentGroup ? l.groupCode === currentGroup.code : true;
                         }
                         }
+                    }else {
+                        visible = false;
                     }
                     }
-                    visible = false;
                 }else{
                 }else{
                     visible = false;
                     visible = false;
                 }
                 }
@@ -390,7 +391,7 @@ class ChartList extends React.Component {
                                     </Button>
                                     </Button>
                                 </Col>
                                 </Col>
                                 <Col>
                                 <Col>
-                                    <ListFilter modelName='chart' model={chart} />
+                                    <ListFilter modelName='chart' model={chart}/>
                                 </Col>
                                 </Col>
                                 <Col >
                                 <Col >
                                     <Button className='tool-link' onClick={() => {
                                     <Button className='tool-link' onClick={() => {

+ 4 - 1
src/components/common/listFilter/index.jsx

@@ -32,6 +32,7 @@ class ListFilter extends React.Component {
             onChange={value => {
             onChange={value => {
                 let item = filterItems.find(i => i.name === value);
                 let item = filterItems.find(i => i.name === value);
                 modelName && dispatch({ type: modelName + '/setFilterItem', item });
                 modelName && dispatch({ type: modelName + '/setFilterItem', item });
+                modelName && dispatch({ type: modelName + '/setFilterLabel', label: '' });
                 if(typeof onChangeFilterItem === 'function') {
                 if(typeof onChangeFilterItem === 'function') {
                     onChangeFilterItem(item)
                     onChangeFilterItem(item)
                     onChangeFilterValue('');
                     onChangeFilterValue('');
@@ -49,7 +50,9 @@ class ListFilter extends React.Component {
         const { type, name } = filterItem;
         const { type, name } = filterItem;
 
 
         if(type === 'date') {
         if(type === 'date') {
-            return <RangePicker  
+            let arr = !!filterLabel ? [moment(+filterLabel.split('#')[0]), moment(+filterLabel.split('#')[1])] : [];
+            return <RangePicker
+                value={arr}
                 ranges={{
                 ranges={{
                     '今天': [moment().startOf('day'), moment().endOf('day')],
                     '今天': [moment().startOf('day'), moment().endOf('day')],
                     '本月': [moment().startOf('month'), moment().endOf('month')],
                     '本月': [moment().startOf('month'), moment().endOf('month')],