sys_tasks.lview 5.94 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
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
    <a:init-procedure/>
    <a:view>
        <script type="text/javascript"><![CDATA[
            function showDetail(reocrd_index, fieldName, is_xml) {
                var dataSet = $('sys_tasks_ds');
                if (!dataSet) {
                    return;
                }
                var record = dataSet.getAt(reocrd_index);
                if (!record) {
                    return;
                }
                var content = record.get(fieldName);
                if (!content) {
                    return;
                }
                if (is_xml) {
                    content = content.replace(/</g, '&lt;');
                    content = content.replace(/>/g, '&gt;');
                    content = content.replace(/"/g, '&quot;');
                    // content = content.replace(/\n/g,'&emsp;');
                }
                Leaf.showMessage('${l:PROMPT}', content, null, 800, 500);
            }
            
            function exception_renderer(value, record, name) {
                var reocrd_index = $('sys_tasks_ds').indexOf(record);
                if (value) {
                    var url = '<a onclick="showDetail(' + reocrd_index + ',\'exception\')">查看明细 </a>';
                    return url;
            
                } else {
                    return '';
                }
            }
            
            function proc_content_renderer(value, record, name) {
                var reocrd_index = $('sys_tasks_ds').indexOf(record);
                if (value) {
                    var url = '<a onclick="showDetail(' + reocrd_index + ',\'proc_content\',\'Y\')">查看明细 </a>';
                    return url;
                } else {
                    return '';
                }
            }
          
            function status_renderer(value, record, name) {
                var status = record.get('status');
                if ("done" === status) {
                    return "完成";
                }
                if ("running" == status) {
                    return "运行中";
                }
                if ("exception" == status) {
                    return "有异常";
                }
                if ("wait" == status) {
                    return "进入队列";
                }
                return "新建";
            }
            
            function query() {
                $('sys_tasks_ds').query();
            }
            
            function reset() {
                $('sys_task_query_ds').reset();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="task_status">
                <a:datas>
                    <a:record code="done" desc="完成"/>
                    <a:record code="running" desc="运行中"/>
                    <a:record code="exception" desc="有异常"/>
                    <a:record code="new" desc="新建"/>
                    <a:record code="wait" desc="进入队列"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="sys_task_query_ds">
                <a:fields>
                    <a:field name="status_display" displayField="desc" options="task_status" returnField="status" valueField="code"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="sys_tasks_ds" autoQuery="true" canQuery="true" fetchAll="false" model="sys.sys_tasks_for_query" pageSize="15" queryDataSet="sys_task_query_ds" selectable="true"/>
        </a:dataSets>
        <a:form column="3" style="margin-left:10px;margin-top:10px;" title="PAGE_QUERY" width="800">
            <a:datePicker name="start_time_from" bindTarget="sys_task_query_ds" prompt="开始时间从" width="200">
                <a:events>
                    <a:event name="enterdown" handler="query"/>
                </a:events>
            </a:datePicker>
            <a:datePicker name="start_time_to" bindTarget="sys_task_query_ds" prompt="开始时间到" width="200">
                <a:events>
                    <a:event name="enterdown" handler="query"/>
                </a:events>
            </a:datePicker>
            <a:comboBox name="status_display" bindTarget="sys_task_query_ds" prompt="状态" width="140"/>
        </a:form>
        <a:hBox style="margin-left:7px;">
            <a:button click="query" text="HAP_QUERY"/>
            <a:button click="reset" text="HAP_RESET"/>
        </a:hBox>
        <a:grid id="sys_tasks_ds_grid" bindTarget="sys_tasks_ds" height="456" navBar="true" style="margin-left:10px;margin-top:10px;" width="1340">
            <a:toolBar>
                <a:button type="delete"/>
            </a:toolBar>
            <a:columns>
                <a:column name="task_name" prompt="任务" width="70"/>
                <a:column name="task_description" prompt="描述" width="150"/>
                <a:column name="user_description" prompt="用户" width="70"/>
                <a:column name="executor_instance" prompt="执行环境" width="50"/>
                <a:column name="priority" prompt="优先级" width="50"/>
                <a:column name="task_type" prompt="类型" width="100"/>
                <a:column name="sql" prompt="SQL" width="100"/>
                <a:column name="proc_file_path" prompt="处理文件路径" width="100"/>
                <a:column name="proc_content" align="center" prompt="处理内容" renderer="proc_content_renderer" width="150"/>
                <a:column name="start_time_view" align="center" prompt="开始时间" width="150"/>
                <a:column name="finished_time_view" align="center" editor="" prompt="结束时间" width="150"/>
                <a:column name="exception" align="center" prompt="异常信息" renderer="exception_renderer" width="90"/>
                <a:column name="status" align="center" prompt="状态" renderer="status_renderer" width="70"/>
            </a:columns>
        </a:grid>
    </a:view>
</a:screen>