<div class="layui-card">
|
<div class="layui-card-header">
|
<h2 class="header-title">筛查医院管理</h2>
|
<span class="layui-breadcrumb pull-right">
|
<a href="#!home_console">首页</a>
|
<a><cite>筛查医院管理</cite></a>
|
</span>
|
</div>
|
<div class="layui-card-body">
|
<div class="layui-form toolbar">
|
<div class="layui-form-item">
|
<div class="layui-inline" style="margin-bottom: -25px;">
|
<select id="enabled" lay-filter="role_clients">
|
<option value="">医院状态</option>
|
<option value="1">启用</option>
|
<option value="0">停用</option>
|
</select>
|
<select id="isScreeningPush" lay-filter="role_clients">
|
<option value="">推送状态</option>
|
<option value="1">是</option>
|
<option value="0">否</option>
|
</select>
|
<input name="hospitalName" id="hospitalName-seach" placeholder="按医院名称" type="text"
|
class="layui-input search-input" maxlength="50" autocomplete="off"/> 
|
</div>
|
<button id="app-btn-search" class="layui-btn icon-btn" layt="abc"><i class="layui-icon"></i>搜索
|
</button>
|
<button id="screeningHospital-btn-add" class="layui-btn icon-btn"><i class="layui-icon"></i>添加筛查医院
|
</button>
|
<!-- 数据表格 -->
|
<table class="layui-table" id="app-table" lay-filter="app-table"></table>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<input id="hospitalId" type="hidden"/>
|
<!-- 表格操作列 -->
|
|
<script type="text/html" id="doctor-table-bar">
|
<button class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改
|
</button>
|
<button class="layui-btn layui-btn-xs" lay-event="downLoad">
|
下载二维码
|
</button>
|
<button class="layui-btn layui-btn-xs" lay-event="export">
|
导出
|
</button>
|
</script>
|
|
<script type="text/html" id="hospital-push-state">
|
<input type="checkbox" lay-filter="hospital-push-state" value="{{d.id}}"
|
lay-skin="switch" lay-text="是|否" {{d.isScreeningPush==1?'checked':''}}/>
|
</script>
|
|
<script type="text/html" id="hospital-state">
|
<input type="checkbox" lay-filter="hospital-state" value="{{d.id}}"
|
lay-skin="switch" lay-text="正常|停用" {{d.enabled==1?'checked':''}}/>
|
</script>
|
|
<script>
|
layui.use(['form', 'table', 'laydate', 'util', 'config', 'upload', 'admin', 'autocomplete', 'formSelects'],
|
function () {
|
var form = layui.form;
|
var table = layui.table;
|
var config = layui.config;
|
var layer = layui.layer;
|
var util = layui.util;
|
var admin = layui.admin;
|
var autocomplete = layui.autocomplete;
|
var formSelects = layui.formSelects;
|
var $ = layui.jquery;
|
|
//自动完成-医院名称
|
autocomplete.render({
|
elem: $('#hospitalName-seach')[0],
|
keywordsName: 'hospitalName', //查询关键字名称
|
url: config.base_server + 'api-opration/hospitalscreening/findByName',
|
template_val: '{{d.hospitalName}}', //选择后文本框显示的数据字段
|
template_txt: "<div class='layui-table-cell'>{{d.hospitalName}}</div>", //下拉列表模板
|
onselect: function (resp) {
|
$("#hospitalId").val(resp.id);
|
}
|
});
|
|
// 渲染表格
|
table.render({
|
elem: '#app-table',
|
url: config.base_server + 'api-opration/hospitalscreening',
|
method: 'GET',
|
headers: {
|
'Authorization': 'Bearer ' + config.getToken().access_token
|
},
|
page: true,
|
cols: [
|
[{
|
field: 'id',
|
width: "200",
|
title: '筛查医院ID',
|
fixed: 'left'
|
}, {
|
field: 'hospitalName',
|
width: "200",
|
title: '医院名称',
|
fixed: 'left'
|
}, {
|
field: 'departmentName',
|
width: "120",
|
title: '科室',
|
align: 'center',
|
fixed: 'left'
|
},
|
{
|
field: 'isScreeningPush',
|
width: "100",
|
title: '推送状态',
|
align: 'center',
|
fixed: 'left',
|
templet: '#hospital-push-state'
|
},
|
{
|
field: 'enabled',
|
width: "100",
|
title: '状态',
|
align: 'center',
|
fixed: 'left',
|
templet: '#hospital-state'
|
},
|
{
|
field: 'createTime',
|
width: "150",
|
sort: true,
|
align: 'center',
|
title: '创建时间',
|
templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy/MM/dd HH:mm')}}</div>"
|
},
|
{
|
width: "300",
|
align: 'center',
|
toolbar: '#doctor-table-bar',
|
title: '操作',
|
fixed: 'right'
|
}
|
]
|
],
|
done: function (res, curr, count) {
|
permissionsInput(res, config);
|
}
|
});
|
|
// 修改状态
|
form.on('switch(hospital-push-state)', function (obj) {
|
layer.load(2);
|
admin.req('api-opration/hospitalscreening/updateEnabled', {
|
objId: obj.elem.value,
|
objVal: obj.elem.checked ? 1 : 0,
|
type: 0
|
}, function (data) {
|
layer.closeAll('loading');
|
if (data.code == 0) {
|
layer.msg(data.msg, {
|
icon: 1,
|
time: 2000
|
});
|
} else {
|
layer.msg(data.msg, {
|
icon: 2,
|
time: 2000
|
});
|
$(obj.elem).prop('checked', !obj.elem.checked);
|
form.render('checkbox');
|
}
|
}, 'GET');
|
});
|
|
// 修改状态
|
form.on('switch(hospital-state)', function (obj) {
|
layer.load(2);
|
admin.req('api-opration/hospitalscreening/updateEnabled', {
|
objId: obj.elem.value,
|
objVal: obj.elem.checked ? 1 : 0,
|
type: 1
|
}, function (data) {
|
layer.closeAll('loading');
|
if (data.code == 0) {
|
layer.msg(data.msg, {
|
icon: 1,
|
time: 2000
|
});
|
} else {
|
layer.msg(data.msg, {
|
icon: 2,
|
time: 2000
|
});
|
$(obj.elem).prop('checked', !obj.elem.checked);
|
form.render('checkbox');
|
}
|
}, 'GET');
|
});
|
|
// 搜索按钮点击事件
|
$('#app-btn-search').click(function () {
|
var enabled = $('#enabled').val();
|
var isScreeningPush = $("#isScreeningPush").val();
|
var hospitalName = $('#hospitalName-seach').val();
|
table.reload('app-table', {
|
where: {
|
enabled: enabled,
|
hospitalName: hospitalName,
|
isScreeningPush: isScreeningPush,
|
}
|
});
|
});
|
|
// 添加按钮点击事件
|
$('#screeningHospital-btn-add').click(function () {
|
showEditModel_add("添加");
|
});
|
|
var showEditModel_add = function (title, data) {
|
admin.putTempData('t_screeningHospital', data);
|
admin.popupCenter({
|
title: title,
|
path: 'pages/keaigao/screeningHospital_form.html',
|
area: '600px',
|
offset: '0px',
|
finish: function () {
|
}
|
});
|
};
|
|
// 工具条点击事件
|
table.on('tool(app-table)', function (obj) {
|
var data = obj.data;
|
var layEvent = obj.event;
|
if (layEvent === 'downLoad') {
|
// 下载二维码
|
downLoad(data.hospitalQrImage);
|
} else if (layEvent === 'edit') {
|
showEditModel_add("编辑", data);
|
}else if(layEvent === 'export'){
|
showEditModel_import("导出",data);
|
}
|
});
|
|
function downLoad(url) {
|
window.open(url);
|
}
|
|
var showEditModel_import = function (title, data) {
|
admin.putTempData('t_hospital', data);
|
admin.popupCenter({
|
title: title,
|
path: 'pages/keaigao/exportScreeningHospital.html',
|
area: '500px',
|
offset: '0px',
|
finish: function () {
|
}
|
});
|
};
|
|
});
|
</script>
|