<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Calvin  
    $Date: 2017年11月22日18:21:48
    $Revision: 1.0  
    $Purpose:移交上门 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <script type="text/javascript"><![CDATA[
            function lock_current_window() {
                Leaf.Masker.mask($('con632_collection_way_window').wrap, '${l:HLS.EXECUTING}');
            }
            
            function unlock_current_window() {
                Leaf.Masker.unmask($('con632_collection_way_window').wrap);
            }
            
            function close() {
                $('con632_collection_way_window').close();
            }
            
            function transfer() {
                var record = $('con632_transfer_ds').getCurrentRecord();
                if ($('con632_transfer_ds').validate()) {
            
                    Leaf.showConfirm('提示', '确认移交上门该催收单据吗?', function() {
                        lock_current_window();
                        Leaf.request({
                            url: '${/request/@context_path}/autocrud/cont.CON632.con_collection/execute',
                            para: {
                                col_id: '${/parameter/@col_id}',
                                visit_person_id: record.get('visit_person_id')
                            },
                            success: function(res) {
                                unlock_current_window();
                                Leaf.SideBar.show({
                                    msg: '操作成功',
                                    duration: 2000
                                });
                                close();
                            },
                            failure: function() {
                                unlock_current_window();
                            },
                            error: function() {
                                unlock_current_window();
                            },
                            sync: true,
                            scope: this
                        });
                    });
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="con632_transfer_ds" autoQuery="true" loadData="true" queryUrl="${/request/@context_path}/autocrud/cont.CON632.con_collection/query?col_id=${/parameter/@col_id}">
                <a:fields>
                    <a:field name="visit_person_id_n" lovGridHeight="350" lovHeight="500" lovLabelWidth="100" lovService="basic.exp_emp_assign_e_v_primary_lov" lovWidth="520" required="true" title="上门人员">
                        <a:mapping>
                            <a:map from="employee_id" to="visit_person_id"/>
                            <a:map from="employee_name" to="visit_person_id_n"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="close" text="HLS.CLOSE"/>
                <a:gridButton click="transfer" text="确认移交"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="100" title="逾期流转">
                <a:textField name="staff_id_n" bindTarget="con632_transfer_ds" prompt="电催人员" readOnly="true"/>
                <a:lov name="visit_person_id_n" bindTarget="con632_transfer_ds" prompt="上门人员"/>
                <a:datePicker name=" " bindTarget="con632_transfer_ds" prompt="流转时间" readOnly="true"/>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>