更新后台管理

This commit is contained in:
yaooo 2023-11-25 14:06:30 +08:00
parent 92497c8e41
commit 5b302e7fb5
9 changed files with 130 additions and 32 deletions

View File

@ -78,14 +78,18 @@ import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const { query } = useRoute()
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
var device_id = query.device_id
if (typeof(device_id) == 'undefined') {
device_id = ''
}
//
const queryParams = reactive({
device_id: '',
device_id: device_id,
start_time: '',
end_time: ''
})
@ -147,6 +151,10 @@ const handleDetail = (data: any) => {
item: '风向',
value: data.wind_direction
})
detailData.gridData.unshift({
item: '设备名称',
value: data.device.name
})
detailData.gridData.unshift({
item: '设备ID',
value: data.device_id

View File

@ -69,6 +69,8 @@
<el-table-column label="ID" prop="id" show-overflow-tooltip />
<el-table-column label="设备编码" prop="code" show-overflow-tooltip />
<el-table-column label="设备名称" prop="name" show-overflow-tooltip />
<el-table-column label="土地ID" prop="land_id" show-overflow-tooltip />
<el-table-column label="土地名称" prop="title" show-overflow-tooltip />
<el-table-column label="设备类型" prop="type">
<template #default="{ row }">
<dict-value :options="dictData.device_type" :value="row.type" />
@ -89,9 +91,14 @@
<dict-value :options="dictData.device_bind_status" :value="row.is_bind" />
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<el-table-column label="创建时间" width="160" prop="create_time">
<template #default="{ row }">
<span>{{ row.create_time ? timeFormat(row.create_time, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="300" align="center" fixed="right">
<template #default="{ row }">
<el-button
<el-button
v-perms="['device.device/edit']"
type="primary"
link
@ -99,6 +106,62 @@
>
编辑
</el-button>
<el-button v-if="row.type == 1"
v-perms="['device.soil_monitor/lists']"
type="primary"
link
>
<router-link
:to="{
path: getRoutePath('device.soil_monitor/lists'),
query: {
device_id: row.id
}
}"
>
查看土壤
</router-link>
</el-button>
<el-button v-if="row.type == 2"
v-perms="['device.air_monitor/lists']"
type="primary"
link
>
<router-link
:to="{
path: getRoutePath('device.air_monitor/lists'),
query: {
device_id: row.id
}
}"
>
查看空气
</router-link>
</el-button>
<el-button v-if="row.type == 3"
v-perms="['device.device/edit']"
type="primary"
link
@click="handleEdit(row)"
>
查看视频
</el-button>
<el-button
v-perms="['device.monitor_alarm/lists']"
type="primary"
link
>
<router-link
:to="{
path: getRoutePath('device.monitor_alarm/lists'),
query: {
device_id: row.id
}
}"
>
查看报警
</router-link>
</el-button>
<el-button
v-perms="['device.device/delete']"
type="danger"
@ -121,6 +184,7 @@
<script lang="ts" setup name="deviceLists">
import { usePaging } from '@/hooks/usePaging'
import { getRoutePath } from '@/router'
import { useDictData } from '@/hooks/useDictOptions'
import { apiDeviceLists, apiDeviceDelete } from '@/api/device'
import { timeFormat } from '@/utils/util'

View File

@ -44,25 +44,9 @@
<el-table-column label="所属用户" prop="user.account" show-overflow-tooltip />
<el-table-column label="土地负责人" prop="master_name" show-overflow-tooltip />
<el-table-column label="负责人电话" prop="master_phone" show-overflow-tooltip />
<el-table-column label="操作" width="200" fixed="right">
<el-table-column label="操作" width="200" align="center" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['land.land_plant/lists']"
type="primary"
link
>
<router-link
:to="{
path: getRoutePath('land.land_plant/lists'),
query: {
land_id: row.id
}
}"
>
种植信息
</router-link>
</el-button>
<el-button
v-perms="['land.land/edit']"
type="primary"
link
@ -70,6 +54,22 @@
>
编辑
</el-button>
<el-button
v-perms="['land.land_plant/lists']"
type="primary"
link
>
<router-link
:to="{
path: getRoutePath('land.land_plant/lists'),
query: {
land_id: row.id
}
}"
>
种植信息
</router-link>
</el-button>
<el-button
v-perms="['land.land/delete']"
type="danger"

View File

@ -73,7 +73,7 @@
<span>{{ row.plant_date ? timeFormat(row.plant_date, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="200" fixed="right">
<el-table-column label="操作" width="200" align="center" fixed="right">
<template #default="{ row }">
<el-button v-perms="['land.land_plant_action/lists']" type="primary" link >
<router-link

View File

@ -42,7 +42,7 @@
<el-table-column label="种植品牌" prop="landPlant.breed" show-overflow-tooltip />
<el-table-column label="种植面积" prop="landPlant.area" show-overflow-tooltip />
<el-table-column label="操作详情" prop="detail" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<el-table-column label="操作" width="120" align="center" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['land.land_plant_action/edit']"

View File

@ -92,15 +92,22 @@ import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const { query } = useRoute()
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
var device_id = query.device_id
if (typeof(device_id) == 'undefined') {
device_id = ''
}
//
const queryParams = reactive({
device_id: '',
const queryParams = reactive({
device_id: device_id,
type: '',
start_time: '',
end_time: ''
})
//
@ -150,6 +157,10 @@ const handleDetail = (data: any) => {
item: '监测类型',
value: deviceType
})
detailData.gridData.unshift({
item: '设备名称',
value: data.device.name
})
detailData.gridData.unshift({
item: '设备ID',
value: data.device_id

View File

@ -14,7 +14,7 @@
<el-table-column label="土壤最低氮含量" prop="soil_n_content_min" show-overflow-tooltip />
<el-table-column label="最大风速" prop="wind_speed_max" show-overflow-tooltip />
<el-table-column label="最小风速" prop="wind_speed_min" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<el-table-column label="操作" width="120" align="center" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['device.monitor_threshold/edit']"

View File

@ -83,12 +83,19 @@ import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import type EditPopup from './edit.vue'
const { query } = useRoute()
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
var device_id = query.device_id
if (typeof(device_id) == 'undefined') {
device_id = ''
}
//
const queryParams = reactive({
device_id: '',
device_id: device_id,
start_time: '',
end_time: ''
})
@ -146,6 +153,10 @@ const handleDetail = (data: any) => {
item: '土壤温度',
value: data.temperature
})
detailData.gridData.unshift({
item: '设备名称',
value: data.device.name
})
detailData.gridData.unshift({
item: '设备ID',
value: data.device_id

View File

@ -20,6 +20,7 @@ use app\common\model\device\Device;
use app\common\model\land\LandDevice;
use app\common\model\land\Land;
use app\common\lists\ListsSearchInterface;
use think\facade\Db;
/**
@ -40,7 +41,7 @@ class DeviceLists extends BaseAdminDataLists implements ListsSearchInterface
public function setSearch(): array
{
return [
'=' => ['code', 'name', 'type', 'status', 'is_online', 'is_bind'],
'=' => ['d.code', 'd.name', 'd.type', 'd.status', 'd.is_online', 'd.is_bind'],
];
}
@ -56,10 +57,13 @@ class DeviceLists extends BaseAdminDataLists implements ListsSearchInterface
*/
public function lists(): array
{
return Device::where($this->searchWhere)
->field(['id', 'code', 'name', 'type', 'status', 'is_online', 'is_bind'])
return Db::name('device')->where($this->searchWhere)
->alias('d')
->leftJoin('land_device ld','ld.device_id = d.id')
->leftJoin('land l','l.id = ld.land_id')
->field('d.*, ld.land_id, l.title')
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->order(['d.id' => 'desc'])
->select()
->toArray();
}
@ -73,7 +77,7 @@ class DeviceLists extends BaseAdminDataLists implements ListsSearchInterface
*/
public function count(): int
{
return Device::where($this->searchWhere)->count();
return Db::name('device')->where($this->searchWhere)->alias('d')->count();
}
}