<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand  
    $Date: 2013-1-10 下午04:23:36  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <script type="text/javascript"><![CDATA[
        
        	function reload(){
            	$('hls_pawn_upload_ds').query();
            }
            function url_link(pkvalue) {
                var url = '${/request/@context_path}/hls_upload_for_attachment_view.lview?sourcetype=hls_pawn_upload&pkvalue=' + pkvalue;
                wd = new Leaf.Window({
                    id: 'attachment_up_window',
                    url: url,
                    title: '附件上传',
                    height: 350,
                    width: 850
                });
            }
             function submitMSG() {
                            alert('submitMSG');
            }
                        function attachmentLink(value, record, name) {
                //var pkvalue = record.get('cus_upload_id');
                //var url = '<img src="../../images/upload.png" alt="附件上传" onclick="url_link('+pkvalue+')"/>&nbsp;&nbsp;&nbsp;';
            
                if (typeof(value) == 'undefined' && Ext.isEmpty(value)) {
                    //return url;
                    return '';
                } else {
                    //return url + value;
                    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])) {
                            url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                        }
                    }
                    return url;
                }
            }
            
            function attachmentUpload(value, record, name) {
                var p_pkvalue = record.get('pawn_upload_id');
            
                return "<A href='javascript:url_link(" + p_pkvalue + ")'>附件上传</A>";
            }
]]></script>
        <a:dataSets>
            <a:dataSet id="hls_pawn_upload_ds" autoQuery="true" fetchAll="true" queryUrl="${/request/@context_path}/autocrud/hls.HLS209.hls_pawn_upload/query?pawn_id=${/parameter/@pawn_id}&amp;ORDER_FIELD=file_code">
                <a:fields>
                    <a:field name="submit_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="submitMSG"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form title="附件信息" width="990">
                <a:grid id="grid_id" bindTarget="hls_pawn_upload_ds" height="300" model="hls_fnd.hls_pawn_upload" queryUrl="${/request/@context_path}/autocrud/hls_fnd.hls_pawn_upload/query?pawn_id=${/parameter/@pawn_id}&amp;_queryorderby=file_code asc" style="margin-left:42px" width="900">
                    <a:columns>
                        <a:column name="file_name" prompt="文件类型" width="320"/>
                        <a:column name="pawn_upload_id" align="center" prompt="附件上传" renderer="attachmentUpload" width="80"/>
                        <a:column name="atm_file" prompt="HLS_CUSTOMER_UPLOAD.UPLOADFILE" renderer="attachmentLink" width="382"/>
                    </a:columns>
                    <a:editors>
                        <a:checkBox id="file_checkBok"/>
                    </a:editors>
                </a:grid>
                <a:form labelWidth="100" style="margin-left:42px" title="其他附件上传" width="900">
                    <a:upload buttonWidth="75" deleteUrl="" fileType="*.*" pkvalue="${/parameter/@pawn_id}" sourcetype="hls_pawn" text="上传文件"/>
                </a:form>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>