chart_main_page.lsc 5.57 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
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:ns1="leaf.application.action" xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
    <a:init-procedure>
        <s:server-script import="app/app_login_check.js"><![CDATA[
            function main_chart_query() {
                var project_apply_list_details;
                var contract_chart_list_details;
                var put_chart_list_details;
                try {
                    //租赁申请报表
                    var project_apply_bm= $bm('app.chart.main_project_chart');
                    var project_apply_list_map = project_apply_bm.queryAsMap({
                        user_id:$ctx.parameter.user_id
                    });
                    project_apply_list_details = project_apply_list_map.getChildren();
                    	
                    //合同报表
                    var contract_chart_bm= $bm('app.chart.main_contract_chart');
                    var contract_chart_list_map = contract_chart_bm.queryAsMap({
                        user_id:$ctx.parameter.user_id
                    });
                    contract_chart_list_details = contract_chart_list_map.getChildren();
                    
                    //投放报表
                    var put_chart_bm= $bm('app.chart.main_put_chart');
                    var put_chart_list_map = put_chart_bm.queryAsMap({
                        user_id:$ctx.parameter.user_id
                    });
                    put_chart_list_details = put_chart_list_map.getChildren();
                    $ctx.parameter.return_status = 'S';
                    $ctx.parameter.return_message = '执行成功';
                } catch (e) {
                    $ctx.success = "true";
                    $ctx.parameter.return_status = 'E';
                    $ctx.parameter.return_message = String(e);
                }
            
                var result = {
                    result: $ctx.parameter.return_status,
                    message: $ctx.parameter.return_message,
                    project_apply:[],
                    contract_chart:[],
                    put_chart:[]
                };
                //租赁申请报表
                var project_apply = result.project_apply;
                if (project_apply_list_details) {
                    for (var i = 0;i < project_apply_list_details.length;i++) {
                        var project_apply_list_detail = project_apply_list_details[i];
                        project_apply.push({
                            "apply_count": project_apply_list_detail.apply_count,
                            "new_count": project_apply_list_detail.new_count,
                            "approving_count": project_apply_list_detail.approving_count,
                            "approved_count": project_apply_list_detail.approved_count,
                            "reject_count": project_apply_list_detail.reject_count,
                            "month_new_add": project_apply_list_detail.month_new_add
                        });
                    }
                }
                //合同报表
                var contract_chart = result.contract_chart;
                if (contract_chart_list_details) {
                    for (var i = 0;i < contract_chart_list_details.length;i++) {
                        var contract_chart_list_detail = contract_chart_list_details[i];
                        contract_chart.push({
                            "other_count": contract_chart_list_detail.other_count,
                            "new_count": contract_chart_list_detail.new_count,
                            "sign_count": contract_chart_list_detail.sign_count,
                            "incept_count": contract_chart_list_detail.incept_count,
                            "overdue_count": contract_chart_list_detail.overdue_count
                        });
                    }
                }
                 //投放报表
                var put_chart = result.put_chart;
                if (put_chart_list_details) {
                    for (var i = 0;i < put_chart_list_details.length;i++) {
                        var put_chart_list_detail = put_chart_list_details[i];
                        put_chart.push({
                            "year_count": put_chart_list_detail.year_count,
                            "jan_count": put_chart_list_detail.jan_count,
                            "feb_count": put_chart_list_detail.feb_count,
                            "mar_count": put_chart_list_detail.mar_count,
                            "apr_count": put_chart_list_detail.apr_count,
                            "may_count": put_chart_list_detail.may_count,
                            "jun_count": put_chart_list_detail.jun_count,
                            "jul_count": put_chart_list_detail.jul_count,
                            "aug_count": put_chart_list_detail.aug_count,
                            "sep_count": put_chart_list_detail.sep_count,
                            "oct_count": put_chart_list_detail.oct_count,
                            "nov_count": put_chart_list_detail.nov_count,
                            "dec_count": put_chart_list_detail.dec_count
                        });
                    }
                }
                $ctx.parameter.json = JSON.stringify(result);
            }
            if ($ctx.parameter.return_status != 'E'&& $ctx.parameter.return_status != 'TIMEOUT') {
                main_chart_query();
            }
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>