group_edit.html 10.2 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
#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 type="hidden" id="group.id" name="id" value="$!group.id"/>
<div class="form-group">
<label class="col-sm-3 control-label">组名称:</label>
<div class="col-sm-8">
<input type="text" placeholder="医院名称" value="$!group.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">
<select class="form-control" name="type">
<option value="1" #if($!group.type==1) selected="selected" #end>1</option>
<option value="2" #if($!group.type==2) selected="selected" #end>2</option>
<option value="3" #if($!group.type==3) selected="selected" #end>3</option>
</select>
<!-- <input type="text" placeholder="类型" aria-required="true" required="true" minlength="3" name="type" class="form-control" id="type"> -->
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">推送地址:</label>
<div class="col-sm-8">
<input type="text" value="$!group.pushaddress" placeholder="连接地址" aria-required="true" required="true" minlength="3" name="pushaddress" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">拉取地址:</label>
<div class="col-sm-8">
<input type="text" value="$!group.pulladdress" placeholder="连接地址" aria-required="true" required="true" minlength="3" name="pulladdress" class="form-control">
</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="orgIds" name="orgIds"/>
<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-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>
<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);
}
}
$('#orgIds').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']});
}
$('#orgIds').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();
//console.log(data);
if("$!group.id" == ""){
ajaxPost(APP.PATH + "/sysOrganGroup/create",data);
}else{
ajaxPost(APP.PATH + "/sysOrganGroup/update",data);
}
parent.reloadGrid('dataTable');
}
}

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: '地址'
}];
</script>
#end
#extends("/common/base_list.html")

<script type="text/javascript">
//拥有医院列表
$(function () {
var orgListTable = new orgLostTableInit();
orgListTable.Init();
})



var orgLostTableInit = function () {
var orgListTableInit = new Object();
//初始化Table
orgListTableInit.Init = function () {
$('#orgList').bootstrapTable({
url: '${ctx}/sysOrganGroup/listGroupOrg/$!group.id', //请求后台的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>