feat: 完善仓库建筑绑定、质检预警规则与大屏展示
这个提交包含在:
@@ -99,6 +99,26 @@ class Granary extends Backend
|
|||||||
{
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
|
$content = isset($data['content']) && is_array($data['content']) ? $data['content'] : [];
|
||||||
|
$position = isset($content['screenPosition']) ? $content['screenPosition'] : '';
|
||||||
|
$positions = \app\common\library\GranaryScreen::extraPositions();
|
||||||
|
if ($position !== '' && !isset($positions[$position])) {
|
||||||
|
return json(['code' => 400, 'msg' => '请选择有效的大屏建筑位置']);
|
||||||
|
}
|
||||||
|
if ($position !== '') {
|
||||||
|
if (strpos($data['storage'], '习水') !== false) {
|
||||||
|
return json(['code' => 400, 'msg' => '此建筑位置属于中心库区']);
|
||||||
|
}
|
||||||
|
foreach ($this->model->field('id,content')->select() as $existing) {
|
||||||
|
$saved = $existing['content'];
|
||||||
|
if (!is_array($saved)) $saved = json_decode($saved, true);
|
||||||
|
if ((string)$existing['id'] !== (string)(isset($data['id']) ? $data['id'] : 0)
|
||||||
|
&& isset($saved['screenPosition']) && $saved['screenPosition'] === $position) {
|
||||||
|
return json(['code' => 400, 'msg' => '此建筑已绑定仓库,请编辑对应仓库或选择其他位置']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['content'] = $content;
|
||||||
$id = $this->model->where(['num' => $data['num']])->value('id');
|
$id = $this->model->where(['num' => $data['num']])->value('id');
|
||||||
if (isset($data['granary_type']) && in_array(intval($data['granary_type']), [1, 2])) {
|
if (isset($data['granary_type']) && in_array(intval($data['granary_type']), [1, 2])) {
|
||||||
$data['granary_type'] = intval($data['granary_type']);
|
$data['granary_type'] = intval($data['granary_type']);
|
||||||
|
|||||||
@@ -113,6 +113,10 @@ class Testing extends Backend
|
|||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
$content = $data['content'];
|
$content = $data['content'];
|
||||||
$date = $data['record_date'];
|
$date = $data['record_date'];
|
||||||
|
$ruleError = \app\common\library\QualityRule::validate($content);
|
||||||
|
if ($ruleError !== '') {
|
||||||
|
return json(['code' => 400, 'msg' => $ruleError]);
|
||||||
|
}
|
||||||
|
|
||||||
// 添加
|
// 添加
|
||||||
if (empty($data['id'])) {
|
if (empty($data['id'])) {
|
||||||
|
|||||||
@@ -270,6 +270,14 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="大屏建筑位置:">
|
||||||
|
<el-select v-model="formData.screenPosition" style="width: 440px;">
|
||||||
|
<el-option label="保留现有建筑位置" value=""></el-option>
|
||||||
|
<el-option label="中心库 · 左上新增仓库(42号仓左侧)" value="center_upper_left"></el-option>
|
||||||
|
<el-option label="中心库 · 右下新增仓库(41号仓左侧)" value="center_lower_right"></el-option>
|
||||||
|
</el-select>
|
||||||
|
<div style="color: #909399;">新仓库请选择对应建筑;现有标记可直接修改仓号,保存后大屏自动同步。</div>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="仓房类型:" prop="granary_type">
|
<el-form-item label="仓房类型:" prop="granary_type">
|
||||||
<el-radio-group v-model="formData.granary_type" @change="changeGranaryType" size="small">
|
<el-radio-group v-model="formData.granary_type" @change="changeGranaryType" size="small">
|
||||||
<el-radio-button :label="1">立式油罐 (油类)</el-radio-button>
|
<el-radio-button :label="1">立式油罐 (油类)</el-radio-button>
|
||||||
|
|||||||
@@ -35,6 +35,16 @@
|
|||||||
.search-select .el-input--suffix .el-input__inner {
|
.search-select .el-input--suffix .el-input__inner {
|
||||||
width: 130px;
|
width: 130px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.quality-direction-toggle {
|
||||||
|
display: inline-flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quality-direction-toggle .el-button {
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<div id="vue" v-cloak>
|
<div id="vue" v-cloak>
|
||||||
<div class="screen-container">
|
<div class="screen-container">
|
||||||
@@ -214,39 +224,63 @@
|
|||||||
<el-input type="number" placeholder="排序" style="width: 330px;" v-model="formData.sort"></el-input>
|
<el-input type="number" placeholder="排序" style="width: 330px;" v-model="formData.sort"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="检测参数:" prop="content">
|
<el-form-item label="检测参数:" prop="content">
|
||||||
|
<p>数值指标请选择“越大越好”或“越小越好”。绿色为达标、黄色为预警、红色为警告;等于阈值时归入较低一级,保存后对大屏生效。</p>
|
||||||
<el-table :data="typeList[formData.type]['content']" border highlight-current-row>
|
<el-table :data="typeList[formData.type]['content']" border highlight-current-row>
|
||||||
<el-table-column prop="num" width="60" label="序号" show-overflow-tooltip
|
<el-table-column prop="num" width="60" label="序号" show-overflow-tooltip
|
||||||
align="center"></el-table-column>
|
align="center"></el-table-column>
|
||||||
<el-table-column prop="name" label="检测项目" show-overflow-tooltip
|
<el-table-column prop="name" label="检测项目" show-overflow-tooltip
|
||||||
align="center"></el-table-column>
|
align="center"></el-table-column>
|
||||||
<el-table-column prop="unit" width="160" label="单位" show-overflow-tooltip
|
<el-table-column prop="unit" width="110" label="单位" show-overflow-tooltip
|
||||||
align="center">
|
align="center">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<el-input style="width: 130px;" placeholder="单位" size="small" maxlength="15" show-word-limit
|
<el-input style="width: 85px;" placeholder="单位" size="small" maxlength="15" show-word-limit
|
||||||
v-model="typeList[formData.type]['content'][scope.$index].unit"></el-input>
|
v-model="typeList[formData.type]['content'][scope.$index].unit"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="val" width="200" label="值" show-overflow-tooltip
|
<el-table-column prop="val" width="130" label="值" show-overflow-tooltip
|
||||||
align="center">
|
align="center">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<el-input style="width: 150px;" placeholder="请您输入值" size="small" maxlength="50" show-word-limit
|
<el-input style="width: 110px;" placeholder="请您输入值" size="small" maxlength="50" show-word-limit
|
||||||
v-model="typeList[formData.type]['content'][scope.$index].val"></el-input>
|
v-model="typeList[formData.type]['content'][scope.$index].val"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="warning" width="230" label="预警值" show-overflow-tooltip
|
<el-table-column prop="warning" width="140" label="预警值" show-overflow-tooltip
|
||||||
align="center">
|
align="center">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<el-input style="width: 170px;" placeholder="请您输入预警值" size="small" maxlength="50" show-word-limit
|
<el-input style="width: 120px;" placeholder="请您输入预警值" size="small" maxlength="50" show-word-limit
|
||||||
v-model="typeList[formData.type]['content'][scope.$index].warning"></el-input>
|
v-model="typeList[formData.type]['content'][scope.$index].warning"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="alert" width="230" label="警戒值" show-overflow-tooltip
|
<el-table-column prop="alert" width="140" label="警告值" show-overflow-tooltip
|
||||||
align="center">
|
align="center">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<el-input style="width: 170px;" placeholder="请您输入警戒值" size="small" maxlength="50" show-word-limit
|
<el-input style="width: 120px;" placeholder="请您输入警告值" size="small" maxlength="50" show-word-limit
|
||||||
v-model="typeList[formData.type]['content'][scope.$index].alert"></el-input>
|
v-model="typeList[formData.type]['content'][scope.$index].alert"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column width="270" fixed="right" label="指标偏好与颜色规则" align="left">
|
||||||
|
<template scope="scope">
|
||||||
|
<template v-if="isNumericRule(scope.row)">
|
||||||
|
<el-button-group class="quality-direction-toggle" :aria-label="'选择' + scope.row.name + '的指标偏好'">
|
||||||
|
<el-button size="mini" :type="ruleDirection(scope.row) === 'lower' ? 'success' : 'default'"
|
||||||
|
:plain="ruleDirection(scope.row) !== 'lower'"
|
||||||
|
:aria-pressed="ruleDirection(scope.row) === 'lower'"
|
||||||
|
@click="setRuleDirection(scope.row, 'lower')">越大越好</el-button>
|
||||||
|
<el-button size="mini" :type="ruleDirection(scope.row) === 'upper' ? 'success' : 'default'"
|
||||||
|
:plain="ruleDirection(scope.row) !== 'upper'"
|
||||||
|
:aria-pressed="ruleDirection(scope.row) === 'upper'"
|
||||||
|
@click="setRuleDirection(scope.row, 'upper')">越小越好</el-button>
|
||||||
|
</el-button-group>
|
||||||
|
<div v-if="ruleError(scope.row)" style="color: #c0392b; margin-top: 6px;">{{ruleError(scope.row)}}</div>
|
||||||
|
<div v-else style="font-size: 12px; line-height: 22px; margin-top: 6px;">
|
||||||
|
<div style="color: #16844a;">绿 · {{ruleRanges(scope.row)[0]}}</div>
|
||||||
|
<div style="color: #946200;">黄 · {{ruleRanges(scope.row)[1]}}</div>
|
||||||
|
<div style="color: #c0392b;">红 · {{ruleRanges(scope.row)[2]}}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<span v-else>文字指标,按检测结果判定</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="alert" width="100" label="图表" show-overflow-tooltip
|
<el-table-column prop="alert" width="100" label="图表" show-overflow-tooltip
|
||||||
align="center">
|
align="center">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
@@ -274,7 +308,7 @@
|
|||||||
width="98%"
|
width="98%"
|
||||||
>
|
>
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<el-form ref="form" :model="formData" label-width="110px">
|
<el-form ref="detailForm" :model="formData" label-width="110px">
|
||||||
<el-form-item label="所属仓库:" prop="gid">
|
<el-form-item label="所属仓库:" prop="gid">
|
||||||
<div>{{detail.granary.name}}</div>
|
<div>{{detail.granary.name}}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -308,9 +342,20 @@
|
|||||||
<el-table-column prop="warning" width="230" label="预警值" show-overflow-tooltip
|
<el-table-column prop="warning" width="230" label="预警值" show-overflow-tooltip
|
||||||
align="center">
|
align="center">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="alert" width="230" label="警戒值" show-overflow-tooltip
|
<el-table-column prop="alert" width="230" label="警告值" show-overflow-tooltip
|
||||||
align="center">
|
align="center">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column width="250" label="指标偏好与颜色规则" align="left">
|
||||||
|
<template scope="scope">
|
||||||
|
<template v-if="isNumericRule(scope.row)">
|
||||||
|
<div>{{ruleDirection(scope.row) === 'lower' ? '● 越大越好' : '● 越小越好'}}</div>
|
||||||
|
<div style="color: #16844a;">绿 · {{ruleRanges(scope.row)[0]}}</div>
|
||||||
|
<div style="color: #946200;">黄 · {{ruleRanges(scope.row)[1]}}</div>
|
||||||
|
<div style="color: #c0392b;">红 · {{ruleRanges(scope.row)[2]}}</div>
|
||||||
|
</template>
|
||||||
|
<span v-else>文字指标,按检测结果判定</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -326,4 +371,4 @@
|
|||||||
<script src="__CDN__/assets/element-ui-2.15.14/js/index.js"></script>
|
<script src="__CDN__/assets/element-ui-2.15.14/js/index.js"></script>
|
||||||
<script src="__CDN__/assets/tool/libs/moment.js"></script>
|
<script src="__CDN__/assets/tool/libs/moment.js"></script>
|
||||||
<script src="/assets/js/sweetalert.min.js"></script>
|
<script src="/assets/js/sweetalert.min.js"></script>
|
||||||
<script src="__CDN__/assets/js/jquery-2.1.1.min.js"></script>
|
<script src="__CDN__/assets/js/jquery-2.1.1.min.js"></script>
|
||||||
|
|||||||
@@ -52,8 +52,23 @@ class Index extends Api
|
|||||||
if (!empty($list) && count($list) > 0) {
|
if (!empty($list) && count($list) > 0) {
|
||||||
$list = collection($list)->toArray();
|
$list = collection($list)->toArray();
|
||||||
|
|
||||||
|
// Load saved rules in two queries rather than one query per granary.
|
||||||
|
$tests = TestingModel::with(['testingParams'])
|
||||||
|
->where('gid', 'in', array_column($list, 'id'))
|
||||||
|
->order('test_date DESC, id DESC')->select();
|
||||||
|
$latestTests = [];
|
||||||
|
foreach ($tests as $test) {
|
||||||
|
$test = $test->toArray();
|
||||||
|
$testKey = $test['gid'] . ':' . $test['type'];
|
||||||
|
if (!isset($latestTests[$testKey])) {
|
||||||
|
$latestTests[$testKey] = $test;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($list as &$v) {
|
foreach ($list as &$v) {
|
||||||
$v['varieties'] = getVarietiesInfo($v['varieties']);
|
$v['varieties'] = getVarietiesInfo($v['varieties']);
|
||||||
|
$testKey = $v['id'] . ':' . $v['varieties']['type'];
|
||||||
|
$v['quality_test'] = isset($latestTests[$testKey]) ? $latestTests[$testKey] : null;
|
||||||
$v['harvest_year'] = is_numeric($v['harvest_year']) ? date('Y-m-d', $v['harvest_year']) : $v['harvest_year'];
|
$v['harvest_year'] = is_numeric($v['harvest_year']) ? date('Y-m-d', $v['harvest_year']) : $v['harvest_year'];
|
||||||
$v['enter_time'] = is_numeric($v['enter_time']) ? date('Y-m-d', $v['enter_time']) : $v['enter_time'];
|
$v['enter_time'] = is_numeric($v['enter_time']) ? date('Y-m-d', $v['enter_time']) : $v['enter_time'];
|
||||||
$v['create_time'] = is_numeric($v['create_time']) ? date('Y-m-d', $v['create_time']) : $v['create_time'];
|
$v['create_time'] = is_numeric($v['create_time']) ? date('Y-m-d', $v['create_time']) : $v['create_time'];
|
||||||
@@ -72,6 +87,12 @@ class Index extends Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
$coords = $this->getSiteCoords($site);
|
$coords = $this->getSiteCoords($site);
|
||||||
|
if ($site !== 'xishui' && is_array($list)) {
|
||||||
|
foreach ($list as &$granary) {
|
||||||
|
$granary['screen_coord'] = \app\common\library\GranaryScreen::resolve($granary, $coords);
|
||||||
|
}
|
||||||
|
unset($granary);
|
||||||
|
}
|
||||||
|
|
||||||
$this->success('获取成功', [
|
$this->success('获取成功', [
|
||||||
'list' => $list,
|
'list' => $list,
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\library;
|
||||||
|
|
||||||
|
/** 建筑位置独立于仓号,修改仓号不会移动大屏标记。 */
|
||||||
|
class GranaryScreen
|
||||||
|
{
|
||||||
|
public static function extraPositions()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'center_upper_left' => ['x' => 46.8, 'y' => 28.4],
|
||||||
|
'center_lower_right' => ['x' => 58.8, 'y' => 34.1],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function resolve($item, $coords)
|
||||||
|
{
|
||||||
|
$content = is_array($item['content']) ? $item['content'] : json_decode($item['content'], true);
|
||||||
|
$position = isset($content['screenPosition']) ? $content['screenPosition'] : '';
|
||||||
|
$extra = self::extraPositions();
|
||||||
|
if (isset($extra[$position])) {
|
||||||
|
return $extra[$position];
|
||||||
|
}
|
||||||
|
// 历史记录按数据库 id 锚定原建筑,避免改号后套用另一栋仓库的位置。
|
||||||
|
$originalNumbers = [27 => 30, 29 => 31, 30 => 32, 31 => 10, 33 => 42,
|
||||||
|
34 => 33, 36 => 35, 37 => 36, 38 => 12, 39 => 39, 40 => 40,
|
||||||
|
42 => 41, 43 => 14, 44 => 37, 45 => 15, 46 => 44, 47 => 16,
|
||||||
|
48 => 17, 49 => 18, 50 => 38, 51 => 43];
|
||||||
|
$num = isset($originalNumbers[$item['id']]) ? $originalNumbers[$item['id']] : null;
|
||||||
|
return $num !== null && isset($coords[$num]) ? $coords[$num] : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\library;
|
||||||
|
|
||||||
|
/** Numeric warning rules shared by the editor and persistence layer. */
|
||||||
|
class QualityRule
|
||||||
|
{
|
||||||
|
public static function direction($item)
|
||||||
|
{
|
||||||
|
if (isset($item['direction']) && in_array($item['direction'], ['upper', 'lower'], true)) {
|
||||||
|
return $item['direction'];
|
||||||
|
}
|
||||||
|
$warning = isset($item['warning']) ? $item['warning'] : null;
|
||||||
|
$alert = isset($item['alert']) ? $item['alert'] : null;
|
||||||
|
return is_numeric($warning) && is_numeric($alert) && $warning > $alert ? 'lower' : 'upper';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function validate($content)
|
||||||
|
{
|
||||||
|
if (!is_array($content) || empty($content)) {
|
||||||
|
return '请填写检测参数';
|
||||||
|
}
|
||||||
|
foreach ($content as $item) {
|
||||||
|
if (!is_array($item)) {
|
||||||
|
return '检测参数格式无效';
|
||||||
|
}
|
||||||
|
if (isset($item['direction']) && !in_array($item['direction'], ['upper', 'lower'], true)) {
|
||||||
|
return '预警方向无效';
|
||||||
|
}
|
||||||
|
if (!isset($item['warning'], $item['alert'])) {
|
||||||
|
return '请填写预警值和警告值';
|
||||||
|
}
|
||||||
|
if (is_numeric($item['warning']) && is_numeric($item['alert'])) {
|
||||||
|
$upper = self::direction($item) === 'upper';
|
||||||
|
if (($upper && $item['warning'] > $item['alert'])
|
||||||
|
|| (!$upper && $item['warning'] < $item['alert'])) {
|
||||||
|
return $item['name'] . ($upper
|
||||||
|
? ':越小越好指标要求预警值 ≤ 警告值(高值预警)'
|
||||||
|
: ':越大越好指标要求预警值 ≥ 警告值(低值预警)');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -799,6 +799,13 @@ class TestingModel extends Model
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
foreach ($typeArr as &$type) {
|
||||||
|
foreach ($type['content'] as &$item) {
|
||||||
|
$item['direction'] = \app\common\library\QualityRule::direction($item);
|
||||||
|
}
|
||||||
|
unset($item);
|
||||||
|
}
|
||||||
|
unset($type);
|
||||||
return $typeArr;
|
return $typeArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -914,6 +921,7 @@ class TestingModel extends Model
|
|||||||
'val' => $v['val'],
|
'val' => $v['val'],
|
||||||
'warning' => $v['warning'],
|
'warning' => $v['warning'],
|
||||||
'alert' => $v['alert'],
|
'alert' => $v['alert'],
|
||||||
|
'direction' => \app\common\library\QualityRule::direction($v),
|
||||||
'test_date' => $data['test_date'],
|
'test_date' => $data['test_date'],
|
||||||
'year' => $data['year'],
|
'year' => $data['year'],
|
||||||
'season' => $data['season'],
|
'season' => $data['season'],
|
||||||
@@ -956,6 +964,7 @@ class TestingModel extends Model
|
|||||||
'val' => $v['val'],
|
'val' => $v['val'],
|
||||||
'warning' => $v['warning'],
|
'warning' => $v['warning'],
|
||||||
'alert' => $v['alert'],
|
'alert' => $v['alert'],
|
||||||
|
'direction' => \app\common\library\QualityRule::direction($v),
|
||||||
'test_date' => $data['test_date'],
|
'test_date' => $data['test_date'],
|
||||||
'year' => $data['year'],
|
'year' => $data['year'],
|
||||||
'season' => $data['season'],
|
'season' => $data['season'],
|
||||||
@@ -1013,4 +1022,4 @@ class TestingModel extends Model
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
3
data.sql
3
data.sql
@@ -902,3 +902,6 @@ UNLOCK TABLES;
|
|||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2024-11-24 22:58:20
|
-- Dump completed on 2024-11-24 22:58:20
|
||||||
|
|
||||||
|
-- Persist per-indicator warning direction after seed inserts.
|
||||||
|
ALTER TABLE `fa_testing_params` ADD COLUMN `direction` varchar(5) DEFAULT NULL COMMENT '预警方向:upper高值预警、lower低值预警';
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Apply once before deploying the editor/API changes. Adjust fa_ if using a custom prefix.
|
||||||
|
-- NULL preserves historical inference until a user explicitly saves a direction.
|
||||||
|
ALTER TABLE `fa_testing_params`
|
||||||
|
ADD COLUMN `direction` varchar(5) DEFAULT NULL COMMENT '指标偏好:upper越小越好(高值预警)、lower越大越好(低值预警)';
|
||||||
@@ -395,6 +395,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
image: '',
|
image: '',
|
||||||
storage: '成都直属库有限公司本部',
|
storage: '成都直属库有限公司本部',
|
||||||
num: '',
|
num: '',
|
||||||
|
screenPosition: '',
|
||||||
granary_type: 1,
|
granary_type: 1,
|
||||||
varieties: '菜籽油',
|
varieties: '菜籽油',
|
||||||
content: []
|
content: []
|
||||||
@@ -413,6 +414,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
image: item.image,
|
image: item.image,
|
||||||
storage: item.storage,
|
storage: item.storage,
|
||||||
num: item.num,
|
num: item.num,
|
||||||
|
screenPosition: (item.content || {}).screenPosition || '',
|
||||||
old_num: item.num,
|
old_num: item.num,
|
||||||
granary_type: item.granary_type || (item.num > 18 ? 2 : 1),
|
granary_type: item.granary_type || (item.num > 18 ? 2 : 1),
|
||||||
varieties: item.varieties,
|
varieties: item.varieties,
|
||||||
@@ -433,7 +435,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
this.varietiesType = 'two';
|
this.varietiesType = 'two';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.contentFields[this.contentType] = item.content || {};
|
this.contentFields[this.contentType] = JSON.parse(JSON.stringify(item.content || {}));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 查看详情
|
// 查看详情
|
||||||
@@ -503,6 +505,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fields['varieties'] = this.formData.varieties;
|
fields['varieties'] = this.formData.varieties;
|
||||||
|
fields['screenPosition'] = this.formData.screenPosition || '';
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
let loading = this.$loading({
|
let loading = this.$loading({
|
||||||
@@ -512,12 +515,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
background: 'rgba(0, 0, 0, 0.3)'
|
background: 'rgba(0, 0, 0, 0.3)'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.formData.content = fields;
|
const payload = Object.assign({}, this.formData, {content: fields});
|
||||||
|
delete payload.screenPosition;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'granary/add',
|
url: 'granary/add',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: this.formData,
|
data: payload,
|
||||||
success: res => {
|
success: res => {
|
||||||
loading.close();
|
loading.close();
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
|||||||
@@ -115,6 +115,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
isNumericRule(item) {
|
||||||
|
return [item.warning, item.alert].every(value =>
|
||||||
|
value !== null && value !== undefined && String(value).trim() !== '' && Number.isFinite(Number(value)));
|
||||||
|
},
|
||||||
|
ruleDirection(item) {
|
||||||
|
return item.direction === 'upper' || item.direction === 'lower' ? item.direction
|
||||||
|
: (this.isNumericRule(item) && Number(item.warning) > Number(item.alert) ? 'lower' : 'upper');
|
||||||
|
},
|
||||||
|
rulePreference(item) {
|
||||||
|
return this.ruleDirection(item) === 'lower' ? 'higher' : 'lower';
|
||||||
|
},
|
||||||
|
setRuleDirection(item, direction) {
|
||||||
|
if (direction !== 'upper' && direction !== 'lower') return;
|
||||||
|
this.$set(item, 'direction', direction);
|
||||||
|
},
|
||||||
|
toggleRule(item) {
|
||||||
|
this.setRuleDirection(item, this.ruleDirection(item) === 'upper' ? 'lower' : 'upper');
|
||||||
|
},
|
||||||
|
ruleRanges(item) {
|
||||||
|
const w = item.warning, a = item.alert;
|
||||||
|
return this.ruleDirection(item) === 'upper'
|
||||||
|
? [`当前值 ≤ ${w}`, `${w} < 当前值 ≤ ${a}`, `当前值 > ${a}`]
|
||||||
|
: [`当前值 ≥ ${w}`, `${a} ≤ 当前值 < ${w}`, `当前值 < ${a}`];
|
||||||
|
},
|
||||||
|
ruleError(item) {
|
||||||
|
if (!this.isNumericRule(item)) return '';
|
||||||
|
const upper = this.ruleDirection(item) === 'upper';
|
||||||
|
return (upper && Number(item.warning) > Number(item.alert)) || (!upper && Number(item.warning) < Number(item.alert))
|
||||||
|
? (upper ? '越小越好指标要求:预警值 ≤ 警告值(高值预警)' : '越大越好指标要求:预警值 ≥ 警告值(低值预警)') : '';
|
||||||
|
},
|
||||||
// 刷新页面
|
// 刷新页面
|
||||||
refreshPage() {
|
refreshPage() {
|
||||||
this.search = {
|
this.search = {
|
||||||
@@ -175,7 +205,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
// 参数验证
|
// 参数验证
|
||||||
for (let item of content) {
|
for (let item of content) {
|
||||||
name = item.name;
|
name = item.name;
|
||||||
if (!item.val) {
|
const error = this.ruleError(item);
|
||||||
|
if (error) {
|
||||||
|
this._sweetMsg({ type: 'warning', content: `${name}:${error}` });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.$set(item, 'direction', this.ruleDirection(item));
|
||||||
|
if (item.val === '' || item.val === null || item.val === undefined) {
|
||||||
this._sweetMsg({
|
this._sweetMsg({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
content: `请您输入${name}值`
|
content: `请您输入${name}值`
|
||||||
@@ -192,7 +228,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
if (item.alert === '') {
|
if (item.alert === '') {
|
||||||
this._sweetMsg({
|
this._sweetMsg({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
content: `请您输入${name}警戒值`
|
content: `请您输入${name}警告值`
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -254,7 +290,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.typeName = item.granary.varieties;
|
this.typeName = item.granary.varieties;
|
||||||
this.typeList[item.type]['content'] = item.testing_params;
|
this.typeList[item.type]['content'] = JSON.parse(JSON.stringify(item.testing_params));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSort(item) {
|
handleSort(item) {
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ html, body {
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
animation: marquee-scroll 45s linear infinite;
|
animation: marquee-scroll var(--marquee-duration, 90s) linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
.alert-marquee-track:hover {
|
.alert-marquee-track:hover {
|
||||||
@@ -1189,12 +1189,12 @@ html, body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
margin: 6px 0 8px 0;
|
margin: 6px 0 8px 0;
|
||||||
background: linear-gradient(135deg, rgba(6, 14, 32, 0.52) 0%, rgba(3, 8, 20, 0.45) 100%);
|
background: linear-gradient(135deg, rgba(12, 26, 44, 0.97) 0%, rgba(8, 19, 33, 0.98) 100%);
|
||||||
border: 1px solid rgba(56, 189, 248, 0.25);
|
border: 1px solid rgba(56, 189, 248, 0.25);
|
||||||
border-top: 1.5px solid rgba(56, 189, 248, 0.65);
|
border-top: 1.5px solid rgba(56, 189, 248, 0.65);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
backdrop-filter: blur(20px) saturate(160%);
|
backdrop-filter: blur(20px);
|
||||||
-webkit-backdrop-filter: blur(20px) saturate(160%);
|
-webkit-backdrop-filter: blur(20px);
|
||||||
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 35px rgba(56, 189, 248, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.12);
|
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 35px rgba(56, 189, 248, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.12);
|
||||||
padding: 12px 18px;
|
padding: 12px 18px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -1462,7 +1462,7 @@ html, body {
|
|||||||
|
|
||||||
.forecast-charts-row {
|
.forecast-charts-row {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 58% 42%;
|
grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
@@ -2150,3 +2150,22 @@ html, body {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Forecast analysis: quiet surfaces, legible hierarchy and independent scales. */
|
||||||
|
.forecast-charts-row > .center-chart-card { min-width: 0; }
|
||||||
|
.forecast-charts-row .center-chart-card-title-bar { flex-wrap: wrap; align-items: flex-start; gap: 4px; margin-bottom: 8px; }
|
||||||
|
.forecast-charts-row .center-chart-card-title { color: #e3edf7; font-size: 13px; margin-bottom: 0; letter-spacing: .2px; }
|
||||||
|
.forecast-charts-row .center-chart-card:last-child { padding-left: 18px; border-left-color: rgba(148, 173, 200, .13); }
|
||||||
|
.forecast-chart-note { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; color: #8ba4bd; font-size: 10px; line-height: 1.7; padding: 0 0 12px; }
|
||||||
|
.threshold-key { color: #dfb883; }
|
||||||
|
.forecast-env-pill { color: #9eb5cb; border-color: #314459; background: #132438; font-size: 9px; }
|
||||||
|
.forecast-env-bar { border-color: #2a4058; box-shadow: none; padding: 8px 10px; flex-wrap: wrap; }
|
||||||
|
.forecast-env-items { flex-wrap: wrap; gap: 7px; }
|
||||||
|
.forecast-env-label { color: #c2d2e3; }
|
||||||
|
.forecast-env-label .env-pulse-icon, .chart-pulse-dot { animation: none; box-shadow: none; }
|
||||||
|
.center-chart-board .center-chart-title { color: #dcebf8; }
|
||||||
|
.center-chart-tabs { border-color: #30465e; border-radius: 6px; background: #0b192b; }
|
||||||
|
.center-chart-tab { padding: 6px 12px; }
|
||||||
|
.center-chart-tab#tab-chart-forecast.active { background: #193e58; color: #93e4f6; box-shadow: none; border-color: #306079; }
|
||||||
|
.center-chart-board button:focus-visible { outline: 2px solid #91d9f5; outline-offset: 3px; }
|
||||||
|
@media (prefers-reduced-motion: reduce) { .center-chart-board { animation: none; } }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||||
<title>中储粮(遵义)智慧粮仓综合监测中心</title>
|
<title>中储粮(遵义)智慧粮仓综合监测中心</title>
|
||||||
<link rel="stylesheet" href="./css/style.css">
|
<link rel="stylesheet" href="./css/style.css?v=20261028_chart3">
|
||||||
<!-- ECharts 可视化库 (CDN) -->
|
<!-- ECharts 可视化库 (CDN) -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
@@ -298,7 +298,7 @@
|
|||||||
<div class="forecast-env-bar">
|
<div class="forecast-env-bar">
|
||||||
<div class="forecast-env-label">
|
<div class="forecast-env-label">
|
||||||
<span class="env-pulse-icon"></span>
|
<span class="env-pulse-icon"></span>
|
||||||
<span>推演环境工况 (API输入):</span>
|
<span>推演环境设置</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="forecast-env-items">
|
<div class="forecast-env-items">
|
||||||
<div class="forecast-env-group">
|
<div class="forecast-env-group">
|
||||||
@@ -340,9 +340,10 @@
|
|||||||
<!-- 左侧:多周期未来质量演变趋势折线图 (含国家警戒线) -->
|
<!-- 左侧:多周期未来质量演变趋势折线图 (含国家警戒线) -->
|
||||||
<div class="center-chart-card">
|
<div class="center-chart-card">
|
||||||
<div class="center-chart-card-title-bar">
|
<div class="center-chart-card-title-bar">
|
||||||
<div class="center-chart-card-title" id="forecast-trend-title">粮食质量指标多周期演变趋势推演 (未来 7~60天走势与国家警戒线)</div>
|
<div class="center-chart-card-title" id="forecast-trend-title">多周期趋势</div>
|
||||||
<div class="forecast-env-pill" id="forecast-trend-env-pill">工况: 仓内 18.5℃ / 72.4% · 仓外 32.5℃ / 54.2%</div>
|
<div class="forecast-env-pill" id="forecast-trend-env-pill">工况: 仓内 18.5℃ / 72.4% · 仓外 32.5℃ / 54.2%</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="forecast-chart-note"><span>各指标独立刻度 · 保留原始单位</span><span>● 实测起点 ┈ 预测趋势 <span class="threshold-key">┄ 警戒参考</span></span></div>
|
||||||
<div id="chart-forecast-trend" class="center-chart-canvas"></div>
|
<div id="chart-forecast-trend" class="center-chart-canvas"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 右侧:现状实测 vs 预测推演偏离对比柱状图 -->
|
<!-- 右侧:现状实测 vs 预测推演偏离对比柱状图 -->
|
||||||
@@ -350,6 +351,7 @@
|
|||||||
<div class="center-chart-card-title-bar">
|
<div class="center-chart-card-title-bar">
|
||||||
<div class="center-chart-card-title" id="forecast-compare-title">现状实测值 vs 预测终值偏离对比与风险评估</div>
|
<div class="center-chart-card-title" id="forecast-compare-title">现状实测值 vs 预测终值偏离对比与风险评估</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="forecast-chart-note">同一指标内对比柱长 · 悬停查看变化量</div>
|
||||||
<div id="chart-forecast-compare" class="center-chart-canvas"></div>
|
<div id="chart-forecast-compare" class="center-chart-canvas"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -403,7 +405,7 @@
|
|||||||
<span>数据接口: <strong>https://grain.gynhc.com/api/index/granaryList</strong> (数据同步正常)</span>
|
<span>数据接口: <strong>https://grain.gynhc.com/api/index/granaryList</strong> (数据同步正常)</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-item">
|
<div class="footer-item">
|
||||||
<span>全库仓罐总数: <strong>20 座/栋</strong></span>
|
<span>全库仓罐总数: <strong id="depot-total-count">20 座/栋</strong></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-item">
|
<div class="footer-item">
|
||||||
<span>电视遥控/键盘: <strong>[方向键 ← / →] 切换仓房</strong> | <strong>[V键] 切换鸟瞰图</strong> | <strong>[空格键] 全屏控制</strong></span>
|
<span>电视遥控/键盘: <strong>[方向键 ← / →] 切换仓房</strong> | <strong>[V键] 切换鸟瞰图</strong> | <strong>[空格键] 全屏控制</strong></span>
|
||||||
@@ -415,6 +417,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="module" src="./js/app.js?v=20260916_v3"></script>
|
<script type="module" src="./js/app.js?v=20261028_chart3"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -17,8 +17,11 @@ import {
|
|||||||
getAerialModeConfig,
|
getAerialModeConfig,
|
||||||
getNextAerialMode,
|
getNextAerialMode,
|
||||||
CENTER_HOTSPOT_COORDS,
|
CENTER_HOTSPOT_COORDS,
|
||||||
generateDepotAlerts
|
CENTER_EXTRA_POSITIONS,
|
||||||
} from './grain_monitor_core.js';
|
resolveHotspotCoord,
|
||||||
|
generateDepotAlerts,
|
||||||
|
syncAlertMarqueeSpeed
|
||||||
|
} from './grain_monitor_core.js?v=20261028_chart3';
|
||||||
|
|
||||||
// 全局状态
|
// 全局状态
|
||||||
const STATE = {
|
const STATE = {
|
||||||
@@ -96,28 +99,7 @@ async function fetchGranaryData() {
|
|||||||
if (!res.ok) continue;
|
if (!res.ok) continue;
|
||||||
const json = await res.json();
|
const json = await res.json();
|
||||||
if (json && json.data && Array.isArray(json.data.list) && json.data.list.length > 0) {
|
if (json && json.data && Array.isArray(json.data.list) && json.data.list.length > 0) {
|
||||||
let list = json.data.list;
|
const list = json.data.list;
|
||||||
// 业务规范对齐:若线上外部API尚未同步最新规划 (缺少44号仓),自动执行“新增的是43,后面的仓库递增”
|
|
||||||
if (!list.some(item => item.name && item.name.includes('44号'))) {
|
|
||||||
list = list.map(item => {
|
|
||||||
if (item.name === '43号仓房' || (item.id === 46 && item.name.includes('43'))) {
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
name: '44号仓房',
|
|
||||||
num: 44,
|
|
||||||
content: item.content ? { ...item.content, code: '44', warehouseType: '高大平房仓' } : item.content
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!list.some(item => item.id === 51 || item.name === '43号仓房')) {
|
|
||||||
const default43 = DEFAULT_GRANARY_DATA?.data?.list?.find(i => i.id === 51);
|
|
||||||
if (default43) {
|
|
||||||
list.push(default43);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
STATE.list = normalizeGranaryList({ ...json, data: { ...json.data, list } });
|
STATE.list = normalizeGranaryList({ ...json, data: { ...json.data, list } });
|
||||||
if (json.data && json.data.coords) {
|
if (json.data && json.data.coords) {
|
||||||
STATE.customCoords = json.data.coords;
|
STATE.customCoords = json.data.coords;
|
||||||
@@ -172,6 +154,9 @@ function renderDepotAlerts() {
|
|||||||
const marqueeTrack = document.getElementById('alert-marquee-track');
|
const marqueeTrack = document.getElementById('alert-marquee-track');
|
||||||
if (!marqueeTrack) return;
|
if (!marqueeTrack) return;
|
||||||
const alerts = generateDepotAlerts(STATE.list, STATE.envData);
|
const alerts = generateDepotAlerts(STATE.list, STATE.envData);
|
||||||
|
const signature = alerts.map(a => `${a.id}|${a.text}`).join('\n');
|
||||||
|
if (marqueeTrack.dataset.alertSignature === signature && marqueeTrack.childElementCount > 0) return;
|
||||||
|
marqueeTrack.dataset.alertSignature = signature;
|
||||||
marqueeTrack.innerHTML = '';
|
marqueeTrack.innerHTML = '';
|
||||||
const displayAlerts = alerts.length > 0 ? (alerts.length === 1 ? alerts : alerts.concat(alerts)) : [];
|
const displayAlerts = alerts.length > 0 ? (alerts.length === 1 ? alerts : alerts.concat(alerts)) : [];
|
||||||
displayAlerts.forEach(alert => {
|
displayAlerts.forEach(alert => {
|
||||||
@@ -192,6 +177,7 @@ function renderDepotAlerts() {
|
|||||||
}
|
}
|
||||||
marqueeTrack.appendChild(pill);
|
marqueeTrack.appendChild(pill);
|
||||||
});
|
});
|
||||||
|
requestAnimationFrame(() => syncAlertMarqueeSpeed(marqueeTrack));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 渲染顶部 KPIs
|
// 4. 渲染顶部 KPIs
|
||||||
@@ -204,6 +190,16 @@ function renderKPIs() {
|
|||||||
document.getElementById('kpi-utilization').textContent = `${s.utilizationRate}%`;
|
document.getElementById('kpi-utilization').textContent = `${s.utilizationRate}%`;
|
||||||
document.getElementById('kpi-warehouse-count').textContent = `${s.warehouseCount} 栋`;
|
document.getElementById('kpi-warehouse-count').textContent = `${s.warehouseCount} 栋`;
|
||||||
document.getElementById('kpi-oil-count').textContent = `${s.oilTankCount} 座`;
|
document.getElementById('kpi-oil-count').textContent = `${s.oilTankCount} 座`;
|
||||||
|
const filterLabels = {
|
||||||
|
all: `全部 (${STATE.list.length})`,
|
||||||
|
warehouse: `平房仓群 (${s.warehouseCount})`,
|
||||||
|
oilTank: `储油罐区 (${s.oilTankCount})`
|
||||||
|
};
|
||||||
|
document.querySelectorAll('.filter-btn[data-filter]').forEach(button => {
|
||||||
|
button.textContent = filterLabels[button.dataset.filter];
|
||||||
|
});
|
||||||
|
const totalCount = document.getElementById('depot-total-count');
|
||||||
|
if (totalCount) totalCount.textContent = `${STATE.list.length} 座/栋`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 渲染 3D 鸟瞰图全景热点图钉 (20 个仓房/油罐全量覆盖,像素级对准与错层防重叠)
|
// 5. 渲染 3D 鸟瞰图全景热点图钉 (20 个仓房/油罐全量覆盖,像素级对准与错层防重叠)
|
||||||
@@ -211,12 +207,10 @@ function renderHotspots() {
|
|||||||
const container = document.getElementById('aerial-hotspots');
|
const container = document.getElementById('aerial-hotspots');
|
||||||
if (!container) return;
|
if (!container) return;
|
||||||
|
|
||||||
const hotspotCoords = STATE.customCoords ? { ...CENTER_HOTSPOT_COORDS, ...STATE.customCoords } : CENTER_HOTSPOT_COORDS;
|
|
||||||
|
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
|
|
||||||
STATE.list.forEach(item => {
|
STATE.list.forEach(item => {
|
||||||
const rawCoord = hotspotCoords[item.id] || hotspotCoords[item.num] || hotspotCoords[item.name];
|
const rawCoord = resolveHotspotCoord(item, STATE.customCoords, CENTER_HOTSPOT_COORDS);
|
||||||
if (!rawCoord) return;
|
if (!rawCoord) return;
|
||||||
|
|
||||||
const coord = {
|
const coord = {
|
||||||
@@ -241,7 +235,7 @@ function renderHotspots() {
|
|||||||
pin.style.left = `${coord.x}%`;
|
pin.style.left = `${coord.x}%`;
|
||||||
pin.style.top = `${coord.y}%`;
|
pin.style.top = `${coord.y}%`;
|
||||||
|
|
||||||
const shortName = item.name.replace('号仓房', '号仓').replace('号油罐', '号罐');
|
const shortName = `${item.num}号${isOil ? '罐' : '仓'}`;
|
||||||
|
|
||||||
let stemHtml = '';
|
let stemHtml = '';
|
||||||
if (hasStem) {
|
if (hasStem) {
|
||||||
@@ -259,8 +253,8 @@ function renderHotspots() {
|
|||||||
|
|
||||||
pin.innerHTML = `
|
pin.innerHTML = `
|
||||||
<div class="bubble-inner">
|
<div class="bubble-inner">
|
||||||
<span class="bubble-name">${shortName}</span>
|
<span class="bubble-name"></span>
|
||||||
<span class="bubble-tag">${item.grainName}</span>
|
<span class="bubble-tag"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="bubble-arrow"></div>
|
<div class="bubble-arrow"></div>
|
||||||
${stemHtml}
|
${stemHtml}
|
||||||
@@ -271,8 +265,25 @@ function renderHotspots() {
|
|||||||
selectGranary(item.id, true);
|
selectGranary(item.id, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pin.querySelector('.bubble-name').textContent = shortName;
|
||||||
|
pin.querySelector('.bubble-tag').textContent = item.grainName;
|
||||||
container.appendChild(pin);
|
container.appendChild(pin);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 未建台账的位置只显示待编号,不参与库存统计或质量预测。
|
||||||
|
if (STATE.filterType !== 'oilTank') {
|
||||||
|
Object.entries(CENTER_EXTRA_POSITIONS).forEach(([position, coord]) => {
|
||||||
|
if (STATE.list.some(item => item.screenPosition === position)) return;
|
||||||
|
const pin = document.createElement('div');
|
||||||
|
pin.className = 'hotspot-pin wheat pending-warehouse';
|
||||||
|
pin.style.left = `${coord.x}%`;
|
||||||
|
pin.style.top = `${coord.y}%`;
|
||||||
|
pin.style.cursor = 'default';
|
||||||
|
pin.title = '请在后台粮仓管理添加仓库,选择对应的大屏建筑位置并填写仓号';
|
||||||
|
pin.innerHTML = '<div class="bubble-inner"><span class="bubble-name">待编号</span></div><div class="bubble-arrow"></div>';
|
||||||
|
container.appendChild(pin);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. 渲染底部仓房/油罐快捷导航条 (纯净 20 仓罐双排点阵)
|
// 6. 渲染底部仓房/油罐快捷导航条 (纯净 20 仓罐双排点阵)
|
||||||
@@ -293,8 +304,10 @@ function renderMiniGrid() {
|
|||||||
const typeClass = isOil ? 'oil' : (item.grainName === '稻谷' ? 'paddy' : 'wheat');
|
const typeClass = isOil ? 'oil' : (item.grainName === '稻谷' ? 'paddy' : 'wheat');
|
||||||
const isActive = item.id === STATE.activeId;
|
const isActive = item.id === STATE.activeId;
|
||||||
btn.className = `mini-btn ${typeClass} ${isActive ? 'active' : ''}`;
|
btn.className = `mini-btn ${typeClass} ${isActive ? 'active' : ''}`;
|
||||||
const shortName = item.name.replace('号仓房', '号仓').replace('号油罐', '号罐');
|
const shortName = `${item.num}号${isOil ? '罐' : '仓'}`;
|
||||||
btn.innerHTML = `<span class="btn-name">${shortName}</span><span class="btn-grain">${item.grainName}</span>`;
|
btn.innerHTML = '<span class="btn-name"></span><span class="btn-grain"></span>';
|
||||||
|
btn.querySelector('.btn-name').textContent = shortName;
|
||||||
|
btn.querySelector('.btn-grain').textContent = item.grainName;
|
||||||
btn.title = `${item.name} (${item.grainName}) - 实存 ${item.storageNum} 吨`;
|
btn.title = `${item.name} (${item.grainName}) - 实存 ${item.storageNum} 吨`;
|
||||||
btn.onclick = () => selectGranary(item.id, true);
|
btn.onclick = () => selectGranary(item.id, true);
|
||||||
container.appendChild(btn);
|
container.appendChild(btn);
|
||||||
@@ -633,7 +646,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
|||||||
|
|
||||||
setupForecastEnvControls();
|
setupForecastEnvControls();
|
||||||
|
|
||||||
const currentReport = getGranaryQualityReport(grainName, currentItem.rawContent || currentItem.content || {});
|
const currentReport = getGranaryQualityReport(grainName, currentItem.rawContent || currentItem.content || {}, currentItem.qualityTest);
|
||||||
|
|
||||||
// 1. 0 毫秒即时秒出基础图表 (杜绝任何白屏与残亮点)
|
// 1. 0 毫秒即时秒出基础图表 (杜绝任何白屏与残亮点)
|
||||||
const baselineList = [
|
const baselineList = [
|
||||||
@@ -673,6 +686,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
|||||||
const initialFuture30 = initialSeries.metrics.map(m => ({
|
const initialFuture30 = initialSeries.metrics.map(m => ({
|
||||||
key: m.key,
|
key: m.key,
|
||||||
name: m.name,
|
name: m.name,
|
||||||
|
unit: m.unit,
|
||||||
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
||||||
}));
|
}));
|
||||||
const initialCompareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], initialFuture30);
|
const initialCompareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], initialFuture30);
|
||||||
@@ -698,7 +712,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
|||||||
const series = generateForecastSeries(grainType, currentReport, forecastList, STATE.forecastEnv);
|
const series = generateForecastSeries(grainType, currentReport, forecastList, STATE.forecastEnv);
|
||||||
|
|
||||||
if (trendTitleEl) {
|
if (trendTitleEl) {
|
||||||
trendTitleEl.textContent = `${currentItem.name} (${grainName}) 质量指标多周期演变推演 (当前实测与未来 7~60天)`;
|
trendTitleEl.textContent = `${currentItem.name} (${grainName}) 多周期趋势`;
|
||||||
}
|
}
|
||||||
const trendOption = buildForecastTrendChartOption(series);
|
const trendOption = buildForecastTrendChartOption(series);
|
||||||
if (trendOption) {
|
if (trendOption) {
|
||||||
@@ -708,11 +722,12 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
|||||||
const future30Targets = series.metrics.map(m => ({
|
const future30Targets = series.metrics.map(m => ({
|
||||||
key: m.key,
|
key: m.key,
|
||||||
name: m.name,
|
name: m.name,
|
||||||
|
unit: m.unit,
|
||||||
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (compareTitleEl) {
|
if (compareTitleEl) {
|
||||||
compareTitleEl.textContent = `${currentItem.name} 现状实测 vs 未来30天预测终值偏离评估`;
|
compareTitleEl.textContent = `${currentItem.name} 未来30天 · 变化对比`;
|
||||||
}
|
}
|
||||||
const compareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], future30Targets);
|
const compareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], future30Targets);
|
||||||
if (compareOption) {
|
if (compareOption) {
|
||||||
|
|||||||
@@ -205,6 +205,34 @@ export function aggregateWarehouseData(warehouseList) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后台 json_encode 未保留中文,反斜杠又在入库时被吃掉,字段会变成 u9ad8u5927 这种串。
|
||||||
|
* 只还原落在汉字区的码位,避免误伤普通编号。
|
||||||
|
* @param {string} value
|
||||||
|
*/
|
||||||
|
export function decodeLooseUnicodeString(value) {
|
||||||
|
if (typeof value !== 'string' || !value.includes('u')) return value;
|
||||||
|
return value.replace(/\\?u([0-9a-fA-F]{4})/g, (match, hex) => {
|
||||||
|
const code = parseInt(hex, 16);
|
||||||
|
const isCjk = (code >= 0x3400 && code <= 0x9FFF)
|
||||||
|
|| (code >= 0xF900 && code <= 0xFAFF)
|
||||||
|
|| (code >= 0x3000 && code <= 0x303F)
|
||||||
|
|| (code >= 0xFF00 && code <= 0xFFEF);
|
||||||
|
return isCjk ? String.fromCharCode(code) : match;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function decodeLooseUnicodeDeep(input) {
|
||||||
|
if (typeof input === 'string') return decodeLooseUnicodeString(input);
|
||||||
|
if (Array.isArray(input)) return input.map(decodeLooseUnicodeDeep);
|
||||||
|
if (input && typeof input === 'object') {
|
||||||
|
const out = {};
|
||||||
|
for (const [key, val] of Object.entries(input)) out[key] = decodeLooseUnicodeDeep(val);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准化 API 返回的 granaryList 列表
|
* 标准化 API 返回的 granaryList 列表
|
||||||
* @param {Object} apiData 接口返回数据 { code, msg, data: { list: [...] } }
|
* @param {Object} apiData 接口返回数据 { code, msg, data: { list: [...] } }
|
||||||
@@ -213,14 +241,14 @@ export function normalizeGranaryList(apiData) {
|
|||||||
const rawList = apiData?.data?.list || apiData?.list || (Array.isArray(apiData) ? apiData : []);
|
const rawList = apiData?.data?.list || apiData?.list || (Array.isArray(apiData) ? apiData : []);
|
||||||
|
|
||||||
return rawList.map(item => {
|
return rawList.map(item => {
|
||||||
|
const content = decodeLooseUnicodeDeep(item.content || {});
|
||||||
const isOilTank = item.granary_type === 1 || item.name.includes('油罐');
|
const isOilTank = item.granary_type === 1 || item.name.includes('油罐');
|
||||||
const isSilo = item.granary_type === 3 ||
|
const isSilo = item.granary_type === 3 ||
|
||||||
item.name.includes('浅圆') ||
|
item.name.includes('浅圆') ||
|
||||||
item.name.includes('筒仓') ||
|
item.name.includes('筒仓') ||
|
||||||
item.content?.warehouseType?.includes('浅圆') ||
|
content.warehouseType?.includes('浅圆') ||
|
||||||
item.content?.warehouseType?.includes('筒仓');
|
content.warehouseType?.includes('筒仓');
|
||||||
const grainTypeCategory = isOilTank ? 'oilTank' : (isSilo ? 'silo' : 'warehouse');
|
const grainTypeCategory = isOilTank ? 'oilTank' : (isSilo ? 'silo' : 'warehouse');
|
||||||
const content = item.content || {};
|
|
||||||
|
|
||||||
const capacityNum = Number(content.capacity || content.tankCapacity || 0);
|
const capacityNum = Number(content.capacity || content.tankCapacity || 0);
|
||||||
const storageNum = Number(content.storageNum || 0);
|
const storageNum = Number(content.storageNum || 0);
|
||||||
@@ -230,6 +258,8 @@ export function normalizeGranaryList(apiData) {
|
|||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
num: item.num,
|
num: item.num,
|
||||||
|
screenPosition: content.screenPosition || '',
|
||||||
|
screenCoord: item.screen_coord || null,
|
||||||
storage: item.storage || '遵义直属库有限公司中心库区',
|
storage: item.storage || '遵义直属库有限公司中心库区',
|
||||||
granaryType: item.granary_type,
|
granaryType: item.granary_type,
|
||||||
isOilTank,
|
isOilTank,
|
||||||
@@ -239,6 +269,7 @@ export function normalizeGranaryList(apiData) {
|
|||||||
storageNum,
|
storageNum,
|
||||||
utilization: capacityNum > 0 ? Number(((storageNum / capacityNum) * 100).toFixed(1)) : 0,
|
utilization: capacityNum > 0 ? Number(((storageNum / capacityNum) * 100).toFixed(1)) : 0,
|
||||||
rawContent: content,
|
rawContent: content,
|
||||||
|
qualityTest: decodeLooseUnicodeDeep(item.quality_test || null),
|
||||||
createTime: item.create_time
|
createTime: item.create_time
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -329,10 +360,11 @@ export function evaluateQualityStatus(item) {
|
|||||||
|
|
||||||
if (item.type === 'qualitative') {
|
if (item.type === 'qualitative') {
|
||||||
const val = String(item.value || '');
|
const val = String(item.value || '');
|
||||||
const isOk = val.includes('正常') || val.includes('达标') || val.includes('宜存') ||
|
const negative = /不合格|未达标|不达标|不宜存|不符合|异常|不具有|未有|有异味/.test(val.replace(/无异味/g, ''));
|
||||||
|
const isOk = !negative && (val.includes('正常') || val.includes('达标') || val.includes('宜存') ||
|
||||||
val.includes('符合') || val.includes('合格') || val.includes('透明') ||
|
val.includes('符合') || val.includes('合格') || val.includes('透明') ||
|
||||||
val.includes('变浅') || val.includes('棕') || val.includes('固有') ||
|
val.includes('变浅') || val.includes('棕') || val.includes('固有') ||
|
||||||
val.includes('无析出物') || val.includes('无异味') || val.includes('未检出');
|
val.includes('无析出物') || val.includes('无异味') || val.includes('未检出'));
|
||||||
return isOk
|
return isOk
|
||||||
? { status: 'normal', statusText: '健康达标', badgeText: '达标', color: '#10b981' }
|
? { status: 'normal', statusText: '健康达标', badgeText: '达标', color: '#10b981' }
|
||||||
: { status: 'danger', statusText: '超标异常', badgeText: '异常', color: '#ef4444' };
|
: { status: 'danger', statusText: '超标异常', badgeText: '异常', color: '#ef4444' };
|
||||||
@@ -370,7 +402,7 @@ export function evaluateQualityStatus(item) {
|
|||||||
* @param {string} grainTypeOrName 品种名称或类型
|
* @param {string} grainTypeOrName 品种名称或类型
|
||||||
* @param {Object} overrides 仓房特有指标覆盖 (如 { water: '12.8%' })
|
* @param {Object} overrides 仓房特有指标覆盖 (如 { water: '12.8%' })
|
||||||
*/
|
*/
|
||||||
export function getGranaryQualityReport(grainTypeOrName = '小麦', overrides = {}) {
|
export function getGranaryQualityReport(grainTypeOrName = '小麦', overrides = {}, qualityTest = null) {
|
||||||
const str = String(grainTypeOrName || '').toLowerCase();
|
const str = String(grainTypeOrName || '').toLowerCase();
|
||||||
let key = 'wheat';
|
let key = 'wheat';
|
||||||
if (str.includes('油') || str.includes('oil') || str.includes('rapeseed')) {
|
if (str.includes('油') || str.includes('oil') || str.includes('rapeseed')) {
|
||||||
@@ -386,9 +418,36 @@ export function getGranaryQualityReport(grainTypeOrName = '小麦', overrides =
|
|||||||
let warnCount = 0;
|
let warnCount = 0;
|
||||||
let normalCount = 0;
|
let normalCount = 0;
|
||||||
|
|
||||||
const items = benchmark.items.map(baseItem => {
|
// A saved test is the source of truth for values, thresholds and direction.
|
||||||
|
const savedParams = qualityTest?.testing_params || [];
|
||||||
|
const cleanName = name => String(name).replace(/[((].*?[))]/g, '').replace(/[、,,\s]/g, '');
|
||||||
|
const aliases = {
|
||||||
|
'杂质': 'impurity', '杂质总量': 'impurity', '谷外糙米': 'milledGrainOutside',
|
||||||
|
'谷外碾米': 'milledGrainOutside', '互混': 'mixRate', '互混率': 'mixRate',
|
||||||
|
'色泽气味质量指标': 'qualityOdor', '色泽气味储存指标': 'storageOdor',
|
||||||
|
'铅': 'pb', '镉': 'cd', '总汞': 'hg', '总砷': 'as', '无机砷': 'as'
|
||||||
|
};
|
||||||
|
const sourceItems = savedParams.length ? savedParams.map((param, index) => {
|
||||||
|
let itemKey = aliases[cleanName(param.name)];
|
||||||
|
if (String(param.name).includes('色泽') && String(param.name).includes('气味')) {
|
||||||
|
itemKey = String(param.name).includes('储存') ? 'storageOdor' : 'qualityOdor';
|
||||||
|
}
|
||||||
|
const base = benchmark.items.find(it => it.key === itemKey
|
||||||
|
|| cleanName(it.name) === cleanName(param.name) || cleanName(it.shortName) === cleanName(param.name));
|
||||||
|
const numeric = [param.warning, param.alert].every(v => v !== null && v !== undefined
|
||||||
|
&& String(v).trim() !== '' && Number.isFinite(Number(v)));
|
||||||
|
return {
|
||||||
|
...(base || { key: `saved-${param.num || index}`, category: 'physical' }),
|
||||||
|
name: param.name, shortName: base?.shortName || param.name,
|
||||||
|
value: param.val, unit: param.unit || '', warn: param.warning, alert: param.alert,
|
||||||
|
direction: param.direction === 'upper' || param.direction === 'lower' ? param.direction
|
||||||
|
: (numeric && Number(param.warning) > Number(param.alert) ? 'lower' : 'upper'),
|
||||||
|
type: numeric ? undefined : 'qualitative', savedRule: numeric
|
||||||
|
};
|
||||||
|
}) : benchmark.items;
|
||||||
|
const items = sourceItems.map(baseItem => {
|
||||||
const item = { ...baseItem };
|
const item = { ...baseItem };
|
||||||
if (overrides[item.key] !== undefined && overrides[item.key] !== null) {
|
if (!savedParams.length && overrides[item.key] !== undefined && overrides[item.key] !== null) {
|
||||||
const cleanVal = String(overrides[item.key]).replace(/[^0-9.]/g, '');
|
const cleanVal = String(overrides[item.key]).replace(/[^0-9.]/g, '');
|
||||||
if (cleanVal) item.value = cleanVal;
|
if (cleanVal) item.value = cleanVal;
|
||||||
}
|
}
|
||||||
@@ -410,8 +469,8 @@ export function getGranaryQualityReport(grainTypeOrName = '小麦', overrides =
|
|||||||
return {
|
return {
|
||||||
variety: benchmark.variety,
|
variety: benchmark.variety,
|
||||||
varietyKey: key,
|
varietyKey: key,
|
||||||
inspectDate: benchmark.inspectDate,
|
inspectDate: qualityTest?.test_date ? String(qualityTest.test_date).replace(/^(\d{4})(\d{2})$/, '$1-$2') : benchmark.inspectDate,
|
||||||
inspectStage: benchmark.inspectStage,
|
inspectStage: qualityTest ? ({ 1: '春季检测', 2: '秋季检测', 3: '满仓验收' }[qualityTest.season] || '最新检测') : benchmark.inspectStage,
|
||||||
items,
|
items,
|
||||||
summary: {
|
summary: {
|
||||||
totalCount: items.length,
|
totalCount: items.length,
|
||||||
@@ -428,6 +487,12 @@ export function getGranaryQualityReport(grainTypeOrName = '小麦', overrides =
|
|||||||
* @param {Object} qualityReport getGranaryQualityReport 返回的对象
|
* @param {Object} qualityReport getGranaryQualityReport 返回的对象
|
||||||
* @param {string} filterCategory 'all' | 'physical' | 'storage' | 'safety'
|
* @param {string} filterCategory 'all' | 'physical' | 'storage' | 'safety'
|
||||||
*/
|
*/
|
||||||
|
function escapeQualityText(value) {
|
||||||
|
return String(value ?? '').replace(/[&<>"']/g, char => ({
|
||||||
|
'&': '&', '<': '<', '>': '>', '"': '"', "'": '''
|
||||||
|
}[char]));
|
||||||
|
}
|
||||||
|
|
||||||
export function buildQualityHtml(qualityReport, filterCategory = 'all') {
|
export function buildQualityHtml(qualityReport, filterCategory = 'all') {
|
||||||
if (!qualityReport || !qualityReport.items) return '';
|
if (!qualityReport || !qualityReport.items) return '';
|
||||||
|
|
||||||
@@ -453,14 +518,14 @@ export function buildQualityHtml(qualityReport, filterCategory = 'all') {
|
|||||||
const displayName = it.shortName || it.name;
|
const displayName = it.shortName || it.name;
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<div class="quality-card ${cardClass}" title="${it.name}: ${displayVal} (预警:${it.warn ?? '-'} 警戒:${it.alert ?? '-'} [${it.statusText}])">
|
<div class="quality-card ${cardClass}" title="${escapeQualityText(it.name)}: ${escapeQualityText(displayVal)} (预警:${escapeQualityText(it.warn ?? '-')} 警戒:${escapeQualityText(it.alert ?? '-')} [${it.statusText}])">
|
||||||
<div class="quality-card-header">
|
<div class="quality-card-header">
|
||||||
<span class="quality-card-name" title="${it.name}">${displayName}</span>
|
<span class="quality-card-name" title="${escapeQualityText(it.name)}">${escapeQualityText(displayName)}</span>
|
||||||
<span class="quality-badge status-${it.status}">${it.badgeText}</span>
|
<span class="quality-badge status-${it.status}">${it.badgeText}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="quality-card-body">
|
<div class="quality-card-body">
|
||||||
<span class="quality-card-value ${valClass}">${it.status === 'danger' ? '⚠️ ' : ''}${displayVal}</span>
|
<span class="quality-card-value ${valClass}">${it.status === 'danger' ? '⚠️ ' : ''}${escapeQualityText(displayVal)}</span>
|
||||||
<span class="quality-card-thresh">${threshDesc}</span>
|
<span class="quality-card-thresh">${escapeQualityText(threshDesc)}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`.trim();
|
`.trim();
|
||||||
@@ -618,6 +683,11 @@ export function computeStripMetric(it, varietyKey = 'wheat') {
|
|||||||
limitDesc = it.value === '未检出' ? `限量达标 · 未检出` : `监测达标`;
|
limitDesc = it.value === '未检出' ? `限量达标 · 未检出` : `监测达标`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (it.savedRule) {
|
||||||
|
const lower = it.direction === 'lower';
|
||||||
|
limitDesc = `${it.status === 'danger' ? '警告' : it.status === 'warn' ? '预警' : '正常'} | ${lower ? '越大越好(低值预警)' : '越小越好(高值预警)'} · 预警${lower ? '<' : '>'}${it.warn} · 警告${lower ? '<' : '>'}${it.alert}${it.unit || ''}`;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...it,
|
...it,
|
||||||
gaugePercent,
|
gaugePercent,
|
||||||
@@ -655,7 +725,7 @@ export function buildQualityHudHtml(qualityReport, filterCategory = 'all') {
|
|||||||
|
|
||||||
// 统计各分类数量
|
// 统计各分类数量
|
||||||
const totalCount = allItems.length;
|
const totalCount = allItems.length;
|
||||||
const coreCount = coreKeys.length;
|
const coreCount = allItems.filter(it => coreKeys.includes(it.key)).length;
|
||||||
const physicalCount = allItems.filter(it => it.category === 'physical' || it.category === 'storage').length;
|
const physicalCount = allItems.filter(it => it.category === 'physical' || it.category === 'storage').length;
|
||||||
const safetyCount = allItems.filter(it => it.category === 'safety').length;
|
const safetyCount = allItems.filter(it => it.category === 'safety').length;
|
||||||
|
|
||||||
@@ -670,15 +740,15 @@ export function buildQualityHudHtml(qualityReport, filterCategory = 'all') {
|
|||||||
const unitStr = item.unit ? `${item.unit}` : '';
|
const unitStr = item.unit ? `${item.unit}` : '';
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<div class="quality-strip-card ${cardClass}" data-key="${item.key}" data-category="${item.category}" title="${item.name}: ${item.value}${unitStr} (${item.limitDesc})">
|
<div class="quality-strip-card ${cardClass}" data-key="${item.key}" data-category="${item.category}" title="${escapeQualityText(item.name)}: ${escapeQualityText(item.value)}${escapeQualityText(unitStr)} (${escapeQualityText(item.limitDesc)})">
|
||||||
<div class="strip-card-header">
|
<div class="strip-card-header">
|
||||||
<div class="strip-card-title-group">
|
<div class="strip-card-title-group">
|
||||||
<span class="strip-card-title">${displayName}</span>
|
<span class="strip-card-title">${escapeQualityText(displayName)}</span>
|
||||||
<span class="quality-badge status-${item.status}">${item.badgeText}</span>
|
<span class="quality-badge status-${item.status}">${item.badgeText}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="strip-card-val-group">
|
<div class="strip-card-val-group">
|
||||||
<span class="strip-main-val ${valClass}">${alertPrefix}${item.value}</span>
|
<span class="strip-main-val ${valClass}">${alertPrefix}${escapeQualityText(item.value)}</span>
|
||||||
<span class="strip-unit">${unitStr}</span>
|
<span class="strip-unit">${escapeQualityText(unitStr)}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="strip-card-gauge-box">
|
<div class="strip-card-gauge-box">
|
||||||
@@ -687,7 +757,7 @@ export function buildQualityHudHtml(qualityReport, filterCategory = 'all') {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="strip-card-footer">
|
<div class="strip-card-footer">
|
||||||
<span class="strip-limit-desc">${item.limitDesc}</span>
|
<span class="strip-limit-desc">${escapeQualityText(item.limitDesc)}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`.trim();
|
`.trim();
|
||||||
@@ -722,7 +792,7 @@ export function formatGranaryParams(normalizedItem) {
|
|||||||
const c = normalizedItem.rawContent || {};
|
const c = normalizedItem.rawContent || {};
|
||||||
const isOil = normalizedItem.isOilTank;
|
const isOil = normalizedItem.isOilTank;
|
||||||
const grainVariety = normalizedItem.grainName || c.varieties || (isOil ? '菜籽油' : '小麦');
|
const grainVariety = normalizedItem.grainName || c.varieties || (isOil ? '菜籽油' : '小麦');
|
||||||
const qualityReport = getGranaryQualityReport(grainVariety, c);
|
const qualityReport = getGranaryQualityReport(grainVariety, c, normalizedItem.qualityTest);
|
||||||
|
|
||||||
const natureMap = {
|
const natureMap = {
|
||||||
'ZC': '中央储备粮 (ZC)',
|
'ZC': '中央储备粮 (ZC)',
|
||||||
@@ -1171,7 +1241,7 @@ export function generateForecastSeries(grainType, currentReport, forecastList =
|
|||||||
const curVal = findCurrentVal(cfg.key, cfg.fallback);
|
const curVal = findCurrentVal(cfg.key, cfg.fallback);
|
||||||
const futureVals = forecastList.map(f => {
|
const futureVals = forecastList.map(f => {
|
||||||
const tVal = f.targets ? f.targets[cfg.targetKey] : undefined;
|
const tVal = f.targets ? f.targets[cfg.targetKey] : undefined;
|
||||||
return tVal !== undefined ? Number(Number(tVal).toFixed(2)) : curVal;
|
return tVal !== undefined && tVal !== null && tVal !== '' && Number.isFinite(Number(tVal)) ? Number(Number(tVal).toFixed(2)) : null;
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
key: cfg.key,
|
key: cfg.key,
|
||||||
@@ -1179,6 +1249,7 @@ export function generateForecastSeries(grainType, currentReport, forecastList =
|
|||||||
unit: cfg.unit,
|
unit: cfg.unit,
|
||||||
alert: cfg.alert,
|
alert: cfg.alert,
|
||||||
warn: cfg.warn,
|
warn: cfg.warn,
|
||||||
|
direction: cfg.key === 'glutenWater' ? 'lower' : 'upper',
|
||||||
values: [curVal, ...futureVals]
|
values: [curVal, ...futureVals]
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -1191,238 +1262,151 @@ export function generateForecastSeries(grainType, currentReport, forecastList =
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** OKLCH (L: 0~1, C: 色度, H: 角度) 转换为 sRGB 十六进制颜色。 */
|
||||||
|
export function OklchtoHex(L, C, H) {
|
||||||
|
const hr = (H * Math.PI) / 180;
|
||||||
|
const a = C * Math.cos(hr);
|
||||||
|
const b = C * Math.sin(hr);
|
||||||
|
const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;
|
||||||
|
const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;
|
||||||
|
const s = (L - 0.0894841775 * a - 1.2914855480 * b) ** 3;
|
||||||
|
const toHex = value => {
|
||||||
|
const x = Math.max(0, Math.min(1, value));
|
||||||
|
const gamma = x >= 0.0031308
|
||||||
|
? 1.055 * Math.pow(x, 1 / 2.4) - 0.055
|
||||||
|
: 12.92 * x;
|
||||||
|
return Math.round(gamma * 255).toString(16).padStart(2, '0');
|
||||||
|
};
|
||||||
|
const r = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
|
||||||
|
const g = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
|
||||||
|
const blue = -0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s;
|
||||||
|
return `#${toHex(r)}${toHex(g)}${toHex(blue)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 黄金角分布配色;传入起始色相可复用同一套颜色。 */
|
||||||
|
export function distinctColorsOKLCH(count, startHue = Math.random() * 360) {
|
||||||
|
const out = [];
|
||||||
|
let h = startHue;
|
||||||
|
for (let i = 0; i < count; i++) {
|
||||||
|
h = (h + 137.508) % 360;
|
||||||
|
out.push(OklchtoHex(0.72, 0.15 + (i % 4) * 0.02, h));
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同一页面会先绘制基线再接收算法数据,按指标缓存配色,避免重绘或切仓时跳色。
|
||||||
|
const forecastPaletteHue = Math.random() * 360;
|
||||||
|
const forecastMetricColors = new Map();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 粮食质量未来趋势 ECharts 配置生成
|
* 粮食质量未来趋势 ECharts 配置生成
|
||||||
* @param {Object} forecastSeries generateForecastSeries 返回的对象
|
* @param {Object} forecastSeries generateForecastSeries 返回的对象
|
||||||
*/
|
*/
|
||||||
|
const forecastNumber = value => value !== null && value !== undefined && value !== '' && Number.isFinite(parseFloat(value)) ? parseFloat(value) : null;
|
||||||
|
const forecastText = value => forecastNumber(value) === null ? '暂无数据' : Number(Number(value).toFixed(2)).toString();
|
||||||
|
const forecastEscape = value => String(value ?? '').replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
||||||
|
const forecastTooltip = {
|
||||||
|
trigger: 'axis', confine: true, backgroundColor: '#101f32', borderColor: '#31465d',
|
||||||
|
padding: [12, 16], textStyle: { color: '#e6edf5', fontSize: 12 },
|
||||||
|
extraCssText: 'border-radius:10px;box-shadow:0 12px 32px #0006;line-height:1.7;'
|
||||||
|
};
|
||||||
|
|
||||||
export function buildForecastTrendChartOption(forecastSeries) {
|
export function buildForecastTrendChartOption(forecastSeries) {
|
||||||
if (!forecastSeries || !forecastSeries.timeline) return null;
|
if (!forecastSeries?.timeline || !forecastSeries.metrics?.length) return null;
|
||||||
const { timeline, metrics, env } = forecastSeries;
|
const { timeline, metrics, env } = forecastSeries;
|
||||||
const envInfo = env || { tm_i: 18.5, tm_o: 32.5, hm_i: 72.4, hm_o: 54.2 };
|
const envInfo = env || { tm_i: 18.5, tm_o: 32.5, hm_i: 72.4, hm_o: 54.2 };
|
||||||
const colors = ['#38bdf8', '#10b981', '#f59e0b', '#ec4899', '#8b5cf6'];
|
const colors = distinctColorsOKLCH(forecastMetricColors.size + metrics.length, forecastPaletteHue);
|
||||||
|
const row = 100 / metrics.length;
|
||||||
|
const titles = [], grids = [], xAxes = [], yAxes = [];
|
||||||
const series = metrics.map((m, idx) => {
|
const series = metrics.map((m, idx) => {
|
||||||
const c = colors[idx % colors.length];
|
const key = m.key || m.name;
|
||||||
const s = {
|
if (!forecastMetricColors.has(key)) forecastMetricColors.set(key, colors[forecastMetricColors.size]);
|
||||||
name: m.name,
|
const c = forecastMetricColors.get(key);
|
||||||
type: 'line',
|
const current = forecastText(m.values[0]);
|
||||||
smooth: true,
|
const last = forecastText(m.values[m.values.length - 1]);
|
||||||
symbol: 'circle',
|
const threshold = m.alert === undefined ? '' : `\n警戒 ${m.direction === 'lower' ? '≥' : '≤'} ${m.alert} ${m.unit || ''}`;
|
||||||
symbolSize: 6,
|
titles.push({ text: m.name, subtext: `${current} → ${last} ${m.unit || ''}${threshold}`, left: 8, top: `${idx * row + 1}%`,
|
||||||
itemStyle: { color: c },
|
textStyle: {color: '#e2eaf4', fontSize: 12, fontWeight: 600},
|
||||||
lineStyle: { width: 2.5, color: c },
|
subtextStyle: {color: c, fontSize: 12, lineHeight: 16}, itemGap: 5 });
|
||||||
areaStyle: {
|
grids.push({ left: 154, right: 36, top: `${idx * row + 3}%`, height: `${row - 9}%`, containLabel: true });
|
||||||
color: {
|
xAxes.push({ type: 'category', gridIndex: idx, data: timeline, boundaryGap: false,
|
||||||
type: 'linear',
|
axisTick: {show: false}, axisLine: {show: false},
|
||||||
x: 0, y: 0, x2: 0, y2: 1,
|
axisLabel: {color: '#8ea3ba', fontSize: 10, hideOverlap: true, formatter: v => v.replace('天预测', '天')},
|
||||||
colorStops: [
|
axisPointer: {lineStyle: {color: '#7893ac', type: 'dashed'}} });
|
||||||
{ offset: 0, color: c + '40' },
|
yAxes.push({ type: 'value', gridIndex: idx, splitNumber: 2,
|
||||||
{ offset: 1, color: c + '05' }
|
scale: true, axisLabel: {color: '#7188a1', fontSize: 10},
|
||||||
]
|
splitLine: {lineStyle: {color: 'rgba(148,173,200,0.10)', type: 'dashed'}} });
|
||||||
}
|
const result = { name: m.name, type: 'line', xAxisIndex: idx, yAxisIndex: idx,
|
||||||
},
|
smooth: false, connectNulls: false, symbol: 'circle', symbolSize: 6,
|
||||||
data: m.values
|
itemStyle: {color: c, borderColor: '#0c1929', borderWidth: 2},
|
||||||
};
|
lineStyle: {width: 2, color: c, type: 'dotted'},
|
||||||
|
emphasis: {focus: 'series', scale: 1.5},
|
||||||
if (m.alert !== undefined) {
|
areaStyle: {color: {type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
|
||||||
s.markLine = {
|
colorStops: [{offset: 0, color: c + '16'}, {offset: 1, color: c + '00'}]}},
|
||||||
symbol: ['none', 'none'],
|
data: m.values };
|
||||||
silent: true,
|
if (m.alert !== undefined) result.markLine = {symbol: ['none', 'none'], silent: true, data: [{
|
||||||
data: [
|
yAxis: m.alert, name: `${m.name}警戒线`,
|
||||||
{
|
lineStyle: {color: '#c89e68', type: 'dashed', width: 1, opacity: 0.65},
|
||||||
yAxis: m.alert,
|
label: {formatter: `警戒 {c}${m.unit || ''}`, position: 'insideEndTop', color: '#dfb883', fontSize: 9,
|
||||||
name: `${m.name}警戒线`,
|
backgroundColor: '#122031', padding: [2, 4], borderRadius: 3}
|
||||||
lineStyle: { color: '#ef4444', type: 'dashed', width: 1.5 },
|
}]};
|
||||||
label: {
|
return result;
|
||||||
formatter: `${m.name}警戒: {c}`,
|
|
||||||
position: 'insideEndTop',
|
|
||||||
color: '#f87171',
|
|
||||||
fontSize: 10,
|
|
||||||
fontWeight: 600,
|
|
||||||
backgroundColor: 'rgba(15, 23, 42, 0.75)',
|
|
||||||
borderColor: 'rgba(239, 68, 68, 0.4)',
|
|
||||||
borderWidth: 1,
|
|
||||||
borderRadius: 3,
|
|
||||||
padding: [2, 4]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
});
|
});
|
||||||
|
return { animationDuration: 350, title: titles, grid: grids, xAxis: xAxes, yAxis: yAxes,
|
||||||
return {
|
aria: {enabled: true, description: '各指标使用独立刻度。圆点为实测与预测值,点状虚线为预测趋势,金色虚线为警戒参考。'},
|
||||||
tooltip: {
|
axisPointer: {link: [{xAxisIndex: 'all'}]},
|
||||||
trigger: 'axis',
|
tooltip: {...forecastTooltip, formatter: params => {
|
||||||
backgroundColor: 'rgba(11, 22, 44, 0.94)',
|
if (!Array.isArray(params) || !params.length) return '';
|
||||||
borderColor: 'rgba(56, 189, 248, 0.4)',
|
const heading = params[0].axisValue || params[0].name || '';
|
||||||
textStyle: { color: '#f8fafc', fontSize: 11 },
|
let html = `<div style="font-weight:600;margin-bottom:8px">${forecastEscape(heading)}</div>`;
|
||||||
formatter: (params) => {
|
params.forEach(p => {
|
||||||
if (!Array.isArray(params) || params.length === 0) return '';
|
const m = metrics[p.seriesIndex] || metrics.find(m => m.name === p.seriesName);
|
||||||
const axisValue = params[0].axisValue || params[0].name || '';
|
html += `<div style="display:flex;justify-content:space-between;gap:24px"><span>${p.marker || ''} ${forecastEscape(p.seriesName)}</span><b>${forecastText(p.value)} <small>${forecastEscape(m?.unit)}</small></b></div>`;
|
||||||
let html = `<div style="font-weight:700;margin-bottom:6px;color:#38bdf8;">${axisValue}</div>`;
|
});
|
||||||
params.forEach(p => {
|
html += `<div style="margin-top:10px;padding-top:8px;border-top:1px solid #304157;color:#8ea3ba;font-size:11px">仓内 ${forecastEscape(envInfo.tm_i)}℃ / ${forecastEscape(envInfo.hm_i)}% · 仓外 ${forecastEscape(envInfo.tm_o)}℃ / ${forecastEscape(envInfo.hm_o)}%</div>`;
|
||||||
const valStr = p.value !== undefined ? p.value : '-';
|
return html;
|
||||||
html += `<div style="display:flex;justify-content:space-between;gap:16px;margin:3px 0;">
|
}}, series };
|
||||||
<span>${p.marker} ${p.seriesName}</span>
|
|
||||||
<strong style="color:#f8fafc;">${valStr}</strong>
|
|
||||||
</div>`;
|
|
||||||
});
|
|
||||||
const isFuture = axisValue.includes('预测') || (params[0].dataIndex !== undefined && params[0].dataIndex > 0) || !axisValue.includes('现状');
|
|
||||||
const condTitle = isFuture ? '⚙️ 算法推演工况条件:' : '🌡️ 当前环境监测工况:';
|
|
||||||
html += `<div style="margin-top:6px;padding-top:5px;border-top:1px dashed rgba(56,189,248,0.25);font-size:10px;color:#94a3b8;line-height:1.4;">
|
|
||||||
<div style="color:#cbd5e1;margin-bottom:2px;">${condTitle}</div>
|
|
||||||
<div>仓内环境: <span style="color:#38bdf8;font-weight:600;">${envInfo.tm_i}℃</span> / <span style="color:#38bdf8;font-weight:600;">${envInfo.hm_i}%</span></div>
|
|
||||||
<div>仓外气象: <span style="color:#10b981;font-weight:600;">${envInfo.tm_o}℃</span> / <span style="color:#10b981;font-weight:600;">${envInfo.hm_o}%</span></div>
|
|
||||||
</div>`;
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
top: '0%',
|
|
||||||
right: '2%',
|
|
||||||
itemGap: 12,
|
|
||||||
textStyle: { color: '#cbd5e1', fontSize: 11 }
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
top: '15%',
|
|
||||||
left: '4%',
|
|
||||||
right: '6%',
|
|
||||||
bottom: '10%',
|
|
||||||
containLabel: true
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
data: timeline,
|
|
||||||
axisLabel: { color: '#94a3b8', fontSize: 10.5 },
|
|
||||||
axisLine: { lineStyle: { color: 'rgba(56, 189, 248, 0.2)' } }
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value',
|
|
||||||
axisLabel: { color: '#94a3b8', fontSize: 10 },
|
|
||||||
splitLine: { lineStyle: { color: 'rgba(56, 189, 248, 0.08)' } }
|
|
||||||
},
|
|
||||||
series
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** 每行按自身最大值设定比例,原始数值与单位始终直接标注,禁止跨指标比较柱长。 */
|
||||||
* 现状实测 vs 预测推演偏离对比 ECharts 配置生成 (高质感防截断水平对比条形图)
|
|
||||||
* @param {string} grainType 粮种类型
|
|
||||||
* @param {Array<Object>} currentItems 当前化验指标列表
|
|
||||||
* @param {Array<Object>} futureTargets 未来预测指标列表
|
|
||||||
*/
|
|
||||||
export function buildForecastCompareChartOption(grainType, currentItems = [], futureTargets = []) {
|
export function buildForecastCompareChartOption(grainType, currentItems = [], futureTargets = []) {
|
||||||
const names = futureTargets.map(f => f.name);
|
const rows = futureTargets.map(f => {
|
||||||
const currentValues = futureTargets.map(f => {
|
|
||||||
const cur = currentItems.find(c => c.key === f.key || c.name === f.name);
|
const cur = currentItems.find(c => c.key === f.key || c.name === f.name);
|
||||||
const num = cur ? parseFloat(cur.value || cur.predictedValue) : 0;
|
const current = forecastNumber(cur?.value ?? cur?.predictedValue);
|
||||||
return isNaN(num) ? 0 : num;
|
const future = forecastNumber(f.predictedValue);
|
||||||
|
const unit = f.unit || cur?.unit || '';
|
||||||
|
const scale = Math.max(current ?? 0, future ?? 0, 0.01);
|
||||||
|
const delta = current !== null && future !== null ? Number((future - current).toFixed(2)) : null;
|
||||||
|
return {...f, current, future, unit, scale, delta};
|
||||||
});
|
});
|
||||||
const forecastValues = futureTargets.map(f => Number(f.predictedValue || 0));
|
const datum = (r, value) => ({value: value === null ? null : value / r.scale * 100, rawValue: value, unit: r.unit});
|
||||||
|
return { animationDuration: 350,
|
||||||
return {
|
aria: {enabled: true, description: '每个指标独立对比当前实测与未来预测,柱长仅可在同一指标内比较。'},
|
||||||
tooltip: {
|
tooltip: {...forecastTooltip, axisPointer: {type: 'shadow', shadowStyle: {color: '#94adc808'}}, formatter: params => {
|
||||||
trigger: 'axis',
|
if (!Array.isArray(params) || !params.length) return '';
|
||||||
axisPointer: { type: 'shadow' },
|
const r = rows[params[0].dataIndex];
|
||||||
backgroundColor: 'rgba(11, 22, 44, 0.94)',
|
if (!r) return '';
|
||||||
borderColor: 'rgba(56, 189, 248, 0.4)',
|
const change = r.delta === null ? '暂无预测' : `${r.delta > 0 ? '+' : ''}${r.delta} ${r.unit}`;
|
||||||
textStyle: { color: '#f8fafc', fontSize: 11 },
|
return `<b>${forecastEscape(r.name)}</b><div>现状实测:${forecastText(r.current)} ${forecastEscape(r.unit)}</div><div>未来预测:${forecastText(r.future)} ${forecastEscape(r.unit)}</div><div style="border-top:1px solid #304157;margin-top:8px;padding-top:8px;color:#b9c9da">变化量:${forecastEscape(change)}</div>`;
|
||||||
formatter: (params) => {
|
}},
|
||||||
if (!Array.isArray(params) || params.length === 0) return '';
|
legend: {top: 10, left: 12, itemWidth: 12, itemHeight: 7, itemGap: 22,
|
||||||
const name = params[0].name || '';
|
textStyle: {color: '#a6bbcf', fontSize: 11}, data: ['现状实测', '未来预测']},
|
||||||
const p0 = params[0];
|
grid: {top: 54, left: 128, right: 120, bottom: 32},
|
||||||
const p1 = params[1] || {};
|
yAxis: {type: 'category', inverse: true, data: rows.map(r => r.name),
|
||||||
const val0 = Number(p0.value || 0);
|
axisTick: {show: false}, axisLine: {show: false},
|
||||||
const val1 = Number(p1.value || 0);
|
axisLabel: {color: '#d2dfed', fontSize: 11, lineHeight: 17, width: 112, overflow: 'break',
|
||||||
const delta = Number((val1 - val0).toFixed(2));
|
formatter: (v, i) => `${v.match(/.{1,8}/g)?.join('\n') || v}\n{unit|${rows[i].unit}}`, rich: {unit: {color: '#7089a2', fontSize: 10}}}},
|
||||||
const deltaText = delta >= 0 ? `+${delta}` : `${delta}`;
|
xAxis: {type: 'value', max: 100, show: false},
|
||||||
const deltaColor = delta > 0 ? '#f59e0b' : '#38bdf8';
|
series: [{name: '现状实测', type: 'bar', barWidth: 9, barGap: '65%',
|
||||||
return `<div style="font-weight:700;margin-bottom:6px;color:#38bdf8;">${name}</div>
|
itemStyle: {color: '#547797', borderRadius: 3},
|
||||||
<div style="display:flex;justify-content:space-between;gap:16px;margin:2px 0;">
|
label: {show: true, position: 'right', distance: 8, color: '#afc3d8', fontSize: 11,
|
||||||
<span>${p0.marker} ${p0.seriesName}</span>
|
formatter: p => `${forecastText(p.data.rawValue)} ${p.data.unit}`},
|
||||||
<strong style="color:#f8fafc;">${val0}</strong>
|
data: rows.map(r => datum(r, r.current))},
|
||||||
</div>
|
{name: '未来预测', type: 'bar', barWidth: 9,
|
||||||
<div style="display:flex;justify-content:space-between;gap:16px;margin:2px 0;">
|
itemStyle: {color: '#59d9ce', borderRadius: 3},
|
||||||
<span>${p1.marker} ${p1.seriesName}</span>
|
label: {show: true, position: 'right', distance: 8, color: '#83e9df', fontSize: 11, fontWeight: 600,
|
||||||
<strong style="color:#6ee7b7;">${val1}</strong>
|
formatter: p => `${forecastText(p.data.rawValue)} ${p.data.unit}`},
|
||||||
</div>
|
data: rows.map(r => datum(r, r.future))}]
|
||||||
<div style="margin-top:5px;padding-top:4px;border-top:1px dashed rgba(56,189,248,0.25);font-size:10px;color:#94a3b8;">
|
|
||||||
未来演变偏离差: <strong style="color:${deltaColor};">${deltaText}</strong>
|
|
||||||
</div>`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
top: '0%',
|
|
||||||
right: '2%',
|
|
||||||
textStyle: { color: '#cbd5e1', fontSize: 10.5 },
|
|
||||||
data: ['现状实测', '未来预测']
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
top: '15%',
|
|
||||||
left: '4%',
|
|
||||||
right: '12%',
|
|
||||||
bottom: '10%',
|
|
||||||
containLabel: true
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'category',
|
|
||||||
inverse: true,
|
|
||||||
data: names,
|
|
||||||
axisLabel: {
|
|
||||||
color: '#cbd5e1',
|
|
||||||
fontSize: 10.5,
|
|
||||||
fontWeight: 500,
|
|
||||||
formatter: (v) => v.length > 9 ? v.substring(0, 8) + '…' : v
|
|
||||||
},
|
|
||||||
axisTick: { show: false },
|
|
||||||
axisLine: { lineStyle: { color: 'rgba(56, 189, 248, 0.2)' } }
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'value',
|
|
||||||
axisLabel: { color: '#94a3b8', fontSize: 10 },
|
|
||||||
splitLine: { lineStyle: { color: 'rgba(56, 189, 248, 0.08)' } }
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: '现状实测',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: 10,
|
|
||||||
barGap: '35%',
|
|
||||||
itemStyle: {
|
|
||||||
borderRadius: [0, 4, 4, 0],
|
|
||||||
color: '#38bdf8'
|
|
||||||
},
|
|
||||||
label: {
|
|
||||||
show: true,
|
|
||||||
position: 'right',
|
|
||||||
color: '#93c5fd',
|
|
||||||
fontSize: 10,
|
|
||||||
fontWeight: 600,
|
|
||||||
formatter: '{c}'
|
|
||||||
},
|
|
||||||
data: currentValues
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '未来预测',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: 10,
|
|
||||||
itemStyle: {
|
|
||||||
borderRadius: [0, 4, 4, 0],
|
|
||||||
color: '#10b981'
|
|
||||||
},
|
|
||||||
label: {
|
|
||||||
show: true,
|
|
||||||
position: 'right',
|
|
||||||
color: '#6ee7b7',
|
|
||||||
fontSize: 10,
|
|
||||||
fontWeight: 600,
|
|
||||||
formatter: '{c}'
|
|
||||||
},
|
|
||||||
data: forecastValues
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1464,9 +1448,8 @@ export async function fetchGranaryForecast(granaryItem, days = [7, 15, 30, 60],
|
|||||||
output: {
|
output: {
|
||||||
targets: {
|
targets: {
|
||||||
water: matched.forecast_water,
|
water: matched.forecast_water,
|
||||||
wheat_moisture: matched.forecast_water,
|
[grainType === 'wheat' ? 'wheat_moisture' : 'paddy_moisture']: matched.forecast_water,
|
||||||
impurity: matched.forecast_impurity,
|
impurity: matched.forecast_impurity,
|
||||||
wheat_GWAC: matched.forecast_impurity,
|
|
||||||
weight: matched.forecast_weight,
|
weight: matched.forecast_weight,
|
||||||
wheat_unitweight: matched.forecast_weight,
|
wheat_unitweight: matched.forecast_weight,
|
||||||
imperfect: matched.forecast_imperfect,
|
imperfect: matched.forecast_imperfect,
|
||||||
@@ -1544,6 +1527,32 @@ export const DEFAULT_GRANARY_DATA = {"code":1,"msg":"获取成功","time":"17872
|
|||||||
* 中心库 3D 鸟瞰实景 (assets/aerial_view2.jpg 3840x2143) 像素级建筑物热点精准锚定与错层避让
|
* 中心库 3D 鸟瞰实景 (assets/aerial_view2.jpg 3840x2143) 像素级建筑物热点精准锚定与错层避让
|
||||||
* 覆盖 13 栋粮食平房仓 (屋脊几何中心) + 7 座立式储油罐 (高低错层 0 重叠 + 激光引线指向罐顶)
|
* 覆盖 13 栋粮食平房仓 (屋脊几何中心) + 7 座立式储油罐 (高低错层 0 重叠 + 激光引线指向罐顶)
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* 后台坐标按仓号发布,内置坐标按数据库 id 发布。两者不能合并成一张表,
|
||||||
|
* 否则 id 与另一座仓的仓号相同时,编号会标到错误的建筑上。
|
||||||
|
* @param {Object} item
|
||||||
|
* @param {Object|null} customCoords 后台坐标,键为仓号
|
||||||
|
* @param {Object} builtinCoords 内置坐标,键为 id
|
||||||
|
*/
|
||||||
|
export function resolveHotspotCoord(item, customCoords, builtinCoords) {
|
||||||
|
if (!item) return null;
|
||||||
|
if (item.screenCoord) return item.screenCoord;
|
||||||
|
if (CENTER_EXTRA_POSITIONS[item.screenPosition]) return CENTER_EXTRA_POSITIONS[item.screenPosition];
|
||||||
|
const custom = customCoords || null;
|
||||||
|
const builtin = builtinCoords || {};
|
||||||
|
if (custom && item.num !== undefined && item.num !== null && custom[item.num]) {
|
||||||
|
return custom[item.num];
|
||||||
|
}
|
||||||
|
if (custom && item.name && custom[item.name]) return custom[item.name];
|
||||||
|
return builtin[item.id] || builtin[item.num] || (item.name && builtin[item.name]) || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 建筑位置与可编辑仓号分开保存,改号后仍指向同一栋建筑。
|
||||||
|
export const CENTER_EXTRA_POSITIONS = {
|
||||||
|
center_upper_left: { x: 46.8, y: 28.4 },
|
||||||
|
center_lower_right: { x: 58.8, y: 34.1 }
|
||||||
|
};
|
||||||
|
|
||||||
export const CENTER_HOTSPOT_COORDS = {
|
export const CENTER_HOTSPOT_COORDS = {
|
||||||
// 7 座立式储油罐 (左侧储油罐群 · 像素级真实罐顶中心锚定 + 全员配备发光激光引线立体错层 0 重叠)
|
// 7 座立式储油罐 (左侧储油罐群 · 像素级真实罐顶中心锚定 + 全员配备发光激光引线立体错层 0 重叠)
|
||||||
43: { x: 4.8, y: 12.8, stemX: 2.8, stemY: 20.3 }, // 14号油罐 (最左立式大罐 · 2500吨 · 气泡右移避开左侧侧边栏遮挡,激光引线斜向直达罐顶正中心)
|
43: { x: 4.8, y: 12.8, stemX: 2.8, stemY: 20.3 }, // 14号油罐 (最左立式大罐 · 2500吨 · 气泡右移避开左侧侧边栏遮挡,激光引线斜向直达罐顶正中心)
|
||||||
@@ -2042,7 +2051,7 @@ export function generateDepotAlerts(normalizedList = [], envData = null) {
|
|||||||
// 2. 遍历各仓房质检报告
|
// 2. 遍历各仓房质检报告
|
||||||
(normalizedList || []).forEach(item => {
|
(normalizedList || []).forEach(item => {
|
||||||
const vName = item.grainName || (item.rawContent && item.rawContent.varieties) || (item.isOilTank ? '菜籽油' : '小麦');
|
const vName = item.grainName || (item.rawContent && item.rawContent.varieties) || (item.isOilTank ? '菜籽油' : '小麦');
|
||||||
const report = getGranaryQualityReport(vName, item.rawContent || {});
|
const report = getGranaryQualityReport(vName, item.rawContent || {}, item.qualityTest || null);
|
||||||
if (!report || !report.items) return;
|
if (!report || !report.items) return;
|
||||||
|
|
||||||
report.items.forEach(it => {
|
report.items.forEach(it => {
|
||||||
@@ -2087,6 +2096,17 @@ export function generateDepotAlerts(normalizedList = [], envData = null) {
|
|||||||
return alerts;
|
return alerts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按轨道宽度设定走马灯时长,保持约 32px/s,避免告警变多后固定时长滚得过快。
|
||||||
|
* @param {HTMLElement} track
|
||||||
|
*/
|
||||||
|
export function syncAlertMarqueeSpeed(track) {
|
||||||
|
if (!track) return;
|
||||||
|
const distance = track.scrollWidth / 2;
|
||||||
|
const seconds = Math.max(60, Math.round((distance || 0) / 32));
|
||||||
|
track.style.setProperty('--marquee-duration', `${seconds}s`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成粮油质检化验单 CSV 模板 (带 UTF-8 BOM,Excel 打开无乱码)
|
* 生成粮油质检化验单 CSV 模板 (带 UTF-8 BOM,Excel 打开无乱码)
|
||||||
* @param {string} varietyKey 'wheat' | 'oil' | 'paddy'
|
* @param {string} varietyKey 'wheat' | 'oil' | 'paddy'
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
DESIGN_THEME,
|
DESIGN_THEME,
|
||||||
XISHUI_GRANARY_DATA,
|
XISHUI_GRANARY_DATA,
|
||||||
XISHUI_HOTSPOT_COORDS,
|
XISHUI_HOTSPOT_COORDS,
|
||||||
|
resolveHotspotCoord,
|
||||||
buildQualityHtml,
|
buildQualityHtml,
|
||||||
buildQualityHudHtml,
|
buildQualityHudHtml,
|
||||||
mapVarietyToForecastType,
|
mapVarietyToForecastType,
|
||||||
@@ -14,8 +15,9 @@ import {
|
|||||||
buildForecastCompareChartOption,
|
buildForecastCompareChartOption,
|
||||||
fetchGranaryForecast,
|
fetchGranaryForecast,
|
||||||
getGranaryQualityReport,
|
getGranaryQualityReport,
|
||||||
generateDepotAlerts
|
generateDepotAlerts,
|
||||||
} from './grain_monitor_core.js';
|
syncAlertMarqueeSpeed
|
||||||
|
} from './grain_monitor_core.js?v=20261028_chart3';
|
||||||
|
|
||||||
// 全局状态
|
// 全局状态
|
||||||
const STATE = {
|
const STATE = {
|
||||||
@@ -108,6 +110,7 @@ function loadGranaryData() {
|
|||||||
renderKPIs();
|
renderKPIs();
|
||||||
renderHotspots();
|
renderHotspots();
|
||||||
renderMiniGrid();
|
renderMiniGrid();
|
||||||
|
renderDetailPanels();
|
||||||
renderDepotAlerts();
|
renderDepotAlerts();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -160,6 +163,9 @@ function renderDepotAlerts() {
|
|||||||
const marqueeTrack = document.getElementById('alert-marquee-track');
|
const marqueeTrack = document.getElementById('alert-marquee-track');
|
||||||
if (!marqueeTrack) return;
|
if (!marqueeTrack) return;
|
||||||
const alerts = generateDepotAlerts(STATE.list, STATE.envData);
|
const alerts = generateDepotAlerts(STATE.list, STATE.envData);
|
||||||
|
const signature = alerts.map(a => `${a.id}|${a.text}`).join('\n');
|
||||||
|
if (marqueeTrack.dataset.alertSignature === signature && marqueeTrack.childElementCount > 0) return;
|
||||||
|
marqueeTrack.dataset.alertSignature = signature;
|
||||||
marqueeTrack.innerHTML = '';
|
marqueeTrack.innerHTML = '';
|
||||||
const displayAlerts = alerts.length > 0 ? (alerts.length === 1 ? alerts : alerts.concat(alerts)) : [];
|
const displayAlerts = alerts.length > 0 ? (alerts.length === 1 ? alerts : alerts.concat(alerts)) : [];
|
||||||
displayAlerts.forEach(alert => {
|
displayAlerts.forEach(alert => {
|
||||||
@@ -180,6 +186,7 @@ function renderDepotAlerts() {
|
|||||||
}
|
}
|
||||||
marqueeTrack.appendChild(pill);
|
marqueeTrack.appendChild(pill);
|
||||||
});
|
});
|
||||||
|
requestAnimationFrame(() => syncAlertMarqueeSpeed(marqueeTrack));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 渲染顶部关键 KPIs
|
// 4. 渲染顶部关键 KPIs
|
||||||
@@ -199,12 +206,10 @@ function renderHotspots() {
|
|||||||
const container = document.getElementById('aerial-hotspots');
|
const container = document.getElementById('aerial-hotspots');
|
||||||
if (!container) return;
|
if (!container) return;
|
||||||
|
|
||||||
const hotspotCoords = STATE.customCoords ? { ...XISHUI_HOTSPOT_COORDS, ...STATE.customCoords } : XISHUI_HOTSPOT_COORDS;
|
|
||||||
|
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
|
|
||||||
STATE.list.forEach(item => {
|
STATE.list.forEach(item => {
|
||||||
const rawCoord = hotspotCoords[item.id] || hotspotCoords[item.num] || hotspotCoords[item.name];
|
const rawCoord = resolveHotspotCoord(item, STATE.customCoords, XISHUI_HOTSPOT_COORDS);
|
||||||
if (!rawCoord) return;
|
if (!rawCoord) return;
|
||||||
|
|
||||||
const coord = {
|
const coord = {
|
||||||
@@ -602,7 +607,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
|||||||
|
|
||||||
setupForecastEnvControls();
|
setupForecastEnvControls();
|
||||||
|
|
||||||
const currentReport = getGranaryQualityReport(grainName, currentItem.rawContent || currentItem.content || {});
|
const currentReport = getGranaryQualityReport(grainName, currentItem.rawContent || currentItem.content || {}, currentItem.qualityTest);
|
||||||
|
|
||||||
// 1. 0 毫秒即时秒出基础图表 (杜绝任何白屏与残亮点)
|
// 1. 0 毫秒即时秒出基础图表 (杜绝任何白屏与残亮点)
|
||||||
const baselineList = [
|
const baselineList = [
|
||||||
@@ -642,6 +647,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
|||||||
const initialFuture30 = initialSeries.metrics.map(m => ({
|
const initialFuture30 = initialSeries.metrics.map(m => ({
|
||||||
key: m.key,
|
key: m.key,
|
||||||
name: m.name,
|
name: m.name,
|
||||||
|
unit: m.unit,
|
||||||
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
||||||
}));
|
}));
|
||||||
const initialCompareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], initialFuture30);
|
const initialCompareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], initialFuture30);
|
||||||
@@ -667,7 +673,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
|||||||
const series = generateForecastSeries(grainType, currentReport, forecastList, STATE.forecastEnv);
|
const series = generateForecastSeries(grainType, currentReport, forecastList, STATE.forecastEnv);
|
||||||
|
|
||||||
if (trendTitleEl) {
|
if (trendTitleEl) {
|
||||||
trendTitleEl.textContent = `${currentItem.name} (${grainName}) 质量指标多周期演变推演 (当前实测与未来 7~60天)`;
|
trendTitleEl.textContent = `${currentItem.name} (${grainName}) 多周期趋势`;
|
||||||
}
|
}
|
||||||
const trendOption = buildForecastTrendChartOption(series);
|
const trendOption = buildForecastTrendChartOption(series);
|
||||||
if (trendOption) {
|
if (trendOption) {
|
||||||
@@ -677,11 +683,12 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
|||||||
const future30Targets = series.metrics.map(m => ({
|
const future30Targets = series.metrics.map(m => ({
|
||||||
key: m.key,
|
key: m.key,
|
||||||
name: m.name,
|
name: m.name,
|
||||||
|
unit: m.unit,
|
||||||
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (compareTitleEl) {
|
if (compareTitleEl) {
|
||||||
compareTitleEl.textContent = `${currentItem.name} 现状实测 vs 未来30天预测终值偏离评估`;
|
compareTitleEl.textContent = `${currentItem.name} 未来30天 · 变化对比`;
|
||||||
}
|
}
|
||||||
const compareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], future30Targets);
|
const compareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], future30Targets);
|
||||||
if (compareOption) {
|
if (compareOption) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||||
<title>中储粮(习水)智慧粮仓综合监测中心</title>
|
<title>中储粮(习水)智慧粮仓综合监测中心</title>
|
||||||
<link rel="stylesheet" href="./css/style.css">
|
<link rel="stylesheet" href="./css/style.css?v=20261028_chart3">
|
||||||
<!-- ECharts 可视化库 (CDN) -->
|
<!-- ECharts 可视化库 (CDN) -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
@@ -283,7 +283,7 @@
|
|||||||
<div class="forecast-env-bar">
|
<div class="forecast-env-bar">
|
||||||
<div class="forecast-env-label">
|
<div class="forecast-env-label">
|
||||||
<span class="env-pulse-icon"></span>
|
<span class="env-pulse-icon"></span>
|
||||||
<span>推演环境工况 (API输入):</span>
|
<span>推演环境设置</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="forecast-env-items">
|
<div class="forecast-env-items">
|
||||||
<div class="forecast-env-group">
|
<div class="forecast-env-group">
|
||||||
@@ -325,9 +325,10 @@
|
|||||||
<!-- 左侧:多周期未来质量演变趋势折线图 (含国家警戒线) -->
|
<!-- 左侧:多周期未来质量演变趋势折线图 (含国家警戒线) -->
|
||||||
<div class="center-chart-card">
|
<div class="center-chart-card">
|
||||||
<div class="center-chart-card-title-bar">
|
<div class="center-chart-card-title-bar">
|
||||||
<div class="center-chart-card-title" id="forecast-trend-title">粮食质量指标多周期演变趋势推演 (未来 7~60天走势与国家警戒线)</div>
|
<div class="center-chart-card-title" id="forecast-trend-title">多周期趋势</div>
|
||||||
<div class="forecast-env-pill" id="forecast-trend-env-pill">工况: 仓内 18.5℃ / 72.4% · 仓外 32.5℃ / 54.2%</div>
|
<div class="forecast-env-pill" id="forecast-trend-env-pill">工况: 仓内 18.5℃ / 72.4% · 仓外 32.5℃ / 54.2%</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="forecast-chart-note"><span>各指标独立刻度 · 保留原始单位</span><span>● 实测起点 ┈ 预测趋势 <span class="threshold-key">┄ 警戒参考</span></span></div>
|
||||||
<div id="chart-forecast-trend" class="center-chart-canvas"></div>
|
<div id="chart-forecast-trend" class="center-chart-canvas"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 右侧:现状实测 vs 预测推演偏离对比柱状图 -->
|
<!-- 右侧:现状实测 vs 预测推演偏离对比柱状图 -->
|
||||||
@@ -335,6 +336,7 @@
|
|||||||
<div class="center-chart-card-title-bar">
|
<div class="center-chart-card-title-bar">
|
||||||
<div class="center-chart-card-title" id="forecast-compare-title">现状实测值 vs 预测终值偏离对比与风险评估</div>
|
<div class="center-chart-card-title" id="forecast-compare-title">现状实测值 vs 预测终值偏离对比与风险评估</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="forecast-chart-note">同一指标内对比柱长 · 悬停查看变化量</div>
|
||||||
<div id="chart-forecast-compare" class="center-chart-canvas"></div>
|
<div id="chart-forecast-compare" class="center-chart-canvas"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -400,6 +402,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="module" src="./js/xishui_app.js?v=20260916_v3"></script>
|
<script type="module" src="./js/xishui_app.js?v=20261028_chart3"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户