feat(testing): 增加质检报告独立编辑与详情页面,不再使用弹窗

这个提交包含在:
wikiboss
2026-11-02 14:19:14 +08:00
父节点 6f877be41a
当前提交 43da3cc0ee
共有 38 个文件被更改,包括 2371 次插入 和 301 次删除

查看文件

@@ -2,7 +2,8 @@
namespace app\admin\controller;
use app\common\controller\Backend;
use app\common\controller\GranaryBackend;
use app\common\library\GranarySite;
use app\common\model\ChinaModel;
use app\common\model\GranaryModel;
use app\common\model\TestingModel;
@@ -12,7 +13,7 @@ use app\common\model\TestingModel;
* Class Granary
* @package app\admin\controller
*/
class Granary extends Backend
class Granary extends GranaryBackend
{
/**
@@ -50,6 +51,7 @@ class Granary extends Backend
$granaryType = input('param.granary_type', '');
$china = input('param.china/a', '');
$varieties = input('param.varieties', '');
$this->model->where('site', 'in', $this->filterSites ?: ['__none__']);
$result = $this->model->getLists([
'keyword' => $key,
'type' => $type,
@@ -99,6 +101,17 @@ class Granary extends Backend
{
$data = $this->request->post();
if (!empty($data)) {
$site = isset($data['site']) ? $data['site'] : '';
if (!GranarySite::valid($site) || !in_array($site, $this->granarySites, true)) {
return json(['code' => 400, 'msg' => '请选择有权限的所属库区']);
}
$data['storage'] = GranarySite::STORAGE[$site];
if (!isset($data['num']) || !preg_match('/^[1-9]\d{0,8}$/D', (string)$data['num'])) {
return json(['code' => 400, 'msg' => '仓号必须是正整数']);
}
$duplicate = $this->model->where('site', $site)->where('num', $data['num'])
->where('id', '<>', isset($data['id']) ? (int)$data['id'] : 0)->count();
if ($duplicate) return json(['code' => 400, 'msg' => '该库区的仓号已存在']);
$content = isset($data['content']) && is_array($data['content']) ? $data['content'] : [];
$position = isset($content['screenPosition']) ? $content['screenPosition'] : '';
$positions = \app\common\library\GranaryScreen::extraPositions();
@@ -106,7 +119,7 @@ class Granary extends Backend
return json(['code' => 400, 'msg' => '请选择有效的大屏建筑位置']);
}
if ($position !== '') {
if (strpos($data['storage'], '习水') !== false) {
if ($site === 'xishui') {
return json(['code' => 400, 'msg' => '此建筑位置属于中心库区']);
}
foreach ($this->model->field('id,content')->select() as $existing) {
@@ -119,11 +132,10 @@ class Granary extends Backend
}
}
$data['content'] = $content;
$id = $this->model->where(['num' => $data['num']])->value('id');
if (isset($data['granary_type']) && in_array(intval($data['granary_type']), [1, 2, 3])) {
$data['granary_type'] = intval($data['granary_type']);
} else {
$data['granary_type'] = $data['num'] > 18 ? 2 : 1;
return json(['code' => 400, 'msg' => '请选择有效仓型']);
}
if ($position !== '') {
$data['granary_type'] = strpos($position, 'center_silo_') === 0 ? 3 : 2;
@@ -135,12 +147,6 @@ class Granary extends Backend
// 添加
if (empty($data['id'])) {
if (!empty($id)) {
return json([
'code' => 401,
'msg' => '您输入的仓号已存在'
]);
}
unset($data['id'], $data['old_num'], $data['china']);
$data['create_time'] = time();
@@ -158,14 +164,6 @@ class Granary extends Backend
}
}
if ($data['num'] != $data['old_num']) {
if (!empty($id)) {
return json([
'code' => 401,
'msg' => '您输入的仓号已存在'
]);
}
}
// 编辑
$data['update_time'] = time();