提交 11e1593d 编写于 作者: NoSubject's avatar NoSubject

Merge branch 'fix/Query.view_search_condition' into 'develop'

Merge of fix/Query.view_search_condition[数据中心]修复一些条件没有正确显示的BUG

See merge request o2oa/o2oa!197
......@@ -73,8 +73,8 @@ MWF.xApplication.ForumDocument.Vote = new Class({
}
var personStr = "";
if( this.data.voteCount ){
personStr = ",目前已有"+ this.data.voteCount +"人参与"
if( this.data.voteUserCount || this.data.voteCount ){
personStr = ",目前已有"+ this.data.voteUserCount || this.data.voteCount +"人参与"
}else{
personStr = ",目前还没有人参与"
}
......
......@@ -1013,6 +1013,7 @@ MWF.xApplication.process.ViewDesigner.Property.Filter = new Class({
this.calendar = new MWF.widget.Calendar(valueInput, {
"style": "xform",
"isTime": true,
"secondEnable" : true,
"target": this.property.designer.content,
"format": "%Y-%m-%d %H:%M:%S"
});
......
......@@ -100,6 +100,7 @@ MWF.xApplication.process.ViewDesigner.widget.ViewFilter = new Class({
this.calendar = new MWF.widget.Calendar(this.valueDatetimeInput, {
"style": "xform",
"isTime": true,
"secondEnable" : true,
"target": this.app.content,
"format": "db"
});
......
......@@ -319,7 +319,6 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
// }.bind(this));
// },
_loadPageNode : function(){
debugger;
this.viewPageAreaNode.empty();
this.paging = new o2.widget.Paging(this.viewPageAreaNode, {
countPerPage: this.json.pageSize || this.options.perPageCount,
......@@ -387,7 +386,6 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
}.bind(this));
},
loadCurrentPageData: function( callback ){
debugger;
//是否需要在翻页的时候清空之前的items ?
this.items = [];
......@@ -628,12 +626,10 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
}
},
_loadModuleEvents : function(){
debugger;
Object.each(this.viewJson.events, function(e, key){
if (e.code){
if (this.options.moduleEvents.indexOf(key)!==-1){
this.addEvent(key, function(event, target){
debugger;
return this.Macro.fire(e.code, target || this, event);
}.bind(this));
}
......@@ -850,33 +846,91 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
var option = this.viewSearchCustomPathListNode.options[idx];
var entry = option.retrieve("entry");
if (entry){
var selectableList = this.getCustomSelectScriptResult(entry);
switch (entry.formatType){
case "numberValue":
this.loadComparisonSelect(this.lp.numberFilter);
this.loadViewSearchCustomValueNumberInput();
if( selectableList.length > 0 ){
this.loadViewSerchCustomSelectByScript(selectableList)
}else{
this.loadViewSearchCustomValueNumberInput();
}
break;
case "dateTimeValue":
this.loadComparisonSelect(this.lp.dateFilter);
this.loadViewSearchCustomValueDateTimeInput();
if( selectableList.length > 0 ){
this.loadViewSerchCustomSelectByScript(selectableList)
}else {
this.loadViewSearchCustomValueDateTimeInput();
}
break;
case "dateValue":
this.loadComparisonSelect(this.lp.dateFilter);
this.loadViewSearchCustomValueDateInput();
if( selectableList.length > 0 ){
this.loadViewSerchCustomSelectByScript(selectableList)
}else {
this.loadViewSearchCustomValueDateInput();
}
break;
case "timeValue":
this.loadComparisonSelect(this.lp.dateFilter);
this.loadViewSearchCustomValueTimeInput();
if( selectableList.length > 0 ){
this.loadViewSerchCustomSelectByScript(selectableList)
}else {
this.loadViewSearchCustomValueTimeInput();
}
break;
case "booleanValue":
this.loadComparisonSelect(this.lp.booleanFilter);
this.loadViewSearchCustomValueBooleanInput();
if( selectableList.length > 0 ){
this.loadViewSerchCustomSelectByScript(selectableList)
}else {
this.loadViewSearchCustomValueBooleanInput();
}
break;
default:
this.loadComparisonSelect(this.lp.textFilter);
this.loadViewSearchCustomValueTextInput();
if( selectableList.length > 0 ){
this.loadViewSerchCustomSelectByScript(selectableList)
}else {
this.loadViewSearchCustomValueTextInput();
}
}
}
},
getCustomSelectScriptResult : function( entry ){
var scriptResult = [];
if( entry.valueType === "script" ){
if( entry.valueScript && entry.valueScript.code ){
var result = this.Macro.exec(entry.valueScript.code, this);
var array = typeOf( result ) === "array" ? result : [result];
for( var i=0; i<array.length; i++ ){
if( array[i].indexOf( "|" ) > -1 ){
var arr = array[i].split("|");
scriptResult.push({ "text" : arr[0], "value" : arr[1] })
}else{
scriptResult.push({ "text" : array[i], "value" : array[i] })
}
}
}
}
return scriptResult;
},
loadViewSerchCustomSelectByScript: function( array ){
this.viewSearchCustomValueContentNode.empty();
this.viewSearchCustomValueNode = new Element("select", {
"styles": this.css.viewFilterSearchCustomComparisonListNode,
"multiple": true
}).inject(this.viewSearchCustomValueContentNode);
array.each(function( v ){
var option = new Element("option", {
"style": this.css.viewFilterSearchOptionNode,
"value": v.value,
"text": v.text,
"selected" : array.length === 1
}).inject(this.viewSearchCustomValueNode);
}.bind(this));
},
loadViewSearchCustomValueNumberInput: function(){
this.viewSearchCustomValueContentNode.empty();
this.viewSearchCustomValueNode = new Element("input", {
......@@ -1001,23 +1055,32 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
var comparisonTitle = this.viewSearchCustomComparisonListNode.options[comparisonIdx].get("text");
var value = "";
switch (entry.formatType){
case "numberValue":
value = this.viewSearchCustomValueNode.get("value");
break;
case "dateTimeValue":
value = this.viewSearchCustomValueNode.get("value");
break;
case "booleanValue":
var idx = this.viewSearchCustomValueNode.selectedIndex;
if (idx!==-1){
var v = this.viewSearchCustomValueNode.options[idx].get("value");
value = (v==="true");
}
break;
default:
value = this.viewSearchCustomValueNode.get("value");
if( entry.valueType === "script" && entry.valueScript && entry.valueScript.code ){
var idx = this.viewSearchCustomValueNode.selectedIndex;
if (idx!==-1){
var v = this.viewSearchCustomValueNode.options[idx].get("value");
value = entry.formatType === "booleanValue" ? (v==="true") : v;
}
}else{
switch (entry.formatType){
case "numberValue":
value = this.viewSearchCustomValueNode.get("value");
break;
case "dateTimeValue":
value = this.viewSearchCustomValueNode.get("value");
break;
case "booleanValue":
var idx = this.viewSearchCustomValueNode.selectedIndex;
if (idx!==-1){
var v = this.viewSearchCustomValueNode.options[idx].get("value");
value = (v==="true");
}
break;
default:
value = this.viewSearchCustomValueNode.get("value");
}
}
if (value===""){
MWF.xDesktop.notice("error", {"x": "left", "y": "top"}, this.lp.filterErrorValue, this.viewSearchCustomValueContentNode, {"x": 0, "y": 85});
return false;
......
......@@ -206,6 +206,9 @@
<input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope=='all')?'checked':''} type="radio" value="all"/>全部
</td>
</tr>
<tr>
<td class="editTableValue" colspan="2">取应用和流程的并集</td>
</tr>
<tr>
<td class="editTableTitle">选择应用:</td>
<td class="editTableValue">
......@@ -237,6 +240,9 @@
<input class="editTableRadio" name="text{$.id}*data.where.draft" text{(!$.data.where.draft)?'checked':''} type="radio" value="false"/>
</td>
</tr>
<tr>
<td class="editTableValue" colspan="2">取栏目和分类的并集:</td>
</tr>
<tr>
<td class="editTableTitle">选择栏目:</td>
<td class="editTableValue">
......@@ -252,6 +258,9 @@
</table>
</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableValue" colspan="2">取组织、人员和身份的并集:</td>
</tr>
<tr>
<td class="editTableTitle">拟稿组织:</td>
<td class="editTableValue">
......@@ -277,27 +286,83 @@
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr><td class="editTableTitle">时段类型:</td><td class="editTableValue">
<input class="editTableRadio" name="text{$.id}*data.where.dateRange.dateRangeType"
onclick="if (this.checked){ $('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_DateArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_MonthArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_YearArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none'); }"
onclick="if (this.checked){
$('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_DateArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_MonthArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_YearArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_adjust').setStyle('display', 'none');
}"
type="radio" text{(['year','season','month','week','date','season'].indexOf($.data.where.dateRange.dateRangeType)==-1)?'checked':''} value="none"/>全部
<input class="editTableRadio" name="text{$.id}*data.where.dateRange.dateRangeType"
onclick="if (this.checked){ $('text{$.id}dateRangeType_RangeArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_DateArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_MonthArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_YearArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none'); }"
onclick="if (this.checked){
$('text{$.id}dateRangeType_RangeArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_DateArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_MonthArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_YearArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_adjust').setStyle('display', 'none');
}"
type="radio" text{($.data.where.dateRange.dateRangeType=='range')?'checked':''} value="range"/>范围<br/>
<input class="editTableRadio" name="text{$.id}*data.where.dateRange.dateRangeType"
onclick="if (this.checked){ $('text{$.id}dateRangeType_YearArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_DateArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_MonthArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none'); }"
onclick="if (this.checked){
$('text{$.id}dateRangeType_YearArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_DateArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_MonthArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_adjust').setStyle('display', '');
}"
type="radio" text{($.data.where.dateRange.dateRangeType=='year')?'checked':''} value="year"/>年度
<input class="editTableRadio" name="text{$.id}*data.where.dateRange.dateRangeType"
onclick="if (this.checked){ $('text{$.id}dateRangeType_YearArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_DateArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_MonthArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none');}"
onclick="if (this.checked){
$('text{$.id}dateRangeType_YearArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_DateArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_MonthArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_adjust').setStyle('display', '');
}"
type="radio" text{($.data.where.dateRange.dateRangeType=='season')?'checked':''} value="season"/>季度
<input class="editTableRadio" name="text{$.id}*data.where.dateRange.dateRangeType"
onclick="if (this.checked){ $('text{$.id}dateRangeType_YearArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_DateArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_MonthArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none');}"
onclick="if (this.checked){
$('text{$.id}dateRangeType_YearArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_DateArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_MonthArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_adjust').setStyle('display', '');
}"
type="radio" text{($.data.where.dateRange.dateRangeType=='month')?'checked':''} value="month"/>月度
<input class="editTableRadio" name="text{$.id}*data.where.dateRange.dateRangeType"
onclick="if (this.checked){ $('text{$.id}dateRangeType_YearArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_DateArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_WeekArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_MonthArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none');}"
onclick="if (this.checked){
$('text{$.id}dateRangeType_YearArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_DateArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_WeekArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_MonthArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_adjust').setStyle('display', '');
}"
type="radio" text{($.data.where.dateRange.dateRangeType=='week')?'checked':''} value="week"/>
<input class="editTableRadio" name="text{$.id}*data.where.dateRange.dateRangeType"
onclick="if (this.checked){ $('text{$.id}dateRangeType_YearArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_DateArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_MonthArea').setStyle('display', 'block'); $('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none'); $('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none');}"
onclick="if (this.checked){
$('text{$.id}dateRangeType_YearArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_DateArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_WeekArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_MonthArea').setStyle('display', 'block');
$('text{$.id}dateRangeType_SeasonArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_RangeArea').setStyle('display', 'none');
$('text{$.id}dateRangeType_adjust').setStyle('display', '');
}"
type="radio" text{($.data.where.dateRange.dateRangeType=='date')?'checked':''} value="date"/>
</td></tr>
</table>
......@@ -384,14 +449,16 @@
</table>
</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">偏移量:</td>
<td class="editTableValue">
<input type="text" name="data.where.dateRange.adjust" value="text{$.data.where.dateRange.adjust}" class="editTableInput"/>
</td>
</tr>
</table>
<div id="text{$.id}dateRangeType_adjust" style="display: text{($.data.where.dateRange.dateRangeType=='none'||$.data.where.dateRange.dateRangeType=='range')?'none':''}">
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">偏移量:</td>
<td class="editTableValue">
<input type="text" name="data.where.dateRange.adjust" value="text{$.data.where.dateRange.adjust}" class="editTableInput"/>
</td>
</tr>
</table>
</div>
</div>
<div title="过滤" class="MWFTab">
......@@ -457,8 +524,14 @@
<tr>
<td class="editTableTitle"></td>
<td class="editTableValue">
<input type="radio" value="restrict" name="text{$.id}viewFilterType" onclick="if (this.checked){ $('text{$.id}viewFilterRestrict').setStyle('display', 'block');}"/>作为默认过滤条件<br>
<input type="radio" value="custom" name="text{$.id}viewFilterType" onclick="if (this.checked){ $('text{$.id}viewFilterRestrict').setStyle('display', 'none');}" checked/>作为自定义过滤数据
<input type="radio" value="restrict" name="text{$.id}viewFilterType" onclick="if (this.checked){
$('text{$.id}viewFilterRestrict').setStyle('display', 'block');
$('text{$.id}viewCustomFilterRestrict').setStyle('display', 'none');
}"/>作为默认过滤条件<br>
<input type="radio" value="custom" name="text{$.id}viewFilterType" onclick="if (this.checked){
$('text{$.id}viewFilterRestrict').setStyle('display', 'none');
$('text{$.id}viewCustomFilterRestrict').setStyle('display', 'block');
}" checked/>作为自定义过滤数据
</td>
</tr>
</table>
......@@ -626,6 +699,27 @@
</div>
</div>
<div id="text{$.id}viewCustomFilterRestrict" style="display: block">
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">值:</td>
<td class="editTableValue">
<input class="editTableRadio" onclick="
if (this.checked){
$('text{$.id}viewCustomFilterValueScriptDiv').setStyle('display', 'none');
}" name="viewCustomFilterValueType" checked type="radio" value="input"/>输入
<input class="editTableRadio" onclick="
if (this.checked){
$('text{$.id}viewCustomFilterValueScriptDiv').setStyle('display', 'block');
}" name="viewCustomFilterValueType" type="radio" value="script"/>可选
</td>
</tr>
</table>
<div style="display:none" id="text{$.id}viewCustomFilterValueScriptDiv">
<div style="padding: 5px">return ["选项文本|选项值"]</div>
<div name="text{$.id}viewCustomFilterValueScript" title="选项脚本"></div>
</div>
</div>
</div>
<div></div>
<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">默认过滤条件</div>
......
......@@ -1202,6 +1202,7 @@ MWF.xApplication.query.ViewDesigner.Property.Filter = new Class({
this.calendar = new MWF.widget.Calendar(valueInput, {
"style": "xform",
"isTime": true,
"secondEnable": true,
"target": this.property.designer.content,
"format": "%Y-%m-%d %H:%M:%S"
});
......
......@@ -65,6 +65,27 @@ MWF.xApplication.query.ViewDesigner.widget.ViewFilter = new Class({
this.scriptArea.load(v);
}.bind(this));
},
createCustomFilterValueScriptArea : function(node){
var title = node.get("title");
MWF.require("MWF.widget.ScriptArea", function(){
this.customFilterValueScriptArea = new MWF.widget.ScriptArea(node, {
"title": title,
"isload" : true,
"isbind" : false,
"maxObj": this.app.formContentNode || this.app.pageContentNode,
"onChange": function(){
this.customFilterValueScriptData = this.customFilterValueScriptArea.toJson();
}.bind(this),
"onSave": function(){
//this.app.saveForm();
}.bind(this),
"style": "formula"
});
var v = (this.customFilterValueScriptData) ? this.customFilterValueScriptData.code : "";
this.customFilterValueScriptArea.load(v);
}.bind(this));
},
getInputNodes: function(){
this.inputAreaNode = this.node.getFirst("div");
this.actionAreaNode = this.inputAreaNode.getNext().setStyles(this.css.actionAreaNode);
......@@ -95,12 +116,23 @@ MWF.xApplication.query.ViewDesigner.widget.ViewFilter = new Class({
this.valueDateInput = inputs[7];
this.valueTimeInput = inputs[8];
this.datatypeInput.addEvent("change")
debugger;
var dataId = this.app.view.data.id;
this.customFilterValueTypes = this.inputAreaNode.getElements("[name='"+dataId+"viewCustomFilterValueType']");
this.customFilterValueScriptDiv = this.inputAreaNode.getElement("#"+dataId+"viewCustomFilterValueScriptDiv");
this.customFilterValueScript = this.inputAreaNode.getElement("[name='"+dataId+"viewCustomFilterValueScript']");
if( this.customFilterValueScript ){
this.createCustomFilterValueScriptArea(this.customFilterValueScript);
}
this.datatypeInput.addEvent("change");
MWF.require("MWF.widget.Calendar", function(){
this.calendar = new MWF.widget.Calendar(this.valueDatetimeInput, {
"style": "xform",
"isTime": true,
"secondEnable": true,
"target": this.app.content,
"format": "db",
"onComplate": function(){
......@@ -116,6 +148,7 @@ MWF.xApplication.query.ViewDesigner.widget.ViewFilter = new Class({
new MWF.widget.Calendar(this.valueTimeInput, {
"style": "xform",
"timeOnly": true,
"secondEnable": true,
"target": this.app.content,
"format": "%H:%M:%S"
});
......@@ -147,6 +180,7 @@ MWF.xApplication.query.ViewDesigner.widget.ViewFilter = new Class({
this.calendar = new MWF.widget.Calendar(this.valueDatetimeInput2, {
"style": "xform",
"isTime": true,
"secondEnable": true,
"target": this.app.content,
"format": "db",
"onComplate": function(){
......@@ -162,6 +196,7 @@ MWF.xApplication.query.ViewDesigner.widget.ViewFilter = new Class({
new MWF.widget.Calendar(this.valueTimeInput2, {
"style": "xform",
"timeOnly": true,
"secondEnable": true,
"target": this.app.content,
"format": "%H:%M:%S"
});
......@@ -279,6 +314,17 @@ MWF.xApplication.query.ViewDesigner.widget.ViewFilter = new Class({
this.addCustomFilterItem();
}
}
this.setData({
"logic": "and",
"path": "",
"title": "",
"type": this.restrictFilterInput.checked ? "restrict" : "custom",
"comparison": "equals",
"formatType": "textValue",
"value": "",
"otherValue": "",
"code": ""
});
},
modifyFilterItem: function(){
var data = this.getInputData();
......@@ -430,16 +476,36 @@ MWF.xApplication.query.ViewDesigner.widget.ViewFilter = new Class({
}
break;
}
return {
"logic": logic,
"path": path,
"title": title,
"type": type,
"comparison": comparison,
"formatType": formatType,
"value": value,
"otherValue": value2,
"code": this.scriptData
if( type === "restrict" ){
return {
"logic": logic,
"path": path,
"title": title,
"type": type,
"comparison": comparison,
"formatType": formatType,
"value": value,
"otherValue": value2,
"code": this.scriptData
};
}else{
var valueType = "";
this.customFilterValueTypes.each( function (radio) {
if( radio.get("checked") )valueType = radio.get("value");
});
return {
"logic": logic,
"path": path,
"title": title,
"type": type,
"comparison": comparison,
"formatType": formatType,
"value": value,
"otherValue": value2,
"code": this.scriptData,
"valueType" : valueType,
"valueScript" : this.customFilterValueScriptData
};
}
},
......@@ -450,6 +516,7 @@ MWF.xApplication.query.ViewDesigner.widget.ViewFilter = new Class({
break;
}
}
this.titleInput.set("value", data.title);
this.pathInput.set("value", data.path);
......@@ -520,7 +587,35 @@ MWF.xApplication.query.ViewDesigner.widget.ViewFilter = new Class({
break;
}
this.scriptData = data.code;
if (this.scriptArea.editor) this.scriptArea.editor.setValue(this.scriptData.code);
if (this.scriptArea && this.scriptArea.editor) this.scriptArea.editor.setValue(this.scriptData.code);
debugger;
if( data.type === "custom" ){
this.customFilterValueTypes.each( function (radio) {
if( data.valueType ){
if( data.valueType === radio.get("value") )radio.set("checked", true);
}else{
if( "input" === radio.get("value") )radio.set("checked", true);
}
});
if ( this.customFilterValueScriptArea ){
if( !data.valueType || data.valueType === "input" ){
this.customFilterValueScriptDiv.hide();
this.customFilterValueScriptData = "";
this.customFilterValueScriptArea.editor.setValue( "" );
}else{
this.customFilterValueScriptDiv.show();
this.customFilterValueScriptData = data.valueScript;
this.customFilterValueScriptArea.editor.setValue( data.valueScript ? data.valueScript.code : "" );
}
}
}
this.changeValueInput();
if(this.datatypeInput.onchange){
this.datatypeInput.onchange();
}
},
deleteItem: function(item){
......@@ -572,7 +667,11 @@ MWF.xApplication.query.ViewDesigner.widget.ViewFilter.Item = new Class({
},
getText: function(){
var lp = this.app.lp.filter;
return lp[this.data.logic]+" "+this.data.path+" "+lp[this.data.comparison] + " \""+this.data.value+"\""+((this.data.comparison=="range") ? ", \""+this.data.otherValue+"\"" : "");
if( this.data.formatType === "numberValue" ){
return lp[this.data.logic]+" "+this.data.path+" "+lp[this.data.comparison] + " "+this.data.value+((this.data.comparison=="range") ? ", \""+this.data.otherValue+"\"" : "");
}else{
return lp[this.data.logic]+" "+this.data.path+" "+lp[this.data.comparison] + " \""+this.data.value+"\""+((this.data.comparison=="range") ? ", \""+this.data.otherValue+"\"" : "");
}
},
reload: function(data){
this.data = data;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册