<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qianming  
    $Date: 2015-6-29 下午2:23:48  
    $Revision: 1.0  
    $Purpose: 北京国资租赁-用友财务接口-基础数据接口
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="bgfl_yongyou_basic_data_transfer_link_id" url="${/request/@context_path}/modules/inf/INF102/bgfl_yongyou_basic_data_transfer.lsc"/>
        <a:link id="bgfl_yongyou_basic_data_refresh_link_id" url="${/request/@context_path}/modules/inf/INF102/bgfl_yongyou_basic_data_refresh.lsc"/>
        <script type="text/javascript"><![CDATA[
        	function bgfl_yongyou_basic_data_query(){
        	    $('bgfl_yongyou_basic_data_result_ds').query();
        	}
        	function bgfl_yongyou_basic_data_reset(){
        	    $('bgfl_yongyou_basic_data_query_ds').reset();
        	}
        	function bgfl_yongyou_basic_data_select_func(record){
        	    if(record.get('import_flag') === 'N' || record.get('import_flag') === 'R'){
        	        return true;
        	    }
        	    return false;
        	}
        	function lock_current_window() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            }
            
            function unlock_current_window() {
                Leaf.Masker.unmask(Ext.getBody());
            }
        	function bgfl_yongyou_basic_data_transfer(){
        	    var selected_records = $('bgfl_yongyou_basic_data_result_ds').getSelected();
        	    if(selected_records.length < 1){
        	        Leaf.showErrorMessage('错误','请至少选择一条基础数据传输到用友系统!');
        	    }else{
        	        Leaf.showConfirm('提示','本次共计传输'+selected_records.length+'条基础数据,您确定?',function(){
        	        var datas_id = selected_records[0].get('data_id');
        	        for(var i=1;i < selected_records.length;i++){
        	            datas_id = datas_id+','+selected_records[i].get('data_id');
        	        }
        	        lock_current_window();
        	        Leaf.request({
                        url: $('bgfl_yongyou_basic_data_transfer_link_id').getUrl(),
                        para: {
                            data_id: '(' + datas_id + ')'
                        },
                        success: function(res) {
                            unlock_current_window();
                            bgfl_yongyou_basic_data_query();
                        },
                        error: function() {
                            unlock_current_window();
                        },
                        failure: function() {
                            unlock_current_window();
                        },
                        scope: this
                    });});
        	    }
        	}
        	function bgfl_yongyou_basic_data_refresh(){
				lock_current_window();
        	    Leaf.request({
                	url: $('bgfl_yongyou_basic_data_refresh_link_id').getUrl(),
                        success: function(res) {
                            unlock_current_window();
                            bgfl_yongyou_basic_data_query();
                        },
                        error: function() {
                            unlock_current_window();
                        },
                        failure: function() {
                            unlock_current_window();
                        },
                        scope: this
                    });        	        
        	}
		]]></script>
        <a:dataSets>
            <a:dataSet id="yes_no_ds" lookupCode="YES_NO"/>
            <a:dataSet id="yongyou_import_flag_ds" lookupCode="YONGYOU_IMPORT_FLAG"/>
            <a:dataSet id="bgfl_yongyou_basic_data_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="data_type" lovGridHeight="300" lovHeight="430" lovLabelWidth="120" lovService="inf.INF102.bgfl_yongyou_data_type_dtl" lovWidth="550">
                        <a:mapping>
                            <a:map from="data_type" to="data_type"/>
                            <a:map from="description" to="data_type_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="system_flag_desc" displayField="code_value_name" options="yes_no_ds" returnField="system_flag" valueField="code_value"/>
                    <a:field name="discard_flag_desc" displayField="code_value_name" options="yes_no_ds" returnField="discard_flag" valueField="code_value"/>
                    <a:field name="import_flag_desc" displayField="code_value_name" options="yongyou_import_flag_ds" returnField="import_flag" valueField="code_value"/>
                    <a:field name="import_user" lovGridHeight="300" lovHeight="430" lovService="inf.INF102.sys_user_for_lov" lovWidth="500">
                        <a:mapping>
                            <a:map from="user_id" to="import_user_id"/>
                            <a:map from="user_desc" to="import_user"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="bgfl_yongyou_basic_data_result_ds" autoPageSize="true" model="inf.INF102.bgfl_yongyou_basic_data" queryDataSet="bgfl_yongyou_basic_data_query_ds" selectFunction="bgfl_yongyou_basic_data_select_func" selectable="true"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="bgfl_yongyou_basic_data_query" text="HLS.QUERY"/>
                <a:gridButton click="bgfl_yongyou_basic_data_reset" text="HLS.RESET"/>
                <a:gridButton click="bgfl_yongyou_basic_data_transfer" text="基础数据传输"/>
                <a:gridButton click="bgfl_yongyou_basic_data_refresh" text="基础数据同步"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="110" marginWidth="35" title="HLS.QUERY_TITLE">
                <a:lov name="data_type" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="数据类型编码"/>
                <a:textField name="data_type_desc" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="数据类型描述" readOnly="true"/>
                <a:textField name="source_table" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="来源表" typeCase="upper"/>
                <a:comboBox name="system_flag_desc" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="是否系统生成"/>
                <a:numberField name="update_times_from" allowDecimals="false" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="更新次数从"/>
                <a:numberField name="update_times_to" allowDecimals="false" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="更新次数至"/>
                <a:datePicker name="import_date_from" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="导入日期从"/>
                <a:datePicker name="import_date_to" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="导入日期至"/>
                <a:comboBox name="discard_flag_desc" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="是否丢弃"/>
                <a:comboBox name="import_flag_desc" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="导入状态"/>
                <a:lov name="import_user" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="导入用户"/>
                <a:textField name="error_message" bindTarget="bgfl_yongyou_basic_data_query_ds" prompt="错误消息"/>
            </a:form>
            <a:grid id="grid_id" bindTarget="bgfl_yongyou_basic_data_result_ds" marginHeight="210" marginWidth="35" navBar="true">
                <a:toolBar>
                    <a:button type="excel"/>
                    <a:button type="clear"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="data_type" lock="true" prompt="数据类型编码" width="120"/>
                    <a:column name="data_type_desc" lock="true" prompt="数据类型描述" showTitle="true" width="120"/>
                    <a:column name="source_table" lock="true" prompt="来源表" showTitle="true" width="140"/>
                    <a:column name="attr01" prompt="属性01" showTitle="true" width="100"/>
                    <a:column name="attr02" prompt="属性02" showTitle="true" width="100"/>
                    <a:column name="attr03" prompt="属性03" showTitle="true" width="100"/>
                    <a:column name="attr04" prompt="属性04" showTitle="true" width="100"/>
                    <a:column name="attr05" prompt="属性05" showTitle="true" width="100"/>
                    <a:column name="attr06" prompt="属性06" showTitle="true" width="100"/>
                    <a:column name="attr07" prompt="属性07" showTitle="true" width="100"/>
                    <a:column name="attr08" prompt="属性08" showTitle="true" width="100"/>
                    <a:column name="attr09" prompt="属性09" showTitle="true" width="100"/>
                    <a:column name="attr10" prompt="属性10" showTitle="true" width="100"/>
                    <a:column name="attr11" prompt="属性11" showTitle="true" width="100"/>
                    <a:column name="attr12" prompt="属性12" showTitle="true" width="100"/>
                    <a:column name="attr13" prompt="属性13" showTitle="true" width="100"/>
                    <a:column name="attr14" prompt="属性14" showTitle="true" width="100"/>
                    <a:column name="attr15" prompt="属性15" showTitle="true" width="100"/>
                    <a:column name="attr16" prompt="属性16" showTitle="true" width="100"/>
                    <a:column name="attr17" prompt="属性17" showTitle="true" width="100"/>
                    <a:column name="attr18" prompt="属性18" showTitle="true" width="100"/>
                    <a:column name="attr19" prompt="属性19" showTitle="true" width="100"/>
                    <a:column name="attr20" prompt="属性20" showTitle="true" width="100"/>
                    <a:column name="update_times" align="center" prompt="更新次数" width="80"/>
                    <a:column name="system_flag" align="center" prompt="是否系统生成" width="90"/>
                    <a:column name="discard_flag" align="center" prompt="是否丢弃" width="80"/>
                    <a:column name="import_flag_desc" align="center" prompt="导入状态" width="100"/>
                    <a:column name="import_date" align="center" prompt="导入日期" renderer="Leaf.formatDate" width="100"/>
                    <a:column name="import_user" prompt="导入用户" width="100"/>
                    <a:column name="error_message" prompt="错误信息" showTitle="true" width="120"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>