user_edit.html 16.6 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
#override("css")
<link rel="stylesheet" href="${ctx}/static/js/zTree_v3/css/zTreeStyle/zTreeStyle.css" type="text/css" />
#end
#override("js")
<script src="${ctx}/static/js/zTree_v3/js/jquery.ztree.all-3.5.min.js" type="text/javascript"></script>
<script type="text/javascript">
var reNodes = ${roleString};
</script>
<script>
var setting_resource = {
check: {
enable: true,
chkboxType: {
'Y': 's',
'N': 's'
}
},
view: {
dblClickExpand: false
},
data: {
simpleData: {
enable: true,
idKey: "role_id"
}
},
callback: {
beforeClick: beforeClick_resource,
onCheck: onCheck_resource
}
};
function beforeClick_resource(treeId, treeNode) {
var zTree = $.fn.zTree.getZTreeObj('tree_resource');
zTree.expandNode(treeNode);
zTree.checkNode(treeNode, !treeNode.checked, null, true);
return false;
}
function selectTreeNode_resource(id) {
var zTree = $.fn.zTree.getZTreeObj('tree_resource');
var node = zTree.getNodeByParam('id', id);
var pNode = node.getParentNode();
while (pNode != null) {
pNode = analParentNode(pNode, zTree);
}
zTree.cancelSelectedNode();
zTree.checkNode(node, true);
zTree.selectNode(node, true);
}
function analParentNode(node, zTree) {
zTree.expandNode(node, true);
var pNode = node.getParentNode();
if (pNode) {
return pNode;
}
return null;
}
function onClick_resource(e, treeId, treeNode) {
var zTree = $.fn.zTree.getZTreeObj('tree_resource');
zTree.expandNode(treeNode);
zTree.checkNode(treeNode, !treeNode.checked, null, true);
return false;
}
function onCheck_resource(e, treeId, treeNode) {
var zTree = $.fn.zTree.getZTreeObj('tree_resource'),
nodes = zTree.getCheckedNodes(true),
v_txt = '';
v_value = '';
v_type = '';
for (var i = 0,
l = nodes.length; i < l; i++) {
v_txt += nodes[i].name + ',';
v_value += nodes[i].id + ',';
if (nodes[i].type) {
v_type += nodes[i].type + ',';
}
}
if (v_txt.length > 0) {
v_txt = v_txt.substring(0, v_txt.length - 1);
v_value = v_value.substring(0, v_value.length - 1);
v_type = v_type.substring(0, v_type.length - 1);
}
$('#resource').attr('value', v_value);
$('#resource_txt').attr('value', v_txt);
$('#resource_type').attr('value', v_type);
}
var zNodes_resource = null;
var zTree_selectMode_resource = 'all';
$(function() {
zNodes_resource = reNodes;
var zTree = $.fn.zTree.init($('#tree_resource'), setting_resource, zNodes_resource);
//初始化勾选
var rpValues = $('#resource').val();
if(rpValues.length > 0){
var rpArray = rpValues.split(",");
for(var i = 0 ; i < rpArray.length ;i++){
var node = zTree.getNodeByParam('id',rpArray[i]);
if(node != null){
zTree.checkNode(node,true,true);
}
}
}
});

</script>
#end
#override("body")
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="col-sm-4">
<form id="validForm" class="form-horizontal m-t" novalidate="novalidate">
<input id="resource" name="roles" type="hidden" value="$!userRoles"/>
<input type="hidden" id="user.id" name="id" value="$!user.id"/>
<div class="form-group">
<label class="col-sm-3 control-label">账号:</label>
<div class="col-sm-8">
<input type="text" placeholder="登录账号" value="$!user.account" aria-required="true" required="true" class="form-control" minlength="2" name="account" id="account">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用户姓名:</label>
<div class="col-sm-8">
<input type="text" placeholder="用户姓名" value="$!user.name" aria-required="true" required="true" class="form-control" minlength="2" name="name" id="name">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">密码:</label>
<div class="col-sm-8">
<input type="password" placeholder="登录密码" value="" #if("$!user.id" == "") aria-required="true" required="true" minlength="2" #end class="form-control" name="pwd" id="pwd">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">手机号:</label>
<div class="col-sm-8">
<input type="text" placeholder="手机号" value="$!user.phone" aria-required="true" required="true" class="form-control" minlength="11" maxlength="11" name="phone" id="phone">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input type="text" placeholder="备注信息" value="$!user.remarks" aria-required="true" required="true" class="form-control" minlength="2" name="remarks" id="remarks">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">医院:</label>
<div class="col-sm-8">
#selector("orgId" "orgId" $orgs $!user.orgId)
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">科室:</label>
<div class="col-sm-8">
#selector("deptId" "deptId" $depts $!user.deptId)
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<label class="checkbox-inline i-checks">
<div class="icheckbox_square-green" style="position: relative;">
<input type="checkbox" value="0" name="enable" #if ($user.enable == 0) checked="checked" #end
style="position: absolute; opacity: 0;" >
<ins class="iCheck-helper"
style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
</div>是否禁用(选中禁用,不选中可用)
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<label class="checkbox-inline i-checks">
<div class="icheckbox_square-green" style="position: relative;">
<input type="checkbox" value="0" name="type" #if ($user.type == 0) checked="checked" #end
style="position: absolute; opacity: 0;" >
<ins class="iCheck-helper"
style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
</div>是否管理员(选中为管理员)
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">医院权限列表:</label>
<button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 移除</button>
</div>
<div class="form-group">
<input type="hidden" id="dataOrgIds" name="dataOrgIds" value="${dataOrgids}"/>
<table id="orgList"></table>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-3 pull-right">
<button type="button" class="btn btn-primary" onclick="save();"><i class="fa fa-check"></i>&nbsp;提交</button>
<button type="button" class="btn btn-white" onclick="parent.closeAll();"><i class="fa fa-close"></i>&nbsp;取消</button>
</div>
</div>
</form>
</div>
<div class="col-sm-6">
<div id="treeContent_resource" class="menuContent">
<ul id="tree_resource" class="ztree" style="margin-top:0; width:180px; height: 250px;"></ul>
</div>
</div>
<div class="col-sm-8">
<div style="padding-top:30px;">
<form class="form-inline">
<div class="form-group">
<input type="text" placeholder="请输入医院名过滤" id="groupName" name="groupName" class="form-control">
</div>
<div class="form-group" onclick="search();">
<a class="btn btn-primary"><i class="fa fa-search"></i> 查询</a>
</div>
<div class="form-group" onclick="add();">
<a class="btn btn-primary"><i class="fa fa-plus"></i> 添加</a>
</div>
</form>
</div>
<table id="dataTable"></table>
</div>
</div>
</div>
<script type="text/javascript">
function search(){
var queryParams = {
query:{
name: $("#groupName").val()
}
}
$('#dataTable').bootstrapTable('refresh', queryParams );
}
function add(){
var list = $('#dataTable').bootstrapTable('getSelections');
for(var i = 0 ; i< list.length ; i++){
if(! $('#orgList').bootstrapTable('getRowByUniqueId', list[i]['id'])){
var row = [];
row.push({
id: list[i]['id'],
name: list[i]['name']
});
$('#orgList').bootstrapTable('append', row);
}
}
$('#dataOrgIds').val(getOrgIds());
}
function del(){
var list = $('#orgList').bootstrapTable('getSelections');
for(var i = 0 ; i< list.length ; i++){
$('#orgList').bootstrapTable('remove', {field: 'id', values: list[i]['id']});
}
$('#dataOrgIds').val(getOrgIds());
}
function getOrgIds(){
var list = $('#orgList').bootstrapTable('getData');
var ids = [];
for(var i = 0 ;i < list.length ;i++){
ids.push(list[i]['id']);
}
return ids.join(',');
}

function save(){
if($('#validForm').valid()){
var data = $('#validForm').serialize();
data = data + "&" + $('#roleForm').serialize();
if("$!user.id" == ""){
ajaxPost(APP.PATH + "/sysUsers/create",data);
}else{
ajaxPost(APP.PATH + "/sysUsers/update",data);
}
parent.reloadGrid('dataTable');
}
}
//机构列表-begin
var controllerRequestMappint = "/sysOrganizations/";

## 参考 base_table_init.js 或者根据empty_bootstrap_table_init.js 来自己创建特殊的table
## 注意:自己创建的特殊的table不能extends base_list.html
var default_dataUrl = APP.PATH + controllerRequestMappint + "list";
var default_dataColumns = [{
field: 'check_state',
title: '',
checkbox: true
},{
field: 'id',
title: '编号'
},{
field: 'name',
title: '名称'
},{
field: 'type',
title: '类型',
formatter:function(value,row,index){
//1:卫生与计划生育委员会,2:妇幼保健院/站,3:妇产(科)医院,4:综合医院,5:计生站,6:卫生院,7:卫生所,8:其他
switch(value){
case 1:return "卫生与计划生育委员会";
case 2:return "妇幼保健院/站";
case 3:return "妇产(科)医院";
case 4:return "综合医院";
case 5:return "计生站";
case 6:return "卫生院";
case 7:return "卫生所";
case 8:return "其他";
}
}
},{
field: 'shortCode',
title: '简码'
},{
field: 'level',
title: '等级',
formatter:function(value,row,index){
switch (value) {
case 1:return "省";
case 2:return "市";
case 3:return "区县";
case 4:return "乡镇";
case 5:return "村";
case 6:return "其他";

default:
return "";
}
}
},{
field: 'gradeLevel',
title: '医院等级'
},{
field: 'mobile',
title: '服务热线'
},{
field: 'starLevel',
title: '星级'
},{
field: 'status',
title: '状态',
formatter:function(value,row,index){
switch (value) {
case 0: return "正式运行";
case 1: return "试运行";
case 2: return "停止运行";
default:
break;
}
}
},{
field: 'address',
title: '地址'
}];
//机构列表-end
</script>
#end
#extends("/common/base_list.html")


<script type="text/javascript">
//拥有医院列表
$(function () {
var orgListTable = new orgLostTableInit();
orgListTable.Init();
var orgId_select = $('#orgId');
orgId_select.on("change",function(){
if(orgId_select.val() != ""){
var url = APP.PATH +"/sysDepartments/list";
$.ajax({
url: url,
cache: false,
data: { orgId : orgId_select.val() },
dataType: "json",
success: function(data){
if(data && data.rows){
var deptOpt = $("#deptId option");
deptOpt.remove();
$('#deptId').append('<option value="">&nbsp;</option>');
for(idx in data.rows){
$('#deptId').append('<option value="' + data.rows[idx].id + '">' + data.rows[idx].name + '</option>');
}
$('#deptId').selectator('destroy');
$('#deptId').selectator({
labels: {
search: 'Search here...'
}
});

}
}
});
}
});
})



var orgLostTableInit = function () {
var orgListTableInit = new Object();
//初始化Table
orgListTableInit.Init = function () {
$('#orgList').bootstrapTable({
url: '${ctx}/sysOrganizations/listOrgs/$!dataOrgids', //请求后台的URL(*)
method: 'get', //请求方式(*)
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
sortable: false, //是否启用排序
queryParams: orgListTableInit.queryParams,//传递参数(*)
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
pageNumber:1, //初始化加载第一页,默认第一页
pageSize: 999, //每页的记录行数(*)
pageList: [999], //可供选择的每页的行数(*)
strictSearch: true,
clickToSelect: true, //是否启用点击选中行
//height: 600, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
uniqueId: "id", //每一行的唯一标识,一般为主键列
cardView: false, //是否显示详细视图
detailView: false, //是否显示父子表
columns: [{
field: 'check_state',
title: '',
checkbox: true
},{
field: 'id',
title: '序号',
visible: false
}, {
field: 'name',
title: '医院名称'
}],
onLoadSuccess: function(){ //加载成功时执行
var list = $('#orgList').bootstrapTable('getData');
var ids = [];
for(var i = 0 ;i< list.length ; i++ ){
ids.push(list[i]['id']);
}
$('#orgIds').val(ids.join(','));
}
});
};

//得到查询的参数
orgListTableInit.queryParams = function (params) {
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
_size: 999, //每页记录数
_offset: 1 , //偏移量
/*sdate: $("#stratTime").val(),
edate: $("#endTime").val(),
sellerid: $("#sellerid").val(),
orderid: $("#orderid").val(),
CardNumber: $("#CardNumber").val(),
maxrows: params.limit,
pageindex: params.pageNumber,
portid: $("#portid").val(),
CardNumber: $("#CardNumber").val(),
tradetype: $('input:radio[name="tradetype"]:checked').val(),
success: $('input:radio[name="success"]:checked').val(),*/
};
return temp;
};
return orgListTableInit;
};
</script>