diff --git a/api/dashboard/stats.php b/api/dashboard/stats.php index 2947dba..0d20d02 100644 --- a/api/dashboard/stats.php +++ b/api/dashboard/stats.php @@ -18,7 +18,12 @@ $sqlMetrics = [ 'person_total' => "SELECT COUNT(*) AS c FROM persons WHERE is_active = 1", 'company_new' => "SELECT COUNT(*) AS c FROM companies WHERE is_active = 1 AND DATE(created_at) = CURDATE() - INTERVAL 1 DAY", 'person_new' => "SELECT COUNT(*) AS c FROM persons WHERE is_active = 1 AND DATE(created_at) = CURDATE() - INTERVAL 1 DAY", - 'preliminary' => "SELECT COUNT(*) AS c FROM preliminary_data WHERE status = '待处理' AND is_active = 1", + 'preliminary' => "SELECT + (SELECT COUNT(*) FROM preliminary_data WHERE is_active = 1 AND status NOT IN ('已转换','已废弃')) + + (SELECT COUNT(*) FROM companies WHERE is_incomplete = 1) + + (SELECT COUNT(*) FROM persons WHERE is_incomplete = 1) + + (SELECT COUNT(*) FROM social_accounts WHERE is_incomplete = 1) + + (SELECT COUNT(*) FROM media_commercial_attributes WHERE is_incomplete = 1) AS c", 'industry_count' => "SELECT COUNT(DISTINCT industry) AS c FROM companies WHERE industry IS NOT NULL AND industry <> ''", 'manufacturer' => "SELECT COUNT(*) AS c FROM companies WHERE business_role = 'manufacturer' AND is_active = 1", 'integrator' => "SELECT COUNT(*) AS c FROM companies WHERE business_role IN ('integrator','distributor') AND is_active = 1", diff --git a/api/fragment/hard_add.php b/api/fragment/hard_add.php new file mode 100644 index 0000000..9af47c2 --- /dev/null +++ b/api/fragment/hard_add.php @@ -0,0 +1,65 @@ +getPdo(); +$pdo->prepare( + "INSERT INTO preliminary_data + (source_type, company_name, person_name, contact_phone, contact_email, + target_product_category, description, source_channel, recorded_by, status) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, '待处理')" +)->execute([ + $sourceType, + $companyName !== '' ? $companyName : null, + $personName !== '' ? $personName : null, + $phone !== '' ? $phone : null, + $email !== '' ? $email : null, + $category !== '' ? $category : null, + $description !== '' ? $description : null, + $sourceChannel, + $_SESSION['username'] ?? null, +]); +$newId = (int)$pdo->lastInsertId(); + +logCurrent('add', 'fragment', 'preliminary_data', $newId, [ + 'source_type' => $sourceType, + 'company_name' => $companyName, + 'person_name' => $personName, + 'phone' => $phone, + 'email' => $email, +]); + +Response::success(['id' => $newId], '新增成功'); diff --git a/static/css/style.css b/static/css/style.css index bc08d00..abd5967 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -476,10 +476,6 @@ table.grid .ops a:hover { text-decoration: underline; } gap: 14px; margin-bottom: 16px; } -/* 碎片处理中心专用:5 张指标卡一行排布(不影响其它页面) */ -.stat-cards.stat-cards-5 { - grid-template-columns: repeat(5, 1fr); -} .stat-card { background: #fff; border-radius: 6px; diff --git a/static/js/config.js b/static/js/config.js index 147f0ad..84f8895 100644 --- a/static/js/config.js +++ b/static/js/config.js @@ -5,7 +5,7 @@ var BASE_URL = '/api/'; var PAGE_SIZE = 20; /** 系统版本号(logo旁展示):修改代码后运行 tools/bump_version.php 自动递增 */ -var APP_VERSION = 'v1.0.36'; +var APP_VERSION = 'v1.0.37'; /** 页脚版权/备案信息(在 config.js 中修改) */ var FOOTER_TEXT = '© 2026 SuperLink 管理系统 版权所有 | 备案号:请替换为真实备案号'; diff --git a/static/js/fragment.js b/static/js/fragment.js index 4ef28ef..4beb1bc 100644 --- a/static/js/fragment.js +++ b/static/js/fragment.js @@ -38,7 +38,7 @@ $(function () { /** 渲染页面内容:指标卡 + 硬碎片 + 软碎片 两个独立区块 */ function renderPage() { $('#page-content').html( - '
' + + '
' + // ================= 硬碎片 ================= '
' + '
' + @@ -56,6 +56,8 @@ $(function () { ' ' + ' ' + ' ' + + ' ' + + ' ' + '
' + '
' + ' ' + @@ -94,6 +96,7 @@ $(function () { $('#hard-type').val(''); $('#hard-source').val(''); $('#hard-status').val(''); $('#hard-keyword').val(''); loadHardList(1); }); + $('#hard-add').on('click', function () { openHardAdd(); }); $('#soft-search').on('click', function () { loadSoftList(1); }); $('#soft-keyword').on('keydown', function (e) { if (e.keyCode === 13) loadSoftList(1); }); $('#soft-reset').on('click', function () { @@ -120,8 +123,7 @@ $(function () { '
' + d.hard_total + '/' + d.soft_total + '
碎片总数(硬/软)
' + '
' + d.month_new + '
本月新增
' + '
' + d.month_processed + '
本月处理
' + - '
' + d.cumulative + '
累计处理
' + - '
' + d.pending + '
待处理碎片
' + '
' + d.cumulative + '
累计处理
' ); }); } @@ -196,6 +198,71 @@ $(function () { }); } + /* ================= 硬碎片:新增 ================= */ + function openHardAdd() { + var typeSel = ''; + var content = + '' + + '
' + + '
' + typeSel + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '' + + ''; + + var idx = Dialog.open({ + title: '新增硬碎片', + area: ['640px', 'auto'], + content: content, + btn: false + }); + + // 来源渠道选项 + httpGet('common/dicts.php', { type: 'all' }).then(function (d) { + var html = ''; + (d.source_channels || []).forEach(function (c) { + html += ''; + }); + $('#ha-source').html(html); + }).catch(function () {}); + + function syncFields() { + var t = $('#ha-type').val(); + $('#ha-f-company_name').toggle(t !== 'person'); + $('#ha-f-person_name').toggle(t === 'person' || t === 'mixed'); + $('#ha-f-category').toggle(t === 'product' || t === 'need'); + } + $('#ha-type').on('change', syncFields); + syncFields(); + $('#ha-cancel').on('click', function () { Dialog.close(idx); }); + + $('#ha-form').on('submit', function (e) { + e.preventDefault(); + var fd = {}; + $(this).find('input, select, textarea').each(function () { + var name = $(this).attr('name'); + if (name) fd[name] = $(this).val(); + }); + fd.source_type = $('#ha-type').val(); + httpPost('fragment/hard_add.php', fd).then(function () { + Dialog.success('新增成功', function () { + Dialog.close(idx); + loadStats(); + loadHardList(1); + }); + }); + }); + } + /* ================= 硬碎片:查看 ================= */ window.viewHard = function (id) { httpGet('fragment/hard_detail.php', { id: id }).then(function (d) {
完整度类型内容摘要来源录入人录入时间状态操作