sys_content_document.lview 11.2 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qianming  
    $Date: 2015-11-30 下午4:58:09  
    $Revision: 1.0  
    $Purpose: 文档配置
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="sys_content_paragraph_link_id" url="${/request/@context_path}/modules/sys/SYS2000/sys_content_paragraph.lview"/>
        <a:link id="sys_content_document_generate_link_id" url="${/request/@context_path}/modules/sys/SYS2000/sys_content_document_generate.lsc"/>
        <a:link id="sys_content_document_content_view_link_id" url="${/request/@context_path}/modules/sys/SYS2000/sys_content_document_content_view.lview"/>
        <a:link id="sys_content_document_preview_link_id" url="${/request/@context_path}/modules/sys/SYS2000/sys_content_document_preview.lsc"/>
        <a:link id="sys_content_document_preview_download_link_id" url="${/request/@context_path}/modules/sys/SYS2000/sys_content_document_preview_download.lsc"/>
        <script type="text/javascript"><![CDATA[
        	function lock_current_window(msg) {
                Leaf.Masker.mask(Ext.getBody(),msg);
        		return true;
	        }
            	            
	        function unlock_current_window() {
	        	Leaf.Masker.unmask(Ext.getBody());
	        }
        	function do_query(){
        	    $('sys_content_document_result_ds').query();
        	}
        	function do_reset(){
        	    $('sys_content_document_query_ds').reset();
        	}
        	function do_export(){
        	    $('sys_content_document_grid_id')._export();
        	}
        	function open_content_window(document_id){
        	    Leaf.Window({
        	        url:$('sys_content_document_content_view_link_id').getUrl(),
        	        params:{
        	            document_id:document_id,
        	            winid:'sys_content_document_content_view_win_id'
        	        },
        	        title:'文档源码',
        	        id:'sys_content_document_content_view_win_id',
        	        fullScreen:true      	        
        	    });
        	}
        	function download_file(file_path,file_name){
	            window.open($('sys_content_document_preview_download_link_id').getUrl()+'?file_path=' + encodeURI(file_path,'utf-8') + '&file_name=' + encodeURI(file_name,'utf-8'),"_self");
	        }
        	function open_preview_window(record_id){
        	    record = $('sys_content_document_result_ds').findById(record_id);
        	    var path = 'E:\\u01\\uploadfile\\contents\\';
                if(lock_current_window('正在生成预览文件,请稍等......')){
                    $L.request({
			            url:$('sys_content_document_preview_link_id').getUrl(),
			            para:{
			                document_id			:record.get('document_id'),
			                document_name		:record.get('document_code')+'.pdf',
			                document_path		:path
			            },
			            success:function(obj){
			                unlock_current_window();
			                $L.SideBar.show({msg: '生成成功',duration: 3000});
			                download_file(path,record.get('document_code')+'.pdf');
			            },
			            failure: function() {
		             		unlock_current_window(); 
		             	},
		             	error: function() {
		                	unlock_current_window();
		             	},
		             	scope: this 
	            	});
                }
        	}
        	function open_paragraphs_window(document_id){
        	    Leaf.Window({
        	        url:$('sys_content_paragraph_link_id').getUrl(),
        	        params:{
        	            document_id:document_id,
        	            winid:'sys_content_paragraph_win_id'
        	        },
        	        title:'段落配置',
        	        id:'sys_content_paragraph_win_id',
        	        fullScreen:true      	        
        	    });
        	}
        	function do_render(value,record,name){
        	    if(name === 'content_xml'){
        	        return record.get('generate_flag')=== 'Y'?'<a href="javascript:open_content_window('+record.get('document_id')+')">查看</a>':'';
        	    }else if(name === 'paragraphs'){
        	        return !record.isNew?'<a href="javascript:open_paragraphs_window('+record.get('document_id')+')">编辑</a>':'';
        	    }else if(name === 'preview'){
        	        return record.get('generate_flag')=== 'Y'?'<a href="javascript:open_preview_window('+record.id+')">预览</a>':'';
        	    }
        	}
        	function do_editer(record,name){
        	    if(name === 'document_code'){
        	        return record.isNew?'sys_content_document_grid_edit_tf':'';
        	    }
        	}
        	function do_generate_source(){
        	    if($('sys_content_document_result_ds').getSelected().length > 0){
        	        $('sys_content_document_result_ds').submitSelected($('sys_content_document_generate_link_id').getUrl());
        	    }else{
        	        Leaf.showErrorMessage('提示','请至少选择一行数据进行操作!');
        	    }
        	}
        	function do_submitsuccess(ds,res){
        	    do_query();
        	}
		]]></script>
        <a:dataSets>
            <a:dataSet id="yes_no_ds" lookupCode="YES_NO"/>
            <a:dataSet id="sys_content_document_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="generate_flag_n" displayField="code_value_name" options="yes_no_ds" returnField="generate_flag" valueField="code_value"/>
                    <a:field name="enabled_flag_n" displayField="code_value_name" options="yes_no_ds" returnField="enabled_flag" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="sys_content_document_result_ds" autoPageSize="true" autoQuery="true" model="sys.SYS2000.sys_content_document" queryDataSet="sys_content_document_query_ds" selectable="true">
                <a:fields>
                    <a:field name="document_code" required="true" typeCase="upper"/>
                    <a:field name="description" required="true"/>
                    <a:field name="debugger_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                    <a:field name="readonly_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="watermark"/>
                    <a:field name="pagesize" defaultValue="A4"/>
                    <a:field name="header" defaultValue="1.50"/>
                    <a:field name="footer" defaultValue="1.75"/>
                    <a:field name="top" defaultValue="2.54"/>
                    <a:field name="bottom" defaultValue="2.54"/>
                    <a:field name="left" defaultValue="3.17"/>
                    <a:field name="right" defaultValue="3.17"/>
                    <a:field name="generate_flag" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="content_xml"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="do_submitsuccess"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="do_query" text="HLS.QUERY"/>
                <a:gridButton click="do_reset" text="HLS.RESET"/>
                <a:gridButton bind="sys_content_document_grid_id" type="excel"/>
                <a:gridButton bind="sys_content_document_grid_id" type="add"/>
                <a:gridButton bind="sys_content_document_grid_id" type="clear"/>
                <a:gridButton bind="sys_content_document_grid_id" type="save"/>
                <a:gridButton click="do_generate_source" text="生成源码"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="110" marginWidth="35" title="HLS.QUERY_TITLE">
                <a:textField name="document_code" bindTarget="sys_content_document_query_ds" prompt="文档编码" typeCase="upper"/>
                <a:textField name="description" bindTarget="sys_content_document_query_ds" prompt="文档名称"/>
                <a:comboBox name="generate_flag_n" bindTarget="sys_content_document_query_ds" prompt="是否生成"/>
                <a:comboBox name="enabled_flag_n" bindTarget="sys_content_document_query_ds" prompt="是否启用"/>
                <a:textArea name="contents" bindTarget="sys_content_document_query_ds" colspan="4" marginWidth="225" prompt="内容"/>
            </a:form>
            <a:grid id="sys_content_document_grid_id" bindTarget="sys_content_document_result_ds" marginHeight="220" marginWidth="35" navBar="true">
                <a:columns>
                    <a:column name="document_code" editorFunction="do_editer" lock="true" prompt="文档编码" width="100"/>
                    <a:column name="description" editor="sys_content_document_grid_edit_tf" lock="true" prompt="文档名称" width="140"/>
                    <a:column name="debugger_flag" align="center" editor="sys_content_document_grid_edit_cb" prompt="是否调试" width="60"/>
                    <a:column name="readonly_flag" align="center" editor="sys_content_document_grid_edit_cb" prompt="是否只读" width="60"/>
                    <a:column name="watermark" editor="sys_content_document_grid_edit_tf" prompt="水印" width="140"/>
                    <a:column name="pagesize" align="center" editor="sys_content_document_grid_edit_tf" prompt="纸张规格" width="60"/>
                    <a:column name="header" editor="sys_content_document_grid_edit_nf" prompt="页眉顶端距离" width="80"/>
                    <a:column name="footer" editor="sys_content_document_grid_edit_nf" prompt="页脚低端距离" width="80"/>
                    <a:column name="top" editor="sys_content_document_grid_edit_nf" prompt="上边距" width="60"/>
                    <a:column name="bottom" editor="sys_content_document_grid_edit_nf" prompt="下边距" width="60"/>
                    <a:column name="left" editor="sys_content_document_grid_edit_nf" prompt="左边距 " width="60"/>
                    <a:column name="right" editor="sys_content_document_grid_edit_nf" prompt="右边距 " width="60"/>
                    <a:column name="paragraphs" align="center" prompt="内容" renderer="do_render" width="60"/>
                    <a:column name="generate_flag" align="center" prompt="是否生成" width="60"/>
                    <a:column name="content_xml" align="center" prompt="文档源码" renderer="do_render" width="60"/>
                    <a:column name="preview" align="center" prompt="文档预览" renderer="do_render" width="60"/>
                    <a:column name="enabled_flag" align="center" editor="sys_content_document_grid_edit_cb" prompt="是否启用" width="60"/>
                </a:columns>
                <a:editors>
                    <a:textField id="sys_content_document_grid_edit_tf"/>
                    <a:checkBox id="sys_content_document_grid_edit_cb"/>
                    <a:numberField id="sys_content_document_grid_edit_nf" allowDecimals="true" allowNegative="false" decimalPrecision="2"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>