更新
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">计划表达式<span>*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" lay-verify="required" name="cronExpression" placeholder="" autocomplete="off" class="layui-input"/>
|
||||
<input type="text" lay-verify="required" name="cronExpr" placeholder="" autocomplete="off" class="layui-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
@@ -141,7 +141,7 @@
|
||||
content: $('#addPlan').html(),
|
||||
success: async function (layero, layerIndex) {
|
||||
var el = $(layero);
|
||||
['planId', 'planName', 'cronExpression', 'indexCode'].forEach(x => {
|
||||
['planId', 'planName', 'cronExpr', 'indexCode'].forEach(x => {
|
||||
const fieldEl = el[0].querySelector(`[name="${x}"]`);
|
||||
if (!fieldEl) return;
|
||||
fieldEl.value = r.data[x];
|
||||
@@ -149,12 +149,12 @@
|
||||
['enabled', 'openDayCheck'].forEach(x => {
|
||||
const fieldEl = el[0].querySelector(`[name="${x}"]`);
|
||||
if (!fieldEl) return;
|
||||
fieldEl.checked = r.data[x];
|
||||
fieldEl.value = r.data[x];
|
||||
fieldEl.checked = !!r.data[x];
|
||||
fieldEl.value = !!r.data[x];
|
||||
layui.form.on('switch(' + x + ')', obj => obj.elem.value = obj.elem.checked)
|
||||
});
|
||||
layui.cron.render({
|
||||
elem: '[name="cronExpression"]',
|
||||
elem: '[name="cronExpr"]',
|
||||
btns: ['confirm'],
|
||||
cssPath: '/admin/v1/static/css/cron.css'
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
{field:'openDayCheck', title: '交易日校验', width: 95, switchTemplet: true},
|
||||
{field:'planId', hide: true, width: 60, title: 'ID'},
|
||||
{field:'planName', title: '计划名称'},
|
||||
{field:'cronExpression', title: '计划表达式'},
|
||||
{field:'cronExpr', title: '计划表达式'},
|
||||
{field:'indexCode', title: '指标代码'},
|
||||
{field:'params', title: '请求参数', templet: function(d) {
|
||||
if (typeof d.params === 'object' && d.params !== null) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div th:fragment="protocolMatchExtra">
|
||||
<script id="addProtocolMatch" type="text/html">
|
||||
<style>.layui-form-select dl{max-height: 160px}</style>
|
||||
<div class="layui-form" style="margin:10px 15px" id="editPlanForm" lay-filter="editPlanForm">
|
||||
<div class="layui-form" style="margin:10px 15px" id="editProtocolMatchForm" lay-filter="editProtocolMatchForm">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">Protocol ID<span>*</span></label>
|
||||
<div class="layui-input-block">
|
||||
@@ -58,7 +58,7 @@ function openEditForm(r) {
|
||||
if (r && r.ok) {
|
||||
window.editLayer = layui.layer.open({
|
||||
type: 1,
|
||||
title: `${r.data.planId ? '编辑' : '新增'}Protocol`,
|
||||
title: `${r.data.protocolId ? '编辑' : '新增'}Protocol`,
|
||||
btn: ['提交', '关闭'],
|
||||
yes: function(index, layero) {
|
||||
layero.find('[lay-filter="submitProtocolMatch"]').click()
|
||||
@@ -101,7 +101,7 @@ layui.table.on('tool(protocolMatches)', function(obj) {
|
||||
$.ajax({
|
||||
url: '/admin/v1/manage/protocolMatch/delete',
|
||||
method: 'POST',
|
||||
data: {planId: obj.data.protocolId},
|
||||
data: {protocolId: obj.data.protocolId},
|
||||
success: function (data) {
|
||||
layui.table.reload('protocolMatches',{
|
||||
page: {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<h1 class="manage-title">
|
||||
<b>Protocol ID 映射表</b>
|
||||
<a href="#" class="help"><i class="layui-icon layui-icon-help"></i></a>
|
||||
<a href="javascript:openUploadForm()" class="operate">上传</a>
|
||||
<a href="javascript:openNewForm()" class="operate">新增</a>
|
||||
</h1>
|
||||
|
||||
@@ -56,7 +55,7 @@
|
||||
function switchTemplet(d) {
|
||||
var fieldName = d.LAY_COL.field;
|
||||
return `<input type="checkbox" lay-skin="switch" lay-text="|"
|
||||
data-field="${fieldName}" data-id="${d.planId}"
|
||||
data-field="${fieldName}" data-id="${d.protocolId}"
|
||||
${d[fieldName] ? 'checked' : ''} lay-filter="switchFilter">`;
|
||||
}
|
||||
|
||||
@@ -81,18 +80,18 @@
|
||||
{title: '开启交易日校验', op: 'enableOpenDayCheck'},
|
||||
{title: '关闭交易日校验', op: 'disableOpenDayCheck'}],
|
||||
click: function (data, othis){
|
||||
var checked = layui.table.checkStatus('protocolMatches'), planIds = [];
|
||||
var checked = layui.table.checkStatus('protocolMatches'), protocolIds = [];
|
||||
if (!checked.data.length) {
|
||||
layui.layer.msg('未选中任何项', {time: 1000});
|
||||
return;
|
||||
}
|
||||
$.each(checked.data, function (i, plan){
|
||||
planIds.push(plan.planId);
|
||||
$.each(checked.data, function (i, protocolMatch){
|
||||
protocolIds.push(protocolMatch.protocolId);
|
||||
});
|
||||
data = $.extend(data, {ids: planIds});
|
||||
data = $.extend(data, {ids: protocolIds});
|
||||
var op = function() {
|
||||
$.ajax({
|
||||
url: '/admin/v1/manage/plan/batchOp',
|
||||
url: '/admin/v1/manage/protocolMatch/batchOp',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
success: function () {
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<div th:fragment="strategyAndPoolExtra">
|
||||
<script id="addStrategyAndPool" type="text/html">
|
||||
<style>.layui-form-select dl{max-height: 160px}</style>
|
||||
<div class="layui-form" style="margin:10px 15px" id="editPlanForm" lay-filter="editPlanForm">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">池ID<span>*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" lay-verify="required|number" name="poolId" placeholder="池ID" autocomplete="off" class="layui-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">池名称<span>*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" lay-verify="required" name="poolName" placeholder="池名称" autocomplete="off" class="layui-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">策略集ID<span>*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" lay-verify="required|number" name="strategyId" placeholder="策略集ID" autocomplete="off" class="layui-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">策略集名称<span>*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" lay-verify="required" name="strategyName" placeholder="策略集名称" autocomplete="off" class="layui-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:none" class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit="*" lay-filter="submitStrategyAndPool">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
layui.form.on('submit(submitStrategyAndPool)', function(obj){
|
||||
var field = obj.field, data = {params: {}}
|
||||
Object.keys(field).forEach(key => {
|
||||
data[key] = field[key]
|
||||
});
|
||||
$.ajax({
|
||||
url: '/admin/v1/manage/strategyAndPool/save',
|
||||
method: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(data),
|
||||
success: function (r) {
|
||||
layer.msg('操作成功', {
|
||||
offset: '15px',
|
||||
icon: 1,
|
||||
time: 1000
|
||||
},
|
||||
function() {
|
||||
if (window.editLayer) {
|
||||
layui.layer.close(window.editLayer);
|
||||
}
|
||||
layui.table.reload('strategyAndPools',{
|
||||
page: {
|
||||
curr: $(".layui-laypage-em").next().html() //当前页码值
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
function openEditForm(r) {
|
||||
if (r && r.ok) {
|
||||
window.editLayer = layui.layer.open({
|
||||
type: 1,
|
||||
title: `${r.data.poolId ? '编辑' : '新增'}策略`,
|
||||
btn: ['提交', '关闭'],
|
||||
yes: function(index, layero) {
|
||||
layero.find('[lay-filter="submitStrategyAndPool"]').click()
|
||||
},
|
||||
skin: "layui-anim layui-anim-rl layui-layer-adminRight",
|
||||
area: '500px',
|
||||
anim: -1,
|
||||
shadeClose: !0,
|
||||
closeBtn: !1,
|
||||
move: !1,
|
||||
offset: 'r',
|
||||
content: $('#addStrategyAndPool').html(),
|
||||
success: function(layero, layerIndex) {
|
||||
Helper.fillEditForm(r, layero, layerIndex);
|
||||
}
|
||||
})
|
||||
}
|
||||
else layer.msg(r && r.data || '服务器错误', {offset: '15px', icon: 2, time: 1000})
|
||||
}
|
||||
function openNewForm(poolId) {
|
||||
$.ajax({
|
||||
url: '/admin/v1/manage/strategyAndPool/getOne',
|
||||
data: {poolId: poolId},
|
||||
success: function(r) {
|
||||
openEditForm(r)
|
||||
},
|
||||
error: function(xhr) {
|
||||
var r = xhr.responseJSON;
|
||||
layer.msg(r && r.data || '服务器错误', {offset: '15px', icon: 2, time: 100})
|
||||
}
|
||||
})
|
||||
}
|
||||
layui.table.on('tool(strategyAndPools)', function(obj) {
|
||||
if (obj.event == 'edit') {
|
||||
openNewForm(obj.data.poolId)
|
||||
}
|
||||
else if (obj.event == 'del') {
|
||||
layui.layer.confirm('确定删除该映射吗?', function (index) {
|
||||
layui.layer.close(index);
|
||||
$.ajax({
|
||||
url: '/admin/v1/manage/strategyAndPool/delete',
|
||||
method: 'POST',
|
||||
data: {poolId: obj.data.poolId},
|
||||
success: function (data) {
|
||||
layui.table.reload('strategyAndPools',{
|
||||
page: {
|
||||
curr: $(".layui-laypage-em").next().html() //当前页码值
|
||||
}
|
||||
});
|
||||
layer.msg('删除成功', {offset: '15px', icon: 1, time: 1000})
|
||||
},
|
||||
error: function (res) {
|
||||
var r = res.responseJSON;
|
||||
layer.msg(r&&r.data||'服务器错误',
|
||||
{offset: '15px', icon: 2, time: 2000});
|
||||
return
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
</html>
|
||||
@@ -0,0 +1,134 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:insert="~{admin/v1/include::head}"
|
||||
th:with="title=${'策略信息'}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ul th:replace="~{admin/v1/include::nav}"></ul>
|
||||
|
||||
<div class="manage-body">
|
||||
<div>
|
||||
<h1 class="manage-title">
|
||||
<b>策略表</b>
|
||||
<a href="#" class="help"><i class="layui-icon layui-icon-help"></i></a>
|
||||
<a href="javascript:openNewForm()" class="operate">新增</a>
|
||||
<a href="/admin/v1/manage/strategyAndPool/exportPreparedStrategies" target="_blank" class="operate">导出</a>
|
||||
</h1>
|
||||
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-sm operdown">
|
||||
<span>选中项<i
|
||||
class="layui-icon layui-icon-sm layui-icon-triangle-d"></i></span>
|
||||
</button>
|
||||
<div>
|
||||
<table class="layui-table" id="strategyAndPools" lay-filter="strategyAndPools">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div th:replace="~{admin/v1/include::feet}"></div>
|
||||
<script type="text/html" id="operationTpl">
|
||||
<div class="layui-btn-group">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
<th:block th:replace="~{admin/v1/include::head-script}"></th:block>
|
||||
<script th:inline="javascript">
|
||||
layui
|
||||
.extend({
|
||||
xmSelect: '/admin/v1/static/layuiadmin/lib/xm-select',
|
||||
cron: '/admin/v1/static/layuiadmin/lib/cron'
|
||||
})
|
||||
.use(['table', 'form', 'dropdown', 'layer', 'xmSelect', 'cron'], function(){
|
||||
var dropdown = layui.dropdown, table = layui.table, form = layui.form;
|
||||
|
||||
$('.help').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
layer.open({
|
||||
title: '帮助',
|
||||
content:
|
||||
'益盟操盘手的策略集和策略池关系<br>'+
|
||||
'可以在破解软件权限后,通过载入日K图获取。<br>' +
|
||||
'获取后解析 /strategy 链接提供的 EmoneyProtobuf 信息,会自动抓取并存储'
|
||||
})
|
||||
})
|
||||
|
||||
function switchTemplet(d) {
|
||||
var fieldName = d.LAY_COL.field;
|
||||
return `<input type="checkbox" lay-skin="switch" lay-text="|"
|
||||
data-field="${fieldName}" data-id="${d.planId}"
|
||||
${d[fieldName] ? 'checked' : ''} lay-filter="switchFilter">`;
|
||||
}
|
||||
|
||||
table.render({
|
||||
elem: '#strategyAndPools',
|
||||
url:'/admin/v1/manage/strategyAndPool/list',
|
||||
page:true, skin:'line',
|
||||
cols: [ [
|
||||
{type:'checkbox'},
|
||||
{field:'poolId', width: 100, title: '池ID'},
|
||||
{field:'poolName', title: '池名'},
|
||||
{field:'strategyId', title: '策略ID'},
|
||||
{field:'strategyName', title: '策略名'},
|
||||
{field:'operation', title: '操作', width: 150, toolbar: '#operationTpl'}
|
||||
]]
|
||||
});
|
||||
|
||||
dropdown.render({
|
||||
elem: '.operdown',
|
||||
data: [
|
||||
{title: '删除'}
|
||||
],
|
||||
click: function (data, othis){
|
||||
var checked = layui.table.checkStatus('strategyAndPools'), planIds = [];
|
||||
if (!checked.data.length) {
|
||||
layui.layer.msg('未选中任何项', {time: 1000});
|
||||
return;
|
||||
}
|
||||
$.each(checked.data, function (i, plan){
|
||||
planIds.push(plan.planId);
|
||||
});
|
||||
data = $.extend(data, {ids: planIds});
|
||||
var op = function() {
|
||||
$.ajax({
|
||||
url: '/admin/v1/manage/strategyAndPool/batchOp',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
success: function () {
|
||||
layer.msg('批量操作成功', {
|
||||
offset: '15px',
|
||||
icon: 1,
|
||||
time: 1000
|
||||
},
|
||||
function() {
|
||||
layui.table.reload('strategyAndPools', {
|
||||
page: {
|
||||
curr: $(".layui-laypage-em").next().html() //当前页码值
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
},
|
||||
error: function (res) {
|
||||
var r = res.responseJSON;
|
||||
layer.msg(r&&r.data||'服务器错误', {
|
||||
offset: '15px',
|
||||
icon: 2,
|
||||
time: 1000
|
||||
});
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
data.op ? op() : layer.confirm('确认批量删除吗?该操作不可恢复', function(){
|
||||
op();
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<th:block th:replace="~{admin/v1/manage/strategyAndPool/include::strategyAndPoolExtra}"></th:block>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user