Commit eec48d51 by mushishixian

刷新逻辑

parent 5a10d436
......@@ -34,8 +34,8 @@
margin-right: 5px;
}
.table-selected {
background-color: #ecf0f1;
.layui-table-click {
background-color: #ddf2e9 !important;
}
</style>
<body>
......
......@@ -23,6 +23,7 @@
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
admin.putTempData("needFreshList", 1);
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
......
......@@ -14,6 +14,7 @@
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
admin.putTempData("needFreshList", 1);
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
......
......@@ -112,22 +112,50 @@
, page: {}
, done: function (res, curr, count) {
//得到当前页码
console.log(curr);
currentPage = curr;
}
});
//点击高亮
table.on('row(list)', function (obj) {
if (obj.tr.hasClass('table-selected')) {
obj.tr.removeClass('table-selected')
obj.tr.find('.layui-form-checkbox').removeClass('layui-form-checked');
//点击行checkbox选中
$(document).on("click", ".layui-table-body table.layui-table tbody tr", function () {
let index = $(this).attr('data-index');
let tableBox = $(this).parents('.layui-table-box');
//存在固定列
if (tableBox.find(".layui-table-fixed.layui-table-fixed-l").length > 0) {
tableDiv = tableBox.find(".layui-table-fixed.layui-table-fixed-l");
} else {
obj.tr.addClass('table-selected')
obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked');
tableDiv = tableBox.find(".layui-table-body.layui-table-main");
}
let checkCell = tableDiv.find("tr[data-index=" + index + "]").find("td div.laytable-cell-checkbox div.layui-form-checkbox I");
if (checkCell.length > 0) {
checkCell.click();
}
});
$(document).on("click", "td div.laytable-cell-checkbox div.layui-form-checkbox", function (e) {
e.stopPropagation();
});
//监听复选框事件,被选中的行高亮显示
table.on('checkbox(list)', function (obj) {
if (obj.checked === true && obj.type === 'all') {
//点击全选
$('.layui-table-body table.layui-table tbody tr').addClass('layui-table-click');
} else if (obj.checked === false && obj.type === 'all') {
//点击全不选
$('.layui-table-body table.layui-table tbody tr').removeClass('layui-table-click');
} else if (obj.checked === true && obj.type === 'one') {
//点击单行
if (obj.checked === true) {
obj.tr.addClass('layui-table-click');
} else {
obj.tr.removeClass('layui-table-click');
}
} else if (obj.checked === false && obj.type === 'one') {
//点击全选之后点击单行
if (obj.tr.hasClass('layui-table-click')) {
obj.tr.removeClass('layui-table-click');
}
}
console.log(obj.tr); //得到当前行元素对象
console.log(obj.data) //得到当前行数据
});
//保存需要刷新的页面数据
......@@ -150,7 +178,7 @@
});
})
//审批供应商弹窗
//同步金蝶的手动操作
$("#sync_supplier_to_erp").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
......@@ -185,8 +213,6 @@
return;
}
let supplierId = data[0].supplier_id;
let status = data[0].status;
let canAuditAddSupplier = {{checkPerm("AuditAddSupplier")?1:0}};
if (canAuditAddSupplier === 0 && status === -1) {
......@@ -282,7 +308,7 @@
}
})
//禁用供应商
$("#disable_supplier").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
......@@ -315,6 +341,8 @@
}
});
//转正供应商
$("#change_supplier_is_type").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
......@@ -346,6 +374,7 @@
}
});
//点击查询按钮
form.on('submit(load)', function (data) {
initCondition.source_type = whereCondition.source_type;
whereCondition = $.extend(false, initCondition, data.field);
......@@ -360,6 +389,7 @@
return false;
});
//点击重置按钮
form.on('submit(reset)', function (data) {
layer.load(1);
location.reload();
......
......@@ -21,6 +21,7 @@
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
admin.putTempData("needFreshList", 1);
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
......
......@@ -12,8 +12,6 @@
layer.load(1);
});
{{--index.setTabTitle('供应商修改 - {{$supplier['supplier_code'] or ''}}');--}}
form.on('submit(updateSupplier)', function (data) {
let confirmMessage = '';
if (data.field.status === '-2') {
......
......@@ -57,12 +57,18 @@
});
admin.on('tab', function (d) {
// // d.layId表示当前tab的url
// //判断列表是否需要刷新
//判断列表是否需要刷新
if (d.layId.search('SupplierList') !== -1) {
setTimeout(function () {
$('.admin-iframe').contents().find('#getSupplierListButton').click()
}, 10)
}, 10);
// let flag = admin.getTempData("needFreshList");
// if (flag) {
// setTimeout(function () {
// $('.admin-iframe').contents().find('#getSupplierListButton').click()
// admin.putTempData("needFreshList", null);
// }, 10);
// }
}
//判断详情是否需要刷新
if (d.layId.search('SupplierDetail') !== -1) {
......
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