添加sql条件功能
This commit is contained in:
parent
38671a6840
commit
10257cc3f3
@ -21,7 +21,7 @@
|
||||
<div class="analysis-navigation-bar-right-img" title="最后更新时间:2021-04-29 14:44:39">
|
||||
<img src="./static/img/gengxin.png">
|
||||
</div>
|
||||
<div class="analysis-navigation-bar-right-img sqlquery">
|
||||
<div class="analysis-navigation-bar-right-img sqlquery" title="查看条件代码">
|
||||
<i class="iconfont" style="font-size: 18px; color: #67729d;"></i>
|
||||
</div>
|
||||
<div class="analysis-navigation-bar-right-img" title="以页面格式下载全量数据">
|
||||
|
42
web/pages/conditionquery.html
Normal file
42
web/pages/conditionquery.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!-- 查询条件代码 -->
|
||||
<div class="conditionquery-box">
|
||||
|
||||
<div class="conditionquery-pad-box">
|
||||
|
||||
<div class="conditionquery-con-box">
|
||||
|
||||
<div class="conditionquery-ant-tabs">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="conditionquery">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this ">SQL查询条件</li>
|
||||
<li>API查询条件</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
|
||||
<div class="conditionquery-txt conditionquery-sqldata" id="conditionquery-sqldata">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
|
||||
<div class="conditionquery-txt conditionquery-apidata" id="conditionquery-apidata"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="conditionquery-but-box">
|
||||
<div>复制代码可直接在 <span>SQL查询</span> 中应用 </div>
|
||||
<div class="conditionquery-copy">复制代码</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
65
web/src/x.min.js
vendored
65
web/src/x.min.js
vendored
@ -1338,10 +1338,13 @@ var X = window.X || {
|
||||
// sql语句显示
|
||||
$(document).off('click','.sqlquery').on('click','.sqlquery',function(){
|
||||
// console.log(1111)
|
||||
X.api('ck/event_model_sql','post',data,function(d){
|
||||
console.log(data);
|
||||
console.log(d[0]['sql']);
|
||||
// X.api('ck/event_model_sql','post',data,function(d){
|
||||
var obj = $(this);
|
||||
var offset = obj.offset();
|
||||
X.querycriteriapop(data,'conditionquery',offset.left - 410,offset.top+obj.height(),function(){
|
||||
|
||||
})
|
||||
// })
|
||||
})
|
||||
|
||||
// 切换为指标公式
|
||||
@ -2067,6 +2070,62 @@ var X = window.X || {
|
||||
|
||||
})();
|
||||
|
||||
// srczip/logic/conditionquery.js
|
||||
(function(){
|
||||
X.pageLogic['conditionquery'] = {
|
||||
init : function(parms){
|
||||
var me = this;
|
||||
this.parms = parms;
|
||||
this.callback = parms.callback;
|
||||
var data = parms.extData;
|
||||
|
||||
X.api('ck/event_model_sql','post',data,function(d){
|
||||
console.log(d);
|
||||
$(".conditionquery-sqldata").html(d[0]['sql']);
|
||||
$(".conditionquery-apidata").html(JSON.stringify(data));
|
||||
})
|
||||
var tab = 0
|
||||
layui.element.on('tab(conditionquery)', function(data){
|
||||
tab = data['index']
|
||||
});
|
||||
|
||||
$(document).on("click",'.conditionquery-copy',function(){
|
||||
|
||||
if(tab == 0){
|
||||
selectText('conditionquery-sqldata');
|
||||
}else {
|
||||
selectText('conditionquery-apidata');
|
||||
}
|
||||
|
||||
document.execCommand('copy');
|
||||
layer.msg('复制成功');
|
||||
|
||||
})
|
||||
|
||||
function selectText(element) {
|
||||
var text = document.getElementById(element);
|
||||
//做下兼容
|
||||
if (document.body.createTextRange) { //如果支持
|
||||
var range = document.body.createTextRange(); //获取range
|
||||
range.moveToElementText(text); //光标移上去
|
||||
range.select(); //选择
|
||||
} else if (window.getSelection) {
|
||||
var selection = window.getSelection(); //获取selection
|
||||
var range = document.createRange(); //创建range
|
||||
range.selectNodeContents(text); //选择节点内容
|
||||
selection.removeAllRanges(); //移除所有range
|
||||
selection.addRange(range); //添加range
|
||||
/*if(selection.setBaseAndExtent){
|
||||
selection.setBaseAndExtent(text, 0, text, 1);
|
||||
}*/
|
||||
} else {
|
||||
alert("复制失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
})();
|
||||
// srczip/logic/dashboard.js
|
||||
//cc
|
||||
(function(){
|
||||
|
@ -154,10 +154,13 @@
|
||||
// sql语句显示
|
||||
$(document).off('click','.sqlquery').on('click','.sqlquery',function(){
|
||||
// console.log(1111)
|
||||
X.api('ck/event_model_sql','post',data,function(d){
|
||||
console.log(data);
|
||||
console.log(d[0]['sql']);
|
||||
// X.api('ck/event_model_sql','post',data,function(d){
|
||||
var obj = $(this);
|
||||
var offset = obj.offset();
|
||||
X.querycriteriapop(data,'conditionquery',offset.left - 410,offset.top+obj.height(),function(){
|
||||
|
||||
})
|
||||
// })
|
||||
})
|
||||
|
||||
// 切换为指标公式
|
||||
|
55
web/srczip/logic/conditionquery.js
Normal file
55
web/srczip/logic/conditionquery.js
Normal file
@ -0,0 +1,55 @@
|
||||
(function(){
|
||||
X.pageLogic['conditionquery'] = {
|
||||
init : function(parms){
|
||||
var me = this;
|
||||
this.parms = parms;
|
||||
this.callback = parms.callback;
|
||||
var data = parms.extData;
|
||||
|
||||
X.api('ck/event_model_sql','post',data,function(d){
|
||||
console.log(d);
|
||||
$(".conditionquery-sqldata").html(d[0]['sql']);
|
||||
$(".conditionquery-apidata").html(JSON.stringify(data));
|
||||
})
|
||||
var tab = 0
|
||||
layui.element.on('tab(conditionquery)', function(data){
|
||||
tab = data['index']
|
||||
});
|
||||
|
||||
$(document).on("click",'.conditionquery-copy',function(){
|
||||
|
||||
if(tab == 0){
|
||||
selectText('conditionquery-sqldata');
|
||||
}else {
|
||||
selectText('conditionquery-apidata');
|
||||
}
|
||||
|
||||
document.execCommand('copy');
|
||||
layer.msg('复制成功');
|
||||
|
||||
})
|
||||
|
||||
function selectText(element) {
|
||||
var text = document.getElementById(element);
|
||||
//做下兼容
|
||||
if (document.body.createTextRange) { //如果支持
|
||||
var range = document.body.createTextRange(); //获取range
|
||||
range.moveToElementText(text); //光标移上去
|
||||
range.select(); //选择
|
||||
} else if (window.getSelection) {
|
||||
var selection = window.getSelection(); //获取selection
|
||||
var range = document.createRange(); //创建range
|
||||
range.selectNodeContents(text); //选择节点内容
|
||||
selection.removeAllRanges(); //移除所有range
|
||||
selection.addRange(range); //添加range
|
||||
/*if(selection.setBaseAndExtent){
|
||||
selection.setBaseAndExtent(text, 0, text, 1);
|
||||
}*/
|
||||
} else {
|
||||
alert("复制失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
})();
|
@ -230,3 +230,14 @@
|
||||
.savereport-but-qd { background-color: #3d90ff; color: #fff; }
|
||||
.analysis-overall { display: none; }
|
||||
|
||||
/* 条件查询 */
|
||||
.conditionquery-box { width: 430px; height: 362px; background-color: #fff; }
|
||||
.conditionquery-pad-box { padding: 12px 16px; color: rgba(0, 0, 0, 0.85); }
|
||||
.conditionquery-con-box { margin: 0 8px; }
|
||||
.layui-tab-brief>.layui-tab-title .layui-this { color:#3d90ff; }
|
||||
.layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after { border-bottom: 2px solid #3d90ff; }
|
||||
.conditionquery-txt { padding: 8px; height: 204px; line-height: 24px; overflow-y: auto; background-color: #fafafa; color: #323234; border: 1px solid #f0f0f0; border-radius: 2px; }
|
||||
|
||||
.conditionquery-but-box { display: flex; justify-content: space-between; align-items: center; margin-top: -10px; }
|
||||
.conditionquery-copy { cursor: pointer; color: #fff; background-color: #3d90ff; border-radius: 2px; padding: 0 16px; font-weight: 400; font-size: 14px; height: 32px; line-height: 32px; }
|
||||
.conditionquery-but-box span{ background-color: #eaecf8; color: #3d90ff; padding: 0 8px; cursor: pointer; display: inline-block; }
|
Loading…
Reference in New Issue
Block a user