<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng
    $Date: 2017-7-17 下午5:11:14
    $Revision: 1.0
    $Purpose: 潜在客户授权
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:view>
        <a:link id="hls2101_aut_trx_user_chance_bp_link" url="${/request/@context_path}/modules/hls/HLS2101/aut_trx_user_chance_bp.lview"/>
        <script type="text/javascript"><![CDATA[
            function hls2101_query() {
                $("hls2101_hn_chance_bp_result_ds").query();
            }
            
            function hls2101_reset() {
                $('hls2101_hn_chance_bp_query_ds').reset();
            }
            
            function hls2101_ds_update_handler(ds, record, name, value, oldvalue) {
                if (name == 'bp_class') {
                    if (value == 'ORG') {
                        record.getField('contact_person').setRequired(true);
                    }
                    if (value == "NP") {
                        record.getField('contact_person').setRequired(false);
                    }
                }
            }
            
            function hls2101_submit() {
                var records = $('hls2101_hn_chance_bp_result_ds').getSelected();
                if (records.length != 1) {
                    Leaf.showMessage('${l:PROMPT}', '${l:HLS.SELECT_RECORD}');
                    return;
                }
                var record = records[0];
                var url = $('hls2101_aut_trx_user_chance_bp_link').getUrl();
                var win = new Leaf.Window({
                    id: 'hls2101_aut_trx_user_chance_bp_winid',
                    url: url,
                    params: {
                        winid: 'hls2101_aut_trx_user_chance_bp_winid',
                        trx_name: record.get('chance_bp_name'),
                        trx_category: record.get('trx_category'),
                        trx_id: record.get('chance_bp_id'),
                        trx_number: record.get('bp_class_desc'),
                        document_owner_user_id: record.get('owner_user_id')
                    },
                    title: '提交授权',
                    width: 350,
                    height: 280
                });
                win.on('close',function(){
                    hls2101_query();
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls211_bp_class_ds" lookupCode="HLS211_BP_CLASS"/>
            <a:dataSet id="hls2101_hn_chance_bp_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="chance_bp_name"/>
                    <a:field name="bp_class_desc" displayField="code_value_name" options="hls211_bp_class_ds" returnField="bp_class" valueField="code_value"/>
                    <a:field name="bp_class"/>
                    <a:field name="owner_user_id"/>
                    <a:field name="owner_user_id_n"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls2101_hn_chance_bp_result_ds" autoPageSize="true" autoQuery="true" model="hls.HLS2101.hn_chance_bp" queryDataSet="hls2101_hn_chance_bp_query_ds" selectable="true" selectionModel="single"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls2101_query" text="HLS.QUERY"/>
                <a:gridButton click="hls2101_reset" text="HLS.RESET"/>
                <a:gridButton click="hls2101_submit" text="HLS.SUBMIT"/>
            </a:screenTopToolbar>
            <a:form column="3" title="查询条件">
                <a:textField name="chance_bp_name" bindTarget="hls2101_hn_chance_bp_query_ds" prompt="客户名称"/>
                <a:comboBox name="bp_class_desc" bindTarget="hls2101_hn_chance_bp_query_ds" prompt="客户类型"/>
                <a:textField name="owner_user_id_n" bindTarget="hls2101_hn_chance_bp_query_ds" prompt="创建人"/>
            </a:form>
            <a:grid id="hls2101_hn_chance_bp_result_grid" bindTarget="hls2101_hn_chance_bp_result_ds" marginHeight="200" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="chance_bp_name" prompt="客户名称" width="200"/>
                    <a:column name="bp_class_desc" prompt="客户类型"/>
                    <a:column name="unit_id_n" prompt="业务部"/>
                    <a:column name="owner_user_id_n" prompt="创建人"/>
                    <a:column name="trx_category_n" prompt="客户状态"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
