<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/11
  Time: 12:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="org.omg.CosCollection.IteratorInBetween" %>
<%@ page import="com.censoft.db.DBUtil" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.text.DateFormat" %>
<%!
    Pub pub = new Pub();

    public String getUsername(ConnectionFactory cf,Connection conn,String userid){
        StringBuffer sb = new StringBuffer();
        Hashtable ht_1=new Hashtable();
        sb.append("select login_name from t_book_admin where login_id=?");
        Vector list = cf.doQuery(conn,sb.toString(),null,new Object[]{userid});
        if(list==null){
            System.out.println("查询出错"+cf.getMsg());
            return "";
        }
        if(list.size()>0){
            ht_1=(Hashtable)list.get(0);
            return pub.trimNull((String)ht_1.get("login_name"));
        }else{
            return "";
        }

    }
    public String getRolename(ConnectionFactory cf,Connection conn,String userid){
        StringBuffer sb = new StringBuffer();
        Hashtable ht_1=new Hashtable();
        sb.append("select t1.role_name,t1.bz from t_book_role t1 join t_book_user_role_rel t2 on t1.id=t2.role_id where t2.login_id=?");
        Vector list = cf.doQuery(conn,sb.toString(),null,new Object[]{userid});
        if(list==null){
            System.out.println("查询出错"+cf.getMsg());
            return "";
        }
        String role_id="";
        if(list.size()>0){
            for(int i=0;i<list.size();i++){
                ht_1=(Hashtable)list.get(i);
                String bz=pub.trimNull((String)ht_1.get("bz"));
                role_id+=bz+",";
            }
            return role_id;
        }else{
            return "";
        }

    }
    public int getCounts(ConnectionFactory cf,Connection conn,String ly_id,String reg_id){
        StringBuffer sb = new StringBuffer();
        sb.append("select reg_id from zc_register" +
                " where zc_id in (select  zc_id from zc_ly where ly_id =?) and reg_id=?");

        Vector list = cf.doQuery(conn,sb.toString(),null,new Object[]{ly_id,reg_id});
        if(list==null){
            System.out.println("查询出错"+cf.getMsg());
            return 1;
        }
        return list.size();
    }
%>
<%
    ConnectionFactory cf = new ConnectionFactory();
    DateFormat df = new SimpleDateFormat("yyyyMMdd");
    Pub pub = new Pub();
    Connection conn = null;
    Vector v_list = null;
    Vector v_list_1 = null;
    Vector zc_list_1 = null;
    String login_user = (String) session.getAttribute("session_login_id");
    String login_name = (String) session.getAttribute("session_login_name");
    int is_view=0;
    String page_size = pub.trimNull(request.getParameter("page_size"));
    String ly_status_s = pub.trimNull(request.getParameter("ly_status"));
    String xm_id = pub.trimNull(request.getParameter("xm_id"));
    String ly_id = pub.trimNull(request.getParameter("ly_id"));
    String sp_id = pub.trimNull(request.getParameter("sp_id"));
    String action = pub.trimNull(request.getParameter("action"));
    String ly_dept = pub.trimNull(request.getParameter("ly_dept"));
    String ly_user = pub.trimNull(request.getParameter("ly_user"));
    String ly_reason="";
    String ly_time="";
    String tel="";
    String beizhu="";
    List list_s = new ArrayList();
    Hashtable ht=null;
    Hashtable ht_sp=null;
    String sp_user_1="";
    String sp_user_2="";
    String sp_user_3="";
    String sp_user_4="";
    String sp_user_5="";
    String sp_user_1_name="";
    String sp_user_2_name="";
    String sp_user_3_name="";
    String sp_user_4_name="";
    String sp_user_5_name="";
    String fkyj_1="";
    String fkyj_2="";
    String fkyj_3="";
    String fkyj_4="";
    String fkyj_5="";
    String spyj_1="";
    String spyj_2="";
    String spyj_3="";
    String spyj_4="";
    String spyj_5="";
    String sp_time_1="";
    String sp_time_2="";
    String sp_time_3="";
    String sp_time_4="";
    String sp_time_5="";
    String is_import="";
    String zc_name_list="";
    int z_jiage =0;
    String user_role_id="";
    try {
        StringBuffer sb = new StringBuffer();
        StringBuffer sb_list = new StringBuffer();
        StringBuffer zc_list = new StringBuffer();
        sb.append("select ly_id,xm_id,ly_dept,ly_reason,ly_time,ly_user,ly_status,tel,beizhu,add_time from zc_ly where ly_id=? ");
        sb.append(" order by add_time desc");
        sb_list.append("select * from zc_sp  where ly_id=?");
        zc_list.append("select distinct reg_id,zc_name,zc_fl,sb_type,counts,jiazhi,add_time from zc_register where zc_id in (select  zc_id from zc_ly where ly_id =?)");
        zc_list.append(" order by add_time desc");
        list_s.add(ly_id);
        conn = com.censoft.db.DBUtil.getConnection();
        user_role_id=getRolename(cf,conn,login_user);
        if(user_role_id.indexOf("csgly")>0 && user_role_id.indexOf("cz")<0 && user_role_id.indexOf("bgsgly")<0
                && user_role_id.indexOf("bgszr")<0&& user_role_id.indexOf("jz")<0){
            is_view=1;
        }
        if( user_role_id.indexOf("cz")>0 && user_role_id.indexOf("bgsgly")<0
                && user_role_id.indexOf("bgszr")<0&& user_role_id.indexOf("jz")<0){
            is_view=2;
        }
        if( user_role_id.indexOf("bgsgly")>0
                && user_role_id.indexOf("bgszr")<0&& user_role_id.indexOf("jz")<0){
            is_view=3;
        }
        if( user_role_id.indexOf("bgszr")>0&& user_role_id.indexOf("jz")<0){
            is_view=4;
        }
        if(  user_role_id.indexOf("jz")>0){
            is_view=5;
        }
        if("admin".equals(login_user)){
            is_view=6;
        }
        v_list = cf.doQuery(conn, sb.toString(),null, list_s.toArray());
        v_list_1 = cf.doQuery(conn, sb_list.toString(),null, list_s.toArray());
        zc_list_1 = cf.doQuery(conn, zc_list.toString(),null, list_s.toArray());
        if (v_list == null) {
            out.println("查询出错" + cf.getMsg());
            return;
        }
        if (v_list_1 == null) {
            out.println("查询出错" + cf.getMsg());
            return;
        }
        if (zc_list_1 != null && zc_list_1.size() > 0) {
            for (int i = 0; i < zc_list_1.size(); i++) {
                Hashtable ht_view = (Hashtable) zc_list_1.get(i);
                String reg_id_view = pub.trimNull((String) ht_view.get("reg_id"));
                int counts = getCounts(cf, conn, ly_id, reg_id_view);
                String zc_name_view = pub.trimNull((String) ht_view.get("zc_name"));
                zc_name_list=zc_name_view+"、"+zc_name_list;
                String jiazhi_view = pub.trimNull((String) ht_view.get("jiazhi"));
                if ("".equals(jiazhi_view)) {
                    jiazhi_view = "0";
                }
                int jiazhi = Integer.parseInt(jiazhi_view) * counts;
                z_jiage=jiazhi+z_jiage;
            }
        }
        if(!"".equals(zc_name_list)){
            zc_name_list=zc_name_list.substring(0,zc_name_list.length()-1);
        }
        if (v_list_1.size()>0){
            ht_sp=(Hashtable)v_list_1.get(0);
            sp_user_1=pub.trimNull((String)ht_sp.get("sp_user_1"));
            sp_user_2=pub.trimNull((String)ht_sp.get("sp_user_2"));
            sp_user_3=pub.trimNull((String)ht_sp.get("sp_user_3"));
            sp_user_4=pub.trimNull((String)ht_sp.get("sp_user_4"));
            sp_user_5=pub.trimNull((String)ht_sp.get("sp_user_5"));
            sp_user_1_name=getUsername(cf,conn,sp_user_1);
            sp_user_2_name=getUsername(cf,conn,sp_user_2);
            sp_user_3_name=getUsername(cf,conn,sp_user_3);
            //sp_user_4_name=getUsername(cf,conn,sp_user_4);
            //sp_user_5_name=getUsername(cf,conn,sp_user_5);
            fkyj_1=pub.trimNull((String)ht_sp.get("fkyj_1"));
            fkyj_2=pub.trimNull((String)ht_sp.get("fkyj_2"));
            fkyj_3=pub.trimNull((String)ht_sp.get("fkyj_3"));
            fkyj_4=pub.trimNull((String)ht_sp.get("fkyj_4"));
            fkyj_5=pub.trimNull((String)ht_sp.get("fkyj_5"));
            spyj_1=pub.trimNull((String)ht_sp.get("spyj_1"));
            spyj_2=pub.trimNull((String)ht_sp.get("spyj_2"));
            spyj_3=pub.trimNull((String)ht_sp.get("spyj_3"));
            spyj_4=pub.trimNull((String)ht_sp.get("spyj_4"));
            spyj_5=pub.trimNull((String)ht_sp.get("spyj_5"));
            sp_time_1=pub.trimNull((String)ht_sp.get("sp_time_1"));
            sp_time_2=pub.trimNull((String)ht_sp.get("sp_time_2"));
            sp_time_3=pub.trimNull((String)ht_sp.get("sp_time_3"));
            sp_time_4=pub.trimNull((String)ht_sp.get("sp_time_4"));
            sp_time_5=pub.trimNull((String)ht_sp.get("sp_time_5"));
            is_import=pub.trimNull((String)ht_sp.get("is_import"));
        }
        if (v_list.size()>0&&!"".equals(ly_id)) {
            ht=(Hashtable)v_list.get(0);
            xm_id=pub.trimNull((String)ht.get("xm_id"));
            ly_dept=pub.trimNull((String)ht.get("ly_dept"));
            ly_reason=pub.trimNull((String)ht.get("ly_reason"));
            ly_time=pub.trimNull((String)ht.get("ly_time"));
            ly_user=pub.trimNull((String)ht.get("ly_user"));
            tel=pub.trimNull((String)ht.get("tel"));
            beizhu=pub.trimNull((String)ht.get("beizhu"));
        }
%>
<article class="page-container" style="overflow: hidden;">
    <form class="form form-horizontal" id="form-admin-add">
        <input type="hidden" name="action" id="action" value="<%=action%>"/>
        <input type="hidden" name="sp_id" id="sp_id" value="<%=sp_id%>"/>
        <input type="hidden" name="ly_id" value="<%=ly_id%>"/>
        <div class="cl pd-5  bk-gray divOverflow" style="overflow:hidden;margin-bottom: 20px;">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">所属项目：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  id="xm_id" readonly value="<%=xm_id%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-2">领用资产列表：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  id="zc_name_list" readonly value="<%=zc_name_list%>" onclick="openZcList('<%=ly_id%>');" class="input-text ">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">总价格：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  id="z_jiage" readonly value="<%=z_jiage%>"  class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-2">领用单位：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  id="ly_dept" readonly value="<%=ly_dept%>" class="input-text ">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">领用原因：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  id="ly_reason" readonly value="<%=ly_reason%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-2">领用时间：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  id="ly_time" readonly value="<%=ly_time%>" class="input-text ">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">领用人：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  id="ly_user" readonly value="<%=ly_user%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-2">联系电话：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  id="tel" readonly value="<%=tel%>" class="input-text ">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">备注：</label>
                <div class="formControls col-xs-8 col-sm-8">
                <textarea cols="" rows="2" class="textarea" readonly placeholder=""
                          dragonfly="true"><%=beizhu%></textarea>
                </div>
            </div>
            <div style="border-top:1px solid #e1e1e8;margin-top:20px;<%if(is_view<1){%>display:none;<%}%>">
                <div style="font-weight: bold;font-size: 19px;margin-top:20px;">处室管理员审批：</div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">反馈意见：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                    <textarea name="fkyj_1" cols="" rows="2" class="textarea" placeholder=""
                              dragonfly="true" <%if(is_view!=1||!"1".equals(ly_status_s)){%>readonly disabled<%}%>><%=fkyj_1%></textarea>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">审批意见：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <select onchange="setName('sp_user_1','sp_user_1_1','<%=login_name%>');" name="spyj_1" id="spyj_1" class="input-text " <%if(is_view!=1||!"1".equals(ly_status_s)){%>readonly disabled<%}%>>
                            <option value="" >请选择</option>
                            <option value="0" <%if("0".equals(spyj_1)){%>selected="selected"<%}%>>不通过</option>
                            <option value="1" <%if("1".equals(spyj_1)){%>selected="selected"<%}%>>通过</option>
                        </select>
                    </div>
                    <label class="form-label col-xs-4 col-sm-2">审批人：</label>
                    <div class="formControls col-xs-8 col-sm-2">
<%--
                        <input type="text"  id="sp_user_1_1" <%if(is_view!=0||!"1".equals(ly_status_s)){%>readonly disabled<%}%> onclick="selectUser('sp_user_1','<%=sp_user_1%>');" value="<%=sp_user_1_name%>" class="input-text ">
--%>
                        <input type="hidden"   id="sp_user_1" value="cz"/>
                        <input type="text"  id="sp_user_1_1"  name="sp_user_1"  value="<%=sp_user_1%>" class="input-text ">
                    </div>
                    <%--<label class="form-label col-xs-4 col-sm-1">审批时间：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <input type="text" name="sp_time_1" id="sp_time_1" <%if(is_view!=1||!"1".equals(ly_status_s)){%>readonly disabled<%}%> onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<%=sp_time_1%>" class="input-text Wdate">
                    </div>--%>
                </div>
            </div>
            <div style="border-top:1px solid #e1e1e8;margin-top:20px;<%if(is_view<2){%>display:none;<%}%>" >
                <div style="font-weight: bold;font-size: 19px;margin-top:20px;">处长审批：</div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">反馈意见：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                    <textarea name="fkyj_2" cols="" rows="2" class="textarea" placeholder=""
                              dragonfly="true" <%if(is_view!=2||!"1".equals(ly_status_s)){%>readonly disabled<%}%>><%=fkyj_2%></textarea>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">审批意见：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <select onchange="setName('sp_user_2','sp_user_2_2','<%=login_name%>');" name="spyj_2" id="spyj_2" class="input-text " <%if(is_view!=2||!"1".equals(ly_status_s)){%>readonly disabled<%}%>>
                            <option value="" >请选择</option>
                            <option value="0" <%if("0".equals(spyj_2)){%>selected="selected"<%}%>>不通过</option>
                            <option value="1" <%if("1".equals(spyj_2)){%>selected="selected"<%}%>>通过</option>
                        </select>
                    </div>
                    <label class="form-label col-xs-4 col-sm-2">审批人：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <input type="hidden"   id="sp_user_2" value="bgsgly"/>
                        <input type="text"   name="sp_user_2" value="<%=sp_user_2%>" id="sp_user_2_2" class="input-text ">
                    </div>
                    <%--<label class="form-label col-xs-4 col-sm-1">审批时间：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <input type="text" name="sp_time_2" id="sp_time_2" <%if(is_view!=2||!"1".equals(ly_status_s)){%>readonly disabled<%}%> onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<%=sp_time_2%>" class="input-text Wdate">
                    </div>--%>
                </div>
            </div>
            <div style="border-top:1px solid #e1e1e8;margin-top:20px;<%if(is_view<3){%>display:none;<%}%>">
                <div style="font-weight: bold;font-size: 19px;margin-top:20px;">办公室管理员审批：</div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">反馈意见：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                    <textarea name="fkyj_3" cols="" rows="2" class="textarea" placeholder=""
                              dragonfly="true" <%if(is_view!=3||!"1".equals(ly_status_s)){%>readonly disabled<%}%>><%=fkyj_3%></textarea>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">审批意见：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <select onchange="setName('sp_user_3','sp_user_3_3','<%=login_name%>');" name="spyj_3" id="spyj_3" class="input-text " <%if(is_view!=3||!"1".equals(ly_status_s)){%>readonly disabled<%}%>>
                            <option value="" >请选择</option>
                            <option value="0" <%if("0".equals(spyj_3)){%>selected="selected"<%}%>>不通过</option>
                            <option value="1" <%if("1".equals(spyj_3)){%>selected="selected"<%}%>>通过</option>
                        </select>
                    </div>
                    <label class="form-label col-xs-4 col-sm-2">审批人：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <input type="hidden"   id="sp_user_3" value="bgszr"/>
                        <input type="text" name="sp_user_3" value="<%=sp_user_3%>" id="sp_user_3_3" class="input-text ">
                    </div>
                   <%-- <label class="form-label col-xs-4 col-sm-1">审批时间：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <input type="text" name="sp_time_3" id="sp_time_3" <%if(is_view!=3||!"1".equals(ly_status_s)){%>readonly disabled<%}%> onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<%=sp_time_3%>" class="input-text Wdate">
                    </div>--%>
                </div>
            </div>
            <div style="border-top:1px solid #e1e1e8;margin-top:20px;<%if(is_view<4){%>display:none;<%}%>">
                <div style="font-weight: bold;font-size: 19px;margin-top:20px;">办公室主任审批：</div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">反馈意见：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                    <textarea name="fkyj_4" cols="" rows="2" class="textarea" placeholder=""
                              dragonfly="true" <%if(is_view!=4||!"1".equals(ly_status_s)){%>readonly disabled<%}%>><%=fkyj_4%></textarea>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">审批意见：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <select name="spyj_4" id="spyj_4" class="input-text " <%if(is_view!=4||!"1".equals(ly_status_s)){%>readonly disabled<%}%>>
                            <option value="" >请选择</option>
                            <option value="0" <%if("0".equals(spyj_4)){%>selected="selected"<%}%>>不通过</option>
                            <option value="1" <%if("1".equals(spyj_4)){%>selected="selected"<%}%>>通过</option>
                        </select>
                    </div>
                    <div class="formControls col-xs-8 col-sm-2" style="line-height: 30px;">
                        <%--<input type="text" id="sp_user_4_1" onclick="selectUser('sp_user_4','<%=sp_user_4%>');" value="" class="input-text ">--%>
                            是否重要:&nbsp;<input type="radio" name="is_import" <%if("0".equals(is_import)){%>checked="checked"<%}%> value="0" <%if(is_view!=4||!"1".equals(ly_status_s)){%>readonly disabled<%}%>>是&nbsp;
                                  <input type="radio" name="is_import"  <%if("1".equals(is_import)){%>checked="checked"<%}%> value="1" <%if(is_view!=4||!"1".equals(ly_status_s)){%>readonly disabled<%}%> >否
                    </div>
                    <%--<label class="form-label col-xs-4 col-sm-1">审批时间：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <input type="text" name="sp_time_4" id="sp_time_4" <%if(is_view!=4||!"1".equals(ly_status_s)){%>readonly disabled<%}%> onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<%=sp_time_4%>" class="input-text Wdate">
                    </div>--%>
                </div>
            </div>
            <div style="border-top:1px solid #e1e1e8;margin-top:20px;<%if(is_view<5){%>display:none;<%}%>">
                <div style="font-weight: bold;font-size: 19px;margin-top:20px;">局长审批：</div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">反馈意见：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                    <textarea name="fkyj_5" cols="" rows="2" <%if(is_view!=5||!"1".equals(ly_status_s)){%>readonly disabled<%}%> class="textarea" placeholder=""
                              dragonfly="true"><%=fkyj_5%></textarea>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">审批意见：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <select name="spyj_5" id="spyj_5" class="input-text " <%if(is_view!=5||!"1".equals(ly_status_s)){%>readonly disabled<%}%>>
                            <option value="" >请选择</option>
                            <option value="0" <%if("0".equals(spyj_5)){%>selected="selected"<%}%>>不通过</option>
                            <option value="1" <%if("1".equals(spyj_1)){%>selected="selected"<%}%>>通过</option>
                        </select>
                    </div>
                   <%-- <label class="form-label col-xs-4 col-sm-1">审批时间：</label>
                    <div class="formControls col-xs-8 col-sm-2">
                        <input type="text" name="sp_time_5" id="sp_time_5" <%if(is_view!=5||!"1".equals(ly_status_s)){%>readonly disabled<%}%> onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<%=sp_time_5%>" class="input-text Wdate">
                    </div>--%>
                </div>
            </div>
        </div>
    </form>
</article>
<div class="cl mb-10  bk-gray " style="height: 50px;">
    <div class="col-sm-3 pd-10" style="width:100%;text-align: center;">
        <input class="btn btn-primary radius btn-green" type="button" <%if(!"1".equals(ly_status_s)||"admin".equals(login_user)){%>readonly disabled<%}%> onclick="javascript:saveForm('save');" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
    </div>
</div>
<script>
    function  setName(id,id_1,value){
        $("#"+id).val(value);
        $("#"+id_1).val(value);
    }
    function selectUser(id,userid) {
        layer_show("审批人", "select_user-t.jsp?id="+id+"&userid="+userid, "1000", "500");
    }
    function openZcList(ly_id) {
        layer_show("资产列表", "zc_list-t.jsp?ly_id="+ly_id, "1000", "500");
    }
    function addRules(title, url) {
        var action = $("#action").val();
        if(action!='update'){
            layer.msg('请先保存再添加', {
                icon: 5,
                time: 2000 //2秒关闭（如果不配置，默认是3秒）
            }, function () {

            });
            return false;
        }
        var abc = layer.open({
            title:title,
            type: 2,
            content: url,
            maxmin: true
        });
        layer.full(abc);

    }
    function closeIframe() {
        parent.searchModel();
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
    function saveForm(type){
        var is_view='<%=is_view%>';
        if(is_view!=0){
            if($("#spyj_"+is_view).val()==''){
                layer.msg('请选择审批意见', {
                    icon: 5,
                    time: 2000 //2秒关闭（如果不配置，默认是3秒）
                });
                return false;

            }
        }
        $.ajax({
            type: "POST",
            url: "./action.jsp",
            data: $('#form-admin-add').serialize(),
            success: function (msg) {
                if (msg.indexOf("success") >= 0) {
                    layer.msg('操作成功!', {icon: 1, time: 1000},
                        function () {
                            $("#action").val("update");
                            parent.searchModel();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                } else {
                    layer.msg('操作失败', {
                        icon: 5,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {
                    });
                }
            }
        });
    }
    function deleteById(id,ly_id) {
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                type: "POST",
                url: "./action.jsp?action=delete&delete_id="+id+"&ly_id="+ly_id,
                data: $('#form-admin-add').serialize(),
                success: function (msg) {
                    if (msg.indexOf("success") >= 0) {
                        layer.msg('操作成功!', {icon: 1, time: 1000},
                            function () {
                                location.reload();
                                parent.searchModel();
                            });
                    } else {
                        layer.msg('操作失败', {
                            icon: 5,
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {
                        });
                    }
                }
            });
        })
    }
</script>
<%
    } catch (Exception e) {
        out.println("查询异常" + e);
        return;
    } finally {
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {
            }
        }
    }
%>