From eaf5199c2eee33f5add31d6dbe17d731eb9eab66 Mon Sep 17 00:00:00 2001
From: zhaoxiaohao <913652501@qq.com>
Date: Thu, 14 May 2020 16:23:48 +0800
Subject: [PATCH] 医生添加用户时, 用户名不能重复
---
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor.html | 36 ++++++++++++++++++++++++++----------
1 files changed, 26 insertions(+), 10 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 b4094b0..c9642a3 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>
@@ -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" 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: '联系方式' },
{
@@ -484,9 +484,9 @@
},
{ 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: 250, sort: true, 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();
@@ -533,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();
@@ -595,9 +594,26 @@
$('#hospitalName-add').append(new Option(item.hospitalName, item.id, false, selected));
})
form.render();
+ $("#username").blur(function () {
+ 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