con_collection_create_entrance.lview 17.2 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 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2016-12-20 上午11:57:52  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" dynamiccreateenabled="true" trace="true">
    <a:view>
        <a:link id="${/parameter/@layout_code}_prj500_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="${/parameter/@layout_code}_prj500_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="con640_update_con_collection_recived_flag_link_id" model="cont.CON640.con_collection_tool" modelaction="insert"/>
        <a:link id="con640_trans_con_collection_realize_link_id" model="cont.CON640.con_collection_tool" modelaction="update"/>
        <a:link id="con640_trans_con_collection_letter_submit_link_id" model="cont.CON640.con_collection_tool" modelaction="delete"/>
        <a:link id="con640_cob_collection_add_bp_link_id" url="${/request/@context_path}/modules/cont/CON640/con_contract_bp_add.lview"/>
        <a:link id="${/parameter/@layout_code}_car_modify_special_link" url="${/request/@context_path}/modules/prj/PRJ500N/prj_project_create_special_wfl.lview"/>
        <a:link id="${/parameter/@layout_code}_con_collection_call_patter_link_id" url="${/request/@context_path}/modules/cont/CON632/con_collection_call_patter.lview"/>
        <script type="text/javascript"><![CDATA[
        
        
         //保存前调用,前台校验
            window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function(ds, record) {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var ds_id=get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TOOL_INFO', 'con_collection_tool');
               if($(ds_id).validate()){
                  var records=$(ds_id).getAt(0);
                  if(records.get('car_out_day')-records.get('car_storage_day')<0){
                       Leaf.showMessage('${l:PROMPT}','车辆入库日与车辆出库日校验错误!');
                       window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                       return false;
                  }else{
                      window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                       return true;
                  }
               }else{
                   window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                       return false;
               }
            };
        
           //dataset字段跟新事件
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {

                    //收车根据内外控制必输
                    if (name == 'car_storage_day'||name=='car_out_day') {

                       if(!Ext.isEmpty(record.get('car_out_day'))&&!Ext.isEmpty(record.get('car_storage_day'))){
                        if((record.get('car_out_day')-record.get('car_storage_day'))/(60*60*24*1000)<0){    
                            record.set('car_duration_day','');
                             Leaf.showMessage('${l:PROMPT}','车辆入库日与车辆出库日校验错误!');
                             
                        }else{
                            record.set('car_duration_day',(record.get('car_out_day')-record.get('car_storage_day'))/(60*60*24*1000));
                        }
                       }
            
                    }
            
            
            }
            
            //确认收车
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var ds_id=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection');
                Leaf.showConfirm('提示','确认车辆已经收回吗?',function(){
        	        window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
        	        Leaf.request({
		                url: $('con640_update_con_collection_recived_flag_link_id').getUrl(),
		                para: {
		                    col_id :'${/parameter/@col_id}'
		                },
		                success: function(res) {
		                    
		    	            Leaf.SideBar.show({
		    	            	msg:'收车确认成功!',
		    	            	duration:2000
		    	            });
		    	            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                failure:function(){
		                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                error:function(){
		                   window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                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_collection');
                Leaf.showConfirm('提示','确认提交变现吗?',function(){
        	        window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
        	        Leaf.request({
		                url: $('con640_trans_con_collection_realize_link_id').getUrl(),
		                para: {
		                    col_id :'${/parameter/@col_id}',
		                    document_type:'REALIZE',
		                },
		                success: function(res) {
		                    
		    	            Leaf.SideBar.show({
		    	            	msg:'提交成功!',
		    	            	duration:2000
		    	            });
		    	            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                    $('${/parameter/@winid}').close();
		                },
		                failure:function(){
		                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                error:function(){
		                   window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                scope: this
	            	}); 
        	    });
            };
            
             //赎回
            window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function() {
                var ds_id=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection');
                Leaf.showConfirm('提示','确认提交赎回吗?',function(){
        	        window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
        	        Leaf.request({
		                url: $('con640_trans_con_collection_letter_submit_link_id').getUrl(),
		                para: {
		                    col_id :'${/parameter/@col_id}'
		                },
		                success: function(res) {
		                    
		    	            Leaf.SideBar.show({
		    	            	msg:'提交成功!',
		    	            	duration:2000
		    	            });
		    	            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                    $('${/parameter/@winid}').close();
		                },
		                failure:function(){
		                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                error:function(){
		                   window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                scope: this
	            	}); 
        	    });
            };
            
            //诉讼
            window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function() {
                var ds_id=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection');
                Leaf.showConfirm('提示','确认提交诉讼吗?',function(){
        	        window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
        	        Leaf.request({
		                url: $('con640_trans_con_collection_realize_link_id').getUrl(),
		                para: {
		                    col_id :'${/parameter/@col_id}',
		                    document_type:'LAWSUIT',
		                },
		                success: function(res) {
		                    
		    	            Leaf.SideBar.show({
		    	            	msg:'提交成功!',
		    	            	duration:2000
		    	            });
		    	            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                    $('${/parameter/@winid}').close();
		                },
		                failure:function(){
		                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                error:function(){
		                   window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                scope: this
	            	}); 
        	    });
            };
            
            
            //诉讼
            window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function() {
                var ds_id=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection');
                Leaf.showConfirm('提示','确认提交诉讼吗?',function(){
        	        window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
        	        Leaf.request({
		                url: $('con640_trans_con_collection_realize_link_id').getUrl(),
		                para: {
		                    col_id :'${/parameter/@col_id}',
		                    document_type:'LAWSUIT',
		                },
		                success: function(res) {
		                    
		    	            Leaf.SideBar.show({
		    	            	msg:'提交成功!',
		    	            	duration:2000
		    	            });
		    	            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                    $('${/parameter/@winid}').close();
		                },
		                failure:function(){
		                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                error:function(){
		                   window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
		                },
		                scope: this
	            	}); 
        	    });
            };
            
            
             //增加担保
            window['${/parameter/@layout_code}_user_button5_layout_dynamic_click'] = function() {
                var coll_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection');
                var record=$(coll_ds_id).getAt(0);
                param={};
                if('${/parameter/@function_code}'!='CON640D_GUARANTEE_QUERY'){
                param['col_id'] = record.get('col_id');
                param['contract_id'] = record.get('contract_id');
                param['function_code'] = 'CON640D_ADD_BP';
                param['function_usage'] = 'MODIFY';
                param['maintain_type'] = 'UPDATE';
                param['url_title'] = '增加担保';
                param['winid'] = 'con640_con_collection_add_bp_winid';
                }else{
                param['col_id'] = record.get('col_id');
                param['contract_id'] = record.get('contract_id');
                param['function_code'] = 'CON640D_GUARANTEE_ADD_QUERY';
                param['function_usage'] = 'READONLY';
                param['maintain_type'] = 'QUERY';
                param['url_title'] = '增加担保明细';
                param['winid'] = 'con640_con_collection_add_bp_query_winid';    
                }
                hls_doc_get_layout_code('prj_project_get_layout_code_link_id', param, 'con640_cob_collection_add_bp_link_id');
            };
            
            
            
              function open_project_Window(record_id, ds_id) {
                var record = $(ds_id).findById(record_id);
                var maintain_type = 'QUERY';
                var param = {};
                param['company_id'] = record.get('company_id');
                param['project_id'] = record.get('project_id');
                param['function_code'] = 'PRJ502D';
                param['function_usage'] = 'QUERY';
                param['bp_class'] = record.get('bp_class');
                param['maintain_type'] = maintain_type;
                /* param['window_open_flag'] = 'Y';
                 param['show_history_flag'] = 'Y'; */
                param['url_title'] = '${l:HLS.PROJECT_MAITAIN}';
                hls_doc_get_layout_code('prj_project_get_layout_code_link_id', param, '${/parameter/@layout_code}_car_modify_special_link', ds_id, '${/parameter/@layout_code}');
            }
            
               function visit_patter_detail(call_ln_id){
                            var win = new Leaf.Window({
                                id: '${/parameter/@layout_code}_con_collection_call_patter_win_id',
                                url: $('${/parameter/@layout_code}_con_collection_call_patter_link_id').getUrl(),
                                params: {
                                    winid: '${/parameter/@layout_code}_con_collection_call_patter_win_id',
                                    call_ln_id: call_ln_id,
                                    query_flag:'Y'
                                },
                                title: '话术详情',
                                width: 1050,
                                height: 550
                            });                  
          }
            
              //超链接渲染
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
               if (name == 'attachment') {
                    link_function = '${/parameter/@layout_code}_prj500_cdd_attachtment_upload';
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                }else if (name == 'project_number') {
                        return '<a href="javascript:open_project_Window(\'' + record.id + '\',\'' + record.ds.id + '\');">' + value + '</a>';
                    }else if(name=='patter_detail') {
                         link_function='visit_patter_detail';
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.get('call_ln_id') + '\');">话术详情</a>';
                    }
                else if (name == 'attach_file_name') {
                    //附件名称
                    if (value != null) {
                        var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
                        var str = value.split(';;');
                        var url = '';
                        for (var i = 0;i < str.length;i++) {
                            var temp = str[i].split('--');
                            if (!Leaf.isEmpty(temp[0])) {
            
                                var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
                                if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
                                    url = url + '<a ref="img" href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                                } else {
                                    url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                                }
                            }
                        }
                        return url;
                    }
                    
                } 
            };
        
         //附件上传
            window['${/parameter/@layout_code}_prj500_cdd_attachtment_upload'] = function(ds_id, id, name, query_only) {
                var record = $(ds_id).findById(id);
                
                if (record.get('check_id')) {
                    var url;
                    if (query_only == 'Y') {
                        url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                    } else {
                        url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                    }
                    var win = new Leaf.Window({
                        url: url,
                        title: '${l:HLS.SUPPORTING_DOCUMENT}',
                        id: '${/parameter/@layout_code}${/parameter/@tree_code}_prj500_cdd_uploadFile_screen_id',
                        width: 850,
                        height: 400
                    });
            
                    win.on('close', function() {
                        record.ds.query();
                    });
                } else {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
                }
            }; 
   ]]></script>
    </a:view>
</a:screen>