Эх сурвалжийг харах

多画面展示功能调整

zhuth 7 жил өмнө
parent
commit
33e9d6ea89

+ 4 - 0
kanban-client/README.md

@@ -70,6 +70,10 @@ columns[i].rowStyle---------------指定列数据列样式
 * 重新设计form展示组件,不再使用td和div嵌套的方式(那可真蠢),超长内容自动隐藏
 ##### 20180502
 * IE/Safari浏览器兼容性调整
+##### 20180525
+* 添加pie图图例垂直排布时根据宽度自动换行逻辑
+##### 20180530
+* 看板多画面展示接口调整
 #### 已知小bug
 * 多模板看板第一次进入需要多等待一个刷新时才会切换到下一个模板。
 * 如果看板第一个模板返回报错则后续正确模板也将无法显示。

+ 9 - 7
kanban-client/app/component/factory.dev.js

@@ -6,13 +6,13 @@ import { converter } from './converter.js';
 import URL from '../constants/url.dev.json';
 import 'whatwg-fetch';
 
-import tempdata from '../data/BarTable.json';
+import tempdata from '../data/bug.json';
 
 class Factory extends React.Component {
 
     constructor(props) {
         super(props);
-        this.dev = 'local';
+        this.dev = 'local ';
         this.index = 0;
         this.state = {
             titleHeight: 0,
@@ -21,9 +21,9 @@ class Factory extends React.Component {
         };
     }
 
-    getModelConfig(mid) {
+    getModelConfig(url) {
         let me = this;
-        fetch(URL.path + mid, {
+        fetch(url, {
             method: 'POST',
             credentials: 'include'
         }).then(function (response) {
@@ -93,7 +93,8 @@ class Factory extends React.Component {
                     } else {
                         this.index++;
                     }
-                    this.getModelConfig(this.props.code[0] + '?kanbanCode=' + codes[this.index]);
+                    let reg = /(.*){code}(.*){index}(.*){kanbanCode}(.*)/g;
+                    this.getModelConfig(URL.completelyPath.replace(reg, '$1' + this.props.code + '$2' + this.props.index + '$3' + codes[this.index]));
                 }.bind(this), refresh.current.interval * 1000 || 10000)
             }
         }
@@ -107,7 +108,7 @@ class Factory extends React.Component {
     }
 
     componentWillMount() {
-        let { code } = this.props;
+        let { code, index } = this.props;
         if(this.dev == 'local') {
             this.setState({
                 model: converter(tempdata.data[0]),
@@ -123,7 +124,8 @@ class Factory extends React.Component {
                 });
             }.bind(this), 7000)
         }else {
-            this.getModelConfig(code[0]);
+            let reg = /(.*){code}(.*){index}(.*)/g;
+            this.getModelConfig(URL.defaultPath.replace(reg, '$1' + code + '$2' + index));
         }
     }
 

+ 7 - 5
kanban-client/app/component/factory.js

@@ -18,9 +18,9 @@ class Factory extends React.Component {
         window.forceUpdate = this.forceUpdate.bind(this);
     }
 
-    getModelConfig(mid) {
+    getModelConfig(url) {
         let me = this;
-        fetch(URL.path + mid, {
+        fetch(url, {
             method: 'POST',
             credentials: 'include'
         }).then(function (response) {
@@ -90,7 +90,8 @@ class Factory extends React.Component {
                     } else {
                         this.index++;
                     }
-                    this.getModelConfig(this.props.code[0] + '?kanbanCode=' + codes[this.index]);
+                    let reg = /(.*){code}(.*){index}(.*){kanbanCode}(.*)/g;
+                    this.getModelConfig(URL.completelyPath.replace(reg, '$1' + this.props.code + '$2' + this.props.index + '$3' + codes[this.index]));
                 }.bind(this), refresh.current.interval * 1000 || 10000)
             }
         }
@@ -104,8 +105,9 @@ class Factory extends React.Component {
     }
 
     componentWillMount() {
-        let { code } = this.props;
-        this.getModelConfig(code[0]);
+        let { code, index } = this.props;
+        let reg = /(.*){code}(.*){index}(.*)/g;
+        this.getModelConfig(URL.defaultPath.replace(reg, '$1' + code + '$2' + index));
     }
 
     componentDidMount() {

+ 2 - 1
kanban-client/app/constants/url.dev.json

@@ -1,3 +1,4 @@
 {
-    "path": "http://localhost:8081/panelInstance/parseData/"
+    "defaultPath": "http://localhost:8098/panelView/parseData/{code}?index={index}",
+    "completelyPath": "http://localhost:8098/panelView/parseData/{code}?index={index}&kanbanCode={kanbanCode}"
 }

+ 2 - 1
kanban-client/app/constants/url.json

@@ -1,3 +1,4 @@
 {
-    "path": "panelInstance/parseData/"
+    "defaultPath": "panelView/parseData/{code}?index={index}",
+    "completelyPath": "panelView/parseData/{code}?index={index}&kanbanCode={kanbanCode}"
 }

+ 6 - 4
kanban-client/app/main.dev.js

@@ -2,9 +2,8 @@ import React from 'react';
 import ReactDOM from 'react-dom';
 import Factory from './component/factory.dev.js';
 import DateFormatter from './utils/DateTimeUtils.js';
-import Promise from 'promise-polyfill';   
+import Promise from 'promise-polyfill';
   
-var code = '9B485291E33';
 Object.assign = Object.assign || function(target, varArgs) {
 	if (target == null) {
 		throw new TypeError('Cannot convert undefined or null to object');
@@ -28,10 +27,13 @@ Object.assign = Object.assign || function(target, varArgs) {
 // To add to window  
 if (!window.Promise) {  
 	window.Promise = Promise;  
-  }  
+}  
+
+var code = 'A64E4730611';
+var index = 0;
 
 ReactDOM.render(
-    <Factory code={[code]} />,
+    <Factory code={code} index={index} />,
 ( document.getElementById('root')));
 
   

+ 5 - 3
kanban-client/app/main.js

@@ -3,8 +3,7 @@ import ReactDOM from 'react-dom';
 import Factory from './component/factory.js';
 import DateFormatter from './utils/DateTimeUtils.js';
 import Promise from 'promise-polyfill';
-
-var code = window.location.search.substring(6);
+import {getUrlParam} from './utils/BaseUtils';
 
 Object.assign = Object.assign || function(target, varArgs) {
 	if (target == null) {
@@ -31,8 +30,11 @@ if (!window.Promise) {
 	window.Promise = Promise;
 }
 
+let code = getUrlParam('code');
+let index = getUrlParam('index');
+
 ReactDOM.render(
-    <Factory code={[code]} />,
+    <Factory code={code} index={index} />,
 ( document.getElementById('root')));
 
   

+ 8 - 1
kanban-client/app/utils/BaseUtils.js

@@ -104,5 +104,12 @@ function isEmptyObject(model) {
     return isEmpty;
 }
 
+function getUrlParam(name) {   
+    var reg = new RegExp("(^|&)"+name+"=([^&]*)(&|$)");   
+    var r = window.location.search.substr(1).match(reg);   
+    if (r != null) return decodeURI(r[2]); 
+    return null;   
+}
+
 
-export { sort, remove, isEqual, isEmptyObject};
+export { sort, remove, isEqual, isEmptyObject, getUrlParam};