con_contract_anti_incept.lview 5.51 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-8-13 上午10:30:25  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure><![CDATA[

    ]]></a:init-procedure>
    <a:view>
        <a:link id="submit_finish_link" model="cont.CON650.contract_workflow_start" modelaction="batch_update"/>
        <a:link id="car_modify_special_link" url="${/request/@context_path}/modules/prj/PRJ500N/prj_project_create_special.lview"/>
        <a:link id="con_contract_modify_link" url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/>
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
			window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {

                var records = $('CONTRACT_ANTI_INCEPT_G_CONTRACT_RESULT_con_contract_ds').getSelected();
                if (records.length != 1) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '只能选择一条合同进行终止操作!');
                    return;
                }
                var cancel_status = records[0].get('cancel_status');
                if(cancel_status=='APPROVING'){
                    Leaf.showMessage('提示','已提交申请的合同不能重复提交');
                    return;
                }
                var prams = [];
                var data = {};
                var records_reason = $('CONTRACT_ANTI_INCEPT_CANCEL_REASON__ds').getAt(0);
                if (Leaf.isEmpty(records_reason.get('cancel_reason'))) {
                    Leaf.showMessage('提示', '请维护合同终止原因!');
                    return;
                } else if (Leaf.isEmpty(records_reason.get('closed_date'))) {
                    Leaf.showMessage('提示', '请维护合同终止日期!');
                    return;
                }
                data['contract_id'] = records[0].get('contract_id');
                data['cancel_reason'] = records_reason.get('cancel_reason');
                data['closed_date'] = records_reason.get('closed_date');
                data['_status'] = 'update';
                prams[0] = data;
                var detail_mask;
                detail_mask = Ext.getBody();
                Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                Leaf.request({
                    url: $('submit_finish_link').getUrl(),
                    para: prams,
                    success: function() {
                        $('CONTRACT_ANTI_INCEPT_G_CONTRACT_RESULT_con_contract_ds').query();
                        Leaf.Masker.unmask(detail_mask);
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 2000
                        });
                        var record1 = $('CONTRACT_ANTI_INCEPT_CANCEL_REASON__ds').getAt(0);
                        record1.set('closed_date','');
                        record1.set('cancel_reason','');
                    },
                    failure: function() {
            			Leaf.Masker.unmask(detail_mask);
                       },
                    error: function() {
            			Leaf.Masker.unmask(detail_mask);
                       },
                    scope: this
                });
            };   
            
            function open_contract_win(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);
                var param = record.data;
                param['function_code'] = 'CON301';
                /* param['function_usage'] = 'QUERY'; */
                param['maintain_type'] = 'UPDATE';
                param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_modify_link', null);
            }
            
            function open_project_Window(record_id, ds_id) {
                var record = $(ds_id).findById(record_id);
                var param = {};
                param['company_id'] = record.get('company_id');
                param['project_id'] = record.get('project_id');
                param['function_code'] = 'PRJ502D';
                param['function_usage'] = 'QUERY';
                param['bp_class'] = record.get('bp_class');
                param['maintain_type'] = 'QUERY';
               /*  param['window_open_flag'] = 'Y';
                param['show_history_flag'] = 'Y'; */
                param['url_title'] = '${l:HLS.PROJECT_MAITAIN}';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'car_modify_special_link', ds_id, '${/parameter/@layout_code}');
            }
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                if (name == 'contract_number' && value) {
                    return '<a href="javascript:open_contract_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
                }
                if (name == 'project_id_c' && value) {
                    return '<a href="javascript:open_project_Window(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
                }
                return value;
            };
           
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>