Commit 7fd54f02 by 杨树贤

列设置查看

parent e1030a14
...@@ -359,6 +359,24 @@ ...@@ -359,6 +359,24 @@
]; ];
cols.push( cols.push(
); );
// 列显示设置缓存
let colSettingsKey = 'supplier_list_col_settings_{{request()->user->userId}}';
function applyColSettings() {
let settings = localStorage.getItem(colSettingsKey);
if (settings) {
settings = JSON.parse(settings);
for (let i = 0; i < cols.length; i++) {
let field = cols[i].field;
if (field && settings[field] !== undefined) {
cols[i].hide = !settings[field];
}
}
}
}
applyColSettings();
table.render({ table.render({
elem: '#list' elem: '#list'
, url: '/api/supplier/GetSupplierList' , url: '/api/supplier/GetSupplierList'
...@@ -447,6 +465,58 @@ ...@@ -447,6 +465,58 @@
admin.putTempData("needFreshDetail_supplier_id=" + supplierId, 1); admin.putTempData("needFreshDetail_supplier_id=" + supplierId, 1);
} }
//列设置
$("#col_setting").click(function () {
let html = '<div style="padding: 15px; max-height: 700px; overflow-y: auto;">';
html += '<form class="layui-form" lay-filter="colSettingForm">';
for (let i = 0; i < cols.length; i++) {
if (cols[i].type === 'checkbox') continue;
let field = cols[i].field;
let title = cols[i].title || '';
let checked = cols[i].hide ? '' : 'checked';
html += '<div class="layui-form-item" style="display:inline-block;width:33%;margin-bottom:5px;">';
html += '<input type="checkbox" name="' + field + '" lay-skin="primary" title="' + title + '" ' + checked + '>';
html += '</div>';
}
html += '</form></div>';
layer.open({
type: 1,
title: '显示列设置',
area: ['800px', '700px'],
content: html,
btn: ['确定', '取消'],
success: function (layero, index) {
form.render('checkbox', 'colSettingForm');
},
yes: function (index, layero) {
let settings = {};
let checkboxes = layero.find('input[type="checkbox"]');
checkboxes.each(function () {
let name = $(this).attr('name');
let checked = $(this).is(':checked');
settings[name] = checked;
});
localStorage.setItem(colSettingsKey, JSON.stringify(settings));
for (let i = 0; i < cols.length; i++) {
let field = cols[i].field;
if (field && settings[field] !== undefined) {
cols[i].hide = !settings[field];
}
}
table.reload('list', {
cols: [cols],
page: {curr: currentPage},
where: whereCondition
});
layer.close(index);
}
});
});
//新增供应商弹窗 //新增供应商弹窗
$("#add_supplier").click(function () { $("#add_supplier").click(function () {
index.openTab({ index.openTab({
......
...@@ -79,6 +79,9 @@ ...@@ -79,6 +79,9 @@
@if(checkPerm('TransferSupplier')) @if(checkPerm('TransferSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="transfer_supplier">供应商交接</button> <button type="button" class="layui-btn layui-btn-sm" id="transfer_supplier">供应商交接</button>
@endif @endif
@if(checkPerm('ConfirmCrmSupplier') && checkPerm('ViewConfirmSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="confirm_crm_supplier">确认客户转化供应商</button>
@endif
</div> </div>
<button type="button" id="refreshWindow" style="display: none">刷新页面</button> <button type="button" id="refreshWindow" style="display: none">刷新页面</button>
<table class="layui-table" id="list" lay-filter="list"></table> <table class="layui-table" id="list" lay-filter="list"></table>
......
...@@ -79,6 +79,10 @@ ...@@ -79,6 +79,10 @@
<?php if(checkPerm('TransferSupplier')): ?> <?php if(checkPerm('TransferSupplier')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="transfer_supplier">供应商交接</button> <button type="button" class="layui-btn layui-btn-sm" id="transfer_supplier">供应商交接</button>
<?php endif; ?> <?php endif; ?>
<?php if(checkPerm('ConfirmCrmSupplier') && checkPerm('ViewConfirmSupplier')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="confirm_crm_supplier">确认客户转化供应商</button>
<?php endif; ?>
<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="col_setting">列设置</button>
</div> </div>
<button type="button" id="refreshWindow" style="display: none">刷新页面</button> <button type="button" id="refreshWindow" style="display: none">刷新页面</button>
<table class="layui-table" id="list" lay-filter="list"></table> <table class="layui-table" id="list" lay-filter="list"></table>
......
...@@ -359,6 +359,24 @@ ...@@ -359,6 +359,24 @@
]; ];
cols.push( cols.push(
); );
// 列显示设置缓存
let colSettingsKey = 'supplier_list_col_settings_<?php echo e(request()->user->userId); ?>';
function applyColSettings() {
let settings = localStorage.getItem(colSettingsKey);
if (settings) {
settings = JSON.parse(settings);
for (let i = 0; i < cols.length; i++) {
let field = cols[i].field;
if (field && settings[field] !== undefined) {
cols[i].hide = !settings[field];
}
}
}
}
applyColSettings();
table.render({ table.render({
elem: '#list' elem: '#list'
, url: '/api/supplier/GetSupplierList' , url: '/api/supplier/GetSupplierList'
...@@ -447,6 +465,58 @@ ...@@ -447,6 +465,58 @@
admin.putTempData("needFreshDetail_supplier_id=" + supplierId, 1); admin.putTempData("needFreshDetail_supplier_id=" + supplierId, 1);
} }
//列设置
$("#col_setting").click(function () {
let html = '<div style="padding: 15px; max-height: 700px; overflow-y: auto;">';
html += '<form class="layui-form" lay-filter="colSettingForm">';
for (let i = 0; i < cols.length; i++) {
if (cols[i].type === 'checkbox') continue;
let field = cols[i].field;
let title = cols[i].title || '';
let checked = cols[i].hide ? '' : 'checked';
html += '<div class="layui-form-item" style="display:inline-block;width:33%;margin-bottom:5px;">';
html += '<input type="checkbox" name="' + field + '" lay-skin="primary" title="' + title + '" ' + checked + '>';
html += '</div>';
}
html += '</form></div>';
layer.open({
type: 1,
title: '显示列设置',
area: ['800px', '700px'],
content: html,
btn: ['确定', '取消'],
success: function (layero, index) {
form.render('checkbox', 'colSettingForm');
},
yes: function (index, layero) {
let settings = {};
let checkboxes = layero.find('input[type="checkbox"]');
checkboxes.each(function () {
let name = $(this).attr('name');
let checked = $(this).is(':checked');
settings[name] = checked;
});
localStorage.setItem(colSettingsKey, JSON.stringify(settings));
for (let i = 0; i < cols.length; i++) {
let field = cols[i].field;
if (field && settings[field] !== undefined) {
cols[i].hide = !settings[field];
}
}
table.reload('list', {
cols: [cols],
page: {curr: currentPage},
where: whereCondition
});
layer.close(index);
}
});
});
//新增供应商弹窗 //新增供应商弹窗
$("#add_supplier").click(function () { $("#add_supplier").click(function () {
index.openTab({ index.openTab({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment