con_contract_location.lview 10.4 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 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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author:  Yimeng
    $Date: 2015-03-13 下午05:58:31  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <!--  <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="con509_excel_import" url="${/request/@context_path}/modules/cont/CON509/acr_excel_import.lview"/> -->
        <a:link id="con509_excel_import" url="${/request/@context_path}/modules/cont/CON509/acr_excel_import.lview"/>
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON509.con_contract_location" modelaction="batch_update"/>
        <a:link id="csh_payment_req_doc_print_link" url="${/request/@context_path}/modules/cont/CON509/csh_payment_doc_print.lview"/>
        <script type="text/javascript"><![CDATA[
            //indexchange事件(grid,attach,gridbox,table)
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_indexchange'] = function(ds, record, bp_seq) {
                //
                var con_contract_location_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_location');
                var con_contract_location_ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_location_ln');
                if (ds.id == con_contract_location_ds_id) {
                    var location_id = record.get('location_id');
                    $(con_contract_location_ln_ds_id).setQueryParameter('location_id', location_id);
                    $(con_contract_location_ln_ds_id).query();
                }
            };
            
            //新增
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                //
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_location');
                $(ds_id).create();
                // window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
                // Leaf.request({
                // url:$('con508_list_query').getUrl(),
                // para:{},
                // success:function(){
                // window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                // $(ds_id).query();
                // },
                // scope:this
                // });
            };
            
            //删除
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_location');
                var records = $(ds_id).getSelected();
                for (var i = 0;i < records.length;i++) {
                    if (records[i].get('docu_amount') > 0) {
                        Leaf.showMessage('提示', '选择的箱子有文件!');
                        return;
                    }
                }
                var grid_id = ds_id.replace('ds', 'layout_grid_id');
                $(grid_id).remove();
            };
            //导入
            // window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function() {
            // var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_location');
            // new Leaf.Window({
            // id: 'con509_upload_window',
            // param :{winid :'con509_upload_window'},
            // url: $('con509_excel_import').getUrl(),
            // title: '${l:HLS.IMPORT}',
            // width: 420,
            // height: 275
            // });
            // };
            
            //导出
            window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_location_ln');
                var grid_id = ds_id.replace('ds', 'layout_grid_id');
                $(grid_id)._export();
            };
            
            
            //更新时调用
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
                var con_contract_location_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_location');
                if (ds.id == con_contract_location_id) {
                    if (name == 'doc_type') {
            
                        var years = record.getField('years');
                        var doc_type = record.get('doc_type');
                        if (doc_type == '20') {
            
                            years.setRequired(true);
                        } else {
                            years.setRequired(false);
                        }
                    } else if (name == 'chest_number' && !Ext.isEmpty(value)) {
                        var ress = $(con_contract_location_id).getAll();
                        var chest_number_lag = 'N';
                        for (var i = 0;i < ress.length - 1;i++) {
                            if (ress[i].get('chest_number') == value) {
                                chest_number_lag = 'Y';
                            }
            
                        }
                        if (chest_number_lag == 'Y') {
            
                            Leaf.showMessage('提示', '箱号不能重复!');
                            setTimeout(function() {
                                record.set('chest_number', '');
                            }, 500);
                        }
                    }
            
            
                }
            };
            
            //入库存储
            window['${/parameter/@layout_code}_user_button5_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_location');
                var records = $(ds_id).getSelected();
                if (records.length < 1) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '未选择箱子不能入库!');
                    return;
                }
                var prams = [];
                for (var i = 0;i < records.length;i++) {
                    var data = {};
                    data['location_id'] = records[i].get('location_id');
                    data['storage_flag'] = records[i].get('storage_flag');
                    data['_status'] = 'update';
                    prams[i] = data;
                }
                Leaf.request({
                    url: $('con_contract_get_layout_code_link_id').getUrl(),
                    para: prams,
                    success: function() {
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 2000
                        });
                        $(ds_id).query();
                    },
                    failure: function() {
            
                       },
                    error: function() {
            
                       },
                    scope: this
                });
            
            };
            //外运完成
            window['${/parameter/@layout_code}_user_button6_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_location');
                var records = $(ds_id).getSelected();
                if (records.length < 1) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '未选择箱子不能外运!');
                    return;
                }
                var prams = [];
                for (var i = 0;i < records.length;i++) {
                    if (records[0].get('express_out_flag') == 'Y') {
                        Leaf.showMessage('${l:HLS.PROMPT}', '已经外运不能外运!');
                        return;
                    }
                    var data = {};
                    data['location_id'] = records[i].get('location_id');
                    data['_status'] = 'execute';
                    prams[i] = data;
                }
                Leaf.request({
                    url: $('con_contract_get_layout_code_link_id').getUrl(),
                    para: prams,
                    success: function() {
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 2000
                        });
                       	$(ds_id).submit();
                        $(ds_id).query();
                    },
                    failure: function() {
            		
                       },
                    error: function() {
            
                       },
                    scope: this
                });
            
            
            };
             window['${/parameter/@layout_code}_user_button7_layout_dynamic_click'] = function() {

                  var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_location_ln');
                  var records = $(ds_id).getSelected();
                   if (records.length === 0) {
                    Leaf.showMessage('${l:PROMPT}', '请选择至少一条记录');
                    return;}
                // }else if(!check_data(records)){
                    // Leaf.showWarningMessage('提示','仅能打印汇签单列显示为<font color="red">未打印</font>或已打印的数据!');
                    // return ;
                // }
                var instr = '';
                for (var i = 0;i < records.length;i++) {
                    if (i == 0) {
                        instr = instr + records[i].get('con_contract_location_ln');
                    } else {
                        instr = instr + ',' + records[i].get('con_contract_location_ln');
                    }
                }
                var url = $('csh_payment_req_doc_print_link').getUrl() + '?con_contract_location_ln=' + instr;
                window.open(url);
                  };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>