Browse Source

图表新增错误反馈【数据源丢失】

zhuth 7 years ago
parent
commit
b8d010099d
3 changed files with 11 additions and 6 deletions
  1. 6 4
      src/components/chart/list.jsx
  2. 3 1
      src/components/dataSource/list.jsx
  3. 2 1
      src/models/chart.js

+ 6 - 4
src/components/chart/list.jsx

@@ -161,15 +161,17 @@ class ChartList extends React.Component {
                     }
                     cover={
                         <Col className='cover-body'>
-                            <Row className='thumb' onClick={l.access ? () => {
+                            <Row className='thumb' onClick={l.access && l.database ? () => {
                                 dispatch({ type: 'chartDesigner/reset' });
                                 dispatch({ type: 'main/redirect', path: '/chart/' + l.code });
                                 dispatch({ type: 'recent/addRecentRecord', tarId: l.code, recordType: 0});
                             } : () => {}}>
-                                {!l.access && <div className='deny-body'>
+                                {!l.access ? <div className='deny-body'>
                                     <div className='deny-tip'>无数据权限</div>
-                                </div>}
-                                <Thumbnail style={{ opacity: l.access ? 1 : 0.3 }} type={l.type} code={l.code} option={l.chartOption}/>
+                                </div> : (!l.database ? <div className='deny-body'>
+                                    <div className='deny-tip'>数据源丢失</div>
+                                </div> : null)}
+                                <Thumbnail style={{ opacity: (l.access && l.database) ? 1 : 0.3 }} type={l.type} code={l.code} option={l.chartOption}/>
                             </Row>
                             <Row className='desc'>
                                 <Ellipsis tooltip={l.description&&l.description.length > 16} lines={2}>{

+ 3 - 1
src/components/dataSource/list.jsx

@@ -488,7 +488,9 @@ class DataSource extends React.Component {
                                 })
                             }}
                             okHandler={() =>{
-                                dispatch({ type: 'dataSource/remoteDelete', code: selectedRecord.code })
+                                dispatch({ type: 'dataSource/remoteDelete', code: selectedRecord.code }).then(() => {
+                                    dispatch({ type: 'chart/fetchList', mandatory: true });
+                                })
                             }} 
                         />}
                         {visibleDataPreviewBox && <DataPreview

+ 2 - 1
src/models/chart.js

@@ -140,7 +140,8 @@ export default {
                             name: d.chartName,
                             dataSourceCode: d.dataId + '',
                             dataSourceName: d.dataName,
-                            access: d.authority === '1',
+                            access: d.authority === '1', // 权限
+                            database: d.dbStatus === '0', // 数据源是否还存在
                             type: CHART_TYPE[d.chartType],
                             creatorCode: d.createId + '',
                             creatorName: d.createBy,