Authored by chenchao

add checkbox

... ... @@ -2,6 +2,22 @@ var $ = require('jquery'),
common = require('../../../../common/common');
var promotionEdit={
batchId:[],
buildCheckboxHtml:function(_class,_data_index,_checked){
var _checkBox="<input type='checkbox'";
var _end="/>",
if(_class){
_checkBox+=" class='"+_class+"'";
}
if(_data_index){
_checkBox+=" data-index='"+_data_index+"'";
}
if(_checked){
_checkBox+=" checked='"+_checked+"'";
}
_checkBox+=_end;
return _checkBox;
},
getParam:function(){
var param={
el: '#basicTable_promotion',
... ... @@ -12,52 +28,76 @@ var promotionEdit={
endTime:common.util.__input("endTime")
};
},
columns: [{
display: "ID",
name: "id"
}, {
display: "促销名称",
name: "title"
}, {
display: '优先级',
name: "priority"
}, {
display: '开始时间',
name: "startTime",
render: function(item) {
var date = new Date(item.startTime * 1000);
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
}
}, {
display: '结束时间',
name: "endTime",
render: function(item) {
var date = new Date(item.endTime * 1000);
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
}
}, {
display: '是否启用',
name: "status",
render: function(item) {
if(item.status==1){
var name ="已启用" ;
}else {
var name ="未启用" ;
columns: [
{
display: '',
type: 'checkbox',
render: function (item) {
var htmlContent = "";
var _class="wqt_checkbox";
if(this.batchId.length == 0 ){
//htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";
htmlContent = this.buildCheckboxHtml(_class,item.__index,null);
}else{
$.each(this.batchId,function(n,value) {
if(item.id == value){
//htmlContent = "<input type='checkbox' checked='checked' class='wqt_checkbox' data-index='"+item.__index+"'>";
htmlContent = this.buildCheckboxHtml(_class,item.__index,"checked");
return false
}else{
//htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";
htmlContent = this.buildCheckboxHtml(_class,item.__index,null);
}
})
}
return htmlContent;
}
},{
display: "ID",
name: "id"
}, {
display: "促销名称",
name: "title"
}, {
display: '优先级',
name: "priority"
}, {
display: '开始时间',
name: "startTime",
render: function(item) {
var date = new Date(item.startTime * 1000);
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
}
}, {
display: '结束时间',
name: "endTime",
render: function(item) {
var date = new Date(item.endTime * 1000);
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
}
}, {
display: '是否启用',
name: "status",
render: function(item) {
if(item.status==1){
var name ="已启用" ;
}else {
var name ="未启用" ;
}
return name;
}
return name;
}
}, {
display: '优惠券限制使用',
name: "status",
render: function(item) {
if(item.status==1){
var name ="是" ;
}else {
var name ="否" ;
}, {
display: '优惠券限制使用',
name: "status",
render: function(item) {
if(item.status==1){
var name ="是" ;
}else {
var name ="否" ;
}
return name;
}
return name;
}
}]
}]
};
return param;
},
... ...