ins_insurance_dym_print.lview 10.5 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hp  
    $Date: 2014-9-28 下午2:02:27  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:c="leaf.application.action" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
    <a:init-procedure>
        <a:model-query autocount="false" defaultWhereClause="t1.template_class =${/parameter/@template_class} and t1.insure_class=${/parameter/@insure_class}" fetchall="true" model="ins.INS505.ins_insurance_content" rootpath="insurance_content"/>
    </a:init-procedure>
    <a:view>
        <a:link id="ins_print_doc_link_id" url="${/request/@context_path}/modules/ins/INS500/ins_insurance_print_word.lview"/>
        <a:link id="ins_print_pdf_link_id" url="${/request/@context_path}/modules/ins/INS500/ins_insurance_print_pdf.lview"/>
        <a:link id="ins_save_print_information_link_id" model="ins.INS505.ins_insurance_content" modelaction="execute"/>
        <a:link id="ins_batch_dl_link_id" url="${/request/@context_path}/modules/ins/INS505/ins_atm_batch_dl.lsc"/>
        <script type="text/javascript"><![CDATA[
            // alert(${/parameter/@project_lease_item_id});
            
            function lock_current_window() {
                var detail_mask;
                if ('${/parameter/@winid}') {
                    if (parent.$L.CmpManager.get('${/parameter/@winid}')) {
                        detail_mask = parent.$('${/parameter/@winid}').wrap;
                        parent.Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                    } else {
                        detail_mask = $('${/parameter/@winid}').wrap;
                        Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                    }
                } else {
                    detail_mask = Ext.getBody();
                    Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                }
                //  Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            }
            
            function unlock_current_window() {
                var detail_mask;
                if ('${/parameter/@winid}') {
                    if (parent.$L.CmpManager.get('${/parameter/@winid}')) {
                        detail_mask = parent.$('${/parameter/@winid}').wrap;
                        parent.Leaf.Masker.unmask(detail_mask);
                    } else {
                        detail_mask = $('${/parameter/@winid}').wrap;
                        Leaf.Masker.unmask(detail_mask);
                    }
                } else {
                    detail_mask = Ext.getBody();
                    Leaf.Masker.unmask(detail_mask);
                }
                if (Ext.get(document.documentElement)) {
                    $L.Masker.unmask(Ext.get(document.documentElement));
                }
                // Leaf.Masker.unmask(Ext.getBody());
            }
            
            function ins505_close() {
                $('ins_insurance_dym_print_winid').close();
            }
            
            
            function download(ins_name) {
                var path = 'E:/u01/' + ins_name + '.doc';
                var url_l = $('ins_batch_dl_link_id').getUrl() + '?path=' + path;
                window.open(url_l, '_self');
            }
            
            function ins_print_detail_print(content_id, template_file) {
                lock_current_window();
                var templt_name = template_file;
                var ins_name = '${/parameter/@bp_id_tenant_n}${/parameter/@machine_number}';
                if ('${/parameter/@insure_class}' == 'PPD') {
                    ins_name = '${/parameter/@bp_id_tenant_n}${/parameter/@machine_number}';
                } else {
                    ins_name = '${/parameter/@bp_id_tenant_n}${/parameter/@contract_number}';
                }
                // var file_path = 'E:\\u01\\pdf_word\\';
            
                var file_path = 'D:\\u01\\pdf_word\\';
                var type = '${/parameter/@type}';
                var url_l = 'ins_print_doc_link_id';
            
                Leaf.request({
                    url: $('ins_save_print_information_link_id').getUrl(),
                    para: {
                        content_id: content_id,
                        file_path: file_path,
                        file_name: ins_name,
                        type: type
                    },
                    success: function() {
            
                        //var file_path = 'D:/project/attachment/INS/';
                        if (type == 'pdf') {
                            url_l = 'ins_print_pdf_link_id';
                        } else {
                            url_l = 'ins_print_doc_link_id';
                        }
                        var url = $(url_l).getUrl() + '?templt_name=' + templt_name + '&file_path=' + file_path + '&project_id=' + '${/parameter/@project_id}' + '&ins_name=' + ins_name + '&project_lease_item_id=${/parameter/@project_lease_item_id}' + '&policy_id=${/parameter/@policy_id}&contract_id=${/parameter/@contract_id}';
                        var form = document.createElement("form");
                        form.target = "word_export_window";
                        form.method = "post";
                        form.action = url;
                        var iframe = Ext.get('word_export_window') || new Ext.Template('<iframe id ="word_export_window" name="word_export_window" style="position:absolute;left:-10000px;top:-10000px;width:1px;height:1px;display:none"></iframe>').insertFirst(document.body, {}, true);
                        document.body.appendChild(form);
                        form.submit();
                        Ext.fly(form).remove();
            
                        unlock_current_window();
                    },
                    failure: function() {
                        unlock_current_window();
                    },
                    error: function() {
                        unlock_current_window();
                    },
                    scope: this
                });
            
            }
            
            function print(btn, e) {
            
                var template_file = btn.value;
                var content_id = btn.binder.name;
                var type = template_file.substr(template_file.length - 3, 3);
                if (type == 'xml' || type == 'XML') {
                    ins_print_detail_print(content_id, template_file);
                    //$('ins_form_query_ds').set('content_id',content_id);
                    $('ins_form_ds').setQueryParameter('content_id', content_id);
                    $('ins_form_ds').query();
                } else {
                    var url = 'http://199.10.10.65:8180/reportapp/frameset?__report=reports/policy/' + template_file + '&&__format=PDF';
                    var url_param = '&&project_id=${/parameter/@project_id}';
                    window.open(url + url_param);
            
                }
            
            }
            
            function ins_download(content_id) {
                var url_l = $('ins_batch_dl_link_id').getUrl() + '?content_id=' + content_id;
                window.open(url_l, '_self');
            }
            
            function download_render(value, record, name) {
                return '<a href="javascript:ins_download(' + record.get('content_id') + ')">' + value + '</a>';
            }
            
            function onmouseover(th, e) {
            
               }
            
            function onmouseout(th, e) {
            
               }
        ]]></script>
        <style><![CDATA[
			.leftmenu {
        color: #4C4C4C
}
		]]></style>
        <a:dataSets>
            <a:dataSet id="bp_master_com_form_ds" autoCreate="true">
                <a:fields>
                    <a:placeHolder id="dynamicLineFields"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="ins_form_query_ds">
                <a:fields>
                    <a:field name="content_print_flag" defaultValue="Y"/>
                    <!--    <a:field name="template_class" defaultValue="ENDORSEMENT"/> -->
                </a:fields>
            </a:dataSet>
            <a:dataSet id="ins_form_ds" model="ins.INS505.ins_insurance_content" queryDataSet="ins_form_query_ds"><![CDATA[
            ]]></a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="ins505_close" text="关闭"/>
            </a:screenTopToolbar>
            <a:fieldSet title="模板" width="625">
                <a:form column="3" labelWidth="180" width="600">
                    <a:placeHolder id="dynamicLineclomns"/>
                </a:form>
            </a:fieldSet>
            <a:fieldSet title="文件" width="610">
                <a:grid bindTarget="ins_form_ds" height="30" width="615">
                    <a:columns>
                        <a:column name="file_name" prompt="文件名" renderer="download_render" width="200"/>
                    </a:columns>
                </a:grid>
            </a:fieldSet>
        </a:screenBody>
    </a:view>
    <a:view-config>
        <c:create-config targetId="dynamicLineclomns">
            <p:loop nullable="true" source="/model/insurance_content">
                <c:process-config>
                    <a:box width="200">
                        <!-- <a href="javascript:print(&apos;CON310&apos;,&apos;PAYING&apos;)">
                       aaa
                    </a> -->
                        <a:button name="${@content_id}" bindTarget="bp_master_com_form_ds" className="leftmenu" click="print" height="80" text="${@template_desc}" width="150">
                            <!--   <a:events>
                           <a:event name="mouseover" handler="onmouseover"   />
                           <a:event name="mouseout" handler="onmouseout"   />
                          </a:events> --><![CDATA[
                            
                            
                            
                            
                            
                        
                        ]]></a:button>
                    </a:box>
                </c:process-config>
            </p:loop>
        </c:create-config>
        <c:create-config targetId="dynamicLineFields">
            <p:loop nullable="true" source="/model/insurance_content">
                <c:process-config>
                    <a:field name="${@content_id}" defaultValue="${@template_file}"/>
                </c:process-config>
            </p:loop>
        </c:create-config>
    </a:view-config>
</a:screen>