Skip to content

Commit

Permalink
结构查询 查询文本高亮显示
Browse files Browse the repository at this point in the history
  • Loading branch information
toolgood committed Nov 7, 2021
1 parent 97d07c6 commit 1d487e9
Show file tree
Hide file tree
Showing 3 changed files with 215 additions and 43 deletions.
85 changes: 71 additions & 14 deletions Source/ToolGood.SqlOnline/Pages/Developments/TableInfo.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<link href="/_/layui/css/layui.css" rel="stylesheet" />
<style>
html { background: #F4F4F4; overflow-x: hidden; }
.notext { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
</style>
</head>
<body>
Expand All @@ -39,25 +40,28 @@
{{ for (var i=0;i<it.length;i++){ }}
{{ var t=it[i]; }}
<li class="i {{= t.t }} " id="{{= t.n }}" data-commont="{{= (t.c!=undefined?t.c:"") }}" data-tname="{{= t.n }}">
<span style="width:100%" class="table">
<i class="layui-icon orange table hidden">&#xe658;</i> {{= t.n }}
<i class="i">【{{= (t.c!=undefined?t.c:"") }}】</i>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<span style="width:100%;font-weight:600" class="table">
<i class="layui-icon orange table hidden">&#xe658;</i>
<a href='javascript:;' class="name">{{= t.n }}</a>
<i class="i commont">【{{= (t.c!=undefined?t.c:"") }}】</i>
<span class=notext>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>
</span>
<ul>
{{ for (var j=0;j<t.items.length;j++){ }}
{{ var c=t.items[j]; }}
<li class="i field {{= c.k }}" data-commont="{{= (c.c!=undefined?c.c:"") }}" data-name="{{= c.n }}">
<span style="width:100%">
<i class="layui-icon orange hidden">&#xe658;</i><a href="javascript:;" class="copy" tabindex="-1" data-clipboard-text="{{= c.n}}">{{= c.n}}</a>
<i class="layui-icon orange hidden">&#xe658;</i><a href="javascript:;" class="copy name" tabindex="-1" data-clipboard-text="{{= c.n}}">{{= c.n}}</a>
<i>{{= c.t}}{{= (c.nu!=undefined?c.nu:"")}}</i>
{{ if(c.v!=undefined){ }}<i class="ii">[{{= c.v }}]</i>{{ } }}
<i class="i">{{= (c.c!=undefined?c.c:"") }}</i>
<i class="i commont">{{= (c.c!=undefined?c.c:"") }}</i>
</span>
</li>
{{ } }}
Expand Down Expand Up @@ -174,21 +178,74 @@
$('.ReturnContent ul li ul li').css("display", "");
$(".ReturnContent > ul > li").each(function (obj) {
var $this = $(this);
if ($(this).attr("data-commont").toLocaleLowerCase().indexOf($text) >= 0 || $(this).attr("data-tname").toLocaleLowerCase().indexOf($text) >= 0) {
var find = false;
var name = $(this).attr("data-tname");
start = name.toLocaleLowerCase().indexOf($text);
if (start >= 0) {
html = name.substr(0, start) + "<span style='color:red;padding:0;'>" + name.substr(start, $text.length) + "</span>" + name.substr(start + $text.length);
$(this).find(".table a.name").html(html);
find = true;
} else if ($(this).find(".table a.name").html().indexOf('</span>') >= 0) {
$(this).find(".table a.name").html(name);
}
name = $(this).attr("data-commont");
start = name.toLocaleLowerCase().indexOf($text);
if (start >= 0) {
var start = $(this).attr("data-commont").toLocaleLowerCase().indexOf($text);
html = "" + name.substr(0, start - 1) + "<span style='color:red;padding:0;'>" + name.substr(start, $text.length) + "</span>" + name.substr(start + $text.length) + "";
$(this).find(".table i.commont").html(html)
find = true;
} else if ($(this).find("i.commont").html().indexOf('</span>') >= 0) {
$(this).find("i.commont").html(name);
}
if (find == true) {
$(this).show();
$(this).find("li").each(function () {
if ($(this).find("a.name").html().indexOf('</span>') >= 0) {
$(this).find("a.name").html($(this).attr("data-name"));
}
if ($(this).find("i.commont").html().indexOf('</span>') >= 0) {
$(this).find("i.commont").html($(this).attr("data-commont"));
}
})
} else {
$(this).find("li").each(function () {
if ($(this).attr("data-commont").toLocaleLowerCase().indexOf($text) >= 0 || $(this).attr("data-name").toLocaleLowerCase().indexOf($text) >= 0) {
var find2 = false;
name = $(this).attr("data-name");
start = name.toLocaleLowerCase().indexOf($text);
if (start >= 0) {
html = name.substr(0, start) + "<span style='color:red;padding:0;'>" + name.substr(start, $text.length) + "</span>" + name.substr(start + $text.length);
$(this).find("a.name").html(html);
$this.show();
$(this).parent().show();
$(this).show();
} else {
find2 = true;
} else if ($(this).find("a.name").html().indexOf('</span>') >= 0) {
$(this).find("a.name").html($(this).attr("data-name"));
}
name = $(this).attr("data-commont");
start = name.toLocaleLowerCase().indexOf($text);
if (start >= 0) {
html = name.substr(0, start) + "<span style='color:red;padding:0;'>" + name.substr(start, $text.length) + "</span>" + name.substr(start + $text.length);
$(this).find("i.commont").html(html)
$this.show();
$(this).parent().show();
$(this).show();
find2 = true;
} else if ($(this).find("i.commont").html().indexOf('</span>') >= 0) {
$(this).find("i.commont").html($(this).attr("data-commont"));
}
if (find2 == false) {
$(this).hide();
}
})
}
})
})
$('.main').on({
mouseenter: function () {
var inner = "<a href='javascript:;' tabindex='-1' class='tryLock' onclick='lockThis(this);'>锁定</a>";
Expand Down
86 changes: 72 additions & 14 deletions Source/ToolGood.SqlOnline/Pages/Sqls/TableInfo.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<link href="/_/layui/css/layui.css" rel="stylesheet" />
<style>
html { background: #F4F4F4; overflow-x:hidden; }
.notext { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
</style>
</head>
<body>
Expand Down Expand Up @@ -40,26 +41,30 @@
{{ for (var i=0;i<it.length;i++){ }}
{{ var t=it[i]; }}
<li class="i {{= t.t }} " id="{{= t.n.replace('.','_') }}" data-commont="{{= (t.c!=undefined?t.c:"") }}" data-tname="{{= t.n }}">
<span style="width:100%" class="table">
<i class="layui-icon orange table hidden">&#xe658;</i> {{= t.n }}
<span style="width:100%;font-weight:600" class="table">
<i class="layui-icon orange table hidden">&#xe658;</i>
<a href='javascript:;' class="name">{{= t.n }}</a>
<a href='javascript:;' class='insertColumn' tabindex="-1" data-clipboard-text="{{= t.n}}" style="display:none" onclick='insertColumn(this); return false;'>插入</a>
<i class="i">【{{= (t.c!=undefined?t.c:"") }}】</i>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<i class="i commont">【{{= (t.c!=undefined?t.c:"") }}】</i>
<span class=notext>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>
</span>
<ul>
{{ for (var j=0;j<t.items.length;j++){ }}
{{ var c=t.items[j]; }}
<li class="i field {{= c.k }}" data-commont="{{= (c.c!=undefined?c.c:"") }}" data-name="{{= c.n }}">
<span style="width:100%">
<i class="layui-icon orange hidden">&#xe658;</i><a href="javascript:;" class="copy" tabindex="-1" onclick="insertColumn(this)" data-clipboard-text="{{= c.n}}">{{= c.n}}</a>
<i class="layui-icon orange hidden">&#xe658;</i>
<a href="javascript:;" class="copy name" tabindex="-1" onclick="insertColumn(this)" data-clipboard-text="{{= c.n}}">{{= c.n}}</a>
<i>{{= c.t}}{{= (c.nu!=undefined?c.nu:"")}}</i>
{{ if(c.v!=undefined){ }}<i class="ii">[{{= c.v }}]</i>{{ } }}
<i class="i">{{= (c.c!=undefined?c.c:"") }}</i>
<i class="i commont">{{= (c.c!=undefined?c.c:"") }}</i>
</span>
</li>
{{ } }}
Expand Down Expand Up @@ -194,21 +199,74 @@
$('.ReturnContent ul li ul li').css("display", "");
$(".ReturnContent > ul > li").each(function (obj) {
var $this = $(this);
if ($(this).attr("data-commont").toLocaleLowerCase().indexOf($text) >= 0 || $(this).attr("data-tname").toLocaleLowerCase().indexOf($text) >= 0) {
var find = false;
var name = $(this).attr("data-tname");
start = name.toLocaleLowerCase().indexOf($text);
if (start >= 0) {
html = name.substr(0, start) + "<span style='color:red;padding:0;'>" + name.substr(start, $text.length) + "</span>" + name.substr(start + $text.length);
$(this).find(".table a.name").html(html);
find = true;
} else if ($(this).find(".table a.name").html().indexOf('</span>') >= 0) {
$(this).find(".table a.name").html(name);
}
name = $(this).attr("data-commont");
start = name.toLocaleLowerCase().indexOf($text);
if (start >= 0) {
var start = $(this).attr("data-commont").toLocaleLowerCase().indexOf($text);
html = "" + name.substr(0, start - 1) + "<span style='color:red;padding:0;'>" + name.substr(start, $text.length) + "</span>" + name.substr(start + $text.length) + "";
$(this).find(".table i.commont").html(html)
find = true;
} else if ($(this).find("i.commont").html().indexOf('</span>') >= 0) {
$(this).find("i.commont").html(name);
}
if (find == true) {
$(this).show();
$(this).find("li").each(function () {
if ($(this).find("a.name").html().indexOf('</span>') >= 0) {
$(this).find("a.name").html($(this).attr("data-name"));
}
if ($(this).find("i.commont").html().indexOf('</span>') >= 0) {
$(this).find("i.commont").html($(this).attr("data-commont"));
}
})
} else {
$(this).find("li").each(function () {
if ($(this).attr("data-commont").toLocaleLowerCase().indexOf($text) >= 0 || $(this).attr("data-name").toLocaleLowerCase().indexOf($text) >= 0) {
var find2 = false;
name = $(this).attr("data-name");
start = name.toLocaleLowerCase().indexOf($text);
if (start >= 0) {
html = name.substr(0, start) + "<span style='color:red;padding:0;'>" + name.substr(start, $text.length) + "</span>" + name.substr(start + $text.length);
$(this).find("a.name").html(html);
$this.show();
$(this).parent().show();
$(this).show();
} else {
find2 = true;
} else if ($(this).find("a.name").html().indexOf('</span>') >= 0) {
$(this).find("a.name").html($(this).attr("data-name"));
}
name = $(this).attr("data-commont");
start = name.toLocaleLowerCase().indexOf($text);
if (start >= 0) {
html = name.substr(0, start) + "<span style='color:red;padding:0;'>" + name.substr(start, $text.length) + "</span>" + name.substr(start + $text.length);
$(this).find("i.commont").html(html)
$this.show();
$(this).parent().show();
$(this).show();
find2 = true;
} else if ($(this).find("i.commont").html().indexOf('</span>') >= 0) {
$(this).find("i.commont").html($(this).attr("data-commont"));
}
if (find2 == false) {
$(this).hide();
}
})
}
})
})
$('.main').on({
mouseenter: function () {
var inner = "<a href='javascript:;' tabindex='-1' class='tryLock' onclick='lockThis(this);'>锁定</a>";
Expand Down
Loading

0 comments on commit 1d487e9

Please sign in to comment.