<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-5-21 下午1:37:08  
    $Revision: 1.0  
    $Purpose: 文件模板定义 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <a:link id="hls810_param_link_link" url="${/request/@context_path}/modules/hls/HLS810/hls_doc_file_tmp_para_link.lview"/>
        <a:link id="hls810_templet_signer_link" url="${/request/@context_path}/modules/hls/HLS810/hls_doc_file_templet_signer.lview"/>
        <a:link id="hls810_atm_link" url="${/request/@context_path}/uploadFile.lview"/>
        <script type="text/javascript"><![CDATA[
       function hls810_add() {
           var ds = $('hls_doc_file_temp_ds');
           var record = ds.create(ds.currentIndex);
           $('hls_doc_file_temp_ds_id').showEditorByRecord(record);
       
       }
       
       function hls810_delete() {
           var ds = $('hls_doc_file_temp_ds');
           var records = ds.getSelected();
           if (records.length != 0) {
               Leaf.showConfirm('${l:HLS.PROMPT}', '${l:HLS030.CONFIRM_DELETE}', function() {
                   ds.remove(records);
               });
           }
       
       }
       
       function hls810_save() {
           var ds = $('hls_doc_file_temp_ds');
           if (ds.validate()) {
               ds.submit();
           }
       
       }
       
       function editor_check(record, name) {
                if (record.isNew) {
                    if(name=='templet_code' )
                    {
                        return 'textFied_ed_up' ;
                    }
                }
                return '' ;
            }
            
       function hls810_query(){
           $('hls_doc_file_temp_ds').query();
       }
       //模板参数链接
       function hls810_param_link_rener(value,record,name){
           var tmpt_id = record.get('templet_id');
               if(!record.isNew){
                    return '<a href="javascript:hls810_link_jump(\''+tmpt_id+'\')">参数集</a>';
                }
       }
       function hls810_link_jump(templet_id){
           var url = $('hls810_param_link_link').getUrl()+'?templet_id='+templet_id;
    	        wd = new Leaf.Window({
                    id: 'hls810_param_link_screen',
                    url: url,
                    title: '关联参数',
                    height: 500,
                    width: 830
                });
       }
        //模板签署人链接 add by 24976
        function hls810_templet_signer_link_rener(value,record,name){
            var tmpt_id = record.get('templet_id');
            if(!record.isNew){
                return '<a href="javascript:hls810_signer_jump(\''+tmpt_id+'\')">签署人</a>';
            }
        }
        function hls810_signer_jump(templet_id){
            var url = $('hls810_templet_signer_link').getUrl()+'?templet_id='+templet_id;
            wd = new Leaf.Window({
                id: 'hls810_templet_signer_link_screen',
                url: url,
                title: '签署人参数',
                height: 500,
                width: 830
            });
        }
       function hls810_plugin_render(value,record,name){
                var tmpt_id = record.get('templet_id');
               if(!record.isNew){
                    return '<a href="javascript:hls810_upload_fun(\''+tmpt_id+'\')">模板上传</a>';
                }
            }
            function hls810_upload_fun(templet_id){
                var url = $('hls810_atm_link').getUrl()+'?table_name=HLS_DOC_FILE_TEMPLET' + '&' + 'header_id=' + templet_id;
    	        wd = new Leaf.Window({
                    id: 'acr515_vat_upload_link',
                    url: url,
                    title: '模板上传',
                    height: 350,
                    width: 850
                });
            }
            function setPassword(value, record, name){
                var passwd ='';
                if(typeof(record.get('pwd')) != 'undefined' ){
                    for(var i=0; i<value.length ; i++){
                        passwd = passwd + '●';
                    }
                    return passwd;
                }
            }
   ]]></script>
        <a:dataSets>
            <a:dataSet id="enable_flag_ds" lookupCode="ENABLED_STATUS"/>
            <a:dataSet id="hls_doc_file_usage_ds" lookupCode="HLS_DOC_FILE_USAGE"/>
            <a:dataSet id="for_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="templet_code"/>
                    <a:field name="templet_name"/>
                    <a:field name="usage_code"/>
                    <a:field name="usage_code_des" displayField="code_value_name" options="hls_doc_file_usage_ds" returnField="usage_code" valueField="code_value"/>
                    <a:field name="enabled_flag"/>
                    <a:field name="enabled_flag_des" displayField="code_value_name" options="enable_flag_ds" returnField="enabled_flag" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls_doc_file_temp_ds" autoQuery="true" model="hls.HLS810.hls_doc_file_templet" queryDataSet="for_query_ds" selectable="true">
                <a:fields>
                    <a:field name="templet_code" required="true"/>
                    <a:field name="templet_name" required="true"/>
                    <a:field name="usage_code" required="true"/>
                    <a:field name="usage_code_des" displayField="code_value_name" options="hls_doc_file_usage_ds" required="true" returnField="usage_code" valueField="code_value"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>


                    <a:field name="main_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="tenant_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="guarantor_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="agent_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>


                    <a:field name="tenant_loop_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="guarantor_loop_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="agent_loop_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>

                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls810_query" text="HLS.QUERY"/>
                <a:gridButton click="hls810_add" text="新增"/>
                <a:gridButton click="hls810_delete" text="删除"/>
                <a:gridButton click="hls810_save" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:form column="4" marginWidth="200" title="查询条件">
                <a:textField name="templet_code" bindTarget="for_query_ds" prompt="模板代码"/>
                <a:textField name="templet_name" bindTarget="for_query_ds" prompt="模板名称"/>
                <a:comboBox name="usage_code_des" bindTarget="for_query_ds" prompt="模板用途"/>
                <a:comboBox name="enabled_flag_des" bindTarget="for_query_ds" prompt="启用"/>
            </a:form>
            <a:grid id="hls_doc_file_temp_ds_id" bindTarget="hls_doc_file_temp_ds" marginHeight="200" marginWidth="200" navBar="true">
                <a:columns>
                    <a:column name="templet_code" editorFunction="editor_check" prompt="模板代码" width="150"/>
                    <a:column name="templet_name" editor="textFied_ed" prompt="模板名称" width="150"/>
                    <a:column name="usage_code_des" editor="combobox_ed" prompt="模板用途" width="100"/>
                    <!-- <a:column name="templet_file_path" editor="textFied_ed" prompt="模板路径" width="200"/>
                    <a:column name="templet_file_name" editor="textFied_ed" prompt="文件名" width="200"/> -->
                    <a:column align="center" prompt="模板上传" renderer="hls810_plugin_render"/>
                    <a:column name="note" editor="textArea_ed" prompt="说明" width="200"/>
                    <a:column name="enabled_flag" editor="checkbox_ed" prompt="启用" width="50"/>
                    <a:column name="param_link" align="center" prompt="参数集" renderer="hls810_param_link_rener"/>
                    <a:column name="templet_signer_link" align="center" prompt="签署人" renderer="hls810_templet_signer_link_rener"/>
                    <a:column name="pwd" align="center" editor="hls810_pwd_ed" prompt="密码" renderer="setPassword"/>

                    <a:column name="main_flag" editor="checkbox_ed" prompt="宏菱" width="150"/>
                    <a:column name="main_key_word" editor="textFied_ed" prompt="宏菱盖章关键字" width="150"/>
                    <a:column name="tenant_flag" editor="checkbox_ed" prompt="承租人（个人/法人）" width="150"/>
                    <a:column name="tenant_key_word" editor="textFied_ed" prompt="承租人盖章关键字" width="150"/>
                    <a:column name="tenant_loop_flag" editor="checkbox_ed" prompt="承租人关键字循环标志" width="150"/>
                    <a:column name="guarantor_flag" editor="checkbox_ed" prompt="担保人（个人/法人）" width="150"/>
                    <a:column name="guarantor_key_word" editor="textFied_ed" prompt="担保人盖章关键字" width="150"/>
                    <a:column name="guarantor_loop_flag" editor="checkbox_ed" prompt="担保人关键字循环标志" width="150"/>
                    <a:column name="agent_flag" editor="checkbox_ed" prompt="代理商" width="150"/>
                    <a:column name="agent_key_word" editor="textFied_ed" prompt="代理商盖章关键字" width="150"/>
                    <a:column name="agent_loop_flag" editor="checkbox_ed" prompt="代理商关键字循环标志" width="150"/>

                    <a:column name="main_timestamp_key_word" editor="textFied_ed" prompt="宏菱时间戳盖章关键字" width="200"/>
                    <a:column name="tenant_timestamp_key_word" editor="textFied_ed" prompt="承租人时间戳盖章关键字" width="200"/>
                    <a:column name="guarantor_timestamp_key_word" editor="textFied_ed" prompt="担保人时间戳盖章关键字" width="200"/>
                    <a:column name="agent_timestamp_key_word" editor="textFied_ed" prompt="代理商时间戳盖章关键字" width="200"/>


                </a:columns>
                <a:editors>
                    <a:textField id="textFied_ed"/>
                    <a:textField id="textFied_ed_up" typeCase="upper"/>
                    <a:comboBox id="combobox_ed"/>
                    <a:checkBox id="checkbox_ed"/>
                    <a:textArea id="textArea_ed" height="60"/>
                    <a:passWord id="hls810_pwd_ed"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
