forked from jly8866/archer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
在线查询新增美化sql功能
- Loading branch information
Showing
11 changed files
with
338 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,142 +1,167 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<ul class="nav nav-tabs"> | ||
{% if navStatus == 'all' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?pageNo=0&navStatus=all">全部工单</a> | ||
</li> | ||
<!-- tab--> | ||
<ul class="nav nav-tabs"> | ||
{% if navStatus == 'all' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?pageNo=0&navStatus=all">全部工单</a> | ||
</li> | ||
|
||
{% if role == '审核人' %} | ||
{% if navStatus == 'waitingforme' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?pageNo=0&navStatus=waitingforme">待我审核的</a> | ||
</li> | ||
{% endif %} | ||
{% if navStatus == 'manreviewing' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?navStatus=manreviewing">待我审核的</a> | ||
</li> | ||
|
||
{% if navStatus == 'finish' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?pageNo=0&navStatus=finish">已执行完毕</a> | ||
</li> | ||
{% if navStatus == 'finish' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?navStatus=finish">已执行完毕</a> | ||
</li> | ||
|
||
{% if navStatus == 'executing' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?pageNo=0&navStatus=executing">执行中</a> | ||
</li> | ||
{% if navStatus == 'executing' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?navStatus=executing">执行中</a> | ||
</li> | ||
|
||
{% if navStatus == 'abort' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?pageNo=0&navStatus=abort">人工终止流程</a> | ||
</li> | ||
{% if navStatus == 'abort' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?navStatus=abort">人工终止流程</a> | ||
</li> | ||
|
||
{% if navStatus == 'autoreviewwrong' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?pageNo=0&navStatus=autoreviewwrong">自动审核不通过的</a> | ||
</li> | ||
{% if navStatus == 'autoreviewwrong' %} | ||
<li class="active"> | ||
{% else %} | ||
<li> | ||
{% endif %} | ||
<a href="/allworkflow/?navStatus=autoreviewwrong">自动审核不通过的</a> | ||
</li> | ||
|
||
</ul> | ||
<table data-toggle="table" class="table table-striped table-hover"> | ||
<thead> | ||
<tr> | ||
<th> | ||
工单ID | ||
</th> | ||
<th> | ||
工单名称 | ||
</th> | ||
<th> | ||
发起人 | ||
</th> | ||
<th> | ||
工单状态 | ||
</th> | ||
<th> | ||
发起时间 | ||
</th> | ||
<th> | ||
目标集群 | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for workflow in listWorkflow %} | ||
<tr> | ||
<td> | ||
{{workflow.id}} | ||
</td> | ||
<td> | ||
<a href="/detail/{{workflow.id}}/">{{workflow.workflow_name}}</a> | ||
</td> | ||
<td> | ||
{{workflow.engineer}} | ||
</td> | ||
<td> | ||
{{workflow.status}} | ||
</td> | ||
<td> | ||
{{workflow.create_time|date:"Y-m-d H:i:s"}} | ||
</td> | ||
<td> | ||
{{workflow.cluster_name}} | ||
</td> | ||
</tr> | ||
{% empty %} | ||
<tr> | ||
<td>当前状态暂无工单,嘿嘿嘿.</td> | ||
<td></td> | ||
<td></td> | ||
<td></td> | ||
<td></td> | ||
<td></td> | ||
|
||
</tr> | ||
{% endfor %} | ||
|
||
</tbody> | ||
</table> | ||
<div style="text-align:center;"> | ||
<ul class="pagination" style="display:inline-block;"> | ||
<li> | ||
<a href="/allworkflow/?pageNo={{pageNo|add:"-1"}}&navStatus={{navStatus}}">前一页</a> | ||
</li> | ||
<li class="active"> | ||
<a href="/allworkflow/?pageNo={{pageNo|add:"0"}}&navStatus={{navStatus}}">{{pageNo|add:"1"}}</a> | ||
</li> | ||
{% if listWorkflow|length >= PAGE_LIMIT %} | ||
<li> | ||
<a href="/allworkflow/?pageNo={{pageNo|add:"1"}}&navStatus={{navStatus}}">{{pageNo|add:"2"}}</a> | ||
</li> | ||
<li> | ||
<a href="/allworkflow/?pageNo={{pageNo|add:"2"}}&navStatus={{navStatus}}">{{pageNo|add:"3"}}</a> | ||
</li> | ||
<li> | ||
<a href="/allworkflow/?pageNo={{pageNo|add:"3"}}&navStatus={{navStatus}}">{{pageNo|add:"4"}}</a> | ||
</li> | ||
<li> | ||
<a href="/allworkflow/?pageNo={{pageNo|add:"4"}}&navStatus={{navStatus}}">{{pageNo|add:"5"}}</a> | ||
</li> | ||
<li> | ||
<a href="/allworkflow/?pageNo={{pageNo|add:"1"}}&navStatus={{navStatus}}">后一页</a> | ||
</li> | ||
{% endif %} | ||
</ul> | ||
</div> | ||
</ul> | ||
<!-- 审核列表的表格--> | ||
<div class="table-responsive"> | ||
<table id="sqlaudit-list" data-toggle="table" class="table table-striped table-hover" | ||
style="table-layout:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"> | ||
</table> | ||
</div> | ||
{% endblock content%} | ||
{% block js %} | ||
{% load staticfiles %} | ||
<script src="{% static 'bootstrap-table/js/bootstrap-table-export.min.js' %}"></script> | ||
<script src="{% static 'bootstrap-table/js/tableExport.min.js' %}"></script> | ||
<script src="{% static 'dist/js/sql-formatter.min.js' %}"></script> | ||
<script> | ||
//获取申请列表 | ||
function get_sqlauditlist() { | ||
//采取异步请求 | ||
//初始化table | ||
$('#sqlaudit-list').bootstrapTable('destroy').bootstrapTable({ | ||
method: 'post', | ||
contentType: "application/x-www-form-urlencoded", | ||
url: "/sqlworkflow/", | ||
striped: true, //是否显示行间隔色 | ||
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) | ||
pagination: true, //是否显示分页(*) | ||
sortable: true, //是否启用排序 | ||
sortOrder: "asc", //排序方式 | ||
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*) | ||
pageNumber: 1, //初始化加载第一页,默认第一页,并记录 | ||
pageSize: 14, //每页的记录行数(*) | ||
pageList: [20, 30, 50, 100], //可供选择的每页的行数(*) | ||
showExport: true, //是否显示导出按钮 | ||
exportOptions: { | ||
fileName: 'allworkflow' //文件名称设置 | ||
}, | ||
search: true, //是否显示表格搜索 | ||
strictSearch: false, //是否全匹配搜索 | ||
showColumns: true, //是否显示所有的列(选择显示的列) | ||
showRefresh: true, //是否显示刷新按钮 | ||
minimumCountColumns: 2, //最少允许的列数 | ||
clickToSelect: true, //是否启用点击选中行 | ||
uniqueId: "id", //每一行的唯一标识,一般为主键列 | ||
showToggle: true, //是否显示详细视图和列表视图的切换按钮 | ||
cardView: false, //是否显示详细视图 | ||
detailView: false, //是否显示父子表 | ||
locale: 'zh-CN', //本地化 | ||
toolbar: "#toolbar", //指明自定义的toolbar | ||
queryParamsType: 'limit', | ||
//请求服务数据时所传参数 | ||
queryParams: | ||
function (params) { | ||
return { | ||
limit: params.limit, | ||
offset: params.offset, | ||
navStatus: "{{ navStatus }}", | ||
search: params.search | ||
} | ||
}, | ||
columns: [{ | ||
title: '工单ID', | ||
field: 'id' | ||
}, { | ||
title: '工单名称', | ||
field: 'workflow_name', | ||
formatter: function (value, row, index) { | ||
return "<a href=\"/detail/" + row.id + "/\">" + value + "</a>" | ||
} | ||
}, { | ||
title: '发起人', | ||
field: 'engineer' | ||
}, { | ||
title: '工单状态', | ||
field: 'status', | ||
formatter: function (value, row, index) { | ||
return sqlworkflowStatus_formatter(value) | ||
} | ||
}, { | ||
title: '发起时间', | ||
field: 'create_time' | ||
}, { | ||
title: '目标集群', | ||
field: 'cluster_name' | ||
}], | ||
onLoadSuccess: function () { | ||
}, | ||
onLoadError: function () { | ||
alert("数据加载失败!"); | ||
}, | ||
onSearch: function (e) { | ||
//传搜索参数给服务器 | ||
queryParams(e) | ||
}, | ||
responseHandler: function (res) { | ||
//在ajax获取到数据,渲染表格之前,修改数据源 | ||
return res; | ||
} | ||
}); | ||
|
||
} | ||
//激活标签页时保存当前标签页的id | ||
$(function () { | ||
$("#nav-tabs").on('shown.bs.tab', "li", function (e) { | ||
var active_tab = $(e.target).parents().attr('id'); | ||
get_sqlauditlist(); | ||
}); | ||
}); | ||
|
||
//初始化数据 | ||
$(document).ready(function () { | ||
var active_tab = 'all'; | ||
get_sqlauditlist(); | ||
}); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.