页面按钮点击事件--增 删 改 查
//页面按钮点击事件
onClick: function(type, item) {
switch (type) {
case 0:
this.ajaxQuery(); //查询
break;
case 1:
this.add(); //执行
break;
case 2:
this.del(); //删除
break;
case 3:
this.edit(); //编辑
break;
default:
}
},
getChecked: function(callback) {
var list = [];
for (var i = 0; i < this.list.length; i++) {
if (this.list[i].checked) {
var item = this.list[i];
list.push(item);
}
}
if (callback && list.length > 0) {
callback(list);
}
},
add: function() {
$state.go("uc/licenseInput", { reload: true });
},
del: function() {
$ngBootbox.confirm({ message: "确认删除当前信息?", title: 'Please answer' })
.then(function() {
$scope.tab.getChecked(function(list) {
if (list && list.length > 0) {
var _list = ModelUtil.setPropertyList(list, 'status', 0);
}
});
console.log('Confirmed!');
}, function() {
console.log('Confirm dismissed!');
});
},
edit: function() {
this.getChecked(function(list) {
$state.go("uc/licenseEdit", { id: list[0]["id"] }, { reload: true });
});
}