|
@ -0,0 +1,244 @@
|
|
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
|
|
|
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
|
|
|
<script>
|
|
|
(function ($, win) {
|
|
|
$(function () {
|
|
|
/* ************************** 变量定义 ******************************** */
|
|
|
// 通用工具类库
|
|
|
var Util = $.Util;
|
|
|
var taskRule = null;
|
|
|
var master = null;
|
|
|
var isFirstPage = false;
|
|
|
/* *************************** 函数定义 ******************************* */
|
|
|
function pageInit() {
|
|
|
taskRule.init();
|
|
|
master.init();
|
|
|
}
|
|
|
|
|
|
function reloadGrid(params) {
|
|
|
if (isFirstPage) {
|
|
|
this.grid.options.newPage = 1;
|
|
|
}
|
|
|
this.grid.setOptions({parms: params});
|
|
|
this.grid.loadData(true);
|
|
|
}
|
|
|
|
|
|
/* *************************** 模块初始化 ***************************** */
|
|
|
|
|
|
taskRule = {
|
|
|
$element: $('.m-taskRule-area'),
|
|
|
$searchBtn: $('#btn_search'),
|
|
|
$addBtn: $('#btn_add'),
|
|
|
|
|
|
$name: $("#inp_name"),//规则标题
|
|
|
$type: $("#inp_type"),//规则类型
|
|
|
$period: $("#inp_period"),//周期
|
|
|
$status: $("#inp_status"),//状态
|
|
|
init: function () {
|
|
|
this.$element.show();
|
|
|
this.$element.attrScan();
|
|
|
window.form = this.$element;
|
|
|
this.$name.ligerTextBox({width: 200});
|
|
|
this.typeBox = this.$type.ligerComboBox({
|
|
|
width: 200,
|
|
|
data: [
|
|
|
{text: '手动', id: 'NORMAL'},
|
|
|
{text: '自动', id: 'AUTO'},
|
|
|
]
|
|
|
});
|
|
|
this.periodBox =this.$period.ligerComboBox({
|
|
|
width: 200,
|
|
|
data: [
|
|
|
{text: '一次性', id: '1'},
|
|
|
{text: '周期性', id: '0'},
|
|
|
]
|
|
|
});
|
|
|
this.statusBox = this.$status.ligerComboBox({
|
|
|
width: 200,
|
|
|
data: [
|
|
|
{text: '有效', id: '1'},
|
|
|
{text: '失效', id: '0'},
|
|
|
]
|
|
|
});
|
|
|
this.bindEvents();
|
|
|
},
|
|
|
bindEvents: function () {
|
|
|
var self = this;
|
|
|
self.$searchBtn.click(function () {
|
|
|
master.grid.options.newPage = 1;
|
|
|
master.reloadGrid();
|
|
|
});
|
|
|
self.$addBtn.click(function () {
|
|
|
$.publish("taskRule:info:create", [0]);
|
|
|
});
|
|
|
|
|
|
}
|
|
|
};
|
|
|
master = {
|
|
|
taskRuleInfoDialog: null,
|
|
|
grid: null,
|
|
|
init: function () {
|
|
|
this.grid = $("#div_taskRule_list").ligerGrid($.LigerGridEx.config({
|
|
|
url: ctx + '/admin/taskRule/list',
|
|
|
parms: {"taskRule": JSON.stringify(taskRule.$element.Fields.getValues())},
|
|
|
ajaxHeader: ajaxHeaderName,
|
|
|
ajaxHeaderValue: ajaxHeaderValue,
|
|
|
columns: [
|
|
|
{display: 'id', name: 'id', hide: true},
|
|
|
{display: '规则名称', name: 'name', width: '10%', align: "left"},
|
|
|
{display: '规则描述', name: 'description', width: '10%', align: "left"},
|
|
|
{display: '积分', name: 'integrate', width: '10%', align: "left"},
|
|
|
{
|
|
|
display: '交易类型', name: 'tradeDirection', width: '10%', align: "left",
|
|
|
render: function (row) {
|
|
|
if(row.tradeDirection == 1) {
|
|
|
return "增"
|
|
|
}
|
|
|
if(row.tradeDirection == -1) {
|
|
|
return "减"
|
|
|
}
|
|
|
if(row.tradeDirection == 0) {
|
|
|
return "清零"
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
display: '规则类型', name: 'type', width: '10%', align: "left",
|
|
|
render: function (row) {
|
|
|
if (row.type == "NORMAL") {
|
|
|
return "手动"
|
|
|
}
|
|
|
if (row.type == "AUTO") {
|
|
|
return "自动"
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{display: 'Java反射类路径', name: 'javaClassPath', width: '10%', align: "left"},
|
|
|
{
|
|
|
display: '周期', name: 'period', width: '10%', align: "left",
|
|
|
render: function (row) {
|
|
|
if (row.period == 1) {
|
|
|
return "一次性"
|
|
|
}
|
|
|
if (row.period == 0) {
|
|
|
return "周期性"
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
display: '状态', name: 'status', width: '10%', align: "left",
|
|
|
render: function (row) {
|
|
|
if (row.status == 1) {
|
|
|
return "有效"
|
|
|
}
|
|
|
if (row.status == 0) {
|
|
|
return "失效"
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
display: '操作', name: 'operator', width: '10%', align: "center", isSort: false,
|
|
|
render: function (row) {
|
|
|
var html = '';
|
|
|
html += '<a style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "taskRule:info:view", row.id) + '">查看</a>';
|
|
|
<sec:authorize url="/admin/taskRule/update">
|
|
|
html += '<a style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "taskRule:info:edit", row.id) + '">编辑</a>';
|
|
|
</sec:authorize>
|
|
|
<%--<sec:authorize url="/admin/taskRule/delete">
|
|
|
html += '<a style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "taskRule:info:del", row.id) + '">删除</a>';
|
|
|
</sec:authorize>--%>
|
|
|
return html;
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
}));
|
|
|
// 自适应宽度
|
|
|
this.grid.adjustToWidth();
|
|
|
this.bindEvents();
|
|
|
},
|
|
|
reloadGrid: function (msg) {
|
|
|
taskRule.$element.attrScan();
|
|
|
var values = taskRule.$element.Fields.getValues();
|
|
|
values.type = taskRule.typeBox.getValue();
|
|
|
values.period = taskRule.periodBox.getValue();
|
|
|
values.status = taskRule.statusBox.getValue();
|
|
|
reloadGrid.call(this,{"taskRule":JSON.stringify(values)});
|
|
|
},
|
|
|
delRecord: function (id, code) {
|
|
|
var self = this;
|
|
|
$.ajax({
|
|
|
url: ctx + "/admin/taskRule/delete",
|
|
|
data: {"id": id},
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
|
success: function (result) {
|
|
|
if (result.status == '200') {
|
|
|
window.reloadMasterGrid(result.msg);
|
|
|
} else {
|
|
|
$.Notice.error(result.msg);
|
|
|
}
|
|
|
},
|
|
|
error: function (data) {
|
|
|
$.Notice.error("系统异常,请联系管理员!");
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
bindEvents: function () {
|
|
|
var self = this;
|
|
|
$.subscribe('taskRule:info:view', function (event, id) {
|
|
|
var title = '查看信息';
|
|
|
self.deviceInfoDialog = $.ligerDialog.open({
|
|
|
height: 600,
|
|
|
width: 560,
|
|
|
urlParms: {"id": id, "type": "view"},
|
|
|
title: title,
|
|
|
url: ctx + '/admin/taskRule/infoInit'
|
|
|
})
|
|
|
});
|
|
|
$.subscribe('taskRule:info:edit', function (event, id) {
|
|
|
var title = '编辑信息';
|
|
|
self.taskRuleInfoDialog = $.ligerDialog.open({
|
|
|
height: 600,
|
|
|
width: 560,
|
|
|
urlParms: {"id": id, "type": "edit"},
|
|
|
title: title,
|
|
|
url: ctx + '/admin/taskRule/infoInit'
|
|
|
})
|
|
|
});
|
|
|
|
|
|
$.subscribe('taskRule:info:create', function (event) {
|
|
|
var title = '新增活动';
|
|
|
self.taskRuleInfoDialog = $.ligerDialog.open({
|
|
|
height: 600,
|
|
|
width: 560,
|
|
|
urlParms: {"type": "create"},
|
|
|
title: title,
|
|
|
url: ctx + '/admin/taskRule/init'
|
|
|
})
|
|
|
});
|
|
|
|
|
|
$.subscribe('taskRule:info:del', function (event, id, code) {
|
|
|
$.ligerDialog.confirm('确认删除该行信息?<br>如果是请点击确认按钮,否则请点击取消。', function (yes) {
|
|
|
if (yes) {
|
|
|
self.delRecord(id, code);
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
};
|
|
|
/* ************************* Dialog页面回调接口 ************************** */
|
|
|
win.reloadMasterGrid = function (msg) {
|
|
|
if (isNoEmpty(msg)) {
|
|
|
$.Notice.success(msg);
|
|
|
}
|
|
|
master.reloadGrid(msg);
|
|
|
};
|
|
|
win.closeTaskRuleInfoDialog = function () {
|
|
|
master.taskRuleInfoDialog.close();
|
|
|
};
|
|
|
/* *************************** 页面初始化 **************************** */
|
|
|
pageInit();
|
|
|
});
|
|
|
})(jQuery, window);
|
|
|
|
|
|
</script>
|