Browse Source

【看板展示】【table刷新定时器调整】

zhuth 8 years ago
parent
commit
1752641e9c

+ 0 - 1
kanban-client/app/assets/Table/index.css

@@ -16,7 +16,6 @@
 .rc-table-title {
   text-align: center;
   font-weight: bold;
-  font-size: large;
   padding: 5px;
 }
 .rc-table-content {

+ 0 - 1
kanban-client/app/assets/Table/index.less

@@ -24,7 +24,6 @@
 .@{prefixCls}-title {
     text-align: center;
     font-weight: bold;
-    font-size: large;
     padding: 5px;
 }
 .@{prefixCls}-content {

+ 6 - 4
kanban-client/app/component/Table.jsx

@@ -43,9 +43,10 @@ class TableModel extends React.Component {
 
 	// 定时任务
 	timing(obj) {
-		this.timerKeys.push(setInterval(function () {
+		let key = setInterval(function () {
 			obj.intervalFunction(this, this.state);
-		}.bind(this), obj.intervalTime || 3000));
+		}.bind(this), obj.intervalTime || 3000);
+		this.timerKeys.push(key);
 	}
 
 	// 调整行
@@ -150,8 +151,9 @@ class TableModel extends React.Component {
 	}
 
 	clearInterval() {
-		for (let timerKey in this.timerKeys) {
-			clearInterval(this.timerKeys[timerKey]);
+		for (let index in this.timerKeys) {
+			clearInterval(this.timerKeys[index]);
+			this.timerKeys.splice(index, 1);
 		}
 	}
 

+ 17 - 13
kanban-client/app/component/converter.js

@@ -120,7 +120,7 @@ function barConfig(model) {
                         fontSize: getFontSize() * .7
                     },
                     axisLabel: {
-                        rotate:  getScreenSize().screenWidth * layout.w / xf.length / 100 < 60 ? 45 : 0,
+                        rotate:  getScreenSize().width * layout.w / xf.length / 100 < 60 ? 45 : 0,
                         interval: 0,
                         textStyle: {
                             fontSize: getFontSize() * .7
@@ -129,6 +129,7 @@ function barConfig(model) {
                 }],
                 yAxis: [{
                     name: ytitle,
+                    nameRotate: .1,
                     type: ytype == 'numeric' ? 'value' : ytype,
                     nameTextStyle: {
                         fontSize: getFontSize() * .7
@@ -184,7 +185,7 @@ function lineConfig(model) {
                         fontSize: fontSize || getFontSize() * .7
                     },
                     axisLabel: {
-                        rotate:  getScreenSize().screenWidth * layout.w / xf.length / 100 < 60 ? 45 : 0,
+                        rotate:  getScreenSize().width * layout.w / xf.length / 100 < 60 ? 45 : 0,
                         interval: 0,
                         textStyle: {
                             fontSize: fontSize || getFontSize() * .7
@@ -193,6 +194,7 @@ function lineConfig(model) {
                 }],
                 yAxis: [{
                     name: ytitle,
+                    nameRotate: .1,
                     type: ytype == 'numeric' ? 'value' : ytype,
                     nameTextStyle: {
                         fontSize: fontSize || getFontSize() * .7
@@ -250,8 +252,8 @@ function getChartsTitle(fontSize, layout, title, subtitle) {
         },
         left: '50%',
         right: '50%',
-        itemGap: 0,
-        padding: 0
+        itemGap: 5,
+        padding: 10
     }
     return title;
 }
@@ -303,7 +305,7 @@ function getLineSeries(fontSize, series) {
 }
 
 function getPieSeries(fontSize, layout, series) {
-
+    let data = series instanceof Array ? series : [series];
     const model = {
         type: 'pie',
         radius: `${layout.w * .7}%`,
@@ -319,7 +321,7 @@ function getPieSeries(fontSize, layout, series) {
     }
     let s = Object.assign({},model);
     s.name = '';
-    s.data = series instanceof Array ? series : [series];
+    s.data = data;
     return [s];
 }
 
@@ -376,18 +378,20 @@ function parseStr(str) {
 
 function getScreenSize() {
     let root = document.getElementById('root');
-    let screenHeight = root.offsetHeight;
-    let screenWidth = root.offsetWidth;
-    return {screenHeight, screenWidth};
+    let height = root.offsetHeight;
+    let width = root.offsetWidth;
+    return {height, width};
 }
 
 function getFontSize() {
-    let {screenHeight, screenWidth} = getScreenSize();
-    if(screenWidth > 800) {
+    let {height, width} = getScreenSize();
+    if(width > 1000) {
+        return 24;
+    }else if(width > 800) {
         return 22;
-    }else if(screenWidth > 500) {
+    }else if(width > 500) {
         return 20;
-    }else if(screenWidth > 300) {
+    }else if(width > 300) {
         return 18;
     }else {
         return 16

+ 0 - 1
kanban-client/app/src/Form/Form.jsx

@@ -127,7 +127,6 @@ export default class Form extends React.Component {
             });
             columnsData.push(arr);
         }
-        console.log(columnsData);
         return columnsData;
     }