sys_alert_rule_privilege.lview 4.89 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ouyangzhaochang2663 $
    $Date: 2010/12/10 08:05:10 $
    $Revision: 1.4 $
    $Purpose: 任务角色授权
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure><![CDATA[     
    ]]></a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
            function alertRoleCodeEdit(record,name){
                if(record.isNew){
                    return 'alert_role_code_lov';
                }else{
                    return '';
                }
            }
            
            function compareDate(start, end){
                if(start > end){
                    return false;
                }
                return true;
            }
            
            function dateValidator(record, name, value){
                if(name == 'start_date' || name == 'end_date'){
                    var start_date = record.get('start_date');
                    var end_date = record.get('end_date');
                    if(typeof(end_date) != 'undefined' && !Ext.isEmpty(end_date)){
                        if(!compareDate(start_date, end_date)){
                            return '${l:START_GREATER_THAN_END}';
                        }
                    }
                    return true;
                }
            }
            
            function onUpdate(ds,record,name,value){
                if(name == 'start_date' || name == 'end_date'){
                    record.validate((name == 'start_date') ? 'end_date' : 'start_date');
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="sys_alert_role_info" loadData="true" model="sys.SYS2030.sys_alert_rules">
                <a:fields>
                    <a:field name="alert_rule_code" readOnly="true"/>
                    <a:field name="description" readOnly="true"/>
                    <a:field name="event_name" readOnly="true"/>
                    <a:field name="event_desc" readOnly="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="sys_alert_rule_privilege_result_ds" autoQuery="true" fetchAll="false" model="sys.SYS2030.sys_alert_rule_privilege" queryUrl="${/request/@context_path}/autocrud/sys.SYS2030.sys_alert_rule_privilege/query?alert_rule_id=${/parameter/@alert_rule_id}" selectable="true">
                <a:fields>
                    <a:field name="role_code" lovGridHeight="340" lovHeight="500" lovService="sys.sys_role" lovWidth="500" required="true" title="HAP_SELECT_ROLE">
                        <a:mapping>
                            <a:map from="role_id" to="role_id"/>
                            <a:map from="role_code" to="role_code"/>
                            <a:map from="role_name" to="role_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="alert_rule_id" defaultValue="${/parameter/@alert_rule_id}"/>
                    <a:field name="start_date" required="true" validator="dateValidator"/>
                    <a:field name="end_date" validator="dateValidator"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onUpdate"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:fieldSet column="2" title="SYS_ALERT_RULES.RULE_INFO" width="570">
                <a:textField name="alert_rule_code" bindTarget="sys_alert_role_info" width="195"/>
                <a:textField name="description" bindTarget="sys_alert_role_info" width="195"/>
                <a:textField name="event_name" bindTarget="sys_alert_role_info" width="195"/>
                <a:textField name="event_desc" bindTarget="sys_alert_role_info" width="195"/>
            </a:fieldSet>
            <a:grid id="sys_alert_rule_privilege_grid" bindTarget="sys_alert_rule_privilege_result_ds" height="300" navBar="true" width="580">
                <a:toolBar>
                    <a:button type="add"/>
                    <a:button type="clear"/>
                    <a:button type="save"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="role_code" align="center" editorFunction="alertRoleCodeEdit" sortable="true" width="150"/>
                    <a:column name="role_name" prompt="SYS_ROLE.ROLE_NAME" width="200"/>
                    <a:column name="start_date" align="center" editor="privilege_date_dp" renderer="Leaf.formatDate"/>
                    <a:column name="end_date" align="center" editor="privilege_date_dp1" renderer="Leaf.formatDate"/>
                </a:columns>
                <a:editors>
                    <a:lov id="alert_role_code_lov"/>
                    <a:datePicker id="privilege_date_dp"/>
                    <a:datePicker id="privilege_date_dp1"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>