123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- /**
- * 角色管理的单例
- */
- var Hospital = {
- id: "hospitalTable", //表格id
- seItem: null, //选中的条目
- table: null,
- layerIndex: -1
- };
- /**
- * 初始化表格的列
- */
- Hospital.initColumn = function () {
- var columns = [
- {field: 'selectItem', radio: true},
- {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
- {title: '医院名称', field: 'name', align: 'center', valign: 'middle', sortable: true,
- formatter: function (value, row) {
- if (row.isGeneral == 1) {
- return value + "<span style='color:#4781f0;'>(总院)</span>";
- }
- return value;
- }
- },
- {title: '医共体', field: 'medicalCommunityName', align: 'center', valign: 'middle', sortable: true},
- {title: '备注', field: 'description', align: 'center', valign: 'middle', sortable: true},
- {title: '排序', field: 'num', align: 'center', valign: 'middle', sortable: true},
- {title: '状态', field: 'status', align: 'center', valign: 'middle', sortable: true,
- formatter: function (value) {
- if (value == 1) {
- return "正常";
- }
- return "停用";
- }
- }
- ]
- return columns;
- };
- /**
- * 检查是否选中
- */
- Hospital.check = function () {
- var selected = $('#' + this.id).bootstrapTable('getSelections');
- if (selected.length == 0) {
- Feng.info("请先选中表格中的某一记录!");
- return false;
- } else {
- Hospital.seItem = selected[0];
- return true;
- }
- };
- /**
- * 点击添加菜单
- */
- Hospital.openAddHospital = function () {
- var index = layer.open({
- type: 2,
- title: '添加医院',
- area: ['830px', '450px'], //宽高
- fix: false, //不固定
- maxmin: true,
- content: Feng.ctxPath + '/admin/nhc.hospital/add'
- });
- this.layerIndex = index;
- };
- /**
- * 点击修改
- */
- Hospital.openChangeHospital = function () {
- if (this.check()) {
- var index = layer.open({
- type: 2,
- title: '修改医院',
- area: ['800px', '450px'], //宽高
- fix: false, //不固定
- maxmin: true,
- content: Feng.ctxPath + '/admin/nhc.hospital/edit/id/' + this.seItem.id
- });
- this.layerIndex = index;
- }
- };
- /**
- * 设为总院
- */
- Hospital.setGeneral = function () {
- if (this.check()) {
- var operation = function () {
- var ajax = new $ax(Feng.ctxPath + "/admin/nhc.hospital/setGeneral", function (data) {
- if (data.code == 200) {
- Feng.success(data.msg);
- $('#hospitalTable').bootstrapTable('refresh');
- } else {
- Feng.error(data.msg);
- }
- }, function (data) {
- Feng.error("设置失败!" + data.responseJSON.message + "!");
- });
- ajax.set("id", Hospital.seItem.id);
- ajax.start();
- };
- Feng.confirm("是否设置该医院为其所在医共体的总院?", operation);
- }
- }
- /**
- * 删除
- */
- Hospital.delHospital = function () {
- if (this.check()) {
- var operation = function () {
- var ajax = new $ax(Feng.ctxPath + "/admin/nhc.hospital/delete", function (data) {
- Feng.success("删除成功!");
- $('#hospitalTable').bootstrapTable('refresh');
- }, function (data) {
- Feng.error("删除失败!" + data.responseJSON.message + "!");
- });
- ajax.set("id", Hospital.seItem.id);
- ajax.start();
- };
- Feng.confirm("是否刪除该医院?", operation);
- }
- };
- /**
- * 搜索
- */
- Hospital.search = function () {
- var queryData = {};
- queryData['communityId'] = $("#communityId").val();
- queryData['name'] = $("#name").val();
- $('#hospitalTable').bootstrapTable('refresh', {query: queryData});
- }
- /**
- * 重置
- */
- Hospital.reset = function () {
- $("#name").val("");
- $("#communityId").val("");
- }
- $(function () {
- Hospital.table = $('#hospitalTable').bootstrapTable({
- url: "/admin/nhc.hospital/list",
- method: 'POST',
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
- search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
- showRefresh: false, // 是否显示刷新按钮
- clickToSelect: true, // 是否启用点击选中行
- singleSelect: false, // 设置True 将禁止多选
- striped: true, // 是否显示行间隔色
- pagination: false, // 设置为 true 会在表格底部显示分页条
- paginationHAlign: "left",
- paginationDetailHAlign: "right",
- sidePagination: "client", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
- pageNumber: 1, //初始化加载第一页,默认第一页
- pageSize: 10, //每页的记录行数(*)
- pageList: [10, 25, 50, 100, 500, 1000, 1500], //可供选择的每页的行数(*)
- maintainSelected: true, //全表全选需要开启
- showColumns: false,
- columns: Hospital.initColumn(),
- onDblClickRow: function () {
- Hospital.openChangeHospital();
- }
- });
- });
|