<!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">
    <link rel="stylesheet" href="plugins/select2/select2.min.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">
    <!-- Date Picker -->
    <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">

    <!--validate css-->
    <link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
    <!--fileinput css-->
    <link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.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]-->
    <link rel="stylesheet" href="plugins/bootstrap-switch/bootstrap-switch.min.css">

    <style>
        .switch {
            width: 35%;
            display: inline-block;
        }

        .delAccounts {
            display: inline-block;
        }

        .bootstrap-switch-container {
            display: -webkit-box;
            white-space: nowrap;
        }
    </style>
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">

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

        <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
             aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title" id="exampleModalLabel" style="font-weight: 700;">咨询单拒绝原由</h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <form>
                            <!--<div class="form-group">-->
                            <!--<label for="recipient-name" class="col-form-label">Recipient:</label>-->
                            <!--<input type="text" class="form-control" id="recipient-name">-->
                            <!--</div>-->
                            <div class="form-group">
                                <label for="message-text" class="col-form-label">请输入拒绝原由:</label>
                                <textarea class="form-control" rows="3" id="js-textarea"></textarea>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary" onclick="review()">提交</button>
                    </div>
                </div>
            </div>
        </div>


        <section class="content-header">
            <h1>
                咨询单管理
                <small>咨询单管理</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
                <li><a class="active">咨询单</a></li>
            </ol>
        </section>


        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <!-- general form elements disabled -->
                    <div class="box box-primary">
                        <form role="form" id="myForm">
                            <input id="id" name="id" value="$!{data.id}" hidden="true"/>

                            <div class="box-body">

                                <div class="panel panel-primary">
                                    <div class="panel-heading">基础信息</div>

                                    <div class="panel-body">
                                        <div class="form-group form-md-line-input col-xs-3">
                                            <label>咨询单编码<font style="color: red"></font></label>
                                            <input type="text"
                                                   class="form-control" name="consultId"
                                                   id="consultId" readonly="readonly"
                                                   maxlength="50" placeholder="咨询单编码"
                                                   value="$!{data.consultId}"
                                            >
                                        </div>

                                        <div class="form-group form-md-line-input col-xs-3">
                                            <label>用药人姓名</label>
                                            <input type="text"
                                                   class="form-control" name="userName"
                                                   id="userName" readonly="readonly"
                                                   maxlength="50" placeholder="用药人姓名"
                                                   value="$!{data.userName}"
                                            >
                                        </div>

                                        <div class="form-group form-md-line-input col-xs-3">
                                            <label>性别<font style="color: red"></font></label>
                                            <input type="text"
                                                   class="form-control" name="sex"
                                                   id="sex" readonly="readonly"
                                                   maxlength="50" placeholder="性别"
                                                   value="$!{data.sex}"
                                            >
                                        </div>

                                        <div class="form-group form-md-line-input col-xs-3">
                                            <label>联系方式<font style="color: red"></font></label>
                                            <input type="text"
                                                   class="form-control" name="iPhone"
                                                   id="iPhone" readonly="readonly"
                                                   maxlength="50" placeholder="联系方式"
                                                   value="$!{data.phone}"
                                            >
                                        </div>

                                        <div class="form-group form-md-line-input col-xs-3">
                                            <label>药师姓名<font style="color: red"></font></label>
                                            <input type="text"
                                                   class="form-control" name="doctorName"
                                                   id="doctorName" readonly="readonly"
                                                   maxlength="50" placeholder="药师姓名"
                                                   value="$!{data.pharmaName}"
                                            >
                                        </div>

                                        <div class="form-group form-md-line-input col-xs-3">
                                            <label>客服姓名<font style="color: red"></font></label>
                                            <input type="text"
                                                   class="form-control" name="customerName"
                                                   id="customerName" readonly="readonly"
                                                   maxlength="50" placeholder="客服姓名"
                                                   value="$!{data.customerName}"
                                            >
                                        </div>

                                        <div class="form-group form-md-line-input col-md-3">
                                            <label>处方医院</label>
                                            <div class="input-group">
                                                <input type="text" name="allergy" id="allergy" value="$!{data.allergy}" class="form-control" style="display: none">
                                                <input type="text" id="hospital" name="hospital" value="$!{hospital}"  class="form-control" disabled>
                                                <span class="input-group-btn">
                                                    <button type="button" name="selHospital" id="selHospital" class="btn btn-info btn-flat">选择</button>
                                                </span>
                                            </div>
                                        </div>

                                        <div class="form-group form-md-line-input col-md-3">
                                            <label>处方医生</label>
                                            <div class="input-group">
                                                <input type="text" name="pastRecords" id="pastRecords" value="$!{data.pastRecords}" class="form-control" style="display: none">
                                                <input type="text" id="pharmacist" name="pharmacist" value="$!{pharmacist}"  class="form-control" disabled>
                                                <span class="input-group-btn">
                                                    <button type="button" name="selDoctor" id="selDoctor" class="btn btn-info btn-flat">选择</button>
                                                </span>
                                            </div>
                                        </div>

                                        <div class="form-group form-md-line-input col-xs-3">
                                            <label>处方单<font style="color: red"></font></label>
                                            <br/>
                                            <div class="form-group " id="imageurl"
                                                 style="width: 130px; height: 120px; margin-left: 5px; padding: 10px; background-color: #f4f4f4; border: 1px solid #CCCCCC">
                                                <img id="prescription" style="cursor:zoom-in; width: 100%; height: 100% " src="$!{data.prescription}" onclick="imgcli(this)">
                                            </div>
                                        </div>

                                        <div class="form-group form-md-line-input col-xs-3">
                                            <label>审核状态<font style="color: red"></font></label>
                                            <input type="text"
                                                   class="form-control" name="status"
                                                   id="status" readonly="readonly"
                                                   maxlength="50" placeholder="status"
                                                   value="$!{data.status}"
                                            >
                                        </div>

                                        <div class="form-group form-md-line-input col-xs-6">
                                            <label>审核未通过原因<font style="color: red"></font></label>
                                            <div class="form-control" name="description"
                                                    id="description"
                                                    maxlength="50"
                                                    style="height: 68px;background: #EEEEEE"
                                            >$!{data.description}
                                            </div>
                                        </div>

                                    </div>
                                </div>

                                <div class="panel panel-primary">
                                    <div class="panel-heading">商品信息</div>
                                    <div class="panel-body">
                                        <div class="form-group form-md-line-input">
                                            <div id="group" class="list-group">
                                                <li class="list-group-item">
                                                    <th style=""><label style="width: 180px;margin-right: 50px;text-align: center">商品名称</label></th>
                                                    <th style=""><label style="width: 180px;margin-right: 50px;text-align: center">商品购买数量</label> </th>
                                                    <th style=""><label style="width: 160px;margin-right: 50px;text-align: center">商品单价</label></th>
                                                    <th style=""><label style="width: 180px;margin-right: 50px;text-align: center">商品总价</label></th>
                                                </li>
                                            </div>
                                            <button type="button" class="search btn btn-primary" onclick="clickAdd()">添加商品</button>
                                        </div>
                                    </div>
                                </div>


                                <div class="box-footer">
                                    #if($shiro.hasPermission("qy:consultSheet:edit"))
                                    <input class="btn btn-info" id="save" value="通过" type="submit">
                                    #end
                                    <a id="reject" class="btn btn-danger" data-toggle="modal"
                                       data-target="#exampleModal">拒绝</a>

                                    <a href="#springUrl('/a/consultSheet/list')" class="btn btn-default">返回 </a>
                                </div>
                            </div>
                        </form>
                        <!-- /.box-body -->
                    </div><!-- /.box -->


                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->


    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<div id="divimg"
     style="cursor:zoom-out; background: rgba(0,0,0,.6); width:100%; height:100%; position: absolute;z-index: 9999;left: 0;top: 0;display: none"
     onclick="hide()">
    <img>
</div>
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="plugins/select2/select2.full.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>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap-switch/4.0.0-alpha.1/js/bootstrap-switch.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>

    var goodsList = [];

    function goodList() {
        var url = "#springUrl('/a/order/fromProduct')"
        $.ajax({
            url: url,
            type: "GET",
            success: function (res) {
                goodsList = JSON.parse(res.data);
//                var provinceId = '$!{data.productId}';
//                var selectProductList = '$!{list}';
//                if (selectProductList != null && selectProductList != '') {
//                    selectProductList = JSON.parse(selectProductList);
//                    for (var i = 0; i < selectProductList.length; i++) {
//                        var obj = selectProductList[i];
//                        clickAdd(obj.id, obj.productId, obj.drugsNum, obj.price, obj.amount);
//                    }
//                }

            }
        });
    }

    function clickAdd(id, productId, count, price, amount) {
        var options = goodsList.map(function (item) {
            if (productId && productId != null && item.id === productId) {
                return `<option selected value="${item.id}" data-price="${item.price}">${item.productName}</option>`
            } else {
                return `<option value="${item.id}" data-price="${item.price}">${item.productName}</option>`
            }
        }).join('');

        var idHtml = "";
        if (id && id != null){
            idHtml +=`<input type="hidden" id="idDetail" name="idDetail" value="`+id+`">`;
        }else{
            idHtml +=`<input type="hidden" id="idDetail" name="idDetail" value="">`
        }

        var listHtml = "";
        if (count && count != null) {
            listHtml += `<input name="listHtml" class="form-control" type='number' style="width: 180px;margin-right: 50px; margin-left: 50px;" oninput="if(value>100)value=100;if(value.length>2)value=value.slice(0,2);if(value<=0)value=1" onchange="updateCount(this)" value=${count} ></input>`;
        } else {
            listHtml += `<input name="listHtml" class="form-control" type='number' style="width: 180px ;margin-right: 50px; margin-left: 50px;" oninput="if(value>100)value=100;if(value.length>2)value=value.slice(0,2);if(value<=0)value=1" onchange="updateCount(this)" value="1"></input>`;
        }

        var HtmlPrice = "";
        if (price && price != null) {
            HtmlPrice += `<input  name="htmlPrice" class="form-control" data-price="`+priceTmp+`" style="width: 180px ;margin-right: 50px" type='text' readonly="readonly"  value="`+price.toFixed(2)+`"></input>`;
        } else {
            let priceTmp = goodsList[0].price.toFixed(2);
            HtmlPrice += `<input   name="htmlPrice" class="form-control" data-price="`+priceTmp+`" style="width: 180px ;margin-right: 50px" type="text"  readonly="readonly" value="`+priceTmp+`"></input>`
        }

        var HtmlAmount = "";
        if (amount && amount != null) {
            HtmlAmount += `<input id="htmlAmount" class="form-control" name="htmlAmount" style="width: 180px ;margin-right: 50px" type='text' readonly="readonly"   value="`+amount.toFixed(2)+`" ></input>`;
        } else {
            var amountTmp = goodsList[0].price.toFixed(2);
            HtmlAmount += `<input id="htmlAmount" class="form-control" name="htmlAmount" style="width: 180px;margin-right: 50px" type="number" readonly="readonly"  value="`+amountTmp+`"></input>`
        }


        let html = `<li id="form-translate" class="list-group-item translate"   style="display:flex ;">
                            ${idHtml}
                        <select  class="form-control select2 releas" name="releas" style="width: 180px;"  onchange="getPrice(this)">
                            ${options}
                        </select>
                            ${listHtml}

                            ${HtmlPrice}

                            ${HtmlAmount}
                        <button type="button" class="search btn btn-primary" style="background-color: #d73925 ;" onclick="deleteSelect(event)">删除</button>
                    </li>`;

        $("#group").append(html);
        initSelect2();
    }

    function initSelect2() {
        $('.releas').select2({
            placeholder: '选择商品'
        });
    }

    function getPrice(e) {
        let price = $(e).find("option:selected").attr('data-price');
        $(e).parent().find('input[name="htmlPrice"]').val(price);
        let value = $(e).parent().find('input[name="htmlPrice"]').val()
        let count = $(e).parent().find('input[name="listHtml"]').val()
        let val = value * count;
        $(e).parent().find('input[name="htmlAmount"]').val(val);
    }

    function updateCount(value) {
        var price = $(value).parent().find('input[name="htmlPrice"]').val();
        var count = $(value).val();
        var totalPrice = price * count;
        $(value).parent().find('input[name="htmlAmount"]').val(totalPrice.toFixed(2))
    }

//    function updatePrice(e) {
//        // var orderAmount = $("#orderAmount");
//        var valueSi = $(value).val();
//        // var sign = Math.floor(valueSi * 100 ) /100
//        $("#orderAmount").val(valueSi.toFixed(2));
//    }

    function deleteSelect(event) {
        let dom = event.target;
        let ret = $(dom);
        ret.parent().remove();
    }

    $().ready(function () {
        var value = $("#sex").val();
        if (value == 0) {
            $("#sex").val("女");
        } else {
            $("#sex").val("男");
        }

        var status = $("#status").val();
        if (status == 0) {
            $("#status").val("未审核");
        } else if (status == 1) {
            $("#status").val("已通过");
        } else if (status == 2) {
            $("#status").val("已拒绝");
        }

        if (status == 1 || status == 2) {
            $("#reject").hide();
            $("#save").hide();
        }

        goodList();
        Cfapp.init();
        recdTypeAdd.init();
    });


    $('#divimg').click(function () {
        $(this).fadeOut(200)
    });


    function imgcli(obj) {
        $('#divimg img').attr('src', $(obj).attr("src"));

        var img = document.getElementById("prescription");
        let imgH = img.naturalHeight;//图片高度
        let imgW = img.naturalWidth;//图片宽度
        //console.log(imgH + "-" + imgW);

        let finalImgH = ($('.content-wrapper').height() * 0.8).toFixed(2);
        let algorithm = (imgH / finalImgH).toFixed(2);
        let finalImgW = (imgW / algorithm).toFixed(2);

        let val = (1 - (finalImgW / $('.content-wrapper').width()).toFixed(2)) / 2 * 100 -3;

        $('#divimg').height($('.content-wrapper').height());
        $('#divimg img').height(finalImgH);
        $('#divimg img').width(finalImgW);
        $('#divimg img').css("margin-left", val + "%");
        $('#divimg img').css("margin-top", "5%");
        $('#divimg').fadeIn(200);

    }

    function hide() {
        $("#hide").hide();
    }

    function review() {
        var url = "#springUrl('/a/consultSheet/updateData')";
        var reason = $("#js-textarea").val();
        console.log(reason);
        if (!reason || reason == null) {
            Cfapp.alert({
                message: "请输入拒绝原由!",
                btntext: "确定",
                success: function () {
                }
            });
            return;
        }
        var aadata = {
            consultId: $('#id').val(),
            status: "2",
            description: reason
        };
        $.ajax({
            url: url,
            data: aadata,
            type: "GET",
            success: function (data) {
                if (data.errorNo == 0) {
                    Cfapp.alert({
                        message: "拒绝成功",
                        btntext: "确定",
                        success: function () {
                            location.href = "#springUrl('/a/consultSheet/list')"
                        }
                    });
                } else {
                    Cfapp.alert({
                        message: "审批失败",
                        btntext: "确定",
                        success: function () {
                            location.href = "#springUrl('/a/consultSheet/list')"
                        }
                    });
                }
            }
        });
    }

    $("#selHospital").click(function () {
        Cfapp.f7({
            dataUrl: "#springUrl('/a/wxQrcode/listOrg')",
            checkType: "single", // 多选为multi
            title: '请选择医院',
            btnoktext: "确定",
            btncanceltext: "取消",
            columns: ["选择", "请选择医院"],
            isSearch: '0',
            searchColumns: ["name"],//搜索的字段名称
            searchColumnsRemarks: ["请选择医院"],//搜索的字段备注
            aoColumns: [{
                "mData": "id"
            }, {
                "mData": "name"
            }],
            aoColumnDefs: [{
                "aTargets": [0],
                "mData": "id",
                "mRender": function (a, b, c, d) {
                    return '<input  class="bindId" value="' + a + '" type="radio" id="' + a + '" name="sel" data-value="' + a + '" data-name="' + c.name + '">';
                }
            }, {
                "aTargets": [1],
                "mData": "name",
                "mRender": function (a, b, c, d) {//a表示createtime对应的值，c表示当前记录行对象
                    return a;
                }
            }],
            success: function () {

            },
            cancel: function () {

            },
            storeFields: 'allergy', // 储存的字段
            displayFields: 'hospital'
        })
    });

    $("#selDoctor").click(function () {
        Cfapp.f7({
            dataUrl: "#springUrl('/a/wxQrcode/listUser?type=" + 3 + "')",
            checkType: "single", // 多选为multi
            title: '请选择医生',
            btnoktext: "确定",
            btncanceltext: "取消",
            columns: ["选择", "请选择医生"],
            isSearch: '0',
            searchColumns: ["name"],//搜索的字段名称
            searchColumnsRemarks: ["请选择医生"],//搜索的字段备注
            aoColumns: [{
                "mData": "id"
            }, {
                "mData": "name"
            }],
            aoColumnDefs: [{
                "aTargets": [0],
                "mData": "id",
                "mRender": function (a, b, c, d) {
                    return '<input  class="bindId" value="' + a + '" type="radio" id="' + a + '" name="sel" data-value="' + a + '" data-name="' + c.name + '">';
                }
            }, {
                "aTargets": [1],
                "mData": "name",
                "mRender": function (a, b, c, d) {//a表示createtime对应的值，c表示当前记录行对象
                    return a;
                }
            }],
            success: function () {

            },
            cancel: function () {

            },
            storeFields: 'pastRecords', // 储存的字段
            displayFields: 'pharmacist'
        })
    });

    var recdTypeAdd = function () {
        var initForm = function () {
            var initFormCtrl = function () {
                bindEvent();
            };
            var bindEvent = function () {
                $("#myForm").validate({
                    rules: {},
                    messages: {},
                    submitHandler: function (form) {
                        $("#save").attr("disabled", true);
                        Cfapp.confirm({
                            message: "确定审核通过吗",
                            btnoktext: "确定",
                            btncanceltext: "取消",
                            success: function () {

                                //验证商品是否重复
                                var arr = [];
                                var obj = {};
                                $(".translate").each((index, item) => {
                                    var txt = $(item).find('[name="releas"]').val();

                                    if (obj[txt]) {
                                        arr.push(index);
                                        return;
                                    } else {
                                        obj[txt] = true;
                                    }
                                })
                                if (arr.length > 0) {
                                    Cfapp.alert({
                                        message: "无法增加重复商品!",
                                        btntext: "确定",
                                        success: function () {
                                            $("#save").attr("disabled", false);
                                        }
                                    });
                                    return;
                                }

                                var datas = [];
                                $(".translate").each(function (index,item){
                                    datas.push({
                                        productId :$(item).find('[name="releas"]').val(),
                                        drugsNum : $(item).find('[name="listHtml"]').val(),
                                        price : $(item).find('[name="htmlPrice"]').val(),
                                        amount : $(item).find('[name="htmlAmount"]').val()
                                    });
                                });

                                if (datas.length == 0){
                                    Cfapp.alert({
                                        message: "咨询单至少包含一件商品",
                                        btntext: "确定",
                                        success: function () {
                                            $("#save").attr("disabled", false);
                                        }
                                    });
                                    return;
                                };

                                var dataJSON = {
                                    "consultId": $("#id").val(),
                                    "status": "1",
                                    "pastRecords": $("#pastRecords").val(),
                                    "allergy": $("#allergy").val(),
                                    "goodsDes": JSON.stringify(datas)
                                };
                                $.getJSON("#springUrl('/a/consultSheet/updateStatus')", dataJSON, function (returnobj) {
                                    $("#save").attr("disabled", false);
                                    if (returnobj.errorNo == 0) {  //保存成功
                                        Cfapp.alert({
                                            message: "审核成功",
                                            btntext: "确定",
                                            success: function () {
                                                location.href = "#springUrl('/a/consultSheet/list')";
                                            }
                                        });
                                    } else if (returnobj.errorNo == 1) {  //修改成功
                                        Cfapp.alert({
                                            message: "审核失败",
                                            btntext: "确定",
                                            success: function () {
                                                location.href = "#springUrl('/a/consultSheet/list')";
                                            }
                                        });
                                    }
                                });
                            },
                            cancel: function () {
                                return;
                            }
                        });

                    }
                })
            }
            initFormCtrl();
        }
        return {

            //main function to initiate the module
            init: function () {
                initForm();
            }

        };
    }();
</script>
</body>

<!-- END BODY -->
</html>