123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
- <%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
- <script>
- /* *************************** 模块初始化 ***************************** */
- var dbInfo = {
- grid: null,
- dialog: null,
- init: function () {
- this.bindEvents();
- this.initForm();
- },
- initForm: function () {
- var me = this;
- $('.m-retrieve-area').show();
- $("#txtName").ligerSearch({
- onClick:function(value){
- me.reloadGrid();
- }});
- var dbInfoStatus = liger.get("valid").value;
- if(dbInfoStatus ==undefined || dbInfoStatus ==null || dbInfoStatus.length<=0){
- liger.get("valid").selectValue("");
- }
- me.grid = $("#div_grid").ligerGrid({
- url: '${contextRoot}/tenant/dataBase/getDBList',
- parms: {
- name: $('#txtName').val(),
- valid:dbInfoStatus
- },
- columns: [
- {display: '实例名称', id: 'id', name: 'name', width: '20%'},
- {display: '主机', name: 'host', width: '15%'},
- {display: '端口', name: 'port', width: '10%'},
- {display: '用户', name: 'usrName', width: '10%'},
- {display: '状态', name: 'valid', width: '10%',align: 'center', render: function (rowdata, rowindex, value) {
- if(rowdata.valid==1 ){
- return ' <div style="vertical-align:middle;margin-top: 10px;"><span>有效 </span></div>';
- }else if(rowdata.valid==0){
- return ' <div style="vertical-align:middle;margin-top: 10px;"><span>无效 </span></div>';
- }
- }},
- {
- display: '操作', name: 'operator', width: '40%', render: function (row) {
- var html = '<div class="m-inline-buttons" style="width:350px;">';
- html += "<a class=\"m-btn\" style=\"padding-right:10px\" onclick=\"dbInfo.editorDialog('"+row.id+"','disabled')\">查看详情</a>";
- html += "<a class=\"m-btn-edit\" onclick=\"dbInfo.editorDialog('"+row.id+"','')\"></a>";
- html += "<a class=\"m-btn-delete\" onclick=\"dbInfo.delete('"+row.id+"')\"></a>";
- html += '</div>';
- return html;
- }
- }
- ],
- onDblClickRow: function (row) {
- me.editorDialog(row.id);
- }
- });
- },
- bindEvents: function () {
- var me = this;
- var flag = false;
- $('#div_new_record').click(function () {
- me.editorDialog();
- });
- $("#valid").ligerComboBox({data : [{"value":"全部","code":""},{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
- cancelable:false,
- initIsTriggerEvent: false,
- onSelected: function (value)
- {
- if (flag) {
- me.reloadGrid();
- } else {
- flag = true;
- }
- },
- onSuccess:function(data){
- }});
- $(".l-text").css("display","inline-block");
- $(".l-text-wrapper").css("display","inline-block");
- },
- delete:function(id){
- var message = "确定要删除该应用信息吗?";
- jQuery.ligerDialog.confirm(message, function (confirm) {
- if (confirm)
- {
- $.ajax({ //ajax处理
- type: "POST",
- url : "${contextRoot}/tenant/dataBase/deleteDBInfo",
- dataType : "json",
- data:{id:id},
- cache:false,
- success :function(data){
- if(data.successFlg) {
- $.ligerDialog.success(data.message);
- dbInfo.grid.reload();
- }
- else{
- $.ligerDialog.error(data.message);
- }
- },
- error :function(data){
- $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
- }
- });
- }
- });
- },
- //刷新列表数据
- reloadGrid: function () {
- this.grid.set({
- parms: {name: $('#txtName').val(),valid:$('#valid_val').val()}
- });
- this.grid.reload();
- },
- //编辑弹窗
- editorDialog: function (id, flag) {
- var me = this;
- var title = "新增数据库实例";
- var params = null;
- if (id != undefined && id != null) {
- title = "编辑数据库实例";
- params = {"id": id, "flag": flag};
- }
- me.dialog = $.ligerDialog.open({
- height: 600,
- width: 500,
- title: title,
- url: '${contextRoot}/tenant/dataBase/editorDbInfo',
- //load: true,
- urlParms: params
- });
- },
- anthorize: function (id) {
- },
- //弹窗返回
- dialogSuccess: function (message) {
- $.ligerDialog.success(message);
- dbInfo.reloadGrid();
- dbInfo.dialog.close();
- }
- };
- $(function () {
- dbInfo.init();
- });
- </script>
|