<?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:model-query defaultWhereClause="t1.specify_code=&apos;CON_GPS_APPROVER&apos;" model="cont.CON543.cus_hls_specify_define" rootPath="hls_specify_define_info"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con638_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="con625_prj_secify_approver_link" url="${/request/@context_path}/modules/prj/PRJ501N/cus_hls_specify_approver.lview"/>
        <script type="text/javascript"><![CDATA[
            //导出
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
            
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var grid_id = ds_id.replace('ds', 'layout_grid_id');
                $(grid_id)._export('xls', '${/model/default_function_name/record/@function_name}');
            
            
            };
            window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'cus_con_contract_gps');
            
                var record = $(ds_id).getCurrentRecord();
                var gps_service_id = record.get('gps_service_id');
                var contract_id = record.get('contract_id');
                if ($(ds_id).validate() && !record.dirty) {
                    var document_id = gps_service_id;
                    var document_table = 'CUS_CON_CONTRACT_GPS';
                    var title = '${/model/hls_specify_define_info/record/@description}';
                    var win = new Leaf.Window({
                        id: 'cus_prj_secify_approver_screen',
                        url: $('con625_prj_secify_approver_link').getUrl(),
                        params: {
                            document_id: document_id,
                            specify_code: 'CON_GPS_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.request({
                            url: '${/request/@context_path}/autocrud/cus.CUS100.cus_con_gps_service_submit/update',
                            para: {
                                gps_service_id: gps_service_id,
                                contract_id: contract_id
                            },
                            success: function(res) {
                                Leaf.Masker.unmask(Ext.getBody());
                                parent.Leaf.SideBar.enable = true;
                                parent.Leaf.SideBar.show({
                                    msg: '${l:HLS.SUBMIT_SUCCESS}',
                                    duration: 2000
                                });
                                //history.go(-1);
                                $('${/parameter/@winid}').close();
                            },
                            scope: this
                        });
                    });
                } else {
                    Leaf.showMessage('提示', '请先保存再提交审批!', null, 350);
                }
            };
            
            //提交审批
            /*       window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
             var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'cus_con_contract_gps');
             var record = $(ds_id).getCurrentRecord();
             var gps_service_id = record.get('gps_service_id');
             var contract_id = record.get('contract_id');
             if (record.dirty != true) {
             Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
             Leaf.request({
             url: '${/request/@context_path}/autocrud/cus.CUS100.cus_con_gps_service_submit/update',
             para: {
             gps_service_id: gps_service_id,
             contract_id: contract_id
             },
             success: function(res) {
             Leaf.Masker.unmask(Ext.getBody());
             parent.Leaf.SideBar.enable = true;
             parent.Leaf.SideBar.show({
             msg: '${l:HLS.SUBMIT_SUCCESS}',
             duration: 2000
             });
             //history.go(-1);
             $('${/parameter/@winid}').close();
             },
             scope: this
             });
             } else {
             Leaf.showMessage('提示', '请先保存再提交审批!', null, 350);
             }
             }; */
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>