From 96e929fc7aa1f9b3b6e41f64564d1177f4d4dda9 Mon Sep 17 00:00:00 2001 From: zhaoxiaohao <913652501@qq.com> Date: Fri, 12 Jun 2020 18:27:24 +0800 Subject: [PATCH] 添加医生时,将手机号设置成登录名 --- kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor.html | 44 +++++++++++++++++++++++++++++++++----------- 1 files changed, 33 insertions(+), 11 deletions(-) diff --git a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor.html b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor.html index b56f6e5..d26f60e 100644 --- a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor.html +++ b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor.html @@ -18,14 +18,14 @@ <option value="false">试用</option> </select>  <input name="hospitalName-seach" id="hospitalName-seach" placeholder="请输入医院名称" type="text" - class="layui-input search-input" maxlength="50" autocomplete="off" />  + class="layui-input search-input" maxlength="50" autocomplete="off" />  </div> <button id="app-btn-search" class="layui-btn icon-btn permissions" layt="abc" permissions="sysdoctor-list"><i class="layui-icon"></i>搜索</button> <button id="doctor-btn-add" class="layui-btn icon-btn permissions" permissions="sysdoctor-edit"><i class="layui-icon"></i>添加</button> - <!-- 数据表格 --> - <table class="layui-table" id="app-table" lay-filter="app-table"></table> + <!-- 数据表格 --> + <table class="layui-table" id="app-table" lay-filter="app-table"></table> </div> </div> </div> @@ -220,7 +220,7 @@ <div class="layui-form-item"> <label class="layui-form-label">联系电话</label> <div class="layui-input-block"> - <input name="doctorTel" type="text" class="layui-input" maxlength="20" lay-verify="required|phone" required/> + <input name="doctorTel" id="doctorTel-add" type="text" class="layui-input" maxlength="20" lay-verify="required|phone" required/> </div> </div> <div class="layui-form-item"> @@ -290,7 +290,7 @@ <div class="layui-form-item"> <label class="layui-form-label" >登录帐号</label> <div class="layui-input-block"> - <input name="username" type="text" class="layui-input" maxlength="15" lay-verify="required" required/> + <input name="username" id="username" readonly type="text" class="layui-input" maxlength="15" lay-verify="required" required/> </div> </div> </div> @@ -467,9 +467,9 @@ headers: { 'Authorization': 'Bearer ' + config.getToken().access_token }, page: true, cols: [[ - { field: 'hospitalName', width: 260, title: '医院名称' }, + { field: 'hospitalName', width: 180, title: '医院名称' }, { field: 'doctorName', width: 120, title: '医生姓名' }, - { field: 'doctorRank', width: 180, title: '职称' }, + { field: 'doctorRank', width: 100, title: '职称' }, { field: 'username', width: 150, title: '登录帐号' }, { field: 'doctorTel', width: 150, title: '联系方式' }, { @@ -483,9 +483,10 @@ } }, { field: 'enabled', width: 100, align: 'center', templet: '#doctor-tpl-state', title: '状态' }, - { field: 'createTime', width: 150, title: '创建时间', templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm')}}</div>" }, + // { field: 'createTime', width: 150, title: '创建时间', templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm')}}</div>" }, + { field: 'createTime', width: 100, sort: true, title: '创建时间', templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy/MM/dd HH:mm')}}</div>" }, { field: 'serverUserName', width: 100, title: '销售代表' }, - { width: 200,align: 'center', toolbar: '#doctor-table-bar', title: '操作' }, + { width: 300, align: 'center', toolbar: '#doctor-table-bar', title: '操作' }, ]], done: function (res, curr, count) { permissionsInput(); @@ -532,8 +533,7 @@ // 搜索按钮点击事件 $('#app-btn-search').click(function () { - if(strUtil.isEmpty($("#hospitalName-seach").val())) - { + if (strUtil.isEmpty($("#hospitalName-seach").val())) { $("#hospitalId").val(""); } var doctorState = $('#doctorState').val(); @@ -542,6 +542,7 @@ var doctorName = $('#doctorName').val(); table.reload('app-table', { where: { doctorState: doctorState, hospitalId: hospitalName, doctorTel: doctorTel, doctorName: doctorName } }); }); + // 显示新增弹窗 var showEditModel_add = function () { layer.open({ @@ -594,9 +595,30 @@ $('#hospitalName-add').append(new Option(item.hospitalName, item.id, false, selected)); }) form.render(); + $("#username").blur(function () { + username_is_usered("username"); + }) + $("#doctorTel-add").blur(function () { + $("#username").val($("#doctorTel-add").val()) + username_is_usered("username"); + }) } }); }; + //判断用户名是否被使用 + var username_is_usered=function(username_id){ + var username=$("#"+username_id).val() + admin.req('api-user/users/findCountByMap',JSON.stringify({username:username}), function (data) { + if (data.code == 0) { + if(data.data>0){ + $("#"+username_id).val("") + layer.msg("该登录帐号已经使用",{ icon: 2, time: 500 }) + } + } else { + layer.msg(data.msg, { icon: 2, time: 500 }); + } + }, 'post'); + } // 显示编辑弹窗 var showEditModel = function (data, flag) { var title = ""; -- Gitblit v1.8.0