/**
|
* 跨城站点管理管理初始化
|
*/
|
var WorldCupGameStatisticsListInfo = {
|
id: "WorldCupGameStatisticsListInfoTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1,
|
storeIds: [],
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
WorldCupGameStatisticsListInfo.initColumn = function () {
|
return [
|
{field: 'selectItem', checkbox: true},
|
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '用户姓名', field: 'name', visible: true, align: 'center', valign: 'middle',},
|
{title: '比赛时间', field: 'startTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '比分', field: 'score', visible: true, align: 'center', valign: 'middle'},
|
{title: '结果', field: 'matchResult', visible: true, align: 'center', valign: 'middle'},
|
{title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle',
|
formatter:function (data, item) {
|
return '<a href="#" onclick="WorldCupGameStatisticsListInfo.changeScore(\'' + data + '\',' + item.blue + ',' + item.red + ')" style="color:blue;">修改比分</a>';
|
}
|
},
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
WorldCupGameStatisticsListInfo.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
WorldCupGameStatisticsListInfo.seItem = selected[0];
|
return true;
|
}
|
};
|
/**
|
* 商户号认证
|
*/
|
WorldCupGameStatisticsListInfo.changeScore = function (id, blue, red) {
|
const str = '<div class="row">\n' +
|
' <div class="form-group" style="height: 50px;">\n' +
|
' <label class="col-sm-3 control-label" style="text-align: right;">蓝方得分:</label>' +
|
' <div class="col-sm-8">\n' +
|
' <input id="blue" class="form-control" type="number" min="0" value="' + blue + '"/>\n' +
|
' </div>\n' +
|
' </div>\n' +
|
' <div class="form-group" style="height: 50px;">\n' +
|
' <label class="col-sm-3 control-label" style="text-align: right;">红方得分:</label>' +
|
' <div class="col-sm-8">\n' +
|
' <input id="red" class="form-control" type="number" min="0" value="' + red + '"/>\n' +
|
' </div>\n' +
|
' </div>\n' +
|
' </div>'
|
layer.open({
|
type: 1
|
,title: '修改比分'
|
,area: ['500px', '300px']
|
,offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
|
,id: 'layerDemo' //防止重复弹出
|
,content: '<div style="padding: 20px">' + str + '</div>'
|
,btnAlign: 'c' //按钮居中
|
,shade: 0.5 //不显示遮罩
|
,btn: ['确认', '关闭']
|
,yes: function (){
|
let blue = $('#blue').val();
|
let red = $('#red').val();
|
if(null == blue || '' == blue){
|
Feng.error("请填写有效的得分");
|
return
|
}
|
if(null == red || '' == red){
|
Feng.error("请填写有效的得分");
|
return
|
}
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/worldCupRecords/changeScore", function (res) {
|
if (res.code==200){
|
Feng.success("修改成功!");
|
WorldCupGameStatisticsListInfo.search();
|
layer.closeAll();
|
}else{
|
Feng.error(res.msg);
|
}
|
}, function (data) {
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set({
|
'id': id,
|
'blue': blue,
|
'red': red
|
});
|
ajax.start();
|
}
|
});
|
};
|
|
WorldCupGameStatisticsListInfo.selecUserOpt = function (arrays){
|
console.log(3333)
|
//获取所有的值
|
var subArr= this.storeIds;
|
$(".timeClass").each(function () {
|
subArr.push($(this).find("input[name*='id']").val());
|
});
|
var str = '';
|
for(var i in arrays){
|
var b = true;
|
for(var j in subArr){
|
if(arrays[i].id === Number(subArr[j])){
|
b = false;
|
break
|
}
|
}
|
if(b){
|
this.storeIds.push(arrays[i].id)
|
str += '<tr class="timeClass">' +
|
'<td><input type="hidden" id="id" name="id" value="'+arrays[i].id+'"><input type="hidden" id="id" name="id" value="'+arrays[i].id+'">' + arrays[i].id + '</td>' +
|
'<td><input type="hidden" id="name" name="name" value="'+arrays[i].name+'">' + arrays[i].name + '</td>' +
|
'<td><input type="hidden" id="phone" name="phone" value="'+arrays[i].phone+'">' + arrays[i].phone +
|
'<td><input type="hidden" id="sex" name="sex" value="'+arrays[i].sex+'">' + arrays[i].sex +
|
'<td><input type="hidden" id="age" name="age" value="'+arrays[i].age+'">' + arrays[i].age +
|
'</td><td><button onclick="deleteSub(this)">移除</button></td></tr>';
|
}
|
}
|
console.log("添加门店后的场地数组和门店数组")
|
console.log(this.storeIds)
|
console.log(this.siteIds)
|
$("#coun").append(str);
|
}
|
function deleteSub(e) {
|
console.log(e);
|
var row = $(e).closest('tr');
|
var value = row.find('#id').val();
|
WorldCupGameStatisticsListInfo.storeIds.splice(WorldCupGameStatisticsListInfo.storeIds.indexOf(parseInt(value)), 1)
|
$(e).parent().parent().remove();
|
console.log('storeIds',WorldCupGameStatisticsListInfo.storeIds)
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
WorldCupGameStatisticsListInfo.close = function() {
|
parent.layer.close(window.parent.WorldCupGameStatisticsInfo.layerIndex);
|
};
|
|
WorldCupGameStatisticsListInfo.search = function () {
|
var queryData = {};
|
queryData['participantId'] = $("#participantId").val();
|
queryData['participantType'] = $("#participantType").val();
|
queryData['name'] = $("#name").val();
|
WorldCupGameStatisticsListInfo.table.refresh({query: queryData});
|
};
|
|
WorldCupGameStatisticsListInfo.resetSearch = function () {
|
$("#name").val("");
|
WorldCupGameStatisticsListInfo.search();
|
};
|
|
$(function () {
|
var defaultColunms = WorldCupGameStatisticsListInfo.initColumn();
|
var table = new BSTable(WorldCupGameStatisticsListInfo.id, "/worldCupRecords/worldCupGameStatisticsListInfo", defaultColunms);
|
table.setPaginationType("server");
|
table.setQueryParams({
|
'participantId': $('#participantId').val(),
|
'participantType': $('#participantType').val()
|
})
|
WorldCupGameStatisticsListInfo.table = table.init();
|
|
});
|