rsc_five_class_plan.lview 8.56 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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2013-8-3 上午11:03:33  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-query defaultWhereClause="v.code=&apos;RSC200_RSC_FIVE_CLASS_USAGE_TYPE&apos; and v.code_value=&apos;SIGNAL_LAMP&apos;" model="basic.sys_code_default_value" rootPath="usage_type"/>
    </a:init-procedure>
    <a:view>
        <a:link id="rsc_five_class_code_link" url="${/request/@context_path}/modules/rsc/RSC200/rsc_five_class_code.lview"/>
        <a:link id="rsc_fc_target_signal_lamp_link" url="${/request/@context_path}/modules/rsc/RSC200/rsc_fc_target_signal_lamp.lview"/>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function rsc_200_query() {
                $('rsc200_result_ds').query();
            }
            
            function rsc_200_grid_submit() {
                var result_ds = $('rsc200_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            
            function rsc_200_grid_add() {
                $('rsc_class_plan_grid').showEditorByRecord($('rsc200_result_ds').create());
            
            }
            
            function rsc200PlanCodeFunction(record, name) {
                if (record.isNew) {
                    return 'rsc200_five_class_plan_tf';
                } else {
                    return '';
                }
            }
            
            function rsc200ModifyPageRenderer(value, record, name) {
                var plan_code = record.get('five_class_plan');
                var usage_type = record.get('usage_type');
            
                if (record.isNew) {
                    return '';
                }
                return '<a href="javascript:rsc200OpenPage(\'' + plan_code + '\',\'' + usage_type + '\')">${l:RSC_FIVE_CLASS_PLANS.MODIFY_PAGE}</a>';
            }
            
            function rsc200OpenPage(plan_code, usage_type) {
            
                new Leaf.Window({
                    id: 'rsc_five_class_code_window',
                    url: $('rsc_five_class_code_link').getUrl() + '?plan_code=' + plan_code + '&usage_type=' + usage_type,
                    title: '${l:RSC_FIVE_CLASS_PLANS.SET_CODE}',
                    height: 545,
                    width: 690
                });
            }
            
            function rsc200LightRuleRend(value, record, name) {
                var plan_code = record.get('five_class_plan');
                var usage_type = record.get('usage_type');
                if (record.isNew || usage_type == 'RISK_MATRIX') {
                    return '';
                } else {
                    return '<a href="javascript:rsc200OpenLampRulePage(\'' + plan_code + '\',\'' + usage_type + '\')">${l:RSC_FIVE_CLASS_PLANS.MODIFY_PAGE}</a>';
                }
            }
            
            function rsc200OpenLampRulePage(plan_code, usage_type) {
                new Leaf.Window({
                    id: 'rsc_fc_target_signal_lamp',
                    url: $('rsc_fc_target_signal_lamp_link').getUrl() + '?plan_code=' + plan_code + '&usage_type=' + usage_type,
                    title: '${l:RSC_FIVE_CLASS_TARGET_VALUE.LAMP_LIGHT_RULE}',
                    height: 445,
                    width: 440
                });
            }
            
            function rsc200CompanyAllocation(value, record, name) {
            
               }
            
            function planCodeValidator(record, name, value) {
                if (name == 'five_class_plan' && record.isNew && !(Leaf.isEmpty(record.get('five_class_plan')))) {
                    var records = $('rsc200_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.E001}';
                        }
                    }
                }
                return true;
            }
            
            function rsc200ClassPlanUpdate(ds, record, name, valid) {
                if (name == 'five_class_plan' && !valid) {
                    Leaf.showInfoMessage('${l:PROMPT.ERROR}', '${l:RSC_FIVE_CLASS_PLANS.E001}');
                }
            }
            
            function rsc200UsageTypeFunction(record, name) {
                if (record.isNew) {
                    return 'rsc200_five_class_plan_cbb';
                } else {
                    return '';
                }
            }
            
            function submitsuccess(ds, record) {
                $('rsc200_result_ds').query();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="rsc200_updatemethod" lookupCode="RSC_FIVE_CLASS_UPDATE_METHOD"/>
            <a:dataSet id="rec200_usage_type_ds" lookupCode="RSC200_RSC_FIVE_CLASS_USAGE_TYPE"/>
            <a:dataSet id="rsc200_query_ds" model="rsc.RSC200.rsc_five_class_plan"/>
            <a:dataSet id="rsc200_result_ds" autoCount="true" autoQuery="true" fetchAll="false" model="rsc.RSC200.rsc_five_class_plan" pageSize="15" queryDataSet="rsc200_query_ds" selectable="true">
                <a:fields>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="five_class_plan" required="true" validator="planCodeValidator"/>
                    <a:field name="usage_type_desc" defaultValue="${/model/usage_type/record/@code_value_name}" displayField="code_value_name" options="rec200_usage_type_ds" required="true" returnField="usage_type" valueField="code_value"/>
                    <a:field name="calculate_object"/>
                    <a:field name="update_system_method_desc" displayField="code_value_name" options="rsc200_updatemethod" returnField="update_system_method" valueField="code_value"/>
                    <a:field name="description" required="true"/>
                    <a:field name="usage_type" defaultValue="${/model/usage_type/record/@code_value}"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="submitsuccess"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="rsc_200_query" text="HLS.QUERY"/>
                <a:gridButton click="rsc_200_grid_add" text="HLS.NEW"/>
                <a:gridButton click="rsc_200_grid_submit" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:grid id="rsc_class_plan_grid" bindTarget="rsc200_result_ds" height="490" marginWidth="20" navBar="true" width="1000">
                <a:columns>
                    <a:column name="five_class_plan" align="left" editorFunction="rsc200PlanCodeFunction" sortable="true" width="100"/>
                    <a:column name="description" align="left" editor="rsc200_five_class_plan_tf" width="200"/>
                    <a:column name="usage_type_desc" align="left" editorFunction="rsc200UsageTypeFunction" prompt="RSC_FIVE_CLASS_PLAN.USAGE_TYPE" width="100"/>
                    <a:column name="calculate_object" align="left" editor="rsc200_five_class_plan_tf" width="100"/>
                    <a:column name="update_system_method_desc" align="left" editor="rsc200_five_class_plan_cbb" prompt="RSC_FIVE_CLASS_PLAN.UPDATE_SYSTEM_METHOD" width="100"/>
                    <a:column name="rsc_200_level_definition" align="center" prompt="RSC_FIVE_CLASS_PLAN.LEVEL_DEFINITION" renderer="rsc200ModifyPageRenderer" width="80"/>
                    <a:column name="rsc_200_light_rule_ren" align="center" prompt="RSC_FIVE_CLASS_PLAN.LIGHT_RULE" renderer="rsc200LightRuleRend" width="100"/>
                    <!-- <a:column name="rsc_200_company_allocation" prompt="RSC_FIVE_CLASS_PLAN.COMPANY_ALLOCATION" renderer="rsc200CompanyAllocation"    /> -->
                    <a:column name="enabled_flag" align="center" editor="rsc200_five_class_plan_cb" width="50"/>
                </a:columns>
                <a:editors>
                    <a:textField id="rsc200_five_class_plan_tf"/>
                    <a:comboBox id="rsc200_five_class_plan_cbb"/>
                    <a:checkBox id="rsc200_five_class_plan_cb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>