<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="dynamic_header_create_url" url="${/request/@context_path}/modules/sys/SYS1090/sys_dynamic_create.lview"/>
        <a:link id="dynamic_header_edit_url" url="${/request/@context_path}/modules/sys/SYS1090/sys_dynamic_edit.lview"/>
        <a:link id="dynamic_header_maintain_url" url="${/request/@context_path}/modules/sys/SYS1090/sys_dynamic_maintain.lview"/>
        <script type="text/javascript"><![CDATA[
            
            function openDynamicCreateWindow(){
                new Leaf.Window({
                    url:$('dynamic_header_create_url').getUrl(),
                    title:'动态配置',
                    id:'dynamic_create_window',
                    width:600,
                    height:200
                });
            }
            
            function openDimensionDetail(id){
                new Leaf.Window({
                    url:$('dynamic_header_edit_url').getUrl()+'?header_id='+id,
                    title:'维度修改',
                    id:'dynamic_edit_window',
                    width:600,
                    height:200
                });
            }
            
            function queryService(){
                $('sys_dynamic_result_ds').query();
            }
            function resetService(){
                $('sys_dynamic_query_ds').reset();
            }
            
            function dynamicRenderer(value, record, name){
                return '<a href=\'javascript:openDynamicDetail(' + record.get('header_id') + ',"'+record.get('service_name')+'",'+record.get('customization_header_id')+',"'+record.get('dimension_code')+'","'+record.get('dimension_value')+'");\'>动态配置</a>';
            }
            
            function dimensionRenderer(value, record, name){
                return '<a href=\'javascript:openDimensionDetail(' + record.get('header_id') + ');\'>修改维度</a>';
            }
            
            function openDynamicDetail(id,service,cust_id,dt,dv){
                new Leaf.Window({
                    url:$('dynamic_header_maintain_url').getUrl()+'?header_id='+id+'&service_name='+service+'&cust_id='+cust_id+'&dimension_code='+dt+'&dimension_value='+dv,
                    title:'动态配置',
                    id:'dynamic_maintain_window',
                    width:1000,
                    height:600
                });
            }
        ]]></script>
        <a:screenBody>
            <a:dataSets>
                <a:dataSet id="sys_dynamic_query_ds">
                    <a:fields>
                        <a:field name="service_name" lovGridHeight="330" lovHeight="460" lovModel="sys.sys_service" lovWidth="450" title="PAGE_SELECT">
                            <a:mapping>
                                <a:map from="service_id" to="service_id"/>
                                <a:map from="service_name" to="service_name"/>
                            </a:mapping>
                        </a:field>
                    </a:fields>
                </a:dataSet>
                <a:dataSet id="sys_dynamic_result_ds" autoCount="true" autoQuery="true" model="sys.SYS1090.sys_dynamic_headers" queryDataSet="sys_dynamic_query_ds" selectable="true" submitUrl="${/request/@context_path}/modules/sys/SYS1090/sys_dynamic_submit.lsc"/>
            </a:dataSets>
            <a:form column="2" style="margin-left:10px;margin-top:10px;" title="查询条件" width="600">
                <a:lov name="service_name" bindTarget="sys_dynamic_query_ds" prompt="页面路径" width="200"/>
            </a:form>
            <a:hBox style="margin-left:7px;">
                <a:button click="queryService" text="HAP_QUERY"/>
                <a:button click="resetService" text="HAP_RESET"/>
            </a:hBox>
            <a:grid id="grid" bindTarget="sys_dynamic_result_ds" height="330" navBar="true" style="margin-left:10px;margin-top:10px;" width="1000">
                <a:toolBar>
                    <a:button btnclass="grid-add" className="item-btn-icon-text" click="openDynamicCreateWindow" text="新增" type="button"/>
                    <a:button type="delete"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="service_name" prompt="页面路径" width="250"/>
                    <a:column name="comments" prompt="描述" width="250"/>
                    <a:column name="dimension_type" align="center" prompt="维度类型"/>
                    <a:column name="dimension_value_desc" align="center" prompt="维度值"/>
                    <a:column name="dynamic_edit" align="center" prompt="动态配置" renderer="dynamicRenderer"/>
                    <a:column name="dimension_edit" align="center" prompt="维度值" renderer="dimensionRenderer"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>