role_index.lview 5.17 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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: lrd
    $Date: 2018/06/04 11:33
    $Revision: 1.0
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true" xmlns:p="uncertain.proc">
    <a:init-procedure>
        <a:model-query defaultWhereClause="role_id=${/parameter/@role_id}" model="sys.sys_role_home_page" rootPath="sys_role_home_page_path"/>
        <s:server-script><![CDATA[
            function newMap(name) {
                return new CompositeMap("a",'http://www.leaf-framework.org/application', name);
            }
            var config = $config();
            var div = CompositeUtil.findChild(config, 'div','class','hap_widget_main_screen');
            var sys_role_home_page_path = $ctx.get('/model/sys_role_home_page_path').getChildren();

            for(var i = 0;i < sys_role_home_page_path.length;i++){
                var record = sys_role_home_page_path[i];

                var att = record.content;
                var attArr = att.match(/left:([\S]+);top:([\S]+);/);

                var s = newMap('screen-include');
                s.screen = record.service_name;

                var componentDiv = div.createChild("div");
                componentDiv.put("class", "hap_widget_tab_screen_component hap_widget_tab_screen_shadow");
                componentDiv.put("style", "left:"+attArr[1]+";top:"+attArr[2]+";");
                componentDiv.put("data-function_code",record.function_code);

                var closeDiv = componentDiv.createChild("div");
                closeDiv.setText("X");
                closeDiv.put("class","hap_widget_tab_screen_component_close");

                var contentDiv = componentDiv.createChild("div");
                contentDiv.put("class" , "hap_widget_tab_screen_component_content");
                contentDiv.addChild(s.getData());

                var layerDiv = componentDiv.createChild("div");
                layerDiv.put("class","hap_widget_tab_screen_component_layer");



            }
            ]]></s:server-script>
    </a:init-procedure>
    <a:view>
        <link href="${/request/@context_path}/css/home_widget/home_widget.css" rel="stylesheet" type="text/css"/>
        <script src="${/request/@context_path}/javascripts/home_widget/home_widget.js" type="text/javascript"/>

        <script type="text/javascript"><![CDATA[
        var context_path = "${/request/@context_path}/";
        $L.onReady(function(){
            ready();
        });
        function roleIndexFunctionDsQuery(ds,para){
            para['role'] = '1';
        }
        function sysRoleHomePageDsQuery(ds, para){
            para['role_id'] = '${/parameter/@role_id}';
        }
        function roleIndexFunctionDsLoad(ds){
            ready();
        }
        function sysRoleHomePageDsLoad(ds){
            ready();
        }
        var sys_role_home_page_model = 0;
        function ready(){
            sys_role_home_page_model++;
            if(sys_role_home_page_model == 3) {
                hapWidget = jQuery("#content").hapWidget({
                    tabData: $("roleIndexFunctionDs"),
                    screenData: $("sysRoleHomePageDs"),
                    screenType: "role",
                    context_path: context_path
                });
            }
        }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="roleIndexFunctionDs"  model="sys.sys_role_widget" autoQuery="true" fetchAll="true" selectable="true">
                <a:fields>
                    <a:field name="role_id" defaultValue="${/parameter/@role_id}"/>
                    <a:field name="function_code" autoComplete="true" lovGridHeight="300" lovHeight="450" lovLabelWidth="100" lovService="sys.SYS860.sys_function_lov" lovWidth="600" title="功能选择">
                        <a:mapping>
                            <a:map from="function_code" to="function_code"/>
                            <a:map from="function_name" to="function_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="query" handler="roleIndexFunctionDsQuery"/>
                    <a:event name="load" handler="roleIndexFunctionDsLoad"/>
                </a:events>
            </a:dataSet>

            <a:dataSet id="sysRoleHomePageDs" model="sys.sys_role_home_page" autoQuery="true" fetchAll="true" selectable="true">
                <a:fields>
                    <a:field name="home_page_id"/>
                    <a:field name="role_id" defaultValue="${/parameter/@role_id}"/>
                    <a:field name="content"/>
                </a:fields>
                <a:events>
                    <a:event name="query" handler="sysRoleHomePageDsQuery"/>
                    <a:event name="load" handler="sysRoleHomePageDsLoad"/>
                </a:events>
            </a:dataSet>



        </a:dataSets>

        <div id="content">
            <div class="hap_widget_float_window"></div>
            <div class="hap_widget_tab_screen"></div>
            <div class="hap_widget_main_screen"></div>
        </div>

    </a:view>

</a:screen>