首页
关于
友链
推荐
肥啾解析
百度一下
肥啾GPT
Search
1
宝塔面板登录 phpMyAdmin 提示服务器和客户端上指示的HTTPS之间不匹配
259 阅读
2
Customer complaints evolve with in-car tech
184 阅读
3
测试
147 阅读
4
内连接,左连接,右连接作用及区别
95 阅读
5
所谓关系
94 阅读
默认分类
网游架设
手机游戏
python
PHP
Mysql
VBA
C++
JAVA
java基础
生产管理
计划控制
ERP系统开发
APS排产
MES研究
考勤系统
CPA
财管
实务
经济法
战略
审计
税法
藏书架
古典名著
世界名著
编程秘籍
攻防渗透
经管书籍
大佬传经
风雅读物
考试相关
心情格言
拾玉良言
外文报刊
外刊随选
Facebook
Twitter
China Daily
软考
登录
Search
标签搜索
期刊读物
古文
何瑜明
累计撰写
103
篇文章
累计收到
153
条评论
首页
栏目
默认分类
网游架设
手机游戏
python
PHP
Mysql
VBA
C++
JAVA
java基础
生产管理
计划控制
ERP系统开发
APS排产
MES研究
考勤系统
CPA
财管
实务
经济法
战略
审计
税法
藏书架
古典名著
世界名著
编程秘籍
攻防渗透
经管书籍
大佬传经
风雅读物
考试相关
心情格言
拾玉良言
外文报刊
外刊随选
Facebook
Twitter
China Daily
软考
页面
关于
友链
推荐
肥啾解析
百度一下
肥啾GPT
搜索到
103
篇与
的结果
2025-04-23
javascript运算问题
在js里 "+"是拼接字符串的,而不是逻辑运算符; 数据类型问题: 如果变量是字符串类型,+操作会变成字符串拼接而非数值相加4 建议使用Number()或parseFloat()进行显式转换: javascript Copy Code const planRate = (Number(completedQuantity) / (Number(row.total_quantity) + Number(row.urgent_order_quantity))) * 100 除零错误防护: 当分母为0时会导致Infinity结果46 应增加防护逻辑: javascript Copy Code const denominator = Number(row.total_quantity) + Number(row.urgent_order_quantity); const planRate = denominator !== 0 ? (completedQuantity / denominator) * 100 : 0; 精度处理建议: 使用toFixed()控制小数位数6 javascript Copy Code const planRate = denominator !== 0 ? ((completedQuantity / denominator) * 100).toFixed(2) : 0; 特殊值处理: 建议增加null/undefined检测4 javascript Copy Code const safeValue = (val) => isNaN(Number(val)) ? 0 : Number(val); const denominator = safeValue(row.total_quantity) + safeValue(row.urgent_order_quantity); 公式优化建议: 可参考完成率的标准计算公式:(已完成量/计划总量)×100%6 紧急订单量是否应计入分母需根据业务逻辑确认16 建议使用Chrome开发者工具的Console面板或Node.js环境进行分步调试,使用console.log输出中间变量值检查问题根源4。
2025年04月23日
2 阅读
0 评论
0 点赞
2025-04-19
测试
<?php header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST'); header('Access-Control-Allow-Headers: Content-Type'); try { $input = json_decode(file_get_contents('php://input'), true); if (!$input || !isset($input['data']) || empty($input['data'])) { throw new Exception('无效数据,请检查输入'); } $rawData = $input['data']; $workers = isset($input['workers']) ? intval($input['workers']) : 3; $productivity = isset($input['productivity']) ? intval($input['productivity']) : 70; $startDateStr = isset($input['startDate']) ? $input['startDate'] : null; if (!$startDateStr) { throw new Exception('请提供排产开始日期'); } // 数据库连接 $pdo = new PDO("mysql:host=localhost;dbname=ytpmc;charset=utf8", "ytpmc", "ytpmc321"); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // 查询 sl 表 $slMap = []; $stmt = $pdo->query("SELECT productId, sl FROM text"); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $slMap[$row['productId']] = intval($row['sl']); } $dailyCapacity = $workers * $productivity; $scheduleData = []; $warningData = []; usort($rawData, function ($a, $b) { $dateDiff = strtotime($a['deliveryDate']) - strtotime($b['deliveryDate']); return $dateDiff !== 0 ? $dateDiff : ($a['originalQuantity'] - $b['originalQuantity']); }); $currentDate = new DateTime($startDateStr); $dailyRemaining = $dailyCapacity; $dailyProductionMap = []; // 每日产品排产汇总 $dailyProductCount = 0; $queue = $rawData; while (!empty($queue)) { $isAnyOrderScheduled = false; foreach ($queue as $key => &$item) { $productId = $item['productId']; $quantityRemaining = $item['quantity']; // 获取 sl,并同步 dailyMax if (isset($slMap[$productId])) { $sl = $slMap[$productId]; $item['dailyMax'] = min($item['dailyMax'], $sl); } else { $sl = $item['dailyMax']; } $alreadyProducedToday = $dailyProductionMap[$productId]['quantity'] ?? 0; // 还可排产量(不能超过 dailyMax,也不能超过日产能剩余) $maxAllocatable = min( $quantityRemaining, $item['dailyMax'] - $alreadyProducedToday, $dailyRemaining ); if ($maxAllocatable > 0) { // 累加数量 if (isset($dailyProductionMap[$productId])) { $dailyProductionMap[$productId]['quantity'] += $maxAllocatable; } else { $dailyProductionMap[$productId] = [ 'productId' => $productId, 'quantity' => $maxAllocatable, 'deliveryDate' => $item['deliveryDate'], 'dailyMax' => $item['dailyMax'], 'productionDate' => $currentDate->format('Y-m-d'), 'isLate' => strtotime($currentDate->format('Y-m-d')) > strtotime($item['deliveryDate']), 'sl' => $sl ]; } $item['quantity'] -= $maxAllocatable; $dailyRemaining -= $maxAllocatable; $dailyProductCount++; $isAnyOrderScheduled = true; if ($item['quantity'] <= 0) { unset($queue[$key]); } } if ($dailyProductCount >= 80) { break; } } // 保存每日排产记录 if (!empty($dailyProductionMap)) { foreach ($dailyProductionMap as $record) { $scheduleData[] = $record; } } // 下一天 $currentDate->modify('+1 day'); $dailyRemaining = $dailyCapacity; $dailyProductCount = 0; $dailyProductionMap = []; } // 预警检查 foreach ($rawData as $item) { $lastProdDate = null; foreach ($scheduleData as $schedule) { if ($schedule['productId'] === $item['productId'] && $schedule['deliveryDate'] === $item['deliveryDate']) { $lastProdDate = new DateTime($schedule['productionDate']); } } if ($lastProdDate && $lastProdDate > new DateTime($item['deliveryDate'])) { $lateDays = $lastProdDate->diff(new DateTime($item['deliveryDate']))->days; $warningData[] = [ 'productId' => $item['productId'], 'quantity' => $item['originalQuantity'], 'deliveryDate' => $item['deliveryDate'], 'dailyMax' => $item['dailyMax'], 'productionDate' => $lastProdDate->format('Y-m-d'), 'lateDays' => $lateDays ]; } } echo json_encode([ 'success' => true, 'scheduleData' => $scheduleData, 'warningData' => $warningData ]); } catch (Exception $e) { echo json_encode([ 'success' => false, 'message' => $e->getMessage() ]); } ?>
2025年04月19日
3 阅读
0 评论
0 点赞
2025-04-16
分班问题
<?php header('Content-Type: application/json'); $data = json_decode(file_get_contents('php://input'), true)['data']; $pdo = new PDO('mysql:host=localhost;dbname=ytpmc;charset=utf8', 'ytpmc', 'ytpmc321'); // 读取共用模具信息 $gongyongData = []; $sql = "SELECT productId, promj, promjsl FROM gongyong"; foreach ($pdo->query($sql) as $row) { $gongyongData[$row['productId']] = [ 'mould' => $row['promj'], 'limit' => $row['promjsl'] * 6 ]; } // 按日期分组 $grouped = []; foreach ($data as $row) { list($productId, $qty, $date,$sx) = $row; $grouped[$date][] = ['productId' => $productId, 'quantity' => (int)$qty, 'sx' => $sx]; } $result = []; foreach ($grouped as $date => $items) { $A = []; $B = []; $sumA = 0; $sumB = 0; $typesA = []; $typesB = []; $mouldA = []; $mouldB = []; $warnings = []; $mouldProducts = []; // 存储共用模具的产品信息 $mouldTotalUsage = ['A' => [], 'B' => []]; // 存储各班次模具总使用量 // 预先建立模具到产品的映射关系 foreach ($items as $item) { $pid = $item['productId']; //$sx=$item['sx']; if (isset($gongyongData[$pid])) { $mould = $gongyongData[$pid]['mould']; $mouldProducts[$mould][] = $pid; } } // 拆分任务:将数量 > 10 的产品拆成多个 $splitItems = []; foreach ($items as $item) { if ($item['quantity'] <= 10 && $item['quantity']<=$item['sx'] ) { $splitItems[] = $item; } else { $qty = $item['quantity']; $half = (int)ceil($qty / 2); $splitItems[] = ['productId' => $item['productId'], 'quantity' => $half,'sx' => $item['sx']]; $splitItems[] = ['productId' => $item['productId'], 'quantity' => $qty - $half,'sx' => $item['sx']]; } } // 排序优化(先排大任务) usort($splitItems, function ($a, $b) { return $b['quantity'] - $a['quantity']; }); // 分配任务 foreach ($splitItems as $item) { $pid = $item['productId']; $qty = $item['quantity']; $sx=$item['sx']; $mould = isset($gongyongData[$pid]) ? $gongyongData[$pid]['mould'] : null; $limit = isset($gongyongData[$pid]) ? $gongyongData[$pid]['limit'] : null; // 检查产品是否已在班次中 $inA = isset($typesA[$pid]); $inB = isset($typesB[$pid]); // 计算模具总使用量(同班次所有共用该模具的产品) $mouldATotal = ($mould && isset($mouldTotalUsage['A'][$mould])) ? $mouldTotalUsage['A'][$mould] : 0; $mouldBTotal = ($mould && isset($mouldTotalUsage['B'][$mould])) ? $mouldTotalUsage['B'][$mould] : 0; // 判断分配条件 $canA = !$inA && ($mould ? $mouldATotal + $qty <= 10000 : true); $canB = !$inB && ($mould ? $mouldBTotal + $qty <= 10000 : true); if (!$canA && !$canB) { $sharedProducts = isset($mouldProducts[$mould]) ? implode(',', array_unique($mouldProducts[$mould])) : ''; $warnings[] = "模具 {$mould} 已达到上限 | 共用产品: {$sharedProducts} | 上限: {$limit} | A班已用: {$mouldATotal} | B班已用: {$mouldBTotal}"; continue; } // 分配逻辑 if ($sumA <= $sumB+70 && $canA) { $A[] = ['productId' => $pid, 'quantity' => $qty, 'sx' => $sx]; $sumA += $qty; $typesA[$pid] = true; if ($mould) { $mouldTotalUsage['A'][$mould] = ($mouldTotalUsage['A'][$mould] ?? 0) + $qty; } } elseif ($sumB < $sumA && $canB) { $B[] = ['productId' => $pid, 'quantity' => $qty, 'sx' => $sx]; $sumB += $qty; $typesB[$pid] = true; if ($mould) { $mouldTotalUsage['B'][$mould] = ($mouldTotalUsage['B'][$mould] ?? 0) + $qty; } } elseif ($canA) { $A[] = ['productId' => $pid, 'quantity' => $qty, 'sx' => $sx]; $sumA += $qty; $typesA[$pid] = true; if ($mould) { $mouldTotalUsage['A'][$mould] = ($mouldTotalUsage['A'][$mould] ?? 0) + $qty; } } elseif ($canB) { $B[] = ['productId' => $pid, 'quantity' => $qty, 'sx' => $sx]; $sumB += $qty; $typesB[$pid] = true; if ($mould) { $mouldTotalUsage['B'][$mould] = ($mouldTotalUsage['B'][$mould] ?? 0) + $qty; } } } // 检查是否有共用模具超限情况 foreach ($mouldTotalUsage['A'] as $mould => $used) { if ($used > $gongyongData[$mouldProducts[$mould][0]]['limit']) { $sharedProducts = implode(',', array_unique($mouldProducts[$mould])); $limit = $gongyongData[$mouldProducts[$mould][0]]['limit']; $warnings[] = "A班模具 {$mould} 共用超限需增加模具数量 | 共用产品: {$sharedProducts} | 上限: {$limit} | 已排产: {$used}"; } } foreach ($mouldTotalUsage['B'] as $mould => $used) { if ($used > $gongyongData[$mouldProducts[$mould][0]]['limit']) { $sharedProducts = implode(',', array_unique($mouldProducts[$mould])); $limit = $gongyongData[$mouldProducts[$mould][0]]['limit']; $warnings[] = "B班模具 {$mould} 共用超限需增加模具数量 | 共用产品: {$sharedProducts} | 上限: {$limit} | 已排产: {$used}"; } } $result[$date] = [ 'A' => $A, 'B' => $B, 'sumA' => $sumA, 'sumB' => $sumB, 'typesA' => count($typesA), 'typesB' => count($typesB), 'warnings' => array_unique($warnings), // 去重 'mouldUsage' => [ 'A' => $mouldTotalUsage['A'], 'B' => $mouldTotalUsage['B'] ], 'mouldInfo' => $mouldProducts ]; } echo json_encode($result, JSON_UNESCAPED_UNICODE);
2025年04月16日
3 阅读
0 评论
0 点赞
2025-04-15
group by重复聚合问题
今天测试时发现有个数据汇总的很有问题,查了下发现出现重复聚合的问题JOIN 关联导致数据膨胀(核心原因)问题本质:LEFT JOIN complete c ON o.part_number = c.nbbh 导致 orders 表数据被重复关联。若 complete 表中存在 多个 nbbh 与同一个 part_number 匹配,则 orders 表的单条记录会被扩展为多条,进而触发 SUM 函数重复累加 quantity 值验证方法:sqlCopy Code-- 检查关联后的总行数是否膨胀SELECT o.part_number, COUNT(*) FROM orders o LEFT JOIN complete c ON o.part_number = c.nbbh WHERE o.zt = '安全库存' GROUP BY o.part_number;若结果中 COUNT(*) 大于 1,则说明存在重复关联36。二、修正方案方案 1:先聚合再关联(推荐)在关联 complete 表前,先对 orders 表按 part_number 完成聚合:sqlCopy CodeSELECTo.part_number, o.urgent_order_quantity -- 直接使用子查询的聚合结果FROM (SELECT part_number, SUM(CASE WHEN zt = '安全库存' THEN quantity ELSE 0 END) AS urgent_order_quantity FROM orders GROUP BY part_number) o LEFT JOIN complete c ON o.part_number = c.nbbh;方案 2:移除冗余关联若 complete 表数据未被实际使用,直接删除关联逻辑:sqlCopy CodeSELECTpart_number, SUM(CASE WHEN zt = '安全库存' THEN quantity ELSE 0 END) AS urgent_order_quantityFROM ordersGROUP BY part_number;三、其他潜在问题排查字段值匹配问题执行以下查询确认 zt 字段实际值是否严格为 安全库存:sqlCopy CodeSELECT DISTINCT zt FROM orders WHERE part_number = '具体零件编号';若存在空格或特殊字符(如 安全库存 ),需修正条件判断12。数据重复问题检查 orders 表中同一 part_number 是否存在多条 zt = '安全库存' 的记录:sqlCopy CodeSELECT part_number, COUNT(*) FROM orders WHERE zt = '安全库存' GROUP BY part_number;四、总结核心问题:LEFT JOIN 导致数据重复,引发 SUM 计算错误36。推荐操作:优先采用 先聚合再关联 的方案,避免关联表引发数据膨胀36。补充验证:同步检查字段值匹配性和数据重复性14。确实存在重复关联问题DeepSeek-R1满血版 回答完成深度思考完成 用时23秒,搜索全网23篇资料针对多表关联导致的数据重复问题,以下是系统性解决方案及实施步骤:一、重复关联根因分析关联条件非唯一性LEFT JOIN 关联的右表(如 complete 表)中存在 多个记录匹配左表同一主键,导致左表单条数据被重复扩展17。验证方法:sqlCopy Code-- 检查 complete 表中 nbbh 的重复性SELECT nbbh, COUNT(*) FROM complete GROUP BY nbbh HAVING COUNT(*) > 1;一对多关系未处理若 orders.part_number 与 complete.nbbh 是 一对多关系,直接关联会导致 orders 数据膨胀67。二、解决方案(按优先级排序)方案 1:先聚合右表再关联(推荐)在关联前对右表按关联字段聚合,确保左表每条记录仅匹配右表一条数据16:sqlCopy CodeSELECTo.part_number, SUM(CASE WHEN o.zt = '安全库存' THEN o.quantity ELSE 0 END) AS safety_stock_quantityFROM orders oLEFT JOIN (SELECT nbbh, SUM(sl) AS total_sl -- 对右表聚合 FROM complete GROUP BY nbbh) c ON o.part_number = c.nbbhGROUP BY o.part_number;方案 2:增加唯一性关联条件若右表存在其他唯一字段(如时间、状态),通过复合条件强制一对一关联17:sqlCopy CodeSELECTo.part_number, SUM(CASE WHEN o.zt = '安全库存' THEN o.quantity ELSE 0 END) AS safety_stock_quantityFROM orders oLEFT JOIN complete c ON o.part_number = c.nbbhAND c.date = '2025-04-15' -- 补充唯一条件(需按业务调整)GROUP BY o.part_number;方案 3:使用 DISTINCT 去重对关联结果强制去重(适用于小数据量场景,性能敏感场景慎用)34:sqlCopy CodeSELECT DISTINCTo.part_number, SUM(CASE WHEN o.zt = '安全库存' THEN o.quantity ELSE 0 END) OVER (PARTITION BY o.part_number) AS safety_stock_quantityFROM orders oLEFT JOIN complete c ON o.part_number = c.nbbh;三、附加验证与优化数据类型一致性验证检查 orders.part_number 与 complete.nbbh 的数据类型是否严格一致(如 VARCHAR vs BIGINT),避免隐式转换导致关联失效2。空值处理优化在聚合函数中显式处理空值,避免统计失真56:sqlCopy CodeSUM(CASE WHEN o.zt = '安全库存' THEN COALESCE(o.quantity, 0) ELSE 0 END)四、典型场景对比场景 推荐方案 优势 局限性右表数据量大 方案1(先聚合) 减少关联数据量,提升性能 需修改SQL结构右表有唯一辅助字段 方案2(复合条件) 保留明细数据 依赖额外唯一字段快速临时修复 方案3(DISTINCT) 改动最小 性能差,不适用大数据量一、重复统计根因分析 complete 表多值关联引发数据膨胀 LEFT JOIN complete c ON o.part_number = c.nbbh 导致 orders 表每条记录可能关联到 complete 表多条数据,进而使 SUM 函数对 quantity 重复累加16。 关联表未预聚合 complete 表的 sl 字段未按 nbbh 预先聚合,直接关联导致统计值翻倍68。 二、优化方案(分两步修正) 1. 修正 complete 表关联逻辑 对右表 complete 先按 nbbh 聚合,消除重复关联影响: sql Copy Code SELECT o.part_number, SUM(CASE WHEN o.zt = '安全库存' THEN o.quantity ELSE 0 END) AS urgent_order_quantity, SUM(CASE WHEN o.zt = '周计划' THEN o.quantity ELSE 0 END) AS weekly_plan_quantity, SUM(CASE WHEN o.zt = '外围' THEN o.quantity ELSE 0 END) AS external_plan_quantity, COALESCE(c.total_sl, 0) AS completed_quantity -- 直接引用预聚合结果 FROM orders o LEFT JOIN ( SELECT nbbh, SUM(sl) AS total_sl -- 预先聚合右表 FROM complete GROUP BY nbbh ) c ON o.part_number = c.nbbh GROUP BY o.part_number; 2. 验证字段值匹配性 检查 orders.zt 字段的实际值是否包含 安全库存、周计划、外围 等精确匹配值: sql Copy Code SELECT DISTINCT zt FROM orders; 若存在空格或大小写问题,需调整 CASE WHEN 条件中的匹配规则14。 三、关键优化点说明 优化项 原查询问题 修正后效果 complete 表关联方式 直接关联导致 SUM 重复计算68 预聚合后消除重复关联风险68 字段值匹配 模糊匹配导致统计遗漏14 精确匹配目标状态值14 空值处理 未显式处理 NULL 值48 COALESCE 确保数值稳定性48 四、附加验证建议 关联字段一致性验证 检查 orders.part_number 和 complete.nbbh 的编码规则是否一致(如数据类型、分隔符等),避免关联失效57: sql Copy Code SELECT part_number FROM orders LIMIT 10; SELECT nbbh FROM complete LIMIT 10; 数据重复性排查 确认 orders 表中同一 part_number 是否存在多条相同 zt 的记录: sql Copy Code SELECT part_number, zt, COUNT(*) FROM orders GROUP BY part_number, zt HAVING COUNT(*) > 1;
2025年04月15日
3 阅读
0 评论
0 点赞
2025-04-11
test
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>生产计划跟踪</title> <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet"> <style> .nav-tabs { border-bottom: 2px solid #0d6efd; } .tab-pane { padding: 20px 0; } .progress-bar { transition: width 0.3s ease; } input[type="number"] { max-width: 120px; } .card { box-shadow: 0 2px 8px rgba(0,0,0,0.1); } .table-hover tbody tr:hover { background-color: #f8f9fa; } </style> </head> <body class="bg-light"> <div class="container py-4"> <!-- 产品汇总标签页 --> <h3 class="mb-4 text-primary">生产计划总览</h3> <nav> <div class="nav nav-tabs" id="nav-tab" role="tablist"> <?php $conn = new mysqli("localhost", "ytpmc", "ytpmc321", "ytpmc"); $parts = $conn->query("SELECT num, sum(sl),ht as total FROM `ordert` where ht='缠布' GROUP BY num"); $parts2 = $conn->query("SELECT num,part,sl,pbsj,zt,ht FROM `ordert` where ht='缠布'"); $first = true; while($row = $parts->fetch_assoc()) { // $active = $first ? 'active' : ''; echo '<button class="nav-link '.$active.'" data-bs-toggle="tab" data-bs-target="#part'.$row['num'].'" type="button"> '.$row['num'].' <span class="badge bg-primary">'.$row['total'].'</span> </button>'; $first = false; } ?> </div> </nav> <!-- 明细内容区域 --> <div class="tab-content mt-3" id="nav-tabContent"> <?php $parts2 = $conn->query("SELECT num,part,sl,pbsj,zt,ht FROM `ordert` where ht='缠布'"); $parts2->data_seek(0); while($part = $parts2->fetch_assoc()) { $active = $part === reset($parts2) ? 'show active' : ''; echo '<div class="tab-pane fade '.$active.'" id="part'.$part['num'].'"> <div class="card"> <div class="card-header bg-white"> <h5>'.$part['num'].' - 生产明细</h5> </div> <div class="card-body"> <table class="table table-hover"> <thead> <tr> <th>产品编号</th> <th>需求数量</th> <th>完成数量</th> <th>操作</th> </tr> </thead> <tbody>'; $sql = "SELECT id,part,sl,wc_sl,zt,ht FROM `ordert` WHERE ht='缠布' AND num='{$part['num']}'"; $details = $conn->query($sql); while($row = $details->fetch_assoc()) { echo '<tr> <td>'.$row['part'].'</td> <td>'.$row['sl'].'</td> <td> <input type="number" class="form-control complete-input" min="0" max="'.$row['sl'].'" value="'.$row['wc_sl'].'" '.($row['zt'] == 'wc' ? 'disabled' : '').'> </td> <td> <button class="btn btn-sm '.($row['zt'] == 'wc' ? 'btn-success' : 'btn-primary').' save-btn" data-num="'.$row['part'].'" '.($row['zt'] == 'wc' ? 'disabled' : '').'> '.($row['zt'] == 'wc' ? '已完成' : '保存').' </button> </td> </tr>'; } echo '</tbody></table></div></div></div>'; } ?> </div> </div> <script src="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script> <script> document.querySelectorAll('.save-btn').forEach(btn => { btn.addEventListener('click', async function() { const num = this.dataset.num; const wc_sl = this.closest('tr').querySelector('.complete-input').value; try { const response = await fetch('update.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ num, wc_sl }) }); const result = await response.json(); if(result.success) { alert('保存成功!'); location.reload(); } else { alert('保存失败:' + result.message); } } catch(error) { console.error('Error:', error); } }); }); </script> </body> </html>
2025年04月11日
3 阅读
0 评论
0 点赞
1
2
3
...
21
0:00