Browse Source

feat: 上报历史查询 下发查询指令

master
wally 4 years ago
parent
commit
ea0a76f650
  1. 18
      alias.config.js
  2. 4
      rest/设备管理.http
  3. 26
      src/apis/index.js
  4. 0
      src/components/data-report.vue
  5. 45
      src/components/search-bar-data.vue
  6. 68
      src/components/search-commands.vue
  7. 26
      src/config/config.js
  8. 53
      src/routers/index.js
  9. 4
      src/store/statistics.js
  10. 105
      src/views/commands.vue
  11. 89
      src/views/data-history.vue
  12. 145
      src/views/data-report.vue
  13. 27
      src/views/device-edit.vue
  14. 8
      src/views/device-list.vue
  15. 2
      src/views/statistical-report.vue

18
alias.config.js

@ -0,0 +1,18 @@
const path = require('path');
const resolve = dir => path.join(__dirname, dir);
module.exports = {
resolve: {
alias: {
'~': __dirname,
'@': resolve('src'),
views: resolve('src/views'),
components: resolve('src/components'),
assets: resolve('src/assets'),
utils: resolve('src/utils'),
store: resolve('src/store'),
apis: resolve('src/apis'),
},
},
};

4
rest/设备管理.http

@ -0,0 +1,4 @@
### 查询设备列表
GET https://test.tall.wiki/gateway/corrosion/devices/all?deviceId=&size=50
Accept: application/json

26
src/apis/index.js

@ -1,3 +1,5 @@
// noinspection SpellCheckingInspection
import http from 'utils/axios';
const apiUrl = import.meta.env.VITE_API_URL;
@ -14,7 +16,13 @@ export const getDevices = () => http.get(`${corrosion}/devices`);
export const createDevice = data => http.post(`${corrosion}/devices`, data);
// 获取设备列表 完整信息
export const getDevicesAll = (params = { deviceId: '', page: 1, size: 50 }) => http.get(`${corrosion}/devices/all`, { params });
export const getDevicesAll = (
params = {
deviceId: '',
page: 1,
size: 50,
},
) => http.get(`${corrosion}/devices/all`, { params });
// 更新设备
export const updateDevice = (deviceId, data) => http.put(`${corrosion}/devices/all/${deviceId}`, data);
@ -43,8 +51,20 @@ export const createConfigNetwork = data => http.post(`${corrosion}/config/networ
// 提交功能配置参数
export const createConfigFunction = data => http.post(`${corrosion}/config/function`, data);
// 查上报数据
export const getDatas = params => http.post(`${corrosion}/datas`, params);
// 导出上报数据
export const exportDatas = params => http.post(`${corrosion}/export`, params);
// 查历史数据
export const getHistories = params => http.post(`${corrosion}/datas`, params);
export const getHistory = params => http.post(`${corrosion}/history/datas`, params);
// 导出历史数据
export const exportHistory = params => http.post(`${corrosion}/export`, params);
export const exportHistory = params => http.post(`${corrosion}/history/export`, params);
// 发送查询历史记录的指令
export const sendCommand = params => http.post(`${corrosion}/history`, params);
// 查询下发指令状态
export const getCommansStatus = params => http.get(`${corrosion}/history`, { params });

0
src/components/history-data.vue → src/components/data-report.vue

45
src/components/search-bar-data.vue

@ -1,22 +1,30 @@
<template>
<el-form :inline="true" :model="searchDevice" ref="searchDeviceForm">
<el-form ref="searchDeviceForm" :inline="true" :model="searchDevice">
<el-form-item label="选择站点">
<el-select v-model="searchDevice.deviceId" placeholder="请选择站点" @change="change">
<!-- <el-option label="全部" value></el-option> -->
<el-option :label="item.address" :value="item.deviceId" v-for="item in devices" :key="item.deviceId"></el-option>
<el-option v-for="item in devices" :key="item.deviceId" :label="item.address" :value="item.deviceId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="选择日期">
<el-date-picker
v-model="searchDevice.date"
type="daterange"
end-placeholder="结束日期"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
type="daterange"
></el-date-picker>
</el-form-item>
<el-form-item v-if="showTypeSelect" label="类型">
<el-select v-model="searchDevice.dataType" placeholder="选择查询类型">
<el-option label="全部" value=""></el-option>
<el-option label="事件上报" value="ReportHistoryEvent"></el-option>
<el-option label="业务上报" value="ReportHistoryData"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
</el-form-item>
@ -28,19 +36,26 @@
</template>
<script setup>
import { reactive, ref, computed, defineProps, defineEmits, watch } from 'vue';
import { computed, defineEmits, defineProps, reactive, ref, watch } from 'vue';
import { useStore } from 'vuex';
import dayjs from 'dayjs';
import { exportHistory } from 'apis/index';
import { exportHistory } from 'apis';
const emit = defineEmits(['search']);
const searchDevice = reactive({ deviceId: '', date: [new Date(), new Date()] });
const searchDevice = reactive({
deviceId: '',
date: [new Date(), new Date()],
dataType: 'ReportHistoryData',
});
const searchDeviceForm = ref(null); // form
const store = useStore();
const devices = computed(() => store.state.device.devices);
const currentDeviceId = computed(() => store.state.device.currentDeviceId); // id
defineProps({ showExport: Boolean });
defineProps({
showExport: Boolean,
showTypeSelect: Boolean,
});
// currentDeviceId
watch(
@ -59,14 +74,22 @@ const change = e => {
//
function generateParams() {
const { deviceId, date } = searchDevice;
let params = { deviceId, date };
const { deviceId, date, dataType } = searchDevice;
let params = {
deviceId,
date,
dataType,
};
if (date) {
const start = +dayjs(date[0]).format('x');
const end = +dayjs(date[1]).format('x');
const daterange = [start, end];
params = { deviceId, date: daterange };
params = {
deviceId,
date: daterange,
dataType,
};
}
return params;

68
src/components/search-commands.vue

@ -0,0 +1,68 @@
<template>
<el-form ref="searchDeviceForm" :inline="true" :model="searchDevice">
<el-form-item label="选择站点">
<el-select v-model="searchDevice.deviceId" placeholder="请选择站点" @change="change">
<!-- <el-option label="全部" value></el-option> -->
<el-option v-for="item in devices" :key="item.deviceId" :label="item.address" :value="item.deviceId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="类型">
<el-select v-model="searchDevice.type" placeholder="选择查询类型">
<el-option label="全部" value=""></el-option>
<el-option label="事件上报" value="EVENT"></el-option>
<el-option label="业务上报" value="DATA"></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="searchDevice.status" placeholder="选择查询类型">
<el-option label="全部" value=""></el-option>
<el-option label="PENDING" value="PENDING"></el-option>
<el-option label="SUCCESS" value="SUCCESS"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
</el-form-item>
</el-form>
</template>
<script setup>
import { computed, defineEmits, reactive, ref, watch } from 'vue';
import { useStore } from 'vuex';
const emit = defineEmits(['search']);
const searchDevice = reactive({
deviceId: '',
type: '',
status: '',
});
const searchDeviceForm = ref(null); // form
const store = useStore();
const devices = computed(() => store.state.device.devices);
const currentDeviceId = computed(() => store.state.device.currentDeviceId); // id
// currentDeviceId
watch(
() => currentDeviceId.value,
newValue => {
if (newValue) {
searchDevice.deviceId !== newValue && (searchDevice.deviceId = newValue);
}
},
{ immediate: true },
);
const change = e => {
store.commit('device/setCurrentDeviceId', e);
};
//
const onSubmit = () => {
searchDeviceForm.value.validate(() => {
emit('search', { ...searchDevice });
});
};
</script>

26
src/config/config.js

@ -1,3 +1,4 @@
// 网络参数设置
export const networkConfig = {
ip1: '',
port1: '',
@ -13,6 +14,7 @@ export const networkConfig = {
status: '',
};
// 功能参数设置
export const functionConfig = {
frequency: {
so2: 0, // SO2采样频率
@ -41,9 +43,33 @@ export const functionConfig = {
status: '',
};
// 金属腐蚀类型
export const corrosiveTypes = [
{ value: 'XIN', type: '锌' },
{ value: 'LV', type: '铝' },
{ value: 'TONG', type: '铜' },
{ value: 'GANG', type: '钢' },
];
// 添加设备
export const deviceData = {
deviceId: '', // 设备id
deviceFullId: '', // 设备完整id
deviceDirection: '', // 设备朝向
area: '', // 地区
address: '', // 安装地点名称
contact: '', // 联系人
phone: '', // 联系人电话
lon: '', // 经度
lat: '', // 纬度
head: '', // 负责人
installLocation: '', // 安装位置
installTime: '', // 安装时间
runTime: '', // 正式运行时间
linkAddress: '', // 链路地址
probNo: '', // 探头编号
simple: '', // 试样
sim1: '', // sim卡1
joint: '', // 主站后台联调情况
remark: '', // 备注
};

53
src/routers/index.js

@ -39,32 +39,59 @@ export const routes = [
component: () => import('@/views/device-create.vue'),
},
{
path: '/corrosion/data-history',
name: 'data-history',
path: '/corrosion/statistical-realtime',
name: 'statistical-realtime',
meta: {
title: '历史数据查看',
title: '实时数据统计',
icon: 'el-icon-time',
},
component: () => import('@/views/statistical-realtime.vue'),
},
{
path: '/corrosion/data-report',
name: 'data-report',
meta: {
title: '上报数据查看',
icon: 'el-icon-document-copy',
},
component: () => import('@/views/data-history.vue'),
component: () => import('@/views/data-report.vue'),
},
{
path: '/corrosion/statistical-history',
name: 'statistical-history',
path: '/corrosion/statistical-report',
name: 'statistical-report',
meta: {
title: '历史数据统计',
title: '上报数据统计',
icon: 'el-icon-data-line',
},
component: () => import('@/views/statistical-history.vue'),
component: () => import('@/views/statistical-report.vue'),
},
{
path: '/corrosion/statistical-realtime',
name: 'statistical-realtime',
path: '/corrosion/data-history',
name: 'data-history',
meta: {
title: '实时数据统计',
icon: 'el-icon-time',
title: '历史数据查看',
icon: 'el-icon-document-copy',
},
component: () => import('@/views/statistical-realtime.vue'),
component: () => import('@/views/data-history.vue'),
},
{
path: '/corrosion/commands',
name: 'commands',
meta: {
title: '指令下发状态',
icon: 'el-icon-document-copy',
},
component: () => import('@/views/commands.vue'),
},
// {
// path: '/corrosion/statistical-history',
// name: 'statistical-history',
// meta: {
// title: '历史数据统计',
// icon: 'el-icon-data-line',
// },
// component: () => import('@/views/statistical-history.vue'),
// },
// {
// path: '/corrosion/months',
// name: 'months',

4
src/store/statistics.js

@ -1,4 +1,4 @@
import { getHistories, getMonthsDate } from 'apis/index';
import { getDatas, getMonthsDate } from 'apis/index';
export default {
namespaced: true,
@ -67,7 +67,7 @@ export default {
// 获取实时数据统计数据
async getRealtimeData({ commit }, params) {
try {
const data = await getHistories(params);
const data = await getDatas(params);
commit('setRealtimeData', data || null);
return data;
} catch (error) {

105
src/views/commands.vue

@ -0,0 +1,105 @@
<template>
<SearchCommands @search="onSearch" />
<template v-if="data">
<el-table :data="data" :style="{ 'max-height': contentHeight + 'px' }" border stripe style="width: 100%">
<el-table-column align="center" fixed label="设备ID" min-width="140" prop="deviceId" />
<el-table-column align="center" label="类型" min-width="100">
<template #default="scope">
{{ computeType(scope.row.type) }}
</template>
</el-table-column>
<el-table-column align="center" label="状态" min-width="100">
<template #default="scope">
<el-tag :type="computeStatus(scope.row.status)">{{ scope.row.status }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="起始时间" min-width="200">
<template #default="scope">
{{ formatDate(+scope.row.startTime) }}
</template>
</el-table-column>
<el-table-column align="center" label="截止时间" min-width="200">
<template #default="scope">
{{ formatDate(+scope.row.endTime) }}
</template>
</el-table-column>
</el-table>
</template>
</template>
<script setup>
import SearchCommands from 'components/search-commands.vue';
import { getCommansStatus } from 'apis';
import { onMounted, ref } from 'vue';
import { ElMessage } from 'element-plus';
import dayjs from 'dayjs';
const data = ref([]);
let contentHeight = 600;
//
onMounted(() => {
const winHeight = document.documentElement.clientHeight;
contentHeight = winHeight - 150;
});
/**
* 查询
* @param {object} options
* @returns {Promise<void>}
*/
async function onSearch(options) {
try {
data.value = await getCommansStatus(options);
} catch (error) {
ElMessage.error('查询失败');
throw new Error(error);
}
}
/**
* 计算状态
* @param {string} status
* @returns {string}
*/
function computeStatus(status) {
let statusStyle = 'success';
switch (status) {
case 'PENDING':
statusStyle = 'primary';
break;
case 'FAIL':
statusStyle = 'danger';
break;
case 'SUCCESS':
statusStyle = 'success';
break;
default:
statusStyle = 'primary';
break;
}
return statusStyle;
}
/**
* 转换类型
* @param {string} type
* @returns {string}
*/
function computeType(type) {
return type === 'DATA' ? '业务' : '事件';
}
/**
* 格式化时间为日期格式
* @param {number} time
* @returns {string}
*/
function formatDate(time) {
try {
return dayjs(time).format('YYYY-MM-DD');
} catch (error) {
return '';
}
}
</script>

89
src/views/data-history.vue

@ -2,11 +2,14 @@
import { computed, onMounted, ref } from 'vue';
import { useStore } from 'vuex';
import SearchBar from 'components/search-bar-data.vue';
import { getHistories } from 'apis/index';
import { getHistory, sendCommand } from 'apis';
import { ElMessage } from 'element-plus';
const search = ref({});
const page = ref({ page: 1, size: 50 });
const page = ref({
page: 1,
size: 50,
});
let timer = null;
const store = useStore();
const token = computed(() => store.getters['user/token']);
@ -30,11 +33,12 @@ const getData = async () => {
const params = {
deviceId: currentDeviceId.value,
date,
dataType: options.dataType,
page: page.value.age,
size: page.value.size,
type: 1,
};
const resData = await getHistories(params);
const resData = await getHistory(params);
data.value = resData.data;
page.value = resData.page;
timer && clearTimeout(timer);
@ -91,43 +95,74 @@ const onPrev = e => {
page.value.page = e - 1;
getData();
};
/**
* 发送查询指令
* @param {string} dataType ('data', 'event')
*/
async function onSend(dataType) {
try {
const { date, deviceId } = search.value;
const params = {
deviceId,
type: dataType,
};
// eslint-disable-next-line prefer-destructuring
date && date[0] && (params.startTime = date[0]);
// eslint-disable-next-line prefer-destructuring
date && date[1] && (params.endTime = date[1]);
await sendCommand(params);
ElMessage.success('指令发送成功');
} catch (e) {
ElMessage.error('指令发送失败');
}
}
</script>
<template>
<SearchBar @search="onSearch" :show-export="true" />
<SearchBar :show-export="true" :show-type-select="true" @search="onSearch" />
<el-row class="mb-4">
<el-button type="primary" @click="onSend('DATA')">发送查询指令(历史数据)</el-button>
<el-button type="primary" @click="onSend('EVENT')">发送查询指令(历史事件)</el-button>
</el-row>
<template v-if="data">
<el-table :data="data" style="width: 100%" border stripe :style="{ 'max-height': contentHeight + 'px' }">
<el-table-column label="设备编号" fixed prop="deviceNo" min-width="140" align="center" />
<el-table-column label="ICCID" prop="iccid" min-width="100" align="center" />
<el-table-column label="IMEI" prop="imei" min-width="80" align="center" />
<el-table-column label="信号强度" prop="signal" min-width="80" align="center" />
<el-table-column label="基站编号" prop="stationNo" min-width="80" align="center" />
<el-table-column label="版本号" prop="version" min-width="80" align="center" />
<el-table-column label="太阳能电压" prop="solarVoltage" min-width="94" align="center" />
<el-table-column label="蓄电池电压" prop="batteryVoltage" min-width="94" align="center" />
<el-table-column label="机箱温度" prop="deviceTemperature" min-width="80" align="center" />
<el-table-column label="机箱湿度" prop="deviceHumidity" min-width="80" align="center" />
<el-table-column label="环境温度" prop="environmentTemperature" min-width="80" align="center" />
<el-table-column label="环境湿度" prop="environmentHumidity" min-width="80" align="center" />
<el-table-column label="SO2" prop="so2" min-width="50" align="center" />
<el-table-column label="盐分" prop="salt" min-width="50" align="center" />
<el-table-column label="腐流1" prop="corrosion1" min-width="60" align="center" />
<el-table-column label="腐流2" prop="corrosion2" min-width="60" align="center" />
<el-table-column label="腐流3" prop="corrosion3" min-width="60" align="center" />
<el-table-column label="腐流4" prop="corrosion4" min-width="60" align="center" />
<el-table :data="data" :style="{ 'max-height': contentHeight + 'px' }" border stripe style="width: 100%">
<el-table-column align="center" fixed label="设备编号" min-width="140" prop="deviceNo" />
<el-table-column align="center" label="ICCID" min-width="100" prop="iccid" />
<el-table-column align="center" label="IMEI" min-width="80" prop="imei" />
<el-table-column align="center" label="信号强度" min-width="80" prop="signal" />
<el-table-column align="center" label="基站编号" min-width="80" prop="stationNo" />
<el-table-column align="center" label="硬件版本" min-width="80" prop="hardwareVersion" />
<el-table-column align="center" label="软件版本" min-width="80" prop="softwareVersion" />
<el-table-column align="center" label="太阳能电压" min-width="94" prop="solarVoltage" />
<el-table-column align="center" label="蓄电池电压" min-width="94" prop="batteryVoltage" />
<el-table-column align="center" label="电压百分比" min-width="94" prop="batteryVoltagePercentage" />
<el-table-column align="center" label="剩余电量" min-width="94" prop="batteryVoltageRemain" />
<el-table-column align="center" label="电池损耗量" min-width="94" prop="batteryLoss" />
<el-table-column align="center" label="机箱温度" min-width="80" prop="deviceTemperature" />
<el-table-column align="center" label="机箱湿度" min-width="80" prop="deviceHumidity" />
<el-table-column align="center" label="环境温度" min-width="80" prop="environmentTemperature" />
<el-table-column align="center" label="环境湿度" min-width="80" prop="environmentHumidity" />
<el-table-column align="center" label="SO2" min-width="50" prop="so2" />
<el-table-column align="center" label="盐分" min-width="50" prop="salt" />
<el-table-column align="center" label="腐流1" min-width="60" prop="corrosion1" />
<el-table-column align="center" label="腐流2" min-width="60" prop="corrosion2" />
<el-table-column align="center" label="腐流3" min-width="60" prop="corrosion3" />
<el-table-column align="center" label="腐流4" min-width="60" prop="corrosion4" />
</el-table>
<el-pagination
background
:current-page="page.page"
:page-size="page.size"
:default-page-size="50"
:page-count="page.count"
layout="total, sizes, prev, pager, next, jumper"
:page-size="page.size"
:page-sizes="[1, 10, 20, 50, 100]"
class="my-3 float-right"
:total="page.total"
background
class="my-3 float-right"
layout="total, sizes, prev, pager, next, jumper"
@current-change="onCurrentPageChange"
@size-change="onSizeChange"
@prev-click="onPrev"

145
src/views/data-report.vue

@ -0,0 +1,145 @@
<script setup>
import { computed, onMounted, ref } from 'vue';
import { useStore } from 'vuex';
import SearchBar from 'components/search-bar-data.vue';
import { getDatas } from 'apis/index';
import { ElMessage } from 'element-plus';
const search = ref({});
const page = ref({
page: 1,
size: 50,
});
let timer = null;
const store = useStore();
const token = computed(() => store.getters['user/token']);
const currentDeviceId = computed(() => store.state.device.currentDeviceId); // id
let contentHeight = 600;
const data = ref(null);
//
const getData = async () => {
try {
if (token && token.value) {
if (!currentDeviceId.value) {
return ElMessage.error('请选择站点');
}
const options = { ...search.value };
const date = options && options.date ? options.date : [];
if (!date || date.length !== 2) {
return ElMessage.error('请选择时间 ');
}
const params = {
deviceId: currentDeviceId.value,
date,
page: page.value.age,
size: page.value.size,
type: 1,
};
const resData = await getDatas(params);
data.value = resData.data;
page.value = resData.page;
timer && clearTimeout(timer);
timer = null;
} else {
timer = setTimeout(() => {
getData();
}, 20);
}
} catch (error) {
ElMessage.error(error.message || '获取数据失败');
console.log('error: ', error);
}
};
// getData();
//
onMounted(() => {
const winHeight = document.documentElement.clientHeight;
contentHeight = winHeight - 150;
});
/**
* 监听sear h信息
* @param {object} payload search组件emi 的数据
*/
const onSearch = payload => {
search.value = { ...payload };
getData();
};
/**
* 当前 码变化
* 更新page 重新 取数据
* @param {number} e 的页码
*/
const onCurrentPageChange = e => {
page.value.page = e;
getData();
};
const onSizeChange = e => {
page.value.size = e;
getData();
};
//
const onNext = e => {
page.value.page = e + 1;
getData();
};
//
const onPrev = e => {
page.value.page = e - 1;
getData();
};
</script>
<template>
<SearchBar :show-export="true" @search="onSearch" />
<template v-if="data">
<el-table :data="data" :style="{ 'max-height': contentHeight + 'px' }" border stripe style="width: 100%">
<el-table-column align="center" fixed label="设备编号" min-width="140" prop="deviceNo" />
<el-table-column align="center" label="ICCID" min-width="100" prop="iccid" />
<el-table-column align="center" label="IMEI" min-width="80" prop="imei" />
<el-table-column align="center" label="信号强度" min-width="80" prop="signal" />
<el-table-column align="center" label="基站编号" min-width="80" prop="stationNo" />
<el-table-column align="center" label="硬件版本" min-width="80" prop="hardwareVersion" />
<el-table-column align="center" label="软件版本" min-width="80" prop="softwareVersion" />
<el-table-column align="center" label="太阳能电压" min-width="94" prop="solarVoltage" />
<el-table-column align="center" label="蓄电池电压" min-width="94" prop="batteryVoltage" />
<el-table-column align="center" label="电压百分比" min-width="94" prop="batteryVoltagePercentage" />
<el-table-column align="center" label="剩余电量" min-width="94" prop="batteryVoltageRemain" />
<el-table-column align="center" label="电池损耗量" min-width="94" prop="batteryLoss" />
<el-table-column align="center" label="机箱温度" min-width="80" prop="deviceTemperature" />
<el-table-column align="center" label="机箱湿度" min-width="80" prop="deviceHumidity" />
<el-table-column align="center" label="环境温度" min-width="80" prop="environmentTemperature" />
<el-table-column align="center" label="环境湿度" min-width="80" prop="environmentHumidity" />
<el-table-column align="center" label="SO2" min-width="50" prop="so2" />
<el-table-column align="center" label="盐分" min-width="50" prop="salt" />
<el-table-column align="center" label="腐流1" min-width="60" prop="corrosion1" />
<el-table-column align="center" label="腐流2" min-width="60" prop="corrosion2" />
<el-table-column align="center" label="腐流3" min-width="60" prop="corrosion3" />
<el-table-column align="center" label="腐流4" min-width="60" prop="corrosion4" />
</el-table>
<el-pagination
:current-page="page.page"
:default-page-size="50"
:page-count="page.count"
:page-size="page.size"
:page-sizes="[1, 10, 20, 50, 100]"
:total="page.total"
background
class="my-3 float-right"
layout="total, sizes, prev, pager, next, jumper"
@current-change="onCurrentPageChange"
@size-change="onSizeChange"
@prev-click="onPrev"
@next-click="onNext"
></el-pagination>
</template>
</template>

27
src/views/device-edit.vue

@ -121,30 +121,11 @@
<script setup>
import { reactive, ref, computed, watch, defineEmits } from 'vue';
import { useStore } from 'vuex';
import { updateDevice } from 'apis/index';
import { updateDevice } from 'apis';
import { ElMessage } from 'element-plus';
import { deviceData } from '@/config/config';
let data = reactive({
deviceId: '', // id
deviceFullId: '', // id
deviceDirection: '', //
area: '', //
address: '', //
contact: '', //
phone: '', //
lon: '', //
lat: '', //
head: '', //
installLocation: '', //
installTime: '', //
runTime: '', //
linkAddress: '', //
probNo: '', //
simple: '', //
sim1: '', // sim1
joint: '', //
remark: '', //
});
let data = reactive(deviceData);
const deviceEdit = ref(null); // form
const store = useStore();
@ -175,7 +156,7 @@ const onSubmit = () => {
ElMessage.success('更新成功');
emit('cancel');
store.commit('device/updateDevice', data);
store.dispatch('device/getDevices'); //
await store.dispatch('device/getDevices'); //
} catch (error) {
ElMessage.error('更新失败, 请稍后重试');
throw new Error(error);

8
src/views/device-list.vue

@ -41,12 +41,12 @@
<i class="el-icon-stopwatch text-base text-green-600 mx-1" @click="openPage(props.row, 'statistical-realtime')"></i>
</el-tooltip>
<el-tooltip class="item" content="数据查看及导出" effect="dark" placement="top">
<i class="el-icon-tickets text-base text-green-600 mx-1" @click="openPage(props.row, 'data-history')"></i>
<i class="el-icon-tickets text-base text-green-600 mx-1" @click="openPage(props.row, 'data-report')"></i>
</el-tooltip>
<el-tooltip class="item" content="数据统计" effect="dark" placement="top">
<i class="el-icon-data-line text-base text-green-600 mx-1" @click="openPage(props.row, 'statistical-history')"></i>
<i class="el-icon-data-line text-base text-green-600 mx-1" @click="openPage(props.row, 'statistical-report')"></i>
</el-tooltip>
<el-popconfirm title="确定要删除此设备吗?" @confirm="handleDelete(props.ro.deviceId)">
<el-popconfirm title="确定要删除此设备吗?" @confirm="handleDelete(props.row.deviceId)">
<template #reference>
<i class="el-icon-delete text-base text-red-600 mx-1"></i>
<!-- <el-button type="text" plain size="mini" icon="el-icon-delete"></el-button> -->
@ -54,7 +54,7 @@
</el-popconfirm>
<el-tooltip class="item" content="编辑设备信息" effect="dark" placement="top">
<i class="el-icon-edit text-base text-blue-600 mx-1" @click="handleEdit(rops.row)"></i>
<i class="el-icon-edit text-base text-blue-600 mx-1" @click="handleEdit(props.row)"></i>
</el-tooltip>
</template>
</el-table-column>

2
src/views/statistical-history.vue → src/views/statistical-report.vue

@ -5,7 +5,7 @@
<script setup>
import SearchBar from 'components/search-bar-data.vue';
import HistoryData from 'components/history-data.vue';
import HistoryData from 'components/data-report.vue';
import { computed, ref } from 'vue';
import { useStore } from 'vuex';
Loading…
Cancel
Save