A-A+

通达OA-工作量表单限制发起人才能删除

2018年11月16日 通达oa 暂无评论 阅读 168 views 次

1、修改弹出框的js文件

文件:D:\MYOA\webroot\general\workflow\list\js\work_operation.js

找到:function work_run_pending(pageName)

function work_run_pending(pageName)
{
   if(checkSelectRows()){
      loadModal();
      open_bootcss_modal("myModal","880","5");
      jQuery('.modal-body').load('data/'+pageName+'.php',function(){
         var selectRows = getSelectRows();
         if(selectRows == ""){
            return false;
         }
            var resultData = getRunData(selectRows)
            var aaa1 = resultData.runData[0].create_man;
            var geturl = 'http://' + window.location.host + '/general/getloginuser.php';
            jQuery.ajax({
                type: "GET",
                url: geturl,
                dataType: 'json',
                success: function(data){
                    var login_name = data.login_name;
                    if(aaa1 == login_name){
                        jQuery('#myModalLabel').html('作废');
                        jQuery('.quick-date-select').show();
                        var Data = {"runData":resultData.runData}
                        var template = jQuery.templates("#pendingDataTmpl");
                        var htmlOutput = template.render(Data);
                        jQuery("#pendingData").html(htmlOutput);
                        jQuery('.quick-date-select').click(function(){
                            var padding_id = jQuery(this).attr("pending");
                            jQuery("#"+padding_id).click();
                        });
                    }else{
                        alert('只有发起人可以作废');
                        return false;
               }
                }
            });

         // console.log(resultData.runData[0]);


         // jQuery('#myModalLabel').html(td_lang.general.workflow.msg_60);




      });
   }
}

红色部分是添加的内容,用ajax请求获取当前登录用户名,比较表单提交的用户名。

因为无法获取当前选中表单数据的提交人,所以还需要传递给此表单用户数据

继续当前文档找function getRunData(selectRows){

function getRunData(selectRows){
   var runData = new Array();
   var runFlowData = new Array();
   var flowDelegateTypeArr = new Array();
   for(var i = 0; i < selectRows.length; i++){
      var dataTr = jQuery(window.frames["workflow-data-list"].document).find("#gridTable").find("tr[role='row'][id='"+selectRows[i]+"']");
      var flow_id = dataTr.find("td[aria-describedby='gridTable_flow_id']").html();
      var delegate_type = dataTr.find("td[aria-describedby='gridTable_delegate_type']").html();
      flowDelegateTypeArr.push(delegate_type);
      var run_id = dataTr.find("td[aria-describedby='gridTable_run_id']").html();
      var prcs_key_id = dataTr.find("td[aria-describedby='gridTable_prcs_key_id']").html();
      var run_name = dataTr.find("td[aria-describedby='gridTable_run_name']").find('a').html();
      var prcs_name = dataTr.find("td[aria-describedby='gridTable_prcs_name']").find('a').html();
      var create_man = dataTr.find("td[aria-describedby='gridTable_create_man']").find('a').html();
      var flow_prcs = dataTr.find("td[aria-describedby='gridTable_flow_prcs']").html();
      var prcs_id = (prcs_name.match(/\d/g))[0];
      runFlowData.push(flow_id+"_"+prcs_id);
      var selectData = {
         'run_id':run_id, 
         'run_name':run_name, 
         'prcs_name':prcs_name, 
         'create_man':create_man,
         'prcs_key_id':prcs_key_id,
         'flow_id':flow_id, 
         'prcs_id':prcs_id, 
         'delegate_type':delegate_type, 
         'flow_prcs':flow_prcs
      };
      runData.push(selectData);
   }
   var resultData = {"runData" : runData, "flowDelegateTypeArr":flowDelegateTypeArr, "runFlowDataArr":runFlowData};
   //alert(runFlowData.join(",").match(/28,/g).length);
   return resultData; //runData;
}

如此work_run_pending中就能获取到当前选中表单提交人的信息了。

 

2、添加文件D:\MYOA\webroot\general\getloginuser.php

内容如下:

<?php

include_once("inc/auth.inc.php");

include_once("inc/conn.php");

 

$username = $_SESSION["LOGIN_USER_NAME"];
$data['login_name'] = iconv('gb2312','utf-8',$username);
echo json_encode($data);

?>

1

标签:

给我留言