Browse Source

数据源不可更改数据链接/筛选组件时间选择器样式优化

zhuth 6 years ago
parent
commit
ba194a9c52

+ 1 - 1
src/components/common/filterBox/filter.jsx

@@ -136,7 +136,7 @@ class Filter extends React.Component {
                 </Select>)
             }else { // 等于/不等于
                 field = (<Select
-                    key={key} // 不定义这个key的话每次在box中更新了值后不能正确反映到filter中来,不信你把这行注释看看
+                    key={key} // 不定义这个key的话每次在box中更新了值后不能正确反映到filter中来
                     { ...commonProps }
                     allowClear
                     mode='single'

+ 12 - 0
src/components/common/filterBox/filter.less

@@ -28,4 +28,16 @@
             color: white;
         }
     }
+    .ant-input-suffix {
+        display: none;
+        width: 12px;
+        height: 12px;
+        font-size: 12px;
+        color: rgba(0, 0, 0, 0.25);
+    }
+    &:hover {
+        .ant-input-suffix {
+            display: inline-block;
+        }
+    }
 }

+ 1 - 19
src/components/common/filterBox/filterBox.jsx

@@ -408,24 +408,6 @@ class FilterBox extends React.Component {
     getFilterItems() {
         const { columns } = this.state;
         const { getFieldDecorator, getFieldValue } = this.props.form;
-        const groups = [];
-        // 处理带分组的列
-        for(let i = 0; i < columns.length; i++) {
-            let c = columns[i];
-            if(c.group) {
-                if(groups.findIndex(g => g.groupName === c.group) === -1) {
-                    groups.unshift({
-                        groupName: c.group,
-                        options: [c]
-                    });
-                }else {
-                    let g = groups.find(g => g.groupName === c.group);
-                    g.options.push(c);
-                }
-            }else {
-                groups.push(c);
-            }
-        }
         getFieldDecorator('filters', { initialValue: [] });
         const filters = getFieldValue('filters');
         const filterItems = filters.map((f, index) => {
@@ -453,7 +435,7 @@ class FilterBox extends React.Component {
                                         onChange={(value) => {this.changeFilterName(f, value)}}
                                     >
                                     {
-                                        groups.map((g, i) => {
+                                        columns.filter(c => c.filterable).map((g, i) => {
                                             let options = g.options;
                                             return !!g.groupName ?
                                             <OptionGroup key={i} label={g.groupName}>

+ 1 - 1
src/components/common/filterBox/filterBox2.jsx

@@ -216,7 +216,7 @@ class FilterBox extends React.Component {
                 }).then(r => {
                     const resData = r.data.data || [];
                     let obj = {fetching: false};
-                    obj['columnData-' + filter.dataSource.name + '-' + filter.name] = resData.map(d => d || 'null')
+                    obj['columnData-' + filter.dataSource.name + '-' + filter.name] = resData.filter(d => d.isFilter === '1').map(d => d || 'null')
                     this.setState(obj);
                 }).catch(ex => {
                     let obj = {fetching: false};

+ 2 - 1
src/components/dataSourceDetail/baseConfig.jsx

@@ -70,9 +70,10 @@ class DataSourceBaseConfig extends React.Component {
                     ):(
                         <div>
                             <Divider orientation="left">连接配置</Divider>
-                            <div style={{ textAlign: 'end', color: '#F5222D' }}>*若只修改数据链接,请确认不同数据库取数逻辑一致</div>
+                            {/* <div style={{ textAlign: 'end', color: '#F5222D' }}>*若只修改数据链接,请确认不同数据库取数逻辑一致</div> */}
                             <FormItem label='数据链接' {...formItemLayout}>
                                 <Select
+                                    disabled
                                     value={dataSourceDetail.connectCode}
                                     onChange={(value) => {
                                         let selectedDataConnect = dataConnect.list.filter((l) => l.code === value)[0];