优化会长信息被置空bug

master
chenzhi 3 years ago
parent 91354a0908
commit c0c6a2b640

@ -193,106 +193,107 @@
<script> <script>
var dataTransfer = ''; var dataTransfer = '';
$.ajax({ $(function () {
url: "{:U('getRootPromote')}", layui.use(['transfer', 'layer', 'util'], function(){
type: "post", var $ = layui.$ ,transfer = layui.transfer,layer = layui.layer ,util = layui.util;
data: {group_id: $('#group_id').val()}, $.ajax({
dataType: 'json', url: "{:U('getRootPromote')}",
success: function (data) { type: "post",
// datas = data; data: {group_id: $('#group_id').val()},
layui.use(['transfer', 'layer', 'util'], function(){ dataType: 'json',
var $ = layui.$ success: function (data) {
,transfer = layui.transfer // datas = data;
,layer = layui.layer var data1 =data;
,util = layui.util; var data2 = [];
if (JSON.parse(data1).data_president) {
var data1 =data; data2 = JSON.parse(data1).data_president.split(",");
var data2 = []; }
if (JSON.parse(data1).data_president) { // var dataTransfers = transfer.getData('key123');
data2 = JSON.parse(data1).data_president.split(","); // $('#promote_data').val(JSON.stringify(dataTransfers));
} //显示搜索框
// var dataTransfers = transfer.getData('key123'); transfer.render({
// $('#promote_data').val(JSON.stringify(dataTransfers)); elem: '#test4'
//显示搜索框 ,data: JSON.parse(data1).list
transfer.render({ ,title: ['全部成员', '选中成员']
elem: '#test4' ,showSearch: true,
,data: JSON.parse(data1).list value: data2,
,title: ['全部成员', '选中成员'] id: 'key123',
,showSearch: true, onchange: function(data, index){
value: data2,
id: 'key123', dataTransfer = transfer.getData('key123'); //获取右侧数据
onchange: function(data, index){
if (index == 0) {
dataTransfer = transfer.getData('key123'); //获取右侧数据
for (var i=0;i<data.length;i++) {
if (index == 0) { data2.push(data[i]['value']);
}
for (var i=0;i<data.length;i++) { $('#promote_data').val(JSON.stringify(dataTransfer));
data2.push(data[i]['value']); return;
} } else if (index == 1){
$('#promote_data').val(JSON.stringify(dataTransfer));
return; for(var i=0;i<data2.length;i++)
} else if (index == 1){ {
console.log(data2[i])
for(var i=0;i<data2.length;i++) for(var j=0;j<data.length;j++) {
{ if (data2[i]==data[j]['value']) {
console.log(data2[i]) data2.splice(i,1);
for(var j=0;j<data.length;j++) { i=i-1;
if (data2[i]==data[j]['value']) { }
data2.splice(i,1);
i=i-1;
} }
} }
// data2.push(data[0]['value']);
transfer.reload('key123',{elem: '#test4',data: JSON.parse(data1).list,title: ['全部成员', '选中成员'],showSearch: true,value: data2,id: 'key123'});
dataTransfer = transfer.getData('key123');
$('#promote_data').val(JSON.stringify(dataTransfer));
return;
} }
// data2.push(data[0]['value']);
transfer.reload('key123',{elem: '#test4',data: JSON.parse(data1).list,title: ['全部成员', '选中成员'],showSearch: true,value: data2,id: 'key123'});
dataTransfer = transfer.getData('key123');
$('#promote_data').val(JSON.stringify(dataTransfer));
return;
} }
})
var dataTransfers = transfer.getData('key123');
$('#promote_data').val(JSON.stringify(dataTransfers));
transfets = transfer;
//批量办法定事件
util.event('lay-demoTransferActive', {
getData: function(othis){
var getData = transfer.getData('key123'); //获取右侧数据
layer.alert(JSON.stringify(getData));
}
,reload:function(){
//实例重载
transfer.reload('key123', {
title: ['文人', '喜欢的文人']
,value: ['2', '5', '9']
,showSearch: true
})
}
});
}
}) }
});
var dataTransfers = transfer.getData('key123');
$('#promote_data').val(JSON.stringify(dataTransfers));
transfets = transfer;
//批量办法定事件
util.event('lay-demoTransferActive', {
getData: function(othis){
var getData = transfer.getData('key123'); //获取右侧数据
layer.alert(JSON.stringify(getData));
}
,reload:function(){
//实例重载
transfer.reload('key123', {
title: ['文人', '喜欢的文人']
,value: ['2', '5', '9']
,showSearch: true
})
}
});
});
}
});
$(function () {
var status = $('input:radio[name="data_empower_type"]:checked').val();
$('#status').val(status);
});
$(":radio").click(function () {
var status = $('input:radio[name="data_empower_type"]:checked').val(); var status = $('input:radio[name="data_empower_type"]:checked').val();
$('#status').val(status); $('#status').val(status);
if (status != 2) { ajaxPostCallback(function(){
$("#test4").css('display','none'); dataTransfer = transfer.getData('key123');
$('#promote_data').val('[]');
} else {
$("#test4").css('display','block');
$('#promote_data').val(JSON.stringify(dataTransfer)); $('#promote_data').val(JSON.stringify(dataTransfer));
} })
})
$(":radio").click(function () {
var status = $('input:radio[name="data_empower_type"]:checked').val();
$('#status').val(status);
if (status != 2) {
$("#test4").css('display','none');
$('#promote_data').val('[]');
} else {
$("#test4").css('display','block');
$('#promote_data').val(JSON.stringify(dataTransfer));
}
})
});
});
</script> </script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
@ -300,7 +301,7 @@
location.href = this.value; location.href = this.value;
}); });
//导航高亮 //导航高亮
highlight_subnav('{:U('AuthManager/index')}'); highlight_subnav("{:U('AuthManager/index')}");
</script> </script>
<style> <style>

@ -406,6 +406,36 @@ function showTab() {
$("." + target).addClass("in"); $("." + target).addClass("in");
}).filter("[data-tab=tab" + window.location.hash.substr(1) + "]").click(); }).filter("[data-tab=tab" + window.location.hash.substr(1) + "]").click();
} }
function ajaxPostCallback(callback){
$('.ajax-post').off("click");
$('.ajax-post').click(function(){
callback();
var that = $(this);
if(check_post_submit(that)) {
if ( that.hasClass('confirm') ) {
post_delnotic(that);
} else if(that.hasClass('confirm_dialog')){
post_confirm_dialog(that);
} else if(that.hasClass('pack')) {
post_submit(that);
} else if(that.hasClass('ajax-loading')) {
updateAlert('正在提交');
post_submit(that);
} else {
post_submit(that);
}
} else {
updateAlert('请选择需要操作的数据','tip_error');
setTimeout(function(){
$('#tip').find('.tipclose').click();
},1500);
}
return false;
});
}
function oldshowTab() { function oldshowTab() {
$(".tab-nav li").click(function(){ $(".tab-nav li").click(function(){
var self = $(this), target = self.data("tab"); var self = $(this), target = self.data("tab");

Loading…
Cancel
Save