新增分区逻辑

This commit is contained in:
liaozetao
2024-04-09 19:05:17 +08:00
parent bbd1b33996
commit 3641f36bb4
21 changed files with 1120 additions and 160 deletions

View File

@@ -50,6 +50,14 @@
</div>
<div class="modal-body">
<form class="form-horizontal" id="bannerForm">
<div id="bannerPartitionDiv">
<div class="form-group">
<label name="partition" class="col-sm-3 control-label">选择地区*:</label>
<div class="form-check" id = "partitionCheck">
<!-- 分区展示-->
</div>
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-3 control-label">Banner名字:</label>
<div class="col-sm-8">
@@ -205,6 +213,14 @@
</div>
<div class="modal-body">
<form id="addBannerForm" class="form-horizontal">
<div id="bannerAddPartitionDiv">
<div class="form-group">
<label name="partition" class="col-sm-3 control-label">选择地区*:</label>
<div class="form-check" id = "partitionAddCheck">
<!-- 分区展示-->
</div>
</div>
</div>
<div class="form-group">
<label for="addName" class="col-sm-3 control-label">Banner名字:</label>
<div class="col-sm-8">
@@ -437,6 +453,7 @@ export default {
$('#table').bootstrapTable({
columns: [
{ field: 'sel', title: 'ID', align: 'center', valign: 'middle', checkbox: true, width: '1%' },
{field: 'partitionDesc', title: '地区', align: 'center', valign: 'middle', width: '5%'},
{ field: 'bannerId', title: 'bannerID', align: 'center', valign: 'middle', width: '5%' },
{ field: 'bannerName', title: '名称', align: 'center', valign: 'middle', width: '10%' },
{
@@ -646,39 +663,66 @@ export default {
$('.titleListDev').addClass("hidden");
var bannerId = parseInt($(this).data('id'));
isEdit = true;
debugger
$.ajax({
type: "get",
url: "/admin/banner/get.action",
data: { bannerId: bannerId },
dataType: "json",
type: 'get',
url: '/partition/listPartitionInfo.action',
dataType: 'json',
success: function (json) {
if (json.code == 200) {
var date = json.data.endTime ? new Date(json.data.endTime).format("yyyy-MM-dd hh:mm:ss") : '';
var startDate = json.data.startTime ? new Date(json.data.startTime).format("yyyy-MM-dd hh:mm:ss") : '';
$('#name').val(json.data.bannerName);
$('#imgUrl').attr('src', json.data.bannerPic);
$('#bannerPic').val(json.data.bannerPic);
$('#skipUrlSort').val(json.data.skipType);
$('#skipUrlContent').val(json.data.skipUri);
$("#bannerType").val(json.data.bannerType);
$('#seqNo').val(json.data.seqNo);
//$("#appId").val(json.data.appId);
$('#iosVersion').val(json.data.iosVersion);
$('#androidVersion').val(json.data.androidVersion);
$('#noShowChannels').val(json.data.noShowChannels);
$('#bannerStatus').val(json.data.bannerStatus);
$('#startDate').val(startDate);
$('#endDate').val(date);
$('#bannerId').val(json.data.bannerId);
$('#platform').val(json.data.platform);
$('#limitLevelExper').val(json.data.limitLevelExper);
$('#showType').val(json.data.showType);
$('#showRule').val(json.data.showRule);
window.selectOnChange(json.data.bannerType, json.data.titleId);
$('#titleList').val(json.data.titleId);
$('#bannerModal').modal('show');
// picker1.datetimepicker('setStartDate', startDate);
var length = json.data.length;
var partitionCheck = $("#partitionCheck");
partitionCheck.empty();
// 分区
for (var i = 0; i < length; i++) {
var checkbox = $("<input>", {type: "checkbox", id: "checkbox" + json.data[i].id, name: "partitionIds", value: json.data[i].id});
var label = $("<label>", {class: "partition-checkbox-label", text: json.data[i].desc});
partitionCheck.append(checkbox,label);
}
$.ajax({
type: "get",
url: "/admin/banner/get.action",
data: { bannerId: bannerId },
dataType: "json",
success: function (json) {
if (json.code == 200) {
var date = json.data.endTime ? new Date(json.data.endTime).format("yyyy-MM-dd hh:mm:ss") : '';
var startDate = json.data.startTime ? new Date(json.data.startTime).format("yyyy-MM-dd hh:mm:ss") : '';
$('#name').val(json.data.bannerName);
$('#imgUrl').attr('src', json.data.bannerPic);
$('#bannerPic').val(json.data.bannerPic);
$('#skipUrlSort').val(json.data.skipType);
$('#skipUrlContent').val(json.data.skipUri);
$("#bannerType").val(json.data.bannerType);
$('#seqNo').val(json.data.seqNo);
//$("#appId").val(json.data.appId);
$('#iosVersion').val(json.data.iosVersion);
$('#androidVersion').val(json.data.androidVersion);
$('#noShowChannels').val(json.data.noShowChannels);
$('#bannerStatus').val(json.data.bannerStatus);
$('#startDate').val(startDate);
$('#endDate').val(date);
$('#bannerId').val(json.data.bannerId);
$('#platform').val(json.data.platform);
$('#limitLevelExper').val(json.data.limitLevelExper);
$('#showType').val(json.data.showType);
$('#showRule').val(json.data.showRule);
window.selectOnChange(json.data.bannerType, json.data.titleId);
$('#titleList').val(json.data.titleId);
// 分区信息
var partitionIds = json.data.partitionIds;
var length = partitionIds.length;
for (var i = 0; i < length; i++) {
$("#checkbox" + partitionIds[i]).prop('checked', true);
}
$('#bannerModal').modal('show');
// picker1.datetimepicker('setStartDate', startDate);
} else {
$("#tipMsg").text("获取信息出错");
$("#tipModal").modal('show');
}
}
});
} else {
$("#tipMsg").text("获取信息出错");
$("#tipModal").modal('show');
@@ -756,6 +800,32 @@ export default {
$('#addStartDate').val('');
$('#addEndDate').val('');
// 分区处理
$.ajax({
type: 'get',
url: '/partition/listPartitionInfo.action',
dataType: 'json',
success: function (json) {
if (json.code == 200) {
var length = json.data.length;
var partitionCheck = $("#partitionAddCheck");
partitionCheck.empty();
// 创建3个checkbox元素并添加到myDiv元素上
for (var i = 0; i < length; i++) {
var checkbox = $("<input>", {
type: "checkbox",
id: "checkbox" + json.data[i].id,
name: "partitionIds",
value: json.data[i].id
});
var label = $("<label>", {class: "partition-checkbox-label", text: json.data[i].desc});
partitionCheck.append(checkbox, label);
}
}
}
});
// 处理appId
// $('#addAppId').empty();
// $('#addAppId').append('<option value="">请选择</option>');