+174
-19
@@ -120,7 +120,10 @@
|
||||
loadDedupeTotalData(1);
|
||||
loadDedupeGroupSummary();
|
||||
}
|
||||
else if (tabName === 'invalid-asin-data') loadInvalidAsinData(1);
|
||||
else if (tabName === 'invalid-asin-data') {
|
||||
loadShopManageGroups();
|
||||
loadInvalidAsinData(1);
|
||||
}
|
||||
else if (tabName === 'shop-keys') loadShopKeys(1);
|
||||
else if (tabName === 'shop-manage') loadShopManage(1);
|
||||
else if (tabName === 'skip-price-asin') loadSkipPriceAsin(1);
|
||||
@@ -1526,7 +1529,7 @@
|
||||
});
|
||||
groups.forEach(function (group) {
|
||||
group.results.sort(shopDataResultSort);
|
||||
group.results = group.results.slice(0, 3);
|
||||
group.results = group.results.slice(0, 1);
|
||||
if (!group.latest_created_at && group.results.length) {
|
||||
group.latest_created_at = group.results[0].created_at || group.results[0].finished_at || '';
|
||||
}
|
||||
@@ -1579,7 +1582,7 @@
|
||||
'<div class="image-video-card-body">' +
|
||||
'<div class="image-video-card-head shop-data-group-head">' +
|
||||
'<div class="shop-data-task-title"><span title="' + escapeHtml(group.shop_name || '-') + '">' + escapeHtml(group.shop_name || '-') + '</span></div>' +
|
||||
'<span class="shop-data-group-meta">' + results.length + '/3 份结果</span>' +
|
||||
'<span class="shop-data-group-meta">' + results.length + '/1 份当日累计文件</span>' +
|
||||
'</div>' +
|
||||
'<div class="image-video-card-info">' +
|
||||
'<div class="image-video-info-row"><label>分组</label><span>' + escapeHtml(group.group_name || '-') + '</span></div>' +
|
||||
@@ -1641,7 +1644,7 @@
|
||||
var total = payload.total != null ? Number(payload.total) : shopDataTaskGroups.length;
|
||||
var responsePage = payload.page || page;
|
||||
var responsePageSize = payload.page_size || shopDataTaskPageSize;
|
||||
document.getElementById('shopDataTaskTotal').textContent = '共 ' + (total || 0) + ' 家店铺 · 每家店铺保留最新 3 份任务结果';
|
||||
document.getElementById('shopDataTaskTotal').textContent = '共 ' + (total || 0) + ' 家店铺 · 每家店铺保留 1 份当日累计文件';
|
||||
renderShopDataTasks();
|
||||
renderPagination('shopDataTaskPagination', total, responsePage, responsePageSize, loadShopDataCrawlTasks);
|
||||
})
|
||||
@@ -2176,9 +2179,11 @@
|
||||
var q = 'page=' + (page || 1) + '&page_size=' + dedupeTotalDataPageSize;
|
||||
var keyword = (document.getElementById('searchDedupeTotalData').value || '').trim();
|
||||
var username = (document.getElementById('searchDedupeTotalDataUsername').value || '').trim();
|
||||
var groupId = (document.getElementById('dedupeTotalDataGroupFilterId').value || '').trim();
|
||||
var dateRange = getDedupeTotalDataDateRange();
|
||||
if (keyword) q += '&keyword=' + encodeURIComponent(keyword);
|
||||
if (username) q += '&username=' + encodeURIComponent(username);
|
||||
if (groupId) q += '&group_id=' + encodeURIComponent(groupId);
|
||||
if (dateRange.startDate) q += '&start_date=' + encodeURIComponent(dateRange.startDate);
|
||||
if (dateRange.endDate) q += '&end_date=' + encodeURIComponent(dateRange.endDate);
|
||||
return q;
|
||||
@@ -2191,16 +2196,16 @@
|
||||
.then(function (res) {
|
||||
var tbody = document.getElementById('dedupeTotalDataListBody');
|
||||
if (!res.success) {
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="empty-tip">加载失败: ' + escapeHtml(res.error || '') + '</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty-tip">加载失败: ' + escapeHtml(res.error || '') + '</td></tr>';
|
||||
return;
|
||||
}
|
||||
var items = res.items || [];
|
||||
if (items.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="empty-tip">暂无总数据</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty-tip">暂无总数据</td></tr>';
|
||||
} else {
|
||||
tbody.innerHTML = items.map(function (item) {
|
||||
return '<tr><td>' + escapeHtml(item.id) + '</td><td>' + escapeHtml(item.data_value || '') + '</td><td>' + escapeHtml(item.username || '') + '</td><td>' + escapeHtml(item.created_at || '') + '</td><td>' +
|
||||
'<button class="btn btn-sm" data-dedupe-total-edit="' + escapeHtml(item.id) + '" data-value="' + escapeHtml(item.data_value || '') + '">编辑</button> ' +
|
||||
return '<tr><td>' + escapeHtml(item.id) + '</td><td>' + escapeHtml(item.data_value || '') + '</td><td>' + escapeHtml(item.username || '') + '</td><td>' + escapeHtml(item.group_name || '未分组') + '</td><td>' + escapeHtml(item.created_at || '') + '</td><td>' +
|
||||
'<button class="btn btn-sm" data-dedupe-total-edit="' + escapeHtml(item.id) + '" data-value="' + escapeHtml(item.data_value || '') + '" data-group-id="' + escapeHtml(item.group_id || '') + '">编辑</button> ' +
|
||||
'<button class="btn btn-sm btn-danger" data-dedupe-total-delete="' + escapeHtml(item.id) + '" data-value="' + escapeHtml(item.data_value || '') + '">删除</button>' +
|
||||
'</td></tr>';
|
||||
}).join('');
|
||||
@@ -2209,7 +2214,7 @@
|
||||
bindDedupeTotalDataActions();
|
||||
})
|
||||
.catch(function () {
|
||||
document.getElementById('dedupeTotalDataListBody').innerHTML = '<tr><td colspan="5" class="empty-tip">请求失败</td></tr>';
|
||||
document.getElementById('dedupeTotalDataListBody').innerHTML = '<tr><td colspan="6" class="empty-tip">请求失败</td></tr>';
|
||||
});
|
||||
}
|
||||
function bindDedupeTotalDataActions() {
|
||||
@@ -2219,7 +2224,11 @@
|
||||
document.getElementById('editDedupeTotalDataValue').value = (btn.dataset.value || '').replace(/"/g, '"');
|
||||
document.getElementById('msgEditDedupeTotalData').textContent = '';
|
||||
document.getElementById('msgEditDedupeTotalData').className = 'msg';
|
||||
document.getElementById('editDedupeTotalDataModal').classList.add('show');
|
||||
var groupId = btn.dataset.groupId || '';
|
||||
loadShopManageGroups().then(function () {
|
||||
document.getElementById('editDedupeTotalDataGroupId').value = groupId;
|
||||
document.getElementById('editDedupeTotalDataModal').classList.add('show');
|
||||
});
|
||||
};
|
||||
});
|
||||
document.querySelectorAll('[data-dedupe-total-delete]').forEach(function (btn) {
|
||||
@@ -2238,10 +2247,12 @@
|
||||
document.getElementById('btnSearchDedupeTotalData').onclick = function () { loadDedupeTotalData(1); };
|
||||
document.getElementById('btnExportDedupeTotalData').onclick = function () {
|
||||
var username = (document.getElementById('searchDedupeTotalDataUsername').value || '').trim();
|
||||
var groupId = (document.getElementById('dedupeTotalDataGroupFilterId').value || '').trim();
|
||||
var dateRange = getDedupeTotalDataDateRange();
|
||||
if (!validateDedupeTotalDataDateRange()) return;
|
||||
var params = [];
|
||||
if (username) params.push('username=' + encodeURIComponent(username));
|
||||
if (groupId) params.push('group_id=' + encodeURIComponent(groupId));
|
||||
if (dateRange.startDate) params.push('start_date=' + encodeURIComponent(dateRange.startDate));
|
||||
if (dateRange.endDate) params.push('end_date=' + encodeURIComponent(dateRange.endDate));
|
||||
fetch('/api/admin/dedupe-total-data/export' + (params.length ? ('?' + params.join('&')) : ''))
|
||||
@@ -2386,6 +2397,12 @@
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
var groupId = (document.getElementById('dedupeTotalDataImportGroupId').value || '').trim();
|
||||
if (!groupId) {
|
||||
msgEl.textContent = '请选择分组';
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
var file = fileInput.files[0];
|
||||
var lowerName = (file.name || '').toLowerCase();
|
||||
if (!(lowerName.endsWith('.xlsx') || lowerName.endsWith('.xls'))) {
|
||||
@@ -2395,6 +2412,7 @@
|
||||
}
|
||||
var formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('group_id', groupId);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '/api/admin/dedupe-total-data/import', true);
|
||||
xhr.upload.onprogress = function (event) {
|
||||
@@ -2449,8 +2467,15 @@
|
||||
if (!confirm('确定按 Excel 中的 ASIN 批量删除匹配的总数据吗?')) {
|
||||
return;
|
||||
}
|
||||
var groupId = (document.getElementById('dedupeTotalDataDeleteGroupId').value || '').trim();
|
||||
if (!groupId) {
|
||||
msgEl.textContent = '请选择分组';
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
var formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('group_id', groupId);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '/api/admin/dedupe-total-data/delete-import', true);
|
||||
xhr.upload.onprogress = function (event) {
|
||||
@@ -2486,6 +2511,7 @@
|
||||
document.getElementById('btnSaveDedupeTotalData').onclick = function () {
|
||||
var itemId = document.getElementById('editDedupeTotalDataId').value;
|
||||
var value = (document.getElementById('editDedupeTotalDataValue').value || '').trim();
|
||||
var groupId = (document.getElementById('editDedupeTotalDataGroupId').value || '').trim();
|
||||
var msgEl = document.getElementById('msgEditDedupeTotalData');
|
||||
msgEl.textContent = '';
|
||||
msgEl.className = 'msg';
|
||||
@@ -2494,10 +2520,15 @@
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
if (!groupId) {
|
||||
msgEl.textContent = '请选择分组';
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
fetch('/api/admin/dedupe-total-data/' + itemId, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ data_value: value })
|
||||
body: JSON.stringify({ data_value: value, group_id: Number(groupId) })
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (res) {
|
||||
@@ -2519,7 +2550,9 @@
|
||||
function buildInvalidAsinDataQuery(page) {
|
||||
var q = 'page=' + (page || 1) + '&page_size=' + invalidAsinDataPageSize;
|
||||
var keyword = (document.getElementById('searchInvalidAsinData').value || '').trim();
|
||||
var groupId = (document.getElementById('invalidAsinDataFilterGroupId').value || '').trim();
|
||||
if (keyword) q += '&keyword=' + encodeURIComponent(keyword);
|
||||
if (groupId) q += '&group_id=' + encodeURIComponent(groupId);
|
||||
return q;
|
||||
}
|
||||
function loadInvalidAsinData(page) {
|
||||
@@ -2529,18 +2562,21 @@
|
||||
.then(function (res) {
|
||||
var tbody = document.getElementById('invalidAsinDataListBody');
|
||||
if (!res.success) {
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="empty-tip">加载失败: ' + (res.error || '') + '</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="7" class="empty-tip">加载失败: ' + (res.error || '') + '</td></tr>';
|
||||
return;
|
||||
}
|
||||
var items = res.items || [];
|
||||
if (items.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="empty-tip">暂无数据</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="7" class="empty-tip">暂无数据</td></tr>';
|
||||
} else {
|
||||
tbody.innerHTML = items.map(function (item) {
|
||||
var dataValueAttr = (item.data_value || '').replace(/"/g, '"');
|
||||
var brandAttr = (item.brand || '').replace(/"/g, '"');
|
||||
return '<tr><td>' + item.id + '</td><td>' + (item.data_value || '') + '</td><td>' + (item.brand || '') + '</td><td>' + (item.created_at || '') + '</td><td>' +
|
||||
'<button class="btn btn-sm" data-invalid-asin-edit="' + item.id + '" data-value="' + dataValueAttr + '" data-brand="' + brandAttr + '">编辑</button> ' +
|
||||
var groupId = item.group_id == null ? '' : String(item.group_id);
|
||||
var source = String(item.record_source || 'AUTO').toUpperCase();
|
||||
var sourceLabel = source === 'MANUAL' ? '\u624b\u52a8\u65b0\u589e' : '\u81ea\u52a8\u5bfc\u5165';
|
||||
return '<tr><td>' + escapeHtml(item.id || '') + '</td><td>' + escapeHtml(item.data_value || '') + '</td><td>' + escapeHtml(item.brand || '') + '</td><td>' + escapeHtml(item.group_name || '') + '</td><td>' + sourceLabel + '</td><td>' + escapeHtml(item.created_at || '') + '</td><td>' +
|
||||
'<button class="btn btn-sm" data-invalid-asin-edit="' + item.id + '" data-value="' + dataValueAttr + '" data-brand="' + brandAttr + '" data-group-id="' + groupId + '" data-source="' + source + '">编辑</button> ' +
|
||||
'<button class="btn btn-sm btn-danger" data-invalid-asin-delete="' + item.id + '" data-value="' + dataValueAttr + '">删除</button>' +
|
||||
'</td></tr>';
|
||||
}).join('');
|
||||
@@ -2549,7 +2585,7 @@
|
||||
bindInvalidAsinDataActions();
|
||||
})
|
||||
.catch(function () {
|
||||
document.getElementById('invalidAsinDataListBody').innerHTML = '<tr><td colspan="5" class="empty-tip">请求失败</td></tr>';
|
||||
document.getElementById('invalidAsinDataListBody').innerHTML = '<tr><td colspan="7" class="empty-tip">请求失败</td></tr>';
|
||||
});
|
||||
}
|
||||
function bindInvalidAsinDataActions() {
|
||||
@@ -2558,6 +2594,20 @@
|
||||
document.getElementById('editInvalidAsinDataId').value = btn.dataset.invalidAsinEdit || '';
|
||||
document.getElementById('editInvalidAsinDataValue').value = (btn.dataset.value || '').replace(/"/g, '"');
|
||||
document.getElementById('editInvalidAsinDataBrand').value = (btn.dataset.brand || '').replace(/"/g, '"');
|
||||
var source = String(btn.dataset.source || 'AUTO').toUpperCase();
|
||||
var isManual = source === 'MANUAL';
|
||||
document.getElementById('editInvalidAsinDataRecordSource').value = source;
|
||||
document.getElementById('editInvalidAsinDataSourceLabel').value = isManual
|
||||
? '\u624b\u52a8\u65b0\u589e'
|
||||
: '\u81ea\u52a8\u5bfc\u5165';
|
||||
document.getElementById('editInvalidAsinDataGroupForm').style.display = isManual ? '' : 'none';
|
||||
if (isManual) {
|
||||
loadShopManageGroups().then(function () {
|
||||
document.getElementById('editInvalidAsinDataGroupSelect').value = currentUserRole === 'super_admin'
|
||||
? (btn.dataset.groupId || '')
|
||||
: getInvalidAsinDataLockedGroupId();
|
||||
});
|
||||
}
|
||||
document.getElementById('msgEditInvalidAsinData').textContent = '';
|
||||
document.getElementById('msgEditInvalidAsinData').className = 'msg';
|
||||
document.getElementById('editInvalidAsinDataModal').classList.add('show');
|
||||
@@ -2580,6 +2630,7 @@
|
||||
document.getElementById('btnAddInvalidAsinData').onclick = function () {
|
||||
var dataValue = (document.getElementById('invalidAsinDataValue').value || '').trim();
|
||||
var brand = (document.getElementById('invalidAsinDataBrand').value || '').trim();
|
||||
var groupId = (document.getElementById('invalidAsinDataGroupSelect').value || '').trim();
|
||||
var msgEl = document.getElementById('msgInvalidAsinData');
|
||||
msgEl.textContent = '';
|
||||
msgEl.className = 'msg';
|
||||
@@ -2588,10 +2639,15 @@
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
if (!groupId) {
|
||||
msgEl.textContent = '请选择分组';
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
fetch('/api/admin/invalid-asin-data', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ data_value: dataValue, brand: brand })
|
||||
body: JSON.stringify({ data_value: dataValue, brand: brand, group_id: Number(groupId) })
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (res) {
|
||||
@@ -2600,6 +2656,9 @@
|
||||
msgEl.classList.add('ok');
|
||||
document.getElementById('invalidAsinDataValue').value = '';
|
||||
document.getElementById('invalidAsinDataBrand').value = '';
|
||||
document.getElementById('invalidAsinDataGroupSelect').value = currentUserRole === 'super_admin'
|
||||
? ''
|
||||
: getInvalidAsinDataLockedGroupId();
|
||||
loadInvalidAsinData(1);
|
||||
} else {
|
||||
msgEl.textContent = res.error || '创建失败';
|
||||
@@ -2615,6 +2674,8 @@
|
||||
var itemId = document.getElementById('editInvalidAsinDataId').value;
|
||||
var dataValue = (document.getElementById('editInvalidAsinDataValue').value || '').trim();
|
||||
var brand = (document.getElementById('editInvalidAsinDataBrand').value || '').trim();
|
||||
var source = String(document.getElementById('editInvalidAsinDataRecordSource').value || 'AUTO').toUpperCase();
|
||||
var groupId = (document.getElementById('editInvalidAsinDataGroupSelect').value || '').trim();
|
||||
var msgEl = document.getElementById('msgEditInvalidAsinData');
|
||||
msgEl.textContent = '';
|
||||
msgEl.className = 'msg';
|
||||
@@ -2623,10 +2684,19 @@
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
if (source === 'MANUAL' && !groupId) {
|
||||
msgEl.textContent = '请选择分组';
|
||||
msgEl.classList.add('err');
|
||||
return;
|
||||
}
|
||||
fetch('/api/admin/invalid-asin-data/' + itemId, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ data_value: dataValue, brand: brand })
|
||||
body: JSON.stringify({
|
||||
data_value: dataValue,
|
||||
brand: brand,
|
||||
group_id: source === 'MANUAL' ? Number(groupId) : null
|
||||
})
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (res) {
|
||||
@@ -2803,6 +2873,7 @@
|
||||
var shopManagePage = 1, shopManagePageSize = 15;
|
||||
var shopManageGroups = [];
|
||||
var shopManageGroupsLoadedAt = 0;
|
||||
var shopManageLockedGroupId = null;
|
||||
var currentShopManageGroupGrantRoutes = [];
|
||||
|
||||
function buildShopManageQuery(page) {
|
||||
@@ -2926,9 +2997,22 @@
|
||||
});
|
||||
}
|
||||
|
||||
function getInvalidAsinDataLockedGroupId() {
|
||||
if (currentUserRole === 'super_admin') return '';
|
||||
if (shopManageLockedGroupId) return String(shopManageLockedGroupId);
|
||||
return shopManageGroups.length ? String(shopManageGroups[0].id || '') : '';
|
||||
}
|
||||
|
||||
function refreshShopGroupSelects(selectedCreateId, selectedEditId) {
|
||||
var createSel = document.getElementById('shopManageGroupSelect');
|
||||
var editSel = document.getElementById('editShopManageGroupSelect');
|
||||
var invalidCreateSel = document.getElementById('invalidAsinDataGroupSelect');
|
||||
var invalidEditSel = document.getElementById('editInvalidAsinDataGroupSelect');
|
||||
var invalidFilterSel = document.getElementById('invalidAsinDataFilterGroupId');
|
||||
var dedupeImportSel = document.getElementById('dedupeTotalDataImportGroupId');
|
||||
var dedupeDeleteSel = document.getElementById('dedupeTotalDataDeleteGroupId');
|
||||
var dedupeFilterSel = document.getElementById('dedupeTotalDataGroupFilterId');
|
||||
var dedupeEditSel = document.getElementById('editDedupeTotalDataGroupId');
|
||||
var filterSel = document.getElementById('shopManageFilterGroupId');
|
||||
var skipCreateSel = document.getElementById('skipPriceAsinGroupSelect');
|
||||
var skipFilterSel = document.getElementById('skipPriceAsinFilterGroupId');
|
||||
@@ -2936,6 +3020,13 @@
|
||||
var queryCreateSel = document.getElementById('queryAsinGroupSelect');
|
||||
var queryFilterSel = document.getElementById('queryAsinFilterGroupId');
|
||||
var chooseQueryShopSel = document.getElementById('chooseQueryAsinShopGroupId');
|
||||
var selectedInvalidCreateId = invalidCreateSel ? invalidCreateSel.value : '';
|
||||
var selectedInvalidEditId = invalidEditSel ? invalidEditSel.value : '';
|
||||
var selectedInvalidFilterId = invalidFilterSel ? invalidFilterSel.value : '';
|
||||
var selectedDedupeImportId = dedupeImportSel ? dedupeImportSel.value : '';
|
||||
var selectedDedupeDeleteId = dedupeDeleteSel ? dedupeDeleteSel.value : '';
|
||||
var selectedDedupeFilterId = dedupeFilterSel ? dedupeFilterSel.value : '';
|
||||
var selectedDedupeEditId = dedupeEditSel ? dedupeEditSel.value : '';
|
||||
var selectedFilterId = filterSel ? filterSel.value : '';
|
||||
var selectedSkipCreateId = skipCreateSel ? skipCreateSel.value : '';
|
||||
var selectedSkipFilterId = skipFilterSel ? skipFilterSel.value : '';
|
||||
@@ -2952,6 +3043,37 @@
|
||||
});
|
||||
createSel.innerHTML = createOpts.join('');
|
||||
editSel.innerHTML = createOpts.join('');
|
||||
var lockedInvalidGroupId = getInvalidAsinDataLockedGroupId();
|
||||
var lockedGroup = shopManageGroups.find(function (group) {
|
||||
return String(group.id || '') === lockedInvalidGroupId;
|
||||
});
|
||||
var invalidGroupOpts = createOpts;
|
||||
if (currentUserRole !== 'super_admin') {
|
||||
invalidGroupOpts = lockedGroup
|
||||
? ['<option value="' + lockedGroup.id + '">' + (lockedGroup.group_name || '') + '</option>']
|
||||
: [createOpts[0]];
|
||||
}
|
||||
var invalidFilterOpts = currentUserRole === 'super_admin'
|
||||
? filterOpts
|
||||
: (lockedGroup
|
||||
? ['<option value="' + lockedGroup.id + '">' + (lockedGroup.group_name || '') + '</option>']
|
||||
: [createOpts[0]]);
|
||||
if (invalidCreateSel) {
|
||||
invalidCreateSel.innerHTML = invalidGroupOpts.join('');
|
||||
invalidCreateSel.disabled = currentUserRole !== 'super_admin';
|
||||
}
|
||||
if (invalidEditSel) {
|
||||
invalidEditSel.innerHTML = invalidGroupOpts.join('');
|
||||
invalidEditSel.disabled = currentUserRole !== 'super_admin';
|
||||
}
|
||||
if (invalidFilterSel) {
|
||||
invalidFilterSel.innerHTML = invalidFilterOpts.join('');
|
||||
invalidFilterSel.disabled = currentUserRole !== 'super_admin';
|
||||
}
|
||||
if (dedupeImportSel) dedupeImportSel.innerHTML = createOpts.join('');
|
||||
if (dedupeDeleteSel) dedupeDeleteSel.innerHTML = createOpts.join('');
|
||||
if (dedupeFilterSel) dedupeFilterSel.innerHTML = filterOpts.join('');
|
||||
if (dedupeEditSel) dedupeEditSel.innerHTML = createOpts.join('');
|
||||
if (skipCreateSel) skipCreateSel.innerHTML = createOpts.join('');
|
||||
if (queryCreateSel) queryCreateSel.innerHTML = createOpts.join('');
|
||||
if (filterSel) filterSel.innerHTML = filterOpts.join('');
|
||||
@@ -2961,6 +3083,25 @@
|
||||
if (chooseQueryShopSel) chooseQueryShopSel.innerHTML = filterOpts.join('');
|
||||
if (selectedCreateId != null) createSel.value = String(selectedCreateId);
|
||||
if (selectedEditId != null) editSel.value = String(selectedEditId);
|
||||
if (invalidCreateSel) {
|
||||
invalidCreateSel.value = currentUserRole === 'super_admin'
|
||||
? selectedInvalidCreateId
|
||||
: lockedInvalidGroupId;
|
||||
}
|
||||
if (invalidEditSel) {
|
||||
invalidEditSel.value = currentUserRole === 'super_admin'
|
||||
? selectedInvalidEditId
|
||||
: lockedInvalidGroupId;
|
||||
}
|
||||
if (invalidFilterSel) {
|
||||
invalidFilterSel.value = currentUserRole === 'super_admin'
|
||||
? selectedInvalidFilterId
|
||||
: lockedInvalidGroupId;
|
||||
}
|
||||
if (dedupeImportSel && selectedDedupeImportId) dedupeImportSel.value = selectedDedupeImportId;
|
||||
if (dedupeDeleteSel && selectedDedupeDeleteId) dedupeDeleteSel.value = selectedDedupeDeleteId;
|
||||
if (dedupeFilterSel && selectedDedupeFilterId) dedupeFilterSel.value = selectedDedupeFilterId;
|
||||
if (dedupeEditSel && selectedDedupeEditId) dedupeEditSel.value = selectedDedupeEditId;
|
||||
if (filterSel && selectedFilterId) filterSel.value = selectedFilterId;
|
||||
if (skipCreateSel && selectedSkipCreateId) skipCreateSel.value = selectedSkipCreateId;
|
||||
if (skipFilterSel && selectedSkipFilterId) skipFilterSel.value = selectedSkipFilterId;
|
||||
@@ -2980,12 +3121,14 @@
|
||||
.then(function (res) {
|
||||
if (!res.success) throw new Error(res.error || '加载分组失败');
|
||||
shopManageGroups = res.items || [];
|
||||
shopManageLockedGroupId = res.locked_group_id || null;
|
||||
shopManageGroupsLoadedAt = Date.now();
|
||||
refreshShopGroupSelects(selectedCreateId, selectedEditId);
|
||||
return shopManageGroups;
|
||||
})
|
||||
.catch(function () {
|
||||
shopManageGroups = [];
|
||||
shopManageLockedGroupId = null;
|
||||
shopManageGroupsLoadedAt = 0;
|
||||
refreshShopGroupSelects();
|
||||
return [];
|
||||
@@ -3040,7 +3183,7 @@
|
||||
|
||||
function updateShopManageGroupButtonsAccess() {
|
||||
var canManageGroups = !!currentUserId;
|
||||
['btnManageShopGroups', 'btnManageShopGroupsFromEdit', 'btnManageSkipPriceAsinGroups', 'btnManageQueryAsinGroups', 'btnManageDedupeGroups'].forEach(function (id) {
|
||||
['btnManageShopGroups', 'btnManageShopGroupsFromEdit', 'btnManageSkipPriceAsinGroups', 'btnManageQueryAsinGroups', 'btnManageDedupeGroups', 'btnManageInvalidAsinDataGroups', 'btnManageInvalidAsinDataGroupsFromEdit'].forEach(function (id) {
|
||||
var btn = document.getElementById(id);
|
||||
if (btn) btn.style.display = canManageGroups ? '' : 'none';
|
||||
});
|
||||
@@ -3123,6 +3266,8 @@
|
||||
renderDedupeGroupSummary();
|
||||
loadShopManage(shopManagePage);
|
||||
loadSkipPriceAsin(skipPriceAsinPage);
|
||||
if (getActiveAdminTabName() === 'dedupe-total-data') loadDedupeTotalData(dedupeTotalDataPage);
|
||||
if (getActiveAdminTabName() === 'invalid-asin-data') loadInvalidAsinData(invalidAsinDataPage);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -3149,6 +3294,14 @@
|
||||
setShopManageGroupGrantRoutes(['dedupe-total-data']);
|
||||
openShopManageGroupModal();
|
||||
};
|
||||
document.getElementById('btnManageInvalidAsinDataGroups').onclick = function () {
|
||||
setShopManageGroupGrantRoutes(['invalid-asin-data']);
|
||||
openShopManageGroupModal();
|
||||
};
|
||||
document.getElementById('btnManageInvalidAsinDataGroupsFromEdit').onclick = function () {
|
||||
setShopManageGroupGrantRoutes(['invalid-asin-data']);
|
||||
openShopManageGroupModal();
|
||||
};
|
||||
document.getElementById('btnSearchShopManage').onclick = function () {
|
||||
loadShopManage(1);
|
||||
};
|
||||
@@ -3200,6 +3353,8 @@
|
||||
renderDedupeGroupSummary();
|
||||
loadShopManage(shopManagePage);
|
||||
loadSkipPriceAsin(skipPriceAsinPage);
|
||||
if (getActiveAdminTabName() === 'dedupe-total-data') loadDedupeTotalData(dedupeTotalDataPage);
|
||||
if (getActiveAdminTabName() === 'invalid-asin-data') loadInvalidAsinData(invalidAsinDataPage);
|
||||
});
|
||||
})
|
||||
.catch(function () {
|
||||
|
||||
Reference in New Issue
Block a user