更新后台管理系统细节

This commit is contained in:
yaooo 2023-11-28 15:29:47 +08:00
parent a9a908f928
commit a190d4ed9a
2 changed files with 31 additions and 4 deletions

View File

@ -8,9 +8,17 @@
>
<el-form-item label="用户ID" prop="user_id">
<el-input class="w-[280px]" v-model="queryParams.user_id" clearable placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="土地ID" prop="land_id">
<el-input class="w-[280px]" v-model="queryParams.land_id" clearable placeholder="请输入土地ID" />
</el-form-item>
<el-form-item label="产品ID" prop="product_id">
<el-input class="w-[280px]" v-model="queryParams.product_id" clearable placeholder="请输入产品ID" />
<el-input
class="w-[280px]"
v-model="queryParams.product_id"
clearable
placeholder="请输入产品ID"
/>
</el-form-item>
<el-form-item label="设备编码" prop="code">
<el-input class="w-[280px]" v-model="queryParams.code" clearable placeholder="请输入设备编码" />
@ -239,6 +247,7 @@ if (typeof product_id == 'undefined') {
//
const queryParams = reactive({
user_id: '',
land_id: '',
product_id: product_id,
code: '',
name: '',

View File

@ -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();
}
}