diff --git a/admin/src/views/device/index.vue b/admin/src/views/device/index.vue
index 645e6f4a..1a39e443 100644
--- a/admin/src/views/device/index.vue
+++ b/admin/src/views/device/index.vue
@@ -8,9 +8,17 @@
>
+
+
+
-
+
@@ -239,6 +247,7 @@ if (typeof product_id == 'undefined') {
// 查询条件
const queryParams = reactive({
user_id: '',
+ land_id: '',
product_id: product_id,
code: '',
name: '',
diff --git a/app/adminapi/lists/device/DeviceLists.php b/app/adminapi/lists/device/DeviceLists.php
index e0b2f3e5..d8c54bc2 100644
--- a/app/adminapi/lists/device/DeviceLists.php
+++ b/app/adminapi/lists/device/DeviceLists.php
@@ -42,10 +42,22 @@ class DeviceLists extends BaseAdminDataLists implements ListsSearchInterface
{
return [
'%like%' => ['d.name'],
- '=' => ['d.code', 'd.type', 'd.status', 'd.is_online', 'd.is_bind'],
+ '=' => ['d.user_id', 'd.code', 'd.type', 'd.status', 'd.is_online', 'd.is_bind'],
];
}
+ public function querySearch(): array
+ {
+ $queryWhere = [];
+ if (!empty($this->params['land_id'])) {
+ $queryWhere['lp.land_id'] = $this->params['land_id'];
+ }
+ if (!empty($this->params['product_id'])) {
+ $queryWhere['pd.product_id'] = $this->params['product_id'];
+ }
+ return $queryWhere;
+ }
+
public function userSearch(): array
{
$userWhere['d.user_id'] = 0;
@@ -72,7 +84,7 @@ class DeviceLists extends BaseAdminDataLists implements ListsSearchInterface
public function lists(): array
{
return Db::name('device')->alias('d')
- ->where($this->searchWhere)->where($this->userSearch())
+ ->where($this->searchWhere)->where($this->userSearch())->where($this->querySearch())
->leftJoin('user u','u.id = d.user_id')
->leftJoin('product_device pd','pd.device_id = d.id')
->leftJoin('product p','p.id = pd.product_id')
@@ -94,7 +106,13 @@ class DeviceLists extends BaseAdminDataLists implements ListsSearchInterface
*/
public function count(): int
{
- return Db::name('device')->alias('d')->where($this->searchWhere)->where($this->userSearch())->count();
+ return Db::name('device')->alias('d')->where($this->searchWhere)->where($this->userSearch())->where($this->querySearch())
+ ->leftJoin('user u','u.id = d.user_id')
+ ->leftJoin('product_device pd','pd.device_id = d.id')
+ ->leftJoin('product p','p.id = pd.product_id')
+ ->leftJoin('land_product lp','lp.product_id = pd.product_id')
+ ->leftJoin('land l','l.id = lp.land_id')
+ ->count();
}
}
\ No newline at end of file