优化会长信息被置空bug

master
chenzhi 3 years ago
parent 91354a0908
commit c0c6a2b640

@ -193,106 +193,107 @@
<script>
var dataTransfer = '';
$.ajax({
url: "{:U('getRootPromote')}",
type: "post",
data: {group_id: $('#group_id').val()},
dataType: 'json',
success: function (data) {
// datas = data;
layui.use(['transfer', 'layer', 'util'], function(){
var $ = layui.$
,transfer = layui.transfer
,layer = layui.layer
,util = layui.util;
var data1 =data;
var data2 = [];
if (JSON.parse(data1).data_president) {
data2 = JSON.parse(data1).data_president.split(",");
}
// var dataTransfers = transfer.getData('key123');
// $('#promote_data').val(JSON.stringify(dataTransfers));
//显示搜索框
transfer.render({
elem: '#test4'
,data: JSON.parse(data1).list
,title: ['全部成员', '选中成员']
,showSearch: true,
value: data2,
id: 'key123',
onchange: function(data, index){
dataTransfer = transfer.getData('key123'); //获取右侧数据
if (index == 0) {
for (var i=0;i<data.length;i++) {
data2.push(data[i]['value']);
}
$('#promote_data').val(JSON.stringify(dataTransfer));
return;
} else if (index == 1){
for(var i=0;i<data2.length;i++)
{
console.log(data2[i])
for(var j=0;j<data.length;j++) {
if (data2[i]==data[j]['value']) {
data2.splice(i,1);
i=i-1;
$(function () {
layui.use(['transfer', 'layer', 'util'], function(){
var $ = layui.$ ,transfer = layui.transfer,layer = layui.layer ,util = layui.util;
$.ajax({
url: "{:U('getRootPromote')}",
type: "post",
data: {group_id: $('#group_id').val()},
dataType: 'json',
success: function (data) {
// datas = data;
var data1 =data;
var data2 = [];
if (JSON.parse(data1).data_president) {
data2 = JSON.parse(data1).data_president.split(",");
}
// var dataTransfers = transfer.getData('key123');
// $('#promote_data').val(JSON.stringify(dataTransfers));
//显示搜索框
transfer.render({
elem: '#test4'
,data: JSON.parse(data1).list
,title: ['全部成员', '选中成员']
,showSearch: true,
value: data2,
id: 'key123',
onchange: function(data, index){
dataTransfer = transfer.getData('key123'); //获取右侧数据
if (index == 0) {
for (var i=0;i<data.length;i++) {
data2.push(data[i]['value']);
}
$('#promote_data').val(JSON.stringify(dataTransfer));
return;
} else if (index == 1){
for(var i=0;i<data2.length;i++)
{
console.log(data2[i])
for(var j=0;j<data.length;j++) {
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();
$('#status').val(status);
if (status != 2) {
$("#test4").css('display','none');
$('#promote_data').val('[]');
} else {
$("#test4").css('display','block');
ajaxPostCallback(function(){
dataTransfer = transfer.getData('key123');
$('#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 type="text/javascript" charset="utf-8">
@ -300,7 +301,7 @@
location.href = this.value;
});
//导航高亮
highlight_subnav('{:U('AuthManager/index')}');
highlight_subnav("{:U('AuthManager/index')}");
</script>
<style>

@ -406,6 +406,36 @@ function showTab() {
$("." + target).addClass("in");
}).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() {
$(".tab-nav li").click(function(){
var self = $(this), target = self.data("tab");

Loading…
Cancel
Save