⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 template_update.jsp

📁 一个做得非常好的电子政务系统
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="com.ijipin.tool.*" %>
<%@ page import="com.ijipin.database.*" %>
<%@ page import="com.ijipin.property.*" %>
<%@ include file="/userinfor.jsp" %>
<%@ include file="/share/page/page_request.jsp"%>
<%@ page import="com.ijipin.flow.*" %>
<%
    ////////////////////////////列表页面所必须有的公共变量
    final String strSkin  = "../../" + userInfor_session.getPFLJ();  //皮肤路径
    final String strLevel = Template.strLevel;  //本页所在的层次
    final String strLink  = Template.strLink_update;    //本页的地址
    final String strLink_action = Template.strLink_action;
    final String strLink_back = Template.strLink_list;
    final int iModuleID= Template.iModuleID;
    //////////////iSecond_barid
    //设置查询参数
    String sTable     = "";
    String sField     = "";
    String sCondition = "";

    int iSpace = Message.SPACE;  //空格的宽度
    String sWidth = Message.WIDTH;  //第一个td的百分比宽度

    //新建一个连接
    DataConn dataConn = new DataConn();
    Statement stmt = null;
    ResultSet rs = null;
    DataList dataList = null;


    //是否可以写,如果为false,必须要取消所有的按牛
    boolean canWrite = true;
    if (strACTION.equals("VIEW")) {
        canWrite = false;
    }

    ////////////////获得事物类别
    SWLB SWLBclass = new SWLB(dataConn);
    String strSWLB = "";
    strSWLB = SWLBclass.getSWLB(iSecond_barid);
%>
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=Message.COMPANY_NAME%></title>
<link href="<%=strSkin%>css.css" rel="stylesheet" type="text/css">
</head>
<%
try {
    stmt = dataConn.getConnection().createStatement();
    dataList = new DataList(stmt);

    String str_value = "";   //临时变量,放字段的值
    String str_field = "";   //字段的名称
    String str_type  = "";   //字段类型
    String key_field = "";   //关键字
    String key_value = "0";   //关键字的值
    int    iFieldCount = 0;  //字段数量
%>
<%@ include file="/share/property/update_property.jsp" %>
<% if (hasEditor) {%>
<script language = "vbscript">
    sub LoadContent
        window_onresize
        dim surl
        surl="http://<%=strServer_session%>:<%=strPort_session%><%=rootPath_session%>/share/editor/load.jsp?key=<%=key_value%>&module=<%=iModuleID%>"
        tbContentElement.LoadURL(sURL)
    end sub
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="vbscript:LoadContent">
<% } else {%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<% } %>

<%@ include file="/share/page/share_bar_top.jsp"%>
<!--  工具条上 2004-04-28 -->
<%@ include file="/share/property/update_tool_top.jsp" %>
<!--  数据区 2004-04-28 -->
<table border="0"  cellspacing="0" cellpadding="0" width="100%" align="center">
  <form name="form" method="post" action="<%=strLink_action%>" onsubmit="javaScript:return check_validate(this);" ENCTYPE="multipart/form-data">
    <%@ include file="/share/page/page_hidden.jsp" %>
<!--隐藏的-->
    <input type="hidden" name="SWLB" value="<%=strSWLB%>">
<%
    iterField = field.getList().iterator();
    iFieldCount = 0;
    while (iterField != null && iterField.hasNext()) {
        fieldInfor = (FieldInfor)iterField.next();
        if (fieldInfor.getZDGZ() != null) {
            str_value = valueRule.getValue(fieldInfor.getZDGZ());
        }

        if (!value_str[iFieldCount].equals("")) {
            str_value = value_str[iFieldCount];
        }
        if ( 2 == fieldInfor.getZDBJ()) {
            if (5 != fieldInfor.getZDBJKJ()) {
%>
    <input type="hidden" name="<%=fieldInfor.getZDMC()%>" value="<%=str_value%>">
<%
            } else {
%>
    <input type="hidden" name="<%=fieldInfor.getZDMC()%>">
<%
            }
        }
        iFieldCount ++;
    }
%>
<%
    iFieldCount = 0;
    iterField = field.getList().iterator();
    while (iterField != null && iterField.hasNext()) {
        fieldInfor = (FieldInfor)iterField.next();
        if (fieldInfor.getZDGZ() != null) {
            str_value = valueRule.getValue(fieldInfor.getZDGZ());
        }
        if (!value_str[iFieldCount].equals("")) {
            str_value = value_str[iFieldCount];
        }
        iFieldCount ++;
        //////列表
        if ( 2 == fieldInfor.getZDBJ() || 3 == fieldInfor.getZDBJ()) {
            continue;
        }
%>
  <tr>
    <td width="<%=sWidth%>" align="right" valign="top"><%=fieldInfor.getZDSM()%></td><td width="<%=iSpace%>">&nbsp;</td>
    <td>
<%
        if ( 0 == fieldInfor.getZDBJKJ()) {
%>
      <input type="text" class="tex3" name="<%=fieldInfor.getZDMC()%>" value="<%=str_value%>" <%if(!canWrite) {%>readonly<%}%>
          <% if (fieldInfor.getZDLX().equals("nvarchar")) {%> maxlength="<%=fieldInfor.getZDCD()%>" <%}%> >
<%
            continue;
        }
        if ( 1 == fieldInfor.getZDBJKJ()) {
%>
      <textarea rows="5" class="drpdwn2" name="<%=fieldInfor.getZDMC()%>" <%if(!canWrite) {%>readonly<%}%>><%=str_value%></textarea>
<%
            continue;
        }
        if ( 2 == fieldInfor.getZDBJKJ()) {
            /////////找关联
            selectTable = fieldInfor.getZDGLBM();
            selectField = fieldInfor.getZDGLZD();
            selectName  = fieldInfor.getZDGLMC();

            if (!canWrite) { ///不可以写,就要把唯一的一个显示出来
                relateCond = selectField + "=" + str_value;
            }
%>
      <select class="search"  name="<%=fieldInfor.getZDMC()%>" <%if(!canWrite) {%>readonly<%}%>>
<%
      //////////////选择的放进iterList
    rs = dataList.getResultSet(selectTable, selectField + "," + selectName, relateCond);
    while (rs.next()) {
        selectValue = Convert.toUnicode(rs.getString(1));
%>
      <option value="<%=selectValue%>" <%if (selectValue.equals(str_value)) {%>selected<%}%>><%=Convert.toUnicode(rs.getString(2))%></option>
<%
    }
%>

      </select>
<%
            continue;
        }
        if ( 3 == fieldInfor.getZDBJKJ()) {
%>
      <input type="text" class="tex1" name="<%=fieldInfor.getZDMC()%>" value="<%=str_value%>"  maxlength=10>
      <a href="javascript:void(0)" onclick="gfPop.fPopCalendar(eval(document.form.<%=fieldInfor.getZDMC()%>));return false;" HIDEFOCUS>
       <img name="popcal" align="absbottom" src="<%=strLevel%>share/calendar/calbtn.gif" width="34" height="22" border="0" alt="">
      </a>

<%
            continue;
        }
%>
    </td>
  </tr>
<%
    }
%>
  <%
      String str_SYBM = "0";
      String str_SYZW = "0";
      String str_SYYG = "0";
      int iSYQT = 1;
      Template template = new Template(dataConn);
      TemplateInfor templateInfor = (TemplateInfor)template.getInfor(Integer.parseInt(key_value));

      if (templateInfor != null) {
          str_SYBM = templateInfor.getSYBM();
          str_SYZW = templateInfor.getSYZW();
          str_SYYG = templateInfor.getSYYG();
          iSYQT = templateInfor.getSYQT();
      }
  %>
  <!--部门选择-->
  <%
    //strBMID_DEPARTMENT   //已选中的ID
    //request:  BMID_DEPARTMENT
  String strBMID_DEPARTMENT = str_SYBM;
  %>
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>
  <tr>
    <td width="<%=sWidth%>" align="right" valign="top">部门选择</td><td width="<%=iSpace%>">&nbsp;</td>
    <td width="400"><%@ include file="/share/select/department_mult.jsp"%><br></td>
  </tr>
  <!--职务选择-->
  <%
    //strZWID_POSITION   //已选中的ID
    //request:  ZWID_POSITION
      String strZWID_POSITION = str_SYZW;
  %>
  <tr>
    <td width="<%=sWidth%>" align="right" valign="top">职务选择</td><td width="<%=iSpace%>">&nbsp;</td>
    <td width="400"><%@ include file="/share/select/position_mult.jsp"%><br></td>
  </tr>
  <!--员工选择-->
  <%
    //strZWID_POSITION   //已选中的ID
    //request:  ZWID_POSITION
      String strYGID_USER = str_SYYG;
  %>
  <tr>
    <td width="<%=sWidth%>" align="right" valign="top">员工选择</td><td width="<%=iSpace%>">&nbsp;</td>
    <td width="400"><%@ include file="/share/select/user_mult.jsp"%><br></td>
  </tr>
  <!--员工全选-->
  <tr>
    <td width="<%=sWidth%>" align="right" valign="top">全体员工</td><td width="<%=iSpace%>">&nbsp;</td>
    <td><input type="checkbox" name="SYQT" value="1" <% if (iSYQT==1) {%> checked <% } %> ></td>
  </tr>

  </form>
</table>
<!--  工具条下 2004-04-28 -->
<%@ include file="/share/property/update_tool_bottom.jsp" %>
<%@ include file="/share/page/page_form.jsp" %>
<Script Language="javaScript" src="<%=strLevel%>share/js/util.js"></Script>
<script language="javascript">
    //定义数组,检查提交
    var onecount;
    onecount=0;
    fieldArray = new Array();
    <%
        iterField = field.getList().iterator();
        while (iterField != null && iterField.hasNext()) {
            fieldInfor = (FieldInfor)iterField.next();

            //字段控件,如果用了日期控件,只能时yyyy-mm-dd
            if (fieldInfor.getZDBJ() != 2) {
                str_type = fieldInfor.getZDLX();
                if (3 == fieldInfor.getZDBJKJ()) {
                    str_type = "datetime";
                }
            %>
            fieldArray[onecount] = new Array("<%=fieldInfor.getZDMC()%>","<%=fieldInfor.getZDSM()%>","<%=str_type%>","<%=fieldInfor.getZDCD()%>","<%=fieldInfor.getZDKK()%>");
            onecount++;
            <%
            }
        }
    %>
</script>
<Script Language="javaScript">
    function FunSave() {
        if (check_validate(form)) {
            //选种部门和职务
            SelectAll(form.BMID_DEPARTMENT);
            SelectAll(form.ZWID_POSITION);
            SelectAll(form.YGID_USER);

            form.action = "<%=strLink_action%>";
            form.submit();
        }
    }
    function FunReset(theForm) {
        theForm.action = "<%=strLink%>";
        theForm.submit();
    }
    function FunBack(theForm) {
        theForm.action = "<%=strLink_back%>";
        theForm.submit();
    }
    function check_validate(theForm) {
        var name   = "";
        var desc   = "";
        var type   = 0;
        var len    = 0;
        var null_2 = 0;
        var temp   = "";

        for (var i=0; i< fieldArray.length; i++) {
            name   = fieldArray[i][0];
            desc   = fieldArray[i][1];
            type   = fieldArray[i][2];
            len    = fieldArray[i][3];
            null_2 = fieldArray[i][4];
            if (null_2 ==1 && isSpace(eval("form." + name + ".value"))) {  //不能为空
                alert(desc + "不能为空");
                eval("form." + name + ".value=''");
                eval("form." + name + ".focus()");
                return false;
            }

            if ( type.toLowerCase()=="nvarchar" && eval("form." + name + ".value").length > len) {
                alert(desc + "字数超出范围");
                temp = eval("form." + name + ".value");
                temp = temp.substring(0, len/2);
                eval("form." + name + ".value='" + temp  + "'");
                eval("form." + name + ".focus()");
                return false;
            }


            if (type.toLowerCase().indexOf("int") >=0 && !isNum(eval("form." + name + ".value")) ) {
                alert(desc + "只能是整数");
                eval("form." + name + ".value='0'");
                eval("form." + name + ".focus()");
                return false;
            }

            if (type.toLowerCase() == "datetime" && !isSpace(eval("form." + name + ".value")) && !Date_istrue(eval("form."+ name+ ".value"))) {
                alert(desc + "只能是日期格式,如:2003-09-13");
                eval("form." + name + ".focus()");
                return false;
            }
        }
        DisableAll(theForm);
        DisableAll(formBar1);
        DisableAll(formBar2);
        ///////////应该出提示了
        return true;
    }
</Script>
</body>
<%
}
catch(Exception e) {
}
finally {
    if (stmt != null) {
        stmt.close();
    }
    if (dataConn != null) {
        dataConn.close();
    }
}
%>
</html>

⌨️ 快捷键说明

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