con_contract_attachment.lview 12.9 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author:  nyl
    $Date: 2014-11-27 下午01:58:31  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure>
        <a:model-query defaultWhereClause="t1.specify_code=&apos;PROJECT_DOC_APPROVER&apos;" model="cont.CON543.lsh_hls_specify_define" rootPath="hls_specify_define_info"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con545_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_con545_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_con545_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="con545_batch_dl_link_id" url="${/request/@context_path}/modules/cont/CON505/con_atm_batch_dl.lsc"/>
        <a:link id="con545_submit_link" model="cont.CON543.lsh_con_sign_submit" modelaction="execute"/>
        <a:link id="con545_cdd_update_link" model="cont.CON543.lsh_hls_contract_review_info" modelaction="batch_update"/>
        <a:link id="con545_con_contract_update_print_detail_link_id" url="${/request/@context_path}/modules/cont/CON500/con_contract_update_print_detail.lview"/>
        <a:link id="con545_prj_secify_approver_link" url="${/request/@context_path}/modules/prj/PRJ501N/lsh_hls_specify_approver.lview"/>
        <script type="text/javascript"><![CDATA[
        
  
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                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])) {
                                url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                            }
                        }
                        return url;
            
                    }
                } else if (name == 'attachment') {
                    link_function = '${/parameter/@layout_code}_con545_cdd_attachtment_upload';
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\',\'' + record.ds.id + '\');">' + config_record.get('prompt') + '</a>';
                } else if (name == 'file') {
                    link_function = '${/parameter/@layout_code}_downloadfile_link';
                    var content_id = record.get('content_id');
                    var content_print_flag = record.get('content_print_flag');
                    if (content_id && content_print_flag == 'Y') {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + content_id + '\');">' + config_record.get('prompt') + '</a>';
                    } else {
                        return;
                    }
                }
                 
            };
            
            function unlock_tree_window() {
                window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            }
            
            function lock_tree_window() {
                window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
            }
            
            window['${/parameter/@layout_code}_con545_cdd_attachtment_upload'] = function(id, name, query_only, ds_id) {
                var record = $(ds_id).findById(id);
                if (record.get('check_id')) {
                    var url;
                    if (query_only == 'Y') {
                        url = $('${/parameter/@layout_code}${/parameter/@tree_code}_con545_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                    } else {
                        url = $('${/parameter/@layout_code}${/parameter/@tree_code}_con545_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}', '请先保存!');
                }
            };
            window['${/parameter/@layout_code}_downloadfile_link'] = function(content_id) {
                var url = $('con545_batch_dl_link_id').getUrl() + '?content_id=' + content_id + '&contract_id=' + '${/parameter/@contract_id}';
                window.open(url, '_self');
            };
            
            
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                birturl = '${/request/@context_path}/reports?__report=reports/contract/OTHER_CONTRACT.rptdesign&__format=pdf&contract_id=' + ${/parameter/@contract_id};
                window.open(birturl);
            };
            
            function con545_window_close() {
                $('hls_doc_get_layout_code_winid').close();
            }
            
            window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
                var document_id = ${/parameter/@contract_id};
                var document_table = 'CON_CONTRACT';
                var title = '${/model/hls_specify_define_info/record/@description}';
                var win = new Leaf.Window({
                    id: 'lsh_prj_secify_approver_screen',
                    url: $('con545_prj_secify_approver_link').getUrl(),
                    params: {
                        document_id: document_id,
                        specify_code: 'PROJECT_DOC_APPROVER'
                    },
                    title: title,
                    width: 550,
                    heigh: 650
                });
                win.on('close', function() {
                    ajax_flag = 'Y';
            
                    /* parent.Leaf.SideBar.enable = true;
                     parent.Leaf.SideBar.show({
                     msg: '${l:HLS.SUBMIT_SUCCESS}',
                     duration: 2000
                     }); */
                    Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            
                    Leaf.request({
                        url: $('con545_submit_link').getUrl(),
                        para: {
                            document_id: document_id,
                            document_table: document_table
                        },
                        success: function(res) {
                            Leaf.Masker.unmask(Ext.getBody());
            
            
                            Leaf.showMessage('${l:HLS.PROMPT}', '${l:HLS.SUBMIT_SUCCESS}', function() {
                                con545_window_close();
                            });
            
                        },
                        failure: function() {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        error: function() {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        scope: this
                    });
                });
            };
            
            
            
            function con505_con_contract_content_print() {
                var records = $('con505_contract_result_ds').getSelected();
                if (records.length != 1) {
                    Leaf.showMessage('${l:PROMPT}', '${l:HLS.SELECT_RECORD}');
                    return;
                }
                var record = records[0];
                new Leaf.Window({
                    id: 'con_contract_update_print_detail_winid',
                    params: {
                        contract_id: record.get('contract_id'),
                        document_category: record.get('document_category'),
                        business_type: record.get('business_type'),
                        winid: 'con_contract_update_print_detail_winid'
                    },
                    url: $('con545_con_contract_update_print_detail_link_id').getUrl(),
                    title: '${l:CON505.CON_CONTENT_PRINT}',
                    width: 900,
                    height: 450
                });
            }
            
            //保存前调用
            window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function(ds, record) {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var cdd_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_cdd_item_doc_ref');
                var records = $(cdd_ds).getAll();
                //con545_cdd_update_link
                if ('${/parameter/@layout_code}' == 'CON_CONTEXT_CONFIRM_1') {
                    for (var i = 0;i < records.length;i++) {
            
            
                        var note2 = records[i].get('note2') == undefined ? '' : records[i].get('note2');
            
                        var note = records[i].get('note') == undefined ? '' : records[i].get('note');
            
                        if (note2 == '') {
                            records[i].set('note2', note);
                            records[i].set('note', '');
            
                        }
                        records[i].set('_status', 'update');
                    }
            
                }
                var check_flag = true;
                return check_flag;
            };
            
            
            
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var cdd_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_cdd_item_doc_ref');
                var record = $(ds_id).getAt(0);
                var win = new Leaf.Window({
                    id: 'con_contract_update_print_detail_winid',
                    params: {
                        contract_id: record.get('contract_id'),
                        document_category: record.get('document_category'),
                        business_type: record.get('business_type'),
                        content_type: 'AUDIT',
                        winid: 'con_contract_update_print_detail_winid'
                    },
                    url: $('con545_con_contract_update_print_detail_link_id').getUrl(),
                    title: '${l:CON505.CON_CONTENT_PRINT}',
                    width: 900,
                    height: 450
                });
                win.addListener('close', function() {
                    if (cdd_ds) {
                        $(cdd_ds).query();
                    }
                });
            };
            
        
            
            
            function zjwfl_before_approve_procedure(out_type) {
                var document_id = '${/parameter/@contract_id}';
                var appoint_check = '${/parameter/@appoint_check}';
                var params;
                out_type = 'no_win';
                var out_object = 'out_object';
                if (appoint_check) {
                    var document_table = 'CON_CONTRACT';
                    var title = '${/model/hls_specify_define_info/record/@description}';
                    var win = new Leaf.Window({
                        id: 'lsh_prj_secify_approver_screen',
                        url: $('con545_prj_secify_approver_link').getUrl(),
                        params: {
                            document_id: document_id,
                            specify_code: 'PROJECT_DOC_APPROVER'
                        },
                        title: title,
                        width: 550,
                        heigh: 650
                    });
                    out_type = 'win';
                    out_object = win;
                }
            
                params = {
                    out_type: out_type,
                    out_object: out_object
                };
                return params;
            }
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>