<%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk/Pc.master" AutoEventWireup="true" CodeBehind="PC_addeditpc.aspx.cs" Inherits="helpdesk.helpdesk.PC_addeditpc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <style>
        .table select {
         width:141px;
        }

        .red {
         color:red
        }
        .table>tbody>tr>th {
         text-align:right;  
         padding-top:15px;
        }
    </style>


    
          <div  class="well">

            
                   <asp:Button ID="Button4" CausesValidation="false" runat="server" class="btn btn-primary btn-flat bg-green"  onclick="back_Click" Text="返回" />
          
          
          
              </div>


    







    <asp:Panel runat="server" ID="pnl_detail">


     
  <div class="panel panel-default">
    <div class="panel-heading">
     1.硬件PC基本信息
    </div>
    
      <div class="panel-body">

 
      <table  class="table">
        <tbody>
           
           <tr>     
     
          <th style="width:100px; " ><span class="red">*</span>  机器名  </th>
       
          <td style="width:200px;  ">
               <asp:TextBox ID="txt_pcname"  ClientIDMode="Static"  CssClass="form-control" runat="server"  ></asp:TextBox>
          </td>
        
          
          
          
              
                
         <th style="width:100px;" >资产编号</th>
          <td  style="width:200px;  "> 
             
               <asp:TextBox ID="txt_assettag" runat="server"   ClientIDMode="Static"  CssClass="form-control"></asp:TextBox>
               
              <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txt_assettag" runat="server" ErrorMessage="必须输入资产编号" Display="Dynamic"></asp:RequiredFieldValidator>  
            </td>
             
          
          
          
      
                
         <th style="width:100px; " >机器型号<span class="glyphicon glyphicon-triangle-top"></span></th>
          <td  style="width:200px; "> 
          
              <div class="input-group">
             <asp:TextBox runat="server"  ID="txt_spec"  ClientIDMode="Static" CssClass="form-control"></asp:TextBox>


                  <span class="input-group-addon">
    <a href="#"   onclick="showpara('lbl_spec','txt_spec'); return false;"><i class="glyphicon glyphicon-plus"></i>

    </a>

</span>


                  </div>
              

















            </td>
            
         </tr>






<tr> 
          <th  >序列号</th>
          <td  >
                <asp:TextBox ID="txt_serial" CssClass="form-control" runat="server"></asp:TextBox>
           </td>
           
                   
        <th  >使用者:</th>
          <td  >
           
                 <asp:TextBox ID="txt_enduser" CssClass="form-control" runat="server" ></asp:TextBox>
             
                   
           </td>
           
             
                
         <th  >使用部门:</th>
          <td  > 
           
              <asp:DropDownList ID="ddl_dept" CssClass="form-control"  Width="200px" runat="server">
           </asp:DropDownList>
            </td>
             
       
          </tr>
 




             

                
      <tr  >     
                
         <th  >机器用途:</th>
          <td  > 
          


                 <div class="input-group">
             <asp:TextBox runat="server"  ID="txt_usetype"  ClientIDMode="Static" CssClass="form-control"></asp:TextBox>


                  <span class="input-group-addon">
    <a href="#"   onclick="showpara('lbl_usetype','txt_usetype'); return false;"><i class="glyphicon glyphicon-plus"></i>

    </a>

</span>


                  </div>
              

              </td>









            
     
          <th >使用状态:</th>
          <td >
             
           



                 <div class="input-group">
             <asp:TextBox runat="server"  ID="txt_usestatus" Text="在用"  ClientIDMode="Static" CssClass="form-control"></asp:TextBox>


                  <span class="input-group-addon">
    <a href="#"   onclick="showpara('lbl_usestatus','txt_usestatus'); return false;"><i class="glyphicon glyphicon-plus"></i>

    </a>

</span>


                  </div>
              





           </td>
          
                
         <th  >操作系统:</th>
          <td  > 
             
         
          




                 <div class="input-group">
             <asp:TextBox runat="server"  ID="txt_os"  ClientIDMode="Static" CssClass="form-control"></asp:TextBox>


                  <span class="input-group-addon">
    <a href="#"   onclick="showpara('lbl_os','txt_os'); return false;"><i class="glyphicon glyphicon-plus"></i>

    </a>

</span>


                  </div>
              






              
            </td>
            </tr>








           <tr> 
          <th  >Office</th>
          <td  >
              
          
              
                 <div class="input-group">
             <asp:TextBox runat="server"  ID="txt_office"  ClientIDMode="Static" CssClass="form-control"></asp:TextBox>


                  <span class="input-group-addon">
    <a href="#"   onclick="showpara('lbl_office','txt_office'); return false;"><i class="glyphicon glyphicon-plus"></i>

    </a>

</span>


                  </div>



              
           </td>
         
             


                <th  >所属组织</th>
          <td  >
            
                   <div class="input-group">
             <asp:TextBox runat="server"  ID="txt_belongto"  ClientIDMode="Static" CssClass="form-control"></asp:TextBox>


                  <span class="input-group-addon">
    <a href="#"   onclick="showpara('lbl_belongto','txt_belongto'); return false;"><i class="glyphicon glyphicon-plus"></i>

    </a>

</span>


                  </div>








           </td>
       
            

                  <th  >存放位置:</th>
          <td  > 
             
          
              <div class="input-group">
             <asp:TextBox runat="server"  ID="txt_storeplace"  ClientIDMode="Static" CssClass="form-control"></asp:TextBox>


                  <span class="input-group-addon">
    <a href="#"   onclick="showpara('lbl_storeplace','txt_storeplace'); return false;"><i class="glyphicon glyphicon-plus"></i>

    </a>

</span>


                  </div>
              
                  
            </td>
            

                
    
          </tr>


            <tr>
                <td colspan="6"  style="border:0px; background-color:#e0e0e0; height:10px;" ></td>
            </tr>

             



         <tr>
              <th  >IP地址</th>
          <td  >
              <asp:TextBox ID="txt_ip" runat="server"  CssClass="form-control"  ClientIDMode="Static"  ></asp:TextBox>
		
           </td>
       
                 <th    >MAC地址</th>
          <td   >
              <asp:TextBox ID="txt_mac" runat="server"  ClientIDMode="Static"   CssClass="form-control"  ></asp:TextBox>
		
           </td>

       
         <th    >主板号:</th>
          <td   > 
             
              <asp:TextBox ID="txt_mainboardserialno" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
            </td>
            
     
     
          </tr>
          


            <tr> 
                
      
     
         
     
        
               
                     <th    >制造商</th>
          <td  >
              <asp:TextBox ID="txt_mainboardmanufacture" runat="server"   CssClass="form-control"  ></asp:TextBox>
		
           </td>

                
                     <th >购买时间:</th>
          <td  > 
             
              <asp:TextBox ID="dt_buydate"  CssClass="form-control" runat="server" onClick="javascript:ShowCalendar(this)"  ></asp:TextBox>
              
            </td>
            
     
                   <th  >保修到期日</th>
          <td  >
              <asp:TextBox ID="dt_expiredate"  CssClass="form-control" runat="server" onClick="javascript:ShowCalendar(this)" ></asp:TextBox>
		
           </td>


            </tr>


            <tr>



                
       
                
                 
         <th  >预留字段1:</th>
          <td  > 
             
              <asp:TextBox ID="txt_prezver1" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
            </td>


          <th >预留字段2</th>
          <td >
              <asp:TextBox ID="txt_prezver2" runat="server"  CssClass="form-control"    ></asp:TextBox>
		
           </td>

                <th>&nbsp;</th>
                <td>&nbsp;</td>

            </tr>




            
            <tr>
                <td colspan="6"  style="border:0px; background-color:#e0e0e0; height:10px;" ></td>
            </tr>




            <tr>

                  <th    >显示器:</th>
          <td  > 
             
              <asp:TextBox ID="txt_display" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
            </td>



            <th   >CPU:</th>
          <td  > 
             
              <asp:TextBox ID="txt_cpu" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
            </td>



                

            <th   >内存:</th>
          <td   > 
             
              <asp:TextBox ID="txt_mem" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
            </td>




            </tr>





               <tr>

                  <th    >硬盘:</th>
          <td   > 
             
              <asp:TextBox ID="txt_harddisk" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
            </td>



            <th   >鼠标:</th>
          <td  > 
             
              <asp:TextBox ID="txt_mouse" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
            </td>



                

            <th   >键盘:</th>
          <td  > 
             
              <asp:TextBox ID="txt_keyboard" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
            </td>




            </tr>







             <tr>

           


            <th   >光驱:</th>
          <td  > 
             
              <asp:TextBox ID="txt_cd" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
            </td>

                    <th   > 网卡 </th>
          <td  > 
             
           <asp:TextBox ID="txt_netcard" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
            </td>

                

            <th   > 声卡</th>
          <td  > 
             
   <asp:TextBox ID="txt_sound" runat="server"  CssClass="form-control"  ></asp:TextBox>
              
              
            </td>




            </tr>


               </tbody>  
</table>

   
          
     </div>
      </div>     
          
    
    </asp:Panel>      
          
          
          
          
          
        
     
  <div class="panel panel-default">
    <div class="panel-heading">
     2.自定义硬件   <a href="pcparam.aspx?types=hardware"><img src="../images/add.png" border=0px />修改模板</a> 
    </div>
    
      <div class="panel-body">


          
        <asp:table runat="server" ID="tb_hardware"    CssClass="table">
         </asp:table>  
      

</div>
      </div>
      
                         
       
          
          
          
        


    
    
    
    
    
    
    
    
    
    
         
  <div class="panel panel-default">
    <div class="panel-heading">
     3.自定义软件   <a href="pcparam.aspx?types=software"><img src="../images/add.png" border=0px />修改模板</a> 
    </div>
    
      <div class="panel-body">  

        <asp:table runat="server" ID="tb_software"  CssClass="table">
         </asp:table>  
        </div>
      </div>
      
                
                

            
  <div class="panel panel-default">
    <div class="panel-heading">
    4.备注
    </div>
    
      <div class="panel-body">  
  
      <table  class="table" >
        <tbody>

     <tr  >     
          <td colspan="4">
         <asp:TextBox runat="server" Width="700px" Height="60px"
             
              CssClass="form-control"
             
              TextMode="MultiLine" ID="txt_note"></asp:TextBox>
               
             
              
          </td></tr>
          
          </tbody>
          </table>
         
   </div>
      </div>

          <div  class="well">

      
               <asp:Button ID="btn_add"
                   
                    OnClientClick="if(isAddConflict()) return false;"
                    runat="server" class="btn btn-primary btn-flat" OnClick="btn_add_Click"   Text="添加" />
           
                <asp:Button CausesValidation="false" ID="Button2" runat="server" class="btn btn-primary btn-flat bg-green"  onclick="back_Click" Text="返回" />
          
            <asp:Button ID="btn_update"
                
                
                  OnClientClick="if(isEditConflict()) return false;"
                 runat="server" class="btn bg-lime btn-flat" OnClick="btn_update_Click"   Text="更新" />
          

            <asp:Button ID="del" runat="server" class="btn btn-primary btn-flat" OnClick="btn_del_Click"   Text="删除" />
           
              </div>
      
          
          
          
          
          
          
        
    <div style="display:none">
    <asp:Label runat="server" ClientIDMode="Static" ID="lbl_spec"></asp:Label>

    <asp:Label runat="server" ClientIDMode="Static" ID="lbl_usetype"></asp:Label>

      <asp:Label runat="server" ClientIDMode="Static" ID="lbl_usestatus"></asp:Label>

          <asp:Label runat="server" ClientIDMode="Static" ID="lbl_os"></asp:Label>

          <asp:Label runat="server" ClientIDMode="Static" ID="lbl_office"></asp:Label>


           <asp:Label runat="server" ClientIDMode="Static" ID="lbl_belongto"></asp:Label>

           <asp:Label runat="server" ClientIDMode="Static" ID="lbl_storeplace"></asp:Label>

        </div>
    
    
    

              <script>



                  function showpara( _contId, _txtId) {

                      layer.open({
                          type: 1,
                          skin: 'layui-layer-rim', //加上边框
                          area: ['420px', '240px'], //宽高
                          content: formatStr($("#" + _contId).html(), _txtId)
                      });

                  }


                  function formatStr(cont, _txtId)
                  {
                      var result = "";
                      var items = cont.split(';');
                      for (var i = 0; i < items.length; i++)
                      {

                          result += '<a href="#" onclick="javascript:closethis(this,'+"'"+_txtId +"'"+ '); return false;" class="btn  btn-flat  btn-sm">' + items[i] + '</a> ';

                      }

                      return result;
                  }


                  function closethis(cont, _txtId)
                  { 
                     
                      $("#" + _txtId).val($(cont).html()); 
                      layer.closeAll();
                  
                  }





                  function isEditConflict() {
                      _name = $("#txt_pcname").val();
                      _assetname = $("#txt_assettag").val();
                      _ip = $("#txt_ip").val();
                      _mac = $("#txt_mac").val();
                      _id=<%=id %>;
                      var result = true;

                      $.ajax({
                          url: "ajax/chk_asset_edit.aspx",
                          async: false,
                          cache: false,
                          data: {
                              name: escape(_name),
                              assetname: escape(_assetname),
                              ip: escape(_ip),
                              mac: escape(_mac),
                              id:_id,
                              types:"pc"
                          },
                          success: function (data) {


                              if (data == "name") {
                                  alert("机器名冲突");
                                  result = true;
                                  return;
                              }

                              if (data == "assetname") {
                                  alert("资产名冲突");
                                  result = true;
                                  return;
                              }


                              if (data == "ip") {
                                  alert("IP冲突");
                                  result = true;
                                  return;
                              }

                              if (data == "mac") {
                                  alert("MAC冲突");
                                  result = true;
                                  return;
                              }

                              result = false;
                          }




                      });

                      return result;
                  }




                  function isAddConflict()
                  {
                      _name = $("#txt_pcname").val();
                      _assetname = $("#txt_assettag").val();
                      _ip = $("#txt_ip").val();
                      _mac = $("#txt_mac").val();
                   
                      var result = true;

                      $.ajax({
                          url: "ajax/chk_asset.aspx",
                          async: false,
                          cache:false,
                          data: {
                              name: escape(_name),
                              assetname: escape(_assetname),
                              ip: escape(_ip),
                              mac: escape(_mac)
                          },
                          success: function (data) {
                            

                              if (data == "name")
                              {
                                  alert("机器名冲突");
                                  result = true;
                                  return;
                              }
                              
                              if (data == "assetname") {
                                  alert("资产名冲突");
                                  result = true;
                                  return;
                              }


                              if (data == "ip") {
                                  alert("IP冲突");
                                  result = true;
                                  return;
                              }

                              if (data == "mac") {
                                  alert("MAC冲突");
                                  result = true;
                                  return;
                              }

                              result = false;
                          }




                      });

                      return result;
                  }
            
                  
                  
                  
                  
                  
                  
                  
                  </script>






</asp:Content>
