提交 ef3611ee 编写于 作者: U unknown

表单和页面中的statement组件增加参数条件

上级 f55587e5
......@@ -154,6 +154,7 @@ o2.widget.ScriptArea = new Class({
},
bind: function(content){
if( o2.typeOf(content) !== "object" )return;
this.value = content.code;
this.html = content.code;
if (content.editors){
......
......@@ -80,18 +80,21 @@
<div class="MWFStatementFilter">
<div class="inputAreaNode_vf">
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable restrictViewFilterTable_vf" style="table-layout: fixed;">
<tr id="text{$.id}pathInputSelectTr">
<tr class="parameterInputTr" style="display: none">
<td class="editTableTitle">{{$.lp.parameter}}:</td>
<td class="editTableValue">
<input type="text" class="editTableInput parameterInput_vf"/>
<div style="line-height: 20px;color:#999;">{{$.lp.parameterNote}}</div>
</td>
</tr>
<tr class="filterListInputTr" id="text{$.id}pathInputSelectTr">
<td class="editTableTitle">{{$.lp.select}}:</td>
<td class="editTableValue">
<select class="pathInputSelect_vf"></select>
<!-- <div style="line-height: 20px;color:#999;">注:选择路径后,需在选择的值前面加上"表别名.",如:o.</div>-->
</td>
</tr>
<tr style="display:none">
<td class="editTableTitle">{{$.lp.title}}:</td>
<td class="editTableValue"><input type="text" class="editTableInput titleInput_vf"/></td>
</tr>
<tr>
<tr class="filterListInputTr" >
<td class="editTableTitle">{{$.lp.path}}:</td>
<td class="editTableValue">
<input type="text" class="editTableInput pathInput_vf"/>
......@@ -107,57 +110,70 @@
<option value="booleanValue">{{$.lp.boolean}}</option>
</select></td>
</tr>
<tr style="display:none">
<td class="editTableTitle"></td>
<td class="editTableValue">
<input type="radio" class="restrictFilterInput_vf" value="restrict" name="text{$.id}viewFilterType" checked/>{{$.lp.asDefaultFilter}}<br>
<input type="radio" class="customFilterInput_vf" value="custom" name="text{$.id}viewFilterType"/>{P{$.lp.asCustomFilter}
</td>
</tr>
</table>
<table id="text{$.pid}viewFilterRestrict" width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr style="display:none;">
<td class="editTableTitle">{{$.lp.logic}}:</td>
<td class="editTableValue"><select class="logicInput_vf">
<option selected value="and">{{$.lp.and}}</option>
<option value="or">{{$.lp.or}}</option>
</select></td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.compare}}:</td>
<td class="editTableValue"><select class="comparisonInput_vf">
<option value="equals" selected>{{$.lp.equals}}(==)</option>
<option value="notEquals">{{$.lp.notEquals}}(!=)</option>
<option value="greaterThan">{{$.lp.greaterThan}}(>)</option>
<option value="greaterThanOrEqualTo">{{$.lp.greaterThanOrEqualTo}}(>=)</option>
<option value="lessThan">{{$.lp.lessThan}}(<)</option>
<option value="lessThanOrEqualTo">{{$.lp.lessThanOrEqualTo}}(<=)</option>
<option value="like">{{$.lp.like}}(like)</option>
<option value="notLike">{{$.lp.notLike}}(not-like)</option>
<option value="range">{{$.lp.range}}(range)</option>
</select></td>
</tr>
<tr style="display:none">
<td class="editTableTitle">{{$.lp.value}}:</td>
<td class="editTableValue">
<input type="text" class="editTableInput valueTextInput_vf" style="display: block"/>
<input type="number" class="editTableInput valueNumberInput_vf" style="display: none"/>
<input type="text" class="editTableInput valueDatetimeInput_vf" style="display: none" readonly/>
<tr class="filterListInputTr">
<td class="editTableTitle">{{$.lp.compare}}:</td>
<td class="editTableValue"><select class="comparisonInput_vf">
<option value="equals" selected>{{$.lp.equals}}(==)</option>
<option value="notEquals">{{$.lp.notEquals}}(!=)</option>
<option value="greaterThan">{{$.lp.greaterThan}}(>)</option>
<option value="greaterThanOrEqualTo">{{$.lp.greaterThanOrEqualTo}}(>=)</option>
<option value="lessThan">{{$.lp.lessThan}}(<)</option>
<option value="lessThanOrEqualTo">{{$.lp.lessThanOrEqualTo}}(<=)</option>
<option value="like">{{$.lp.like}}(like)</option>
<option value="notLike">{{$.lp.notLike}}(not-like)</option>
<option value="range">{{$.lp.range}}(range)</option>
</select></td>
</tr>
<tr style="display:none">
<td class="editTableTitle">{{$.lp.subject}}:</td>
<td class="editTableValue"><input type="text" class="editTableInput titleInput_vf"/></td>
</tr>
<tr style="display:none;">
<td class="editTableTitle">{{$.lp.logic}}:</td>
<td class="editTableValue"><select class="logicInput_vf">
<option selected value="and">{{$.lp.and}}</option>
<option value="or">{{$.lp.or}}</option>
</select></td>
</tr>
<tr style="display:none">
<td class="editTableTitle">{{$.lp.value}}:</td>
<td class="editTableValue">
<input type="text" class="editTableInput valueTextInput_vf" style="display: block"/>
<input type="number" class="editTableInput valueNumberInput_vf" style="display: none"/>
<input type="text" class="editTableInput valueDatetimeInput_vf" style="display: none" readonly/>
<input type="text" class="editTableInput valueDateInput_vf" style="display: none" readonly/>
<input type="text" class="editTableInput valueTimeInput_vf" style="display: none" readonly/>
<select class="valueBooleanInput_vf" style="display: none">
<option value="true" selected>{{$.lp.true}}(True)</option>
<option value="false">{{$.lp.false}}(False)</option>
</select>
</td>
</tr>
<select class="valueBooleanInput_vf" style="display: none">
<option value="true" selected>{{$.lp.true}}(True)</option>
<option value="false">{{$.lp.false}}(False)</option>
</select>
</td>
</tr>
</table>
<div title="值" class="MWFFilterFormulaArea"></div>
<table id="text{$.pid}viewFilterRestrict" width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle"></td>
<td class="editTableValue">
<input type="radio" class="restrictFilterInput_vf" value="restrict" name="text{$.id}viewFilterType" checked onclick="if (this.checked){
debugger;
this.getParent('.inputAreaNode_vf').getElements('tr.parameterInputTr').hide();
this.getParent('.inputAreaNode_vf').getElements('tr.filterListInputTr').setStyle('display','');
}"/>{{$.lp.addDefaultConditionByPath}}<br>
<input type="radio" class="restrictParameterInput_form_vf" value="custom" name="text{$.id}viewFilterType" onclick="if (this.checked){
debugger;
this.getParent('.inputAreaNode_vf').getElements('tr.parameterInputTr').setStyle('display','');
this.getParent('.inputAreaNode_vf').getElements('tr.filterListInputTr').hide();
}"/>{{$.lp.addDefaultConditionByParameter}}
</td>
</tr>
</table>
<div title="{{$.lp.value}}" class="MWFFilterFormulaArea"></div>
</div>
<div class="actionAreaNode_vf"></div>
<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">{{$.lp.defaultFilter}}</div>
<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">{{$.lp.pathConditions}}</div>
<div class="filterListAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">{{$.lp.parameterConditions}}}</div>
<div class="parameterListAreaNode_form_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
</div>
<div class="MWFScriptArea" name="defaultSelectedScript" title="{{$.lp.defaultSelectedLineScript}}"></div>
<div class="MWFScriptArea" name="selectedAbleScript" title="{{$.lp.allowSelectiLineScript}}" id="text{$.pid}selectedAbleScript"
......
......@@ -54,13 +54,13 @@
</td>
</tr>
<tr>
<td class="editTableTitle">高度</td>
<td class="editTableTitle">{{$.lp.height}}</td>
<td class="editTableValue">
<input type="text" name="DialogHeight" value="text{$.DialogHeight}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">宽度</td>
<td class="editTableTitle">{{$.lp.width}}</td>
<td class="editTableValue">
<input type="text" name="DialogWidth" value="text{$.DialogWidth}" class="editTableInput"/>
</td>
......@@ -214,9 +214,9 @@
<div title="{{$.lp.value}}" class="MWFFilterFormulaArea"></div>
</div>
<div class="actionAreaNode_vf"></div>
<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">路径默认条件</div>
<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">{{$.lp.pathConditions}}</div>
<div class="filterListAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">参数默认条件</div>
<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">{{$.lp.parameterConditions}}}</div>
<div class="parameterListAreaNode_form_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
</div>
</div>
......
......@@ -546,10 +546,11 @@ MWF.xApplication.process.FormDesigner.Property = MWF.FCProperty = new Class({
loadStatementFilter: function(){
var nodes = this.propertyContent.getElements(".MWFStatementFilter");
var filtrData = this.data.filterList;
var parameterData = this.data.parameterList;
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, "parameterData": null}, {
this.viewFilter = new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.form.designer, {"filtrData": filtrData, "customData": null, "parameterData": parameterData}, {
"statementId" : this.data.queryStatement ? this.data.queryStatement.id : "",
"withForm" : true,
"onChange": function(ids){
......
......@@ -1141,6 +1141,10 @@ MWF.xApplication.process.FormDesigner.LP = {
"showZero": "Show Zero",
"showNullString": "Show an empty string",
"centerServer": "Center service",
"pathConditions": "Path default conditions",
"parameterConditions": "Parameter default conditions",
"addDefaultConditionByPath": "Add default condition by path",
"addDefaultConditionByParameter": "Add default condition by parameter",
"wps" : {
"config":"Config",
"options" : "options",
......
......@@ -1150,6 +1150,10 @@ MWF.xApplication.process.FormDesigner.LP = {
"showZero": "显示零",
"showNullString": "显示空字符串",
"centerServer": "中心服务",
"pathConditions": "路径默认条件",
"parameterConditions": "参数默认条件",
"addDefaultConditionByPath": "通过路径添加默认条件",
"addDefaultConditionByParameter": "通过参数添加默认条件",
"wps" : {
"config":"配置",
"options" : "通用选项",
......
......@@ -76,6 +76,7 @@ MWF.xApplication.process.Xform.Statement = MWF.APPStatement = new Class(
},
loadView: function(){
if (!this.json.queryStatement) return "";
var filter = null;
if (this.json.filterList && this.json.filterList.length){
filter = [];
......@@ -86,6 +87,14 @@ MWF.xApplication.process.Xform.Statement = MWF.APPStatement = new Class(
}.bind(this));
}
var parameter = null;
if( this.json.parameterList && this.json.parameterList.length ){
parameter = {};
this.json.parameterList.each(function(entry){
parameter[entry.parameter] = this.parseParameter(entry);
}.bind(this));
}
//var data = JSON.parse(this.json.data);
......@@ -100,6 +109,7 @@ MWF.xApplication.process.Xform.Statement = MWF.APPStatement = new Class(
"isExpand": this.json.isExpand || "no",
"showActionbar" : this.json.actionbar === "show",
"filter": filter,
"parameter": parameter,
"defaultSelectedScript" : this.json.defaultSelectedScript ? this.json.defaultSelectedScript.code : null,
"selectedAbleScript" : this.json.selectedAbleScript ? this.json.selectedAbleScript.code : null
};
......@@ -150,5 +160,69 @@ MWF.xApplication.process.Xform.Statement = MWF.APPStatement = new Class(
}else{
return [];
}
},
parseParameter: function (f) {
var value = f.value;
if( f.valueType === "script" ){
value = this.form.Macro.exec(f.valueScript ? f.valueScript.code : "", this);
}
if (typeOf(value) === "date") {
value = value.format("db");
}
var user = layout.user;
switch (value) {
case "@person":
value = user.distinguishedName;
break;
case "@identityList":
value = user.identityList.map(function (d) {
return d.distinguishedName;
});
break;
case "@unitList":
o2.Actions.load("x_organization_assemble_express").UnitAction.listWithPerson({"personList": [user.distinguishedName]}, function (json) {
value = json.unitList;
}, null, false);
break;
case "@unitAllList":
o2.Actions.load("x_organization_assemble_express").UnitAction.listWithIdentitySupNested({"personList": [user.distinguishedName]}, function (json) {
value = json.unitList;
}, null, false);
break;
case "@year":
value = (new Date().getFullYear()).toString();
break;
case "@season":
var m = new Date().format("%m");
if (["01", "02", "03"].contains(m)) {
value = "1"
} else if (["04", "05", "06"].contains(m)) {
value = "2"
} else if (["07", "08", "09"].contains(m)) {
value = "3"
} else {
value = "4"
}
break;
case "@month":
value = new Date().format("%Y-%m");
break;
case "@time":
value = new Date().format("db");
break;
case "@date":
value = new Date().format("%Y-%m-%d");
break;
default:
}
if (f.formatType === "dateTimeValue" || f.formatType === "datetimeValue") {
value = "{ts '" + value + "'}"
} else if (f.formatType === "dateValue") {
value = "{d '" + value + "'}"
} else if (f.formatType === "timeValue") {
value = "{t '" + value + "'}"
}
return value;
}
});
......@@ -50,14 +50,18 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
}
},
loadData: function () {
if (this.filtrData.parameterData && this.filtrData.parameterData.length && this.parameterListAreaNode) {
if (this.filtrData.parameterData && this.filtrData.parameterData.length ) {
this.filtrData.parameterData.each(function (data) {
if( this.options.withForm ){
data.type = "parameter_form";
this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemParameterForm(this, data));
if( this.parameterListAreaNode_form ){
data.type = "parameter_form";
this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemParameterForm(this, data));
}
}else{
data.type = "parameter";
this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemParameter(this, data));
if( this.parameterListAreaNode ){
data.type = "parameter";
this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemParameter(this, data));
}
}
}.bind(this));
}
......@@ -83,6 +87,9 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
MWF.require("MWF.widget.ScriptArea", function () {
this.scriptArea = new MWF.widget.ScriptArea(node, {
"title": title,
"isload": true,
"isbind": false,
"forceType": "ace",
"maxObj": this.app.formContentNode || this.app.pageContentNode,
"onChange": function () {
this.scriptData = this.scriptArea.toJson();
......@@ -104,6 +111,7 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
"title": title,
"isload": true,
"isbind": false,
"forceType": "ace",
"maxObj": this.app.formContentNode || this.app.pageContentNode,
"onChange": function () {
this.parameterValueScriptData = this.parameterValueScriptArea.toJson();
......@@ -125,6 +133,7 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
"title": title,
"isload": true,
"isbind": false,
"forceType": "ace",
"maxObj": this.app.formContentNode || this.app.pageContentNode,
"onChange": function () {
this.customFilterValueScriptData = this.customFilterValueScriptArea.toJson();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册