<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation = "false" CodeBehind="Computers.aspx.cs" 
Inherits="SmartLogonServer.Computers" %>

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <!--必须的css引用-->
    <link href="Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="Content/bootstrap-table/bootstrap-table.min.css"  rel="stylesheet" />
<link href="Content/bootstrap-table/extensions/fixed-column/bootstrap-table-fixed-columns.css"  rel="stylesheet" />
    <link href="Content/toastr/toastr.min.css"  rel="stylesheet" />
</head>
<body>
    <div class="panel-body" style="padding-bottom:0px;">
      
          <div class="panel panel-default">
            <div class="panel-heading"><%=GetString("D0006") %></div>
            <div class="panel-body">
                <form id="formSearch" class="form-horizontal">
                    <div class="form-group">
                        <div class ="row">
                        <label class="control-label col-xs-1" for="txt_search_pcode"><%=GetString("D0016") %></label>
                        <div class="col-xs-3">
                            <input type="text" class="form-control" id="txt_search_pccode"/>
                        </div>
                        <label class="control-label col-xs-1" for="txt_search_name"><%=GetString("D0017") %></label>
                        <div class="col-xs-3">
                            <input type="text" class="form-control" id="txt_search_name" />
                        </div>
                            </div>
                        <div class ="row">
                        <label class="control-label col-xs-1" for="txt_search_memo"><%=GetString("D0018") %></label>
                        <div class="col-xs-3">
                            <input type="text" class="form-control" id="txt_search_memo"/>
                        </div>
                        <label class="control-label col-xs-1" for="txt_search_group"><%=GetString("D0010") %></label>
                        <div class="col-xs-3">
                            <input type="text" class="form-control" id="txt_search_group" />
                        </div>
   
                        <div class="col-xs-4" style="text-align:right;">
                            <button type="button" id="btn_clear"  class="btn"><%=GetString("B0030") %></button>
                            <button type="button" id="btn_query" class="btn btn-primary"><%=GetString("B0031") %></button>
                        </div>
                            </div>
                    </div>
                </form>
            </div>
        </div>

        <div id="toolbar" class="btn-group">
            <button id="btn_add" type="button" class="btn btn-success">
                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span><%=GetString("B0021") %>
            </button>
        </div>
        <table id="tb_computer"></table>
    </div>

   

   <div class="modal fade" id="ModuleComputer" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLiveLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        
       <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h5 class="modal-title" id="staticBackdropLiveLabel"><%=GetString("B0022") %></h5>
      </div>
      <div class="modal-body">
       
                 <div class="row" style="padding:5px;">          
                
          <div class="col-sm-2"><label for="edtComputerID" ><%=GetString("D0016") %></label> </div>
          <div class="col-sm-10"><input type="text"  id="edtComputerID" name="edtComputerID" class="form-control" placeholder="0000000000"/></div>
           
                   </div>

            <div class="row" style="padding:5px;">            
           <!--                     
          <div class="col-sm-2"><label for="edtComputerGroup" >组号</label> </div>
          <div class="col-sm-4"><input type="text"  id="edtComputerGroup"  name="edtComputerGroup" readonly="true" class="form-control" placeholder="组号" /></div>
            -->
          <div class="col-sm-2"><label for="edtComputerName" ><%=GetString("D0017") %></label> </div>
          <div class="col-sm-10"><input type="text"  id="edtComputerName" name="edtComputerName"  class="form-control" placeholder=<%=GetQuoteString("D0017") %> /></div>
              </div>
               
          <div class="row" style="padding:5px;">       
          <div class="col-sm-2"><label for="edtComputerUserName" ><%=GetString("D0019") %></label> </div>
          <div class="col-sm-4"><input type="text" id="edtComputerUserName"  name="edtComputerUserName" class="form-control" placeholder=<%=GetQuoteString("D0019") %>/></div>

          <div class="col-sm-2"><label for="edtComputerUserPwd" ><%=GetString("D0020") %></label></div> 
          <div class="col-sm-4"><input type="password"  id="edtComputerUserPwd" name="edtComputerUserPwd"  class="form-control" placeholder=<%=GetQuoteString("D0023") %> /></div> 
              
         </div>
          <div class="row" style="padding:5px;">     
          <div class="col-sm-2"><label for="edtComputerDomain" ><%=GetString("D0021") %></label></div> 
          <div class="col-sm-10"><input type="text" id="edtComputerDomain"  name="edtComputerDomain" class="form-control" placeholder=<%=GetQuoteString("D0021") %> /></div> 
         </div>
          <div class="row" style="padding:5px;">      
          <div class="col-sm-2"><label for="edtComputerDomain" ><%=GetString("D0022") %></label></div> 
          <div class="col-sm-10"><input type="text" id="edtPCDomain"  name="edtPCDomain" class="form-control" placeholder=<%=GetQuoteString("D0022") %> /></div> 
         </div>
                    <div class="row" style="padding:5px;">     
          <div class="col-sm-2"><label for="edtComputerMemo" ><%=GetString("D0018") %></label></div> 
          <div class="col-sm-10"><input type="text" id="edtComputerMemo"  name="edtComputerMemo"   class="form-control"/></div> 
         </div>
           <div class="row" style="padding:5px;">     
                               
                        <label class="control-label col-xs-2"><%=GetString("D0010") %></label>
                        <div class="col-xs-10">
     
                        <select name="selectgroup" id="selectgroup" class="form-control">
    
                            </select>

                        
          
         </div>                
        </div>
      
      <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span><%=GetString("B0025") %></button>
                    <button type="button" id="pc-sava-edit-btn" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span><%=GetString("B0026") %></button>
        
      </div>
    </div>
  </div>
</div>
</div>

<div class="modal fade" id="ModuleLogonUI" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticModuleLogonUI" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        
       <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h5 class="modal-title" id="staticModuleLogonUI"><%=GetString("D0024") %></h5>
      </div>
      <div class="modal-body">
       
                 <div class="row mt-3">          
                
          <div class="col-sm-2"><label for="edtComputerID2" ><%=GetString("D0016") %></label> </div>
          <div class="col-sm-10"><input type="text"  id="edtComputerID2" name="edtComputerID2" class="form-control" placeholder="0000000000"/></div>
           
                   </div>

            
            <div class="text-center"> 
                <div class="col-sm-3"></div>
                <div class="col-sm-9">
            <img id="imgshow" width="128" height="128"  src=""/>
            <input type="file" class="form-control" accept="image/*"  id="customFile" style="display: none;" />
            
            <button type="button" class="btn btn-primary btn-lg" onclick="$('#customFile').click()" ><%=GetString("D0025") %></button>
                <label><%=GetString("D0033") %></label>
                    </div>
            </div>   
         
          <div class="row mt-3"> 
          <div class="col-sm-2"><label for="edtComputerDomain" ><%=GetString("D0026") %></label></div> 
          <div class="col-sm-10"><input type="text" id="edtLogonUIText1"  name="edtLogonUIText1" class="form-control" placeholder="刷卡登录" /></div> 
         </div>
                    <div class="row mt-3"> 
          <div class="col-sm-2"><label for="edtComputerMemo" ><%=GetString("D0027") %></label></div> 
          <div class="col-sm-10"><input type="text" id="edtLogonUIText2"  name="edtLogonUIText2"   class="form-control" placeholder="友我科技"/></div> 
         </div>
           <div class="row mt-3 "> 
             <div class="col-sm-2"><label for="edtComputerDomain" ><%=GetString("D0028") %></label></div> 
          <div class="col-sm-3 form-check">
              <input type="radio" id="showeditauto"  name="showeditauto" value="0"  />
             <label class="form-check-label" for="showeditauto"><%=GetString("D0029") %></label>
                </div> 
               <div class="col-sm-3 form-check">
              <input type="radio" id="showedityes"  name="showeditauto"   value="1"  />
             <label class="form-check-label" for="showedityes"><%=GetString("D0030") %></label>
          </div> 
             <div class="col-sm-3 form-check">
              <input type="radio" id="showeditno"  name="showeditauto"   value="2"  />
             <label class="form-check-label" for="showeditno"><%=GetString("D0031") %></label>
          </div> 
             <div class="col-sm-3 form-check">
              <input type="radio" id="cardkey"  name="showeditauto"   value="3"  />
             <label class="form-check-label" for="cardkey"><%=GetString("D0032") %></label>
          </div> 
         </div>                
        </div>
      
      <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span><%=GetString("B0025") %></button>
                    <button type="button" id="Logonui-sava-edit-btn" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span><%=GetString("B0026") %></button>
        
      </div>
    </div>
  </div>
</div>

        <div class="modal fade" id="ModuleComputerConfig" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLiveLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        
       <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h5 class="modal-title" id="staticLiveLabel"><%=GetString("D0034") %></h5>
      </div>
      <div class="modal-body">
       
                 <div class="row mt-3">          
                
          <div class="col-sm-2"><label for="edtComputerID" ><%=GetString("D0016") %></label> </div>
          <div class="col-sm-10"><input type="text"  id="edtConfigComputerID" name="edtConfigComputerID" class="form-control" readonly="true"/></div>
           
                   </div>

         <div class="row mt-3">         
                                
          <div class="col-sm-2"><label ><%=GetString("D0035") %></label> </div>
          <div class="col-sm-4">
              <div class="form-check">
              <input type="radio" name="outoftime" class="form-check-input" id="outtime0" value="0" />
              <label class="form-check-label" for="outtime0"><%=GetString("D0036") %></label>
            </div>
                            <div class="form-check">
              <input type="radio" name="outoftime" class="form-check-input" id="outtime1" value="1" />
              <label class="form-check-label" for="outtime1"><%=GetString("D0037") %></label>
            </div>
                            <div class="form-check">
              <input type="radio" name="outoftime" class="form-check-input" id="outtime2" value="2" />
              <label class="form-check-label" for="outtime2"><%=GetString("D0038") %></label>
            </div>
                            <div class="form-check">
              <input type="radio" name="outoftime" class="form-check-input" id="outtime3" value="3" />
              <label class="form-check-label" for="outtime3"><%=GetString("D0039") %></label>
            </div>
              <div class="form-check">
              <input type="radio" name="outoftime" class="form-check-input" id="outtime4" value="4" />
              <label class="form-check-label" for="outtime4"><%=GetString("D0040") %></label>
            </div>

          </div>
         </div>
               
          <div class="row mt-3">         
                                
          <div class="col-sm-2"><label><%=GetString("D0041") %></label> </div>
          <div class="col-sm-4">
              <div class="form-check">
              <input type="radio" name="outofcard" class="form-check-input" id="outcard0" value="0" />
              <label class="form-check-label" for="outcard0"><%=GetString("D0036") %></label>
            </div>
                            <div class="form-check">
              <input type="radio" name="outofcard" class="form-check-input" id="outcard1" value="1" />
              <label class="form-check-label" for="outcard1"><%=GetString("D0037") %></label>
            </div>
                            <div class="form-check">
              <input type="radio" name="outofcard" class="form-check-input" id="outcard2" value="2" />
              <label class="form-check-label" for="outcard2"><%=GetString("D0038") %></label>
            </div>
                            <div class="form-check">
              <input type="radio" name="outofcard" class="form-check-input" id="outcard3" value="3" />
              <label class="form-check-label" for="outcard3"><%=GetString("D0039") %></label>
            </div>
              <div   class="form-check" >
              <input type="radio" name="outofcard" class="form-check-input" id="outcard4" value="4" />
              <label class="form-check-label" for="outcard4"><%=GetString("D0040") %></label>
            </div>

          </div>
         </div>    
                   
        </div>
      
      <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span><%=GetString("B0025") %></button>
                    <button type="button" id="pc-sava-config-btn" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span><%=GetString("B0026") %></button>
        
      </div>
    </div>
  </div>
</div>
        <!--必须的js文件-->
        <script src="Content/jquery-1.9.1.min.js"></script>
        <script src="Content/bootstrap/js/bootstrap.min.js"></script>
        <script src="Content/bootstrap-table/bootstrap-table.min.js"></script>
        <script src="Content/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="Content/bootstrap-table/extensions/fixed-column/bootstrap-table-fixed-columns.js"></script>
            <script src="Content/toastr/toastr.min.js"></script>
        <script src="Content/sweetalert/sweetalert.min.js"></script>
        <script type="text/javascript">
            //页面加载完成之后


            $(function () {


                //表格的初始化
                $('#tb_computer').bootstrapTable({
                    url: "Computer.ashx",                         //直接从本地数据初始化表格
                    method: 'get',                      //请求方式（*）
                    //datatype: "json",
                    //contentType: "application/x-www-form-urlencoded",
                    toolbar: '#toolbar',                //工具按钮用哪个容器
                    idField: 'ComputerID',
                    uniqueId: 'ComputerID',
                    striped: true,                      //是否显示行间隔色
                    cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                    pagination: true,                   //是否显示分页（*）
                    sortable: false,                     //是否启用排序
                    sortOrder: "asc",                   //排序方式
                    queryParams: function (params) {
                        var pages = {
                            limit: params.pageSize, // 每页显示数量
                            offset: params.pageNumber, // SQL语句起始索引
                            pccode: $("#txt_search_pccode").val(),
                            name: $("#txt_search_name").val(),
                            memo: $("#txt_search_memo").val(),
                            pcgroup: $("#txt_search_group").val()
                        }

                        return JSON.stringify(pages);
                    },                                  //传递参数（*）
                    queryParamsType: "",
                    sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                    pageNumber: 1,                      //初始化加载第一页，默认第一页
                    pageSize: 25,                       //每页的记录行数（*）
                    pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                    search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                    strictSearch: true,
                    showColumns: true,                  //是否显示所有的列

                    showRefresh: true,                  //是否显示刷新按钮
                    minimumCountColumns: 2,             //最少允许的列数
                    height: 800,
                    selectItemName: 'parentItem',
                    fixedColumns: true,
                    fixedNumber: 6,
                    showToggle: false,          //是否显示详细视图和列表视图的切换按钮
                    cardView: false,          //是否显示详细视图
                    showExport: true, //是否显示导出按钮
                    exportDataType: "all",
                    exportTypes: ['excel'], //导出文件类型
                    //注册加载子表的事件。注意下这里的三个参数！
                    onExpandRow: function (index, row, $detail) {
                        InitSubTable(index, row, $detail);
                    },
                    columns: [{
                        checkbox: false,
                        width: 20
                    }, {
                        field: 'ComputerID',
                        title: <%=GetQuoteString("D0016") %>,
                        width: 100

                    }, {
                        field: 'PCGroupName',
                        title: <%=GetQuoteString("D0010") %>,
                        width: 200

                    }, {
                        field: 'ComputerName',
                        title: <%=GetQuoteString("D0017") %>,
                        width: 200

                    }, {
                        field: 'ComputerUserName',
                        title: <%=GetQuoteString("D0019") %>,
                        width: 200
                    }, {
                    
                        title: <%=GetQuoteString("D0042") %>,
                        width: 300,
                        formatter: function (value, row, index) {//这里的三个参数：value表示当前行当前列的值；row表示当前行的数据；index表示当前行的索引（从0开始）。
                            var html = <%=GetQuoteString("D0021") %> + ':' + row.ComputerDomain + '<br/>' + <%=GetQuoteString("D0022") %>+ ':' + row.ComputerDeviceID;
                                return html;
                            }
                        
                    },
                    {
                        field: 'ComputerMemo',
                        title: <%=GetQuoteString("D0018") %>,
                        width: 100
                    },
                    {
                        field: 'ComputerAddTime',
                        title: <%=GetQuoteString("D0015") %>,
                         width: 100
                    },
                    {
                        title: <%=GetQuoteString("D0043") %>,
                        width: 200,
                        formatter: function (value, row, index) {//这里的三个参数：value表示当前行当前列的值；row表示当前行的数据；index表示当前行的索引（从0开始）。
                            var html = '<div align="center"><img width="100" height="100" src="' + row.LogonUIImage + '"><br/>' + row.LogonUIText1 + '<br/>' + row.LogonUIText2 + '</div>';
                    return html;
                }
                    }, {
                        title: <%=GetQuoteString("B0027") %>,
                        width: 200,
                        formatter: function (value, row, index) {//这里的三个参数：value表示当前行当前列的值；row表示当前行的数据；index表示当前行的索引（从0开始）。

                            var html = '<button type="button" onclick="editModelpc(\'' + row.ComputerID + '\')" class="btn btn-primary"><span class="glyphicon glyphicon-pencil" aria- hidden="true" ></span >'+<%=GetQuoteString("B0035") %>+'</button >&nbsp;&nbsp;';
                                     
                            html = html + '<button type="button" onclick="configModelpc(\'' + row.ComputerID + '\')" class="btn btn-warning"><span class="glyphicon glyphicon-lock" aria- hidden="true" ></span >'+<%=GetQuoteString("B0036") %>+'</button >&nbsp;&nbsp;' +
                                       '<button type="button" onclick="configLogonUI(\'' + row.ComputerID + '\')" class="btn btn-success"><span class="glyphicon glyphicon-user" aria- hidden="true" ></span >'+<%=GetQuoteString("B0037") %>+'</button >&nbsp;&nbsp;';
                            html = html + '<button type="button" onclick="deleteModelpc(\'' + row.ComputerID + '\')" class="btn btn-danger"><span class="glyphicon glyphicon-remove" aria- hidden="true" ></span >'+<%=GetQuoteString("B0038") %>+'</button >';
                            return html;
                        }
                    }],
                    onEditableSave: function (field, row, oldValue, $el) {
                        
                     
                    }
                });

                
                
                $("#customFile").change(function (e) {
                    //获取目标文件
                    var file = e.target.files || e.dataTransfer.files;
                    //如果目标文件存在
                    if (file) {
                        //定义一个文件阅读器
                        var reader = new FileReader();
                        //文件装载后将其显示在图片预览里
                        reader.onload = function () {
                            $("#imgshow").attr("src", this.result);
                        }
                        //装载文件
                        reader.readAsDataURL(file[0]);
                    }
                });

                //新增事件
                $("#btn_add").on('click', function () {
                    $('#tb_computer').bootstrapTable("resetView");
                    //弹出模态框
                    loadGroupdata();
                    $("#ModuleComputer").modal();
                    //给弹出框里面的各个文本框赋值
                    $("#ModuleComputer input").val("");
                    $("#ModuleComputer input[name='edtComputerID']").prop("readonly", false);
                    $("#ModuleComputer input[name='edtComputerGroup']").prop("readonly", true);
                    $("#ModuleComputer input[name='edtComputerGroup']").val('<%=Session["GroupName"]%>');

                });

            });


            //编辑事件
            var editModelpc = function (id) {
                //根据当前行的id获取当前的行数据
                
                var row = $("#tb_computer").bootstrapTable('getRowByUniqueId', id);
                //弹出模态框
                loadGroupdata(row.PCGroupID);
                $("#ModuleComputer").modal();
                //给弹出框里面的各个文本框赋值
                $("#ModuleComputer input").val("");
                 $("#ModuleComputer input[name='edtComputerID']").prop("readonly", true);
                 $("#ModuleComputer input[name='edtComputerID']").val(row.ComputerID);
                 
                 $("#ModuleComputer input[name='edtComputerName']").val(row.ComputerName);
                 $("#ModuleComputer input[name='edtComputerUserName']").val(row.ComputerUserName);

                 $("#ModuleComputer input[name='edtComputerDomain']").val(row.ComputerDomain);
                 $("#ModuleComputer input[name='edtPCDomain']").val(row.ComputerDeviceID);
                 $("#ModuleComputer input[name='edtComputerMemo']").val(row.ComputerMemo); 


            }




            var configLogonUI = function (id) {
                //根据当前行的id获取当前的行数据

                var row = $("#tb_computer").bootstrapTable('getRowByUniqueId', id);
                //弹出模态框

                

                $("#ModuleLogonUI").modal();
                //给弹出框里面的各个文本框赋值
                //$("#ModuleLogonUI input").val("");
                $("#ModuleLogonUI input[name='edtComputerID2']").prop("readonly", true);
                $("#ModuleLogonUI input[name='edtComputerID2']").val(row.ComputerID);
         
                $("#imgshow").attr("src",row.LogonUIImage);
                $("#ModuleLogonUI input[name='edtLogonUIText1']").val(row.LogonUIText1);
                $("#ModuleLogonUI input[name='edtLogonUIText2']").val(row.LogonUIText2);

                if (row.LogonUIShowEdit == "1") {
                  
                    $("#ModuleLogonUI input[id='showedityes']").prop('checked', 'true');
                }
                else if (row.LogonUIShowEdit == "2") {
                    
                    $("#ModuleLogonUI input[id='showeditno']").prop('checked', 'true');
                }
                else if (row.LogonUIShowEdit == "3") {
                   
                    $("#ModuleLogonUI input[id='cardkey']").prop('checked', 'true');
                }
                else {
                   
                    $("#ModuleLogonUI input[id='showeditauto']").prop('checked', 'true');
                }

            }
            //编辑事件
            var configModelpc = function (id) {
                //根据当前行的id获取当前的行数据

                var row = $("#tb_computer").bootstrapTable('getRowByUniqueId', id);
                //弹出模态框

                $("#ModuleComputerConfig").modal();
                //给弹出框里面的各个文本框赋值

               // $("#ModuleComputerConfig input[name='edtComputerID']").prop("readonly", true);
                $("#ModuleComputerConfig input[name='edtConfigComputerID']").val(row.ComputerID);
                switch (row.outoftime) {
                    case 0: $("#ModuleComputerConfig input[name='outoftime'][value=0]").prop("checked", true); break;
                    case 1: $("#ModuleComputerConfig input[name='outoftime'][value=1]").prop("checked", true); break;
                    case 2: $("#ModuleComputerConfig input[name='outoftime'][value=2]").prop("checked", true); break;
                    case 3: $("#ModuleComputerConfig input[name='outoftime'][value=3]").prop("checked", true); break;
                    case 4: $("#ModuleComputerConfig input[name='outoftime'][value=4]").prop("checked", true); break;
                }
                switch (row.outofcard) {
                    case 0: $("#ModuleComputerConfig input[name='outofcard'][value=0]").prop("checked", true); break;
                    case 1: $("#ModuleComputerConfig input[name='outofcard'][value=1]").prop("checked", true); break;
                    case 2: $("#ModuleComputerConfig input[name='outofcard'][value=2]").prop("checked", true); break;
                    case 3: $("#ModuleComputerConfig input[name='outofcard'][value=3]").prop("checked", true); break;
                    case 4: $("#ModuleComputerConfig input[name='outofcard'][value=4]").prop("checked", true); break;
                }
                
              
                


            }
            //删除事件
            var deleteModelpc = function (id) {
               
                    swal({
                        title: <%=GetQuoteString("B0028") %>,
                        text: <%=GetQuoteString("D0044") %> + id,
                        icon: "warning",
                        // buttons: true,
                        dangerMode: true,
                        buttons:{
                            cancel: <%=GetQuoteString("B0029") %>,
                            confirm: {
                                text: <%=GetQuoteString("B0028") %>,
                                value: 'confirm'
                            }
                        }
                    })
    .then((value) => {
        if (value==='confirm') {
                    $.ajax({
                        type: "post",
                        url: "ComputerEdit.ashx",
                        data: {
                            'Edit': "delete",
                            'ComputerID': id

                        },
                        dataType: 'JSON',
                        success: function (data, status) {
                            if (status == "success") {
                                if (data.result == true) {
                                    $("#tb_computer").bootstrapTable("refresh", {
                                        silent: true //静态刷新
                                    });
                                    toastr.success(<%=GetQuoteString("C0005") %>);
                                }
                                else {
                                    toastr.error(<%=GetQuoteString("C0006") %>);
                                }
                            }
                        },
                        error: function () {
                            toastr.error(<%=GetQuoteString("C0006") %>);
                        },
                        complete: function () {

                        }

                    });
            }
            });//then
            }


            $("#pc-sava-edit-btn").click(function () {
                $('#ModuleComputer').modal('hide');

                $.ajax({
                    type: "post",
                    url: "ComputerEdit.ashx",
                    data: {
                        'Edit': $("#ModuleComputer input[name='edtComputerID']").prop("readonly"),
                        'ComputerID': $("#ModuleComputer input[name='edtComputerID']").val(),
                        'ComputerGroup': '10000A',
                        'ComputerName': $("#ModuleComputer input[name='edtComputerName']").val(),
                        'ComputerUserName': $("#ModuleComputer input[name='edtComputerUserName']").val(),
                        'ComputerUserPwd': $("#ModuleComputer input[name='edtComputerUserPwd']").val(),
                        'ComputerDomain': $("#ModuleComputer input[name='edtComputerDomain']").val(),
                        'PCDomain': $("#ModuleComputer input[name='edtPCDomain']").val(),
                        'ComputerMemo': $("#ModuleComputer input[name='edtComputerMemo']").val(),
                        'PCGroupID': $("#ModuleComputer select[name='selectgroup']").val()
                    },
                    dataType: 'JSON',
                    success: function (data, status) {
                        if (status == "success") {
                            if (data.result == true) {
                                $("#tb_computer").bootstrapTable("refresh", {
                                    silent: true //静态刷新
                                });
                                toastr.success(<%=GetQuoteString("C0005") %>);
                            }
                            else {
                                toastr.error(<%=GetQuoteString("C0006") %>);
                            }
                        }
                    },
                    error: function () {
                        toastr.error(<%=GetQuoteString("C0006") %>);
                    },
                    complete: function () {

                    }

                });
            })


            $("#pc-sava-config-btn").click(function () {
                $('#ModuleComputerConfig').modal('hide');

                $.ajax({
                    type: "post",
                    url: "ComputerLockEdit.ashx",
                    data: {
                        'ComputerID': $("#ModuleComputerConfig input[name='edtConfigComputerID']").val(),
                        'outoftime': $("#ModuleComputerConfig input[name='outoftime']:checked").val(),
                        'outofcard': $("#ModuleComputerConfig input[name='outofcard']:checked").val()

                    },
                    dataType: 'JSON',
                    success: function (data, status) {
                        if (status == "success") {
                            if (data.result == true) {
                                $("#tb_computer").bootstrapTable("refresh", {
                                    silent: true //静态刷新
                                });
                                toastr.success(<%=GetQuoteString("C0005") %>);
                            }
                            else {
                                toastr.error(<%=GetQuoteString("C0006") %>);
                            }
                        }
                    },
                    error: function () {
                        toastr.error(<%=GetQuoteString("C0006") %>);
                    },
                    complete: function () {

                    }

                });
            })

            
           
            $("#Logonui-sava-edit-btn").click(function () {
                $('#ModuleLogonUI').modal('hide');
                

                console.log("showeditauto=", $("#ModuleLogonUI input[name='showeditauto']:checked").val());
                $.ajax({
                    type: "post",
                    url: "ComputerUIEdit.ashx",
                    data: {
                        'ComputerID': $("#ModuleLogonUI input[name='edtComputerID2']").val(),
                        'LogonUIImage': $("#imgshow").attr("src"),
                        'LogonUIText1': $("#ModuleLogonUI input[name='edtLogonUIText1']").val(),
                        'LogonUIText2': $("#ModuleLogonUI input[name='edtLogonUIText2']").val(),
                        'LogonUIShowEdit': $("#ModuleLogonUI input[name='showeditauto']:checked").val()
                    },
                    dataType: 'JSON',
                    success: function (data, status) {
                        if (status == "success") {
                            if (data.result == true) {
                                $("#tb_computer").bootstrapTable("refresh", {
                                    silent: true //静态刷新
                                });
                                toastr.success(<%=GetQuoteString("C0005") %>);
                            }
                            else {
                                toastr.error(<%=GetQuoteString("C0006") %>);
                            }
                        }
                    },
                    error: function () {
                        toastr.error(<%=GetQuoteString("C0006") %>);
                    },
                    complete: function () {

                    }

                });
            })
    

            $("#btn_clear").click(function () {
                $("#txt_search_pccode").val("");
                $("#txt_search_name").val("");
                $("#txt_search_memo").val("");
                $("#txt_search_group").val("");
            })

            $("#btn_query").click(function () {
                $('#tb_computer').bootstrapTable('refresh', { offset: 1 });
            })

            function loadGroupdata(selectval) {
                $.ajax({
                    url: "PCGroup.ashx",
                    type: 'GET',
                    data: {
                        'edit': 'loadgroup'
                    },
                    async: true,
                    datatype: 'JSON',
                    success: function (data) {
                        if (data) {

                            var groupnames = [];
                            for (var i = 0, len = data.length; i < len; i++) {
                                var groupdata = data[i];
                                //拼接成多个<option><option/>
                                if (selectval == groupdata.ID)
                                    groupnames.push('<option value="' + groupdata.ID + '" selected>' + groupdata.PCGroupName + '</option>');
                                else
                                groupnames.push('<option value="' + groupdata.ID + '">' + groupdata.PCGroupName + '</option>')
                            }
                            $("#selectgroup").html(groupnames.join(' '));
                        }
                    },
                    error: function () {
                        toastr.error(<%=GetQuoteString("C0006") %>);
                    }
                });
            }
            toastr.options.positionClass = 'toast-top-center';
        </script>
</body>
</html>
