后台去重数据新增国家
This commit is contained in:
@@ -2929,6 +2929,7 @@ def _format_dedupe_total_data_item(item):
|
||||
return {
|
||||
'id': item.get('id'),
|
||||
'data_value': item.get('dataValue') or '',
|
||||
'country': item.get('country') or '',
|
||||
'group_id': item.get('groupId'),
|
||||
'group_name': item.get('groupName') or '',
|
||||
'uploader_user_id': item.get('uploaderUserId'),
|
||||
@@ -2948,6 +2949,7 @@ def list_dedupe_total_data():
|
||||
keyword = (request.args.get('keyword') or '').strip()
|
||||
username = (request.args.get('username') or '').strip()
|
||||
group_id = _parse_positive_group_id(request.args.get('group_id') or request.args.get('groupId'))
|
||||
country = (request.args.get('country') or '').strip()
|
||||
start_date = (request.args.get('start_date') or request.args.get('startDate') or '').strip()
|
||||
end_date = (request.args.get('end_date') or request.args.get('endDate') or '').strip()
|
||||
params = {
|
||||
@@ -2957,6 +2959,8 @@ def list_dedupe_total_data():
|
||||
'username': username,
|
||||
'operatorId': current_row.get('id'),
|
||||
}
|
||||
if country:
|
||||
params['country'] = country
|
||||
if start_date:
|
||||
params['startDate'] = start_date
|
||||
if end_date:
|
||||
@@ -2993,10 +2997,13 @@ def export_dedupe_total_data():
|
||||
return denied
|
||||
params = {'operatorId': current_row.get('id')}
|
||||
username = (request.args.get('username') or '').strip()
|
||||
country = (request.args.get('country') or '').strip()
|
||||
start_date = (request.args.get('start_date') or request.args.get('startDate') or '').strip()
|
||||
end_date = (request.args.get('end_date') or request.args.get('endDate') or '').strip()
|
||||
if username:
|
||||
params['username'] = username
|
||||
if country:
|
||||
params['country'] = country
|
||||
if start_date:
|
||||
params['startDate'] = start_date
|
||||
if end_date:
|
||||
|
||||
+20
-4
@@ -2180,14 +2180,28 @@
|
||||
var keyword = (document.getElementById('searchDedupeTotalData').value || '').trim();
|
||||
var username = (document.getElementById('searchDedupeTotalDataUsername').value || '').trim();
|
||||
var groupId = (document.getElementById('dedupeTotalDataGroupFilterId').value || '').trim();
|
||||
var country = (document.getElementById('dedupeTotalDataCountryFilter').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 (country) q += '&country=' + encodeURIComponent(country);
|
||||
if (dateRange.startDate) q += '&start_date=' + encodeURIComponent(dateRange.startDate);
|
||||
if (dateRange.endDate) q += '&end_date=' + encodeURIComponent(dateRange.endDate);
|
||||
return q;
|
||||
}
|
||||
function getDedupeTotalDataCountryLabel(countryCodes) {
|
||||
var countryLabels = {
|
||||
DE: '德国', UK: '英国', FR: '法国', IT: '意大利', ES: '西班牙', US: '美国'
|
||||
};
|
||||
if (Array.isArray(countryCodes)) {
|
||||
return countryCodes.map(function (code) { return countryLabels[code] || code; }).join('、');
|
||||
}
|
||||
return String(countryCodes || '').split(/[,,]/).map(function (code) {
|
||||
code = code.trim();
|
||||
return countryLabels[code] || code;
|
||||
}).filter(Boolean).join('、');
|
||||
}
|
||||
function loadDedupeTotalData(page) {
|
||||
if (!validateDedupeTotalDataDateRange()) return;
|
||||
dedupeTotalDataPage = page || 1;
|
||||
@@ -2196,15 +2210,15 @@
|
||||
.then(function (res) {
|
||||
var tbody = document.getElementById('dedupeTotalDataListBody');
|
||||
if (!res.success) {
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty-tip">加载失败: ' + escapeHtml(res.error || '') + '</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="7" class="empty-tip">加载失败: ' + escapeHtml(res.error || '') + '</td></tr>';
|
||||
return;
|
||||
}
|
||||
var items = res.items || [];
|
||||
if (items.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty-tip">暂无总数据</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="7" 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.group_name || '未分组') + '</td><td>' + escapeHtml(item.created_at || '') + '</td><td>' +
|
||||
return '<tr><td>' + escapeHtml(item.id) + '</td><td>' + escapeHtml(item.data_value || '') + '</td><td>' + escapeHtml(getDedupeTotalDataCountryLabel(item.country)) + '</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>';
|
||||
@@ -2214,7 +2228,7 @@
|
||||
bindDedupeTotalDataActions();
|
||||
})
|
||||
.catch(function () {
|
||||
document.getElementById('dedupeTotalDataListBody').innerHTML = '<tr><td colspan="6" class="empty-tip">请求失败</td></tr>';
|
||||
document.getElementById('dedupeTotalDataListBody').innerHTML = '<tr><td colspan="7" class="empty-tip">请求失败</td></tr>';
|
||||
});
|
||||
}
|
||||
function bindDedupeTotalDataActions() {
|
||||
@@ -2268,11 +2282,13 @@
|
||||
if (dedupeTotalDataExportButton.disabled) return;
|
||||
var username = (document.getElementById('searchDedupeTotalDataUsername').value || '').trim();
|
||||
var groupId = (document.getElementById('dedupeTotalDataGroupFilterId').value || '').trim();
|
||||
var country = (document.getElementById('dedupeTotalDataCountryFilter').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 (country) params.push('country=' + encodeURIComponent(country));
|
||||
if (dateRange.startDate) params.push('start_date=' + encodeURIComponent(dateRange.startDate));
|
||||
if (dateRange.endDate) params.push('end_date=' + encodeURIComponent(dateRange.endDate));
|
||||
var originalButtonText = dedupeTotalDataExportButton.textContent;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>管理后台 - 南日AI</title>
|
||||
<title>管理后台 - 数富AI</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
@@ -2030,7 +2030,7 @@
|
||||
<h3 style="margin-bottom:16px;font-size:15px;">新增ASIN</h3>
|
||||
<div class="form-row">
|
||||
<div class="form-group" style="min-width:320px;">
|
||||
<label>上传 Excel 文件(读取 ASIN 列)</label>
|
||||
<label>上传 Excel 文件(读取 ASIN 列,可选 国家 列)</label>
|
||||
<input type="file" id="dedupeTotalDataFile" accept=".xlsx,.xls">
|
||||
</div>
|
||||
<div class="form-group" style="min-width:220px;">
|
||||
@@ -2091,6 +2091,18 @@
|
||||
<option value="">全部分组</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>国家</label>
|
||||
<select id="dedupeTotalDataCountryFilter">
|
||||
<option value="">全部国家</option>
|
||||
<option value="DE">德国</option>
|
||||
<option value="UK">英国</option>
|
||||
<option value="FR">法国</option>
|
||||
<option value="IT">意大利</option>
|
||||
<option value="ES">西班牙</option>
|
||||
<option value="US">美国</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>开始日期</label>
|
||||
<input type="date" id="exportDedupeTotalDataStartDate">
|
||||
@@ -2109,6 +2121,7 @@
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>ASIN值</th>
|
||||
<th>国家</th>
|
||||
<th>用户名</th>
|
||||
<th>分组</th>
|
||||
<th>创建时间</th>
|
||||
@@ -3175,7 +3188,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/admin.js?v=dedupe-export-wait-1"></script>
|
||||
<script src="/static/admin.js?v=dedupe-country-1"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>登录 - 南日AI</title>
|
||||
<title>登录 - 数富AI</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
@@ -96,7 +96,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
<span class="header-title">南日AI</span>
|
||||
<span class="header-title">数富AI</span>
|
||||
</header>
|
||||
|
||||
<div class="login-box">
|
||||
|
||||
Reference in New Issue
Block a user