<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: lingfeng.chen
    $Date: 2017-7-14 上午10:06:32
    $Revision: 1.0
    $Purpose: 潜在客户管理
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure>
        <a:model-query model="basic.sys_session_info" rootPath="mainPage_session_record"/>
        <a:model-query defaultWhereClause="t1.role_id=${/session/@role_id} and t1.company_id=${/session/@company_id}" fetchAll="true" model="hls.HLS109.hls_default_parameter" rootPath="hls_default_parameter_path"/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
            function hls2104d_grid_editorFunction(record, name) {
                var current_user_id = '${/session/@user_id}';
                if (current_user_id == record.get('interviewer_user_id') || record.isNew) {
                    if (name == 'interview_name') {
                        return 'hls2104d_grid_textField';
                    }
                    if (name == 'interview_date') {
                        return 'hls2104d_grid_datePicker';
                    }
                    if (name == 'interview_location') {
                        return 'hls2104d_grid_textField';
                    }
            
                    if (name == 'description') {
                        return 'hls2104d_grid_textArea';
            
                    }
                    if (name == 'interviewee_name'){
                        return 'hls2104d_grid_textField';
                    }
            
                }
            
                return '';
            }
            
            function hls2104d_query() {
                $("hls2104d_chance_bp_detail_result_ds").query();
            }
            
            function hls2104d_reset() {
                $('hls2104d_chance_bp_detail_query_ds').reset();
            }
            
         
            function hls2104d_submitsuccess_handler_func(ds,res){
                hls2104d_query();
            }
         
        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls2104d_chance_bp_detail_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="chance_bp_id" defaultValue="${/parameter/@chance_bp_id}"/>
                    <a:field name="interview_date_from"/>
                    <a:field name="interview_date_to"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls2104d_chance_bp_detail_result_ds" autoPageSize="true" autoQuery="true" model="hls.HLS2104.hn_chance_bp_interviews" queryDataSet="hls2104d_chance_bp_detail_query_ds">
                <a:fields>
                    <a:field name="chance_bp_name" defaultValue="${/parameter/@chance_bp_name}"/>
                    <a:field name="chance_bp_id" defaultValue="${/parameter/@chance_bp_id}" required="true"/>
                    <a:field name="interview_name" required="true"/>
                    <a:field name="interview_date" required="true"/>
                    <a:field name="interview_location" required="true"/>
                    <a:field name="interviewee_name" required="true"/>
                    <a:field name="description" required="true"/>
                    <a:field name="interviewer_user_id_n" defaultValue="${/model/mainPage_session_record/record/@user_desc}" required="true"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="hls2104d_submitsuccess_handler_func"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls2104d_query" text="HLS.QUERY"/>
                <a:gridButton click="hls2104d_reset" text="HLS.RESET"/>
                <a:gridButton bind="hls2104d_chance_bp_detail_result_grid" text="新增" type="add"/>
                <a:gridButton bind="hls2104d_chance_bp_detail_result_grid" text="HLS.SAVE" type="save"/>
            </a:screenTopToolbar>
            <a:form column="2" title="查询条件">
                <a:datePicker name="interview_date_from" bindTarget="hls2104d_chance_bp_detail_query_ds" prompt="访谈时间从"/>
                <a:datePicker name="interview_date_to" bindTarget="hls2104d_chance_bp_detail_query_ds" prompt="访谈时间到"/>
            </a:form>
            <a:grid id="hls2104d_chance_bp_detail_result_grid" bindTarget="hls2104d_chance_bp_detail_result_ds" marginHeight="200" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="chance_bp_name" editorFunction="hls2104d_grid_editorFunction" prompt="客户名称" width="200"/>
                    <a:column name="interview_name" editorFunction="hls2104d_grid_editorFunction" prompt="访谈名称" width="200"/>
                    <a:column name="interviewee_name" editorFunction="hls2104d_grid_editorFunction" prompt="访谈人员" width="150"/>
                    <a:column name="interview_date" editorFunction="hls2104d_grid_editorFunction" prompt="访谈时间" renderer="Leaf.formatDate"/>
                    <a:column name="interview_location" editorFunction="hls2104d_grid_editorFunction" prompt="访谈地点" width="150"/>
                    <a:column name="interviewer_user_id_n" editorFunction="hls2104d_grid_editorFunction" prompt="创建人"/>
                    <a:column name="description" editorFunction="hls2104d_grid_editorFunction" prompt="说明" width="300"/>
                </a:columns>
                <a:editors>
                    <a:comboBox id="hls2104d_grid_comboBox"/>
                    <a:checkBox id="hls2104d_grid_checkBox" checkedValue="Y" uncheckedValue="N"/>
                    <a:datePicker id="hls2104d_grid_datePicker"/>
                    <a:lov id="hls2104d_grid_lov"/>
                    <a:textArea id="hls2104d_grid_textArea" height="100" width="300"/>
                    <a:textField id="hls2104d_grid_textField"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
