<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <a:link id="con_collection_update_link" model="cont.CON635.con_collection_hand" modelaction="batch_update"/>
        <script type="text/javascript"><![CDATA[
            function query() {
                $('con_collection_result_ds').query();
            }
            
            
            function staff_chang() {
                var result_records = $('con_collection_result_ds').getSelected();
                var persons_record = $('con_collection_persons_ds').getSelected()[0];
                var datas = [];
                for (var i = 0;i < result_records.length;i++) {
                    var obj = {};
                    obj['col_id'] = result_records[i].get('col_id');
                    obj['staff_id'] = persons_record.get('staff_id');
                    obj['_status'] = 'update';
                    datas[i] = obj;
                }
                Leaf.request({
                    url: $('con_collection_update_link').getUrl(),
                    para: datas,
                    success: function(res) {
                        Leaf.SideBar.show({
                            msg: '${l:HLS.SUBMIT_SUCCESS}',
                            duration: 2000
                        });
                        $('con_collection_result_ds').query();
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="con_collection_persons_ds" autoQuery="true" model="cont.CON632.con_collection_persons_query_lov" selectable="true" selectionModel="single"/>
            <a:dataSet id="con635_con_collection_hand_ds">
                <a:fields>
                    <a:field name="staff_name" displayField="staff_name" options="con_collection_persons_ds" returnField="staff_id" valueField="staff_id"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con_collection_result_ds" autoQuery="true" model="cont.CON635.con_collection_hand" queryDataSet="con635_con_collection_hand_ds" selectable="true"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="query" text="查询"/>
                <a:gridButton click="staff_chang" text="人员变更"/>
            </a:screenTopToolbar>
            <a:form column="4" marginWidth="20" title="查询">
                <a:comboBox name="staff_name" bindTarget="con635_con_collection_hand_ds" prompt="分配人员"/>
            </a:form>
            <a:hBox>
                <a:grid Width="950" bindTarget="con_collection_result_ds" marginHeight="200" navBar="true">
                    <a:toolBar>
                        <a:button type="excel"/>
                    </a:toolBar>
                    <a:columns>
                        <a:column name="contract_number" align="left" prompt="合同编号" width="140"/>
                        <a:column name="project_number" align="left" prompt="申请编号" width="100"/>
                        <a:column name="bp_name" align="left" prompt="客户名称" width="100"/>
                        <a:column name="staff_name" align="center" prompt="分配人员" width="100"/>
                        <a:column name="overdue_status_type_n" align="center" prompt="逾期状态" width="90"/>
                        <a:column name="remain_principal" align="right" prompt="剩余本金" renderer="Leaf.formatMoney" width="100"/>
                        <a:column name="overdue_amount_sum" align="right" prompt="逾期租金" renderer="Leaf.formatMoney" width="100"/>
                        <a:column name="overdue_max_days" align="right" prompt="逾期天数" width="80"/>
                        <a:column name="province_description" align="center" prompt="经销商省份" width="100"/>
                    </a:columns>
                </a:grid>
                <a:grid bindTarget="con_collection_persons_ds" marginHeight="200" navBar="true" width="300">
                    <a:columns>
                        <a:column name="staff_name" prompt="人员" width="100"/>
                    </a:columns>
                </a:grid>
            </a:hBox>
        </a:screenBody>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>
