<?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 lov_query() {
                var bp_customer_industry_list_details; //INDUSTRY
                var bp_customer_position_list_details; //customer_position
                var bp_release_form_list_details; //RELEASE_FORM
                try {
                    var bp_customer_industry_list_bm = $bm('app.lov.app_bp_industry_list');
                    var bp_customer_position_list_bm = $bm('app.lov.app_bp_customer_position_list');
                    var bp_release_form_list_bm = $bm('app.lov.app_bp_release_form_list');
            
                    var bp_customer_industry_list_map = bp_customer_industry_list_bm.queryAsMap();
                    var bp_customer_position_list_map = bp_customer_position_list_bm.queryAsMap();
                    var bp_release_form_list_map = bp_release_form_list_bm.queryAsMap();
            
                    bp_customer_industry_list_details = bp_customer_industry_list_map.getChildren();
                    bp_customer_position_list_details = bp_customer_position_list_map.getChildren();
                    bp_release_form_list_details = bp_release_form_list_map.getChildren();
            
                    $ctx.parameter.return_status = 'S';
                    $ctx.parameter.return_message = '执行成功';
                } catch (e) {
                    $ctx.parameter.return_status = 'E';
                    $ctx.parameter.return_message = String(e);
                }
            
            
                var result = {
                    result: $ctx.parameter.return_status,
                    message: $ctx.parameter.return_message,
                    bp_customer_industry_list: [],
                    bp_customer_position_list: [],
                    bp_release_form_list: []
                };
                var bp_customer_industry_list = result.bp_customer_industry_list;
                var bp_customer_position_list = result.bp_customer_position_list;
                var bp_release_form_list = result.bp_release_form_list;
            
                if (bp_customer_industry_list_details) {
                    for (var i = 0;i < bp_customer_industry_list_details.length;i++) {
                        var bp_customer_industry_list_detail = bp_customer_industry_list_details[i];
                        bp_customer_industry_list.push({
                            "code": bp_customer_industry_list_detail.code,
                            "name": bp_customer_industry_list_detail.name
                        });
                    }
                }
                if (bp_customer_position_list_details) {
                    for (var i = 0;i < bp_customer_position_list_details.length;i++) {
                        var bp_customer_position_list_detail = bp_customer_position_list_details[i];
                        bp_customer_position_list.push({
                            "code": bp_customer_position_list_detail.code,
                            "name": bp_customer_position_list_detail.name
                        });
                    }
                }
                if (bp_release_form_list_details) {
                    for (var i = 0;i < bp_release_form_list_details.length;i++) {
                        var bp_release_form_list_detail = bp_release_form_list_details[i];
                        bp_release_form_list.push({
                            "code": bp_release_form_list_detail.code,
                            "name": bp_release_form_list_detail.name
                        });
                    }
                }
            
            
                $ctx.parameter.json = JSON.stringify(result);
            }
            
             if ($ctx.parameter.return_status != 'E'&& $ctx.parameter.return_status != 'TIMEOUT') {
                lov_query();
            }
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>
