<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <base href="#springUrl('/assets/adminlte/')"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>工作台</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">

    <!-- DataTables -->
    <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">

    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
    <!-- Morris chart -->
    <link rel="stylesheet" href="plugins/morris/morris.css">
    <!-- jvectormap -->
    <link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <link rel="stylesheet"
          href="plugins\bootstrap-fileinput\fileinput.min.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        td{text-align: center !important;vertical-align: middle !important}
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini">


<div class="wrapper">
    <div class="content-wrapper" style="margin-left:0;">
        <div id="importExcelDiv"></div>

        <section class="content-header">
            <h1>
                人员信息管理
                <small>人员信息</small>
            </h1>
            <ol class="breadcrumb">
                <li><a><i class="fa fa-dashboard"></i>首页</a></li>
                <li><a class="active">管理列表</a></li>
            </ol>
        </section>


        <!-- Main content -->
        <section class="content">
            <ul id="myTab" class="nav nav-tabs">
                #if($shiro.hasPermission("qy:workshop:view"))
                <li class="active"><a href="#springUrl('/a/workshop/list?meetingId=')$!{meetingId}" data-toggle="tab">
                    人员信息 </a></li>
                #end
                #if($shiro.hasPermission("qy:demand:edit"))
                <li><a href="#springUrl('/a/demand/form?meetingId=')${meetingId}">需求服务</a></li>
                #end
                #if($shiro.hasPermission("qy:sample:view"))
                <li><a href="#springUrl('/a/sample/list?meetingId=')${meetingId}">样本资料</a></li>
                #end
                #if($shiro.hasPermission("qy:speech:view"))
                <li><a href="#springUrl('/a/speech/list?meetingId=')${meetingId}">演讲嘉宾</a></li>
                #end
                #if($shiro.hasPermission("qy:agenda:view"))
                <li><a href="#springUrl('/a/agenda/list?meetingId=')${meetingId}">会议议程</a></li>
                #end
                #if($shiro.hasPermission("qy:album:view"))
                <li><a href="#springUrl('/a/album/list?meetingId=')${meetingId}">相册图集</a></li>
                #end
                #if($shiro.hasPermission("qy:activ:view"))
                <li><a href="#springUrl('/a/activ/list?meetingId=')${meetingId}">现场活动</a></li>
                #end
                #if($shiro.hasPermission("qy:welcome:edit"))
                <li><a href="#springUrl('/a/welcome/form?meetingId=')${meetingId}">欢迎信</a></li>
                #end
                #if($shiro.hasPermission("qy:takedrive:view"))
                <li><a href="#springUrl('/a/takedrive/list?meetingId=')${meetingId}">试驾车辆</a></li>
                #end
                #if($shiro.hasPermission("qy:templateMessage:view"))
                <li><a href="#springUrl('/a/templateMessage/list?meetingId=')${meetingId}">模板消息</a></li>
                #end
            </ul>
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <form id="seachTableForm"
                                  action="#springUrl('/a/workshop/exportExcel?meetingId=')${meetingId}" method="get"
                                  onkeydown="if(event.keyCode==13){return false;}">
                                <div class="col-xs-2">
                                    <input type="text" class="form-control "
                                           name="surname" placeholder="预导姓">
                                </div>
                                <div class="col-xs-2">
                                    <input type="text" class="form-control "
                                           name="first_name" placeholder="预导名">
                                </div>
                                <div class="col-xs-2">
                                    <input type="text" class="form-control "
                                           name="mname" placeholder="会员姓">
                                </div>
                                <div class="col-xs-2">
                                    <input type="text" class="form-control "
                                           name="msurname" placeholder="会员名">
                                </div>
                                <div class="col-xs-2">
                                    <input type="text" class="form-control"
                                           name="phone" placeholder="手机号">
                                </div>
                                <div class="col-xs-2">
                                    <input type="text" class="form-control"
                                           name="sort" placeholder="序号">
                                </div>

                                <input type="text" class="form-control "
                                       name="wsid" value="$!{meetingId}" placeholder="手机号" style="display: none;">

                                <div class="col-xs-5">
                                    #if($shiro.hasPermission("qy:workshop:edit"))
                                    <a href="javascript:void(0)" onclick="importExcel(${meetingId});"
                                       class="btn btn-primary">导入</a>
                                    <a href="javascript:void (0)" class="btn btn-primary search">搜索</a>
                                    <button style="display: none" class="btn btn-primary">导出</button>
                                    <a href="#springUrl('/a/workshop/exportExcel?meetingId=')${meetingId}"
                                       class="btn btn-primary">导出RSVP</a>
                                    <a href="#springUrl('/a/workshop/exportInviteCodeExcel?wsid=')${meetingId}"
                                       class="btn btn-primary">导出邀请码</a>
                                    #end
                                    #if($shiro.hasPermission("qy:workshop:sendMessage"))
                                    <a href="javascript:sendMessage(${meetingId})"
                                       class="btn btn-primary">内部员工邀请</a>
                                    #end
                                </div>
                            </form>
                        </div><!-- /.box-header -->
                        <div class="box-body" >
                            <table id="table" class="table table-bordered table-striped" >
                                <thead>
                                <tr style="text-align: center;vertical-align: middle">
                                    <td hidden="true">Id</td>
                                    <th>序号</th>
                                    <th>预导入姓</th>
                                    <th>预导入名</th>
                                    <th>性别</th>
                                    <th>公司(CN)</th>
                                    <th>手机号码</th>
                                    <th>会员姓</th>
                                    <th>会员名</th>
                                    <th>会员公司</th>
                                    <th>状态</th>
                                    <th>邀请码</th>
                                    <th>桌号</th>
                                    <th>工厂参观分组</th>
                                    <th>试乘试驾体验分组</th>
                                    <th>创建时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody id="tablebody" >
                                </tbody>

                            </table>
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    <div id="addlabelModal" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <!-- dialog body -->
                <div class="modal-body">
                    <input class="form-control select2"  style="width: 100%" id="addlabel"
                           name="name" value="$!{name}" placeholder='英文名字'>
                    </input>
                </div>
                <div style="text-align: center;padding-bottom: 20px;">
                    <button style="width: 100px;" type="button" class="btn btn-primary" onclick="addlabelsubmit()">确定
                    </button>
                    <button style="width: 100px;" type="button" id="tagCacel" class="btn btn-default">取消</button>
                </div>
                <!-- dialog buttons -->
            </div>
        </div>
    </div>
    <div id="addtablenumber" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <!-- dialog body -->
                <div class="modal-body">
                    <input class="form-control select2"  style="width: 100%" id="addtable"
                           placeholder='桌号'>
                    </input>
                </div>
                <div style="text-align: center;padding-bottom: 20px;">
                    <button style="width: 100px;" type="button" class="btn btn-primary" onclick="addlabelsubmit1()">确定
                    </button>
                    <button style="width: 100px;" type="button" id="tagCacel1" class="btn btn-default">取消</button>
                </div>
                <!-- dialog buttons -->
            </div>
        </div>
    </div>
    <div id="addfactorynumber" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <!-- dialog body -->
                <div class="modal-body">
                    <input class="form-control select2"  style="width: 100%" id="addfactory"
                           placeholder='工厂参观分组'>
                    </input>
                </div>
                <div style="text-align: center;padding-bottom: 20px;">
                    <button style="width: 100px;" type="button" class="btn btn-primary" onclick="addlabelsubmit2()">确定
                    </button>
                    <button style="width: 100px;" type="button" id="tagCacel2" class="btn btn-default">取消</button>
                </div>
                <!-- dialog buttons -->
            </div>
        </div>
    </div>
    <div id="adddrivenumber" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <!-- dialog body -->
                <div class="modal-body">
                    <input class="form-control select2"  style="width: 100%" id="adddrive"
                           placeholder='试乘试驾体验分组'>
                    </input>
                </div>
                <div style="text-align: center;padding-bottom: 20px;">
                    <button style="width: 100px;" type="button" class="btn btn-primary" onclick="addlabelsubmit3()">确定
                    </button>
                    <button style="width: 100px;" type="button" id="tagCacel3" class="btn btn-default">取消</button>
                </div>
                <!-- dialog buttons -->
            </div>
        </div>
    </div>


    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.4 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins\bootstrap-fileinput\fileinput.js"></script>
<script src="plugins/bootstrap-fileinput/zh.js"></script>
<script src="plugins/bootstrap-fileinput/zh2.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script type="text/javascript"
        src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script>
    var csrfheader = {name: '_csrf_header', value: '${_csrf.headerName}'};
    var csrftoken = {name: '_csrf', value: '${_csrf.token}'};
</script>
<script src="common/js/cfapp.js"></script>
<script>
    function formatDates(now) {
        var now = new Date(now);
        var year = now.getFullYear();
        var month = now.getMonth() + 1;
        var date = now.getDate();
        var hour = now.getHours();
        var minute = now.getMinutes();
        var second = now.getSeconds();
        return year + "-" + month + "-" + date + "   " + hour + ":"
                + minute + ":" + second;
    }

    function sendMessage(obj){
        Cfapp.confirm({
            message: "确定要发送吗",
            btnoktext: "确定",
            btncanceltext: "取消",
            success: function () {
                $.ajax({
                    type: "POST",
                    url: "#springUrl('/a/workshop/sendMessage')",
                    data: {meetingId: obj, _csrf_header: csrfheader.value, _csrf: csrftoken.value},
                    dataType: "json",
                    success: function (data) {
                        if (data.errorNo == 0) {
                            Cfapp.alert({
                                message: "发送成功",
                                btntext: "确定",
                                success: function () {


                                }
                            });
                        }
                    },
                    error: function () {
                    }
                })
            },
            cancel: function () {
                //;
            }
        });
    }

    function seachTable() {
        var sSource = "#springUrl('/a/workshop/listData')";
        var aoData = {
            iDisplayStart: 1,
            iDosplayLength: 10
        }
        var retrieveData = function (sSource, aoData, fnCallback) {

            $("#seachTableForm input").each(function () {
                var params = {
                    name: $(this).attr("name"),
                    value: $(this).val()
                };
                aoData.push(params);
            })

            $.ajax({
                "type": "GET",
                "url": sSource,
                "dataType": "json",
                "data": aoData, //以json格式传递
                "success": fnCallback
            });
        };

        $('#table').DataTable({
            "lengthChange": false,
            "searching": false,
            "ordering": false,
            "bFiltered": false,
            "bStateSave": true, // save datatable state(pagination, sort, etc) in cookie.
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": sSource,
            "fnServerData": retrieveData,
            "pagingType": "full_numbers",
            "aoColumns": [
                {
                    "mData": "id"
                },
                {
                    "mData":"sort"
                },
                {
                    "mData": "surname"
                },
                {
                    "mData": "first_name"
                },
                {
                    "mData": "gender"
                },
                {
                    "mData": "organization"
                },
                {
                    "mData": "phone"
                },
                {
                    "mData": "msurname"
                },
                {
                    "mData": "mname"
                },
                {
                    "mData": "morganization"
                },
                {
                    "mData": "status"
                },
                {
                    "mData":"invitcode"
                },
                {
                    "mData":"table_number"
                },{
                    "mData":"factory_number"
                },{
                    "mData":"drive_number"
                },
                {
                    "mData": "create_time"
                },
                {
                    "mData": "id"
                }],
            "aoColumnDefs": [
                { // set default column settings
                    'visible': false,
                    'targets': [0]
                },
                {
                    "aTargets": [2],
                    "mData": "surname",
                    "mRender": function (a, b, c, d) {
                        if (c.surname != c.msurname) {
                            return '<font color="red">' + a + '</font>';
                        } else {
                            return a;
                        }
                    }
                },
                {
                    "aTargets": [3],
                    "mData": "first_name",
                    "mRender": function (a, b, c, d) {
                        if (c.first_name != c.mname) {
                            return '<font color="red">' + a + '</font>';
                        } else {
                            return a;
                        }
                    }
                },
                {
                    "aTargets": [5],
                    "mData": "organization",
                    "mRender": function (a, b, c, d) {
                        if (c.organization != c.morganization) {
                            return '<font color="red">' + a + '</font>';
                        } else {
                            return a;
                        }
                    }
                },

                {
                    "aTargets": [6],
                    "mData": "phone",
                    "mRender": function (a, b, c, d) {
                        return a;
                    }
                },
                /*{
                 "aTargets": [1],
                 "mData": "number",
                 "mRender": function (a, b, c, d) {
                 return '<a href="#springUrl("/a/workshop/form?id=' + c.id + '")" data-id="' + c.id + '" data-action="view">' + a + '</a>';

                 }
                 },*/
                {
                    "aTargets": [7],
                    "mData": "msurname",
                    "mRender": function (a, b, c, d) {
                        if (a == null) {
                            return "";
                        } else if (c.surname != c.msurname) {
                            return '<font color="red">' + a + '</font>';
                        } else {
                            return a;
                        }
                    }
                },
                {
                    "aTargets": [8],
                    "mData": "mname",
                    "mRender": function (a, b, c, d) {
                        if (a == null) {
                            return "";
                        } else if (c.first_name != c.mname) {
                            return '<font color="red">' + a + '</font>';
                        } else {
                            return a;
                        }
                    }
                },
                {
                    "aTargets": [10],
                    "mData": "status",
                    "mRender": function (a, b, c, d) {
                        if(c.del_flag == 0){
                            if (a == 0) {
                                return "待报名";
                            } else if (a == 1) {
                                return "已报名";
                            } else if (a == 2) {
                                return "已签到";
                            }else if(a==-1){
                                return "已拒绝";
                            }
                        }else{
                            return "已删除";
                        }

                    }
                },
                {
                    "aTargets":[11],
                    "mData":"invitcode",
                    "mRender":function(a,b,c,d){
                        return a;
                    }
                },
                {
                    "aTargets": [15],
                    "mData": "create_time",
                    "mRender": function (a, b, c, d) {//a表示createtime对应的值，c表示当前记录行对象
                        return formatDates(a);
                    }
                },

                {
                    "aTargets": [16],
                    "mData": "id",
                    "mRender": function (a, b, c, d) {//a表示id对应的值，c表示当前记录行对象
                        var html = '#if($shiro.hasPermission("qy:workshop:edit"))';//
                        // var url = "#springUrl('/a/details/form?member_uid=123&meetingId=')${meetingId}";
                        var url = "#springUrl('/a/details/form?meetingId=')${meetingId}";

                        url += "&member_uid=" + c.member_uid;
                        html+='<div class="btn-group">';
//                        html += '<a href="javascript:void(0)" data-action="view" class="btn"></a><br/>';
                        html+='<button type="button" class="btn btn-default  dropdown-toggle"  data-toggle="dropdown">操作<span class="caret"></span> <span class="sr-only">切换下拉菜单</span></button>';
                        html+='<ul class="dropdown-menu" role="menu">';
                        html += '<a href="javascript:void(0)" data-action="view" class="btn green" onclick="addlabel(' + a + ')">维护英文名</a><br/>';
                        html += '<a href="javascript:void(0)" data-action="view" class="btn green" onclick="addlabel1(' + a + ')" >维护桌号</a><br/>';
                        html += '<a href="javascript:void(0)" data-action="view" class="btn green" onclick="addlabel2(' + a + ')" >维护工厂参观</a><br/>';
                        html += '<a href="javascript:void(0)" data-action="view" class="btn green" onclick="addlabel3(' + a + ')" >维护试乘试驾</a><br/>';
                        if(c.status!=0 && c.del_flag == 0) {
                            html += '<a href=' + url + ' data-id="' + a + '" data-action="view" class="btn green" >需求服务变更</a><br/>';
                            var url1 = "#springUrl('/a/detail_log/listData?meetingId=')${meetingId}";
                            url1 += "&memberUid=" + c.member_uid;
                            html += '<a href=' + url1 + ' data-id="' + a + '" data-action="view" class="btn green" >需求服务变更日志</a><br/>';
                        }
                        html += '<a href="javascript:void(0);" data-id="' + a + '" data-action="remove"  onclick="removeData(' + a + ',' + c.wsid + ')" class="btn red">删除</a><br/>';
                        html+='</ul>';
                        html += '#end';
                        return html;
                    }
                }

            ]
        });
    }

    jQuery(document).ready(function () {
        seachTable();
        $('.datepicker').datepicker({
            show: true,
            format: 'yyyy-mm-dd',
            autoclose: true,
            language: 'zh-CN',
            todayBtn: 'linked',
            clearBtn: 'linked'

        });
        $('.search').click(function () {
            $("#table").dataTable().fnClearTable();
        });
    });

    Cfapp.init();
    function removeData(id, meetingId) {
        Cfapp.confirm({
            message: "确定要删除吗",
            btnoktext: "确定",
            btncanceltext: "取消",
            success: function () {
                $.ajax({
                    type: "POST",
                    url: "#springUrl('/a/workshop/delete')",
                    data: {id: id, _csrf_header: csrfheader.value, _csrf: csrftoken.value},
                    dataType: "json",
                    success: function (data) {
                        if (data.errorNo == 0) {
                            Cfapp.alert({
                                message: "删除成功",
                                btntext: "确定",
                                success: function () {
                                    location.href = "#springUrl('/a/workshop/list?meetingId=')" + meetingId

                                }
                            });
                        }
                    },
                    error: function () {
                    }
                })
            },
            cancel: function () {
                //;
            }
        });
    }
    function importExcel(id) {
        var templateExcelUrl = "#springUrl('/a/workshop/templateExcel')";
        var importExcelUrl = "#springUrl('/a/workshop/importExcel')?_csrf_header=" + csrfheader.value + "&_csrf=" + csrftoken.value + "&id=" + id;


        Cfapp.importExcel({
            title: '人员导入',
            importurl: importExcelUrl,
            templateurl: templateExcelUrl,
            cancel: function () {

            },
            success: function () {
                //alert(data.retJson.errorNo)
                location.href = "#springUrl('/a/workshop/list?meetingId=')${meetingId}";
            }
        });
    }
    //维护英文名
    $("#tagCacel").click(function () {
        $("#addlabelModal").modal('hide');
    })
    var id = "";
    function addlabel(id1) {
        id = id1;
        $.ajax({
            "url": "#springUrl('/a/workshop/updateconpanys')",
            "type": "POST",
            "data": { id: id, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
            "  jsonType": "json",
            "success": function (data) {
                $('#addlabel').val(data.name);
            }
        })
        $("#addlabel option").attr("selected", false);
        $("#addlabelModal").modal('show');
    }
    function addlabelsubmit() {
        var values = $("#addlabel").val();
        $.ajax({
            "url": "#springUrl('/a/workshop/updateconpany')",
            "type": "POST",
            "data": {conpany: values, id: id, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
            "  jsonType": "json",
            "success": function (data) {
                Cfapp.confirm({
                    message: "修改成功",
                    btnoktext: "确定",
                    btncanceltext: "取消",
                    success: function () {
                        location.href = "#springUrl('/a/workshop/list?meetingId=')${meetingId}";
                    }, cancel: function () {
                        location.href = "#springUrl('/a/workshop/list?meetingId=')${meetingId}";
                    }
                })
                $("#addlabelModal").modal('hide');
            }
        });
    }
    //维护桌号
    $("#tagCacel1").click(function () {
        $("#addtablenumber").modal('hide');
    })
    var id = "";
    function addlabel1(id1) {
        id = id1;
        $.ajax({
            "url": "#springUrl('/a/workshop/updatetablenumbers')",
            "type": "POST",
            "data": { id: id, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
            "  jsonType": "json",
            "success": function (data) {
                $('#addtable').val(data.table);
            }
        })
        $("#addtable option").attr("selected", false);
        $("#addtablenumber").modal('show');
    }
    function addlabelsubmit1() {
        var values = $("#addtable").val();
        $.ajax({
            "url": "#springUrl('/a/workshop/updatetablenumber')",
            "type": "POST",
            "data": {table_number: values, id: id, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
            "  jsonType": "json",
            "success": function (data) {
                Cfapp.confirm({
                    message: "修改成功",
                    btnoktext: "确定",
                    btncanceltext: "取消",
                    success: function () {
                        location.href = "#springUrl('/a/workshop/list?meetingId=')${meetingId}";
                    }, cancel: function () {
                        location.href = "#springUrl('/a/workshop/list?meetingId=')${meetingId}";
                    }
                })
                $("#addtablenumber").modal('hide');
            }
        });
    }

    //维护工厂
    $("#tagCacel2").click(function () {
        $("#addfactorynumber").modal('hide');
    })
    var id = "";
    function addlabel2(id1) {
        id = id1;
        $.ajax({
            "url": "#springUrl('/a/workshop/updatefactorynumbers')",
            "type": "POST",
            "data": { id: id, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
            "  jsonType": "json",
            "success": function (data) {
                $('#addfactory').val(data.factory);
            }
        })
        $("#addfactory option").attr("selected", false);
        $("#addfactorynumber").modal('show');
    }
    function addlabelsubmit2() {
        var values = $("#addfactory").val();
        $.ajax({
            "url": "#springUrl('/a/workshop/updatefactorynumber')",
            "type": "POST",
            "data": {factory_number: values, id: id, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
            "  jsonType": "json",
            "success": function (data) {
                Cfapp.confirm({
                    message: "修改成功",
                    btnoktext: "确定",
                    btncanceltext: "取消",
                    success: function () {
                        location.href = "#springUrl('/a/workshop/list?meetingId=')${meetingId}";
                    }, cancel: function () {
                        location.href = "#springUrl('/a/workshop/list?meetingId=')${meetingId}";
                    }
                })
                $("#addfactorynumber").modal('hide');
            }
        });
    }

    //维护试乘
    $("#tagCacel3").click(function () {
        $("#adddrivenumber").modal('hide');
    })
    var id = "";
    function addlabel3(id1) {
        id = id1;
        $.ajax({
            "url": "#springUrl('/a/workshop/updatedrivenumbers')",
            "type": "POST",
            "data": { id: id, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
            "  jsonType": "json",
            "success": function (data) {
                $('#adddrive').val(data.drive);
            }
        })
        $("#adddrive option").attr("selected", false);
        $("#adddrivenumber").modal('show');
    }
    function addlabelsubmit3() {
        var values = $("#adddrive").val();
        $.ajax({
            "url": "#springUrl('/a/workshop/updatedrivenumber')",
            "type": "POST",
            "data": {drive_number: values, id: id, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
            "  jsonType": "json",
            "success": function (data) {
                Cfapp.confirm({
                    message: "修改成功",
                    btnoktext: "确定",
                    btncanceltext: "取消",
                    success: function () {
                        location.href = "#springUrl('/a/workshop/list?meetingId=')${meetingId}";
                    }, cancel: function () {
                        location.href = "#springUrl('/a/workshop/list?meetingId=')${meetingId}";
                    }
                })
                $("#adddrivenumber").modal('hide');
            }
        });
    }
    /*    function updateconpany(organization_en, id) {


     $.ajax({
     "url": "#springUrl('/a/workshop/updateconpany')",
     "type": "POST",
     "data": {conpany: organization_en, id: id, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
     "  jsonType": "json",
     success: function () {

     }
     })
     }*/


</script>

</body>
</html>
