flowstep_control.asp

来自「OFFICE办公自动化」· ASP 代码 · 共 408 行

ASP
408
字号
<%
'文件名:flowstep_control.asp
'作者:展亮
'功能:编辑流程
'参数:flow_name'流程名,form_name'表单名
'开发时间:2003-10-31 17:58
%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<!--#include file="../asp/displayflowstep.asp"-->
<!--#include file="../asp/workflow_unit_controlplan.asp"-->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/flowstep.css" type=text/css>
<title>main</title>
</head>
<%
oabusyusername=Session("LoginName")
'-----------------------------------------------------
flow_name=request("flow_name")
form_name=request("form_name")
submit1=request("submit1")
submit2=request("submit2")
submit3=request("submit3")
submit4=request("submit4")
flow_no=request("flow_no")
parent_no=request("parent_no")
action_type=request("action_type")
form_unit=request("form_unit")
if form_unit="" then form_unit=-1
judge_symbol=request("judge_symbol")
judge_value=request("judge_value")
flow_title=request("flow_title")
tell_type=request("tell_type")
judge_type=request("judge_type")
judge_result=request("judge_result")
check_member=request("check_member")
company_member=request("company_member")
blrylb=request("blrylb")
id=request("id")
%>
<center>
<%
'set rs=server.createobject("adodb.recordset")
'sql="select allow_edit_workflow from userinf where username='" & cString(oabusyusername)&"'"
'rs.open sql,oConn,1
'allow_edit_workflow=rs("allow_edit_workflow")
if allow_edit_workflow="yes" then
  response.write "<br><br><br><font color=red>你没有编辑流程的权限!</font>"
  response.end
end if

'----------------------------------------------------
if submit1="修改" then
  set rs=server.createobject("adodb.recordset")
  sql="select flow_no from workflow_flow_construction where flow_name='" & cString(flow_name) & "' and flow_no=" & flow_no & " and id<>" & id
  rs.open sql,oConn,1
  if (rs.eof or rs.bof) and flow_no<>0 then
    rs.close
    set rs=nothing
    set rs1=server.createobject("adodb.recordset")
    sql="select action_type from workflow_flow_construction where flow_name='" & cString(flow_name) & "' and id=" & id
    rs1.open sql,oConn,1
    if (rs1("action_type")="开始" and action_type="开始") or (rs1("action_type")<>"开始" and action_type<>"开始") then
      rs1.close
      set rs1=nothing
      'Response.Write sql
      sql = "update workflow_flow_construction set "
      sql = sql & "flow_no='" & cString(flow_no) & "',"
      sql = sql & "parent_no='" & cString(parent_no) & "',"
      sql = sql & "action_type='" & cString(action_type) & "',"
      sql = sql & "form_unit='" & cString(form_unit) & "',"
      sql = sql & "judge_symbol='" & cString(judge_symbol) & "',"
      sql = sql & "judge_value='" & cString(judge_value) & "',"
      sql = sql & "tell_type='" & cString(tell_type) & "',"
      sql = sql & "judge_type='" & cString(judge_type) & "',"
      sql = sql & "judge_result='" & cString(judge_result) & "',"
      sql = sql & "check_member='" & cString(check_member) & "',"			'审批人员类别
      sql = sql & "company_member='" & cString(company_member) & "',"
      sql = sql & "blrylb='" & cString(blrylb) & "',"									'负责人ID列表
      sql = sql & "flow_title='" & cString(flow_title) & "' where id=" & id
      oConn.Execute sql
      alertword="<font color=green>成功修改流程!</font>"
    else
      alertword="<font color=red>修改流程失败!--程序只能有一个开始,开始总在第一步</font>"
    end if
  else
    alertword="<font color=red>修改流程失败!--流程序号不能为0,也不能重复</font>"
  end if
end if
'------------------------------------------------------
%>
<%
'--------------------------------------------------------
  if submit2="删除" then
    sql="delete from workflow_flow_construction where id=" & id
    oConn.Execute sql
    alertword="<font color=green>成功删除流程!</font>"
  end if
'------------------------------------------------------
%>
<%
if submit3="增加" then
  if parent_no="" then parent_no=0
  set rs=server.createobject("adodb.recordset")
  sql="select flow_no from workflow_flow_construction where flow_name='" & cString(flow_name) & "' and flow_no=" & flow_no
  rs.open sql,oConn,1
  if (rs.eof or rs.bof) and flow_no<>0 then
    rs.close
    set rs=nothing
    set rs1=server.createobject("adodb.recordset")
    sql="select action_type from workflow_flow_construction where flow_name='" & cString(flow_name) & "' and action_type='开始'"
    rs1.open sql,oConn,1
    if ((rs1.eof or rs1.bof) and action_type="开始") or ((not rs1.eof and not rs1.bof) and action_type<>"开始") then
      rs1.close
      set rs1=nothing
      
      sql = "Insert Into workflow_flow_construction (flow_name,flow_no,parent_no,action_type,form_unit,judge_symbol,judge_value,flow_title,tell_type,judge_type,judge_result,check_member,company_member,blrylb) Values( "
      sql = sql &"'"& cString(flow_name) & "',"
      sql = sql &"'"& flow_no & "',"
      sql = sql & parent_no & ","
      sql = sql &"'"& cString(action_type) & "',"
      sql = sql &"'"& cString(form_unit) & "',"
      sql = sql &"'"& cString(judge_symbol) & "',"
      sql = sql &"'"& cString(judge_value) & "',"
      sql = sql &"'"& cString(flow_title) & "',"
      sql = sql &"'"& cString(tell_type) & "',"
      sql = sql &"'"& cString(judge_type) & "',"
      sql = sql &"'"& cString(judge_result) & "',"
      sql = sql &"'"& cString(check_member) & "',"
      sql = sql &"'"& cString(company_member) & "',"
      sql = sql &"'"& cString(blrylb) & "')"
      'Response.Write sql
      oConn.Execute sql
      alertword="<font color=green>成功增加流程!</font>"
    else
      alertword="<font color=red>增加流程失败!--程序只能有一个开始,开始总在第一步</font>"
    end if
  else
    alertword="<font color=red>增加流程失败!--流程序号不能为0,也不能重复</font>"
  end if
end if
'---------------------------------------------
%>
<%
'---------------------------------------------
if submit4="关联" then
  sql="update workflow_form_name set flow_name='',inapplication='no' where flow_name='" & cString(flow_name)&"'"
  oConn.Execute sql

  sql="update workflow_form_name set flow_name='" & cString(flow_name) & "',inapplication='no' where form_name='" & cString(form_name)&"'"
  oConn.Execute sql
end if
'-------------------------------------------------
%>

<%
'---------------------------------------------
if request("application")="应用" then
  sql="update workflow_form_name set inapplication='yes' where flow_name='" & cString(flow_name)&"'"
  oConn.Execute sql
end if
'-------------------------------------------------
if request("application")="不应用" then
  sql="update workflow_form_name set inapplication='no' where flow_name='" & cString(flow_name)&"'"
  oConn.Execute sql
end if
'-------------------------------------------------
%>

<table width="95%" cellspacing="1" cellpadding="2">
  <tr>
  <td>
<table cellspacing="1" cellpadding="2">
  <tr>
    <td nowrap><b>编辑流程</b></td>
    <%
    set rs=server.createobject("adodb.recordset")
    sql="select * from workflow_flow_name"
    rs.open sql,oConn,1
    if not rs.eof and not rs.bof then flow_name=rs("flow_name")
    if request("flow_name")<>"" then flow_name=request("flow_name")
    if flow_name<>"" then
    %>
    <form method="get" name="form1" action="flowstep_control.asp">
    <td>
      <select name="flow_name" size=1 onchange="document.form1.submit();">
    <%
    while not rs.eof and not rs.bof
    %>
      <option value="<%=rs("flow_name")%>"<%=selected(rs("flow_name"),flow_name)%>><%=rs("flow_name")%></option>
    <%
    rs.movenext
    wend
    rs.close
    set rs=nothing
    %>
      </select>
      
    </td>
    </form>
    <%
    end if
    %>
  </tr>
</table>
  </td>
  <form method="post" name="app1" action="flowstep_control.asp">
  <td>
<%
'--------------------------------------------------
'判断是否要应用
'如果数据库中application=no就可以应用
appval="no"
set rs=server.createobject("adodb.recordset")
sql="select inapplication from workflow_form_name where flow_name='" & cString(flow_name)&"'"
rs.open sql,oConn,1
if not rs.eof and not rs.bof then appval=rs("inapplication")
rs.close
set rs=nothing
appstr=""
noappstr=" disabled"
if appval="yes" then
  appstr=" disabled"
  noappstr=""
end if
'---------------------------------------------------
%>
    <input type="submit" name="application" value="应用"<%=appstr%>>
    <input type="submit" name="application" value="不应用"<%=noappstr%>>
    <input type="hidden" name="flow_name" value="<%=flow_name%>">
  </td>
  </form>
  <form method="post" name="form3" action="flowstep_control.asp">
  <td align=right>
    <select name="form_name" size=1>
    <option value="">无</option>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from workflow_form_name"
rs.open sql,oConn,1
while not rs.eof and not rs.bof
%>
    <option value="<%=rs("form_name")%>"<%=selected(rs("flow_name"),flow_name)%>><%=rs("form_name")%></option>
<%
rs.movenext
wend
rs.close
set rs=nothing
%>
    </select>
    <input type="submit" name="submit4" value="关联">
    <input type="hidden" name="flow_name" value="<%=flow_name%>">
  </td>
  </form>
  </tr>
</table>
<div align=left>  <%=alertword%></div>
<table width="95%" cellspacing="1" cellpadding="2" class="tab">
  <tr>
    <td align=center valign=top class="td2">
      <br><b>流程名称:</b><%=flow_name%><hr>
      <%call displayflow(flow_name)%>
    </td>
    <td valign=top width="160" class="td3">
      <%call workflow_unit_controlplan()%>
      <br><br>
       说明:
      <ol>
        <li>流程序号必须填写且为正整数。</li>
        <li>流程的第一步必须为“开始”且其流程序号必须为1。</li>
        <li>上步序号指本步骤的上一步骤的流程序号。</li>
      </ol>
    </td>
  </tr>
</table>
</center>

<%
set rs=server.createobject("adodb.recordset")
sql="select top 1 flow_no from workflow_flow_construction where flow_name='" & cString(flow_name) & "' order by flow_no desc"
rs.open sql,oConn,1
if not rs.eof and not rs.bof then
  flow_no=rs("flow_no")
else
  flow_no=0
end if
flow_no=flow_no+1
%>

<script language="javascript">
  document.form2.flow_no.value="<%=flow_no%>";

  chang();

  function chang(){
    if(document.form2.action_type.value=="开始"||document.form2.action_type.value=="结束"){
        document.form2.tell_type.disabled="true";
        document.form2.judge_type.disabled="true";
        document.form2.judge_result.disabled="true";
        document.form2.form_unit.disabled="true";
        document.form2.judge_symbol.disabled="true";
        document.form2.judge_value.disabled="true";
        document.form2.check_member.disabled="true";
        document.form2.company_member.disabled="true";
    }

    if(document.form2.action_type.value=="判断"){
      document.form2.judge_type.disabled="";
      if(document.form2.judge_type.value=="审批判断"){
         document.form2.tell_type.disabled="true";
         document.form2.judge_result.disabled="";
         document.form2.form_unit.disabled="true";
         document.form2.judge_symbol.disabled="true";
         document.form2.judge_value.disabled="true";
         document.form2.check_member.disabled="true";
         document.form2.company_member.disabled="true";
      }
      else {
         document.form2.tell_type.disabled="true";
         document.form2.judge_result.disabled="true";
         document.form2.form_unit.disabled="";
         document.form2.judge_symbol.disabled="";
         document.form2.judge_value.disabled="";
         document.form2.check_member.disabled="true";
         document.form2.company_member.disabled="true";
      }
    }

    if(document.form2.action_type.value=="审批"){
      document.form2.check_member.disabled="";
      if(document.form2.check_member.value=="负责人"){
        document.form2.tell_type.disabled="true";
        document.form2.judge_type.disabled="true";
        document.form2.judge_result.disabled="true";
        document.form2.form_unit.disabled="true";
        document.form2.judge_symbol.disabled="true";
        document.form2.judge_value.disabled="true";
        document.form2.company_member.disabled="true";
        document.form2.blryxmlb.disabled="";
       }
       else{
        document.form2.tell_type.disabled="true";
        document.form2.judge_type.disabled="true";
        document.form2.judge_result.disabled="true";
        document.form2.form_unit.disabled="true";
        document.form2.judge_symbol.disabled="true";
        document.form2.judge_value.disabled="true";
        document.form2.company_member.disabled="";
        document.form2.blryxmlb.disabled="true";
       }
    }

    if(document.form2.action_type.value=="通知"){
      document.form2.tell_type.disabled="";
      if(document.form2.tell_type.value=="通知表单提交人"||document.form2.tell_type.value=="通知所有人"){
        document.form2.judge_type.disabled="true";
        document.form2.judge_result.disabled="true";
        document.form2.form_unit.disabled="true";
        document.form2.judge_symbol.disabled="true";
        document.form2.judge_value.disabled="true";
        document.form2.check_member.disabled="true";
        document.form2.company_member.disabled="true";
      }
      else{
        if(document.form2.tell_type.value=="通知指定人"){
          document.form2.judge_type.disabled="true";
          document.form2.judge_result.disabled="true";
          document.form2.form_unit.disabled="true";
          document.form2.judge_symbol.disabled="true";
          document.form2.judge_value.disabled="true";
          document.form2.check_member.disabled="true";
          document.form2.company_member.disabled="";
        }
        else{
          document.form2.judge_type.disabled="true";
          document.form2.judge_result.disabled="true";
          document.form2.form_unit.disabled="";
          document.form2.judge_symbol.disabled="true";
          document.form2.judge_value.disabled="true";
          document.form2.check_member.disabled="true";
          document.form2.company_member.disabled="true";
        }
      }
    }

    if(document.form2.action_type.value=="归档"){
        document.form2.tell_type.disabled="true";
        document.form2.judge_type.disabled="true";
        document.form2.judge_result.disabled="true";
        document.form2.form_unit.disabled="true";
        document.form2.judge_symbol.disabled="true";
        document.form2.judge_value.disabled="true";
        document.form2.check_member.disabled="true";
        document.form2.company_member.disabled="";
    }
  };
</script>

<%
rs.close
set rs=nothing
set conn=nothing
%>

 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?