@{
    ViewBag.Title = "UpdateDealerUserRights";
    Layout = "~/Views/Shared/_LayoutTable.cshtml";
}
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <table class="table table-bordered table-striped table-hover">
                <tr>
                    <td style="text-align:right">登录人员：</td>
                    <td style="text-align:left"><input type="text" id="txtLoginName"   readonly="readonly" style="width:200px" value="@ViewBag.LoginName"><input type="hidden" id="loginid" value="@ViewBag.LoginID" /></td>
                    <td></td>
                </tr>
                <tr>
                    <td style="text-align:right">经手人：</td>
                    <td style="text-align:left"><input type="text" id="bfullname"   readonly="readonly" style="width:200px" value="@ViewBag.NextUser"><input type="hidden" id="nexttypeid" value="@ViewBag.NextUserID" /></td>
                    <td><button class="glyphicon glyphicon-plus btn btn-default" onclick="ShowNextUser()"></button></td>
                </tr>
                <tr>
                    <td style="text-align:right">制单人：</td>
                    <td style="text-align:left"><input type="text" id="salesmanFullName"   readonly="readonly" style="width:200px" value="@ViewBag.Productor"><input type="hidden" id="salesmanBtypeid" value="@ViewBag.ProductorID" /></td>
                    <td><button class="glyphicon glyphicon-plus btn btn-default" onclick="ShowProductor()"></button></td>
                </tr>
                <tr>
                    <td style="text-align:right">往来单位：</td>
                    <td style="text-align:left"><input type="text" id="cfullname"   readonly="readonly" style="width:200px" value="@ViewBag.BtypeName"><input type="hidden" id="clientTypeID" value="@ViewBag.Btypeid" /></td>
                    <td><button class="glyphicon glyphicon-plus btn btn-default" onclick="ShowBtype()"></button></td>
                </tr>
                <tr>
                    <td style="text-align:right">密码：</td>
                    <td style="text-align:left"><input type="password" id="txtPassword"   style="width:200px" value="@ViewBag.PassWord"></td>
                    <td></td>
                </tr>
                <tr>
                    <td style="text-align:right">备注：</td>
                    <td style="text-align:left"><textarea cols="20" rows="5" name="cmarks" id="txtRemark"  >@ViewBag.Comment</textarea></td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td style="text-align:left"><button id="btnSubmit" class="btn btn-default" onclick="Update()"><i class="glyphicon glyphicon-ok"></i>提交</button></td>
                    <td></td>
                </tr>
            </table>
        </div>
    </div>
</div>
<script type="text/javascript">
    function ShowNextUser() {//经手人
        layer.open({
            btnClose: 2,
            type: 2,
            title: '<i class="glyphicon glyphicon-user"></i> 设置经手人',
            shadeClose: false,
            shade: 0.5,
            area: ['70%', '80%'],
            content: '../CommonSelector/EmployeeSelector?operation=next',
            end: function () {

            }
        });
    }
    function ShowProductor() {//制单人
        layer.open({
            btnClose: 2,
            type: 2,
            title: '<i class="glyphicon glyphicon-user"></i> 设置制单人',
            shadeClose: false,
            shade: 0.5,
            area: ['70%', '80%'],
            content: '../CommonSelector/EmployeeSelector?operation=productor',
            end: function () {

            }
        });
    }
    function ShowBtype() {//往来单位
        layer.open({
            btnClose: 2,
            type: 2,
            title: '<i class="glyphicon glyphicon-user"></i> 设置往来单位',
            shadeClose: false,
            shade: 0.5,
            area: ['70%', '80%'],
            content: '../CommonSelector/ClientSelector',
            end: function () {

            }
        });
    }
    function Update() {
        $.ajax({
            url: "../DealerEdition/UpdateUserRights",
            dataType: "text",
            data: { LoginID: $("#loginid").val(), empname: $("#bfullname").val(), empid: $("#nexttypeid").val(), salname: $("#salesmanFullName").val(), salid: $("#salesmanBtypeid").val(), clientname: $("#cfullname").val(), clientid: $("#clientTypeID").val(), password: $("#txtPassword").val(), comment: $("#txtRemark").val() },
            type: "post",
            success: function (data) {//删除成功后刷新table
                parent.$('#businessTable').bootstrapTable('refresh');
                parent.layer.msg(data, { time: 2000 })
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
            },
            error: function (data) {
                layer.msg(data, { icon: 5, time: 2000 });
            },
        })
    }
</script>