<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Icon  
    $Date: 2014-10-15 上午11:22:08  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="violation_attachment_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <script type="text/javascript"><![CDATA[
        function receipt_attachment_upload(val,rec,name){
    	   return '<a href=javascript:open_upload_window('+rec.get('violation_id')+')>附件上传</a>';
    	}
        	
		function open_upload_window(record_id){
		    	if(Leaf.isEmpty(record_id)) {
		    	    Leaf.showMessage('提示','请先保存再上传附件!');
		    	    return;
		    	}
        	    var url = $('violation_attachment_uploadFile_id').getUrl() + '?table_name=AST_CAR_VIOLATION&header_id=' + record_id;
                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'violation_uploadFile_id',
                    width: 850,
                    height: 400
                });
                win.on('close', function() {
                });
        }
        
        function inspectionSubmitsuccess(ds) {
            ds.query();
        }
		]]></script>
        <a:dataSets>
            <a:dataSet id="ast_car_violation_result_ds" model="ast.AST509.ast_car_violation" selectable="true">
                <a:fields>
                    <a:field name="violation_id"/>
                    <a:field name="item_detail_id"/>
                    <a:field name="violation_date"/>
                    <a:field name="violation_address"/>
                    <a:field name="deal_methods"/>
                    <a:field name="handle_result"/>
                    <a:field name="description"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="inspectionSubmitsuccess"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:grid id="ast_car_violation_grid_id" bindTarget="ast_car_violation_result_ds" height="210" marginWidth="30" navBar="true">
            <a:toolBar>
                <a:button type="add"/>
                <a:button type="delete"/>
            </a:toolBar>
            <a:columns>
                <a:column name="violation_date" editor="ast_car_violation_dp" prompt="违章时间" renderer="Leaf.formatDate" width="100"/>
                <a:column name="violation_address" editor="ast_car_violation_tf" prompt="违章地点" width="200"/>
                <a:column name="deal_methods" editor="ast_car_violation_tf" prompt="处理方式" width="100"/>
                <a:column name="handle_result" align="right" editor="ast_car_violation_tf" prompt="处理结果" width="100"/>
                <a:column name="description" editor="ast_car_violation_tf" prompt="描述" width="284"/>
                <a:column align="center" prompt="附件上传" renderer="receipt_attachment_upload" width="80"/>
            </a:columns>
            <a:editors>
                <a:textField id="ast_car_violation_tf"/>
                <a:datePicker id="ast_car_violation_dp"/>
            </a:editors>
        </a:grid>
        <a:hBox/>
    </a:view>
</a:screen>