feat: 补齐后排大仓和七座浅圆仓的编号及后台绑定

这个提交包含在:
wikiboss
2026-10-28 18:12:48 +08:00
父节点 87edf36b5b
当前提交 a06d23a632
共有 5 个文件被更改,包括 66 次插入 和 10 次删除

查看文件

@@ -120,11 +120,17 @@ class Granary extends Backend
} }
$data['content'] = $content; $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, 3])) {
$data['granary_type'] = intval($data['granary_type']); $data['granary_type'] = intval($data['granary_type']);
} else { } else {
$data['granary_type'] = $data['num'] > 18 ? 2 : 1; $data['granary_type'] = $data['num'] > 18 ? 2 : 1;
} }
if ($position !== '') {
$data['granary_type'] = strpos($position, 'center_silo_') === 0 ? 3 : 2;
}
if ($data['granary_type'] === 3) {
$data['content']['warehouseType'] = '立式浅圆仓';
}
$data['content'] = json_encode($data['content']); $data['content'] = json_encode($data['content']);
// 添加 // 添加

查看文件

@@ -132,8 +132,9 @@
<div class="screen-container-right display-flex" style="position: relative; top: 2px;"> <div class="screen-container-right display-flex" style="position: relative; top: 2px;">
<el-radio-group @input="handelTypeRadio" size="small" v-model="search.granary_type"> <el-radio-group @input="handelTypeRadio" size="small" v-model="search.granary_type">
<el-radio-button :label="0">全部</el-radio-button> <el-radio-button :label="0">全部</el-radio-button>
<el-radio-button :label="1">圆型</el-radio-button> <el-radio-button :label="1">油罐</el-radio-button>
<el-radio-button :label="2">房型</el-radio-button> <el-radio-button :label="2">平房仓</el-radio-button>
<el-radio-button :label="3">浅圆仓</el-radio-button>
</el-radio-group> </el-radio-group>
</div> </div>
<div class="search-select screen-container-right display-flex keyword v-key"> <div class="search-select screen-container-right display-flex keyword v-key">
@@ -209,7 +210,8 @@
align="center"> align="center">
<template scope="scope"> <template scope="scope">
<span v-if="scope.row.granary_type == 1">圆型</span> <span v-if="scope.row.granary_type == 1">圆型</span>
<span v-else>房型</span> <span v-else-if="scope.row.granary_type == 3">浅圆仓</span>
<span v-else>平房仓</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="varieties" width="130" label="存储品种" show-overflow-tooltip <el-table-column prop="varieties" width="130" label="存储品种" show-overflow-tooltip
@@ -271,10 +273,19 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="大屏建筑位置:"> <el-form-item label="大屏建筑位置:">
<el-select v-model="formData.screenPosition" style="width: 440px;"> <el-select @change="changeScreenPosition" v-model="formData.screenPosition" style="width: 440px;">
<el-option label="保留现有建筑位置" value=""></el-option> <el-option label="保留现有建筑位置" value=""></el-option>
<el-option label="中心库 · 左上新增仓库(42号仓左侧)" value="center_upper_left"></el-option> <el-option label="中心库 · 左上新增仓库(42号仓左侧)" value="center_upper_left"></el-option>
<el-option label="中心库 · 右下新增仓库(41号仓左侧)" value="center_lower_right"></el-option> <el-option label="中心库 · 右下新增仓库(41号仓左侧)" value="center_lower_right"></el-option>
<el-option label="中心库 · 中间大长仓(43号仓位置)" value="center_middle"></el-option>
<el-option label="中心库 · 最后排大仓" value="center_rear"></el-option>
<el-option label="中心库 · 第1座浅圆仓(从左到右)" value="center_silo_1"></el-option>
<el-option label="中心库 · 第2座浅圆仓(从左到右)" value="center_silo_2"></el-option>
<el-option label="中心库 · 第3座浅圆仓(从左到右)" value="center_silo_3"></el-option>
<el-option label="中心库 · 第4座浅圆仓(从左到右)" value="center_silo_4"></el-option>
<el-option label="中心库 · 第5座浅圆仓(从左到右)" value="center_silo_5"></el-option>
<el-option label="中心库 · 第6座浅圆仓(从左到右)" value="center_silo_6"></el-option>
<el-option label="中心库 · 第7座浅圆仓(从左到右)" value="center_silo_7"></el-option>
</el-select> </el-select>
<div style="color: #909399;">新仓库请选择对应建筑;现有标记可直接修改仓号,保存后大屏自动同步。</div> <div style="color: #909399;">新仓库请选择对应建筑;现有标记可直接修改仓号,保存后大屏自动同步。</div>
</el-form-item> </el-form-item>
@@ -282,6 +293,7 @@
<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>
<el-radio-button :label="2">房型平房仓 (粮类)</el-radio-button> <el-radio-button :label="2">房型平房仓 (粮类)</el-radio-button>
<el-radio-button :label="3">浅圆仓 (粮类)</el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<div v-if="formData.num !== '' && formData.num !== undefined"> <div v-if="formData.num !== '' && formData.num !== undefined">
@@ -295,7 +307,7 @@
<el-input v-if="isCustomVariety" v-model="customVariety" @input="handleCustomVarietyChange" placeholder="请输入自定义品种名称" style="width: 180px;" maxlength="20" show-word-limit size="small"></el-input> <el-input v-if="isCustomVariety" v-model="customVariety" @input="handleCustomVarietyChange" placeholder="请输入自定义品种名称" style="width: 180px;" maxlength="20" show-word-limit size="small"></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-if="formData.granary_type == 2" label="参数模板:"> <el-form-item v-if="formData.granary_type != 1" label="参数模板:">
<el-radio-group v-model="contentType" size="mini"> <el-radio-group v-model="contentType" size="mini">
<el-radio-button label="two">稻谷类指标模板</el-radio-button> <el-radio-button label="two">稻谷类指标模板</el-radio-button>
<el-radio-button label="three">小麦/玉米/杂粮指标模板</el-radio-button> <el-radio-button label="three">小麦/玉米/杂粮指标模板</el-radio-button>

查看文件

@@ -10,6 +10,15 @@ class GranaryScreen
return [ return [
'center_upper_left' => ['x' => 46.8, 'y' => 28.4], 'center_upper_left' => ['x' => 46.8, 'y' => 28.4],
'center_lower_right' => ['x' => 58.8, 'y' => 34.1], 'center_lower_right' => ['x' => 58.8, 'y' => 34.1],
'center_middle' => ['x' => 44.0, 'y' => 33.5],
'center_rear' => ['x' => 45.1, 'y' => 18.7],
'center_silo_1' => ['x' => 52.4, 'y' => 13.5, 'stemY' => 17.2],
'center_silo_2' => ['x' => 56.6, 'y' => 17.5, 'stemY' => 19.6],
'center_silo_3' => ['x' => 61.3, 'y' => 13.5, 'stemY' => 22.0],
'center_silo_4' => ['x' => 66.2, 'y' => 21.0, 'stemY' => 24.1],
'center_silo_5' => ['x' => 73.2, 'y' => 22.5, 'stemY' => 26.3],
'center_silo_6' => ['x' => 78.5, 'y' => 26.0, 'stemY' => 28.8],
'center_silo_7' => ['x' => 84.9, 'y' => 28.0, 'stemY' => 30.7],
]; ];
} }

25
ops/test_granary_screen.php 普通文件
查看文件

@@ -0,0 +1,25 @@
<?php
require __DIR__ . '/../application/common/library/GranaryScreen.php';
use app\common\library\GranaryScreen;
function check($condition, $message) {
if (!$condition) throw new RuntimeException($message);
}
$positions = GranaryScreen::extraPositions();
check(count($positions) === 11, 'All eleven configurable building positions must exist');
$lastX = 0;
for ($i = 1; $i <= 7; $i++) {
$position = 'center_silo_' . $i;
$item = ['id' => 200 + $i, 'num' => 46 + $i, 'content' => ['screenPosition' => $position]];
$coord = GranaryScreen::resolve($item, []);
check($coord['x'] > $lastX, 'Silos must run from left to right');
check($coord['stemY'] > $coord['y'] && $coord['stemY'] < 32, 'Lead line must point to the silo roof');
$item['num'] = 900 + $i;
check(GranaryScreen::resolve($item, []) === $coord, 'Renumbering must preserve the building');
$lastX = $coord['x'];
}
$middle = GranaryScreen::resolve(['id' => 46, 'num' => 43, 'content' => ['screenPosition' => 'center_middle']], []);
$rear = GranaryScreen::resolve(['id' => 114, 'num' => 46, 'content' => ['screenPosition' => 'center_rear']], []);
check($middle !== $rear, '43 and 46 must label two separate buildings');
check(GranaryScreen::resolve(['id' => 43, 'num' => 14, 'content' => []], [14 => ['x' => 4.8, 'y' => 12.8]]) === ['x' => 4.8, 'y' => 12.8], 'Oil tank numbering must remain separate');
echo "All building position checks passed\n";

查看文件

@@ -290,11 +290,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
let num = parseInt(e, 10); let num = parseInt(e, 10);
if (isNaN(num)) return; if (isNaN(num)) return;
this.formData.num = num; this.formData.num = num;
if (this.title === '添加') { if (this.title === '添加' && this.formData.granary_type !== 3) {
this.formData.granary_type = num > 18 ? 2 : 1; this.formData.granary_type = num > 18 ? 2 : 1;
this.changeGranaryType(this.formData.granary_type); this.changeGranaryType(this.formData.granary_type);
} }
}, },
changeScreenPosition(position) {
if (!position) return;
this.changeGranaryType(position.indexOf('center_silo_') === 0 ? 3 : 2);
},
// 自由切换仓型(1: 圆型油罐,2: 房型平房仓) // 自由切换仓型(1: 圆型油罐,2: 房型平房仓)
changeGranaryType(type) { changeGranaryType(type) {
this.formData.granary_type = type; this.formData.granary_type = type;
@@ -334,11 +338,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
this.varietiesType = 'one'; this.varietiesType = 'one';
} else if (e === '小麦' || e === '玉米') { } else if (e === '小麦' || e === '玉米') {
this.contentType = 'three'; this.contentType = 'three';
this.formData.granary_type = 2; this.formData.granary_type = this.formData.granary_type === 3 ? 3 : 2;
this.varietiesType = 'two'; this.varietiesType = 'two';
} else { } else {
this.contentType = 'two'; this.contentType = 'two';
this.formData.granary_type = 2; this.formData.granary_type = this.formData.granary_type === 3 ? 3 : 2;
this.varietiesType = 'two'; this.varietiesType = 'two';
} }
} }
@@ -352,7 +356,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
this.formData.granary_type = 1; this.formData.granary_type = 1;
this.varietiesType = 'one'; this.varietiesType = 'one';
} else { } else {
this.formData.granary_type = 2; this.formData.granary_type = this.formData.granary_type === 3 ? 3 : 2;
this.varietiesType = 'two'; this.varietiesType = 'two';
} }
this.contentFields[this.contentType]['varieties'] = val; this.contentFields[this.contentType]['varieties'] = val;