...
|
...
|
@@ -31,15 +31,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
|
columns: [
|
|
|
[
|
|
|
{checkbox: true},
|
|
|
{field: 'id', title: __('Id')},
|
|
|
{field: 'course.name', title: __('Course_id')},
|
|
|
{field: 'store.name', title: __('Store_id')},
|
|
|
{field: 'date', title: __('Date'), operate: 'RANGE', addclass: 'datetimerange'},
|
|
|
{field: 'time_start', title: __('Time_start')},
|
|
|
{field: 'count', title: __('Count')},
|
|
|
{field: 'notify_count', title: __('Notify_count')},
|
|
|
{field: 'sign_count', title: __('Sign_count')},
|
|
|
{field: 'time_end', title: __('Time_end')},
|
|
|
{field: 'id', title: __('Id'),sortable: true},
|
|
|
{field: 'course.name', title: __('Course_id'),sortable: true},
|
|
|
{field: 'store.name', title: __('Store_id'),sortable: true},
|
|
|
{field: 'date', title: __('Date'), operate: 'RANGE', addclass: 'datetimerange',sortable: true},
|
|
|
{field: 'time_start', title: __('Time_start'),sortable: true},
|
|
|
{field: 'count', title: __('Count'),sortable: true},
|
|
|
{field: 'teacher', title: __('Teacher'),sortable: true},
|
|
|
{field: 'notify_count', title: __('Notify_count'),sortable: true},
|
|
|
{field: 'sign_count', title: __('Sign_count'),sortable: true},
|
|
|
{field: 'time_end', title: __('Time_end'),sortable: true},
|
|
|
{field: 'status', title: __('Status'), formatter: function (value) {
|
|
|
var color = 'red';
|
|
|
if (value === 'new') {
|
...
|
...
|
@@ -49,7 +50,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
|
color = 'black';
|
|
|
}
|
|
|
return '<span style="color:' + color + '">' + __(value) + '</span>';
|
|
|
}},
|
|
|
},sortable: true},
|
|
|
{
|
|
|
field : 'operate', title: __('Operate'), table: table, buttons: [
|
|
|
{
|
...
|
...
|
@@ -98,6 +99,111 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
|
Table.api.bindevent(table);
|
|
|
|
|
|
//发布
|
|
|
$(document).on("click",".btn-publishAll",function (e) {
|
|
|
var temp=table.bootstrapTable('getSelections');
|
|
|
var arr = [];
|
|
|
var a = true;
|
|
|
$.each(temp, function(key, value){
|
|
|
if(value.status !=='new'){
|
|
|
Layer.open({title: '错误', content: '含有已发布或取消的课程', btn: '确定'});
|
|
|
a = false;
|
|
|
return false;
|
|
|
}
|
|
|
arr.push(value.id);
|
|
|
});
|
|
|
if(a){
|
|
|
$.ajax({
|
|
|
type : "POST",
|
|
|
url : "course_store/publishAll",
|
|
|
data : {
|
|
|
arr : arr,
|
|
|
},
|
|
|
dataType: "json",
|
|
|
success : function (data) {
|
|
|
if (data.code === 1) {
|
|
|
Layer.msg('发布成功');
|
|
|
Layer.closeAll();
|
|
|
$('.btn-refresh').trigger('click')
|
|
|
} else {
|
|
|
Layer.msg('发布失败');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//发布
|
|
|
$(document).on("click",".btn-publishAll",function (e) {
|
|
|
var temp=table.bootstrapTable('getSelections');
|
|
|
var arr = [];
|
|
|
var a = true;
|
|
|
$.each(temp, function(key, value){
|
|
|
if(value.status !=='new'){
|
|
|
Layer.open({title: '错误', content: '含有已发布或取消的课程', btn: '确定'});
|
|
|
a = false;
|
|
|
return false;
|
|
|
}
|
|
|
arr.push(value.id);
|
|
|
});
|
|
|
if(a){
|
|
|
$.ajax({
|
|
|
type : "POST",
|
|
|
url : "course_store/publishAll",
|
|
|
data : {
|
|
|
arr : arr,
|
|
|
},
|
|
|
dataType: "json",
|
|
|
success : function (data) {
|
|
|
if (data.code === 1) {
|
|
|
Layer.msg('发布成功');
|
|
|
Layer.closeAll();
|
|
|
$('.btn-refresh').trigger('click')
|
|
|
} else {
|
|
|
Layer.msg('发布失败');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//发布
|
|
|
$(document).on("click",".btn-deleteAll",function (e) {
|
|
|
var temp=table.bootstrapTable('getSelections');
|
|
|
var arr = [];
|
|
|
var a = true;
|
|
|
$.each(temp, function(key, value){
|
|
|
if(value.status !=='new'){
|
|
|
Layer.open({title: '错误', content: '含有已发布或取消的课程', btn: '确定'});
|
|
|
a = false;
|
|
|
return false;
|
|
|
}
|
|
|
arr.push(value.id);
|
|
|
});
|
|
|
if(a){
|
|
|
$.ajax({
|
|
|
type : "POST",
|
|
|
url : "course_store/deleteAll",
|
|
|
data : {
|
|
|
arr : arr,
|
|
|
},
|
|
|
dataType: "json",
|
|
|
success : function (data) {
|
|
|
if (data.code === 1) {
|
|
|
Layer.msg('发布成功');
|
|
|
Layer.closeAll();
|
|
|
$('.btn-refresh').trigger('click')
|
|
|
} else {
|
|
|
Layer.msg('发布失败');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//发布
|
|
|
$(document).on("click",".btn-publish",function (e) {
|
|
|
var id = $(this).data('publish-id');
|
|
|
var status = $(this).data('publish-status');
|
...
|
...
|
|