$stationType, 'pageTitle' => $stationName, 'pageIcon' => 'cube', 'cardTitle' => '快速录入', 'tableTitle' => '操作记录', 'dataSources' => [ 'types' => $types ?? [], 'models' => $models ?? [], 'customers' => $customers ?? [], ], 'submitMode' => 'auto', 'codeFields' => ['serial_no'], 'labelFields' => [], 'emptyText' => '暂无记录,请在扫描框中录入第一条数据', 'reloadAfterSubmit' => true, 'enableFilter' => false, ], $bizConfig['view'] ?? []); // 注入全局变量 $GLOBALS['records'] = $parsedRecords; $GLOBALS['fieldConfigs'] = $fieldConfigs; $GLOBALS['types'] = $types ?? []; $GLOBALS['models'] = $models ?? []; $GLOBALS['customers'] = $customers ?? []; $GLOBALS['user'] = $user; $GLOBALS['sysConfig'] = $sysConfig; $GLOBALS['stationType'] = $stationType; $GLOBALS['bizConfig'] = $bizConfig; $GLOBALS['filterType'] = $filterType ?? ''; $GLOBALS['filterModel'] = $filterModel ?? ''; $GLOBALS['todayCount'] = $todayCount ?? 0; $GLOBALS['totalCount'] = $totalCount ?? 0; $GLOBALS['shellColors'] = $shellColors ?? []; $GLOBALS['csrfToken'] = $csrfToken; $GLOBALS['stationError'] = $stationError ?? ''; renderStationTemplate($stationConfig); } else { // ========== 动态工位:使用 station_records 表(JSON 存储) ========== // 解析记录中的 JSON 数据 $parsedRecords = []; if (!empty($records)) { foreach ($records as $rec) { $row = ['id' => $rec['id'], 'operator' => $rec['operator'], 'created_at' => $rec['created_at']]; $jsonData = json_decode($rec['record_data'], true); if (is_array($jsonData)) { $row = array_merge($row, $jsonData); } $parsedRecords[] = $row; } } // 配置工位模板 $stationConfig = [ 'stationKey' => $stationType, 'pageTitle' => $stationName, 'pageIcon' => 'cube', 'cardTitle' => '快速录入', 'tableTitle' => '操作记录', 'dataSources' => [ 'types' => $types ?? [], 'models' => $models ?? [], 'customers' => $customers ?? [], ], 'submitMode' => 'auto', // 扫描回车直接提交 'codeFields' => ['serial_no'], // 序列号类字段 code 样式 'labelFields' => [], 'emptyText' => '暂无记录,请在扫描框中录入第一条数据', 'reloadAfterSubmit' => true, // 提交后刷新页面 'enableFilter' => false, // 不启用联动筛选 ]; // 将解析后的记录和字段配置注入全局,供 renderStationTemplate 使用 $GLOBALS['records'] = $parsedRecords; $GLOBALS['fieldConfigs'] = $fieldConfigs; $GLOBALS['types'] = $types ?? []; $GLOBALS['models'] = $models ?? []; $GLOBALS['customers'] = $customers ?? []; $GLOBALS['user'] = $user; $GLOBALS['sysConfig'] = $sysConfig; $GLOBALS['stationType'] = $stationType; $GLOBALS['bizConfig'] = null; $GLOBALS['filterType'] = ''; $GLOBALS['filterModel'] = ''; $GLOBALS['todayCount'] = 0; $GLOBALS['totalCount'] = $totalCount ?? count($parsedRecords); $GLOBALS['shellColors'] = []; $GLOBALS['csrfToken'] = $csrfToken; $GLOBALS['stationError'] = ''; renderStationTemplate($stationConfig); }