<%--
  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="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="java.util.*" %>
<%
    Connection conn = null;
    Vector v_list;
    Hashtable ht = new Hashtable();
    Pub pub = new Pub();
    ConnectionFactory cf = new ConnectionFactory();
    String update_id = pub.trimNull(request.getParameter("update_id"));
    try {
        conn = com.censoft.db.DBUtil.getConnection();
        v_list=cf.doQuery(conn,"select t1.zc_name,pinpai,t3.*" +
                " from zc_register t1 join zc_bg t3 on t1.zc_id=t3.zc_id " +
                " where t3.bg_id=? ",null,new Object[]{update_id});
        if (v_list == null) {
            out.println("查询出错");
            return;
        }
        if (v_list.size() > 0) {
            ht = (Hashtable) v_list.get(0);

        }
    } catch (Exception e) {
        try {
            if(conn != null){
                conn.rollback();
            }
        } catch (SQLException e1) {
            e1.printStackTrace();
        }
        return;
    } finally {
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {
            }
        }
    }
%>
<style>
    .col-sm-1{width: 12%;}
</style>
<article class="page-container" style="overflow: hidden;">
    <form class="form form-horizontal" id="form-admin-add">
        <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-1">资产名称：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  value="<%=pub.trimNull((String)ht.get("zc_name"))%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-1">资产编号：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  name="zc_id" value="<%=pub.trimNull((String)ht.get("zc_id"))%>" class="input-text ">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">原所属项目：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  name="old_xm_id" value="<%=pub.trimNull((String)ht.get("old_xm_id"))%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-1">品牌：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  value="<%=pub.trimNull((String)ht.get("pinpai"))%>" class="input-text">
                </div>

            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">原使用部门：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text" name="old_ly_dept" value="<%=pub.trimNull((String)ht.get("old_ly_dept"))%>" class="input-text">
                </div>
                <label class="form-label col-xs-4 col-sm-1">原使用人：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text" name="old_ly_user" value="<%=pub.trimNull((String)ht.get("old_ly_user"))%>" class="input-text">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">新属项目：</label>
                <div class="formControls col-xs-8 col-sm-3" id="xm_id" >
                    <input type="text" name="old_ly_user" value="<%=pub.trimNull((String)ht.get("new_xm_id"))%>" class="input-text">
                </div>
                <label class="form-label col-xs-4 col-sm-1">新使用部门：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text"  name="new_ly_dept"  class="input-text" value="<%=pub.trimNull((String)ht.get("new_ly_dept"))%>">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">新使用人：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text"  name="new_ly_user" class="input-text" value="<%=pub.trimNull((String)ht.get("new_ly_user"))%>">
                </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="bg_time" class="input-text "  autocomplete="off"  value="<%=pub.trimNull((String)ht.get("bg_time"))%>" >
                </div>
            </div>
        </div>
    </form>
    <%--<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" onclick="javascript:saveForm();" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
        </div>
    </div>--%>
</article>
<script>
    function saveForm(){
        $.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 () {
                            parent.searchModel();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                } else {
                    layer.msg('操作失败'+msg, {
                        icon: 5,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {
                    });
                }
            }
        });
    }
</script>