sys_tmp_query.lview 6.54 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2014-10-28 上午11:11:15  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
    <a:init-procedure>
        <s:server-script import="contract_print_path.js"><![CDATA[
            $ctx.parameter.file_path = con_print_path['con_print_path'];
            $ctx.parameter.tomcat_source = con_print_path['tomcat_source'];
        ]]></s:server-script>
    </a:init-procedure>
    <a:view package="leaf.ui.std" template="default">
        <div/>
        <a:link id="rsc_rick_mon_upload_link" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="view_pdf_id" url="${/request/@context_path}/modules/view_pdf.lview"/>
        <script type="text/javascript"><![CDATA[
            function mon_upload_win(table_name, table_pk_value) {
                var url = $('rsc_rick_mon_upload_link').getUrl() + '?table_name=' + table_name + '&header_id=' + table_pk_value;
                new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'rsc_risk_mon_report_win',
                    width: 850,
                    height: 400
                });
            
            }
            
            function upload_renderer(value, record, name) {
                return '<a href="javascript:mon_upload_win(\'' + 'HLS_ATTACHMENT_MODULE' + '\',' + record.get('attachment_module_id') + ');">' + '附件上传/下载' + '</a>';
            }
            
            function bpQueryScreen_query() {
                $('upload_ds').query();
            }
            
            function bpQueryScreen_back() {
                history.go(-1);
            }
            
            window['file_name_link_render'] = function(value, record, name) {
                if (name == 'pdf_attachment_id' && value != null) {
                    if (value != null) {
                        var url = '<a href=javascript:view_pdf(\'' + value + '\')>PDF预览</a>';
                    }
                    return url;
                } else if (name != 'pdf_attachment_id' && value != null) {
                    var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
                    var str = value.split(';;');
                    var file_name;
                    url = '';
                    for (var i = 0;i < str.length;i++) {
                        var temp = str[i].split('--');
                        if (!Leaf.isEmpty(temp[0])) {
                            file_name = temp[0].toUpperCase();
                            if (file_name.indexOf('.PDF') >= 0) {
                                url = url + '<a style="color:red" href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>';
                            } else {
                                url = url + '<a style="color:red" href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ',';
                            }
                        }
                    }
                    return url;
                }
            };
            
            function view_pdf(attachment_id) {
                // new Leaf.Window({
                // params: {
                // attachment_id: attachment_id,
                // num : 3
                // },
                // url: $('view_pdf_id').getUrl(),
                // id: 'view_pdf1_id',
                // title: '${l:PRJ501.PRJ_HISTORY_VERSION}',
                // fullScreen: true
                // });
                Leaf.request({
                    url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query',
                    para: {
                        attachment_id: attachment_id
                    },
                    success: function(res) {
                        var path = res.result.record.file_path;
                        path = path.substr(path.indexOf('hls_attachment'));
                        var tomcat_source = '${/parameter/@tomcat_source}';
                        var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path;
                        var oWin = window.open(source_path);
            
                    },
                    scope: this
                });
            }
            
            // function view_pdf(attachment_id) {
            // Leaf.request({
            // url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query',
            // para: {
            // attachment_id: attachment_id
            // },
            // success: function(res) {
            // var path = res.result.record.file_path;
            // path = path.substr(path.indexOf('hls_attachment'));
            // var tomcat_source = '${/parameter/@tomcat_source}';
            // var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path;
            // var oWin = window.open(source_path);
            
            // },
            // scope: this
            // });
            
            // }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="para_bpQueryDs" autoCreate="true"><![CDATA[
             	
             ]]></a:dataSet>
            <a:dataSet id="upload_ds" autoQuery="true" fetchAll="true" model="sys.SYS120.hls_attachment_module" queryDataSet="para_bpQueryDs"><![CDATA[
            ]]></a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="bpQueryScreen_back" text="后退"/>
                <a:gridButton click="bpQueryScreen_query" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:form column="2" labelWidth="120" title="模板查询" width="600">
                <a:textField name="description" bindTarget="para_bpQueryDs" prompt="模板名称"/>
            </a:form>
            <a:grid id="mon_grid_id" bindTarget="upload_ds" marginHeight="200" marginWidth="200" navBar="true" width="600">
                <a:columns>
                    <a:column name="description" prompt="模板名称" width="200"/>
                    <a:column name="upload" align="center" prompt="附件上传/下载" renderer="upload_renderer"/>
                    <a:column name="file_name" align="left" prompt="附件名称" renderer="file_name_link_render" width="880"/>
                </a:columns>
                <a:editors>
                    <a:textField id="mon_tf"/>
                    <a:checkBox id="mon_cb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>