<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure><![CDATA[
	]]></a:init-procedure>
    <a:view>
        <a:link id="update_grant_brand" model="hls.HLS051.hls_product_to_grant_brand_update" modelaction="batch_update"/>
        <script type="text/javascript"><![CDATA[
            function hls051_grant_barnd_close() {
                $('hls_grant_brand_window').close();
            }
            
            function hls051_grant_barnd_query() {
                $('hls051_plan_to_grant_brand_ds').query();
            }
            
            function hls051_grant_barnd_save(ds, record) {

                var ds = $('hls051_plan_to_grant_brand_ds');
                var records = ds.getAll();
                var saveData = [];
                for (var i = 0;i < records.length;i++) {
                    var record = records[i];
                    record.set('_status', 'update');
                    record.set('product_grant_id', '${/parameter/@product_grant_id}');
                    saveData.push(record.data)
                }
                Leaf.request({
                    url: $('update_grant_brand').getUrl(),
                    para: saveData,
                    success: function(args) {
                        Leaf.Masker.unmask(Ext.getBody());
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 5000
                        });
                    },
                    failure: function(args) {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function(args) {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
            
                });
            }
            
            
        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls051_product_plan_brand_query_ds">
                <a:fields>
                    <a:field name="brand_code"/>
                    <a:field name="description"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls051_plan_to_grant_brand_ds" autoPageSize="true" autoQuery="true" model="hls.HLS051.hls_product_to_grant_brand" queryDataSet="hls051_product_plan_brand_query_ds" queryUrl="${/request/@context_path}/autocrud/hls.HLS051.hls_product_to_grant_brand/query?product_grant_id=${/parameter/@product_grant_id}">
                <a:fields>
                    <a:field name="product_grant_id" defaultValue="${/parameter/@product_grant_id}"/>
                    <a:field name="enable_flag" checkedValue="Y" defaultValue="N" required="true" uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls051_grant_barnd_close" text="关闭"/>
                <a:gridButton click="hls051_grant_barnd_query" text="查询"/>
                <a:gridButton click="hls051_grant_barnd_save" text="保存"/>
            </a:screenTopToolbar>
            <a:form Width="500" column="2" title="查询条件">
                <a:textField name="brand_code" bindTarget="hls051_product_plan_brand_query_ds" prompt="品牌代码"/>
                <a:textField name="description" bindTarget="hls051_product_plan_brand_query_ds" prompt="品牌名称"/>
            </a:form>
            <a:grid id="hls051_plan_to_grant_brand_grid" bindTarget="hls051_plan_to_grant_brand_ds" marginHeight="180" marginWidth="15" navBar="true">
                <a:columns>
                    <a:column name="brand_code" align="center" autoAdjust="true" prompt="品牌代码" width="200"/>
                    <a:column name="description" align="center" autoAdjust="true" prompt="品牌名称" width="200"/>
                    <a:column name="enable_flag" align="center" autoAdjust="true" editor="editor_cb" prompt="启用"/>
                </a:columns>
                <a:editors>
                    <a:checkBox id="editor_cb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
