zj_wfl_approve.lview 51.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:t="leaf.application.action" xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
    <a:init-procedure>
        <!--
    		权限控制
    	-->
        <s:server-script><![CDATA[
            var bm = $bm('zjwfl.ZJWFL5110.zj_wfl_check_approve_privilege');
            var result = bm.queryAsMap().getChildren();
            if (result[0].HAS_PRIVILEGE != 'Y') {
                var config = $config();
                var view = CompositeUtil.findChild(config, 'view');
                var list = view.getChilds();
                list.clear();
                var script = view.createChild('script');
                script.setText("wflCmp('zj_wfl_approve_win').close();alert('您没有权限查看');");
            }
        ]]></s:server-script>
        <a:model-query defaultWhereClause="t1.node_id = ${/parameter/@node_id}" model="zjwfl.zj_wfl_workflow_node_filter_node_id" rootPath="node_record"/>
        <a:model-query autocount="true" fetchall="true" model="zjwfl.sdic_wfl_workflow_node_action" rootpath="node_action"/>
        <a:model-query autocount="true" fetchall="true" model="zjwfl.zj_wfl_workflow_node_action_group" rootpath="node_action_group"/>
        <a:model-query autoCount="true" defaultWhereClause="t1.record_id = ${/parameter/@record_id}" fetchAll="true" model="zjwfl.ZJWFL5110.cus_zj_wfl_instance_node_recipient" rootPath="instance_one"/>
        <a:model-query defaultWhereClause="t1.record_id = ${/parameter/@record_id}" model="zjwfl.zj_wfl_node_service_wait_to_do" rootPath="node_service_record" trace="true"/>
xy's avatar
xy committed
24
        <a:model-query defaultWhereClause="t1.record_id = ${/parameter/@record_id}" model="zjwfl.zj_wfl_node_info_query" rootPath="node_info_record" trace="true"/>
25 26 27 28 29 30 31
        <s:server-script import="zjwfl_user_define.js"/>
    </a:init-procedure>
    <a:view>
        <style><![CDATA[
         .buttongroup .item-btn-tl,.buttongroup .item-btn-tc,.buttongroup .item-btn-tr,.buttongroup .item-btn-bl,.buttongroup .item-btn-bc,.buttongroup .item-btn-br,.buttongroup .item-btn-mr{
            display:none;
         }
xy's avatar
xy committed
32

33 34 35 36
         .buttongroup .item-btn{
            height:30px;
            border:none;
         }
xy's avatar
xy committed
37

38 39 40
         .buttongroup .item-btn-ml{
            background:url(${/request/@context_path}/images/button2.gif)
         }
xy's avatar
xy committed
41

42 43 44 45
         .buttongroup .item-btn-mc{
             background:url(${/request/@context_path}/images/button2.gif) right 0;
             padding:9px 8px 5px 0;
         }
xy's avatar
xy committed
46

47 48 49
         .buttongroup .item-btn-mc button div{
             color:#ffffff;
         }
xy's avatar
xy committed
50

51 52 53
         .buttongroup .item-btn-over .item-btn-mc{
             background:url(${/request/@context_path}/images/button2.gif) right -30px;
         }
xy's avatar
xy committed
54

55 56 57
         .buttongroup .item-btn-over .item-btn-ml{
             background:url(${/request/@context_path}/images/button2.gif) left -30px;
         }
xy's avatar
xy committed
58

59 60 61
         .buttongroup .item-btn-over button div{
             color:#000000;
         }
xy's avatar
xy committed
62

63
         .fixed {
xy's avatar
xy committed
64
             position:fixed;
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
             left:10px;
             bottom:10px;
             height:100px;
             width:150px;
             background:green;
             _position: absolute;/*IE6 用absolute模拟fixed*/
			 _top: expression(documentElement.scrollTop + 50 + "px");
			 _left:-152px ;
		   }
        ]]></style>
        <a:link id="svcLink_agree" url="${/request/@context_path}/modules/zjwfl/ZJWFL5110/zj_wfl_approve_agree.lsc"/>
        <a:link id="svcLink_refuse" url="${/request/@context_path}/modules/zjwfl/ZJWFL5110/zj_wfl_approve_refuse.lsc"/>
        <a:link id="svcLink_skip" url="${/request/@context_path}/modules/zjwfl/ZJWFL5110/zj_wfl_approve_skip.lsc"/>
        <a:link id="svcLink_do_proc" url="${/request/@context_path}/modules/zjwfl/ZJWFL5110/zj_wfl_approve_do_procedure.lsc"/>
        <a:link id="svcLink_view_page" url="${/request/@context_path}/modules/zjwfl/ZJWFL5110/zj_wfl_approve_view_page.lsc"/>
        <a:link id="pageLink_transfer" url="${/request/@context_path}/modules/zjwfl/ZJWFL5110/zj_wfl_approve_transfer.lview"/>
        <a:link id="pageLink_add_approver" url="${/request/@context_path}/modules/zjwfl/ZJWFL5110/zj_wfl_approve_add_approver.lview"/>
        <a:link id="pageLink_view_graphics" url="${/request/@context_path}/modules/zjwfl/zj_wfl_graphics.lview"/>
niminmin's avatar
niminmin committed
83
        <a:link id="zj_wfl_approve_upload_link_id" url="${/request/@context_path}/uploadFile.lview"/>
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
        <a:link id="zjwfl5110_notice_link" model="zjwfl.ZJWFL5110.zj_wfl_approve_agree" modelaction="execute"/>
        <script><![CDATA[

            function wflCmp(id) {
                var cmp = $L.CmpManager.get(id);
                if(cmp == null){
                    cmp = top.$L.CmpManager.get(id);
                }
                if (cmp == null) {
                    alert('未找到组件:' + id)
                    window.console && console.error('未找到组件:' + id);
                }
                return cmp;
            }

        	function zjwfl_before_approve_procedure(out_type){
        	    var params ={out_object:'out_object',
                    		out_type:'no_win'};
xy's avatar
xy committed
102
                return  params;
103
        	}
xy's avatar
xy committed
104

105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
            function zjwfl5110_approveCheck_type(type) {
                if (type == 'agree') {
                    return true;
                } else if (type == 'refuse') {
                    return true;
                } else if (type == 'do_proc') {
                    return true;
                } else if (type == 'jump') {
                    return true;
                } else if (type == 'view_page') {
                    return true;
                } else if (type == 'transfer_approver') {
                    return true;
                } else if (type == 'add_approver') {
                    return true;
niminmin's avatar
niminmin committed
120 121 122 123
                }else if (type == 'upload_attach') {
                    return true;
                }
                 else{
124 125 126
                    return false;
                }
            }
xy's avatar
xy committed
127

128 129
            (function() {
                var checker_list = {};
xy's avatar
xy committed
130

131 132 133
                zjwfl5110_ApproveChecker_add = function(name, fun) {
                    checker_list[name] = fun;
                };
xy's avatar
xy committed
134

135 136 137
                zjwfl5110_ApproveChecker_remove = function(name) {
                    delete checker_list[name];
                };
xy's avatar
xy committed
138

139 140 141
                zjwfl5110_ApproveChecker_check = function(type) {
                    for (var key in checker_list) {
                        if (checker_list[key](type) == true) {
xy's avatar
xy committed
142

143 144 145 146 147 148
                           } else {
                            return false;
                        }
                    }
                    return true;
                };
xy's avatar
xy committed
149

150
            })();
xy's avatar
xy committed
151

152 153 154 155 156 157 158
            function zjwfl5110_approveCheckNew(type) {
                if (zjwfl5110_approveCheck_type(type) && zjwfl5110_ApproveChecker_check(type)) {
                    return true;
                } else {
                    return false;
                }
            }
xy's avatar
xy committed
159

160
            function zjwfl5110_uploadAttach() {
niminmin's avatar
niminmin committed
161 162
                debugger;
                var rcpt_record_id = '${/parameter/@record_id}';
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
                var workflowCode ='${/model/node_info_record/record/@workflow_code}';
                if(workflowCode == 'ACR_INVOICE_REVERSE_WFL'){
                    var instance_id = '${/parameter/@instance_id}'
                    var url = $('zj_wfl_approve_upload_link_id').getUrl() + '?table_name=ZJ_WFL_INSTANCE_ACR_REVERSE&header_id=' + instance_id;
                    var win = new Leaf.Window({
                        url: url,
                        title: '附件上传',
                        id: 'zj_wfl_approve_history_downloadfile_win',
                        width: 850,
                        height: 400
                    });
                }else {
                    var url = $('zj_wfl_approve_upload_link_id').getUrl() + '?table_name=ZJ_WFL_INSTANCE_NODE_RECIPIENT&header_id=' + rcpt_record_id;
                    var win = new Leaf.Window({
                        url: url,
                        title: '附件上传',
                        id: 'zj_wfl_approve_history_downloadfile_win',
                        width: 850,
                        height: 400
                    });
                }
niminmin's avatar
niminmin committed
184 185 186 187 188 189
                win.on('close', function() {
                    zjwfl5110_approvePage_noMask();
                });



190
            }
xy's avatar
xy committed
191

192
            function zjwfl5110_approvePage_close() {
193 194
               // wflCmp('zj_wfl_approve_win').close();
                window.parent.location.reload();
195
            }
xy's avatar
xy committed
196

197 198 199 200 201 202 203
            function zjwfl5110_approvePage_mask() {
                if(parent.$jq("iframe[id='wfl_common_iframe']").length > 0) {
                    Leaf.Masker.mask(document.documentElement, '正在提交');
                }else{
                    Leaf.Masker.mask($('zj_wfl_approve_win').wrap);
                }
            }
xy's avatar
xy committed
204

205 206 207 208 209 210 211
            function zjwfl5110_approvePage_noMask() {
                if(parent.$jq("iframe[id='wfl_common_iframe']").length > 0) {
                    Leaf.Masker.unmask(document.documentElement);
                }else{
                    Leaf.Masker.unmask($('zj_wfl_approve_win').wrap);
                }
            }
xy's avatar
xy committed
212 213


214 215 216 217 218 219 220 221 222 223 224 225 226
            function zjwfl5110_actionTypeRenderer(value, record, name) {
                var action_type = record.get('action_type');
                var action_type_desc = record.get('action_type_desc');
                if (action_type == '1') {
                    return "<div style='background-color:rgb(127,255,0)'>" + action_type_desc + "</div>"; //同意,绿色
                } else if (action_type == '2') {
                    return "<div style='background-color:rgb(255,69,0)'>" + action_type_desc + "</div>"; //拒绝,红色
                } else if (action_type == '3') {
                    return "<div style='background-color:rgb(255,255,0)'>" + action_type_desc + "</div>"; //跳转,黄色
                } else {
                    return "";
                }
            }
xy's avatar
xy committed
227

228 229 230 231 232 233 234 235 236 237 238 239
            function zjwfl5110_viewGraphics() {
                new Leaf.Window({
                    id: 'zj_wfl_graphics',
                    url: $('pageLink_view_graphics').getUrl(),
                    params: {
                        instance_id: '${/parameter/@instance_id}',
                        workflow_id: '${/parameter/@workflow_id}'
                    },
                    title: '流程图',
                    fullScreen: true
                });
            }
xy's avatar
xy committed
240

241
            //初始化意见框内容
xy's avatar
xy committed
242

243
            function comment_text_ds_add(ds,record,index) {
Darming's avatar
Darming committed
244 245 246 247 248 249 250 251 252 253 254
                // var comment_text = '';
                // var position_code = '${/model/instance_one/record/@position_code}';
                // var node_sequence_num = '${/model/instance_one/record/@node_sequence_num}';
                // var workflow_code = '${/model/instance_one/record/@workflow_code}';
                //
                // if (position_code == '07' && workflow_code == 'PROJECT_APPLY' && node_sequence_num == '30') {
                //      comment_text = "项目结构:\n\n担保方式:\n\n资金来源:";
                // } else if (position_code == '03' && workflow_code == 'PROJECT_APPLY' && node_sequence_num == '30') {
                //      comment_text = "项目结构:\n\n税收筹划:\n\n财务分析:";
                // }
                // record.set('comment_text',comment_text);
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
            }
            function zjwfl5110_notice(){
                var comment_text = $('comment_text_ds').getAt(0).get('comment_text');
                var record_id = '${/parameter/@record_id}';
                Leaf.showConfirm('提示','是否关闭通知',function(){
                    Leaf.request({
                        url: $('zjwfl5110_notice_link').getUrl(),
                        para: {
                            record_id: record_id,
                            comment_text: comment_text
                        },
                        success: function(response) {
                            //解锁
                            zjwfl5110_approvePage_noMask();
                            if (response.result.result_num == 0) {
                                Leaf.SideBar.show({
                                    msg: '提交成功',
                                    duration: 2000
                                });
                                zjwfl5110_approvePage_close();
                            }
                        },
                        failure: function() {
                            zjwfl5110_approvePage_noMask();
                        },
                        error: function() {
                            zjwfl5110_approvePage_noMask();
                        },
                        scope: this
                    });
                });
            }
        ]]></script>
        <a:dataSets id="zjwfl_approve_datasets_id">
            <a:dataSet id="nodeActionDs">
                <a:datas dataSource="/model/node_action"/>
            </a:dataSet>
            <a:dataSet id="comment_text_ds" autoCreate="true">
                <a:fields>
stone's avatar
stone committed
294
                    <a:field name="comment_text" required="true"/>
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
                </a:fields>
                <a:events>
                    <a:event name="add" handler="comment_text_ds_add"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:fieldSet marginWidth="30" title="工作流信息">
                <table border="0" cellpadding="0" cellspacing="0" class="item-table" style="outline:none;width:100%;">
                    <tr>
                        <td atype="table-cell" class="table-hc" style="width:16%"><![CDATA[节点描述]]></td>
                        <td atype="table-cell" style="width:16%"><![CDATA[${/model/instance_one/record/@node_desc}]]></td>
                        <td atype="table-cell" class="table-hc" style="width:16%"><![CDATA[到达时间]]></td>
                        <td atype="table-cell" style="width:16%"><![CDATA[${/model/instance_one/record/@creation_date_format}]]></td>
                        <td atype="table-cell" class="table-hc" style="width:16%"><![CDATA[停留时间]]></td>
                        <td atype="table-cell" style="width:16%"><![CDATA[${/model/instance_one/record/@residence_date_format}]]></td>
                    </tr>
                    <tr>
                        <td atype="table-cell" class="table-hc"><![CDATA[工作流代码]]></td>
                        <td atype="table-cell"><![CDATA[${/model/instance_one/record/@workflow_code}]]></td>
                        <td atype="table-cell" class="table-hc"><![CDATA[工作流描述]]></td>
                        <td atype="table-cell"><![CDATA[${/model/instance_one/record/@workflow_desc}]]></td>
                        <td atype="table-cell" class="table-hc" style="width:16%"><![CDATA[流程图]]></td>
                        <td atype="table-cell" style="width:16%">
                            <a href="javascript:zjwfl5110_viewGraphics();"><![CDATA[查看]]></a>
                        </td>
                    </tr>
                </table>
            </a:fieldSet>
        </a:screenBody>
<!--        <a:vBox>-->
<!--            <a:hBox>-->
<!--                <a:box>-->
<!--                    <div style="color:red ;font-size:24px"><![CDATA[${/model/instance_one/record/@workflow_desc}]]></div>-->
<!--                </a:box>-->
<!--            </a:hBox>-->
<!--        </a:vBox>-->
        <a:switch test="/model/node_service_record/record/@service_url">
            <a:case value="DEFAULT">
                <a:screen-include screen="modules/zjwfl/zj_wfl_default_document_info.lview?instance_id=${/parameter/@instance_id}&amp;approve_count=${/model/instance_one/record/@approve_count}"/>
            </a:case>
            <a:case value="ERROR">
                <div style="color:red;"><![CDATA[自定义页面获取失败]]></div>
            </a:case>
            <a:case value="*">
xy's avatar
xy committed
340 341 342 343 344 345
                <a:switch test="/model/node_info_record/record/@workflow_code">
                    <a:case value="PROJECT_WFL">
                        <a:switch test="/model/node_info_record/record/@is_constru_unit">
                            <a:case value="Y">
                                <a:screen-include screen="${/model/node_service_record/record/@service_url_constru}&amp;winid=zj_wfl_approve_win&amp;instance_id=${/parameter/@instance_id}"/>
                            </a:case>
18083's avatar
18083 committed
346 347 348 349 350
                            <a:case value="N">
                                <a:switch test="/model/node_info_record/record/@division">
                                    <a:case value="95">
                                        <a:screen-include screen="${/model/node_service_record/record/@service_url_operat}&amp;winid=zj_wfl_approve_win&amp;instance_id=${/parameter/@instance_id}"/>
                                    </a:case>
xy's avatar
xy committed
351 352
                            <a:case value="*">
                                <a:screen-include screen="${/model/node_service_record/record/@service_url}&amp;winid=zj_wfl_approve_win&amp;instance_id=${/parameter/@instance_id}"/>
18083's avatar
18083 committed
353 354
                                    </a:case>
                                </a:switch>
xy's avatar
xy committed
355 356
                            </a:case>
                        </a:switch>
18083's avatar
18083 committed
357 358 359 360 361 362 363 364 365 366
                    </a:case>
				    <a:case value="DCFL_CSH_PAYMENT_REQ">
                      <a:switch test="/model/node_info_record/record/@payment_division">
                        <a:case value="95">
                             <a:screen-include screen="${/model/node_service_record/record/@service_url_operat_payment}&amp;winid=zj_wfl_approve_win&amp;instance_id=${/parameter/@instance_id}"/>
                        </a:case>
                        <a:case value="*">
                                <a:screen-include screen="${/model/node_service_record/record/@service_url}&amp;winid=zj_wfl_approve_win&amp;instance_id=${/parameter/@instance_id}"/>
                        </a:case>
                      </a:switch>
xy's avatar
xy committed
367 368 369 370 371
                    </a:case>
                    <a:case value="*">
                        <a:screen-include screen="${/model/node_service_record/record/@service_url}&amp;winid=zj_wfl_approve_win&amp;instance_id=${/parameter/@instance_id}"/>
                    </a:case>
                </a:switch>
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534
            </a:case>
        </a:switch>
        <a:switch test="/model/node_record/record/@show_approve_history_flag">
            <a:case value="Y">
                <a:screen-include screen="modules/zjwfl/zj_wfl_approve_history.lview?instance_id=${/parameter/@instance_id}&amp;reader_type=APPROVER&amp;node_id=${/parameter/@node_id}"/>
            </a:case>
        </a:switch>
        <a:screenBody>
            <a:vBox>
                <a:hBox>
                    <a:box>
                        <div><![CDATA[审批意见]]></div>
                        <a:textArea name="comment_text" id="comment_text_id" bindTarget="comment_text_ds" height="90" prompt="" width="550"/>
                    </a:box>
                    <table id="showbutton">
                        <tr>
                            <td id="showbuttongroup"/>
                            <a:switch test="/model/node_record/record/@can_transfer_approver_flag">
                                <a:case value="Y">
                                    <script><![CDATA[
	                            		function zjwfl5110_winOpen_transfer_approve() {
	                            		    if(!zjwfl5110_approveCheckNew('transfer_approver'))
							                {
							                    return;
							                }
							                var win = new Leaf.Window({
								                id: 'zj_wfl_approve_transfer_win',
								                url: $('pageLink_transfer').getUrl(),
								                params: {
								                    record_id : '${/parameter/@record_id}'
								                },
								                title: '转交',
								                width:500,
								                height:200
								            });
								            
								            win.on('close',function (){
								            	zjwfl5110_approvePage_close();
								            });
							            }
							        ]]></script>
                                    <td style="padding-right: 15px;">
                                        <a:gridButton click="zjwfl5110_winOpen_transfer_approve" text="转交"/>
                                    </td>
                                </a:case>
                            </a:switch>
                            <a:switch test="/model/node_record/record/@can_add_approver_flag">
                                <a:case value="Y">
                                    <script><![CDATA[
	                            		function zjwfl5110_winOpen_add_approver() {
	                            		    if(!zjwfl5110_approveCheckNew('add_approver'))
							                {
							                    return;
							                }
							                var win = new Leaf.Window({
								                id: 'zj_wfl_approve_add_approver_win',
								                url: $('pageLink_add_approver').getUrl(),
								                params: {
								                    record_id : '${/parameter/@record_id}'
								                },
								                title: '添加审批人',
								                width:650,
								                height:500
								            });
								            
								            win.on('close',function (){
								            	zjwfl5110_approvePage_close();
								            });
							            }
							        ]]></script>
                                    <td style="padding-right: 15px;">
                                        <a:gridButton click="zjwfl5110_winOpen_add_approver" text="添加审批人"/>
                                    </td>
                                </a:case>
                            </a:switch>
                            <!-- <td style="padding-right: 15px;">
                                <a:gridButton click="zjwfl5110_uploadAttach" text="附件"/>
                            </td>  -->
                            <td style="padding-right: 15px;">
                                <a:gridButton click="zjwfl5110_approvePage_close" text="返回"/>
                            </td>
                        </tr>
                    </table>
                </a:hBox>
            </a:vBox>
        </a:screenBody>
        <script><![CDATA[
            function zjwfl_approve_step(record_id, comment_text, node_action_id) {
                //设置请求的时间
                Ext.Ajax.timeout = 20 * 60 * 1000;
                Leaf.request({
                    url: $('svcLink_agree').getUrl(),
                    para: {
                        record_id: record_id,
                        comment_text: comment_text,
                        node_action_id: node_action_id
                    },
                    success: function(response) {
                        //解锁
                        zjwfl5110_approvePage_noMask();
                        if (response.result.result_num == 0) {
                            Leaf.SideBar.show({
                                msg: '提交成功',
                                duration: 2000
                            });
            
                            zjwfl5110_approvePage_close();
                        }
                    },
                    failure: function() {
                        zjwfl5110_approvePage_noMask();
                    },
                    error: function() {
                        zjwfl5110_approvePage_noMask();
                    },
                    scope: this
                });
            }
            
            function zjwfl5110_onButtonGroup(record, combobox_ds_id, wfl_node_action_id, wfl_node_action_prompt, wfl_action_type) {
                //在提交请求的过程中锁屏
                zjwfl5110_approvePage_mask();
                var node_action_id = '';
                var node_action_prompt = '';
                var action_type = '';
                if (record) {
                    node_action_id = record.get('node_action_id');
                    node_action_prompt = record.get('node_action_prompt');
                    action_type = record.get('action_type');
                } else {
                    if (combobox_ds_id) {
                        if ($(combobox_ds_id).validate()) {
                            var current_record = $(combobox_ds_id).getCurrentRecord();
                            node_action_id = current_record.get('node_action_id');
                            node_action_prompt = current_record.get('node_action_prompt');
                            action_type = current_record.get('action_type');
                        } else {
                            zjwfl5110_approvePage_noMask();
                            return;
                        }
                    } else {
                        if (wfl_node_action_id) {
                            node_action_id = wfl_node_action_id;
                            node_action_prompt = wfl_node_action_prompt;
                            action_type = wfl_action_type;
                        } else {
                            zjwfl5110_approvePage_noMask();
                            return;
                        }
                    }
                }
                var checkActionType = '';
                if (action_type == 1) {
                    checkActionType = 'agree';
                } else if (action_type == 2) {
                    checkActionType = 'refuse';
                } else if (action_type == 3) {
                    checkActionType = 'jump';
                } else if (action_type == 4) {
                    checkActionType = 'do_proc';
                } else if (action_type == 5) {
                    checkActionType = 'view_page';
                    zjwfl5110_onViewPage(record, combobox_ds_id, wfl_node_action_id, wfl_node_action_prompt, action_type);
niminmin's avatar
niminmin committed
535 536 537 538 539 540
                }
                else if (action_type == 7) {
                    checkActionType = 'upload_attach';
                    zjwfl5110_approvePage_noMask();
                    zjwfl5110_uploadAttach();
                }else {
541 542 543 544 545 546 547 548
                    zjwfl5110_approvePage_noMask();
                    return;
                }
            
                if (!zjwfl5110_approveCheckNew(checkActionType)) {
                    zjwfl5110_approvePage_noMask();
                    return;
                }
niminmin's avatar
niminmin committed
549
            if (action_type !== 7){
550 551 552 553
                if (!$('comment_text_ds').validate()) {
                    zjwfl5110_approvePage_noMask();
                    return;
                }
niminmin's avatar
niminmin committed
554 555
            }

556 557 558 559 560 561 562 563
                var record_id = '${/parameter/@record_id}';
                var comment_text = $('comment_text_id').getValue();
                var confirm_execute_flag = 'N';
                var out_type;
                var out_object;
                var params;
                //add by wangwei5743
                //查看页面类型,不需要弹出提示
niminmin's avatar
niminmin committed
564
                if (action_type != 5&&action_type != 7) {
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122
                    var win = Leaf.showConfirm('是否确认', node_action_prompt, function() {
                        confirm_execute_flag = 'Y';
                        if (action_type == 1) {
                            params = zjwfl_before_approve_procedure(out_type);
                            out_object = params.out_object;
                            out_type = params.out_type;
                            if (out_type == 'win') {
                                out_object.addListener('close', function() {
                                    zjwfl_approve_step(record_id, comment_text, node_action_id);
                                });
                            } else {
                                zjwfl_approve_step(record_id, comment_text, node_action_id);
                            }
                        } else {
                            zjwfl_approve_step(record_id, comment_text, node_action_id);
                        }
                    }, function() {
                        zjwfl5110_approvePage_noMask();
                    });
                    win.on('close', function() {
                        if (confirm_execute_flag == 'N') {
                            zjwfl5110_approvePage_noMask();
                        }
                    });
                }
            }
            
            
            function zjwfl5110_onAgree(record) {
                //在提交请求的过程中锁屏
                zjwfl5110_approvePage_mask();
            
                if (!zjwfl5110_approveCheckNew('agree')) {
                    zjwfl5110_approvePage_noMask();
                    return;
                }
            
                if (!$('comment_text_ds').validate()) {
                    zjwfl5110_approvePage_noMask();
                    return;
                }
                var record_id = '${/parameter/@record_id}';
                var comment_text = $('comment_text_id').getValue();
                var node_action_id = record.get('node_action_id');
                var out_type;
                var out_object;
                var params;
                Leaf.showConfirm('是否确认', record.get('node_action_prompt'), function() {
                    params = zjwfl_before_approve_procedure(out_type);
                    out_object = params.out_object;
                    out_type = params.out_type;
                    if (out_type == 'win') {
                        out_object.addListener('close', function() {
                            zjwfl_approve_step(record_id, comment_text, node_action_id);
                        });
                    } else {
                        zjwfl_approve_step(record_id, comment_text, node_action_id);
                    }
                }, function() {
                    zjwfl5110_approvePage_noMask();
                });
            }
            
            function zjwfl5110_onRefuse(record) {
            
                //在提交请求的过程中锁屏
                zjwfl5110_approvePage_mask();
            
                if (!zjwfl5110_approveCheckNew('refuse')) {
                    zjwfl5110_approvePage_noMask();
                    return;
                }
                if (!$('comment_text_ds').validate()) {
                    zjwfl5110_approvePage_noMask();
                    return;
                }
                var record_id = '${/parameter/@record_id}';
                var comment_text = $('comment_text_id').getValue();
                var node_action_id = record.get('node_action_id');
            
                Leaf.showConfirm('是否确认', record.get('node_action_prompt'), function() {
            
                    //设置请求的时间
                    Ext.Ajax.timeout = 20 * 60 * 1000;
            
                    Leaf.request({
                        url: $('svcLink_refuse').getUrl(),
                        para: {
                            record_id: record_id,
                            comment_text: comment_text,
                            node_action_id: node_action_id
                        },
                        success: function(response) {
                            //解锁
                            zjwfl5110_approvePage_noMask();
            
                            if (response.result.result_num == 0) {
                                Leaf.SideBar.show({
                                    msg: '提交成功',
                                    duration: 2000
                                });
            
                                zjwfl5110_approvePage_close();
                            }
                        },
                        failure: function() {
                            zjwfl5110_approvePage_noMask();
                        },
                        error: function() {
                            zjwfl5110_approvePage_noMask();
                        },
                        scope: this
                    });
            
                }, function() {
                    zjwfl5110_approvePage_noMask();
                });
            }
            
            function zjwfl5110_onSkip(record) {
            
                //在提交请求的过程中锁屏
                zjwfl5110_approvePage_mask();
            
                if (!zjwfl5110_approveCheckNew('jump')) {
                    zjwfl5110_approvePage_noMask();
                    return;
                }
                if (!$('comment_text_ds').validate()) {
            
                    zjwfl5110_approvePage_noMask();
                    return;
                }
                var record_id = '${/parameter/@record_id}';
                var comment_text = $('comment_text_id').getValue();
                var node_action_id = record.get('node_action_id');
            
            
                Leaf.showConfirm('是否确认', record.get('node_action_prompt'), function() {
            
                    //设置请求的时间
                    Ext.Ajax.timeout = 20 * 60 * 1000;
            
                    Leaf.request({
                        url: $('svcLink_skip').getUrl(),
                        para: {
                            record_id: record_id,
                            comment_text: comment_text,
                            node_action_id: node_action_id
                        },
                        success: function(response) {
                            //解锁
                            zjwfl5110_approvePage_noMask();
            
                            if (response.result.result_num == 0) {
                                Leaf.SideBar.show({
                                    msg: '提交成功',
                                    duration: 2000
                                });
            
                                zjwfl5110_approvePage_close();
                            }
                        },
                        failure: function() {
                            zjwfl5110_approvePage_noMask();
                        },
                        error: function() {
                            zjwfl5110_approvePage_noMask();
                        },
                        scope: this
                    });
            
                }, function() {
                    zjwfl5110_approvePage_noMask();
                });
            }
            
            function zjwfl5110_onProcedure(record) {
            
                //在提交请求的过程中锁屏
                zjwfl5110_approvePage_mask();
            
                if (!zjwfl5110_approveCheckNew('do_proc')) {
                    zjwfl5110_approvePage_noMask();
                    return;
                }
            
                var record_id = '${/parameter/@record_id}';
                var node_action_id = record.get('node_action_id');
            
                Leaf.showConfirm('是否确认', record.get('node_action_prompt'), function() {
            
                    //设置请求的时间
                    Ext.Ajax.timeout = 20 * 60 * 1000;
                    Leaf.request({
                        url: $('svcLink_do_proc').getUrl(),
                        para: {
                            record_id: record_id,
                            node_action_id: node_action_id
                        },
                        success: function(response) {
                            //解锁
                            zjwfl5110_approvePage_noMask();
            
                            if (response.result.result_num == 0) {
                                Leaf.SideBar.show({
                                    msg: '提交成功',
                                    duration: 2000
                                });
            
                                zjwfl5110_approvePage_close();
                            }
                        },
                        failure: function() {
                            zjwfl5110_approvePage_noMask();
                        },
                        error: function() {
                            zjwfl5110_approvePage_noMask();
                        },
                        scope: this
                    });
            
                }, function() {
                    zjwfl5110_approvePage_noMask();
                });
            }
            
            /*  //上传附件
             function zjwfl5110_uploadAttach() {
             var rcpt_record_id = '${/parameter/@record_id}';
             new Leaf.Window({
             id: 'zj_wfl_approve_history_downloadfile_win',
             //url: $('zj_wfl_approve_upload_link_id').getUrl() + '?table_name=ZJ_WFL_APPROVE_RECORD&header_id=' + rcpt_record_id,
             url: $('zj_wfl_approve_upload_link_id').getUrl() + '?document_table=ZJ_WFL_APPROVE_RECORD&document_id=' + rcpt_record_id,
             title: '附件查看',
             width: 850,
             height: 400
             });
             } */
            
            
            
            
            function zjwfl5110_onViewPage(record, combobox_ds_id, wfl_node_action_id, wfl_node_action_prompt, action_type) {
                //在提交请求的过程中锁屏
                zjwfl5110_approvePage_mask();
            
                if (!zjwfl5110_approveCheckNew('view_page')) {
                    zjwfl5110_approvePage_noMask();
                    return;
                }
            
                var record_id = '${/parameter/@record_id}';
                var node_action_id = '';
                if (record) {
                    node_action_id = record.get('node_action_id');
                } else {
                    if (combobox_ds_id) {
                        if ($(combobox_ds_id).validate()) {
                            var current_record = $(combobox_ds_id).getCurrentRecord();
                            node_action_id = current_record.get('node_action_id');
                        } else {
                            zjwfl5110_approvePage_noMask();
                            return;
                        }
                    } else {
                        if (wfl_node_action_id) {
                            node_action_id = wfl_node_action_id;
                        } else {
                            zjwfl5110_approvePage_noMask();
                            return;
                        }
                    }
                }
            
                //Leaf.showConfirm('是否确认', '是否确认?', function() {
            
                //设置请求的时间
                Ext.Ajax.timeout = 20 * 60 * 1000;
                Leaf.request({
                    url: $('svcLink_view_page').getUrl(),
                    para: {
                        record_id: record_id,
                        node_action_id: node_action_id
                    },
                    success: function(response) {
                        //解锁
                        zjwfl5110_approvePage_noMask();
                      
                        var result = response.result;
            
                        if (result.result_num == 0) {
                            // add by wangwei
                            //指派页面不为全屏
                            var w = result.service_url.indexOf('?');
                            var service_name = result.service_url.substring(0, w);
                            if (service_name.trim() != 'modules/wfl_screen/sdic_workflow_assigned.lview'&&service_name.trim() != 'modules/wfl_screen/hn_wfl_unit_assigned.lview'&&service_name.trim() != 'modules/wfl_screen/sdic_workflow_assigned_unit.lview') {
                                new Leaf.Window({
                                    id: 'zj_wfl_workflow_service_window',
                                    url: '${/request/@context_path}/' + result.service_url,
                                    title: '',
                                    fullScreen: true
                                });
                            } else if (service_name.trim() == 'modules/wfl_screen/sdic_workflow_assigned.lview') {
                                var comment_text = $('comment_text_id').getValue();
                                new Leaf.Window({
                                    id: 'zj_wfl_workflow_service_window',
                                    url: '${/request/@context_path}/' + result.service_url,
                                    params:{
                                        comment_text:comment_text
                                    },
                                    title: '',
                                    width: 650,
                                    height: 530
                                });
                            } else if (service_name.trim() == 'modules/wfl_screen/hn_wfl_unit_assigned.lview') {
                                new Leaf.Window({
                                    id: 'zj_wfl_workflow_service_window',
                                    url: '${/request/@context_path}/' + result.service_url,
                                    title: '',
                                    width: 650,
                                    height: 530
                                });
                            }else if (service_name.trim() == 'modules/wfl_screen/sdic_workflow_assigned_unit.lview') {
                                
                                new Leaf.Window({
                                    id: 'zj_wfl_workflow_service_window',
                                    url: '${/request/@context_path}/' + result.service_url,
                                    title: '',
                                    width: 650,
                                    height: 530
                                });
                            }
            
                        }
                    },
                    failure: function() {
                        zjwfl5110_approvePage_noMask();
                    },
                    error: function() {
                        zjwfl5110_approvePage_noMask();
                    },
                    scope: this
                });
            
                /*  }, function() {
                 zjwfl5110_approvePage_noMask();
                 }); */
            }
            
            function initButton() {
            
                var node_action_ds = $('nodeActionDs');
                var datalist = node_action_ds.getAll();
            
                var record_type = '${/parameter/@record_type}';
            
                if (record_type == 'APPROVER') {
            
                    for (var n = datalist.length;n > 0;n--) {
                        var i = n - 1;
                        var node_action = datalist[i];
                        var table = document.getElementById("showbutton");
                        // var newTD = table.rows[0].insertCell(0);
                        // newTD.style.cssText = 'padding-right:15px';
                        // var buttonTpl = "<TABLE action_id='{action_id}'  class='item-btn' style=';width:60px;' id='{id}' cellSpacing='0'><TBODY><TR><TD class='item-btn-tl'><I></I></TD><TD class='item-btn-tc'></TD><TD class='item-btn-tr'><I></I></TD></TR><TR><TD class='item-btn-ml'><I></I></TD><TD class='item-btn-mc'><BUTTON type='button' hidefocus='true' atype='btn' title='' style='height:16px;' class=''><div style='line-height:16px;height:16px;'>{action_desc}</div></BUTTON></TD><TD class='item-btn-mr'><I></I></TD></TR><TR><TD class='item-btn-bl'><I></I></TD><TD class='item-btn-bc'></TD><TD class='item-btn-br'><I></I></TD></TR></TBODY></TABLE>";
                        // var btnid = 'btn_' + i;
                        // var bindaction_id = node_action.get('node_action_id');
                        // var bindaction_desc = node_action.get('node_action_desc');
                        // new Ext.Template(buttonTpl).insertFirst(newTD, {
                        // id: btnid,
                        // action_desc: bindaction_desc,
                        // action_id: bindaction_id
                        // });
            
            
                        //根据动作类型,动态设置按钮的执行事件
                        // var action_type = node_action.get('action_type');
            
                        // function create_sigle_button(action_type) {
                        // switch (action_type) {
                        // case '1':
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_onAgree.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // break;
                        // case '2':
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_onRefuse.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // break;
                        // case '3':
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_onSkip.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // break;
                        // case '4':
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_onProcedure.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // break;
                        // case '6':
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_uploadAttach.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // break;
                        // default:
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_onViewPage.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // }
                        // }
            
                        // function create_button_group(action_type) {
                        // switch (action_type) {
                        // case '1':
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_onAgree.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // break;
                        // case '2':
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_onRefuse.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // break;
                        // case '3':
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_onSkip.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // break;
                        // case '4':
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_onProcedure.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // break;
                        // case '6':
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_uploadAttach.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // break;
                        // default:
                        // new Leaf.Button({
                        // "id": btnid,
                        // "listeners": {
                        // "click": zjwfl5110_onViewPage.createDelegate(this, [node_action])
                        // },
                        // "height": 16,
                        // "width": 60,
                        // "required": false,
                        // "readonly": false
                        // });
                        // }
                        // }
                    }
                } else if (record_type == 'NOTICE') {
                    var table = document.getElementById("showbutton");
                    var newTD = table.rows[0].insertCell(0);
                    newTD.style.cssText = 'padding-right:15px';
                    var buttonTpl = "<TABLE action_id='{action_id}'  class='item-btn' style=';width:60px;' id='{id}' cellSpacing='0'><TBODY><TR><TD class='item-btn-tl'><I></I></TD><TD class='item-btn-tc'></TD><TD class='item-btn-tr'><I></I></TD></TR><TR><TD class='item-btn-ml'><I></I></TD><TD class='item-btn-mc'><BUTTON type='button' hidefocus='true' atype='btn' title='' style='height:16px;' class=''><div style='line-height:16px;height:16px;'>{action_desc}</div></BUTTON></TD><TD class='item-btn-mr'><I></I></TD></TR><TR><TD class='item-btn-bl'><I></I></TD><TD class='item-btn-bc'></TD><TD class='item-btn-br'><I></I></TD></TR></TBODY></TABLE>";
                    var btnid = 'btn_notice';
                    new Ext.Template(buttonTpl).insertFirst(newTD, {
                        id: btnid,
                        action_desc: '关闭',
                        action_id: 'btn_notice_action'
                    });
                    new Leaf.Button({
                        "id": btnid,
                        "listeners": {
                            "click": zjwfl5110_notice
                        },
                        "height": 16,
                        "width": 60,
                        "required": false,
                        "readonly": false
                    });
                }
            }
            initButton();
        ]]></script>
    </a:view>
</a:screen>