From 913a017f3d091bc0d8944c8d8be3958f068f2c28 Mon Sep 17 00:00:00 2001 From: miguannan <53815784+javami888@users.noreply.github.com> Date: Tue, 19 May 2026 13:30:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=B4=A8=E6=A3=80=E5=8F=91=E8=B4=A7?= =?UTF-8?q?=E8=B5=84=E6=96=99=E7=9B=B8=E5=85=B3=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/application/api/controller/Material.php | 37 +- back/application/api/controller/Role.php | 2 +- .../api/controller_74GYL3/Material.php | 42 +- .../api/controller_74GYL3/Role.php | 2 +- front/src/views/components/Materials.vue | 819 ++++++++++-------- 5 files changed, 538 insertions(+), 364 deletions(-) diff --git a/back/application/api/controller/Material.php b/back/application/api/controller/Material.php index 3c740b1..3287a5d 100644 --- a/back/application/api/controller/Material.php +++ b/back/application/api/controller/Material.php @@ -55,6 +55,7 @@ class Material extends Common $insert_info['create_time'] = $param['create_time']; db('materials_info')->insert($insert_info); + return $this->sendSuccess('添加成功'); } @@ -79,24 +80,44 @@ class Material extends Common //项目基础信息 else if (1 == $param['materials_class'] ) { - $MaterialsInfoList = db('materials_info') - ->alias('p') + $currPage = empty($param['currPage']) ? 1 : $param['currPage']; + $pageSize = empty($param['pageSize']) ? 10 : $param['pageSize']; + + $countQuery = db('materials_info')->alias('p') + ->where('p.materials_class', $param['materials_class']) + ->where('p.materials_owner', $param['materials_owner']); + $listQuery = db('materials_info')->alias('p') ->join('materials_type s', 's.type_id = p.materials_type', 'left') ->where('p.materials_class', $param['materials_class']) ->where('p.materials_owner', $param['materials_owner']); - if (isset($param['materials_type']) && is_array($param['materials_type']) && count($param['materials_type']) > 0) { - $MaterialsInfoList->whereIn('p.materials_type', $param['materials_type']); - } elseif (isset($param['materials_type'])) { - $MaterialsInfoList->where('p.materials_type', $param['materials_type']); + if (!empty($param['materials_type'])) { + if (is_array($param['materials_type'])) { + $countQuery->whereIn('p.materials_type', $param['materials_type']); + $listQuery->whereIn('p.materials_type', $param['materials_type']); + } else { + $countQuery->where('p.materials_type', $param['materials_type']); + $listQuery->where('p.materials_type', $param['materials_type']); + } } - $MaterialsInfoList = $MaterialsInfoList + if (!empty($param['start_time'])) { + $countQuery->where('p.create_time', '>=', $param['start_time']); + $listQuery->where('p.create_time', '>=', $param['start_time']); + } + if (!empty($param['end_time'])) { + $countQuery->where('p.create_time', '<=', $param['end_time']); + $listQuery->where('p.create_time', '<=', $param['end_time']); + } + + $total = $countQuery->count(); + $list = $listQuery + ->page($currPage, $pageSize) ->order('p.create_time desc') ->field('p.*, s.type_name as materials_type_name') ->select(); - return $this->sendSuccess($MaterialsInfoList); + return $this->sendSuccess(['list' => $list, 'total' => $total]); } //问题单信息 diff --git a/back/application/api/controller/Role.php b/back/application/api/controller/Role.php index 1d17ecc..1c22e8f 100644 --- a/back/application/api/controller/Role.php +++ b/back/application/api/controller/Role.php @@ -56,7 +56,7 @@ class Role extends Common $results = db('system_router')->alias('router') ->join('system_role', 'system_role.router_id = router.id OR system_role.router_id LIKE concat(router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id) OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\')', 'LEFT') ->field('router.*, GROUP_CONCAT(system_role.role_name) as roles') - ->group('router.path') + ->group('router.id') ->select(); $this->sendSuccess($results); } diff --git a/back/application/api/controller_74GYL3/Material.php b/back/application/api/controller_74GYL3/Material.php index 3f719fd..2b093f3 100644 --- a/back/application/api/controller_74GYL3/Material.php +++ b/back/application/api/controller_74GYL3/Material.php @@ -54,6 +54,7 @@ class Material extends Common $insert_info['create_time'] = $param['create_time']; db('materials_info')->insert($insert_info); + return $this->sendSuccess('添加成功'); } @@ -78,15 +79,38 @@ class Material extends Common //项目基础信息 else if (1 == $param['materials_class'] ) { - $MaterialsInfoList = db('materials_info')->alias('p') - ->join('materials_type s', 's.type_id =p.materials_type', 'left') - ->where('p.materials_class', $param['materials_class']) - ->where('p.materials_owner', $param['materials_owner']) - ->where('p.materials_type', $param['materials_type']) - ->order('p.create_time desc') - ->field('p.*, s.type_name as materials_type_name') - ->select(); - return $this->sendSuccess($MaterialsInfoList); + $currPage = empty($param['currPage']) ? 1 : $param['currPage']; + $pageSize = empty($param['pageSize']) ? 10 : $param['pageSize']; + + $countQuery = db('materials_info')->alias('p') + ->where('p.materials_class', $param['materials_class']) + ->where('p.materials_owner', $param['materials_owner']); + $listQuery = db('materials_info')->alias('p') + ->join('materials_type s', 's.type_id = p.materials_type', 'left') + ->where('p.materials_class', $param['materials_class']) + ->where('p.materials_owner', $param['materials_owner']); + + if (!empty($param['materials_type'])) { + $countQuery->where('p.materials_type', $param['materials_type']); + $listQuery->where('p.materials_type', $param['materials_type']); + } + + if (!empty($param['start_time'])) { + $countQuery->where('p.create_time', '>=', $param['start_time']); + $listQuery->where('p.create_time', '>=', $param['start_time']); + } + if (!empty($param['end_time'])) { + $countQuery->where('p.create_time', '<=', $param['end_time']); + $listQuery->where('p.create_time', '<=', $param['end_time']); + } + + $total = $countQuery->count(); + $list = $listQuery + ->page($currPage, $pageSize) + ->order('p.create_time desc') + ->field('p.*, s.type_name as materials_type_name') + ->select(); + return $this->sendSuccess(['list' => $list, 'total' => $total]); } //问题单信息 diff --git a/back/application/api/controller_74GYL3/Role.php b/back/application/api/controller_74GYL3/Role.php index 1d17ecc..1c22e8f 100644 --- a/back/application/api/controller_74GYL3/Role.php +++ b/back/application/api/controller_74GYL3/Role.php @@ -56,7 +56,7 @@ class Role extends Common $results = db('system_router')->alias('router') ->join('system_role', 'system_role.router_id = router.id OR system_role.router_id LIKE concat(router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id) OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\')', 'LEFT') ->field('router.*, GROUP_CONCAT(system_role.role_name) as roles') - ->group('router.path') + ->group('router.id') ->select(); $this->sendSuccess($results); } diff --git a/front/src/views/components/Materials.vue b/front/src/views/components/Materials.vue index 578d903..8b7b474 100644 --- a/front/src/views/components/Materials.vue +++ b/front/src/views/components/Materials.vue @@ -1,124 +1,202 @@ - - - 添加 - - - - - - - - - - + + + + + + + + + 查询 + 重置 + + + 添加 + + + + + + + - - - - - - - - + + + + + + + + + + + 请选择筛选条件后点击查询 + - - - - - - + + + + + + - - - - - - + + + + + - - - - + + + - - - 点击上传 - - 支持jpg/jpeg/png/pdf/pptx/xlsx/xls/docx/doc/ppt/zip/rar文件,不超过100MB - - - - - - 取 消 - 确 定 - - + + + 点击上传 + + 支持jpg/jpeg/png/pdf/pptx/xlsx/xls/docx/doc/ppt/zip/rar文件,不超过100MB + + + + + + 取 消 + 确 定 + + - - - - - - + + + + + + - - - - + + + - - - - - - + + + + + - - - 点击上传 - - 支持jpg/jpeg/png/pdf/pptx/xlsx/xls/docx/doc/ppt/zip/rar文件,不超过100MB - - - - - - 取 消 - 确 定 - - + + + 点击上传 + + 支持jpg/jpeg/png/pdf/pptx/xlsx/xls/docx/doc/ppt/zip/rar文件,不超过100MB + + + + + + 取 消 + 确 定 + + - - - - - - 该文件类型({{ fileExtension }})需要下载后查看 - - 立即下载 {{ fileExtension.toUpperCase() }} 文件 - - - + + + + + + 该文件类型({{ fileExtension }})需要下载后查看 + + 立即下载 {{ fileExtension.toUpperCase() }} 文件 + + + - + \ No newline at end of file +
该文件类型({{ fileExtension }})需要下载后查看