xfrontend/web/srczip/logic/kanbanshezhi.js
2021-07-23 14:37:55 +08:00

80 lines
3.3 KiB
JavaScript

(function(){
X.pageLogic['kanbanshezhi'] = {
init : function(){
var me = this;
// 弹窗占满整平
$('.kanbanshezhi-box').css('height',window.innerHeight+'px');
// me.renderdata();
//关闭弹窗
$('.kanbanshezhi-top .kanbanshezhi-tuihui').click(function(){
layer.closeAll();
})
// 更新方式
$(".kanbanshezhi-list-box .gxfs").click(function(){
var datatype = $(this).attr('data-type');
$(".kanbanshezhi-list-box .gxfs").removeClass('kanbanshezhi-list-on');
$(this).addClass('kanbanshezhi-list-on');
if(datatype == "realtime"){
$(".gxfs .ssgx").prop("checked", true);
$(".gxfs .dsgx").prop("checked", false);
$(".ddgxsele").attr("disabled", true); //禁用下拉框
}else{
$(".gxfs .ssgx").prop("checked", false);
$(".gxfs .dsgx").prop("checked", true);
$(".ddgxsele").removeAttr("disabled");//启用下拉框
}
})
$(".kanbanshezhi-but-box .kanbanshezhi-qd").click(function(){
var calculation = $(".kanbanshezhi-list-left .jsjs").prop("checked"); //计算
var timezoneset = $(".kanbanshezhi-list-left .sqsz").prop("checked"); //时区
var updatemode = $(".kanbanshezhi-list-box .kanbanshezhi-list-on").attr("data-type");
var timezone = $(".sqsz-select").val(); //时区
var timingtime = $(".ddgxsele").val(); //定时更新事件
var data = {
'type':'modify',
'updatemode':updatemode,
'timezoneset':timezoneset,
'calculation':calculation,
'timingtime':timingtime,
'timezone':timezone,
}
X.api("api/kanbanset",data,function(d){
// 修改成功
me.renderdata();
})
})
},
renderdata : function(){
X.api("api/kanbanset",{},function(d){
// console.log(d);
if(d.updatemode == 'timing'){
$(".gxfs .ssgx").prop("checked", false);
$(".gxfs .dsgx").prop("checked", true);
$(".ddgxsele").removeAttr("disabled");//启用下拉框
$(".ddgxsele").val(d.timingtime);
$("#dsgx").addClass('kanbanshezhi-list-on');
}else {
$(".gxfs .ssgx").prop("checked", true);
$(".gxfs .dsgx").prop("checked", false);
$(".ddgxsele").removeAttr("disabled", true);//禁用下拉框
$("#ssgx").addClass('kanbanshezhi-list-on');
}
if(d.calculation){
$(".kanbanshezhi-list-left .jsjs").prop("checked",true);
}
if(d.timezoneset){
$(".kanbanshezhi-list-left .sqsz").prop("checked",true);
$(".sqsz-select").val(d.timezone)
}
layui.form.render();
})
}
};
})();