Commit eec48d51 by mushishixian

刷新逻辑

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