|
|
|
<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="站点名称" prop="stnm">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.stnm"
|
|
|
|
placeholder="请输入站点名称"
|
|
|
|
clearable
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="摄像机IP" prop="ip">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.stnm"
|
|
|
|
placeholder="请输入摄像机IP"
|
|
|
|
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-table v-loading="loading" :data="currdataList"
|
|
|
|
border>
|
|
|
|
<el-table-column label="站点名称" align="center" prop="stnm" />
|
|
|
|
<el-table-column label="摄像机IP" align="center" prop="ip" />
|
|
|
|
<el-table-column label="最新数值" align="center" prop="value" />
|
|
|
|
<el-table-column label="最新上传时间" align="center" prop="tm" width="180" />
|
|
|
|
<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)"
|
|
|
|
>修改</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"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<!-- 添加或修改实时数据对话框 -->
|
|
|
|
<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="测站id" prop="stnmId" style="display: none;">
|
|
|
|
<el-input v-model="form.stnmId" placeholder="请输入测站id" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="测站名称" prop="stnm">
|
|
|
|
<el-input v-model="form.stnm" :disabled="true" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="摄像机IP" prop="stcd">
|
|
|
|
<el-input v-model="form.stcd" :disabled="true" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="最新数值" prop="latestValue">
|
|
|
|
<el-input v-model="form.value" placeholder="请输入最新数值" />
|
|
|
|
</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>
|
|
|
|
export default {
|
|
|
|
name: "Currdata",
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
// 遮罩层
|
|
|
|
loading: true,
|
|
|
|
// 选中数组
|
|
|
|
ids: [],
|
|
|
|
// 非单个禁用
|
|
|
|
single: true,
|
|
|
|
// 非多个禁用
|
|
|
|
multiple: true,
|
|
|
|
// 显示搜索条件
|
|
|
|
showSearch: true,
|
|
|
|
// 总条数
|
|
|
|
total: 100,
|
|
|
|
// 实时数据表格数据
|
|
|
|
currdataList: [
|
|
|
|
{stnmId: 1,stnm:'鄞州公园',ip:'123.2.4.1',value:'2.95',tm: '2022-06-08 13:00:00'},
|
|
|
|
{stnmId: 2,stnm:'画龙',ip:'123.2.3.2',value:'39.2',tm: '2022-06-08 13:00:00'},
|
|
|
|
{stnmId: 3,stnm:'大盘山',ip:'123.2.3.3',value:'41.2',tm: '2022-06-08 13:00:00'},
|
|
|
|
{stnmId: 4,stnm:'大石门',ip:'123.2.3.4',value:'45.3',tm: '2022-06-08 13:00:00'},
|
|
|
|
{stnmId: 5,stnm:'云龙',ip:'123.2.3.5',value:'24.3',tm: '2022-06-08 13:00:00'},
|
|
|
|
{stnmId: 6,stnm:'华家山',ip:'123.2.3.6',value:'29.8',tm: '2022-06-08 13:00:00'},
|
|
|
|
{stnmId: 7,stnm:'东钱湖',ip:'123.2.3.7',value:'30.3',tm: '2022-06-08 13:00:00'},
|
|
|
|
{stnmId: 8,stnm:'横溪水库',ip:'123.2.3.8',value:'35.6',tm: '2022-06-08 13:00:00'},
|
|
|
|
{stnmId: 9,stnm:'咸祥',ip:'123.2.3.9',value:'33,1',tm: '2022-06-08 13:00:00'},
|
|
|
|
{stnmId: 10,stnm:'白鹤',ip:'123.2.3.10',value:'24.4',tm: '2022-06-08 13:00:00'},
|
|
|
|
],
|
|
|
|
// 弹出层标题
|
|
|
|
title: "",
|
|
|
|
// 是否显示弹出层
|
|
|
|
open: false,
|
|
|
|
// 查询参数
|
|
|
|
queryParams: {
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
stnmId: null,
|
|
|
|
stnm: null,
|
|
|
|
mainType: null,
|
|
|
|
type: null,
|
|
|
|
stcd: null,
|
|
|
|
deviceTypeId: null,
|
|
|
|
stcdTypeId: null,
|
|
|
|
latestTm: null,
|
|
|
|
latestValue: null
|
|
|
|
},
|
|
|
|
dataType: '',
|
|
|
|
// 表单参数
|
|
|
|
form: {},
|
|
|
|
// 表单校验
|
|
|
|
rules: {
|
|
|
|
},
|
|
|
|
spanArr: [],
|
|
|
|
position: 0
|
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.getList();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
/** 查询实时数据列表 */
|
|
|
|
getList() {
|
|
|
|
this.loading = false;
|
|
|
|
},
|
|
|
|
// 取消按钮
|
|
|
|
cancel() {
|
|
|
|
this.open = false;
|
|
|
|
this.reset();
|
|
|
|
},
|
|
|
|
// 表单重置
|
|
|
|
reset() {
|
|
|
|
this.form = {
|
|
|
|
id: null,
|
|
|
|
stnmId: null,
|
|
|
|
stnm: null,
|
|
|
|
mainType: null,
|
|
|
|
type: null,
|
|
|
|
stcd: null,
|
|
|
|
deviceTypeId: null,
|
|
|
|
stcdTypeId: null,
|
|
|
|
latestTm: null,
|
|
|
|
latestValue: 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 = "添加实时数据";
|
|
|
|
},
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
async handleUpdate(row) {
|
|
|
|
this.reset();
|
|
|
|
const id = row.id || this.ids
|
|
|
|
let res = await this.$axiosGet('/data/currdata/info/'+id);
|
|
|
|
if(res.code === 0){
|
|
|
|
this.form = res.data;
|
|
|
|
this.open = true;
|
|
|
|
this.title = "修改";
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async addMethod(){
|
|
|
|
let res = await this.$axiosPost('/data/currdata/add',this.form);
|
|
|
|
if(res.code === 0){
|
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
|
this.open = false;
|
|
|
|
this.getList();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async editMethod(){
|
|
|
|
let res = await this.$axiosPost('/data/currdata/edit',this.form);
|
|
|
|
if(res.code === 0){
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
this.open = false;
|
|
|
|
this.getList();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/** 提交按钮 */
|
|
|
|
submitForm() {
|
|
|
|
},
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
handleDelete(row) {
|
|
|
|
const stnmIds = row.stnmId || this.ids;
|
|
|
|
this.$modal.confirm('是否确认删除站点信息编号为"' + stnmIds + '"的数据项?').then(function() {
|
|
|
|
|
|
|
|
}).then(() => {
|
|
|
|
this.getList();
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
}).catch(() => {});
|
|
|
|
},
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
handleExport() {
|
|
|
|
this.download('data/currdata/export', {
|
|
|
|
...this.queryParams
|
|
|
|
}, `currdata_${new Date().getTime()}.xlsx`)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|