<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LPC 
    $Date: 
    $Revision: 1.0  
    $Purpose: 自动指派
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:view>
        <a:link id="pageLink_allocation_detail" url="${/request/@context_path}/modules/zjwfl/ZJWFL1111/hls_auto_allocation_person.lview"/>
        <!-- <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/> -->
        <!-- <a:screen-include screen="modules/hls/hls_common_javascript.lview"/> -->
        <script type="text/javascript"><![CDATA[
            function allocation_group_grid_query() {
                $('allocation_group_ds').query();
            }
            
            function resetAccountSet() {
                $('allocation_groupDs').reset();
            }
            
            function allocation_group_grid_add() {
                $('allocation_group_grid').showEditorByRecord($('allocation_group_ds').create());
            }
            
            function allocation_group_grid_clear() {
                $('allocation_group_grid').clear();
            }
            
            
            function allocation_group_grid_submit() {

                var result_ds = $('allocation_group_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            
            
            // function allocation_group_quit() {
            // location.href = $('sys_service_welcome_link').getUrl();
            // parent.shMenu('show');
            // }
            
            function editorFunction_allocation_groupDs_grid(record, name) {
                if (name == 'group_code') {
                    if (record.isNew) {
                        return 'allocation_group_grid_editor_tf_upper';
                    }
                }
                return '';
            
            }
            
            function render_allocationDefineDs_grid(value, record, name) {

                if (name == 'allocation_detail') {
                    var group_id = record.get('group_id');
                    if (!Ext.isEmpty(group_id)) {
                        return '<a href="javascript:winOpen_allocation_detail(' + group_id + ')">指派成员</a>';
                    }
                }
                return '';
            }
            
            function winOpen_allocation_detail(group_id) {
                new Leaf.Window({
                    id: 'allocation_group',
                    url: $('pageLink_allocation_detail').getUrl(),
                    params: {
                        group_id: group_id
                    },
                    title: '成员指派',
                    fullScreen: true,
                    draggable: true
            
                });
            }
        ]]></script>
        <a:dataSets>
            <!-- <a:dataSet id="gld_coa_structure_ds">
                <a:datas dataSource="/model/coa_structure"/>
            </a:dataSet> -->
            <a:dataSet id="allocation_groupDs"/>
            <a:dataSet id="allocation_group_ds" autoQuery="true" fetchAll="true" model="zjwfl.ZJWFL1111.hls_auto_allocation_group" queryDataSet="allocation_groupDs" selectable="true">
                <a:fields>
                    <a:field name="group_id"/>
                    <a:field name="group_code" required="true"/>
                    <a:field name="group_name" required="true"/>
                    <a:field name="company_id" defaultValue="${/session/@company_id}"/>
                    <a:field name="enable_flag" checkedValue="Y" defaultValue="Y" required="true" unCheckedValue="N"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <!-- <a:gridButton click="allocation_group_quit" text="HLS.EXIT"/> -->
                <a:gridButton click="allocation_group_grid_query" text="HLS.QUERY"/>
                <a:gridButton click="allocation_group_grid_add" text="HLS.NEW"/>
                <a:gridButton click="allocation_group_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="allocation_group_grid_submit" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:form column="2" title="指派模板查询">
                <a:textField name="group_code" bindTarget="allocation_groupDs" prompt="分组类型" typeCase="upper"/>
                <a:textField name="group_name" bindTarget="allocation_groupDs" prompt="分组名称"/>
            </a:form>
            <a:grid id="allocation_group_grid" bindTarget="allocation_group_ds" marginHeight="180" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="group_code" align="left" editorFunction="editorFunction_allocation_groupDs_grid" prompt="分组类型" sortable="true" width="200"/>
                    <a:column name="group_name" align="left" editor="allocation_group_grid_editor_tf" prompt="分组名称" width="200"/>
                    <a:column name="enable_flag" align="center" editor="allocation_group_cb" prompt="启用标志" width="80"/>
                    <a:column name="allocation_detail" align="center" prompt="指派成员" renderer="render_allocationDefineDs_grid" width="80"/>
                </a:columns>
                <a:editors>
                    <a:textField id="allocation_group_grid_editor_tf_upper" typeCase="upper"/>
                    <a:textField id="allocation_group_grid_editor_tf"/>
                    <a:checkBox id="allocation_group_cb"/>
                    <a:comboBox id="allocation_group_grid_editor_comb"/>
                    <a:lov id="allocation_group_grid_editor_lov"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>