Browse Source

调整model 'dashboardDesigner', 解决code smells, 未完成开发部分代码调整

shim 7 years ago
parent
commit
1e38d04dc3

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

@@ -176,11 +176,11 @@ class ChartList extends React.Component {
         return allGroups.map(p => {
             let c = cGroups.filter(c => c.pcode === p.code).sort((a, b) => a.index - b.index);
             return c.length > 0 ? (
-                <Menu.SubMenu key={p.code} title={<span style={{ fontWeight: selectedRecord ? (
+                <Menu.SubMenu key={p.code} title={<span style={{ fontWeight: selectedRecord ? 
                     (p.code+'' === selectedRecord.groupCode+'' ? 'bold' : (
                         c.find(ch => ch.code+'' === selectedRecord.groupCode+'') && c.find(ch => ch.code+'' === selectedRecord.groupCode+'').pcode === p.code ? 'bold' : 'normal'
                     ))
-                ) : chart.currentGroup[0].code === p.code ? 'bold' : 'normal' }}>{p.label}</span>} onTitleClick={(item) => {
+                 : chart.currentGroup[0].code === p.code ? 'bold' : 'normal' }}>{p.label}</span>} onTitleClick={(item) => {
                     dispatch({ type: 'chart/setCurrentGroup', group1: p });
                     if(selectedRecord) {
                         dispatch({ type: 'chart/remoteSetChartGroup', chart: selectedRecord, group: p });

+ 9 - 3
src/components/dashboardDesigner/elementConfig.jsx

@@ -10,18 +10,24 @@ const ElementConfig = ({operation, visibleBox, hideElementConfigBox, dashboardDe
    
     const okHandler = (model) => {
         if(operation === 'create') {
-            
+            return 
+            // TODO
         }else if(operation === 'modify') {
-            
+            return
+            // TODO
         }
     }
 
     const handleChange = (content) => {
-    console.log(content)
+    console.log(content) 
+        return
+        // TODO
     }
 
     const handleRawChange = (rawContent) => {
     console.log(rawContent)
+        return
+        // TODO
     }
 
     

+ 0 - 1
src/components/dashboardDesigner/layout.jsx

@@ -176,7 +176,6 @@ class DashboardDesigner extends React.Component {
                 <ReactGridLayout 
                     className={`grid-layout${this.state.editMode ?' grid-layout-edit': ''}`}  
                     cols={12}
-                    layout={this.state.layout} 
                     rowHeight={30} 
                     width={1200}  //TODO: 宽度响应式设计?
                     isDraggable={editMode}

+ 2 - 2
src/components/datasource/dataSource.jsx

@@ -100,11 +100,11 @@ class DataSource extends React.Component {
         return allGroups.map(p => {
             let c = cGroups.filter(c => c.pcode === p.code).sort((a, b) => a.index - b.index);
             return c.length > 0 ? (
-                <Menu.SubMenu key={p.code} title={<span style={{ fontWeight: selectedRecord ? (
+                <Menu.SubMenu key={p.code} title={<span style={{ fontWeight: selectedRecord ? 
                     (p.code+'' === selectedRecord.groupCode+'' ? 'bold' : (
                         c.find(ch => ch.code+'' === selectedRecord.groupCode+'') && c.find(ch => ch.code+'' === selectedRecord.groupCode+'').pcode === p.code ? 'bold' : 'normal'
                     ))
-                ) : dataSource.currentGroup[0].code === p.code ? 'bold' : 'normal' }}>{p.label}</span>} onTitleClick={(item) => {
+                 : dataSource.currentGroup[0].code === p.code ? 'bold' : 'normal' }}>{p.label}</span>} onTitleClick={(item) => {
                     dispatch({ type: 'dataSource/setCurrentGroup', group1: p });
                     if(selectedRecord) {
                         dispatch({ type: 'dataSource/remoteSetDataSourceGroup', dataSource: selectedRecord, group: p });

+ 4 - 23
src/models/dashboardDesigner.js

@@ -15,35 +15,16 @@ export default {
         },
         parameters: {
         },  //全局可用参数
-        layout:[{
-            key:0,
-            x:0,     //单个元素的坐标宽高
-            y:0,
-            w:1,
-            h:1,
-            minW:  1,  //最小宽度
-            maxW: Infinity, //最大宽度
-            minH:  1, //最小高度
-            maxH: Infinity,  //最大宽度
-        },{
-            key:1,
-            x:1,     //单个元素的坐标宽高
-            y:0,
-            w:1,
-            h:1,
-            minW:  1,  //最小宽度
-            maxW: Infinity, //最大宽度
-            minH:  1, //最小高度
-            maxH: Infinity,  //最大宽度
-        }],
         elementList:[{
             key:0,
             type:'chart',  //基础元素simple vs 图表元素chart
-            content:'',            
+            layout:{},
+            content:{},            
         }, {
             key:1,
             type:'simple',
-            content:'',
+            layout: {},
+            content:{},
         }],
         configBoxForm: {
         }