123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- {{include "com/inc.html"}}
- <!-- Main Header -->
- {{include "com/header.html"}}
- <!-- Left side column. 权限菜单 -->
- {{include "com/menu.html"}}
- <div class="content-wrapper">
- <section class="content-header">
- <h1>
- <small></small>
- </h1>
- <ol class="breadcrumb">
- <li><a href="#"><i class="fa fa-dashboard"></i> 用户组管理</a></li>
- <li><a href="/front/group"><i class="fa fa-dashboard"></i> 用户组管理</a></li>
- <li><a href="/front/group/new"><i class="fa fa-dashboard"></i> 用户组新增</a></li>
- </ol>
- </section>
- <!-- Main content -->
- <section class="content">
- <form class="form-horizontal" onsubmit="return false;">
- <div class="box box-primary">
- <div class="box-header with-border">
- <i class="fa fa-group"></i>
- <h4 class="box-title">用户组信息</h4>
- </div>
- <div class="box-body">
- <div class="form-group" style="text-align: right;margin-right: 20px" >
- <!-- <a class="btn btn-sm btn-success" onclick="addMember()"><i class="fa fa-fw fa-plus fa-lg"></i>添加成员信息</a>-->
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label"><span style="color:red;">* </span>用户组名称</label>
- <div class="col-sm-3">
- <input type="text" class="form-control" id="group-name" placeholder="用户组名称" required>
- </div>
- <label class="col-sm-2 control-label"><span style="color:red;">* </span>公司名称</label>
- <div class="col-sm-3">
- <input type="text" class="form-control" id="company-name" placeholder="公司名称" required>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label"><span style="color:red;">* </span>负责人</label>
- <div class="col-sm-3">
- <input type="text" class="form-control" id="leader" placeholder="负责人名称" required>
- </div>
- <label class="col-sm-2 control-label">联系方式</label>
- <div class="col-sm-3">
- <input type="text" class="form-control" id="contract" placeholder="联系方式:电话/邮箱">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">用户组权限</label>
- <div class="col-sm-5 radio">
- <label class="margin-r-5">
- <input type="radio" name="role" value=1 checked>系统管理员
- </label>
- <label class="margin-r-5">
- <input type="radio" name="role" value=2 checked>管理员
- </label>
- <label class="margin-r-5">
- <input type="radio" name="role" value=3>质检员
- </label>
- <label>
- <input type="radio" name="role" value="4">普通用户
- </label>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">登陆密码</label>
- <div class="col-sm-2">
- <input type="password" id="group-pwd" readonly="readonly" class="form-control" placeholder="手动输入密码">
- </div>
- <div class="col-xs-3" style="width: auto">
- <label class="control-label" style="font-size: xx-small;width: auto">默认密码:</label>
- <input id="group-switch-pwd" name="switch-pwd" type="checkbox">
- </div>
- <label class="col-sm-1 control-label" style="width: auto">服务时间</label>
- <div class="col-sm-3">
- <input type="text" id="stratDate" class="col-sm-2 form-control" readonly="readonly" placeholder="开始日期 - 结束日期">
- </div>
- </div>
- <div class="box-body">
- <div class="box-header with-border">
- <i class="fa fa-user"></i>
- <h4 class="box-title">质检员信息</h4>
- </div>
- <h1></h1>
- <div class="form-group">
- <label class="col-sm-2 control-label">用户账号</label>
- <div class="col-sm-3">
- <input type="text" readonly="readonly" class="form-control" placeholder="默认用户组名称+zj+数字">
- </div>
- <label class="col-sm-2 control-label">用户个数(个)</label>
- <div class="col-sm-3">
- <input type="number" id="u1-size" class="form-control" value="1" oninput="if(value<0)value=0;if(value>10)value=10">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">登陆密码</label>
- <div class="col-sm-2">
- <input type="password" id="u1-pwd" readonly="readonly" class="form-control" placeholder="手动输入密码">
- </div>
- <div class="col-xs-3" style="width: auto">
- <label class="control-label" style="font-size: xx-small;">默认密码:</label>
- <input id="u1-switch-pwd" name="switch-pwd" type="checkbox">
- </div>
- <label class="col-sm-1 control-label" style="width: auto">用户状态</label>
- <div class="col-sm-3">
- <input id="u1-switch-state" name="switch-state" type="checkbox">
- </div>
- </div>
- </div>
- <div class="box-body">
- <div class="box-header with-border">
- <i class="fa fa-user"></i>
- <h4 class="box-title">成员信息</h4>
- </div>
- <h1></h1>
- <div class="form-group">
- <label class="col-sm-2 control-label">用户账号</label>
- <div class="col-sm-3">
- <input type="text" readonly="readonly" class="form-control" placeholder="默认用户组名称+数字">
- </div>
- <label class="col-sm-2 control-label">用户个数(个)</label>
- <div class="col-sm-3">
- <input type="number" id="u2-size" class="form-control" value="1" oninput="if(value<0)value=0;if(value>30)value=30">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">登陆密码</label>
- <div class="col-sm-2">
- <input type="password" readonly="readonly" id="u2-pwd" class="form-control" placeholder="手动输入密码">
- </div>
- <div class="col-xs-3" style="width: auto">
- <label class="control-label" style="font-size: xx-small;width: auto">默认密码:</label>
- <input name="switch-pwd" id="u2-switch-pwd" type="checkbox">
- </div>
- <label class="col-sm-1 control-label" style="width: auto">用户状态</label>
- <div class="col-sm-3">
- <input id="u2-switch-state" name="switch-state" type="checkbox">
- </div>
- </div>
- </div>
- </div>
- <div class="text-center">
- <button class="btn btn-lg btn-success" onclick="saveMethod()">保存</button>
- </div>
- <hr>
- </div>
- </form>
- </section>
- </div>
- {{include "com/footer.html"}}
- <script>
- menuActive("group");
- let group = {}
- let user = {}
- $(document).ready(function () {
- $("#group-pwd").val({{.T.pwd}})
- $("#u1-pwd").val({{.T.pwd}})
- $("#u2-pwd").val({{.T.pwd}})
- })
- $("[name='switch-state']").each(function () {
- $(this).bootstrapSwitch({
- onText : "开", // 设置ON文本
- offText : "关", // 设置OFF文本
- onColor : "success",// 设置ON文本颜色(info/success/warning/danger/primary)
- offColor : "primary", // 设置OFF文本颜色 (info/success/warning/danger/primary)
- }).bootstrapSwitch('size', 'small').bootstrapSwitch('state', true);
- })
- $("[name='switch-pwd']").each(function () {
- $(this).bootstrapSwitch({
- onText : "是",
- offText : "否",
- onColor : "success",
- offColor : "warning",
- }).bootstrapSwitch('size', 'small').bootstrapSwitch('state', true);
- })
- // 用户组状态
- $("#group-switch-state").bootstrapSwitch('onSwitchChange', function (event, state){group['state'] = state})
- // 用户组登陆密码
- $("#group-switch-pwd").bootstrapSwitch(
- 'onSwitchChange', function (event, state){
- group["default_pwd"] = state
- if (state===true) {
- $("#group-pwd").attr('readonly', 'readonly').val("xxx")
- }else {
- $("#group-pwd").removeAttr('readonly').val("")
- }
- }
- )
- // 用户登陆密码
- $("#u1-switch-pwd").bootstrapSwitch(
- 'onSwitchChange', function (event, state){
- user["u1_default_pwd"] = state
- if (state===true) {
- $("#u1-pwd").attr('readonly', 'readonly').val({{.T.pwd}})
- }else {
- $("#u1-pwd").removeAttr('readonly').val("")
- }
- }
- )
- $("#u2-switch-pwd").bootstrapSwitch(
- 'onSwitchChange', function (event, state){
- user["u2_default_pwd"] = state
- if (state===true) {
- $("#u2-pwd").attr('readonly', 'readonly').val({{.T.pwd}})
- }else {
- $("#u2-pwd").removeAttr('readonly').val("")
- }
- }
- )
- // 用户状态
- $("#u1-switch-state").bootstrapSwitch('onSwitchChange', function (event, state){user["u1_state"] = state})
- $("#u2-switch-state").bootstrapSwitch('onSwitchChange', function (event, state){user["u2_state"] = state})
- function saveMethod() {
- const gname = $("#group-name").val();
- const company = $("#company-name").val()
- const lender = $("#leader").val()
- if (gname === "" || company === "" || lender === "") {
- return
- }
- group["i_role"] = $("input[name='role']:checked").val()
- group["s_name"] = gname
- group["s_entname"] = company
- group["s_personname"] = lender
- group["s_personcontact"] = $("#contract").val()
- group["s_password"] = $("#group-pwd").val()
- user["u1_size"] = $("#u1-size").val()
- user["u1_pwd"] = $("#u1-pwd").val()
- user["u2_size"] = $("#u2-size").val()
- user["u2_pwd"] = $("#u2-pwd").val()
- console.log(group)
- console.log(user)
- $.ajax({
- url: "/front/group/new",
- type: 'POST',
- data: {"group": JSON.stringify(group), "user": JSON.stringify(user)},
- success: function (r) {
- if (r.rep) {
- window.location.href="/front/group"
- } else {
- showTip("保存失败");
- }
- }
- })
- }
- </script>
|