rsc_five_class_codes.lview 6.39 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ericyin  
    $Date: 2012-12-18 下午4:00:22  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="rsc_five_class_rule_link" url="${/request/@context_path}/modules/rsc/RSC202/rsc_five_class_rules.lview"/>
        <script type="text/javascript"><![CDATA[
            function rsc202_class_code_query() {
                $('rsc202_class_code_result_ds').query();
            }
            function rsc202_class_code_grid_submit() {
                var result_ds = $('rsc202_class_code_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            function rsc202_class_code_grid_add() {
                $('rsc_class_code_grid').showEditorByRecord($('rsc202_class_code_result_ds').create());
            }
            
            function rsc202_class_code_quit() {
                $('rsc_five_class_code_window').close();
            }
            function rsc_202_class_code_grid_clear() {
                $('rsc_class_code_grid').remove();
            }
            function rsc202ClassCodeFunction(record, name) {
                if (record.isNew) {
                    return 'rsc202_five_class_code_tf';
                } else {
                    return '';
                }
            }
            function rsc202DetailPageRenderer(value, record, name) {
                var class_code = record.get('five_class_code');
                if (record.isNew) {
                    return '';
                }
                return '<a href="javascript:rsc202OpenDetailPage(\'' + class_code + '\')">${l:RSC_FIVE_CLASS_PLANS.MODIFY_PAGE}</a>';
            }
            function rsc202OpenDetailPage(class_code) {
                new Leaf.Window({
                    id: 'rsc_five_class_rule_window',
                    url: $('rsc_five_class_rule_link').getUrl() + '?class_code=' + class_code,
                    title: '${l:RSC_FIVE_CLASS_PLANS.SET_RULE}',
                    height: 435,
                    width: 880
                });
            }
            function classCodeValidator(record, name, value) {
                if (name == 'five_class_code' && record.isNew) {
                    var records = $('rsc202_class_code_result_ds').getAll();

                    for (var i = 0,length = records.length;i < length;i++) {
                        var r = records[i],v = r.get(name);
                        if (r != record && v == value) {
                            return '${l:RSC_FIVE_CLASS_PLANS.E003}';
                        }
                    }
                }
                return true;
            }
            function rsc202ClassCodeOnAdd(ds, record, index) {
                record.set('five_class_plan_code', '${/parameter/@plan_code}');
            }
            function rsc202ClassCodeUpdate(ds, record, name, valid) {
                if (name == 'five_class_code' && !valid) {
                    Leaf.showInfoMessage('错误', '${l:RSC_FIVE_CLASS_PLANS.E003}');
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="rsc202_class_code_query_ds" model="rsc.RSC202.rsc_five_class_codes"/>
            <a:dataSet id="rsc202_class_code_result_ds" autoCount="true" autoQuery="true" fetchAll="false" model="rsc.RSC202.rsc_five_class_codes" pageSize="15" queryDataSet="rsc202_class_code_query_ds" queryUrl="${/request/@context_path}/autocrud/rsc.RSC202.rsc_five_class_codes/query?five_class_plan_code=${/parameter/@plan_code}" selectable="true">
                <a:fields>
                    <a:field name="five_class_code" required="true" validator="classCodeValidator"/>
                    <a:field name="five_class_plan_code"/>
                    <a:field name="five_class_name_description" required="true"/>
                    <a:field name="priority"/>
                </a:fields>
                <a:events>
                    <a:event name="add" handler="rsc202ClassCodeOnAdd"/>
                    <a:event name="valid" handler="rsc202ClassCodeUpdate"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar height="29">
                <a:button click="rsc202_class_code_quit" height="20" icon="${/request/@context_path}/images/quit.png" iconAlign="left" text="HLS.EXIT" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="rsc202_class_code_grid_add" height="20" icon="${/request/@context_path}/images/add.png" iconAlign="left" text="HLS.NEW" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="rsc_202_class_code_grid_clear" height="20" icon="${/request/@context_path}/images/remove.png" iconAlign="left" text="HLS_REMOVE" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="rsc202_class_code_grid_submit" height="20" icon="${/request/@context_path}/images/save.png" iconAlign="left" text="HLS.SAVE" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="rsc202_class_code_query" height="20" icon="${/request/@context_path}/images/search.png" iconAlign="left" text="HAP_QUERY" width="50"/>
                <a:separator style="margin-left:3px;"/>
            </a:screenTopToolbar>
            <a:grid id="rsc_class_code_grid" bindTarget="rsc202_class_code_result_ds" height="385" navBar="true" width="600">
                <a:columns>
                    <a:column name="five_class_plan_code" align="left" width="100"/>
                    <a:column name="five_class_code" align="left" editorFunction="rsc202ClassCodeFunction" sortable="true" width="100"/>
                    <a:column name="five_class_name_description" align="left" editor="rsc202_five_class_code_tf" prompt="RSC_FIVE_CLASS_CODES.FIVE_CLASS_NAME_DESC" width="200"/>
                    <a:column name="priority" align="left" editor="rsc202_five_class_code_tf" width="90"/>
                    <a:column name="rsc_202_classcode_link" align="left" prompt="RSC_FIVE_CLASS_CODES.DETAIL" renderer="rsc202DetailPageRenderer" width="80"/>
                </a:columns>
                <a:editors>
                    <a:textField id="rsc202_five_class_code_tf"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>