Browse Source

数据源策略model调整

zhuth 7 years ago
parent
commit
dc3195e886

+ 2 - 2
src/components/common/CardList.jsx

@@ -118,9 +118,9 @@ class CardList extends React.Component {
                                     <Row>{l.createBy} {moment(l.createTime).format('YYYY-MM-DD')}</Row>
                                     <Row>{l.createBy} {moment(l.createTime).format('YYYY-MM-DD')}</Row>
                                 </Col>
                                 </Col>
                                 <Col span={2} style={{ textAlign: 'right' }}>
                                 <Col span={2} style={{ textAlign: 'right' }}>
-                                    <Dropdown overlay={operationMenu} trigger={['click']}>
+                                    {/* <Dropdown overlay={operationMenu} trigger={['click']}>
                                         <Icon type="ellipsis" />
                                         <Icon type="ellipsis" />
-                                    </Dropdown>
+                                    </Dropdown> */}
                                 </Col>
                                 </Col>
                             </Row>
                             </Row>
                         </Col>
                         </Col>

+ 3 - 0
src/components/common/filterBox/filterBox.jsx

@@ -227,6 +227,7 @@ class FilterBox extends React.Component {
             field = (<Select 
             field = (<Select 
                 mode={(operator==='contain' || operator === 'notContain' ) ? 'multiple' : 'single'}
                 mode={(operator==='contain' || operator === 'notContain' ) ? 'multiple' : 'single'}
                 showSearch
                 showSearch
+                dropdownMatchSelectWidth={false}
                 notFoundContent={fetching ? <Spin size="small" /> : '无'}
                 notFoundContent={fetching ? <Spin size="small" /> : '无'}
                 onFocus={() => {this.fetchColumnData(column)}}
                 onFocus={() => {this.fetchColumnData(column)}}
                 onChange={(value) => {this.changeFilterValue(filter, value, index)}}
                 onChange={(value) => {this.changeFilterValue(filter, value, index)}}
@@ -329,6 +330,7 @@ class FilterBox extends React.Component {
                                                     children.toLowerCase().indexOf(inputValue.toLowerCase()) !== -1;
                                                     children.toLowerCase().indexOf(inputValue.toLowerCase()) !== -1;
                                             }
                                             }
                                         }
                                         }
+                                        dropdownMatchSelectWidth={false}
                                         onChange={(value) => {this.changeFilterName(f, value)}}
                                         onChange={(value) => {this.changeFilterName(f, value)}}
                                     >
                                     >
                                     {
                                     {
@@ -364,6 +366,7 @@ class FilterBox extends React.Component {
                                     <Select
                                     <Select
                                         labelInValue={true}
                                         labelInValue={true}
                                         onChange={(value) => {console.log(value);this.changeFilterOperator(f, value)}}
                                         onChange={(value) => {console.log(value);this.changeFilterOperator(f, value)}}
+                                        dropdownMatchSelectWidth={false}
                                     >
                                     >
                                         {OPERATORS[type].map((o, i) => {
                                         {OPERATORS[type].map((o, i) => {
                                             return <SelectOption key={i} value={o.value}>{o.label}</SelectOption>;
                                             return <SelectOption key={i} value={o.value}>{o.label}</SelectOption>;

+ 3 - 6
src/components/dataSourceDetail/accessConfig.jsx

@@ -214,7 +214,7 @@ class DataSourceAccessConfig extends React.Component{
                     onClick={this.showPolicyRuleBox}
                     onClick={this.showPolicyRuleBox}
                     className={`filter-tag filter-tag-add`}
                     className={`filter-tag filter-tag-add`}
                 >
                 >
-                    <Icon type="filter" />
+                    <Icon type="filter" theme="outlined" />
                 </Tag>
                 </Tag>
             </div>,
             </div>,
             width: 500
             width: 500
@@ -222,11 +222,8 @@ class DataSourceAccessConfig extends React.Component{
             title: '开放对象',
             title: '开放对象',
             dataIndex: 'targets',
             dataIndex: 'targets',
             render: (targets, record, index) => <div key={index}>
             render: (targets, record, index) => <div key={index}>
-                {/* {
-                    <Tag><Icon type='geren' />{owner ? (owner.name || '拥有者' ) : '拥有者'}</Tag>
-                } */}
                 {
                 {
-                    targets.map(item => <Tag className='user-tag' key={item.code}>{item.isGroup ? <Icon type='group' /> : <Icon type='geren' />}{item.name}</Tag>)
+                    targets.map(item => <Tag className='user-tag' key={item.code}>{item.isGroup ? <Icon type="team" theme="outlined" /> : <Icon type="user" theme="outlined" />}{item.name}</Tag>)
                 }
                 }
                 <Tag key='add' onClick={this.showAccessObjectBox}><Icon type="plus" /></Tag>
                 <Tag key='add' onClick={this.showAccessObjectBox}><Icon type="plus" /></Tag>
             </div>,
             </div>,
@@ -245,7 +242,7 @@ class DataSourceAccessConfig extends React.Component{
                     <Card className='policy-body' title={
                     <Card className='policy-body' title={
                         <Row className='policy-tools' type='flex' justify='space-between'>
                         <Row className='policy-tools' type='flex' justify='space-between'>
                             <Col className='policy-public' style={{ display: 'flex' }}>
                             <Col className='policy-public' style={{ display: 'flex' }}>
-                                完全开放数据源<Switch size="small"/>
+                                {/* 完全开放数据源<Switch size="small"/> */}
                             </Col>
                             </Col>
                             <Col className='search'>
                             <Col className='search'>
                                 <Search
                                 <Search

+ 0 - 1
src/components/dataSourceDetail/columnConfig.jsx

@@ -371,7 +371,6 @@ class DataSourceColumnConfig extends React.Component {
 
 
 function mapStateToProps({ present: { dataSourceDetail, loading } }) {
 function mapStateToProps({ present: { dataSourceDetail, loading } }) {
     const fetching = loading.effects['dataSourceDetail/importColumns'];
     const fetching = loading.effects['dataSourceDetail/importColumns'];
-    console.log(loading);
     return {
     return {
         fetching,
         fetching,
         dataSourceDetail
         dataSourceDetail

+ 8 - 9
src/models/chartPolicy.js

@@ -16,17 +16,16 @@ function getBodyFilter(modelFilter) {
     if(type === 'scale' && operator === 'between') {
     if(type === 'scale' && operator === 'between') {
         bodyFilter['value'] = value1 + ',' + value2;
         bodyFilter['value'] = value1 + ',' + value2;
     }else if(type === 'time') {
     }else if(type === 'time') {
-        // let v1 = dateFormat(new Date(value1),'yyyy-MM-dd hh:mm:ss');
-        // let v2 = dateFormat(new Date(value2),'yyyy-MM-dd hh:mm:ss');
-
-        let v1 = moment(value1).format('YYYY-MM-DD HH:mm:ss');
-        let v2 = moment(value2).format('YYYY-MM-DD HH:mm:ss');
+        let v1 = moment(value1).format('YYYY-MM-DD');
+        let v2 = moment(value2).format('YYYY-MM-DD');
 
 
         if(operator === 'between') {
         if(operator === 'between') {
             bodyFilter['value'] = v1 + ',' + v2;
             bodyFilter['value'] = v1 + ',' + v2;
         }else {
         }else {
             bodyFilter['value'] = v1;
             bodyFilter['value'] = v1;
         }
         }
+    }else if(type === 'categorical' && (operator === 'contain' || operator === 'notContain')) {
+        bodyFilter['value'] = JSON.stringify(value1);
     }
     }
     return bodyFilter;
     return bodyFilter;
 }
 }
@@ -53,8 +52,10 @@ function getModelFilter(resFilter) {
             modelFilter['value1'] = v1;
             modelFilter['value1'] = v1;
             modelFilter['value2'] = v2;
             modelFilter['value2'] = v2;
         }else {
         }else {
-            modelFilter['value'] = v1;
+            modelFilter['value1'] = v1;
         }
         }
+    }else if(columnType === 'categorical' && (symbol === 'contain' || symbol === 'notContain')) {
+        modelFilter['value1'] = JSON.parse(value);
     }
     }
     return modelFilter;
     return modelFilter;
 }
 }
@@ -129,8 +130,7 @@ export default {
         },
         },
         *remoteAdd(action, { put, call, select }) {
         *remoteAdd(action, { put, call, select }) {
             const chartPolicy = yield select(state => state.present.chartPolicy);
             const chartPolicy = yield select(state => state.present.chartPolicy);
-            const { chartCode } = action;
-            const { policy } = action;
+            const { chartCode, policy } = action;
             const body = {
             const body = {
                 type: 'chart',
                 type: 'chart',
                 tarId: chartCode,
                 tarId: chartCode,
@@ -161,7 +161,6 @@ export default {
         },
         },
         *remoteModify(action, { put, call, select }) {
         *remoteModify(action, { put, call, select }) {
             const { policy, chartCode } = action;
             const { policy, chartCode } = action;
-            console.log(chartCode);
             const body = {
             const body = {
                 id: policy.code,
                 id: policy.code,
                 type: 'chart',
                 type: 'chart',

+ 9 - 10
src/models/dataSourcePolicy.js

@@ -16,9 +16,6 @@ function getBodyFilter(modelFilter) {
     if(type === 'scale' && operator === 'between') {
     if(type === 'scale' && operator === 'between') {
         bodyFilter['value'] = value1 + ',' + value2;
         bodyFilter['value'] = value1 + ',' + value2;
     }else if(type === 'time') {
     }else if(type === 'time') {
-        // let v1 = dateFormat(new Date(value1),'yyyy-MM-dd hh:mm:ss');
-        // let v2 = dateFormat(new Date(value2),'yyyy-MM-dd hh:mm:ss');
-
         let v1 = moment(value1).format('YYYY-MM-DD HH:mm:ss');
         let v1 = moment(value1).format('YYYY-MM-DD HH:mm:ss');
         let v2 = moment(value2).format('YYYY-MM-DD HH:mm:ss');
         let v2 = moment(value2).format('YYYY-MM-DD HH:mm:ss');
 
 
@@ -27,6 +24,8 @@ function getBodyFilter(modelFilter) {
         }else {
         }else {
             bodyFilter['value'] = v1;
             bodyFilter['value'] = v1;
         }
         }
+    }else if(type === 'categorical' && (operator === 'contain' || operator === 'notContain')) {
+        bodyFilter['value'] = JSON.stringify(value1);
     }
     }
     return bodyFilter;
     return bodyFilter;
 }
 }
@@ -53,8 +52,10 @@ function getModelFilter(resFilter) {
             modelFilter['value1'] = v1;
             modelFilter['value1'] = v1;
             modelFilter['value2'] = v2;
             modelFilter['value2'] = v2;
         }else {
         }else {
-            modelFilter['value'] = v1;
+            modelFilter['value1'] = v1;
         }
         }
+    }else if(columnType === 'categorical' && (symbol === 'contain' || symbol === 'notContain')) {
+        modelFilter['value1'] = JSON.parse(value);
     }
     }
     return modelFilter;
     return modelFilter;
 }
 }
@@ -119,12 +120,11 @@ export default {
         },
         },
         *remoteAdd(action, { put, call, select }) {
         *remoteAdd(action, { put, call, select }) {
             const dataSourcePolicy = yield select(state => state.present.dataSourcePolicy);
             const dataSourcePolicy = yield select(state => state.present.dataSourcePolicy);
-            const dataSource = yield select(state => state.present.dataSource);
-            const { newOne } = dataSource;
+            const dataSourceDetail = yield select(state => state.present.dataSourceDetail);
             const { policy } = action;
             const { policy } = action;
             const body = {
             const body = {
                 type: 'base',
                 type: 'base',
-                tarId: newOne.code,
+                tarId: dataSourceDetail.code,
                 name: policy.name,
                 name: policy.name,
                 rule: policy.filters.map(f => getBodyFilter(f)),
                 rule: policy.filters.map(f => getBodyFilter(f)),
                 isOpen: policy.enabled ? '1' : '0',
                 isOpen: policy.enabled ? '1' : '0',
@@ -151,13 +151,12 @@ export default {
             }
             }
         },
         },
         *remoteModify(action, { put, call, select }) {
         *remoteModify(action, { put, call, select }) {
-            const dataSource = yield select(state => state.present.dataSource);
+            const dataSourceDetail = yield select(state => state.present.dataSourceDetail);
             const { policy } = action;
             const { policy } = action;
-            const { newOne } = dataSource;
             const body = {
             const body = {
                 id: policy.code,
                 id: policy.code,
                 type: 'base',
                 type: 'base',
-                tarId: newOne.code,
+                tarId: dataSourceDetail.code,
                 name: policy.name,
                 name: policy.name,
                 rule: policy.filters.map(f => getBodyFilter(f)),
                 rule: policy.filters.map(f => getBodyFilter(f)),
                 isOpen: policy.enabled ? '1' : '0',
                 isOpen: policy.enabled ? '1' : '0',

+ 7 - 3
src/models/recent.js

@@ -4,6 +4,7 @@
 import { message } from 'antd'
 import { message } from 'antd'
 import * as service from '../services/index'
 import * as service from '../services/index'
 import URLS from '../constants/url'
 import URLS from '../constants/url'
+import moment from 'moment'
 
 
 export default {
 export default {
     namespace: 'recent',
     namespace: 'recent',
@@ -33,6 +34,7 @@ export default {
                 });
                 });
                 
                 
                 console.log('请求最近访问图表', res);
                 console.log('请求最近访问图表', res);
+                
                 if(!res.err && res.data.code > 0) {
                 if(!res.err && res.data.code > 0) {
                     let recentChart = res.data.data.map((r, i) => {
                     let recentChart = res.data.data.map((r, i) => {
                         return {
                         return {
@@ -44,8 +46,9 @@ export default {
                             chartOption: r.chartOption,
                             chartOption: r.chartOption,
                             description: r.describes || "",
                             description: r.describes || "",
                             createTime: r.createDate,
                             createTime: r.createDate,
+                            recentTime: moment(r.reDate)
                         }
                         }
-                    });
+                    }).sort((a, b) => moment(a.recentTime) - moment(b.recentTime));
                     yield put({ type: 'listRecentChart', recentChart });
                     yield put({ type: 'listRecentChart', recentChart });
                 }else {
                 }else {
                     message.error('读取最近访问图表列表错误: ' + (res.err || res.data.msg));
                     message.error('读取最近访问图表列表错误: ' + (res.err || res.data.msg));
@@ -73,9 +76,10 @@ export default {
                             name: r.bdName,
                             name: r.bdName,
                             thumbnail: r.thumbnail,
                             thumbnail: r.thumbnail,
                             createBy: r.createBy,
                             createBy: r.createBy,
-                            description: r.bdNote || ""
+                            description: r.bdNote || "",
+                            recentTime: r.reDate
                         }
                         }
-                    });
+                    }).sort((a, b) => moment(b.recentTime) - moment(a.recentTime));
                     yield put({ type: 'listRecentDashboard', recentDashboard });
                     yield put({ type: 'listRecentDashboard', recentDashboard });
                 }else {
                 }else {
                     message.error('读取最近访问看板列表错误: ' + (res.err || res.data.msg));
                     message.error('读取最近访问看板列表错误: ' + (res.err || res.data.msg));