更新后台系统
This commit is contained in:
parent
a190d4ed9a
commit
6f6ad628a4
|
@ -93,7 +93,7 @@
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange" style="width: 100%">
|
<el-table :data="pager.lists" @selection-change="handleSelectionChange" style="width: 100%">
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column label="ID" prop="id" show-overflow-tooltip />
|
<el-table-column label="ID" prop="id" width="80" show-overflow-tooltip />
|
||||||
<el-table-column label="用户信息" width="200">
|
<el-table-column label="用户信息" width="200">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag class="mr-2" type="success">ID: {{ row.user_id }}</el-tag>
|
<el-tag class="mr-2" type="success">ID: {{ row.user_id }}</el-tag>
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
<span>{{ row.create_time ? timeFormat(row.create_time, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
|
<span>{{ row.create_time ? timeFormat(row.create_time, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="300" align="center" fixed="right">
|
<el-table-column label="操作" width="200" align="center" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
v-perms="['device.device/edit']"
|
v-perms="['device.device/edit']"
|
||||||
|
@ -149,46 +149,6 @@
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</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
|
<el-button
|
||||||
v-perms="['device.monitor_alarm/lists']"
|
v-perms="['device.monitor_alarm/lists']"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
|
@ -36,19 +36,23 @@
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column label="ID" prop="id" show-overflow-tooltip />
|
<el-table-column label="ID" prop="id" width="80" show-overflow-tooltip />
|
||||||
<el-table-column label="设备ID" prop="device_id" show-overflow-tooltip />
|
<el-table-column label="设备信息" width="200">
|
||||||
<el-table-column label="设备名称" prop="device.name" show-overflow-tooltip />
|
<template #default="{ row }">
|
||||||
<el-table-column label="监测类型" prop="type">
|
<el-tag class="mr-2" type="success">ID: {{ row.device_id }}</el-tag>
|
||||||
|
<el-tag class="mr-2" type="success">名称: {{ row.device.name }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="监测类型" align="center" prop="type">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<dict-value :options="dictData.alarm_type" :value="row.type" />
|
<dict-value :options="dictData.alarm_type" :value="row.type" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="报警内容" prop="content" show-overflow-tooltip />
|
<el-table-column label="报警内容" width="300" prop="content" show-overflow-tooltip />
|
||||||
<el-table-column label="报警数值" prop="value" show-overflow-tooltip />
|
<el-table-column label="报警数值" prop="value" show-overflow-tooltip />
|
||||||
<el-table-column label="报警时间" prop="plant_date">
|
<el-table-column label="报警时间" align="center" prop="create_time">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span>{{ row.create_time ? timeFormat(row.plant_date, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
|
<span>{{ row.create_time ? timeFormat(row.create_time, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="140" align="center" fixed="right">
|
<el-table-column label="操作" width="140" align="center" fixed="right">
|
||||||
|
@ -141,6 +145,10 @@ const handleDetail = (data: any) => {
|
||||||
deviceType = dictData['alarm_type'][key]['name']
|
deviceType = dictData['alarm_type'][key]['name']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
detailData.gridData.unshift({
|
||||||
|
item: '报警时间',
|
||||||
|
value: data.create_time ? timeFormat(data.create_time, 'yyyy-mm-dd hh:MM:ss') : ''
|
||||||
|
})
|
||||||
detailData.gridData.unshift({
|
detailData.gridData.unshift({
|
||||||
item: '解决方案',
|
item: '解决方案',
|
||||||
value: data.solution
|
value: data.solution
|
||||||
|
|
|
@ -41,6 +41,7 @@ class DeviceLogic extends BaseLogic
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$device = Device::create([
|
$device = Device::create([
|
||||||
|
'user_id' => $params['user_id'],
|
||||||
'code' => $params['code'],
|
'code' => $params['code'],
|
||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'type' => $params['type'],
|
'type' => $params['type'],
|
||||||
|
@ -77,6 +78,7 @@ class DeviceLogic extends BaseLogic
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$device = Device::where('id', $params['id'])->update([
|
$device = Device::where('id', $params['id'])->update([
|
||||||
|
'user_id' => $params['user_id'],
|
||||||
'code' => $params['code'],
|
'code' => $params['code'],
|
||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'type' => $params['type'],
|
'type' => $params['type'],
|
||||||
|
|
|
@ -31,13 +31,13 @@ class DeviceValidate extends BaseValidate
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
'id' => 'require',
|
'id' => 'require',
|
||||||
'code' => 'require',
|
'code' => 'require',
|
||||||
'name' => 'require',
|
'name' => 'require',
|
||||||
'type' => 'require',
|
'type' => 'require',
|
||||||
'status' => 'require',
|
'status' => 'require',
|
||||||
'is_online' => 'require',
|
'is_online' => 'require',
|
||||||
'is_bind' => 'require',
|
'is_bind' => 'require',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,13 +46,13 @@ class DeviceValidate extends BaseValidate
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $field = [
|
protected $field = [
|
||||||
'id' => 'id',
|
'id' => 'id',
|
||||||
'code' => '设备编码',
|
'code' => '设备编码',
|
||||||
'name' => '设备名称',
|
'name' => '设备名称',
|
||||||
'type' => '设备类型',
|
'type' => '设备类型',
|
||||||
'status' => '设备状态',
|
'status' => '设备状态',
|
||||||
'is_online' => '是否在线',
|
'is_online' => '是否在线',
|
||||||
'is_bind' => '是否绑定土地',
|
'is_bind' => '是否绑定土地',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue