删除脚本模板

This commit is contained in:
jiangzeyin 2019-04-25 14:17:53 +08:00
parent 3088fce94c
commit 2a927e5acf
7 changed files with 46 additions and 2 deletions

View File

@ -5,6 +5,7 @@
### 新增功能 ### 新增功能
1. 新增线程列表监控(感谢@其锋) 1. 新增线程列表监控(感谢@其锋)
2. 新增节点脚本模板(感谢@其锋)
### 解决BUG、优化功能 ### 解决BUG、优化功能

View File

@ -68,7 +68,7 @@ public class ScriptServer extends BaseOperService<ScriptModel> {
public void deleteItem(String id) { public void deleteItem(String id) {
ScriptModel scriptModel = getItem(id); ScriptModel scriptModel = getItem(id);
if (scriptModel != null) { if (scriptModel != null) {
FileUtil.del(scriptModel.getFile(true)); FileUtil.del(scriptModel.getFile(true).getParentFile());
} }
deleteJson(AgentConfigBean.SCRIPT, id); deleteJson(AgentConfigBean.SCRIPT, id);
} }

View File

@ -105,6 +105,7 @@ public enum NodeUrl {
Script_Item("/script/item.json"), Script_Item("/script/item.json"),
Script_Save("/script/save.json"), Script_Save("/script/save.json"),
Script_Upload("/script/upload.json"), Script_Upload("/script/upload.json"),
Script_Del("/script/del.json"),
; ;

View File

@ -58,6 +58,13 @@ public class ScriptController extends BaseServerController {
return NodeForward.request(getNode(), getRequest(), NodeUrl.Script_Save).toString(); return NodeForward.request(getNode(), getRequest(), NodeUrl.Script_Save).toString();
} }
@RequestMapping(value = "del.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
@UrlPermission(value = Role.System, optType = UserOperateLogV1.OptType.Save_Del)
public String del() {
return NodeForward.request(getNode(), getRequest(), NodeUrl.Script_Del).toString();
}
/** /**
* 导入脚本 * 导入脚本
* *

View File

@ -237,6 +237,7 @@ public class UserOperateLogV1 extends BaseJsonModel {
Script_Start(40,"执行脚本"), Script_Start(40,"执行脚本"),
Script_Stop(41,"停止脚本"), Script_Stop(41,"停止脚本"),
Save_Upload(34, "导入脚本模板"), Save_Upload(34, "导入脚本模板"),
Save_Del(34, "删除脚本模板"),
; ;
private int code; private int code;

View File

@ -40,6 +40,10 @@
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button> <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
#if($item)
<a class="layui-btn layui-btn-warm" data-id="$item.id" id="delete">删除</a>
#end
</div> </div>
</div> </div>
#end #end
@ -63,6 +67,36 @@
}); });
return false; return false;
}); });
$("#delete").click(function () {
var id = $(this).attr("data-id");
var type = $(this).attr("type");
var msg = '确定删除此脚本模板吗 ' + id + '';
layer.confirm(msg, {
title: '系统提示'
}, function (index) {
loadingAjax({
url: './del.json',
data: {
id: id
},
success: function (data) {
layer.msg(data.msg);
if (200 == data.code) {
autoClose();
}
}
});
});
});
}
function autoClose() {
setTimeout(function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
parent.location.reload();
}, 2000);
} }
</script> </script>

View File

@ -49,7 +49,7 @@
</td> </td>
</tr> </tr>
#end #end
#if(!$array) #if(!$array || $array.size()<=0)
<tr> <tr>
<td colspan="5">没有相关信息</td> <td colspan="5">没有相关信息</td>
</tr> </tr>