From f21e26d26a048ea2a39b163fd5e969ef0afc0909 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 14 Aug 2019 16:30:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=81=A5=E5=BA=B7=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E6=98=8E=E7=BB=86=E4=BD=BF=E7=94=A8=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E4=BB=A3=E6=9B=BFpopover?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Views/Admin/Healths.cshtml | 30 ++++++++++++++++++--- Bootstrap.Admin/wwwroot/js/healths.js | 31 ++++++++++++++-------- 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/Bootstrap.Admin/Views/Admin/Healths.cshtml b/Bootstrap.Admin/Views/Admin/Healths.cshtml index 6975c250..817e185b 100644 --- a/Bootstrap.Admin/Views/Admin/Healths.cshtml +++ b/Bootstrap.Admin/Views/Admin/Healths.cshtml @@ -10,8 +10,11 @@ } @@ -26,12 +29,33 @@ } +@section modal { + +}
健康检查结果
耗时:--
-
+
diff --git a/Bootstrap.Admin/wwwroot/js/healths.js b/Bootstrap.Admin/wwwroot/js/healths.js index 08a2c8b9..441fb996 100644 --- a/Bootstrap.Admin/wwwroot/js/healths.js +++ b/Bootstrap.Admin/wwwroot/js/healths.js @@ -9,7 +9,7 @@ return cate[value]; }; - var $table = $('table').smartTable({ + var $table = $('#tbCheck').smartTable({ sidePagination: "client", showToggle: false, showRefresh: false, @@ -22,21 +22,18 @@ { title: "检查结果", field: "Status", formatter: StatusFormatter }, { title: "明细数据", field: "Data", formatter: function (value, row, index) { - return '明细'; + return ''; }, events: { 'click .detail': function (e, value, row, index) { if ($.isEmptyObject(row.Data)) return; - var $button = $(e.currentTarget); - if (!$button.data($.fn.popover.Constructor.DATA_KEY)) { - var content = $.map(row.Data, function (v, name) { - return $.format("{0}{1}", name, v); - }).join(""); - content = $.format('
{0}
检查项
检查值
', content); - $button.popover({ title: cate[row.Name], html: true, content: content, placement: $(window).width() < 768 ? "bottom" : "left" }); - } - $button.popover('show'); + var content = $.map(row.Data, function (v, name) { + return { name: name, value: v }; + }); + // 弹出 modal 健康检查明细窗口 + $checkDetail.bootstrapTable('load', content); + $('#dialogNew').modal('show'); } } } @@ -57,4 +54,16 @@ $.footer(); } }); + + // init detail Table + var $checkDetail = $('#checkDetail').smartTable({ + sidePagination: "client", + showToggle: false, + showRefresh: false, + showColumns: false, + columns: [ + { title: "检查项", field: "name" }, + { title: "值", field: "value" } + ] + }); }); \ No newline at end of file