<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:view>
        <a:link id="con1380_query_id" model="cont.CON1380.con1380_result_query_job" modelaction="execute"/>
        <a:link id="query_job" model="cont.CON1380.con1380_result_query_job" modelaction="update"/>
        <script><![CDATA[
        $L.onReady(function(){
            debugger;
            var headers_ds = $('${/parameter/@layout_code}_F_QUERY__ds');
            var record = headers_ds.getCurrentRecord();
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hlcm_monthly_report_temp');
            $(ds_id).setQueryParameter('commission_month',record.get('base_date'));
            $(ds_id).query();
        });

        //更新全量数据
        window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
            debugger;
            var headers_ds = $('${/parameter/@layout_code}_F_QUERY__ds');
            var record = headers_ds.getAt(0);
            if (Ext.isEmpty(record.get('base_date'))) {
                $L.showMessage('提示', '基准日期必输，不能为空');
                return;
            }
            Leaf.showConfirm('${l:HLS.PROMPT}', '<font color="red">该任务需执行约30分钟，请耐心等待！</font></br></br><font color="red">【特别注意】任务发起后30分钟内请勿重复点击</font>', function () {
                Leaf.Masker.mask(Ext.getBody(), '${l:BEING_IMPLEMENTED}');
                Leaf.request({
                    url: $('con1380_query_id').getUrl(),
                    para: {
                        month: record.get('base_date')
                    },
                    success: function (res) {
                        Leaf.Masker.unmask(Ext.getBody());
                        Leaf.SideBar.show({
                            msg: '发起成功！',
                            duration: 2000
                        });
                    },
                    error: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    failure: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
            }, null, 300, 150);
        };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>