v1.0.37: 碎片处理看板调整 - 删待处理碎片卡(4张)+硬碎片新增按钮与录入弹窗(hard_add.php)+综合概览待处理数据碎片=硬+软+看板操作后实时刷新
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* 硬碎片新增接口 POST /api/fragment/hard_add.php
|
||||
* 入参:source_type(company|person|product|need|mixed,必填)/
|
||||
* company_name / person_name / contact_phone / contact_email /
|
||||
* target_product_category / description / source_channel
|
||||
* 写入 preliminary_data,status=待处理,recorded_by=当前登录用户
|
||||
*/
|
||||
require_once __DIR__ . '/../common/db.php';
|
||||
require_once __DIR__ . '/../common/response.php';
|
||||
require_once __DIR__ . '/../common/auth.php';
|
||||
require_once __DIR__ . '/../common/logger.php';
|
||||
|
||||
checkAjax();
|
||||
checkPermission('preliminary');
|
||||
|
||||
$sourceType = trim($_POST['source_type'] ?? '');
|
||||
if (!in_array($sourceType, ['company', 'person', 'product', 'need', 'mixed'], true)) {
|
||||
Response::error('碎片类型(source_type)为必填项', 400);
|
||||
}
|
||||
|
||||
$companyName = trim($_POST['company_name'] ?? '');
|
||||
$personName = trim($_POST['person_name'] ?? '');
|
||||
$phone = trim($_POST['contact_phone'] ?? '');
|
||||
$email = trim($_POST['contact_email'] ?? '');
|
||||
$category = trim($_POST['target_product_category'] ?? '');
|
||||
$description = trim($_POST['description'] ?? '');
|
||||
$sourceChannel = trim($_POST['source_channel'] ?? '');
|
||||
if ($sourceChannel === '') {
|
||||
$sourceChannel = '手动录入';
|
||||
}
|
||||
|
||||
// 至少有一项内容才能录为碎片
|
||||
if ($companyName === '' && $personName === '' && $phone === '' && $email === '' && $category === '' && $description === '') {
|
||||
Response::error('请至少填写一项内容', 400);
|
||||
}
|
||||
|
||||
$pdo = DB::getInstance()->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], '新增成功');
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -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 管理系统 版权所有 | 备案号:请替换为真实备案号';
|
||||
|
||||
+70
-3
@@ -38,7 +38,7 @@ $(function () {
|
||||
/** 渲染页面内容:指标卡 + 硬碎片 + 软碎片 两个独立区块 */
|
||||
function renderPage() {
|
||||
$('#page-content').html(
|
||||
'<div class="stat-cards stat-cards-5" id="stat-cards"></div>' +
|
||||
'<div class="stat-cards" id="stat-cards"></div>' +
|
||||
// ================= 硬碎片 =================
|
||||
'<div class="card" style="margin-top:14px;">' +
|
||||
' <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;">' +
|
||||
@@ -56,6 +56,8 @@ $(function () {
|
||||
' <input type="text" id="hard-keyword" placeholder="公司/姓名/电话/邮箱/描述关键词">' +
|
||||
' <button class="btn btn-primary" id="hard-search">搜索</button>' +
|
||||
' <button class="btn" id="hard-reset">重置</button>' +
|
||||
' <span class="spacer"></span>' +
|
||||
' <button class="btn btn-success" id="hard-add">+ 新增碎片</button>' +
|
||||
' </div>' +
|
||||
' <div class="table-wrap"><table class="grid">' +
|
||||
' <thead><tr><th>完整度</th><th>类型</th><th>内容摘要</th><th>来源</th><th>录入人</th><th>录入时间</th><th>状态</th><th>操作</th></tr></thead>' +
|
||||
@@ -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 () {
|
||||
'<div class="stat-card c-blue"><div class="num">' + d.hard_total + '/' + d.soft_total + '</div><div class="label">碎片总数(硬/软)</div></div>' +
|
||||
'<div class="stat-card c-green"><div class="num">' + d.month_new + '</div><div class="label">本月新增</div></div>' +
|
||||
'<div class="stat-card c-orange"><div class="num">' + d.month_processed + '</div><div class="label">本月处理</div></div>' +
|
||||
'<div class="stat-card c-teal"><div class="num">' + d.cumulative + '</div><div class="label">累计处理</div></div>' +
|
||||
'<div class="stat-card c-red"><div class="num">' + d.pending + '</div><div class="label">待处理碎片</div></div>'
|
||||
'<div class="stat-card c-teal"><div class="num">' + d.cumulative + '</div><div class="label">累计处理</div></div>'
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -196,6 +198,71 @@ $(function () {
|
||||
});
|
||||
}
|
||||
|
||||
/* ================= 硬碎片:新增 ================= */
|
||||
function openHardAdd() {
|
||||
var typeSel = '<select id="ha-type">' +
|
||||
'<option value="company">企业</option><option value="person">人员</option>' +
|
||||
'<option value="product">产品</option><option value="need">需求</option><option value="mixed">混合</option></select>';
|
||||
var content =
|
||||
'<form id="ha-form" style="padding:16px 22px 4px;">' +
|
||||
'<div class="form-grid">' +
|
||||
' <div class="form-item"><label>碎片类型<span class="req">*</span></label>' + typeSel + '</div>' +
|
||||
' <div class="form-item" id="ha-f-company_name"><label>公司名称</label><input type="text" name="company_name" placeholder="如:深圳XX科技"></div>' +
|
||||
' <div class="form-item" id="ha-f-person_name"><label>联系人</label><input type="text" name="person_name" placeholder="如:张三"></div>' +
|
||||
' <div class="form-item"><label>联系电话</label><input type="text" name="contact_phone" placeholder="如:13812345678"></div>' +
|
||||
' <div class="form-item"><label>联系邮箱</label><input type="text" name="contact_email" placeholder="如:a@b.com"></div>' +
|
||||
' <div class="form-item" id="ha-f-category"><label>意向产品品类</label><input type="text" name="target_product_category" placeholder="如:工业机器人"></div>' +
|
||||
' <div class="form-item"><label>来源渠道</label><select name="source_channel" id="ha-source"><option value="手动录入">手动录入</option></select></div>' +
|
||||
' <div class="form-item full"><label>原始描述</label><textarea name="description" style="height:70px;" placeholder="记录原始线索信息"></textarea></div>' +
|
||||
'</div>' +
|
||||
'<div class="dialog-footer"><button type="button" class="btn" id="ha-cancel">取消</button>' +
|
||||
'<button type="submit" class="btn btn-primary">保存碎片</button></div>' +
|
||||
'</form>';
|
||||
|
||||
var idx = Dialog.open({
|
||||
title: '新增硬碎片',
|
||||
area: ['640px', 'auto'],
|
||||
content: content,
|
||||
btn: false
|
||||
});
|
||||
|
||||
// 来源渠道选项
|
||||
httpGet('common/dicts.php', { type: 'all' }).then(function (d) {
|
||||
var html = '<option value="手动录入">手动录入</option>';
|
||||
(d.source_channels || []).forEach(function (c) {
|
||||
html += '<option value="' + escHtml(c.name) + '">' + escHtml(c.name) + '</option>';
|
||||
});
|
||||
$('#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) {
|
||||
|
||||
Reference in New Issue
Block a user