flexible_UI.lview 10.2 KB
Newer Older
niminmin's avatar
niminmin 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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2014-5-19 下午01:09:48  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:view>
        <script type="text/javascript"><![CDATA[
            //锁屏
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window'] = function() {
                var detail_mask;
                if ('${/parameter/@winid}') {
                    if (parent.$L.CmpManager.get('${/parameter/@winid}')) {
                        detail_mask = parent.$('${/parameter/@winid}').wrap;
                        parent.Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                    } else {
                        detail_mask = $('${/parameter/@winid}').wrap;
                        Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                    }
                } else {
                    detail_mask = Ext.getBody();
                    Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                }
            };
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_cp_object_focus'] = function() {};
            //解屏
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window'] = function() {
                var detail_mask;
                if ('${/parameter/@winid}') {
                    if (parent.$L.CmpManager.get('${/parameter/@winid}')) {
                        detail_mask = parent.$('${/parameter/@winid}').wrap;
                        parent.Leaf.Masker.unmask(detail_mask);
                    } else {
                        detail_mask = $('${/parameter/@winid}').wrap;
                        Leaf.Masker.unmask(detail_mask);
                    }
                } else {
                    detail_mask = Ext.getBody();
                    Leaf.Masker.unmask(detail_mask);
                }
                if (Ext.get(document.documentElement)) {
                    $L.Masker.unmask(Ext.get(document.documentElement));
                }
            };
            //图片渲染
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_dynamic_pic_renderer'] = function(record, name, bp_seq) {
                var result = name.match(/(.*)_pic$/);
                if (result) {
                    var pic_value = record.get(result[1]);
                    if (pic_value == 'OUTFLOW') {
                        return '<img src="${/request/@context_path}/images/outflow.png" style="margin-top:4px"/>';
                    } else if (pic_value == 'INFLOW') {
                        return '<img src="${/request/@context_path}/images/inflow.png" style="margin-top:4px"/>';
                    } else if (pic_value == 'NONCASH') {
                        return '<img src="${/request/@context_path}/images/noncash.png" style="margin-top:4px"/>';
                    } else if (pic_value == 'CASH') {
                        return '<img src="${/request/@context_path}/images/cash.png" style="margin-top:4px"/>';
                    }
                }
            };
            
            
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_hls_link_render_record'] = {};
            //超链接渲染
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record, bp_seq) {
                var link_function = '';
                window['${/parameter/@bp_seq}${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
                if (name == 'quote') {
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>';
                }
            };
            //按钮渲染
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_dynamic_button_renderer'] = function(value, record, name, config_record, bp_seq) {
                var link_function = '';
                if (name == 'quote') {
                    link_function = '';
                }
                if (Ext.isIE || Ext.isIE9 || Ext.isIE10) {
                    return '<button style="font-size:11px;height:22px;width:70%;text-align:center;padding:0 4px 4px 0" onclick="window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');"><div style="height: 18px; line-height: 16px; text-decoration: none;">' + config_record.get('prompt') + '</div></button>';
                } else {
                    return '<button style="font-size:11px;height:22px;width:70%;text-align:center;" onclick="window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</button>';
                }
            };
            //新增和加载时调用(form)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function(ds, record, config_records, bp_seq) {
            
               };
            
            //保存前调用
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function(ds, record) {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var check_flag = true;
                return check_flag;
            };
            
            //保存submitsuccess调用
            window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res, bp_seq) {
                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            };
            //保存失败调用
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_submitfailed'] = function(ds) {
                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            };
            
            //新增时调用(grid,table,gridBox)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function(ds, record, config_records, bp_seq) {
            
               };
            //加载时调用(grid,table,gridBox)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function(ds, record, config_records, bp_seq) {
            
               };
            //查询时调用(grid,table,gridBox)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
            
               };
            //查询时调用(form,fieldboxcolumn)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_query'] = function(ds, qpara, bp_seq) {
            
               };
            //新增时调用(attach)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_attach_add'] = function(ds, record, config_records, bp_seq) {
            
               };
            //加载时调用(attach)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_attach_load'] = function(ds, record, config_records, bp_seq) {
            
               };
            //更新时调用
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
            
               };
            
            //选择事件(grid,attach,gridbox,table)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_select'] = function(ds, record, bp_seq) {
            
               };
            //indexchange事件(grid,attach,gridbox,table)
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_indexchange'] = function(ds, record, bp_seq) {
            	
               };
            
            //取消选择事件(grid,attach,gridbox,table)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_unselect'] = function(ds, record, bp_seq) {
            
               };
            
            //移除事件(grid,attach,gridbox,table)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_remove'] = function(ds, record, bp_seq) {
            
            };

            //移除前事件(grid,attach,gridbox,table)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_brfore_remove'] = function(ds, record, bp_seq) {
                return true;
            };

            //grid cellclick
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_cell_click'] = function(ds, record, bp_seq) {

            };

            function sumFunction(datas, name) {
                var sum = 0;
                for (var i = 0;i < datas.length;i++) {
                    var r = datas[i];
                    var d = r.get(name);
                    var n = parseFloat(d);
                    if (!isNaN(n)) {
                        sum = plus(sum, n);
                    }
                }
                var total = (typeof(sum) == 'undefined' ? '' : parseFloat(sum));
                return '<font>' + Leaf.formatNumber(total) + '</font>';
            }
            
            //false为忽略校验,true为不忽略校验
            window['${/parameter/@layout_code}_not_ignore_required_flag'] = true;
            //忽略保存校验方法
            window['${/parameter/@layout_code}_ignore_required_before_save'] = function() {
                window['${/parameter/@layout_code}_not_ignore_required_flag'] = true;
            };
            
            //requiredfunction
            window['${/parameter/@layout_code}_not_ignore_required'] = function() {
                return window['${/parameter/@layout_code}_not_ignore_required_flag'];
            };

            Leaf.onReady(function() {
                var input = document.createElement('input');
                document.body.appendChild(input);
                Ext.fly(input).moveTo(-10000, -10000);
                input.focus();
                setTimeout(function() {
                    Ext.fly(input).remove();
                }, 1000);
            });
        ]]></script>
    </a:view>
</a:screen>