zj_wfl_graphics_preview.lview 4.74 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
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <model-query autoCount="false" fetchAll="true" model="zjwfl.zj_wfl_graphics" rootPath="graphics_record"/>
        <model-query autoCount="false" fetchAll="true" model="zjwfl.zj_wfl_graphics_preview" rootPath="graphics_detail_list"/>
    </a:init-procedure>
    <a:view>
        <a:link id="bmLink_reset_graphics" model="zjwfl.zj_wfl_graphics_detail" modelaction="execute"/>
        <a:link id="pageLink_edit_graphics" url="${/request/@context_path}/modules/zjwfl/zj_wfl_graphics_editor.lview"/>
        <a:link id="pageLink_sub_preview" url="${/request/@context_path}/modules/zjwfl/zj_wfl_graphics_preview_sub.lview"/>
        <a:link id="bmLink_getGraphic" model="zjwfl.zj_wfl_graphics" modelaction="query"/>
        <script type="text/javascript"><![CDATA[
        	function winClose_graphicsProview()
        	{
        	    $('zj_wfl_graphics_preview').close();
        	}
        	
        	function winOpen_graphics_preview_sub(workflow_id,width,height)
        	{
        	    new Leaf.Window({
                    id: 'zj_wfl_graphics_preview_sub',
                    url: $('pageLink_sub_preview').getUrl(),
                    params: {
                        workflow_id: workflow_id
                    },
                    title: '链接流程图',
                    height: height + 30,
                    width: width + 30
                });
        	}
        	
            function onClick_graphics(e, el, ds, record) {
                if(record){
	                var workflow_id = record.get('link_workflow_id');
	                if (Ext.isEmpty(workflow_id)) {
	                    return;
	                }
	                else
	                {
	                    
	                    Leaf.request({
			                url: $('bmLink_getGraphic').getUrl(),
			                para: {
			                	workflow_id:workflow_id
			                },
			                success: function(res) {
			                    var obj = res.result.record;
			                    winOpen_graphics_preview_sub(workflow_id,obj['width'],obj['height']);
			                },
			                failure: function() {
			                },
			                error: function() {
			                },
			                scope: this
			            });
	                }
                }
            }
            
            function previewPage_refresh()
            {
                graphics_preview_refresh();
            }
            
            function editGraphics() {
                var win = new Leaf.Window({
                    id: 'zj_wfl_graphics_editor',
                    url: $('pageLink_edit_graphics').getUrl(),
                    params: {
                        workflow_id: '${/parameter/@workflow_id}'
                    },
                    fullScreen: true,
                    className:'graphic_background'
                });
                win.on('close',function(){
                	previewPage_refresh();
                });
            }
            
            function resetGraphics() {
                Leaf.showConfirm('${l:PROMPT}', '是否需要重置图形编辑?', function() {
                    Leaf.request({
                        url: $('bmLink_reset_graphics').getUrl(),
                        para: {
                            workflow_id: '${/parameter/@workflow_id}'
                        },
                        success: editGraphics,
                        scope: this
                    });
                }, function() {
            
                   });
            }
            
            
        ]]></script>
        <a:dataSets>
            <a:dataSet id="graphics_detail_ds" model="zjwfl.zj_wfl_graphics_preview" queryUrl="${/request/@context_path}/autocrud/zjwfl.zj_wfl_graphics_preview/query?workflow_id=${/parameter/@workflow_id}">
                <a:datas dataSource="/model/graphics_detail_list"/>
                <a:fields>
                    <a:field name="type"/>
                    <a:field name="config"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:hBox>
                <a:button click="editGraphics" text="编辑"/>
                <a:button click="resetGraphics" text="重置"/>
            </a:hBox>
            <a:graphic id="graphics_preview_main" bindTarget="graphics_detail_ds" height="${/model/graphics_record/record/@height}" style="border:1px solid #ccc" width="${/model/graphics_record/record/@width}">
                <a:events>
                    <a:event name="click" handler="onClick_graphics"/>
                </a:events>
            </a:graphic>
        </a:screenBody>
    </a:view>
</a:screen>