sch_concurrent_job_maintain.lview 13.9 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 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="pageLink_job_log" url="${/request/@context_path}/modules/sch/SCH111/sch_concurrent_job_log.lview"/>
        <a:link id="pageLink_view_programe" url="${/request/@context_path}/modules/sch/SCH111/sch_concurrent_job_programe.lview"/>
        <a:link id="pageLink_job_create" url="${/request/@context_path}/modules/sch/SCH111/sch_concurrent_job_create.lview"/>
        <a:link id="bmLink_jobStatusHandle" model="sch.SCH111.sch_concurrent_job" modelaction="update"/>
        <a:link id="pageLink_jobParaUpdate" url="${/request/@context_path}/modules/sch/SCH111/sch_concurrent_job_para.lview"/>
        <script type="text/javascript"><![CDATA[
        
        function hls_sch111_query() {
            jobDs_refresh();
        }
        
        function jobDs_refresh()
        {
            $('jobDs').query();
        }
        
        function jobHandle(operation_type)
        {
            var record = $('jobDs').getCurrentRecord();
            if (Ext.isEmpty(record)) {
                Leaf.showMessage('${l:PROMPT}', '请至少选择一条数据!');
                return;
            }
            
            var msgConfig={SLEEP:'暂挂',WAKE:'恢复',DELETE:'删除'};
            
            if(record.get('cycle_flag')=='N')
            {
                if(operation_type=='SLEEP'||operation_type=='WAKE')
                {
                    Leaf.showMessage('${l:PROMPT}', '非周期性任务不能'+msgConfig[operation_type]);
                    return;
                }
                if(record.get('job_status')=='WAITING' && operation_type=='DELETE')
                {
                    
                }
                else
                {
                    Leaf.showMessage('${l:PROMPT}', '非周期性任务只能在等待状态才能'+msgConfig[operation_type]);
                	return;
                }
                
            }
            
            var job_id=record.get('job_id');
            
            
            Leaf.showConfirm('${l:PROMPT}', msgConfig[operation_type]+'是否确认?', function()
            {
                Leaf.request(
                {
                    url: $('bmLink_jobStatusHandle').getUrl(),
                    para: {
                        job_id:job_id,
                    	operation_type:operation_type
                    },
                    success: function() {
                        Leaf.SideBar.show({
	                        msg: '操作成功!',
	                        duration: 2000
	                    });
                        jobDs_refresh();
                    },
                    scope: this
                });
            });
        }
        
        function job_sleep()
        {
            jobHandle('SLEEP');
        }
        
        function job_wake()
        {
            jobHandle('WAKE');
        }
        function job_stop()
        {
            jobHandle('DELETE');
        }
        
        
        function winOpen_job_para(job_id,cycle_flag,task_code,job_status)
        {
            // var maintain_type='';
                
            // if(cycle_flag=='Y' && (job_status != 'FINISH' || job_status != 'DELETE'))
            // {
                // maintain_type='UPDATE';
            // }
            // else
            // {
                // maintain_type='READONLY';
            // }
            
            var maintain_type = 'READONLY';
            
            new Leaf.Window({
                id: 'sch_concurrent_job_para',
                url: $('pageLink_jobParaUpdate').getUrl(),
                params:{
                	job_id:job_id,
                	task_code:task_code,
                	maintain_type:maintain_type
                },
                title: '${l:SCH111.WIN_TITLE.JOB_PARA}',
                width:600,
                height:450
            });
        }
        
        function winOpen_job_log(job_id)
        {
            new Leaf.Window({
                id: 'win_job_log',
                url: $('pageLink_job_log').getUrl(),
                params:{
                	job_id:job_id
                },
                title: '${l:SCH111.WIN_TITLE.JOB_LOG}',
                width:800,
                height:550
            });
           
        }
        
        function winClose_view_programe()
        {
            $('win_view_programe').close();
        }
        
        function winOpen_view_programe(job_id)
        {
            new Leaf.Window({
                id: 'win_view_programe',
                url: $('pageLink_view_programe').getUrl(),
                params:{
                	job_id:job_id
                },
                title: '${l:SCH111.WIN_TITLE.VIEW_PROGRAME}',
                width:700,
                height:420
            });
        }
        
        function winClose_job_log()
        {
            $('win_job_log').close();
        }
        
        function winOpen_job_create()
        {
            var win = new Leaf.Window({
                id: 'sch_concurrent_job_create',
                url: $('pageLink_job_create').getUrl(),
                title: '${l:SCH111.SCH_CONCURRENT_JOB.JOB_CREATE}',
                width:600,
                height:500
            });
            
            win.on('close',function (){
            	jobDs_refresh();
            });
        }
        
        
        function render_jobDs_grid(value, record, name) {
            if(name=='job_para')
            {
                if(!record.isNew){
		            return '<a href="javascript:winOpen_job_para(' + record.get('job_id') + ',\''+ record.get('cycle_flag') +'\',\'' + record.get('task_code') +'\',\'' + record.get('job_status') + '\');">' + '${l:SCH111.WIN_TITLE.JOB_PARA}' + '</a>';
	            }
	            return '';
            }
            if(name=='job_status_name')
            {
                var status = record.get('job_status');
                var statusColor=
	            {
	                RUNNING:'00FF00',
	                FINISH:'',
	                SCHEDULED:'00FF00',
	                DELETE:'',
	                ERROR:'FF0000',
	                SLEEP:'FFFF00',
	                WAITING:'FFFF00'
	            };
	            if(Ext.isEmpty(statusColor[status]))
	            {
	                return value;
	            }
	            return "<div style='background-color:#"+statusColor[status]+"'>" + value + "</div>";
            }
            else if(name=='job_log')
            {
                if(!record.isNew){
		            return '<a href="javascript:winOpen_job_log(' + record.get('job_id') + ');">' + '${l:SCH111.WIN_TITLE.JOB_LOG}' + '</a>';
	            }
	            return '';
            }
            else if(name=='view_programe')
            {
                if(!record.isNew){
		            return '<a href="javascript:winOpen_view_programe(' + record.get('job_id') + ');">' + '${l:SCH111.WIN_TITLE.VIEW_PROGRAME}' + '</a>';
	            }
	            return '';
            }
            
        }
        
        ]]></script>
        <a:dataSets>
            <a:dataSet id="checkBoxValueDs">
                <a:datas>
                    <a:record code_value="ALL" code_value_name="全部"/>
                    <a:record code_value="Y" code_value_name="是"/>
                    <a:record code_value="N" code_value_name="否"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="jobStatusDs" lookupCode="SCH_JOB_STATUS"/>
            <a:dataSet id="para_jobDs" autoCreate="true" model="sch.SCH111.sch_concurrent_job">
                <a:fields>
                    <a:field name="cycle_flag_desc" displayField="code_value_name" options="checkBoxValueDs" prompt="SCH111.SCH_CONCURRENT_JOB.CYCLE_FLAG" returnField="cycle_flag" valueField="code_value"/>
                    <a:field name="task_name" lovGridHeight="300" lovHeight="450" lovService="sch.SCH111.sch_task_for_lov" lovWidth="500" title="选择任务">
                        <a:mapping>
                            <a:map from="task_code" to="task_code"/>
                            <a:map from="task_name" to="task_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="schedule_name" lovGridHeight="300" lovHeight="450" lovService="sch.SCH111.sch_schedule_for_lov" lovWidth="500" title="选择任务">
                        <a:mapping>
                            <a:map from="schedule_name" to="schedule_code"/>
                            <a:map from="short_desc" to="schedule_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="job_status_name" displayField="code_value_name" options="jobStatusDs" returnField="job_status" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="jobDs" autoPageSize="true" autoQuery="true" model="sch.SCH111.sch_concurrent_job" queryDataSet="para_jobDs" selectable="true" selectionModel="single">
                <a:fields>
                    <a:field name="what" readOnly="true"/>
                    <a:field name="cycle_flag" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="create_sub_job_flag" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="task_code" required="true"/>
                    <a:field name="task_name" required="true"/>
                    <a:field name="procedure_name" required="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls_sch111_query" text="HLS.QUERY"/>
                <a:gridButton click="winOpen_job_create" text="SCH111.SCH_CONCURRENT_JOB.JOB_CREATE"/>
                <a:gridButton click="job_sleep" text="SCH111.SCH_CONCURRENT_JOB.JOB_SLEEP"/>
                <a:gridButton click="job_wake" text="SCH111.SCH_CONCURRENT_JOB.JOB_WAKE"/>
                <a:gridButton click="job_stop" text="SCH111.SCH_CONCURRENT_JOB.JOB_STOP"/>
            </a:screenTopToolbar>
            <a:form column="5" labelWidth="100" marginWidth="30" title="HAP_QUERY_TITLE">
                <a:numberField name="job_id" allowDecimals="false" allowNegative="false" bindTarget="para_jobDs"/>
                <a:lov name="task_name" bindTarget="para_jobDs"/>
                <a:lov name="schedule_name" bindTarget="para_jobDs"/>
                <a:comboBox name="cycle_flag_desc" bindTarget="para_jobDs"/>
                <a:datePicker name="job_start_date" bindTarget="para_jobDs"/>
                <a:numberField name="parent_job_id" allowDecimals="false" allowNegative="false" bindTarget="para_jobDs"/>
                <a:textField name="description" bindTarget="para_jobDs"/>
                <a:comboBox name="job_status_name" bindTarget="para_jobDs"/>
            </a:form>
            <a:tabPanel marginHeight="220" marginWidth="30">
                <a:tabs>
                    <a:tab prompt="基本信息" width="100">
                        <a:grid id="jobDs_grid" bindTarget="jobDs" marginHeight="250" marginWidth="35" navBar="true">
                            <a:columns>
                                <a:column name="job_id" align="right" width="60"/>
                                <a:column name="parent_job_id" align="right" width="60"/>
                                <a:column name="description" autoAdjust="false" showTitle="true" width="230"/>
                                <a:column name="job_status_name" align="center" autoAdjust="false" renderer="render_jobDs_grid" resizable="false" width="60"/>
                                <a:column name="task_name" autoAdjust="false" showTitle="true" width="200"/>
                                <a:column name="schedule_name" autoAdjust="false" showTitle="true" width="150"/>
                                <a:column name="job_start_date" width="130"/>
                                <a:column name="job_end_date" width="130"/>
                                <a:column name="run_times" align="right" width="60"/>
                                <a:column name="error_times" align="right" width="60"/>
                                <a:column name="job_log" align="center" prompt="SCH111.WIN_TITLE.JOB_LOG" renderer="render_jobDs_grid" width="50"/>
                            </a:columns>
                        </a:grid>
                    </a:tab>
                    <a:tab prompt="其他信息" width="100">
                        <a:grid id="jobDs_grid2" bindTarget="jobDs" marginHeight="250" marginWidth="35" navBar="true">
                            <a:columns>
                                <a:column name="job_id" align="right" width="60"/>
                                <a:column name="parent_job_id" align="right" width="60"/>
                                <a:column name="description" autoAdjust="false" showTitle="true" width="230"/>
                                <a:column name="job_status_name" align="center" autoAdjust="false" renderer="render_jobDs_grid" resizable="false" width="60"/>
                                <a:column name="cycle_flag" width="50"/>
                                <a:column name="job_last_run_time" width="130"/>
                                <a:column name="job_next_run_time" width="130"/>
                                <a:column name="job_log" align="center" prompt="SCH111.WIN_TITLE.JOB_LOG" renderer="render_jobDs_grid" width="50"/>
                                <a:column name="view_programe" align="center" prompt="SCH111.WIN_TITLE.VIEW_PROGRAME" renderer="render_jobDs_grid" width="50"/>
                                <a:column name="job_para" align="center" prompt="SCH111.WIN_TITLE.JOB_PARA" renderer="render_jobDs_grid" width="50"/>
                            </a:columns>
                        </a:grid>
                    </a:tab>
                </a:tabs>
            </a:tabPanel>
        </a:screenBody>
    </a:view>
</a:screen>