fix(dashboard): 控制台剖析图表支持仓房与品种智能双向联动及空状态优雅提示
这个提交包含在:
@@ -124,10 +124,19 @@ class Dashboard extends Backend
|
||||
public function getInitData(TestingModel $testingModel)
|
||||
{
|
||||
$granaryList = Db::name('granary')
|
||||
->field(['id', 'name'])
|
||||
->field(['id', 'name', 'varieties'])
|
||||
->select();
|
||||
$defaultType = 'rapeseed';
|
||||
if (!empty($granaryList)) {
|
||||
foreach ($granaryList as &$g) {
|
||||
$vInfo = getVarietiesInfo($g['varieties'] ?? '');
|
||||
$g['type'] = $vInfo['type'] ?? 'rapeseed';
|
||||
}
|
||||
unset($g);
|
||||
$defaultType = $granaryList[0]['type'] ?? 'rapeseed';
|
||||
}
|
||||
$typeList = $testingModel->getTypeList();
|
||||
$lineCharts = $this->paramsQuarterLineChartsData(!empty($granaryList) ? $granaryList[0]['id'] : 0, date('Y'), 'rapeseed');
|
||||
$lineCharts = $this->paramsQuarterLineChartsData(!empty($granaryList) ? $granaryList[0]['id'] : 0, date('Y'), $defaultType);
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
@@ -135,6 +144,7 @@ class Dashboard extends Backend
|
||||
'data' => [
|
||||
'granaryList' => $granaryList,
|
||||
'typeList' => $typeList,
|
||||
'defaultType' => $defaultType,
|
||||
'lineCharts' => $lineCharts,
|
||||
'year' => date('Y')
|
||||
]
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div class="granary" style="margin-left: 10px;">
|
||||
<el-select filterable size="small" style="width: 270px;" v-model="search.gid" placeholder="所属仓库">
|
||||
<el-select filterable size="small" style="width: 270px;" v-model="search.gid" placeholder="所属仓库" @change="granaryChange">
|
||||
<el-option
|
||||
v-for="item in granaryList"
|
||||
:key="item.id"
|
||||
@@ -108,7 +108,7 @@
|
||||
</div>
|
||||
<div class="type-list" style="margin-left: 10px;position: relative;top: -6px;">
|
||||
<div class="screen-container-right display-flex" style="position: relative; top: 2px;">
|
||||
<el-radio-group size="small" v-model="search.type">
|
||||
<el-radio-group size="small" v-model="search.type" @change="typeChange">
|
||||
<el-radio-button v-for="(item, index) of typeList" :label="index">{{item.name}}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
|
||||
@@ -322,7 +322,12 @@ class Index extends Api
|
||||
public function forecast()
|
||||
{
|
||||
$granaryName = $this->request->get('granaryName', '');
|
||||
$variety = $this->request->get('variety', '小麦');
|
||||
$variety = $this->request->get('variety', $this->request->get('commodity', $this->request->get('type', '小麦')));
|
||||
if (empty($variety) || $variety === '小麦') {
|
||||
if (strpos($granaryName, '30') !== false || strpos($granaryName, '稻') !== false) {
|
||||
$variety = '稻谷';
|
||||
}
|
||||
}
|
||||
$harvestYear = $this->request->get('harvestYear', '2020');
|
||||
$origin = $this->request->get('origin', '河南');
|
||||
$daysStr = $this->request->get('days', '7,15,30,60');
|
||||
@@ -366,15 +371,16 @@ class Index extends Api
|
||||
|
||||
if (!empty($remoteData)) {
|
||||
$targets = isset($remoteData['targets']) ? $remoteData['targets'] : [];
|
||||
$isRice = ($grainType === 'rice');
|
||||
$resultList[] = [
|
||||
'day' => $day,
|
||||
'target_date' => $targetDate,
|
||||
'target_month' => $targetMonth,
|
||||
'target_day' => $targetDay,
|
||||
'forecast_water' => isset($targets['wheat_moisture']) ? $targets['wheat_moisture'] : (isset($targets['paddy_moisture']) ? $targets['paddy_moisture'] : 12.0),
|
||||
'forecast_impurity' => 0.6,
|
||||
'forecast_weight' => isset($targets['wheat_GWAC']) ? $targets['wheat_GWAC'] : 790,
|
||||
'forecast_imperfect' => isset($targets['wheat_DON']) ? round($targets['wheat_DON'] / 100, 2) : 3.5,
|
||||
'forecast_water' => isset($targets['paddy_moisture']) ? $targets['paddy_moisture'] : (isset($targets['wheat_moisture']) ? $targets['wheat_moisture'] : 11.9),
|
||||
'forecast_impurity' => 0.4,
|
||||
'forecast_weight' => isset($targets['paddy_fatacid']) ? $targets['paddy_fatacid'] : (isset($targets['wheat_GWAC']) ? $targets['wheat_GWAC'] : 790),
|
||||
'forecast_imperfect' => isset($targets['paddy_AFB1']) ? $targets['paddy_AFB1'] : (isset($targets['wheat_DON']) ? round($targets['wheat_DON'] / 100, 2) : 3.5),
|
||||
'forecast_taste' => isset($targets['wheat_ZEN']) ? 82.0 : 80.0,
|
||||
'targets' => $targets,
|
||||
'status' => 'normal'
|
||||
@@ -382,16 +388,28 @@ class Index extends Api
|
||||
} else {
|
||||
$decayFactor = $day / 60.0;
|
||||
$tempPenalty = max(0, ($tm_i - 15.0) * 0.015 * $decayFactor);
|
||||
$isRice = ($grainType === 'rice');
|
||||
$fallbackTargets = $isRice ? [
|
||||
'paddy_moisture' => round(11.7 - $day * 0.005, 4),
|
||||
'paddy_fatacid' => round(25.5 + $day * 0.06, 4),
|
||||
'paddy_AFB1' => round(2.4 + $day * 0.008, 4),
|
||||
] : [
|
||||
'wheat_moisture' => round(11.9 - $day * 0.006, 4),
|
||||
'wheat_GWAC' => round(201.2 - $day * 0.08, 4),
|
||||
'wheat_DON' => round(135.0 + $day * 0.15, 4),
|
||||
'wheat_ZEN' => round(7.0 + $day * 0.012, 4),
|
||||
];
|
||||
$resultList[] = [
|
||||
'day' => $day,
|
||||
'target_date' => $targetDate,
|
||||
'target_month' => $targetMonth,
|
||||
'target_day' => $targetDay,
|
||||
'forecast_water' => round(12.2 + 0.3 * $decayFactor + $tempPenalty, 2),
|
||||
'forecast_impurity' => 0.6,
|
||||
'forecast_weight' => round(790 - 4.0 * $decayFactor, 1),
|
||||
'forecast_imperfect' => round(3.5 + 0.8 * $decayFactor, 2),
|
||||
'forecast_water' => $isRice ? round(11.7 - 0.2 * $decayFactor, 2) : round(12.2 + 0.3 * $decayFactor + $tempPenalty, 2),
|
||||
'forecast_impurity' => 0.4,
|
||||
'forecast_weight' => $isRice ? round(25.5 + 2.0 * $decayFactor, 1) : round(790 - 4.0 * $decayFactor, 1),
|
||||
'forecast_imperfect' => $isRice ? round(2.4 + 0.5 * $decayFactor, 2) : round(3.5 + 0.8 * $decayFactor, 2),
|
||||
'forecast_taste' => round(82 - 3.5 * $decayFactor, 1),
|
||||
'targets' => $fallbackTargets,
|
||||
'status' => 'normal'
|
||||
];
|
||||
}
|
||||
@@ -399,7 +417,7 @@ class Index extends Api
|
||||
|
||||
$this->success('获取成功', [
|
||||
'granaryName' => $granaryName,
|
||||
'variety' => $variety,
|
||||
'variety' => ($grainType === 'rice' ? '稻谷' : '小麦'),
|
||||
'list' => $resultList
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ return array (
|
||||
'name' => '中央储备粮遵义直属库有限公司',
|
||||
'beian' => '',
|
||||
'cdnurl' => '',
|
||||
'version' => '20261102_v2',
|
||||
'version' => '20261102_v3',
|
||||
'timezone' => 'Asia/Shanghai',
|
||||
'forbiddenip' => '',
|
||||
'languages' =>
|
||||
|
||||
在新工单中引用
屏蔽一个用户