123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <script type="text/javascript" src="/static/js/layui_crud.js"></script>
- <div class="children-content" id="cleardata">
- <blockquote class="layui-elem-quote" style="padding:1rem;line-height:2.5rem;">
- 系统管理 / SCD清理
- </blockquote>
- <div id="tree_area" style="float:left;width:22%;overflow: auto;background-color: #fafafa;">
- <div id="tree" class="ztree tree"></div>
- </div>
- <div style="float:right;width:77%;">
- <table id="table_datalist_control" lay-filter="table_row_operator">
- </table>
- </div>
- </div>
- <!--语法规则-->
- <script type="text/html" id="table_row_operator">
- {{if is_parse=="1" || (is_parse=="0" && date_sub_sencond(CREATED_TIME))}}
- <i class="layui-icon layui-icon-delete" title="删除SCD并清除相关数据" style="margin-left:10px;cursor:pointer;" lay-event="delete"></i>
- <i class="layui-icon layui-icon-refresh" title="重新解析" style="margin-left:10px;cursor:pointer;" lay-event="agin_parse"></i>
- {{/if}}
- </script>
- <script type="text/javascript">
- template.helper("date_sub_sencond",function(dt){
- return new Date()- new Date(dt)
- })
- var cleardataele=$("#cleardata");
- cleardataele.find("#tree").height($(".main-body").height() - $(".layui-elem-quote:first").height());
- Global.Ztree.Init(cleardataele.find("#tree"), {
- url: Global.AccessUrl + "/api/area/children/list",
- idKey: "id",
- pidKey: "pid",
- nameKey: "title",
- callback: {
- onClick: function(event, treeId, treeNode) {
- if (treeNode.id != "0") {
- } else {
- layer.msg("请先选择变电站!")
- }
- ruleCrud_syntax.GetList({"stationid":treeNode.id});
- },
- onInitLoad:function(firstnode){
- //console.log(firstnode)
- ruleCrud_syntax.GetList({"stationid":""});
- }
- }
- });
- var ruleCrud_syntax=new CurdObj();
- ruleCrud_syntax.Init({
- "module_name":"cleardata",
- "list_table_id":"table_ruleCrud_dataclear",
- "window_size": ['60rem', '55rem'],
- "nameColKey":"scd_name",
- "idColKey":"id",
- "height": ($(".main-body").height()-$("#header").height()-$(".layui-elem-quote:first").height()),
- //默认的数据table ID
- "table_datalist_control": "table_datalist_control",
- //默认的数据table工具栏ID
- "table_tools_bar": "none",
- //默认的数据table查询条件元素ID
- "table_search_panel": "table_search_panel",
- //默认的数据table操作模板ID
- "table_row_operator": "table_row_operator",
- "apiUrl": {
- "delete_url": "/api/screen/scd/delete",
- "list_url": "/api/screen/scd/list"
- },
- "data":{},
- "columns":[
- [
- {
- field: 'id',
- title: "SCD编号",
- width: 100
- }, {
- field: 'scd_name',
- title: "SCD名称",
- width: 260
- },{
- field: 'is_parse',
- title: "解析状态",
- width: 160,
- templet:function(data){
- var breaker=0;
- //解析时间超过30分钟时,解析又可能中断了
- if(data.is_parse==0 && (new Date()- new Date(data.CREATED_TIME)>(1000*60*30))){
- return "<b style='color:red'>解析可能已中断</b>"
- }
- return data.is_parse==1?"解析完成":"<b style='color:red'>解析中...</b>";
- }
- }, {
- field: '',
- title: "可用状态",
- width: 120,
- templet:function(data){
- return data.enable==1?"启用":"<b style='color:red'>不可用</b>";
- }
- }, {
- field: 'version',
- title: "版本",
- width: 90
- },{
- field:"CREATED_TIME",
- title: "创建日期",
- width: 180
- },{
- fixed: 'right',
- title: "操作",
- width: 120,
- align: 'center',
- templet:function(data){
- return template('table_row_operator',data);
- }
- }
- ]
- ]
- });
- function agin_parse(data){
- layer.confirm('<div style="text-align:center;">重新解析会清除原来的数据,确定要重新解析SCD文件<span style="color:red;font-weight:700;padding:0 2px;">' + data.scd_name + "</span>吗?</div>", function(index) {
- $.post(Global.AccessUrl+"/api/screen/scd/agin_parse",{"scd_id":data.id},function(r){
- if(r.code!=0){
- layer.msg("操作失败:"+r.msg);
- return;
- }
- layer.msg("正在重新解析中,等耐心等待解析完成",{time:5000});
- setTimeout(function(){
- autoRefresh();
- },3000);
- })
- });
- }
- function autoRefresh(){
- if($("#cleardata").length==0){
- return;
- }
- ruleCrud_syntax.Reset();
- setTimeout(function(){
- autoRefresh();
- },5000);
- }
- </script>
|