前台需要登录页面 ,发起流程页面,审核流程页面
后台 管理流程节点页面
登录页面
<!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 type="text/javascript" src="../../popwindow/jquery-1.11.2.min.js"></script> </head> <body> <div align="center" style="50%; top:100px; border:#F00 solid 1px ; font:large '雅黑' bolder; color:#C30; position:absolute; left:25%; "> <h1>登录</h1> <div style="margin-top:20px; font-size:12px" >用户名:<input type="text" id="name" style="height:15px;"/></div> <div style="margin-top:20px; font-size:12px; margin-bottom:20px;" >密 码:<input type="password"id="pwd" style="height:15px;"/> </div> <div style="font-size:12px; margin-bottom:20px;"><input type="button" value="登录" id="btn"/></div> </div> </body> <script type="text/javascript" > $(document).ready(function(e) { $("#btn").click(function(e) { var name=$("#name").val(); var pwd=$("#pwd").val(); $.ajax({ url:"dengluchuli.php", dataType:"text", data:{name:name,pwd:pwd}, type:"POST", success: function(data){ var a=data; if (a=="n") { window.location.href="index.php"; } else if (a=="y") { window.location.href="faqi.php"; } } }); }); }); </script> </html>
登录处理页面
<?php session_start(); include ("../DBDA.class.php"); $db=new DBDA(); $pwd=$_POST["pwd"]; $name=$_POST["name"]; if ($name!=""&&$pwd!="") { $sql="select password from login where username='{$name}'"; $attr=$db->StrQuery($sql); if($attr==$pwd ) { echo"y"; $_SESSION["uid"]=$name; } else { echo"n"; } }
发起流程页面
<!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> <body> <div>发起流程页面</div> <form action="chuli2.php" method="post"> <div><select name="lc" id="lch"> <?php session_start(); if (empty($_SESSION["uid"])) { header("location:denglu.php"); exit(); } include ("../DBDA.class.php"); $db=new DBDA(); $sql="select * from liucheng"; $attr=$db->Query($sql); foreach($attr as $v) { echo "<option value='{$v[0]}'>{$v[1]}</option>"; } ?> </select></div> <textarea name="t" id="wz"></textarea> <input type="submit" value="提交" id="btn" /> </form> </body> </html>
发起流程处理
<?php session_start(); include ("../DBDA.class.php"); $db=new DBDA(); $wz=$_POST["t"]; $code=$_POST["lc"]; $uid=$_SESSION["uid"]; $time=date("Y-m-d H:i:s"); $sql="insert into liuchengchuli values('','{$code}','{$uid}','{$wz}',false,'{$time}','0')"; $re=$db->Query($sql,0); if($re) { header("location:faqi.php"); }
流程审核
<!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> <body> <div>流程审核</div> <table align="center" border="1px"> <tr> <td>流程名称</td> <td>发起者</td> <td>流程内容</td> <td>是否结束</td> <td>发起时间</td> <td>操作</td> </tr> <?php session_start(); if(empty($_SESSION["uid"])) { /*header("location:denglu.php"); exit();*/ } $uid=$_SESSION["uid"]; include ("../DBDA.class.php"); $db=new DBDA(); $sql="select * from liuchengchuli order by riqi desc"; $attr=$db->Query($sql); //数据筛选 foreach ($attr as $v) { $lchid=$v[1]; $towhere=$v[6]; // 根据流程代号和登陆者用户名查询用户在该流程次序号 $sql1="select orders from jiedian where code='{$lchid}' and uids='{$uid}'"; $order=$db->StrQuery($sql1); //判断该用户在流程中的次序号是否等于towhere if($order==$towhere&& $order!="") { //处理流程名称 $sflowname = "select name from liucheng where code='{$lchid}'"; $flowname = $db->StrQuery($sflowname); //流程名称 //处理发起者名称 $susername = "select name from user where uid='{$v[2]}'"; $username = $db->StrQuery($susername); //发起者姓名 //处理是否结束 $jieshu = $v[4]?"<span style='background-color:red'>已结束</span>":"<span style='background-color:green'>进行中</span>"; } } ?> </table> </body> </html>
审核处理
<?php include ("../DBDA.class.php"); $db=new DBDA(); $code=$_GET["code"]; //修改towhere记录进行到第几步 $sql="update liuchengchuli set towhere = towhere+1 where code='{$code}'"; if ($db->Query($sql,0)) { //判断流程是否结束 $sql1="select * from jiedian where code ='{$code}'"; $attr=$db->Query($sql1); $order=$attr[0][3]; //查询towhere $sql2="select towhere from liuchengchuli where code='{$code}'"; $towhere=$db->StrQuery($sql2); //结束显示 if($towhere>=$order) { $sok = "update userflow set isok=true where ids='{$code}'"; $db->Query($sok,0); } header("liuchengshenhe.php"); }
流程管理
<!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 type="text/javascript" src="../../popwindow/jquery-1.11.2.min.js"></script> </head> <body> <div>新建流程</div> 请选择节点人员 <div> <?php session_start(); /* if (empty($_SESSION["uid"])) { header("location:denglu.php"); exit(); }*/ include ("../DBDA.class.php"); $db=new DBDA(); $sql="select * from user "; $user=$db->Query($sql); foreach($user as $v) { echo"<input type='radio' name='jd' class='aa' value='{$v[1]}'/>{$v[3]}"; } ?> <div>添加节点</div> <div><input type="button" id="btn" value="添加" /></div> <div id="a"> <?php //判断session有没有存节点人员 if(!empty($_SESSION["jiedian"])) { $attr=$_SESSION["jiedian"]; foreach($attr as $k=>$v) { $sql="select name from user where uid='{$v}'"; $name=$db->StrQuery($sql); echo "<div class='ck'>{$k} {$name}<input value='删除' type='button' k='{$k}' class='stn1'/></div>"; } } ?> </div> <div>新建流程</div> <div>请输入流程名称<input type="text" id="t" /> <input type="button" value="确定" id="lc"/></div> </div> </body> <script type="text/javascript" > $(document).ready(function(e) { $("#btn").click(function(e) { //获取选中的value值 var a=$(".aa"); for(var i=0; i<a.length;i++) { if( a.eq(i).prop("checked")) { var uid=a.eq(i).val(); } } $.ajax({ url:"chuli1.php", data:{uid:uid,type:0}, dataType:"TEXT", type:"POST", success: function(data){ window.location="zhuye.php"; }, }); }); //删除 $(".stn1").click(function(e) { var k=$(this).attr("k"); $.ajax({ url:"chuli1.php", data:{k:k,type:1}, type:"POST", dataType:"TEXT", success: function(data){ window.location="zhuye.php"; } }) }); $("#lc").click(function(e) { var name=$("#t").val(); $.ajax({ url:"chuli1.php", data:{name:name,type:2}, dataType:"TEXT", type:"POST", success: function(data){ } }) }); }); </script> </html>
流程处理
<?php session_start(); $type=$_POST["type"]; include ("../DBDA.class.php"); $db=new DBDA(); //先取type判断类型 $sql="select name from user"; $attr=$db->Query($sql); //判断哪个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["k"]; $attr=$_SESSION["jiedian"]; unset($attr[$id]); $attr=array_values($attr); $_SESSION["jiedian"]=$attr; break; case 2: $name=$_POST["name"]; $code=time(); @$attr=$_SESSION["jiedian"]; $sql1="insert into liucheng values('{$code}','{$name}')"; $db->Query($sql1,0); foreach ($attr as$k=>$v) { $sql2="insert into jiedian values('','$code','$v','$k')"; $db->Query($sql2,0); } break; }