提交 4a0cbed1 编写于 作者: 蔡祥熠

Merge branch 'feature/Query.statement_xscript' into 'wrdp'

Merge of feature/Query.statement_xscript 修改查询视图 to wrdp

See merge request o2oa/o2oa!2016
......@@ -669,13 +669,12 @@ MWF.xScript.ViewEnvironment = function (ev) {
this.statement = {
"execute": function (statement, callback, async) {
var filterList = { "filterList": (statement.filter || null) };
MWF.Actions.get("x_query_assemble_surface").execute(statement.view, statement.application, filterList, function (json) {
var data = {
"grid": json.data.grid,
};
if (callback) callback(data);
}, null, async);
var obj = { "filterList": (statement.filterList || []), parameter : (statement.parameter || {}) };
MWF.Actions.load("x_query_assemble_surface").StatementAction.executeV2(
statement.name, statement.mode || "data", statement.page || 1, statement.pageSize || 20, obj,
function (json) {
if (callback) callback(json);
}, null, async);
},
"select": function (statement, callback, options) {
if (statement.statement) {
......
......@@ -161,9 +161,7 @@
</div>
<div class="actionAreaNode_vf"></div>
<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">默认过滤条件</div>
<div class="listAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
<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 class="filterListAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
</div>
<div class="MWFScriptArea" name="defaultSelectedScript" title="默认选中行脚本"></div>
<div class="MWFScriptArea" name="selectedAbleScript" title="允许选择行脚本" id="text{$.pid}selectedAbleScript"
......
......@@ -191,9 +191,9 @@
</div>
<div class="actionAreaNode_vf"></div>
<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">默认过滤条件</div>
<div class="listAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
<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 class="filterListAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
<!-- <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>
......
......@@ -525,12 +525,12 @@ MWF.xApplication.process.FormDesigner.Property = MWF.FCProperty = new Class({
nodes.each(function(node){
MWF.xDesktop.requireApp("query.StatementDesigner", "widget.ViewFilter", function(){
var _slef = this;
this.viewFilter = new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.form.designer, {"filtrData": filtrData, "customData": null}, {
this.viewFilter = new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.form.designer, {"filtrData": filtrData, "customData": null, "parameterData": null}, {
"statementId" : this.data.queryStatement ? this.data.queryStatement.id : "",
"withForm" : true,
"onChange": function(ids){
var data = this.getData();
_slef.changeJsonDate(["filterList"], data.data);
_slef.changeJsonDate(["filterList"], data.filterData);
//_slef.changeJsonDate(["data", "customFilterEntryList"], data.customData);
}
});
......
......@@ -157,11 +157,13 @@ MWF.xApplication.query.Query.Statement = MWF.QStatement = new Class({
( data.filterList || [] ).each( function (d) {
var parameterName = d.path.replace(/\./g, "_");
var value = d.value;
if( d.code && d.code.code ){
value = this.Macro.exec( d.code.code, this);
}
// if( d.code && d.code.code ){
// value = this.Macro.exec( d.code.code, this);
// }
if( d.comparison === "like" || d.comparison === "notLike" ){
this.parameter[ parameterName ] = "%"+value+"%";
if( value.substr(0, 1) !== "%" )value = "%"+value;
if( value.substr(value.length-1,1) !== "%" )value = value+"%";
this.parameter[ parameterName ] = value; //"%"+value+"%";
}else{
if( d.formatType === "dateTimeValue" || d.formatType === "datetimeValue"){
value = "{ts '"+value+"'}"
......@@ -177,14 +179,15 @@ MWF.xApplication.query.Query.Statement = MWF.QStatement = new Class({
this.filterList.push( d );
}.bind(this))
},
loadParameter : function( data ){
loadParameter : function(){
this.parameter = {};
var parameter = this.json.parameter ? Object.clone(this.json.parameter) : {};
//系统默认的参数
( this.viewJson.filterList || [] ).each( function (f) {
( this.viewJson.parameterList || [] ).each( function (f) {
var value = f.value;
if( data.parameter && data.parameter[ f.parameter ] ){
value = data.parameter[ f.parameter ];
delete data.parameter[ f.parameter ];
if( parameter && parameter[ f.parameter ] ){
value = parameter[ f.parameter ];
delete parameter[ f.parameter ];
}
debugger;
if( typeOf( value ) === "date" ){
......@@ -254,14 +257,12 @@ MWF.xApplication.query.Query.Statement = MWF.QStatement = new Class({
this.parameter[ f.parameter ] = value;
}.bind(this));
//传入的参数
if( data.parameter ){
for( var p in data.parameter ){
var value = data.parameter[p];
if( typeOf( value ) === "date" ){
value = "{ts '"+value+"'}"
}
this.parameter[ p ] = value;
for( var p in parameter ){
var value = parameter[p];
if( typeOf( value ) === "date" ){
value = "{ts '"+value+"'}"
}
parameter[ p ] = value;
}
},
loadCurrentPageData: function( callback, async, type ){
......@@ -484,14 +485,14 @@ MWF.xApplication.query.Query.Statement = MWF.QStatement = new Class({
switchStatement : function (json) {
this.switchView(json);
},
setFilter : function( filter, callback ){
setFilter : function( filter, parameter, callback ){
if( this.lookuping || this.pageloading )return;
if( !filter )filter = {"filterList": [], "paramter" : {} };
if( typeOf( filter ) === "object" )return;
this.json.filter = filter.filterList || [];
this.json.paramter = filter.paramter || {};
if( !filter )filter = [];
if( !parameter )parameter = {};
this.json.filter = filter;
this.json.parameter = parameter;
if( this.viewAreaNode ){
this.createViewNode({"filterList": this.json.filter.clone(), "paramter" : Object.clone(this.json.paramter) }, callback);
this.createViewNode({"filterList": this.json.filter.clone() }, callback);
}
}
});
......
......@@ -58,18 +58,18 @@ MWF.xApplication.query.StatementDesigner.Property = MWF.SDProperty = new Class({
},
loadViewFilter: function () {
var nodes = this.propertyContent.getElements(".MWFViewFilter");
var filtrData = this.view.data.data.filterList;
var parameterData = this.view.data.data.parameterList;
var customData = this.view.data.data.customFilterList;
nodes.each(function (node) {
MWF.xDesktop.requireApp("query.StatementDesigner", "widget.ViewFilter", function () {
var _slef = this;
this.viewFilter = new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.view.designer, {
"filtrData": filtrData,
"parameterData": parameterData,
"customData": customData
}, {
"onChange": function (ids) {
var data = this.getData();
_slef.changeJsonDate(["data", "filterList"], data.data);
_slef.changeJsonDate(["data", "parameterList"], data.parameterData);
_slef.changeJsonDate(["data", "customFilterList"], data.customData);
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册