v1.0.26: 渠道新增计划增加「发生地址」字段(来源详情后,单行文本,详细到门牌号) - 列表列+新增/编辑表单+接口+迁移SQL
This commit is contained in:
@@ -41,7 +41,7 @@ $total = (int)$stmt->fetchColumn();
|
||||
|
||||
$offset = ($page - 1) * $limit;
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT id, channel_type, source_detail, industry, start_date, end_date, remark, status, cost, created_at, updated_at
|
||||
"SELECT id, channel_type, source_detail, occurrence_address, industry, start_date, end_date, remark, status, cost, created_at, updated_at
|
||||
FROM channel_plans
|
||||
WHERE $whereSql
|
||||
ORDER BY id DESC
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* 渠道新增计划保存接口 POST /api/channel/plan_save.php
|
||||
* 入参:id(可选,编辑时传)/ channel_type(渠道类别=source_channel 枚举,新增时必填)/
|
||||
* source_detail / industry / start_date / end_date / remark / status(待启动|已执行|错过)/ cost(费用(元))
|
||||
* source_detail / occurrence_address(发生地址)/ industry / start_date / end_date / remark / status(待启动|已执行|错过)/ cost(费用(元))
|
||||
* 说明:编辑(传 id)时仅更新提交的字段,便于列表行内实时改状态/费用。
|
||||
*/
|
||||
require_once __DIR__ . '/../common/db.php';
|
||||
@@ -52,7 +52,7 @@ if ($id > 0) {
|
||||
Response::error('计划不存在');
|
||||
}
|
||||
// 只更新提交的字段
|
||||
foreach (['channel_type', 'source_detail', 'industry', 'start_date', 'end_date', 'remark', 'status'] as $k) {
|
||||
foreach (['channel_type', 'source_detail', 'occurrence_address', 'industry', 'start_date', 'end_date', 'remark', 'status'] as $k) {
|
||||
$collect($k);
|
||||
}
|
||||
if (isset($_POST['cost'])) {
|
||||
@@ -76,9 +76,10 @@ if ($channelType === '') {
|
||||
Response::error('渠道类别(channel_type)为必填项', 400);
|
||||
}
|
||||
$fields = [
|
||||
'channel_type' => $channelType,
|
||||
'source_detail' => strOrNull($_POST['source_detail'] ?? null),
|
||||
'industry' => strOrNull($_POST['industry'] ?? null),
|
||||
'channel_type' => $channelType,
|
||||
'source_detail' => strOrNull($_POST['source_detail'] ?? null),
|
||||
'occurrence_address' => strOrNull($_POST['occurrence_address'] ?? null),
|
||||
'industry' => strOrNull($_POST['industry'] ?? null),
|
||||
'start_date' => strOrNull($_POST['start_date'] ?? null),
|
||||
'end_date' => strOrNull($_POST['end_date'] ?? null),
|
||||
'remark' => strOrNull($_POST['remark'] ?? null),
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
-- ============================================================
|
||||
-- SuperLink Web - v1.0.25 数据库结构变更
|
||||
-- 渠道新增计划增加「发生地址」字段(详细到门牌号,单行文本)
|
||||
-- ============================================================
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
ALTER TABLE `channel_plans`
|
||||
ADD COLUMN `occurrence_address` VARCHAR(255) NULL DEFAULT NULL COMMENT '发生地址(详细到门牌号)' AFTER `source_detail`;
|
||||
@@ -67,7 +67,7 @@ $(function () {
|
||||
' <button class="btn btn-success" id="btn-plan-add">+ 新增计划</button>' +
|
||||
' </div>' +
|
||||
' <div class="table-wrap"><table class="grid">' +
|
||||
' <thead><tr><th>ID</th><th>渠道类别</th><th>来源详情</th><th>所属行业</th><th>时间窗口</th><th>剩余天数</th><th>备注说明</th><th>状态反馈</th><th>费用(元)</th><th>创建时间</th></tr></thead>' +
|
||||
' <thead><tr><th>ID</th><th>渠道类别</th><th>来源详情</th><th>发生地址</th><th>所属行业</th><th>时间窗口</th><th>剩余天数</th><th>备注说明</th><th>状态反馈</th><th>费用(元)</th><th>创建时间</th></tr></thead>' +
|
||||
' <tbody id="plan-tbody"></tbody>' +
|
||||
' </table></div>' +
|
||||
' <div class="pagination" id="plan-pagination"></div>' +
|
||||
@@ -225,6 +225,7 @@ $(function () {
|
||||
'<td>' + r.id + '</td>' +
|
||||
'<td>' + escHtml(r.channel_type) + '</td>' +
|
||||
'<td title="' + escHtml(r.source_detail || '') + '">' + escHtml((r.source_detail || '-').substring(0, 16)) + '</td>' +
|
||||
'<td title="' + escHtml(r.occurrence_address || '') + '">' + escHtml((r.occurrence_address || '-').substring(0, 20)) + '</td>' +
|
||||
'<td>' + escHtml(r.industry || '-') + '</td>' +
|
||||
'<td>' + escHtml(win) + '</td>' +
|
||||
'<td>' + (r.remaining_days > 0 ? '<span class="tag' + (r.remaining_days <= 7 ? ' tag-red' : '') + '">' + r.remaining_days + ' 天</span>' : '<span class="tag tag-gray">已到期</span>') + '</td>' +
|
||||
@@ -234,7 +235,7 @@ $(function () {
|
||||
'<td>' + fmtDate(r.created_at) + '</td></tr>';
|
||||
});
|
||||
if (!rows.length) {
|
||||
html = '<tr><td colspan="10" class="empty-tip" style="padding:40px 0;">暂无渠道新增计划</td></tr>';
|
||||
html = '<tr><td colspan="11" class="empty-tip" style="padding:40px 0;">暂无渠道新增计划</td></tr>';
|
||||
}
|
||||
$('#plan-tbody').html(html);
|
||||
bindPlanInlineEdit();
|
||||
@@ -328,6 +329,7 @@ $(function () {
|
||||
' <div class="form-item"><label>渠道类别<span class="req">*</span></label><select name="channel_type">' + chHtml + '</select></div>' +
|
||||
' <div class="form-item"><label>所属行业</label><input type="text" name="industry" value="' + escHtml(r.industry || '') + '"></div>' +
|
||||
' <div class="form-item"><label>来源详情</label><input type="text" name="source_detail" value="' + escHtml(r.source_detail || '') + '" placeholder="如:华南工博会"></div>' +
|
||||
' <div class="form-item"><label>发生地址</label><input type="text" name="occurrence_address" value="' + escHtml(r.occurrence_address || '') + '" placeholder="详细到门牌号,如:深圳市南山区科技园路1号A栋101"></div>' +
|
||||
' <div class="form-item"><label>状态反馈</label><select name="status">' +
|
||||
' <option value="待启动"' + (!r.status || r.status === '待启动' ? ' selected' : '') + '>待启动</option>' +
|
||||
' <option value="已执行"' + (r.status === '已执行' ? ' selected' : '') + '>已执行</option>' +
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ var BASE_URL = '/api/';
|
||||
var PAGE_SIZE = 20;
|
||||
|
||||
/** 系统版本号(logo旁展示):修改代码后运行 tools/bump_version.php 自动递增 */
|
||||
var APP_VERSION = 'v1.0.25';
|
||||
var APP_VERSION = 'v1.0.26';
|
||||
|
||||
/** 页脚版权/备案信息(在 config.js 中修改) */
|
||||
var FOOTER_TEXT = '© 2026 SuperLink 管理系统 版权所有 | 备案号:请替换为真实备案号';
|
||||
|
||||
Reference in New Issue
Block a user