提交 80a3ae72 编写于 作者: 蔡祥熠

Merge branch 'cherry-pick-50015492' into 'develop'

Merge branch 'feature/View.default_selected_item' into 'wrdp'

See merge request o2oa/o2oa!1504
......@@ -196,7 +196,7 @@
<div style="display:none; height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">自定义过滤数据</div>
<div class="fieldListAreaNode_vf" style="display:none; min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
</div>
<div class="MWFScriptArea" name="defaultSelectedScript" title="默认选中行脚本"></div>
</div>
<div title="事件" class="MWFTab">
<div class="MWFEventsArea" name="events"></div>
......
......@@ -257,7 +257,7 @@
<div style="display:none; height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">自定义过滤数据</div>
<div class="fieldListAreaNode_vf" style="display:none; min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
</div>
<div class="MWFScriptArea" name="defaultSelectedScript" title="默认选中行脚本"></div>
</div>
<div title="事件" class="MWFTab">
......
......@@ -107,6 +107,7 @@
<div id="text{$.pid}selectedScriptArea" style="display: text{($.result=='script')?'block':'none'};">
<div class="MWFScriptArea" name="selectedScript" title="选择结果 (S)"></div>
</div>
<div class="MWFScriptArea" name="defaultSelectedScript" title="默认选中行脚本"></div>
</div>
<div title="过滤" class="MWFTab">
<div class="MWFViewFilter">
......
......@@ -50,6 +50,8 @@ MWF.xApplication.process.Xform.View = MWF.APPView = new Class({
}.bind(this));
}
debugger;
//var data = JSON.parse(this.json.data);
var viewJson = {
"application": (this.json.queryView) ? this.json.queryView.appName : this.json.application,
......@@ -60,7 +62,8 @@ MWF.xApplication.process.Xform.View = MWF.APPView = new Class({
"itemStyles": this.json.itemStyles,
"isExpand": this.json.isExpand || "no",
"showActionbar" : this.json.actionbar === "show",
"filter": filter
"filter": filter,
"defaultSelectedScript" : this.json.defaultSelectedScript ? this.json.defaultSelectedScript.code : null
};
//MWF.xDesktop.requireApp("query.Query", "Viewer", function(){
......
......@@ -283,7 +283,8 @@ MWF.xApplication.process.Xform.ViewSelector = MWF.APPViewSelector = new Class({
"itemStyles": this.json.itemStyles,
"isExpand": this.json.isExpand || "no",
"showActionbar" : this.json.actionbar === "show",
"filter": filter
"filter": filter,
"defaultSelectedScript" : this.json.defaultSelectedScript ? this.json.defaultSelectedScript.code : null
};
var options = {};
var width = options.width || "850";
......
......@@ -191,7 +191,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
this.createExportNode();
}
},
createViewNode: function(data){
createViewNode: function(data, callback){
this.viewAreaNode.empty();
this.selectedItems = [];
......@@ -268,20 +268,20 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
if (column.allowOpen) this.openColumns.push(column.column);
}.bind(this));
this.lookup(data);
this.lookup(data, callback);
}else{
this.viewJson.selectList.each(function(column){
if (column.hideColumn) this.hideColumns.push(column.column);
if (!column.allowOpen) this.openColumns.push(column.column);
}.bind(this));
this.lookup(data);
this.lookup(data, callback);
}
},
isSelectTdHidden :function(){
if( !this.viewJson.firstTdHidden ){
return false;
}
if( this.json.select === "single" || this.json.select === "multi" ){
if( this.json.select === "single" || this.json.select === "multi" || this.json.defaultSelectedScript || this.viewJson.defaultSelectedScript ){
return false;
}
if( this.viewJson.select === "single" || this.viewJson.select === "multi" ){
......@@ -391,7 +391,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
this.currentPage = this.options.defaultPage || 1;
this.options.defaultPage = null;
},
lookup: function(data){
lookup: function(data, callback){
this.getLookupAction(function(){
if (this.json.application){
......@@ -405,6 +405,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
if( this.noDataTextNode )this.noDataTextNode.destroy();
this.loadCurrentPageData( function () {
this.fireEvent("postLoad"); //用户配置的事件
if(callback)callback(this);
}.bind(this));
}else{
//this._loadPageNode();
......@@ -424,6 +425,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
this.loadingAreaNode = null;
}
this.fireEvent("postLoad"); //用户配置的事件
if(callback)callback(this);
}
}.bind(this));
}
......@@ -1246,12 +1248,12 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
})
}
},
setFilter : function( filter ){
setFilter : function( filter, callback ){
if( !filter )filter = [];
if( typeOf( filter ) === "object" )filter = [ filter ];
this.json.filter = filter;
if( this.viewAreaNode ){
this.createViewNode({"filterList": this.json.filter ? this.json.filter.clone() : null});
this.createViewNode({"filterList": this.json.filter ? this.json.filter.clone() : null}, callback);
}
},
switchView : function( json ){
......@@ -1381,6 +1383,27 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({
//}
}.bind(this));
//默认选中
var defaultSelectedScript = this.view.json.defaultSelectedScript || this.view.viewJson.defaultSelectedScript;
if( !this.isSelected && defaultSelectedScript ){
// var flag = this.view.json.select || this.view.viewJson.select || "none";
// if ( flag ==="single" || flag==="multi"){
//
// }
var flag = this.view.Macro.exec( defaultSelectedScript,
{"node" : this.node, "data" : this.data, "view": this.view, "row" : this});
if( flag ){
if( flag === "multi" || flag === "single" ){
this.select( flag );
}else if( flag.toString() === "true" ){
var f = this.view.json.select || this.view.viewJson.select || "none";
if ( f ==="single" || f==="multi"){
this.select();
}
}
}
}
// Object.each(this.data.data, function(cell, k){
// if (this.view.hideColumns.indexOf(k)===-1){
// var td = new Element("td", {"styles": this.css.viewContentTdNode}).inject(this.node);
......@@ -1587,8 +1610,8 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({
}
},
select: function(){
var flag = this.view.json.select || this.view.viewJson.select || "none";
select: function( force ){
var flag = force || this.view.json.select || this.view.viewJson.select || "none";
if (this.isSelected){
if (flag==="single"){
this.unSelectedSingle();
......
......@@ -117,6 +117,8 @@
<!--</tr>-->
</table>
<div class="MWFFormulaArea" name="data.defaultSelectedScript" title="默认选中行脚本"></div>
<!--<div class="MWFApplicationSelect" title="选择应用"></div>-->
......
......@@ -362,7 +362,14 @@ MWF.xApplication.query.ViewDesigner.Property = MWF.FVProperty = new Class({
scriptAreas.each(function (node) {
var title = node.get("title");
var name = node.get("name");
var scriptContent = this.data[name];
var names = name.split(".");
var scriptContent = this.data;
Array.each(names, function (n) {
if (scriptContent) scriptContent = scriptContent[n];
});
// var scriptContent = this.data[name];
MWF.require("MWF.widget.ScriptArea", function () {
var scriptArea = new MWF.widget.ScriptArea(node, {
......@@ -370,7 +377,16 @@ MWF.xApplication.query.ViewDesigner.Property = MWF.FVProperty = new Class({
//"maxObj": this.propertyNode.parentElement.parentElement.parentElement,
"maxObj": this.designer.editContentNode,
"onChange": function () {
this.data[name] = scriptArea.toJson().code;
var scriptObj = this.data;
Array.each(names, function (n, idx) {
if( idx === names.length -1 )return;
if (scriptObj) scriptObj = scriptObj[n];
});
scriptObj[names[names.length -1]] = scriptArea.toJson().code;
// this.data[name] = scriptArea.toJson().code;
}.bind(this),
"onSave": function () {
this.designer.saveView();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册