图表管理+报表历史管理

master
xce 2025-12-24 03:42:53 +08:00
parent 6dabc03817
commit 2c716e70f8
4 changed files with 542 additions and 1 deletions

44
src/api/system/data.js Normal file
View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询DTU温湿度上报数据列表
export function listData(query) {
return request({
url: '/system/data/list',
method: 'get',
params: query
})
}
// 查询DTU温湿度上报数据详细
export function getData(id) {
return request({
url: '/system/data/' + id,
method: 'get'
})
}
// 新增DTU温湿度上报数据
export function addData(data) {
return request({
url: '/system/data',
method: 'post',
data: data
})
}
// 修改DTU温湿度上报数据
export function updateData(data) {
return request({
url: '/system/data',
method: 'put',
data: data
})
}
// 删除DTU温湿度上报数据
export function delData(id) {
return request({
url: '/system/data/' + id,
method: 'delete'
})
}

View File

@ -74,7 +74,7 @@ Vue.use(Element, {
}) })
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.config.devtools = false
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,

View File

@ -0,0 +1,411 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备唯一标识(IMEI/DeviceId)" prop="imei">
<el-input
v-model="queryParams.imei"
placeholder="请输入设备唯一标识(IMEI/DeviceId)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备上报时间戳(ms或s建议统一ms)" prop="ts">
<el-input
v-model="queryParams.ts"
placeholder="请输入设备上报时间戳(ms或s建议统一ms)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="ts转换后的正常时间(由服务端转换入库)" prop="time">
<el-date-picker clearable
v-model="queryParams.time"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择ts转换后的正常时间(由服务端转换入库)">
</el-date-picker>
</el-form-item>
<el-form-item label="温度1(℃)" prop="temp1">
<el-input
v-model="queryParams.temp1"
placeholder="请输入温度1(℃)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="湿度1(%RH)" prop="humi1">
<el-input
v-model="queryParams.humi1"
placeholder="请输入湿度1(%RH)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="温度2(℃)" prop="temp2">
<el-input
v-model="queryParams.temp2"
placeholder="请输入温度2(℃)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="湿度2(%RH)" prop="humi2">
<el-input
v-model="queryParams.humi2"
placeholder="请输入湿度2(%RH)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="温度3(℃)" prop="temp3">
<el-input
v-model="queryParams.temp3"
placeholder="请输入温度3(℃)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="湿度3(%RH)" prop="humi3">
<el-input
v-model="queryParams.humi3"
placeholder="请输入湿度3(%RH)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="温度4(℃)" prop="temp4">
<el-input
v-model="queryParams.temp4"
placeholder="请输入温度4(℃)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="湿度4(%RH)" prop="humi4">
<el-input
v-model="queryParams.humi4"
placeholder="请输入湿度4(%RH)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:data:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:data:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:data:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:data:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键ID" align="center" prop="id" />
<el-table-column label="设备唯一标识(IMEI/DeviceId)" align="center" prop="imei" />
<el-table-column label="设备上报时间戳(ms或s建议统一ms)" align="center" prop="ts" />
<el-table-column label="ts转换后的正常时间(由服务端转换入库)" align="center" prop="time" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.time, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="温度1(℃)" align="center" prop="temp1" />
<el-table-column label="湿度1(%RH)" align="center" prop="humi1" />
<el-table-column label="温度2(℃)" align="center" prop="temp2" />
<el-table-column label="湿度2(%RH)" align="center" prop="humi2" />
<el-table-column label="温度3(℃)" align="center" prop="temp3" />
<el-table-column label="湿度3(%RH)" align="center" prop="humi3" />
<el-table-column label="温度4(℃)" align="center" prop="temp4" />
<el-table-column label="湿度4(%RH)" align="center" prop="humi4" />
<el-table-column label="原始JSON元信息(原始上报码/额外字段)" align="center" prop="raw" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:data:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:data:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改DTU温湿度上报数据对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="设备唯一标识(IMEI/DeviceId)" prop="imei">
<el-input v-model="form.imei" placeholder="请输入设备唯一标识(IMEI/DeviceId)" />
</el-form-item>
<el-form-item label="设备上报时间戳(ms或s建议统一ms)" prop="ts">
<el-input v-model="form.ts" placeholder="请输入设备上报时间戳(ms或s建议统一ms)" />
</el-form-item>
<el-form-item label="ts转换后的正常时间(由服务端转换入库)" prop="time">
<el-date-picker clearable
v-model="form.time"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择ts转换后的正常时间(由服务端转换入库)">
</el-date-picker>
</el-form-item>
<el-form-item label="温度1(℃)" prop="temp1">
<el-input v-model="form.temp1" placeholder="请输入温度1(℃)" />
</el-form-item>
<el-form-item label="湿度1(%RH)" prop="humi1">
<el-input v-model="form.humi1" placeholder="请输入湿度1(%RH)" />
</el-form-item>
<el-form-item label="温度2(℃)" prop="temp2">
<el-input v-model="form.temp2" placeholder="请输入温度2(℃)" />
</el-form-item>
<el-form-item label="湿度2(%RH)" prop="humi2">
<el-input v-model="form.humi2" placeholder="请输入湿度2(%RH)" />
</el-form-item>
<el-form-item label="温度3(℃)" prop="temp3">
<el-input v-model="form.temp3" placeholder="请输入温度3(℃)" />
</el-form-item>
<el-form-item label="湿度3(%RH)" prop="humi3">
<el-input v-model="form.humi3" placeholder="请输入湿度3(%RH)" />
</el-form-item>
<el-form-item label="温度4(℃)" prop="temp4">
<el-input v-model="form.temp4" placeholder="请输入温度4(℃)" />
</el-form-item>
<el-form-item label="湿度4(%RH)" prop="humi4">
<el-input v-model="form.humi4" placeholder="请输入湿度4(%RH)" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listData, getData, delData, addData, updateData } from "@/api/system/data"
export default {
name: "Data",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// DTU湿
dataList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
imei: null,
ts: null,
time: null,
temp1: null,
humi1: null,
temp2: null,
humi2: null,
temp3: null,
humi3: null,
temp4: null,
humi4: null,
raw: null,
},
//
form: {},
//
rules: {
imei: [
{ required: true, message: "设备唯一标识(IMEI/DeviceId)不能为空", trigger: "blur" }
],
ts: [
{ required: true, message: "设备上报时间戳(ms或s建议统一ms)不能为空", trigger: "blur" }
],
time: [
{ required: true, message: "ts转换后的正常时间(由服务端转换入库)不能为空", trigger: "blur" }
],
createTime: [
{ required: true, message: "创建时间(入库时间)不能为空", trigger: "blur" }
]
}
}
},
created() {
this.getList()
},
methods: {
/** 查询DTU温湿度上报数据列表 */
getList() {
this.loading = true
listData(this.queryParams).then(response => {
this.dataList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
id: null,
imei: null,
ts: null,
time: null,
temp1: null,
humi1: null,
temp2: null,
humi2: null,
temp3: null,
humi3: null,
temp4: null,
humi4: null,
raw: null,
createBy: null,
createTime: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加DTU温湿度上报数据"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getData(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改DTU温湿度上报数据"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateData(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addData(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除DTU温湿度上报数据编号为"' + ids + '"的数据项?').then(function() {
return delData(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('system/data/export', {
...this.queryParams
}, `data_${new Date().getTime()}.xlsx`)
}
}
}
</script>

View File

@ -0,0 +1,86 @@
<template>
<div class="app-container">
<el-form ref="queryForm" size="small" :inline="true">
<el-form-item label="图标名称" prop="menuName">
<el-input v-model="name" class="icon-search" clearable placeholder="请输入图标名称" @clear="filterIcons" @input="getIcons">
<i slot="suffix" class="el-icon-search el-input__icon" />
</el-input>
</el-form-item>
</el-form>
<el-table
:data="iconList.map(item => ({value: item}))"
row-key="menuId"
>
<el-table-column type="index" :show-overflow-tooltip="true" width="220" align="center" ></el-table-column>
<el-table-column prop="value" label="菜单名称" :show-overflow-tooltip="true" align="center" width="240"></el-table-column>
<el-table-column prop="value" label="图标" align="center" width="240">
<template slot-scope="scope">
<svg-icon :icon-class="scope.row.value" />
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="page"
:limit.sync="pageSize"
@pagination="getIcons"
/>
</div>
</template>
<script>
import icons from "@/components/IconSelect/requireIcons"
// import icons from './'
export default {
name: 'IconSelect',
props: {
activeIcon: {
type: String
}
},
data() {
return {
name: '',
iconList: icons,
page:1,
pageSize:10,
total: icons.length
}
},
created() {
this.getIcons();
},
methods: {
filterIcons() {
this.iconList = icons
if (this.name) {
this.iconList = this.iconList.filter(item => item.includes(this.name));
}
this.page = 1;
this.total = this.iconList.length;
const start = (this.page - 1) * this.pageSize;
this.iconList = this.iconList.slice(start, start + this.pageSize)
return this.iconList;
},
getIcons() {
this.iconList = icons
if (this.name) {
this.iconList = this.iconList.filter(item => item.includes(this.name));
}
this.total = this.iconList.length;
const start = (this.page - 1) * this.pageSize;
this.iconList = this.iconList.slice(start, start + this.pageSize)
return this.iconList;
},
reset() {
this.name = ''
this.iconList = icons
}
}
}
</script>