<?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_area" model="cont.CON630.con_persons_district_area_update" modelaction="batch_update"/>
        <script type="text/javascript"><![CDATA[
            function hls051_grant_aera_close() {
                $('con_persons_district_window').close();
            }
            
            function hls051_grant_aera_save(ds, record) {

                var ds = $('hls051_plan_to_grant_area_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('staff_id', '${/parameter/@staff_id}');
                    saveData.push(record.data)
                }
                Leaf.request({
                    url: $('update_grant_area').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_area_query_ds">
                <a:fields>
                    <a:field name="area_code"/>
                    <a:field name="description"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls051_plan_to_grant_area_ds" autoQuery="true" fetchAll="true" model="cont.CON630.con_persons_district_area" queryDataSet="hls051_product_plan_area_query_ds" queryUrl="${/request/@context_path}/autocrud/cont.CON630.con_persons_district_area/query?staff_id=${/parameter/@staff_id}">
                <a:fields>
                    <a:field name="staff_id" defaultValue="${/parameter/@staff_id}"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls051_grant_aera_close" text="关闭"/>
                <!-- <a:gridButton click="hls051_grant_aera_query" text="查询"/> -->
                <a:gridButton click="hls051_grant_aera_save" text="保存"/>
            </a:screenTopToolbar>
            <a:treeGrid id="hls051_tab1_id_tree_grid_id" bindTarget="hls051_plan_to_grant_area_ds" idField="area_id" marginHeight="180" navBar="true" parentField="parent_area_id" showCheckBox="true" width="380">
                <a:columns>
                    <a:column name="area_desc" prompt="区域名称" width="150"/>
                </a:columns>
                <!-- <a:editors>
                                <a:comboBox id="tabDs_grid_comb"/>
                            </a:editors> -->
            </a:treeGrid>
            <!-- <a:events>
                    <a:event name="select" handler="hls_doc_layout_tab_select"/>
                </a:events> -->
        </a:screenBody>
    </a:view>
</a:screen>
