|
@ -0,0 +1,196 @@
|
|
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
|
|
|
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
|
|
|
<script>
|
|
|
(function ($, win) {
|
|
|
$(function () {
|
|
|
/* ************************** 变量定义 ******************************** */
|
|
|
// 通用工具类库
|
|
|
var Util = $.Util;
|
|
|
var retrieve = null;
|
|
|
var master = null;
|
|
|
var isFirstPage = false;
|
|
|
|
|
|
/* *************************** 函数定义 ******************************* */
|
|
|
function pageInit() {
|
|
|
retrieve.init();
|
|
|
master.init();
|
|
|
}
|
|
|
|
|
|
function reloadGrid(params) {
|
|
|
if (isFirstPage) {
|
|
|
this.grid.options.newPage = 1;
|
|
|
}
|
|
|
this.grid.setOptions({parms: params});
|
|
|
this.grid.loadData(true);
|
|
|
}
|
|
|
|
|
|
/* *************************** 模块初始化 ***************************** */
|
|
|
|
|
|
retrieve = {
|
|
|
$element: $('.m-retrieve-area'),
|
|
|
$searchBtn: $('#btn_search'),
|
|
|
$addBtn: $('#btn_add'),
|
|
|
$name: $("#inp_name"),//人员姓名
|
|
|
$code: $("#inp_code"),//人员姓名
|
|
|
$mobile: $("#inp_mobile"),
|
|
|
init: function () {
|
|
|
this.$element.show();
|
|
|
this.$element.attrScan();
|
|
|
window.form = this.$element;
|
|
|
this.$name.ligerTextBox({width: 200}); //姓名
|
|
|
this.$code.ligerTextBox({width: 200}); //姓名
|
|
|
this.$mobile.ligerTextBox({width: 200})//手机号
|
|
|
this.bindEvents();
|
|
|
},
|
|
|
bindEvents: function () {
|
|
|
var self = this;
|
|
|
self.$searchBtn.click(function () {
|
|
|
master.grid.options.newPage = 1;
|
|
|
master.reloadGrid();
|
|
|
});
|
|
|
self.$addBtn.click(function () {
|
|
|
$.publish("info:create", [''])
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
master = {
|
|
|
infoDialog: null,
|
|
|
grid: null,
|
|
|
init: function () {
|
|
|
var data;
|
|
|
this.grid = $("#div_user_list").ligerGrid($.LigerGridEx.config({
|
|
|
url: ctx + 'userRoleList',
|
|
|
parms: {},
|
|
|
ajaxHeader: ajaxHeaderName,
|
|
|
ajaxHeaderValue: ajaxHeaderValue,
|
|
|
columns: [
|
|
|
{display: 'ID', name: 'id', hide: true},
|
|
|
{display: '医生编码', name: 'code', width: '20%', align: "center"},
|
|
|
{display: '医生姓名', name: 'name', width: '8%', align: "center"},
|
|
|
{
|
|
|
display: '性别', name: 'sex', width: '5%', align: "center",
|
|
|
render: function (item) {
|
|
|
if (!item.sex | item.sex == 0) return "未知";
|
|
|
if (parseInt(item.sex) == 1) return '男';
|
|
|
if (parseInt(item.sex) == 2) return '女';
|
|
|
return '未知';
|
|
|
}
|
|
|
},
|
|
|
{display: '身份证号', name: 'idCard', width: '12%', align: "center"},
|
|
|
{display: '手机号码', name: 'mobile', width: '10%', align: "center"},
|
|
|
{display: '机构编码', name: 'hospital', width: '10%', align: "center"},
|
|
|
{display: '所属机构', name: 'hospitalName', width: '20%', align: "left"},
|
|
|
{
|
|
|
display: '操作', name: 'operator', width: '15%', align: "center", isSort: false,
|
|
|
render: function (row) {
|
|
|
var html = '';
|
|
|
html += '<a href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "info:view", row.code) + '">查看</a>';
|
|
|
<sec:authorize url="/admin/range/update">
|
|
|
if (!Util.isStrEquals(row.code, "admin")) {
|
|
|
html += '<a style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "info:edit", row.code) + '">编辑</a>';
|
|
|
}
|
|
|
</sec:authorize>
|
|
|
<sec:authorize url="/admin/range/delete">
|
|
|
if (!Util.isStrEquals(row.code, "admin")) {
|
|
|
html += '<a style="margin-left:10px;" title="删除" href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}','{2}'])", "info:del", row.code) + '">删除</a>';
|
|
|
}
|
|
|
</sec:authorize>
|
|
|
return html;
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
|
|
|
}));
|
|
|
// 自适应宽度
|
|
|
this.grid.adjustToWidth();
|
|
|
this.bindEvents();
|
|
|
},
|
|
|
reloadGrid: function (msg) {
|
|
|
if (msg) {
|
|
|
//如果是新增,直接刷新页面
|
|
|
master.grid.loadData();
|
|
|
} else {
|
|
|
//如果是查询
|
|
|
retrieve.$element.attrScan();
|
|
|
var values = retrieve.$element.Fields.getValues();
|
|
|
reloadGrid.call(this, values);
|
|
|
}
|
|
|
},
|
|
|
delRecord: function (id, code) {
|
|
|
var self = this;
|
|
|
$.ajax({
|
|
|
url: ctx + "/admin/range/delete",
|
|
|
data: {"id": id},
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
|
success: function (result) {
|
|
|
if (result.status == '200') {
|
|
|
window.reloadMasterGrid(result.msg);
|
|
|
} else {
|
|
|
$.Notice.error(result.msg);
|
|
|
}
|
|
|
},
|
|
|
error: function (data) {
|
|
|
$.Notice.error("系统异常,请联系管理员!");
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
bindEvents: function () {
|
|
|
var self = this;
|
|
|
$.subscribe('info:view', function (event, id) {
|
|
|
var title = '查看用户信息';
|
|
|
self.infoDialog = $.ligerDialog.open({
|
|
|
|
|
|
height: 460,
|
|
|
width: 490,
|
|
|
urlParms: {"id": id, "mode": "view"},
|
|
|
title: title,
|
|
|
url: ctx + '/admin/range/editInit'
|
|
|
})
|
|
|
});
|
|
|
$.subscribe('info:edit', function (event, id) {
|
|
|
var title = '编辑用户信息';
|
|
|
self.infoDialog = $.ligerDialog.open({
|
|
|
height: 460,
|
|
|
width: 490,
|
|
|
urlParms: {"id": id, "mode": "edit"},
|
|
|
title: title,
|
|
|
url: ctx + '/admin/range/editInit'
|
|
|
})
|
|
|
});
|
|
|
$.subscribe('info:create', function (event, id) {
|
|
|
var title = '新增用户';
|
|
|
self.infoDialog = $.ligerDialog.open({
|
|
|
height: 600,
|
|
|
width: 850,
|
|
|
urlParms: {"id": id, "mode": "new"},
|
|
|
title: title,
|
|
|
url: ctx + '/admin/range/infoInit'
|
|
|
})
|
|
|
});
|
|
|
|
|
|
$.subscribe('info:del', function (event, id, code) {
|
|
|
$.ligerDialog.confirm('确认删除该行信息?<br>如果是请点击确认按钮,否则请点击取消。', function (yes) {
|
|
|
if (yes) {
|
|
|
self.delRecord(id, code);
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/* ************************* Dialog页面回调接口 ************************** */
|
|
|
win.reloadMasterGrid = function (msg) {
|
|
|
if (isNoEmpty(msg)) {
|
|
|
$.Notice.success(msg);
|
|
|
}
|
|
|
master.reloadGrid(msg);
|
|
|
};
|
|
|
win.closeUserInfoDialog = function () {
|
|
|
master.infoDialog.close();
|
|
|
};
|
|
|
/* *************************** 页面初始化 **************************** */
|
|
|
pageInit();
|
|
|
});
|
|
|
})(jQuery, window);
|
|
|
</script>
|