• 流程


    新建流程

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script src="../jquery-1.11.2.min.js"></script>
    <?php
    session_start();
    include("../DBDA.class.php");
    $db=new DBDA();
    $sql="select * from user";
    $attr=$db->Query($sql);
    ?>
    </head>
    
    <body>
    <h1>新建流程</h1>
    <div>
    	<div>请选择节点人员</div><br />
        <div>
        <?php
    	foreach($attr as $v)
    	{
    		echo "<input type='radio' class='ry' name='ry' value='{$v[0]}' />$v[2]   ";
    	}
    	?>
        </div><br />
        <div><input type="button" value="添加节点" id="addjiedian" /></div><br />
        <div id="jiedian">
        <?php
    	//判断session里有没有存节点人员
    	if(!empty($_SESSION["jiedian"]))
    	{
    		$attr=$_SESSION["jiedian"];
    		foreach($attr as $k=>$v)
    		{
    			$sname="select Name from user where Uid='{$v}'";
    			$name=$db->StrQuery($sname);	
    			echo "<div>{$k}--{$name}--<input type='button' value='删除' class='del' bs='{$k}' /></div>";
    		}
    	}
    	?>
        </div><br />
        <div>
        请输入流程名称:<input type="text" id="name"  />
        </div><br />
        <div>
        <input type="button" id="xinjian" value="新建流程" />
        </div>
    </div>
    </body>
    <script type="text/javascript">
    $(document).ready(function(e) {
        $("#addjiedian").click(function(){
    			//把选中的用户名取出
    			var uid="";
    			var rd=$(".ry")//根据class找到所有单选按钮
    			for(var i=0;i<rd.length;i++)
    			{
    				if(rd.eq(i).prop("checked"))
    				{
    					uid=rd.eq(i).val();	
    				}
    			}
    			//调用ajax将选中的用户名添加到session
    			$.ajax({
    					url:"chuli.php",
    					data:{uid:uid,type:0},
    					type:"POST",
    					dataType:"TEXT",
    					success: function(data){
    							window.location="xinjian.php";
    						}
    				});
    		})
    	//删除
    	$(".del").click(function(){
    			//取出索引
    			var id=$(this).attr("bs");
    			//调用ajax删除
    			$.ajax({
    					url:"chuli.php",
    					data:{id:id,type:1},
    					type:"POST",
    					dataType:"TEXT",
    					success: function(data){
    							window.location="xinjian.php";
    						}
    				});
    		})
    		//新建流程
    	$("#xinjian").click(function(){
    			var name=$("#name").val();
    			$.ajax({
    					url:"chuli.php",
    					data:{name:name,type:2},
    					type:"POST",
    					dataType:"TEXT",
    					success: function(data){
    							window.location="xinjian.php";
    						}
    				});
    		})
    });
    </script>
    </html>
    

      处理页面

    <?php
    session_start();
    include("../DBDA.class.php");
    $db=new DBDA();
    //先取type
    $type=$_POST["type"];
    //判断是哪一个ajax调用的
    switch($type)
    {
    	//将传过来的uid存到session里
    	case 0:
    	$uid=$_POST["uid"];
    	if(empty($_SESSION["jiedian"]))
    	{
    		$attr=array($uid);
    		$_SESSION["jiedian"]=$attr;	
    	}
    	else
    	{
    		$attr=$_SESSION["jiedian"];
    		$attr[]=$uid;
    		$_SESSION["jiedian"]=$attr;
    	}
    		break;
    	case 1:
    	$id=$_POST["id"];
    	$attr=$_SESSION["jiedian"];
    	unset($attr[$id]);
    	$attr=array_values($attr);//重新索引
    	$_SESSION["jiedian"]=$attr;
    	    break;
    	case 2:
    	$name=$_POST["name"];
    	$code=date("YmdHis");
    	@$attr=$_SESSION["jiedian"];
    	$sadd="insert into liucheng values('{$code}','{$name}')";
    	$db->Query($sadd,0);
    	foreach($attr as $k=>$v)
    	{
    		$saddpath="insert into flowpath values('','{$code}','{$v}','{$k}')";
    		$db->Query($saddpath,0);
    	}
    		break;
    }
    

      审核

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head>
    <?php
    session_start();
    include("../DBDA.class.php");
    $db=new DBDA();
    if(empty($_SESSION["uid"]))
    {
    	header("location:login.php");
    	exit;	
    }
    $uid=$_SESSION["uid"];
    //查询用户发起流程表中的所有数据
    $suflow="select * from userflow order by riqi desc";
    $auflow=$db->Query($suflow);
    
    ?>
    <body>
    <h1>审核页面</h1>
    <table width="60%" border="1" cellpadding="0" cellspacing="0">
    	<tr>
        	<td>流程名称</td>
            <td>发起者</td>
            <td>流程内容</td>
            <td>是否结束</td>
            <td>发起时间</td>
            <td>操作</td>
        </tr>
        <?php
    	foreach($auflow as $vuflow)
    	{
    		$flowcode=$vuflow[1];//流程代号
    		$towhere=$vuflow[6];//流程走到哪
    		//根据流程代号和登陆者用户名,查询该用户在该流程中的次序号
    		$sorder="select orders from flowpath where code='{$flowcode}' and uids='{$uid}'";
    		$order=$db->StrQuery($sorder);	//次序号
    		//判断该用户在流程中的次序号是否等于流程走到哪<br />
    		if($towhere==$order && $order!="")
    		{
    			//处理流程名称
    			$sflowname="select name from liucheng where code='{$flowcode}'";
    			$flowname=$db->StrQuery($sflowname);
    			//处理发起者名称
    			$susername="select name from user where uid='{$vuflow[2]}'";
    			$username=$db->StrQuery($susername);
    			//处理是否结束
    			$jieshu=$vuflow[4]?"<span style='background-color:red'>已结束</span>":"<span style='background-color:green'>进行中</span>";
    			echo "<tr>
        	<td>{$flowname}</td>
            <td>{$username}</td>
            <td>{$vuflow[3]}</td>
            <td>{$jieshu}</td>
            <td>{$vuflow[5]}</td>
            <td><a href='pass.php?code={$vuflow[0]}'>通过</a></td>
        </tr>";	
    		}
    	}
    	?>
    </table>
    </body>
    </html>
    

      通过处理

    <?php
    include("../DBDA.class.php");
    $db=new DBDA();
    $code=$_GET["code"];
    $sql="update userflow set towhere=towhere+1 where ids='{$code}'";
    if($db->Query($sql,0))
    {
    	//判断流程是否结束
    	$suflow="select * from userflow where ids='{$code}'";
    	$auflow=$db->Query($suflow);
    	$flowcode=$auflow[0][1];//流程代号
    	$towhere=$auflow[0][6];//走到哪了
    	//根据流程代号查询该流程下人员的个数
    	$scount="select count(*) from flowpath where code='{$flowcode}'";
    	$count=$db->StrQuery($scount);
    	if($towhere>=$count)
    	{
    	$sok="update userflow set isok=true where ids='{$code}'";
    	$db->Query($sok,0);	
    	}
    	header("location:shenhe.php");
    }
    

      

  • 相关阅读:
    多模块javaweb项目构建tomcat部署
    html页面基于ajax按钮60秒倒计时
    java面向对象六原则一法则
    sessionStorage 和 localStorage 、cookie
    Is-A,Has-A,Use-A(转载)
    多例模式
    java变量类型
    单例模式
    How to modify a compiled Android application (.apk file)
    Unity3D 绘制扇形/环形
  • 原文地址:https://www.cnblogs.com/hamilton/p/5648207.html
Copyright © 2020-2023  润新知