con_contract_terminate_enter.lview 7.19 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
  create by nyl  2014-12-3 
  for contract context create
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <!-- <a:link id="con560n_contract_modify_link_id" url="${/request/@context_path}/modules/cont/CON301/con_contract_query_n.lview"/> -->
        <a:link id="con560n_contract_modify_link_id" url="${/request/@context_path}/modules/prj/PRJ506/virtual_contract_query.lview"/>
        <a:link id="con560n_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="con_contract_terminate_link_id" model="cont.CON560.con_contract_terminate" modelaction="batch_update"/>
        <a:link id="${/parameter/@layout_code}_con560_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="${/parameter/@layout_code}_con560_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <script type="text/javascript"><![CDATA[
            function open_contract_win(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);

                var param = record.data;
                
                param['function_code'] = 'CON301R';
                param['function_usage'] = 'QUERY';
                param['maintain_type'] = 'READONLY';
                param['cond_para2'] = record.get('hn_industry_classification');
                param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
                var winid = 'con560n_contract_query_link_id';
                new Leaf.Window({
                    id: winid,
                    params: param,
                    url: $('con560n_contract_modify_link_id').getUrl(),
                    title: param['url_title'] + '(' + 'CONTRACT_QUERY' + ')',
                    fullScreen: true,
                    draggable: true
                });
            
                //  hls_doc_get_layout_code('con560n_contract_get_layout_code_link_id', param, 'con560n_contract_modify_link_id',ds_id);
            }
            
            function virtual_con_link(record_id, name){
                //
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][record_id + '---' + name];
                var head_ds=  get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var param={};
                //var param = record.data;
                param['function_code'] = 'C0N301D_CON';
                param['document_id'] = record.get('project_id');
                param['function_usage'] = 'QUERY';
                param['maintain_type'] = 'READONLY';
                param['cond_para2'] = record.get('hn_industry_classification');
                 param['url_title'] = '合同明细';
                param['winid']='con301_virtual_contract_query_detail_link_id';
                hls_doc_get_layout_code('con560n_contract_get_layout_code_link_id', param, 'con560n_contract_modify_link_id',head_ds);
            }
            
            
            //提交
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
            
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                if (ds_id) {
                    var records = $(ds_id).getSelected();
                    if (!records.length) {
                        Leaf.showMessage('${l:PROMPT}', '请至少选择一条记录');
                        return;
                    }
                    var TerminateData = [];
                    for (var i = 0;i < records.length;i++) {
                        var data = {};
                        data['contract_id'] = records[i].get('contract_id');
                        data['_status'] = 'update';
                        TerminateData.push(data);
            
                    }
            
                    Leaf.showConfirm('${l:PROMPT}', '确认要结束?', function() {
            
                        Leaf.request({
                            url: $('con_contract_terminate_link_id').getUrl(),
                            para: TerminateData,
                            success: function() {
                                Leaf.SideBar.show({
                                    msg: '操作成功',
                                    duration: 2000
                                });
                                $(ds_id).query();
                            },
                            scope: this
                        });
                    }, function() {
                        return;
                    }, null, null);
                }
            };
            
            function upload_attachment(ds_id, record_id) {
            		return;
               }
            
            window['${/parameter/@layout_code}_con560_attachtment_upload'] = function(id, dsid, name, query_only) {
                var record = $(dsid).findById(id);
                if (record.get('contract_id')) {
                    var url;
                    if (query_only == 'Y') {
                        url = $('${/parameter/@layout_code}_con560_downloadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('contract_id');
                    } else {
                        url = $('${/parameter/@layout_code}_con560_uploadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('contract_id');
                    }
                    var win = new Leaf.Window({
                        url: url,
                        title: '${l:HLS.SUPPORTING_DOCUMENT}',
                        id: '${/parameter/@layout_code}_con560_uploadFile_screen_id',
                        width: 850,
                        height: 400
                    });
            
                    win.on('close', function() {
                        record.ds.query();
                    });
                }
            };
            
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
            	var link_function = '';
                window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
                if(name==='contract_number'){
                    link_function = 'virtual_con_link';
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + value + '</a>';
                    
                } 
                else if (name == 'attachment_upload') {  //add by zhangyu 2015-12-13 for guotou
                    link_function = '${/parameter/@layout_code}_con560_attachtment_upload';
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.ds.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                }
            
                return value;
            };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>