提交 923c28a0 编写于 作者: NoSubject's avatar NoSubject

Merge branch 'hotfix/修复门户页面中嵌入统计时行列转换报错的问题,并在页面的统计组件中增加了reloadStat方法,增加图表样式和表格样式的设置' into 'release'

Merge of hotfix/修复门户页面中嵌入统计时行列转换报错的问题,并在页面的统计组件中增加了reloadStat方法,增加图表样式和表格样式的设置 to release

See merge request o2oa/o2oa!1810
......@@ -1820,8 +1820,8 @@ MWF.xApplication.Meeting.MeetingTooltip = new Class({
this.setItemValue(contentNode, "subject", data.subject );
this.setItemValue(contentNode, "invitePerson", persons.join(",") );
this.setItemValue(contentNode, "description", description );
this.setItemValue(contentNode, "hostPerson", this.data.hostPerson.split("@")[0] );
this.setItemValue(contentNode, "hostUnit", this.data.hostUnit.split("@")[0] );
this.setItemValue(contentNode, "hostPerson", (this.data.hostPerson || "").split("@")[0] );
this.setItemValue(contentNode, "hostUnit", (this.data.hostUnit || "").split("@")[0] );
this.fireEvent("customContent", [contentNode, node]);
},
......
......@@ -231,6 +231,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
this.loadLanguage(function(flag) {
this.isParseLanguage = flag;
if (flag && this.formDataText) {
var data = o2.bindJson(this.formDataText, {"lp": MWF.xApplication.cms.Xform.LP.form});
this.data = JSON.parse(data);
......
......@@ -20,6 +20,8 @@
</table>
<div class="MWFMaplist" name="styles" title="{{$.lp.style}}"></div>
<div class="MWFMaplist" name="chartNodeStyles" title="{{$.lp.chartNodeStyles}}"></div>
<div class="MWFMaplist" name="tableNodeStyles" title="{{$.lp.tableNodeStyles}}"></div>
<div class="MWFMaplist" name="properties" title="{{$.lp.attribute}}"></div>
<div>
......@@ -52,6 +54,13 @@
<input class="editTableRadio" name="isTable" text{($.isTable=='no')?'checked':''} type="radio" value="no"/>{{$.lp.hide}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.showRowToColumn}}</td>
<td class="editTableValue">
<input class="editTableRadio" name="isRowToColumn" text{($.isRowToColumn!='no')?'checked':''} type="radio" value="yes"/>{{$.lp.show}}
<input class="editTableRadio" name="isRowToColumn" text{($.isRowToColumn=='no')?'checked':''} type="radio" value="no"/>{{$.lp.hide}}
</td>
</tr>
</table>
</div>
......
......@@ -24,6 +24,10 @@
"code": "",
"html": ""
},
"loadChart" : {
"code": "",
"html": ""
},
"click": {
"code": "",
"html": ""
......
......@@ -52,6 +52,13 @@
<input class="editTableRadio" name="isTable" text{($.isTable=='no')?'checked':''} type="radio" value="no"/>{{$.lp.hide}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.showRowToColumn}}</td>
<td class="editTableValue">
<input class="editTableRadio" name="isRowToColumn" text{($.isRowToColumn!='no')?'checked':''} type="radio" value="yes"/>{{$.lp.show}}
<input class="editTableRadio" name="isRowToColumn" text{($.isRowToColumn=='no')?'checked':''} type="radio" value="no"/>{{$.lp.hide}}
</td>
</tr>
</table>
</div>
......
......@@ -24,6 +24,10 @@
"code": "",
"html": ""
},
"loadChart": {
"code": "",
"html": ""
},
"click": {
"code": "",
"html": ""
......
......@@ -910,6 +910,7 @@ MWF.xApplication.process.FormDesigner.LP = {
"showChart": "Show Chart",
"showLegend": "Show Legend",
"showTable": "Show Table",
"showRowToColumn": "Row to column conversion",
"selectTag": "Select Tag",
"elementTag": "Tag",
......
......@@ -908,6 +908,9 @@ MWF.xApplication.process.FormDesigner.LP = {
"showChart": "显示图表",
"showLegend": "显示图例",
"showTable": "显示表格",
"showRowToColumn": "行列转换",
"chartNodeStyles": "图表容器样式",
"tableNodeStyles": "表格容器样式",
"selectTag": "选择标签",
"elementTag": "元素标签",
......
......@@ -24,7 +24,12 @@ MWF.xApplication.process.Xform.Stat = MWF.APPStat = new Class(
* @event MWF.xApplication.process.Xform.Stat#loadStat
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["load", "queryLoad", "postLoad", "loadStat"]
/**
* 图表加载完成触发.
* @event MWF.xApplication.process.Xform.Stat#afterLoadStat
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["load", "queryLoad", "postLoad", "loadStat", "loadChart"]
},
_loadUserInterface: function(){
......@@ -40,16 +45,9 @@ MWF.xApplication.process.Xform.Stat = MWF.APPStat = new Class(
reload: function(){
this.active();
},
loadStat: function(){
if (this.json.queryStat){
var viewJson = {
"application": this.json.queryStat.appName,
"statName": this.json.queryStat.name,
"isChart": (this.json.isChart!="no"),
"isLegend": (this.json.isLegend!="no"),
"isTable": (this.json.isTable!="no")
};
loadStat: function( json ){
var viewJson = Object.merge(this.getDefaultJson(), json || {});
if ( viewJson.application && viewJson.statName ){
MWF.xDesktop.requireApp("query.Query", "Statistician", function(){
/**
* @summary Statistician组件,平台使用该组件执行统计的逻辑
......@@ -62,11 +60,59 @@ MWF.xApplication.process.Xform.Stat = MWF.APPStat = new Class(
"resizeNode": (this.node.getStyle("height").toString().toLowerCase()!=="auto" && this.node.getStyle("height").toInt()>0),
"onLoaded": function(){
this.fireEvent("loadStat");
}.bind(this),
"onLoadChart": function(){
this.fireEvent("loadChart");
}.bind(this)
});
}.bind(this));
}
},
getDefaultJson: function(){
if( this.json.queryStat ){
return {
"application": this.json.queryStat.appName,
"statName": this.json.queryStat.name,
"isChart": (this.json.isChart!=="no"),
"isLegend": (this.json.isLegend!=="no"),
"isTable": (this.json.isTable!=="no"),
"isRowToColumn": (this.json.isRowToColumn!=="no"),
"tableNodeStyles": this.json.tableNodeStyles,
"chartNodeStyles": this.json.chartNodeStyles
};
}else{
return {};
}
},
/**
* @summary 重新加载统计。
* @param json {Object} 加载选项
* <pre><code class='language-js'>[{
* "application": "", //数据中心应用名称
* "statName": "", //统计名称
* "isChart": true, //是否显示图表
* "isLegend": true, //是否显示图例
* "isTable": true, //是否显示表格
* "isRowToColumn": true, //是否显示行列转换
* }]</code></pre>
* @example
* this.form.get("fieldId").reloadStat({
* "application": "数据中心应用名称",
* "statName": "统计名称"
* });
* @return {Boolean} 是否通过校验
*/
reloadStat: function(json){
var viewJson = Object.merge(this.getDefaultJson(), json || {});
if( viewJson.application && viewJson.statName ){
if( this.stat ){
this.stat.reload(viewJson);
}else{
this.loadStat(viewJson);
}
}
},
/**
* @summary 获取统计数据。
* @return {Ojbect} 统计数据.
......
......@@ -34,6 +34,14 @@ MWF.xApplication.query.Query.Statistician = MWF.QStatistician = new Class({
this.loadStatData();
},
reload: function(json){
if( this.stat )this.stat.destroy();
this.container.empty();
if(json)this.json = json;
this.loadLayout();
this.fireEvent("loadLayout");
this.loadStatData();
},
loadLayout: function(){
this.node = new Element("div", {"styles": this.css.node}).inject(this.container);
......@@ -111,7 +119,9 @@ MWF.xApplication.query.Query.Statistician.Stat = new Class({
}
if (this.json.isChart) this.chartAreaNode = new Element("div", {"styles": this.css.statChartAreaNode}).inject(this.node);
if( this.json.chartNodeStyles )this.chartAreaNode.setStyles(this.json.chartNodeStyles);
if (this.json.isTable) this.tableAreaNode = new Element("div#tableAreaNode", {"styles": this.css.statTableAreaNode}).inject(this.node);
if( this.json.tableNodeStyles )this.tableAreaNode.setStyles(this.json.tableNodeStyles);
this.loadData();
if (this.json.isTable) this.createTable();
if (this.json.isChart) this.createChart();
......@@ -174,7 +184,7 @@ MWF.xApplication.query.Query.Statistician.Stat = new Class({
"MWFButtonText": this.lp.chart.line
}).inject(this.chartToolbarNode);
}
if (this.data.calculate.isGroup ){
if (this.data.calculate.isGroup && this.json.isRowToColumn !== false ){
var actionNode = new Element("div", {
"MWFnodeid": "rowToColumn",
"MWFnodetype": "MWFToolBarButton",
......@@ -272,6 +282,7 @@ MWF.xApplication.query.Query.Statistician.Stat = new Class({
}.bind(this)
});
this.bar.load();
this.statistician.fireEvent("loadChart");
}.bind(this));
},
loadChartPie: function(){
......@@ -290,6 +301,7 @@ MWF.xApplication.query.Query.Statistician.Stat = new Class({
this.bar = new MWF.widget.chart.Pie(this.chartNode, data, {"textType": "percent"});
this.bar.load();
this.statistician.fireEvent("loadChart");
}.bind(this));
},
loadChartLine: function(){
......@@ -316,6 +328,7 @@ MWF.xApplication.query.Query.Statistician.Stat = new Class({
});
this.bar.load();
this.statistician.fireEvent("loadChart");
}.bind(this));
},
......@@ -363,9 +376,9 @@ MWF.xApplication.query.Query.Statistician.Stat = new Class({
if (this.bar) this.bar.destroy();
if (this.statistician.app){
if (this.resizeChartFun){
this.resizeChartFun.app.removeEvent("resizeCompleted", this.resizeChartFun);
this.resizeChartFun.app.removeEvent("postMaxSize", this.resizeChartFun);
this.resizeChartFun.app.removeEvent("postRestoreSize", this.resizeChartFun);
this.statistician.app.removeEvent("resizeCompleted", this.resizeChartFun);
this.statistician.app.removeEvent("postMaxSize", this.resizeChartFun);
this.statistician.app.removeEvent("postRestoreSize", this.resizeChartFun);
}
}
MWF.release(this);
......@@ -479,6 +492,7 @@ MWF.xApplication.query.Query.Statistician.GroupStat = new Class({
});
this.bar.load();
if (this.json.isLegend) this.loadFlags();
this.statistician.fireEvent("loadChart");
}.bind(this));
},
rowToColumn: function(data){
......@@ -552,6 +566,7 @@ MWF.xApplication.query.Query.Statistician.GroupStat = new Class({
var pie = new MWF.widget.chart.Pie(pieNode, data, {"textType": "percent"});
pie.load();
}.bind(this));
this.statistician.fireEvent("loadChart");
}.bind(this));
},
......@@ -606,6 +621,7 @@ MWF.xApplication.query.Query.Statistician.GroupStat = new Class({
});
this.bar.load();
if (this.json.isLegend) this.loadFlags();
this.statistician.fireEvent("loadChart");
}.bind(this));
},
......@@ -613,7 +629,7 @@ MWF.xApplication.query.Query.Statistician.GroupStat = new Class({
this.isRowToColumn = !this.isRowToColumn;
if (this.selectedRows.length || this.selectedCols.length) this.selectAll();
if ((this.selectedRows && this.selectedRows.length) || (this.selectedCols && this.selectedCols.length)) this.selectAll();
this.statGridData = this.rowToColumn(this.statGridData);
this.selectedData = [];
......@@ -760,8 +776,10 @@ MWF.xApplication.query.Query.Statistician.GroupStat = new Class({
},
reloadTable: function(){
this.tableAreaNode.empty();
this.createTable();
if(this.tableAreaNode){
this.tableAreaNode.empty();
this.createTable();
}
},
createTableHead: function(){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册