Explorar el Código

查询设计中允许使用视图

unknown hace 5 años
padre
commit
32b1a9231e

+ 4 - 90
o2web/source/x_component_query_StatementDesigner/$Statement/column.html

@@ -32,105 +32,19 @@
         <div style="border-top: 1px solid #999; margin-top:10px">
             <div style="background-color: #EEE; height:24px; line-height: 24px; text-align: center; font-weight: bold">数据</div>
             <div class="MWFDataData" id="text{$.pid}dataDataEditor">
-                <div style="display:text{($.vtype=='process')?'block':'none'}" id="text{$.pid}dataPathSelectedProcessArea" class="text{$.vid}dataPathSelectedProcessArea">
-                    <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-                        <tr>
-                            <td class="editTableTitle">选择数据:</td>
-                            <td class="editTableValue"><select id="text{$.pid}dataPathSelected" onchange=" var v=this.options[this.selectedIndex].value; if (v){var n = $('text{$.pid}viewColumnPathInput'); n.set('value', v); n.focus();} ">
-                                <option value="" selected>(请选择)</option>
-                                <option value="$work.title">标题</option>
-                                <option value="$work.startTime">创建时间</option>
-                                <option value="$work.startTimeMonth">创建月份</option>
-                                <option value="$work.completedTime">完成时间</option>
-                                <option value="$work.completedTimeMonth">完成月份</option>
-                                <option value="$work.creatorPerson">拟稿人</option>
-                                <option value="$work.creatorIdentity">拟稿人身份</option>
-                                <option value="$work.creatorUnit">拟稿组织</option>
-                                <option value="$work.creatorUnitLevelName">拟稿组织层级</option>
-                                <option value="$work.application">应用ID</option>
-                                <option value="$work.applicationName">应用名称</option>
-                                <option value="$work.applicationAlias">应用别名</option>
-                                <option value="$work.process">流程ID</option>
-                                <option value="$work.processName">流程名称</option>
-                                <option value="$work.processAlias">流程别名</option>
-                                <option value="$work.serial">编号</option>
-                                <option value="$work.activityType">活动类型</option>
-                                <option value="$work.activityName">活动名称</option>
-                                <option value="$work.activityArrivedTime">活动到达时间</option>
-                                <option value="$work.workId">工作ID</option>
-                                <option value="$work.workCompletedId">已完成工作ID</option>
-                                <option value="$work.job">JOB的ID(job)</option>
-                                <option value="$work.completed">是否已完成(completed)</option>
-                            </select></td>
-                        </tr>
-                    </table>
-                </div>
-                <div style="display:text{($.vtype=='cms')?'block':'none'}" id="text{$.pid}dataPathSelectedCMSArea" class="text{$.vid}dataPathSelectedCMSArea">
-                    <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-                        <tr>
-                            <td class="editTableTitle">选择数据:</td>
-                            <td class="editTableValue"><select  id="text{$.pid}dataPathSelectedCMS" onchange="var v=this.options[this.selectedIndex].value; if (v){var n = $('text{$.pid}viewColumnPathInput'); n.set('value', v); n.focus();} ">
-                                <option value="" selected>(请选择)</option>
-                                <option value="$document.title">标题</option>
-                                <option value="$document.publishTime">发布时间</option>
-                                <option value="$document.creatorPerson">拟稿人</option>
-                                <option value="$document.creatorIdentity">拟稿人身份</option>
-                                <option value="$document.creatorUnitName">拟稿组织</option>
-                                <option value="$document.creatorTopUnitName">拟稿顶级组织</option>
-                                <option value="$document.appId">栏目ID</option>
-                                <option value="$document.appName">栏目名称</option>
-                                <option value="$document.categoryId">分类ID</option>
-                                <option value="$document.categoryName">分类名称</option>
-                                <option value="$document.categoryAlias">分类别名</option>
-                                <option value="$document.id">文档ID</option>
-                            </select></td>
-                        </tr>
-                    </table>
-                </div>
                 <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
                     <tr>
                         <td class="editTableTitle">数据路径:</td>
-                        <td class="editTableValue"><input onkeypress="$('text{$.pid}dataPathSelected').getElement('option').set('selected', true); $('text{$.pid}dataPathSelectedCMS').getElement('option').set('selected', true)" id="text{$.pid}viewColumnPathInput" type="text" name="path" value="text{$.path}" class="editTableInput"/></td>
+                        <td class="editTableValue">
+                            <input onkeypress="$('text{$.pid}dataPathSelected').getElement('option').set('selected', true); $('text{$.pid}dataPathSelectedCMS').getElement('option').set('selected', true)" id="text{$.pid}viewColumnPathInput" type="text" name="path" value="text{$.path}" class="editTableInput"/>
+                            <div style="line-height: 20px;color:#999;">注:指该列相对单条数据的路径。比如 0,title,或 0.title</div>
+                        </td>
                     </tr>
                 </table>
             </div>
         </div>
 
         <div style="border-top: 1px solid #999; margin-top:10px">
-<!--            <div class="MWFColumnExport" id="text{$.pid}columnExportEditor">-->
-<!--                <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">-->
-<!--                    <tr>-->
-<!--                        <td class="editTableTitle">排序:</td>-->
-<!--                        <td class="editTableValue"><select name="orderType" onchange="-->
-<!--                            var node = $(this).getParent('table').getElement('.MWFColumnExportNumberOrder');-->
-<!--                            if(this.options[this.selectedIndex].value==='none'){-->
-<!--                                node.hide();-->
-<!--                                node.getElements('input')[1].click();-->
-<!--                            }else{-->
-<!--                                node.setStyle('display','table-row');-->
-<!--                            }-->
-<!--                        ">-->
-<!--                            <option value="none" text{(($.orderType)!='asc' && ($.orderType)!='desc') ?'selected':''}>无</option>-->
-<!--                            <option value="asc" text{($.orderType)=='asc' ?'selected':''}>升序</option>-->
-<!--                            <option value="desc" text{($.orderType)=='desc' ?'selected':''}>降序</option>-->
-<!--                        </select></td>-->
-<!--                    </tr>-->
-<!--                    <tr class="MWFColumnExportNumberOrder" style="display: text{(($.orderType)!='asc' && ($.orderType)!='desc') ?'none':'table-row'}">-->
-<!--                        <td class="editTableTitle">转换成数字排序:</td>-->
-<!--                        <td class="editTableValue">-->
-<!--                            <input class="MWFWorkDataCheck" name="numberOrder" type="radio" value="true" text{($.numberOrder)===true?'checked':''}/>是-->
-<!--                            <input class="MWFWorkDataCheck" name="numberOrder" type="radio" value="false" text{($.numberOrder)!==true?'checked':''}/>否-->
-<!--                        </td>-->
-<!--                    </tr>-->
-<!--                    <tr class="MWFColumnExportGroup">-->
-<!--                        <td class="editTableTitle">分类:</td>-->
-<!--                        <td class="editTableValue">-->
-<!--                            <input class="MWFWorkDataCheck" name="groupEntry" type="radio" value="true" text{($.groupEntry)===true?'checked':''}/>是-->
-<!--                            <input class="MWFWorkDataCheck" name="groupEntry" type="radio" value="false" text{($.groupEntry)!==true?'checked':''}/>否-->
-<!--                        </td>-->
-<!--                    </tr>-->
-<!--                </table>-->
-<!--            </div>-->
             <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
                 <tr class="MWFColumnExportHide">
                     <td class="editTableTitle">隐藏:</td>

+ 19 - 241
o2web/source/x_component_query_StatementDesigner/$Statement/view.html

@@ -48,7 +48,6 @@
                 <td class="editTableTitleNoWidth">每页行数:</td>
                 <td class="editTableValue">
                     <input type="number" name="pageSize" value="text{$.pageSize || 20}" class="editTableInput"/>
-                    <div style="color:#999;">注:每页最大行数为2000条</div>
                 </td>
             </tr>
             <tr>
@@ -67,7 +66,7 @@
                 </td>
             </tr>
             <tr>
-                <td class="editTableTitle">无分类和选择隐藏首列</td>
+                <td class="editTableTitle">无选择隐藏首列</td>
                 <td class="editTableValue">
                     <input class="editTableRadio" name="data.firstTdHidden" text{($.data.firstTdHidden===true)?'checked':''} type="radio" value="single"/>是
                     <input class="editTableRadio" name="data.firstTdHidden" text{($.data.firstTdHidden!==true)?'checked':''} type="radio" value="multi"/>否
@@ -107,48 +106,14 @@
                     </tr>
                     <tr>
                         <td class="editTableTitle">路径:</td>
-                        <td class="editTableValue"><input type="text" class="editTableInput pathInput_vf"/></td>
+                        <td class="editTableValue">
+                            <input type="text" class="editTableInput pathInput_vf"/>
+                            <div style="line-height: 20px;color:#999;">注:路径的写法是表别名.字段名,如:o.title</div>
+                        </td>
                     </tr>
                     <tr>
                         <td class="editTableTitle">数据类型:</td>
-                        <td class="editTableValue"><select class="datatypeInput_vf"
-                                onchange="if (this.selectedIndex==2){
-                                    $('text{$.id}viewFilterDateFormulaSelector').setStyle('display', 'block');
-                                    // $('text{$.id}viewFilterDateFormulaSelector2').setStyle('display', 'block');
-                                    $('text{$.id}viewFilterDateOnlyFormulaSelector').setStyle('display', 'none');
-                                    // $('text{$.id}viewFilterDateOnlyFormulaSelector2').setStyle('display', 'none');
-                                    $('text{$.id}viewFilterTimeOnlyFormulaSelector').setStyle('display', 'none');
-                                    // $('text{$.id}viewFilterTimeOnlyFormulaSelector2').setStyle('display', 'none');
-                                }else if (this.selectedIndex==3){
-                                    $('text{$.id}viewFilterDateFormulaSelector').setStyle('display', 'none');
-                                    // $('text{$.id}viewFilterDateFormulaSelector2').setStyle('display', 'none');
-                                    $('text{$.id}viewFilterDateOnlyFormulaSelector').setStyle('display', 'block');
-                                    // $('text{$.id}viewFilterDateOnlyFormulaSelector2').setStyle('display', 'block');
-                                    $('text{$.id}viewFilterTimeOnlyFormulaSelector').setStyle('display', 'none');
-                                    // $('text{$.id}viewFilterTimeOnlyFormulaSelector2').setStyle('display', 'none');
-                                }else if (this.selectedIndex==4){
-                                    $('text{$.id}viewFilterDateFormulaSelector').setStyle('display', 'none');
-                                    // $('text{$.id}viewFilterDateFormulaSelector2').setStyle('display', 'none');
-                                    $('text{$.id}viewFilterDateOnlyFormulaSelector').setStyle('display', 'none');
-                                    // $('text{$.id}viewFilterDateOnlyFormulaSelector2').setStyle('display', 'none');
-                                    $('text{$.id}viewFilterTimeOnlyFormulaSelector').setStyle('display', 'block');
-                                    // $('text{$.id}viewFilterTimeOnlyFormulaSelector2').setStyle('display', 'block');
-                                }else{
-                                    $('text{$.id}viewFilterDateFormulaSelector').setStyle('display', 'none');
-                                    // $('text{$.id}viewFilterDateFormulaSelector2').setStyle('display', 'none');
-                                    $('text{$.id}viewFilterDateOnlyFormulaSelector').setStyle('display', 'none');
-                                    // $('text{$.id}viewFilterDateOnlyFormulaSelector2').setStyle('display', 'none');
-                                    $('text{$.id}viewFilterTimeOnlyFormulaSelector').setStyle('display', 'none');
-                                    // $('text{$.id}viewFilterTimeOnlyFormulaSelector2').setStyle('display', 'none');
-                                }
-
-                                if (this.selectedIndex==0){
-                                    $('text{$.id}viewFilterTextFormulaSelector').setStyle('display', 'block');
-                                    // $('text{$.id}viewFilterTextFormulaSelector2').setStyle('display', 'block')
-                                }else{
-                                    $('text{$.id}viewFilterTextFormulaSelector').setStyle('display', 'none');
-                                    // $('text{$.id}viewFilterTextFormulaSelector2').setStyle('display', 'none')
-                                }">
+                        <td class="editTableValue"><select class="datatypeInput_vf">
                             <option value="textValue" selected>文本</option>
                             <option value="numberValue">数字</option>
                             <option value="dateTimeValue">日期时间</option>
@@ -157,197 +122,20 @@
                             <option value="booleanValue">布尔</option>
                         </select></td>
                     </tr>
-                    <tr>
-                        <td class="editTableTitle"></td>
-                        <td class="editTableValue">
-                            <input type="radio" class="restrictFilterInput_vf" 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" class="customFilterInput_vf" 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>
+<!--                    <tr>-->
+<!--                        <td class="editTableTitle"></td>-->
+<!--                        <td class="editTableValue">-->
+<!--                            <input type="radio" class="restrictFilterInput_vf" 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" class="customFilterInput_vf" 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>
-                <div id="text{$.id}viewFilterRestrict"  style="display: none">
-                    <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-                        <tr>
-                            <td class="editTableTitle">逻辑:</td>
-                            <td class="editTableValue"><select class="logicInput_vf">
-                                <option selected value="and">并且(and)</option>
-                                <option value="or">或者(or)</option>
-                            </select></td>
-                        </tr>
-
-                        <tr>
-                            <td class="editTableTitle">比较:</td>
-                            <td class="editTableValue"><select class="comparisonInput_vf" onchange="
-                                // if (this.selectedIndex==8){
-                                //     $('text{$.id}viewFilterValue2Area').setStyle('display', 'block');
-                                //     $('text{$.id}viewFilterValueTitleArea').set('text', '从');
-                                // }else{
-                                //     $('text{$.id}viewFilterValue2Area').setStyle('display', 'none');
-                                //     $('text{$.id}viewFilterValueTitleArea').set('text', '值');
-                                // }"
-                                >
-                                <option value="equals" selected>等于(==)</option>
-                                <option value="notEquals">不等于(!=)</option>
-                                <option value="greaterThan">大于(>)</option>
-                                <option value="greaterThanOrEqualTo">大于等于(>=)</option>
-                                <option value="lessThan">小于(<)</option>
-                                <option value="lessThanOrEqualTo">小于等于(<=)</option>
-                                <option value="like">匹配(like)</option>
-                                <option value="notLike">不匹配(not-like)</option>
-                                <option value="range">范围(range)</option>
-                            </select></td>
-                        </tr>
-                        <tr>
-                            <td class="editTableTitle" id="text{$.id}viewFilterValueTitleArea">值:</td>
-                            <td class="editTableValue" id="text{$.id}viewFilterValueArea">
-                                <input type="text" class="editTableInput valueTextInput_vf" style="display: block" onkeypress="$('text{$.id}viewFilterTextFormulaSelector').getElements('input').set('checked', false)"/>
-                                <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>是(True)</option>
-                                    <option value="false">否(False)</option>
-                                </select>
-                            </td>
-                        </tr>
-
-                    </table>
-                    <div style="display: none" id="text{$.id}viewFilterDateFormulaSelector">
-                        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-                            <tr>
-                                <td class="editTableTitle"></td>
-                                <td class="editTableValue">
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDatetimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@year" />当前年度
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDatetimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@season" />当前季度
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDatetimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@month" />当前月份<br/>
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDatetimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@time" />当前时间
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDatetimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@date" />当天
-
-                                </td>
-                            </tr>
-                        </table>
-                    </div>
-                    <div style="display: none" id="text{$.id}viewFilterDateOnlyFormulaSelector">
-                        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-                            <tr>
-                                <td class="editTableTitle"></td>
-                                <td class="editTableValue">
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDateInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@year" />当前年度
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDateInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@season" />当前季度
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDateInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@month" />当前月份<br/>
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDateInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@date" />当天
-
-                                </td>
-                            </tr>
-                        </table>
-                    </div>
-                    <div style="display: none" id="text{$.id}viewFilterTimeOnlyFormulaSelector">
-                        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-                            <tr>
-                                <td class="editTableTitle"></td>
-                                <td class="editTableValue">
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueTimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@time" />当前时间
-                                </td>
-                            </tr>
-                        </table>
-                    </div>
-
-                    <div style="display: block" id="text{$.id}viewFilterTextFormulaSelector">
-                        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-                            <tr>
-                                <td class="editTableTitle"></td>
-                                <td class="editTableValue">
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueTextInput_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula" onclick="" type="radio" value="@person" />当前人
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueTextInput_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula" type="radio" value="@identityList" />当前身份<br/>
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueTextInput_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula" type="radio" value="@unitList" />当前人所在直接组织<br/>
-                                    <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueTextInput_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula" type="radio" value="@unitAllList" />当前人所在所有组织
-                                </td>
-                            </tr>
-                        </table>
-                    </div>
-
-                    <div id="text{$.id}viewFilterValue2Area"  style="display: none">
-                        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-                            <tr>
-                                <td class="editTableTitle">到:</td>
-                                <td class="editTableValue" id="text{$.id}viewFilterValueArea2">
-                                    <input type="text" class="editTableInput valueTextInput2_vf" style="display: block">
-<!--                                    onkeypress="$('text{$.id}viewFilterTextFormulaSelector2').getElements('input').set('checked', false)"/>-->
-                                    <input type="number" class="editTableInput valueNumberInput2_vf" style="display: none"/>
-                                    <input type="text" class="editTableInput valueDatetimeInput2_vf" style="display: none" readonly/>
-                                    <input type="text" class="editTableInput valueDateInput2_vf" style="display: none" readonly/>
-                                    <input type="text" class="editTableInput valueTimeInput2_vf" style="display: none" readonly/>
-                                    <select class="valueBooleanInput2_vf" style="display: none">
-                                        <option value="true" selected>是(True)</option>
-                                        <option value="false">否(False)</option>
-                                    </select>
-                                </td>
-                            </tr>
-                        </table>
-
-<!--       rang的时候,所有@xxx都是无效的
-                            <div style="display: none" id="text{$.id}viewFilterDateFormulaSelector2">-->
-<!--                            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">-->
-<!--                                <tr>-->
-<!--                                    <td class="editTableTitle"></td>-->
-<!--                                    <td class="editTableValue">-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueDatetimeInput2_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula2" type="radio" value="@year" />当前年度-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueDatetimeInput2_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula2" type="radio" value="@season" />当前季度-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueDatetimeInput2_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula2" type="radio" value="@month" />当前月份<br/>-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueDatetimeInput2_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula2" type="radio" value="@time" />当前时间-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueDatetimeInput2_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula2" type="radio" value="@date" />当天-->
-
-<!--                                    </td>-->
-<!--                                </tr>-->
-<!--                            </table>-->
-<!--                        </div>-->
-<!--                        <div style="display: none" id="text{$.id}viewFilterDateOnlyFormulaSelector2">-->
-<!--                            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">-->
-<!--                                <tr>-->
-<!--                                    <td class="editTableTitle"></td>-->
-<!--                                    <td class="editTableValue">-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueDateInput2_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@year" />当前年度-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueDateInput2_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@season" />当前季度-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueDateInput2_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@month" />当前月份<br/>-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueDateInput2_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@date" />当天-->
-
-<!--                                    </td>-->
-<!--                                </tr>-->
-<!--                            </table>-->
-<!--                        </div>-->
-<!--                        <div style="display: none" id="text{$.id}viewFilterTimeOnlyFormulaSelector2">-->
-<!--                            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">-->
-<!--                                <tr>-->
-<!--                                    <td class="editTableTitle"></td>-->
-<!--                                    <td class="editTableValue">-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueTimeInput2_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@time" />当前时间-->
-<!--                                    </td>-->
-<!--                                </tr>-->
-<!--                            </table>-->
-<!--                        </div>-->
-<!--                        <div style="display: block" id="text{$.id}viewFilterTextFormulaSelector2">-->
-<!--                            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">-->
-<!--                                <tr>-->
-<!--                                    <td class="editTableTitle"></td>-->
-<!--                                    <td class="editTableValue">-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueTextInput2_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula2" onclick="" type="radio" value="@person" />当前人-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueTextInput2_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula2" type="radio" value="@identityList" />当前身份<br/>-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueTextInput2_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula2" type="radio" value="@unitList" />当前人所在直接组织<br/>-->
-<!--                                        <input onclick="$('text{$.id}viewFilterValueArea2').getElement('.valueTextInput2_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula2" type="radio" value="@unitAllList" />当前人所在所有组织-->
-<!--                                    </td>-->
-<!--                                </tr>-->
-<!--                            </table>-->
-<!--                        </div>-->
-                    </div>
-
-                </div>
                 <div id="text{$.id}viewCustomFilterRestrict"  style="display: block">
                     <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
                         <tr>
@@ -371,21 +159,11 @@
                 </div>
             </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="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">自定义过滤数据</div>
             <div class="fieldListAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
         </div>
     </div>
 
-<!--    <div title="样式"  class="MWFTab">-->
-<!--        <div class="MWFMaplist" name="tableStyles" collapse="true" title="表格样式"></div>-->
-<!--        <div class="MWFMaplist" name="titleTdStyles" collapse="true" title="标题单元格样式"></div>-->
-<!--        <div class="MWFMaplist" name="contentTdStyles" collapse="true" title="内容单元格样式"></div>-->
-<!--        <div class="MWFMaplist" name="contentTdOverStyles" collapse="true" title="内容单元格鼠标over事件样式"></div>-->
-<!--        <div class="MWFMaplist" name="contentTdSelectedStyles" collapse="true" title="内容单元格选中样式"></div>-->
-<!--    </div>-->
-
     <div title="样式"  class="MWFTab">
         <div class="MWFViewStylesArea" name="data.viewStyles"></div>
     </div>

+ 20 - 0
o2web/source/x_component_query_StatementDesigner/Property.js

@@ -40,5 +40,25 @@ MWF.xApplication.query.StatementDesigner.Property = MWF.SDProperty = new Class({
         } else {
             this.propertyContent.setStyle("display", "block");
         }
+    },
+    loadViewFilter: function () {
+        var nodes = this.propertyContent.getElements(".MWFViewFilter");
+        //var filtrData = this.view.data.data.filterList;
+        var customData = this.view.data.data.customFilterList;
+        nodes.each(function (node) {
+            MWF.xDesktop.requireApp("query.StatementDesigner", "widget.ViewFilter", function () {
+                var _slef = this;
+                new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.view.designer, {
+                    // "filtrData": filtrData,
+                    "customData": customData
+                }, {
+                    "onChange": function (ids) {
+                        var data = this.getData();
+                        // _slef.changeJsonDate(["data", "filterList"], data.data);
+                        _slef.changeJsonDate(["data", "customFilterList"], data.customData);
+                    }
+                });
+            }.bind(this));
+        }.bind(this));
     }
 });

+ 4 - 0
o2web/source/x_component_query_StatementDesigner/Statement.js

@@ -7,6 +7,7 @@ MWF.xDesktop.requireApp("query.StatementDesigner", "lp."+MWF.language, null, fal
 MWF.xDesktop.requireApp("query.StatementDesigner", "Property", null, false);
 MWF.xDesktop.requireApp("query.ViewDesigner", "View", null, false);
 o2.require("o2.widget.JavascriptEditor", null, false);
+o2.require("o2.widget.UUID", null, false);
 
 MWF.xApplication.query.StatementDesigner.Statement = new Class({
     Extends: MWF.widget.Common,
@@ -774,6 +775,9 @@ MWF.xApplication.query.StatementDesigner.View = new Class({
     },
     parseData: function(){
         this.json = this.data;
+        if( !this.json.id ){
+            this.json.id = (new o2.widget.UUID).id;
+        }
         if( !this.json.data || !this.json.data.events ){
             var url = "../x_component_query_StatementDesigner/$Statement/view.json";
             MWF.getJSON(url, {

+ 0 - 134
o2web/source/x_component_query_StatementDesigner/widget/$PersonSelector/default/css.wcss

@@ -1,134 +0,0 @@
-{
-	"node": {
-	    "min-height": "24px",
-	    "overflow": "hidden",
-	    "margin-right": "26px"
-	},
-	"addPersonNode": {
-        "float": "right",
-        "height": "24px",
-        "width": "24px",
-        "cursor": "pointer",
-        "background": "url("+"../x_component_process_ProcessDesigner/widget/$PersonSelector/default/icon/addPerson.png)  center center no-repeat"
-    },
-
-    "dutyMaskNode": {
-        "background-color": "#666",
-        "opacity": 0.6,
-        "z-index":1000
-    },
-    "dutyInputArea": {
-        "height": "510px",
-        "width": "355px",
-        "background-color": "#FFF",
-        "overflow": "hidden",
-        "border": "3px solid #666",
-        "border-radius": "10px",
-        "box-shadow": "0px 0px 15px #666",
-        "position": "absolute",
-        "z-index":1001
-    },
-    "dutyTitleNode": {
-        "height": "30px",
-        "background-color": "#EEE",
-        "border-bottom": "1px solid #CCC"
-    },
-
-    "dutyTitleTextNode": {
-        "margin-right": "30px",
-        "height": "30px",
-        "padding": "0px 10px",
-        "color": "#666",
-        "font-weight": "bold",
-        "font-size": "14px",
-        "line-height": "30px"
-    },
-    "dutyTitleActionNode": {
-        "width": "30px",
-        "height": "30px",
-        "float": "right",
-        "background": "url("+"../x_component_Organization/Selector/$Selector/default/icon/close.png) no-repeat center center",
-        "cursor": "pointer"
-    },
-
-    "dutyContentNode": {
-        "overflow": "hidden",
-        "height": "410px",
-        "padding": "12px"
-    },
-    "dutyContentAreaNode": {
-        "height": "410px"
-    },
-    "dutyActionNode": {
-        "height": "40px",
-        "width": "310px",
-        "margin": "auto"
-    },
-    "dutyOkActionNode": {
-        "width": "150px",
-        "height": "30px",
-        "background": "url("+"../x_component_Organization/Selector/$Selector/default/icon/editOk_bg.png) no-repeat center center",
-        "border": "0px",
-        "color": "#FFF",
-        "font-size": "18px",
-        "padding-left": "35px",
-        "border-radius": "4px",
-        "cursor": "pointer"
-    },
-    "dutyCancelActionNode": {
-        "width": "100px",
-        "height": "30px",
-        "background": "url("+"../x_component_Organization/Selector/$Selector/default/icon/editCancel_bg.png) no-repeat center center",
-        "border": "0px",
-        "color": "#FFF",
-        "font-size": "18px",
-        "padding-left": "20px",
-        "border-radius": "4px",
-        "margin-left": "10px",
-        "cursor": "pointer"
-    },
-    "dutyTextNode": {
-        "color": "#444",
-        "font-size": "14px",
-        "font-weight": "bold",
-        "height": "26px",
-        "margin-bottom": "6px",
-        "line-height": "26px"
-    },
-    "dutyReferenceAreaNode": {
-        "height": "28px",
-        "padding": "4px 0px 0px 0px",
-        "overflow": "hidden"
-    },
-    "dutyReferenceItemNode":{
-        "margin": "0px 4px 4px 0px",
-        "height": "24px",
-        "line-height": "24px",
-        "border": "1px solid #CCC",
-        "border-radius": "4px",
-        "background": "#f3f4ff",
-        "color": "#666",
-        "float": "left",
-        "cursor": "pointer",
-        "font-size": "14px",
-        "padding": "0px 10px"
-    },
-    "dutyReferenceItemNode_over": {
-        "background": "#e7eaff",
-        "border": "1px solid #999",
-        "color": "#666",
-    },
-    "dutyReferenceItemNode_down": {
-        "background": "#626ca6",
-        "border": "1px solid #FFF",
-        "color": "#FFF",
-    },
-    "dutyScriptAreaNode": {
-        "height": "316px",
-        "padding": "10px 0px"
-    },
-    "dutyScriptNode": {
-        "height": "316px",
-        "border": "1px solid #EEE"
-    }
-}

+ 60 - 0
o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/css.wcss

@@ -0,0 +1,60 @@
+{
+	"inputAreaNode": {
+	    "overflow": "hidden",
+	    "margin": "5px"
+	},
+	"actionAreaNode": {
+	    "height": "20px",
+	    "background": "#EEE",
+	    "border-top": "1px solid #CCC",
+	    "border-bottom": "1px solid #CCC",
+	    "cursor": "pointer"
+	},
+	"actionNode": {
+	    "height": "20px",
+	    "background": "url("+"../x_component_process_ViewDesigner/widget/$ViewFilter/default/down.png) no-repeat center -2px"
+	},
+	"verificationNode": {
+	    "background-color": "#fbe8e8",
+	    "color": "#ff0000",
+	    "height": "24px",
+	    "line-height": "24px"
+	},
+	"verificationTextNode": {
+	    "background": "url("+"../x_component_process_ViewDesigner/widget/$ViewFilter/default/icon/error.png) no-repeat 5px center",
+	    "padding-left": "26px"
+	},
+
+	"itemNode": {
+        "cursor": "pointer",
+        "height": "24px",
+        "margin": "2px 4px",
+        "background-color": "#f4f7fe",
+        "border": "1px solid #999999"
+    },
+    "itemNode_current": {
+        "cursor": "pointer",
+        "height": "24px",
+        "margin": "2px 4px",
+        "background-color": "#e1e9ff",
+        "border": "1px solid #999999"
+    },
+    "itemDeleteNode": {
+        "width": "20px",
+        "height": "24px",
+        "float": "right",
+        "background": "url("+"../x_component_process_ViewDesigner/widget/$ViewFilter/default/icon/delete1.png) no-repeat center center",
+        "cursor": "pointer"
+    },
+    "itemContentNode": {
+        "padding-left": "5px",
+        "padding-right": "3px",
+        "margin-right": "20px",
+        "height": "24px",
+        "line-height": "24px",
+        "overflow": "hidden",
+        "text-overflow": "ellipsis",
+        "white-space": "nowrap"
+    }
+
+}

BIN
o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/down.png


+ 0 - 0
o2web/source/x_component_query_StatementDesigner/widget/$PersonSelector/default/icon/addPerson.png → o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/addPerson.png


BIN
o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/delete1.png


BIN
o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/error.png


+ 0 - 314
o2web/source/x_component_query_StatementDesigner/widget/PersonSelector.js

@@ -1,314 +0,0 @@
-MWF.xApplication.query.StatDesigner = MWF.xApplication.query.StatDesigner || {};
-MWF.xApplication.query.StatDesigner.widget = MWF.xApplication.query.StatDesigner.widget || {};
-MWF.require("MWF.xAction.org.express.RestActions", null,false);
-MWF.require("MWF.widget.Identity", null, false);
-
-MWF.xApplication.query.StatDesigner.widget.PersonSelector = new Class({
-    Implements: [Options, Events],
-    Extends: MWF.widget.Common,
-    options: {
-        "style": "default",
-        "type": "identity",
-        "names": []
-    },
-    initialize: function(node, app, options){
-
-        this.setOptions(options);
-        this.node = $(node);
-        this.app = app;
-
-        this.path = "../x_component_query_ViewDesigner/widget/$PersonSelector/";
-        this.cssPath = "../x_component_query_ViewDesigner/widget/$PersonSelector/"+this.options.style+"/css.wcss";
-        this._loadCss();
-
-        this.identitys = [];
-        this.restActions = new MWF.xAction.org.express.RestActions();
-
-        this.name = this.node.get("name");
-        this.load();
-
-    },
-    load: function(data){
-        this.node.setStyles(this.css.node);
-        this.createAddNode();
-        this.loadIdentitys();
-    },
-    loadIdentitys: function(){
-        var explorer = {
-            "actions": this.restActions,
-            "app": {
-                "lp": this.app.lp
-            }
-        };
-        if (this.options.names){
-            if (this.options.type.toLowerCase()=="duty"){
-                var dutys = JSON.decode(this.options.names);
-                dutys.each(function(d){
-                    var dutyItem = new MWF.widget.Duty(d, this.node, explorer, true, function(e){
-                        var _self = this;
-                        var text = this.selector.app.lp.deleteDutyText.replace(/{duty}/g, this.data.name);
-                        this.selector.app.confirm("warm", e, this.selector.app.lp.deleteDutyTitle, text, 300, 120, function(){
-                            _self.selector.fireEvent("removeDuty", [_self]);
-                            this.close();
-                        }, function(){
-                            this.close();
-                        });
-                        e.stopPropagation();
-                    });
-                    dutyItem.selector = this;
-                    dutyItem.explorer = explorer;
-                    this.identitys.push(dutyItem);
-                }.bind(this));
-            }else{
-                this.options.names.each(function(name){
-                    MWF.require("MWF.widget.Identity", function(){
-                        if (this.options.type.toLowerCase()=="identity") this.identitys.push(new MWF.widget.Identity({"name": name.name, "id": name.id}, this.node, explorer));
-                        if (this.options.type.toLowerCase()=="department") this.identitys.push(new MWF.widget.Department({"name": name.name, "id": name.id}, this.node, explorer));
-                        if (this.options.type.toLowerCase()=="company") this.identitys.push(new MWF.widget.Company({"name": name.name, "id": name.id}, this.node, explorer));
-                        if (this.options.type.toLowerCase()=="person") this.identitys.push(new MWF.widget.Person({"name": name.name, "id": name.id}, this.node, explorer));
-
-                        if (this.options.type.toLowerCase()=="application") this.identitys.push(new MWF.widget.Application({"name": name.name, "id": name.id}, this.node, explorer));
-                        if (this.options.type.toLowerCase()=="process") this.identitys.push(new MWF.widget.Process({"name": name.name, "id": name.id}, this.node, explorer));
-                    }.bind(this));
-                }.bind(this));
-            }
-        }
-
-    },
-    createAddNode: function(){
-        this.addNode = new Element("div", {"styles": this.css.addPersonNode}).inject(this.node, "before");
-        this.addNode.addEvent("click", function(e){
-
-            var selecteds = [];
-            this.identitys.each(function(id){selecteds.push(id.data.id)});
-
-            var explorer = {
-                "actions": this.restActions,
-                "app": {
-                    "lp": this.app.lp
-                }
-            };
-
-            var options = {
-                "type": this.options.type,
-                "count": (this.options.type.toLowerCase()=="duty")? 1: 0,
-                "values": selecteds,
-                "zIndex": 20000,
-                "onComplete": function(items){
-                    this.identitys = [];
-                    if (this.options.type.toLowerCase()!="duty") this.node.empty();
-
-                    MWF.require("MWF.widget.Identity", function(){
-                        items.each(function(item){
-                            if (this.options.type.toLowerCase()=="identity") this.identitys.push(new MWF.widget.Identity(item.data, this.node, explorer));
-                            if (this.options.type.toLowerCase()=="department") this.identitys.push(new MWF.widget.Department(item.data, this.node, explorer));
-                            if (this.options.type.toLowerCase()=="company") this.identitys.push(new MWF.widget.Company(item.data, this.node, explorer));
-                            if (this.options.type.toLowerCase()=="person") this.identitys.push(new MWF.widget.Person(item.data, this.node, explorer));
-
-                            if (this.options.type.toLowerCase()=="application") this.identitys.push(new MWF.widget.Application(item.data, this.node, explorer));
-                            if (this.options.type.toLowerCase()=="process") this.identitys.push(new MWF.widget.Process(item.data, this.node, explorer));
-                        }.bind(this));
-                        if (this.options.type.toLowerCase()=="duty") {
-                            items.each(function(item){
-                                new MWF.xApplication.query.StatDesigner.widget.PersonSelector.DutyInput(this, item.data, this.node, explorer, 20000);
-                            }.bind(this));
-                        }
-
-                        this.fireEvent("change", [this.identitys]);
-                    }.bind(this));
-                }.bind(this)
-            };
-
-            var selector = new MWF.OrgSelector(this.app.content, options);
-        }.bind(this));
-    }
-});
-MWF.xApplication.query.StatDesigner.widget.PersonSelector.DutyInput = Class({
-    Implements: [Events],
-    initialize: function(selector, data, node, explorer, zIndex){
-        this.itemNode = $(node);
-        this.data = data;
-        this.isNew = false;
-
-        this.selector = selector;
-        this.css = this.selector.css;
-        this.app = this.selector.app;
-        this.explorer = explorer;
-        this.zIndex = zIndex;
-
-        this.selector.identitys = [];
-        this.load();
-    },
-    load: function(){
-        this.css.dutyMaskNode["z-index"] = this.zIndex;
-        this.app.content.mask({
-            "destroyOnHide": true,
-            "style": this.css.dutyMaskNode
-        });
-        this.node = new Element("div", {
-            "styles": this.css.dutyInputArea
-        });
-
-        this.titleNode = new Element("div", {
-            "styles": this.css.dutyTitleNode
-        }).inject(this.node);
-
-        this.titleActionNode = new Element("div", {
-            "styles": this.css.dutyTitleActionNode
-        }).inject(this.titleNode);
-        this.titleTextNode = new Element("div", {
-            "styles": this.css.dutyTitleTextNode,
-            "text": this.app.lp.dutyInputTitle
-        }).inject(this.titleNode);
-
-        this.contentNode = new Element("div", {
-            "styles": this.css.dutyContentNode
-        }).inject(this.node);
-        this.loadContent();
-
-        this.actionNode = new Element("div", {
-            "styles": this.css.dutyActionNode
-        }).inject(this.node);
-        this.actionNode.setStyle("text-align", "center");
-        this.loadAction();
-
-        this.node.setStyle("z-index", this.zIndex.toInt()+1);
-        this.node.inject(this.app.content);
-        this.node.position({
-            relativeTo: this.app.content,
-            position: "center",
-            edge: "center"
-        });
-
-        var size = this.app.content.getSize();
-        var nodeSize = this.node.getSize();
-        this.node.makeDraggable({
-            "handle": this.titleNode,
-            "limit": {
-                "x": [0, size.x-nodeSize.x],
-                "y": [0, size.y-nodeSize.y]
-            }
-        });
-
-        this.setEvent();
-    },
-    setEvent: function(){
-        if (this.titleActionNode){
-            this.titleActionNode.addEvent("click", function(){this.selector.fireEvent("cancel"); this.close();}.bind(this));
-        }
-        this.okActionNode.addEvent("click", function(){
-            this.selectDuty();
-            this.close();
-        }.bind(this));
-        this.cancelActionNode.addEvent("click", function(){this.selector.fireEvent("cancel"); this.close();}.bind(this));
-    },
-    selectDuty: function(){
-        var code = this.scriptEditor.editor.editor.getValue();
-        this.data.code = code;
-        if (!this.item){
-            var dutyItem = new MWF.widget.Duty(this.data, this.itemNode, this.explorer, true, function(e){
-                var _self = this;
-                var text = this.selector.app.lp.deleteDutyText.replace(/{duty}/g, this.data.name);
-                this.selector.app.confirm("warm", e, this.selector.app.lp.deleteDutyTitle, text, 300, 120, function(){
-                    _self.selector.fireEvent("removeDuty", [_self]);
-                    this.close();
-                }, function(){
-                    this.close();
-                });
-                e.stopPropagation();
-            });
-            dutyItem.selector = this.selector;
-            dutyItem.explorer = this.explorer;
-
-            this.selector.identitys.push(dutyItem);
-            this.selector.fireEvent("change", [this.selector.identitys]);
-        }else{
-            this.selector.identitys.push(this.item);
-            this.selector.fireEvent("change", [this.selector.identitys]);
-        }
-    },
-    "close": function(){
-        this.node.destroy();
-        this.app.content.unmask();
-        MWF.release(this);
-        delete this;
-    },
-    loadAction: function(){
-        this.okActionNode = new Element("button", {
-            "styles": this.css.dutyOkActionNode,
-            "text": "确 定"
-        }).inject(this.actionNode);
-        this.cancelActionNode = new Element("button", {
-            "styles": this.css.dutyCancelActionNode,
-            "text": "取 消"
-        }).inject(this.actionNode);
-    },
-    loadContent: function(){
-        this.contentAreaNode= new Element("div", {"styles": this.css.dutyContentAreaNode}).inject(this.contentNode);
-        var text = this.app.lp.dutyInput.replace(/{duty}/g, this.data.name);
-        this.textNode = new Element("div", {"styles": this.css.dutyTextNode, "text": text}).inject(this.contentAreaNode);
-        this.referenceAreaNode = new Element("div", {"styles": this.css.dutyReferenceAreaNode}).inject(this.contentAreaNode);
-        this.scriptAreaNode = new Element("div", {"styles": this.css.dutyScriptAreaNode}).inject(this.contentAreaNode);
-        this.createScriptNode();
-
-        this.createReference(this.app.lp.creatorCompany, "return this.workContext.getWork().creatorCompany");
-        this.createReference(this.app.lp.creatorDepartment, "return this.workContext.getWork().creatorDepartment");
-        this.createReference(this.app.lp.currentCompany, "return this.workContext.getTask().company");
-        this.createReference(this.app.lp.currentDepartment, "return this.workContext.getTask().department");
-
-    },
-    createScriptNode: function(){
-        this.scriptNode = new Element("div", {"styles": this.css.dutyScriptNode}).inject(this.scriptAreaNode);
-        MWF.xDesktop.requireApp("query.ProcessDesigner", "widget.ScriptText", function(){
-            this.scriptEditor = new MWF.xApplication.query.ProcessDesigner.widget.ScriptText(this.scriptNode, "", this.app, {
-                "height": 316,
-                "maskNode": this.app.content,
-                "maxObj": this.app.content
-                //"onChange": function(code){
-                //    _self.data[node.get("name")] = code;
-                //}
-            });
-            this.scriptEditor.loadEditor(function(){
-                if (this.data.code) this.scriptEditor.editor.editor.setValue(this.data.code);
-            }.bind(this));
-        }.bind(this));
-    },
-    createReference: function(text, code){
-        var node = new Element("div", {"styles": this.css.dutyReferenceItemNode}).inject(this.referenceAreaNode);
-        node.set("text", text);
-        node.store("code", code);
-        var css = this.css.dutyReferenceItemNode;
-        var overcss = this.css.dutyReferenceItemNode_over;
-        var downcss = this.css.dutyReferenceItemNode_down;
-        var _self = this;
-        node.addEvents({
-            "mouseover": function(){this.setStyles(overcss);},
-            "mouseout": function(){this.setStyles(css);},
-            "mousedown": function(){this.setStyles(downcss);},
-            "mouseup": function(){this.setStyles(overcss);},
-            "click": function(){
-                var code = this.retrieve("code");
-                var value = _self.scriptEditor.editor.editor.getValue();
-                if (!value){
-                    _self.scriptEditor.editor.editor.setValue(code);
-                }else{
-                    value = value + "\n" +code;
-                    _self.scriptEditor.editor.editor.setValue(value);
-                }
-            }
-        });
-    }
-});
-
-MWF.widget.Duty = new Class({
-    Extends: MWF.widget.Department,
-    setEvent: function(){
-        this.node.addEvent("click", function(){
-            this.modifyDuty();
-        }.bind(this));
-    },
-    modifyDuty: function(){
-        var dutyInput = new MWF.xApplication.query.ProcessDesigner.widget.PersonSelector.DutyInput(this.selector, this.data, this.selector.node, this.explorer, 20000);
-        dutyInput.item = this;
-    }
-});

+ 1012 - 0
o2web/source/x_component_query_StatementDesigner/widget/ViewFilter.js

@@ -0,0 +1,1012 @@
+MWF.xApplication.query = MWF.xApplication.query || {};
+MWF.xApplication.query.StatementDesigner = MWF.xApplication.query.StatementDesigner || {};
+MWF.xApplication.query.StatementDesigner.widget = MWF.xApplication.query.StatementDesigner.widget || {};
+
+MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
+    Implements: [Options, Events],
+    Extends: MWF.widget.Common,
+    options: {
+        "style": "default",
+        "type": "identity",
+        "names": []
+    },
+    initialize: function(node, app, filtrData, options){
+        this.setOptions(options);
+        this.node = $(node);
+        this.app = app;
+        this.filtrData = filtrData;
+
+        this.path = "../x_component_query_StatementDesigner/widget/$ViewFilter/";
+        this.cssPath = "../x_component_query_StatementDesigner/widget/$ViewFilter/"+this.options.style+"/css.wcss";
+        this._loadCss();
+
+        this.items = [];
+        this.load();
+
+    },
+    load: function(data){
+        this.getInputNodes();
+        this.createActionNode();
+        //this.createAddNode();
+        //this.loadIdentitys();
+        this.loadData();
+    },
+    loadData: function(){
+        if (this.filtrData.customData && this.filtrData.customData.length){
+            this.filtrData.customData.each(function(data){
+                data.type = "custom";
+                this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom(this, data));
+            }.bind(this));
+        }
+    },
+    createScriptArea: function(node){
+        this.scriptValueArea = node;
+        var title = node.get("title");
+
+        MWF.require("MWF.widget.ScriptArea", function(){
+            this.scriptArea = new MWF.widget.ScriptArea(node, {
+                "title": title,
+                "maxObj": this.app.formContentNode || this.app.pageContentNode,
+                "onChange": function(){
+                    this.scriptData = this.scriptArea.toJson();
+                }.bind(this),
+                "onSave": function(){
+                    //this.app.saveForm();
+                }.bind(this),
+                "style": "formula"
+            });
+            var v = (this.scriptData) ? this.scriptData.code : "";
+            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(){
+        debugger;
+        this.inputAreaNode = this.node.getElement(".inputAreaNode_vf");
+        this.actionAreaNode = this.node.getElement(".actionAreaNode_vf");
+        this.actionAreaNode.setStyles( this.css.actionAreaNode );
+        // this.listAreaNode = this.node.getElement(".listAreaNode_vf");
+        this.fieldListAreaNode = this.node.getElement(".fieldListAreaNode_vf");
+
+        this.restrictViewFilterTable = this.node.getElement(".restrictViewFilterTable_vf");
+
+        var scriptValueArea = this.node.getElement(".MWFFilterFormulaArea");
+        if (scriptValueArea){
+            this.createScriptArea(scriptValueArea);
+        }
+
+        this.titleInput = this.inputAreaNode.getElement(".titleInput_vf");
+        this.pathInput = this.inputAreaNode.getElement(".pathInput_vf");
+        this.datatypeInput = this.inputAreaNode.getElement(".datatypeInput_vf");
+
+        // this.restrictFilterInput = this.inputAreaNode.getElement(".restrictFilterInput_vf");
+        // this.customFilterInput = this.inputAreaNode.getElement(".customFilterInput_vf");
+
+        // this.logicInput = this.inputAreaNode.getElement(".logicInput_vf");
+
+        // this.comparisonInput = this.inputAreaNode.getElement(".comparisonInput_vf");
+        // this.comparisonInput.addEvent("change", function(){
+        //     this.switchInputDisplay();
+        // }.bind(this))
+
+        // this.valueTextInput = this.inputAreaNode.getElement(".valueTextInput_vf");
+        // this.valueNumberInput = this.inputAreaNode.getElement(".valueNumberInput_vf");
+        // this.valueDatetimeInput = this.inputAreaNode.getElement(".valueDatetimeInput_vf");
+        // this.valueBooleanInput = this.inputAreaNode.getElement(".valueBooleanInput_vf");
+        // this.valueDateInput = this.inputAreaNode.getElement(".valueDateInput_vf");
+        // this.valueTimeInput = this.inputAreaNode.getElement(".valueTimeInput_vf");
+
+        if( this.app.statement.view ){
+            var dataId = this.app.statement.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);
+            }
+        }
+
+        // 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(){
+        //             this.node.getElement("#"+id+"viewFilterDateFormulaSelector").getElements("input").set("checked", false);
+        //         }.bind(this)
+        //     });
+        //     new MWF.widget.Calendar(this.valueDateInput, {
+        //         "style": "xform",
+        //         "isTime": false,
+        //         "target": this.app.content,
+        //         "format": "%Y-%m-%d"
+        //     });
+        //     new MWF.widget.Calendar(this.valueTimeInput, {
+        //         "style": "xform",
+        //         "timeOnly": true,
+        //         "secondEnable": true,
+        //         "target": this.app.content,
+        //         "format": "%H:%M:%S"
+        //     });
+        // }.bind(this));
+
+        // this.datatypeInput.addEvent("change", function(){
+        //     this.switchInputDisplay();
+        // }.bind(this));
+
+        // this.valueTextInput.addEvent("keydown", function(e){
+        //     if (e.code==13) this.modifyOrAddFilterItem();
+        // }.bind(this));
+        // this.valueNumberInput.addEvent("keydown", function(e){
+        //     if (e.code==13) this.modifyOrAddFilterItem();
+        // }.bind(this));
+
+        // if (this.app.view){
+        //     var id = this.app.view.data.id;
+        //     var div = this.node.getElement("#"+id+"viewFilterValueArea2");
+        //     // inputs = div.getElements("input");
+        //     if( div ){
+        //         this.valueTextInput2 = div.getElement(".valueTextInput2_vf") || null;
+        //         this.valueNumberInput2 = div.getElement(".valueNumberInput2_vf") || null;
+        //         this.valueDatetimeInput2 = div.getElement(".valueDatetimeInput2_vf") || null;
+        //         this.valueDateInput2 = div.getElement(".valueDateInput2_vf") || null;
+        //         this.valueTimeInput2 = div.getElement(".valueTimeInput2_vf") || null;
+        //         this.valueBooleanInput2 = div.getElement(".valueBooleanInput2_vf") || null;
+        //
+        //         MWF.require("MWF.widget.Calendar", function(){
+        //             this.calendar = new MWF.widget.Calendar(this.valueDatetimeInput2, {
+        //                 "style": "xform",
+        //                 "isTime": true,
+        //                 "secondEnable": true,
+        //                 "target": this.app.content,
+        //                 "format": "db",
+        //                 "onComplate": function(){
+        //                     this.node.getElement("#"+id+"viewFilterDateFormulaSelector2").getElements("input").set("checked", false);
+        //                 }.bind(this)
+        //             });
+        //             new MWF.widget.Calendar(this.valueDateInput2, {
+        //                 "style": "xform",
+        //                 "isTime": false,
+        //                 "target": this.app.content,
+        //                 "format": "%Y-%m-%d"
+        //             });
+        //             new MWF.widget.Calendar(this.valueTimeInput2, {
+        //                 "style": "xform",
+        //                 "timeOnly": true,
+        //                 "secondEnable": true,
+        //                 "target": this.app.content,
+        //                 "format": "%H:%M:%S"
+        //             });
+        //         }.bind(this));
+        //
+        //         this.valueTextInput2.addEvent("keydown", function(e){
+        //             if (e.code==13) this.modifyOrAddFilterItem();
+        //         }.bind(this));
+        //         this.valueNumberInput2.addEvent("keydown", function(e){
+        //             if (e.code==13) this.modifyOrAddFilterItem();
+        //         }.bind(this));
+        //     }
+        // }
+    },
+    // switchInputDisplay : function(){
+    //     var id = "";
+    //     if( this.app.view ){
+    //         id = this.app.view.data.id;
+    //     }
+    //
+    //     var config = {
+    //         "textValue": {
+    //             "equals": {
+    //                 "selectorArea" : ["#"+id+"viewFilterTextFormulaSelector"] //["input", "@person", "@unitList", "@unitAllList", "@identityList" ],
+    //             },
+    //             "notEquals": {
+    //                 "selectorArea" : ["#"+id+"viewFilterTextFormulaSelector"] //["input", "@person", "@unitList", "@unitAllList", "@identityList" ],
+    //             },
+    //             "greaterThan": {
+    //                 "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ]
+    //             },
+    //             "greaterThanOrEqualTo": {
+    //                 "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ]
+    //             },
+    //             "lessThan": {
+    //                 "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ]
+    //             },
+    //             "lessThanOrEqualTo": {
+    //                 "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ]
+    //             },
+    //             "like": {
+    //                 "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ]
+    //             },
+    //             "notLike": {
+    //                 "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ]
+    //             },
+    //             "range": {
+    //                 "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ]
+    //             }
+    //         },
+    //         "numberValue": {
+    //             "equals": {}, //["input"]
+    //             "notEquals": {},
+    //             "greaterThan": {},
+    //             "greaterThanOrEqualTo": {},
+    //             "lessThan": {},
+    //             "lessThanOrEqualTo": {},
+    //             "range": {}
+    //         },
+    //         "dateTimeValue": {
+    //             "equals": {
+    //                 "invalidValue" : ["@year","@season","@month","@time","@date"]
+    //             },
+    //             "notEquals": {
+    //                 "selectorArea" : ["#"+id+"viewFilterDateFormulaSelector"]
+    //             },
+    //             "greaterThan": {
+    //                 "selectorArea" : ["#"+id+"viewFilterDateFormulaSelector"]
+    //             },
+    //             "greaterThanOrEqualTo": {
+    //                 "selectorArea" : ["#"+id+"viewFilterDateFormulaSelector"]
+    //             },
+    //             "lessThan": {
+    //                 "selectorArea" : ["#"+id+"viewFilterDateFormulaSelector"]
+    //             },
+    //             "lessThanOrEqualTo": {
+    //                 "selectorArea" : ["#"+id+"viewFilterDateFormulaSelector"]
+    //             },
+    //             "range": {
+    //                 "invalidValue" : ["@year","@season","@month","@time","@date"]
+    //             }
+    //         },
+    //         "dateValue": {
+    //             "equals": {
+    //                 "invalidValue" : ["@year","@season","@month","@date"]
+    //             },
+    //             "notEquals": {
+    //                 "selectorArea" : ["#"+id+"viewFilterDateOnlyFormulaSelector"]
+    //             },
+    //             "greaterThan":{
+    //                 "selectorArea" : ["#"+id+"viewFilterDateOnlyFormulaSelector"]
+    //             },
+    //             "greaterThanOrEqualTo": {
+    //                 "selectorArea" : ["#"+id+"viewFilterDateOnlyFormulaSelector"]
+    //             },
+    //             "lessThan": {
+    //                 "selectorArea" : ["#"+id+"viewFilterDateOnlyFormulaSelector"]
+    //             },
+    //             "lessThanOrEqualTo": {
+    //                 "selectorArea" : ["#"+id+"viewFilterDateOnlyFormulaSelector"]
+    //             },
+    //             "range": {
+    //                 "invalidValue" : ["@year","@season","@month","@date"]
+    //             }
+    //         },
+    //         "timeValue": {
+    //             "equals": {
+    //                 "invalidValue" : ["@time"]
+    //             },
+    //             "notEquals": {
+    //                 "selectorArea" : ["#"+id+"viewFilterTimeOnlyFormulaSelector"]
+    //             },
+    //             "greaterThan": {
+    //                 "selectorArea" : ["#"+id+"viewFilterTimeOnlyFormulaSelector"]
+    //             },
+    //             "greaterThanOrEqualTo": {
+    //                 "selectorArea" : ["#"+id+"viewFilterTimeOnlyFormulaSelector"]
+    //             },
+    //             "lessThan": {
+    //                 "selectorArea" : ["#"+id+"viewFilterTimeOnlyFormulaSelector"]
+    //             },
+    //             "lessThanOrEqualTo": {
+    //                 "selectorArea" : ["#"+id+"viewFilterTimeOnlyFormulaSelector"]
+    //             },
+    //             "range": {
+    //                 "invalidValue" : ["@time"]
+    //             }
+    //         },
+    //         "booleanValue": {
+    //             "equals": {},
+    //             "notEquals": {}
+    //         }
+    //     };
+    //
+    //     debugger;
+    //
+    //     var formulaSelectorIdList = [
+    //         "#"+id+"viewFilterTextFormulaSelector",
+    //         "#"+id+"viewFilterDateFormulaSelector",
+    //         "#"+id+"viewFilterDateOnlyFormulaSelector",
+    //         "#"+id+"viewFilterTimeOnlyFormulaSelector"
+    //     ];
+    //
+    //     var formatType = this.datatypeInput.options[this.datatypeInput.selectedIndex].value;
+    //     var object = config[formatType];
+    //
+    //     var availableComparisonList = Object.keys( object );
+    //     var options = this.comparisonInput.options;
+    //
+    //     var comparison = options[this.comparisonInput.selectedIndex].value;
+    //
+    //     if( !this.originalComparisonOptions ){
+    //         this.originalComparisonOptions = [];
+    //         for( var i=0; i< options.length; i++ ){
+    //             this.originalComparisonOptions.push({
+    //                 "text" : options[i].text,
+    //                 "value" : options[i].value
+    //             });
+    //         }
+    //     }
+    //
+    //     while( this.comparisonInput.options && this.comparisonInput.options.length ){
+    //         this.comparisonInput.options[0].destroy();
+    //     }
+    //
+    //     for( var i=0; i<this.originalComparisonOptions.length; i++ ){
+    //         var opt = this.originalComparisonOptions[i];
+    //         if( availableComparisonList.contains( opt.value )){
+    //             var option = new Element("option", {
+    //                 text : opt.text,
+    //                 value : opt.value
+    //             }).inject( this.comparisonInput );
+    //             if( opt.value === comparison )option.selected = true;
+    //         }
+    //     }
+    //
+    //     var availableInputArray = [];
+    //     var invalidValue = [];
+    //     for( var key in object ){
+    //         if( comparison === key ){
+    //             availableInputArray = object[key].selectorArea || [];
+    //             invalidValue = object[key].invalidValue || [];
+    //             break;
+    //         }
+    //     }
+    //     for( var i=0; i<invalidValue.length; i++ ){
+    //         invalidValue[i] = invalidValue[i].toLowerCase();
+    //     }
+    //
+    //     formulaSelectorIdList.each( function(id) {
+    //         var el = this.inputAreaNode.getElement( id );
+    //         if( !el )return;
+    //         if( availableInputArray.contains(id) ){
+    //             el.setStyle("display", "block");
+    //         }else{
+    //             el.getElements("input").set("checked", false);
+    //             el.setStyle("display", "none");
+    //         }
+    //     }.bind(this));
+    //
+    //     var viewFilterValue2Area, viewFilterValueTitleArea;
+    //     if ( availableComparisonList.contains("range") && comparison=="range"){
+    //         viewFilterValue2Area = this.inputAreaNode.getElement("#"+id+"viewFilterValue2Area");
+    //         if(viewFilterValue2Area)viewFilterValue2Area.setStyle('display', 'block');
+    //
+    //         viewFilterValueTitleArea = this.inputAreaNode.getElement("#"+id+"viewFilterValueTitleArea");
+    //         if(viewFilterValueTitleArea)viewFilterValueTitleArea.set('text', '从');
+    //     }else{
+    //         viewFilterValue2Area = this.inputAreaNode.getElement("#"+id+"viewFilterValue2Area");
+    //         if(viewFilterValue2Area)viewFilterValue2Area.setStyle('display', 'none');
+    //
+    //         viewFilterValueTitleArea = this.inputAreaNode.getElement("#"+id+"viewFilterValueTitleArea");
+    //         if(viewFilterValueTitleArea)viewFilterValueTitleArea.set('text', '值');
+    //     }
+    //     switch (formatType){
+    //         case "textValue":
+    //             this.valueTextInput.setStyle("display", "block");
+    //             if( invalidValue.contains( (this.valueTextInput.get("value") || "" ).toLowerCase() )){
+    //                 this.valueTextInput.set("value","");
+    //             }
+    //             this.valueNumberInput.setStyle("display", "none");
+    //             this.valueDatetimeInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "none");
+    //             this.valueTimeInput.setStyle("display", "none");
+    //             this.valueBooleanInput.setStyle("display", "none");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "block");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "none");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "none");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "none");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "none");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "none");
+    //             break;
+    //         case "numberValue":
+    //             this.valueTextInput.setStyle("display", "none");
+    //             this.valueNumberInput.setStyle("display", "block");
+    //             if( invalidValue.contains( (this.valueNumberInput.get("value") || "" ).toLowerCase() )){
+    //                 this.valueNumberInput.set("value","");
+    //             }
+    //             this.valueDatetimeInput.setStyle("display", "none");
+    //             this.valueBooleanInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "none");
+    //             this.valueTimeInput.setStyle("display", "none");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "none");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "block");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "none");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "none");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "none");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "none");
+    //             break;
+    //         case "datetimeValue":
+    //         case "dateTimeValue":
+    //             this.valueTextInput.setStyle("display", "none");
+    //             this.valueNumberInput.setStyle("display", "none");
+    //             this.valueDatetimeInput.setStyle("display", "block");
+    //             if( invalidValue.contains( (this.valueDatetimeInput.get("value") || "" ).toLowerCase() )){
+    //                 this.valueDatetimeInput.set("value","");
+    //             }
+    //             this.valueBooleanInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "none");
+    //             this.valueTimeInput.setStyle("display", "none");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "none");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "none");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "block");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "none");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "none");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "none");
+    //             break;
+    //         case "dateValue":
+    //             this.valueTextInput.setStyle("display", "none");
+    //             this.valueNumberInput.setStyle("display", "none");
+    //             this.valueDatetimeInput.setStyle("display", "none");
+    //             this.valueBooleanInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "block");
+    //             if( invalidValue.contains( (this.valueDateInput.get("value") || "" ).toLowerCase() )){
+    //                 this.valueDateInput.set("value","");
+    //             }
+    //             this.valueTimeInput.setStyle("display", "none");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "none");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "none");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "none");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "block");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "none");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "none");
+    //             break;
+    //         case "timeValue":
+    //             this.valueTextInput.setStyle("display", "none");
+    //             this.valueNumberInput.setStyle("display", "none");
+    //             this.valueDatetimeInput.setStyle("display", "none");
+    //             this.valueBooleanInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "none");
+    //             this.valueTimeInput.setStyle("display", "block");
+    //             if( invalidValue.contains( (this.valueTimeInput.get("value") || "" ).toLowerCase() )){
+    //                 this.valueTimeInput.set("value","");
+    //             }
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "none");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "none");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "none");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "none");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "block");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "none");
+    //             break;
+    //         case "booleanValue":
+    //             this.valueTextInput.setStyle("display", "none");
+    //             this.valueNumberInput.setStyle("display", "none");
+    //             this.valueDatetimeInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "none");
+    //             this.valueTimeInput.setStyle("display", "none");
+    //             this.valueBooleanInput.setStyle("display", "block");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "none");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "none");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "none");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "none");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "none");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "block");
+    //             break;
+    //     }
+    // },
+    // changeValueInput: function(){
+    //     var type = this.datatypeInput.options[this.datatypeInput.selectedIndex].value;
+    //     switch (type){
+    //         case "textValue":
+    //             this.valueTextInput.setStyle("display", "block");
+    //             this.valueNumberInput.setStyle("display", "none");
+    //             this.valueDatetimeInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "none");
+    //             this.valueTimeInput.setStyle("display", "none");
+    //             this.valueBooleanInput.setStyle("display", "none");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "block");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "none");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "none");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "none");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "none");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "none");
+    //             break;
+    //         case "numberValue":
+    //             this.valueTextInput.setStyle("display", "none");
+    //             this.valueNumberInput.setStyle("display", "block");
+    //             this.valueDatetimeInput.setStyle("display", "none");
+    //             this.valueBooleanInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "none");
+    //             this.valueTimeInput.setStyle("display", "none");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "none");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "block");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "none");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "none");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "none");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "none");
+    //             break;
+    //         case "datetimeValue":
+    //         case "dateTimeValue":
+    //             this.valueTextInput.setStyle("display", "none");
+    //             this.valueNumberInput.setStyle("display", "none");
+    //             this.valueDatetimeInput.setStyle("display", "block");
+    //             this.valueBooleanInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "none");
+    //             this.valueTimeInput.setStyle("display", "none");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "none");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "none");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "block");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "none");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "none");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "none");
+    //             break;
+    //         case "dateValue":
+    //             this.valueTextInput.setStyle("display", "none");
+    //             this.valueNumberInput.setStyle("display", "none");
+    //             this.valueDatetimeInput.setStyle("display", "none");
+    //             this.valueBooleanInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "block");
+    //             this.valueTimeInput.setStyle("display", "none");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "none");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "none");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "none");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "block");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "none");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "none");
+    //             break;
+    //         case "timeValue":
+    //             this.valueTextInput.setStyle("display", "none");
+    //             this.valueNumberInput.setStyle("display", "none");
+    //             this.valueDatetimeInput.setStyle("display", "none");
+    //             this.valueBooleanInput.setStyle("display", "none");
+    //             this.valueDateInput.setStyle("display", "none");
+    //             this.valueTimeInput.setStyle("display", "block");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "none");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "none");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "none");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "none");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "block");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "none");
+    //             break;
+    //         case "booleanValue":
+    //             this.valueTextInput.setStyle("display", "none");
+    //             this.valueNumberInput.setStyle("display", "none");
+    //             this.valueDatetimeInput.setStyle("display", "none");
+    //             this.valueTimeInput.setStyle("display", "none");
+    //             this.valueBooleanInput.setStyle("display", "block");
+    //             if (this.valueTextInput2) this.valueTextInput2.setStyle("display", "none");
+    //             if (this.valueNumberInput2) this.valueNumberInput2.setStyle("display", "none");
+    //             if (this.valueDatetimeInput2) this.valueDatetimeInput2.setStyle("display", "none");
+    //             if (this.valueDateInput2) this.valueDateInput2.setStyle("display", "none");
+    //             if (this.valueTimeInput2) this.valueTimeInput2.setStyle("display", "none");
+    //             if (this.valueBooleanInput2) this.valueBooleanInput2.setStyle("display", "block");
+    //             break;
+    //     }
+    // },
+    createActionNode: function(){
+        this.actionNode = new Element("div", {"styles": this.css.actionNode}).inject(this.actionAreaNode);
+        this.actionNode.addEvent("click", function(){
+            this.modifyOrAddFilterItem();
+        }.bind(this));
+    },
+    modifyOrAddFilterItem: function(){
+        if (this.currentFilterItem){
+            this.modifyFilterItem();
+        }else{
+            // if (this.restrictFilterInput.checked){
+            //     this.addFilterItem();
+            // }else{
+                this.addCustomFilterItem();
+            // }
+        }
+        this.setData({
+            "logic": "and",
+            "path": "",
+            "title": "",
+            "type": "custom", //this.restrictFilterInput.checked ? "restrict" : "custom",
+            "comparison": "equals",
+            "formatType": "textValue",
+            "value": "",
+            "otherValue": "",
+            "code": ""
+        });
+    },
+    modifyFilterItem: function(){
+        var data = this.getInputData();
+        if (this.verificationData(data)){
+            this.currentFilterItem.reload(data);
+            this.currentFilterItem.unSelected();
+            this.fireEvent("change");
+        }
+    },
+    // addFilterItem: function(){
+    //     var data = this.getInputData();
+    //     if (this.verificationData(data)){
+    //         this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item(this, data));
+    //         this.fireEvent("change");
+    //     }
+    // },
+    addCustomFilterItem: function(){
+        var data = this.getInputData();
+        if (this.verificationDataCustom(data)){
+            this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom(this, data));
+            this.fireEvent("change");
+        }
+    },
+    verificationData: function(data){
+        if (!data.path){
+            this.verificationNode = new Element("div", {"styles": this.css.verificationNode}).inject(this.inputAreaNode);
+            new Element("div", {"styles": this.css.verificationTextNode, "text": this.app.lp.mastInputPath}).inject(this.verificationNode);
+            this.pathInput.focus();
+            this.pathInput.setStyle("background-color", "#fbe8e8");
+
+            this.pathInput.addEvents({
+                "keydown": function(){
+                    if (this.verificationNode){
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                        this.pathInput.setStyle("background-color", "#FFF");
+                    }
+                }.bind(this),
+                "click": function(){
+                    if (this.verificationNode){
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                    }
+                }.bind(this)
+            });
+            return false;
+        }
+        // if (data.comparison=="range" && !data.otherValue){
+        //     this.verificationNode = new Element("div", {"styles": this.css.verificationNode}).inject(this.inputAreaNode);
+        //     new Element("div", {"styles": this.css.verificationTextNode, "text": this.app.lp.mastInputPath}).inject(this.verificationNode);
+        // }
+        return true;
+    },
+    verificationDataCustom: function(data){
+        if (!data.title){
+            this.verificationNode = new Element("div", {"styles": this.css.verificationNode}).inject(this.inputAreaNode);
+            new Element("div", {"styles": this.css.verificationTextNode, "text": this.app.lp.mastInputTitle}).inject(this.verificationNode);
+            this.titleInput.focus();
+            this.titleInput.setStyle("background-color", "#fbe8e8");
+
+            this.titleInput.addEvents({
+                "keydown": function(){
+                    if (this.verificationNode){
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                        this.titleInput.setStyle("background-color", "#FFF");
+                    }
+                }.bind(this),
+                "click": function(){
+                    if (this.verificationNode){
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                    }
+                }.bind(this)
+            });
+            return false;
+        }
+        if (!data.path){
+            this.verificationNode = new Element("div", {"styles": this.css.verificationNode}).inject(this.inputAreaNode);
+            new Element("div", {"styles": this.css.verificationTextNode, "text": this.app.lp.mastInputPath}).inject(this.verificationNode);
+            this.pathInput.focus();
+            this.pathInput.setStyle("background-color", "#fbe8e8");
+
+            this.pathInput.addEvents({
+                "keydown": function(){
+                    if (this.verificationNode){
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                        this.pathInput.setStyle("background-color", "#FFF");
+                    }
+                }.bind(this),
+                "click": function(){
+                    if (this.verificationNode){
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                    }
+                }.bind(this)
+            });
+            return false;
+        }
+        return true;
+    },
+    getInputData: function(){
+        // var logic = this.logicInput.options[this.logicInput.selectedIndex].value;
+        var path = this.pathInput.get("value");
+        var title = this.titleInput.get("value");
+        // if (this.restrictFilterInput.checked) var type = "restrict";
+        // if (this.customFilterInput.checked) var type = "custom";
+
+        var type = "custom";
+
+        // var comparison = this.comparisonInput.options[this.comparisonInput.selectedIndex].value;
+        var comparison = "";
+        var formatType = this.datatypeInput.options[this.datatypeInput.selectedIndex].value;
+        var value = "";
+        var value2 = "";
+        // switch (formatType){
+        //     case "textValue":
+        //         value = this.valueTextInput.get("value") || "";
+        //         value2 = (this.valueTextInput2) ? (this.valueTextInput2.get("value") || "") : "";
+        //         break;
+        //     case "numberValue":
+        //         value = this.valueNumberInput.get("value").toFloat();
+        //         value2 = (this.valueNumberInput2) ? this.valueNumberInput2.get("value").toFloat() : "";
+        //         break;
+        //     case "datetimeValue":
+        //     case "dateTimeValue":
+        //         value = this.valueDatetimeInput.get("value") || "";
+        //         value2 = (this.valueDatetimeInput2) ? (this.valueDatetimeInput2.get("value") || "") : "";
+        //         break;
+        //     case "dateValue":
+        //         value = this.valueDateInput.get("value") || "";
+        //         value2 = (this.valueDateInput2) ? (this.valueDateInput2.get("value") || "") : "";
+        //         break;
+        //     case "timeValue":
+        //         value = this.valueTimeInput.get("value") || "";
+        //         value2 = (this.valueTimeInput2) ? (this.valueTimeInput2.get("value") || "") : "";
+        //         break;
+        //
+        //     case "booleanValue":
+        //         value = this.valueBooleanInput.options[this.valueBooleanInput.selectedIndex].value;
+        //         value2 = (this.valueBooleanInput2) ? this.valueBooleanInput2.options[this.valueBooleanInput.selectedIndex].value : "";
+        //         if (value=="true"){
+        //             value = true;
+        //         }else{
+        //             value = false;
+        //         }
+        //         if (value2=="true"){
+        //             value2 = true;
+        //         }else{
+        //             value2 = false;
+        //         }
+        //         break;
+        // }
+        // 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": "and",
+                "path": path,
+                "title": title,
+                "type": type,
+                "comparison": comparison,
+                "formatType": formatType,
+                "value": value,
+                "otherValue": value2,
+                "code": this.scriptData,
+                "valueType" : valueType,
+                "valueScript" : this.customFilterValueScriptData
+            };
+        // }
+    },
+
+    setData: function(data){
+        // for (var i=0; i<this.logicInput.options.length; i++){
+        //     if (this.logicInput.options[i].value===data.logic){
+        //         this.logicInput.options[i].set("selected", true);
+        //         break;
+        //     }
+        // }
+
+        this.titleInput.set("value", data.title);
+        this.pathInput.set("value", data.path);
+
+        // for (var i=0; i<this.comparisonInput.options.length; i++){
+        //     if (this.comparisonInput.options[i].value===data.comparison){
+        //         this.comparisonInput.options[i].set("selected", true);
+        //         break;
+        //     }
+        // }
+
+        for (var i=0; i<this.datatypeInput.options.length; i++){
+            if (this.datatypeInput.options[i].value===data.formatType){
+                this.datatypeInput.options[i].set("selected", true);
+                break;
+            }
+        }
+
+        // switch (data.formatType){
+        //     case "textValue":
+        //         this.valueTextInput.set("value", data.value);
+        //         if (this.valueTextInput2) this.valueTextInput2.set("value", data.otherValue);
+        //         break;
+        //     case "numberValue":
+        //         this.valueNumberInput.set("value", data.value);
+        //         if (this.valueNumberInput2) this.valueNumberInput2.set("value", data.otherValue);
+        //         break;
+        //     case "datetimeValue":
+        //     case "dateTimeValue":
+        //         this.valueDatetimeInput.set("value", data.value);
+        //         if (this.valueDatetimeInput2) this.valueDatetimeInput2.set("value", data.otherValue);
+        //         break;
+        //     case "dateValue":
+        //         this.valueDateInput.set("value", data.value);
+        //         if (this.valueDateInput2) this.valueDateInput2.set("value", data.otherValue);
+        //         break;
+        //     case "timeValue":
+        //         this.valueTimeInput.set("value", data.value);
+        //         if (this.valueTimeInput2) this.valueTimeInput2.set("value", data.otherValue);
+        //         break;
+        //     case "booleanValue":
+        //
+        //         for (var i=0; i<this.valueBooleanInput.options.length; i++){
+        //             var v = this.valueBooleanInput.options[i].value;
+        //             if (v=="true"){
+        //                 v = true;
+        //             }else{
+        //                 v = false;
+        //             }
+        //             if (v===data.value){
+        //                 this.valueBooleanInput.options[i].set("selected", true);
+        //                 break;
+        //             }
+        //         }
+        //         if (this.valueBooleanInput2){
+        //             for (var i=0; i<this.valueBooleanInput2.options.length; i++){
+        //                 var v = this.valueBooleanInput2.options[i].value;
+        //                 if (v=="true"){
+        //                     v = true;
+        //                 }else{
+        //                     v = false;
+        //                 }
+        //                 if (v===data.otherValue){
+        //                     this.valueBooleanInput2.options[i].set("selected", true);
+        //                     break;
+        //                 }
+        //             }
+        //         }
+        //         break;
+        // }
+        this.scriptData = data.code;
+        try{
+            if (this.scriptArea && this.scriptArea.editor) this.scriptArea.editor.setValue(this.scriptData.code);
+        }catch (e) {}
+
+        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.switchInputDisplay();
+        // if(this.datatypeInput.onchange){
+        //     this.datatypeInput.onchange();
+        // }
+    },
+
+    deleteItem: function(item){
+        if (this.currentFilterItem == item) item.unSelected();
+        this.items.erase(item);
+        item.node.destroy();
+        MWF.release(item);
+        this.fireEvent("change");
+    },
+    getData: function(){
+        // var data = [];
+        var customData = [];
+        this.items.each(function(item){
+            // if (item.data.type==="custom"){
+                customData.push(item.data);
+            // }else{
+            //     data.push(item.data);
+            // }
+        }.bind(this));
+        // return {"data": data, "customData": customData};
+        return {"customData": customData};
+    }
+});
+
+
+
+MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom = new Class({
+    Implements: [Events],
+    initialize: function(filter, data){
+        this.filter = filter;
+        this.data = data;
+        this.container = this.filter.fieldListAreaNode;
+        this.css = this.filter.css;
+        this.app = this.filter.app;
+        this.load();
+    },
+    load: function(){
+        this.node = new Element("div", {"styles": this.css.itemNode}).inject(this.container);
+        this.deleteNode = new Element("div", {"styles": this.css.itemDeleteNode}).inject(this.node);
+        this.contentNode = new Element("div", {"styles": this.css.itemContentNode}).inject(this.node);
+        this.contentNode.set("text", this.getText());
+
+        this.contentNode.addEvent("click", function(){
+            this.selected();
+        }.bind(this));
+
+        this.deleteNode.addEvent("click", function(e){
+            this.deleteItem(e);
+        }.bind(this));
+    },
+    getText: function(){
+        var lp = this.app.lp.filter;
+        return this.data.title+"("+this.data.path+")";
+    },
+    reload: function(data){
+        this.data = data;
+        this.contentNode.set("text", this.getText());
+    },
+    selected: function(){
+        // this.filter.customFilterInput.set("checked", true);
+        // this.filter.customFilterInput.click();
+        if (this.filter.currentFilterItem) this.filter.currentFilterItem.unSelected();
+        this.node.setStyles(this.css.itemNode_current);
+        this.filter.currentFilterItem = this;
+        this.filter.setData(this.data);
+    },
+    unSelected: function(){
+        this.node.setStyles(this.css.itemNode);
+        this.filter.currentFilterItem = null;
+        this.filter.currentItem = this;
+    },
+    deleteItem: function(e){
+        var _self = this;
+        this.filter.app.confirm("warn", e, this.app.lp.delete_filterItem_title, this.app.lp.delete_filterItem, 300, 120, function(){
+            _self.destroy();
+            this.close();
+        }, function(){
+            this.close();
+        });
+    },
+    destroy: function(){
+        this.filter.deleteItem(this);
+    }
+});