Parcourir la source

数据管理页面

wujunjie il y a 7 ans
Parent
commit
12e5b5222d

+ 43 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/range/user_role_add.jsp

@ -0,0 +1,43 @@
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<%@ include file="../../head/page_head.jsp" %>
	<title>新增数据范围</title>
</head>
<body>
<div id="div_wrapper">
	<!-- 检索条件 -->
	<div class="m-retrieve-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
		<div class="m-form-group f-mt10">
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_name" placeholder="请输入医生姓名" class="f-ml10" data-attr-scan="name"/>
			</div>
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_mobile" placeholder="请输入身份证号" class="f-ml10" data-attr-scan="mobile"/>
			</div>
			<sec:authorize url="/admin/range/doctorList">
			<div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
				<span>查add询</span>
			</div>
			</sec:authorize>
			<!-- 保存按钮 -->
			<sec:authorize url="/admin/range/create">
				<div class="m-form-control m-form-control-fr">
					<div id="btn_add" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam" style="margin-right: 20px;">
						<span>新增</span>
					</div>
				</div>
			</sec:authorize>
		</div>
	</div>
	<!-- 列表 -->
	<div id="div_user_list">
	</div>
</div>
</body>
<%@ include file="../../head/page_foot.jsp" %>
<%@ include file="user_role_add_js.jsp" %>
</html>

+ 137 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/range/user_role_add_js.jsp

@ -0,0 +1,137 @@
<%@ 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 + 'doctorList',
                        parms: {},
                        ajaxHeader: ajaxHeaderName,
                        ajaxHeaderValue: ajaxHeaderValue,
                        columns: [
                            {display: 'ID', name: 'id', hide: true},
                            {display: '医生编码', name: 'code', width: '30%', 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: '17%', align: "center"},
                            {display: '手机号码', name: 'mobile', width: '10%', align: "center"},
                            {display: '机构编码', name: 'hospital', width: '10%', align: "center"},
                            {display: '所属机构', name: 'hospitalName', width: '20%', align: "left"},
                        ],
                        checkbox: true,
                    }));
                    // 自适应宽度
                    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);
                    }
                },
                bindEvents: function () {
                    var self = this;
                    $.subscribe('info:create', function (event, id) {
                        var title = '新增用户';
                        var rows = master.grid.getSelectedRows();
                        var codes = new Array()
                        for (var i=0;i<rows.length;i++){
                            codes.push(rows[i].code)
                        }
                        self.infoDialog = $.ligerDialog.open({
                            height: 600,
                            width: 850,
                            urlParms: {"doc": codes.toString(), "mode": "new"},
                            title: title,
                            url: ctx + '/admin/range/create'
                        })
                    });
                }
            };
            /* ************************* Dialog页面回调接口 ************************** */
            win.reloadMasterGrid = function (msg) {
                if (isNoEmpty(msg)) {
                    $.Notice.success(msg);
                }
                master.reloadGrid(msg);
            };
            win.closeUserInfoDialog = function () {
                master.infoDialog.close();
            };
            /* *************************** 页面初始化 **************************** */
            pageInit();
        });
    })(jQuery, window);
</script>

+ 42 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/range/user_role_list.jsp

@ -0,0 +1,42 @@
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<%@ include file="../../head/page_head.jsp" %>
	<title>数据范围管理</title>
</head>
<body>
<div id="div_wrapper">
	<!-- 检索条件 -->
	<div class="m-retrieve-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
		<div class="m-form-group f-mt10">
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_name" placeholder="请输入医生姓名" class="f-ml10" data-attr-scan="name"/>
			</div>
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_mobile" placeholder="请输入身份证号" class="f-ml10" data-attr-scan="mobile"/>
			</div>
			<sec:authorize url="/admin/range/userRoleList">
			<div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
				<span>查list询</span>
			</div>
			</sec:authorize>
			<sec:authorize url="/admin/range/infoInit">
			<div class="m-form-control m-form-control-fr">
				<div id="btn_add" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam" style="margin-right: 20px;">
					<span>新增</span>
				</div>
			</div>
			</sec:authorize>
		</div>
	</div>
	<!-- 列表 -->
	<div id="div_user_list">
	</div>
</div>
</body>
<%@ include file="../../head/page_foot.jsp" %>
<%@ include file="user_role_list_js.jsp" %>
</html>

+ 196 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/range/user_role_list_js.jsp

@ -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>

+ 63 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/range/user_role_modify.jsp

@ -0,0 +1,63 @@
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<html>
<head>
	<%@ include file="../../head/page_head.jsp"%>
	<title>医生详情</title>
	<style type="text/css">
		.m-form-group label.label_title{width: 100px}
	</style>
</head>
<body>
<div id="div_patient_info_form" data-role-form class="m-form-inline f-mt20 f-ml30" data-role-form>
	<input type="hidden" id="inp_id" value='${id}' data-attr-scan="id"/>
	<input type="hidden" id="inp_mode" value='${mode}'/>
	<div class="m-form-group" style="padding:10 0 10 0">
		<label class="label_title" style="width:120px">医生编modify码</label>
		<div class="l-text-wrapper m-form-control essential">
			<input type="text"  id="inp_code" class="required useTitle ajax f-w240 validate-special-char"  required-title="编码不能为空"  data-attr-scan="code"/>
		</div>
	</div>
	<div class="m-form-group">
		<label class="label_title" style="width:120px">医生姓名</label>
		<div class="l-text-wrapper m-form-control essential">
			<input type="text"  id="inp_name" class="required useTitle f-w240 validate-special-char"  required-title="姓名不能为空"  data-attr-scan="name"/>
		</div>
		<div class="m-form-group">
			<label class="label_title" style="width:120px">身份证号</label>
			<div class="l-text-wrapper m-form-control essential">
				<input type="text"  id="inp_phone" class="required useTitle f-w240 validate-special-char" required-title="号码不能为空"  data-attr-scan="phone"/>
			</div>
		</div>
	</div>
	<div class="m-form-group">
		<label class="label_title" style="width:120px">手机号码</label>
		<div class="l-text-wrapper m-form-control essential">
			<input type="text"  id="inp_mobile" class="required useTitle ajax validate-mobile-phone f-w240 validate-special-char" required-title="手机号码不能为空"  required-title="请输入手机号码"  data-attr-scan="mobile"/>
		</div>
	</div>
	<div class="m-form-group">
		<label class="label_title" style="width:120px">机构编码</label>
		<div class="l-text-wrapper m-form-control essential">
			<input type="text"  id="inp_type" class="required useTitle f-w240 validate-special-char" required-title="用户类型不能为空"  data-attr-scan="type"/>
		</div>
	</div>
	<div class="m-form-group" id="new_psw_div" style="display: none">
		<label class="label_title" style="width:120px">所属机构</label>
		<div class="l-text-wrapper m-form-control essential">
			<input type="password"  id="inp_psw" class="required useTitle f-w240 validate-special-char" required-title="登陆密码不能为空"  data-attr-scan="password"/>
		</div>
	</div>
	</div>
	<div class="m-form-group f-pa" id="btn_save_close"  style="right: 10px;bottom: 0;display: none">
		<div class="m-form-control">
			<input type="button" value="保存" id="btn_save" class="l-button u-btn u-btn-primary u-btn-large f-ib f-vam" />
			<div id="btn_cancel" class="l-button u-btn u-btn-cancel u-btn-large f-ib f-vam" >
				<span>关闭</span>
			</div>
		</div>
	</div>
</div>
</body>
<%@ include file="../../head/page_foot.jsp"%>
<%@ include file="user_role_modify_js.jsp" %>
</html>

+ 221 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/range/user_role_modify_js.jsp

@ -0,0 +1,221 @@
<%@ 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 type = $('#inp_mode').val();
			var id = $('#inp_id').val();
			var info = "";
			var oldCode = "";
			var oldMobile = "";
			var jValidation = $.jValidation;
			function pageInit() {
				info.init();
				info.initForm();
			}
			info = {
				//变量
				$form: $("#div_patient_info_form"),
				$code: $('#inp_code'),
				$name: $('#inp_name'),
				$mobile: $('#inp_mobile'),
				$type: $("#inp_type"),
                $jobNo:$("#inp_jobNo"),
                $seat:$("#inp_seat"),
                $phone:$("#inp_phone"),
				//$roles:$("#inp_roles"),
				$organization: $("#inp_organizationId"),
				init: function () {
					this.$form.attrScan();
					this.$code.ligerTextBox({width: 240});
					this.$name.ligerTextBox({width: 240});
					this.$mobile.ligerTextBox({width: 240});
					this.typeBox = this.$type.ligerComboBox({
						width: 240,
						data: [
							{text: '管理员', typeId: '1'},
							{text: '医生', typeId: '2'},
                            {text: '客服管理员', typeId: '3'},
                            {text: '普通客服', typeId: '4'},
							{text: '其他', typeId: '0'}
						],
						initIsTriggerEvent: false,
						valueField: 'typeId',
					});
                    this.$jobNo.ligerTextBox({width: 240});
                    this.$seat.ligerTextBox({width: 240});
                    this.$phone.ligerTextBox({width: 240});
				},
				initForm: function () {
					_this = this;
                    this.bindEvents();
					//修改、查看
					if (isNoEmpty(id) && id != 0) {
						$.ajax({
							url: ctx + "/admin/range/userRoleDetail",
							method: "post",
							dataType: "json",
							async: false,
							data: {id:id},
							success: function (result) {
								if (result.status == '200') {
									//通过id查信息
									var data = result.data;
									if (!data) {
										return
									}
									oldCode = data.code;
									oldMobile = data.mobile;
									_this.$form.Fields.fillValues({
										code: data.code,
										name: data.name,
										mobile: data.mobile,
                                        jobNo:data.jobNo,
                                        seat:data.seat,
                                        phone:data.phone
									});
									_this.typeBox.selectValue(data.type);
								} else {
									$.Notice.error(result.msg);
								}
							},
							error: function (data) {
								$.Notice.error("系统异常,请联系管理员!");
							}
						});
					}
					if (type == "view") {
						_this.$form.addClass("m-form-readonly"); //表单只读
						$(".essential").addClass("XXXtest");
						$(".essential").removeClass("essential");
						$("#btn_save_close").css("display", "none");
					} else {
						this.$form.removeClass("m-form-readonly");
						$(".XXXtest").addClass("essential");
						$("#btn_save_close").css("display", "block");
                        if(type == "edit"){
                            $("#new_psw_div").css("display", "block");
                            $("#old_psw_div").css("display", "block");
                        }
					}
					this.$form.show();
				},
				//绑定事件
				bindEvents: function () {
					var validator = new jValidation.Validation(this.$form, {
						immediate: true, onSubmit: false,
						onElementValidateForAjax: function (elm) {
							if (Util.isStrEquals($(elm).attr("id"), 'inp_mobile')) {
								var result = new jValidation.ajax.Result();
								var newMobile = $('#inp_mobile').val();
								if (newMobile != null && oldMobile != '' && oldMobile == newMobile) {
									return true;
								}
								if (newMobile != oldMobile) {
									$.ajax({
										url: ctx + "/admin/user/isMobileExist",
										async: false,
										method: "post",
										dataType: "json",
										data: {"mobile": newMobile},
										success: function (data) {
											if (data == true) {
												result.setResult(false);
												result.setErrorMsg("手机号已注册过");
											} else {
												result.setResult(true);
											}
										}
									});
								}
								return result;
							}
							;
							if (Util.isStrEquals($(elm).attr("id"), 'inp_code')) {
								var result = new jValidation.ajax.Result();
								var newCode = $('#inp_code').val();
								if (newCode != null && oldCode != '' && oldCode == newCode) {
									return true;
								}
								if (newCode != oldCode) {
									$.ajax({
										url: ctx + "/admin/user/isCodeExist",
										async: false,
										method: "post",
										dataType: "json",
										data: {"code": newCode},
										success: function (data) {
											if (data == true) {
												result.setResult(false);
												result.setErrorMsg("用户编码已存在");
											} else {
												result.setResult(true);
											}
										}
									});
								}
								return result;
							}
						}
					});
					var self = this;
					$("#btn_save").click(function () {
                        var values = self.$form.Fields.getValues();
                        if (!validator.validate()) {
                            return;
                        }
                        values.type = self.typeBox.getValue();
                        update(values);
                    });
                    $("#inp_type").change(function () {
                        var val = self.typeBox.getValue();
                        if(val==3||val==4){
                            $("#customer").show();
                        }else{
                            $("#customer").hide();
                        }
                        debugger
                    });
					function update(values) {
						var dataModel = $.DataModel.init();
						var url = "update";
						if (values.id == 0) {
							url = "create";
						}
						$.ajax({
							url: ctx + "/admin/user/" + url,
							async: false,
							method: "post",
							dataType: "json",
							data: {jsonData: JSON.stringify(values)},
							success: function (data) {
								if (data.status == 200) {
									parent.window.reloadMasterGrid(data.msg);
									parent.window.closeUserInfoDialog();
								} else {
									$.Notice.error(data.msg);
								}
							}
						});
					}
					$("#btn_cancel").click(function () {
						parent.window.closeUserInfoDialog();
					});
				}
			}
			pageInit();
		});
	})(jQuery, window)
</script>