xfrontend/web/srczip/logic/userlabel.js
2021-10-21 18:51:52 +08:00

69 lines
2.7 KiB
JavaScript

(function(){
X.pageLogic['userlabel'] = {
init : function(parms){
var me = this;
me.userlabellist();
$(document).off('click','.lable-dingyi').on('click','.lable-dingyi',function(){
X.gourl('userlabel_dy','conetnt');
});
$(document).off('click','.addlabeldata').on('click','.addlabeldata',function(){
X.DATA.userlabelid = "";
X.gourl('userlabel_dy','conetnt');
});
$(document).off('click','.lable-del').on('click','.lable-del',function(){
var _id = X.DATA.userlabelid;
layer.confirm('确认删除选中的标签吗?该操作不可恢复', {
btn: ['取消','删除 '] //按钮
}, function(){
//取消
layer.close(layer.index);
}, function(){
//删除
X.api("user_label/del",'post',{label_id: _id},function(d){
layer.msg('删除成功');
layer.close(layer.index);
me.userlabellist();
})
});
});
// X.api('user_label/read','post',{project_id: X.DATA.projectid},function(d){
// console.log(d);
// })
// 监听单行事件
layui.table.on('row(userlabeltest)',function(obj){
var data = obj.data
console.log(data);
X.DATA.userlabelid = data._id;
X.laytpldata('#userlabel-right-box-dot',data,'.userlabel-right-box');
});
},
userlabellist : function(){
X.laytabledata("#userlabel-table","user_label/list",[[
{field:'cluster_name', title: '标签名', sort: true}
,{field:'display_name', title: '显示名'}
,{field:'act_name', title: '最后操作人'}
,{field:'cluster_type', title: '创建方式',templet:function(d){
if(d.cluster_type == "user_custom"){
return '自定义条件'
}else{
return '其他条件'
}
}}
// ,{fixed: 'right', title:'操作', toolbar: '#eventattradminbarDemo', width:80}
]],"&project_id="+X.DATA.projectid,'auto',function(res, curr, count){
// console.log(res);
if(res.data.length > 0){
X.DATA.userlabelid = res.data[0]._id;
X.laytpldata('#userlabel-right-box-dot',res.data[0],'.userlabel-right-box');
}
});
}
};
})();