Merge branch 'master' of https://codeup.aliyun.com/645deca397d94d909e439238/iotplatform_sourcecode/screenFront
This commit is contained in:
commit
9b53b17d86
@ -10,88 +10,186 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-dialog v-model="is_Show" title="历史报警记录" ref="" destroy-on-close>
|
<el-dialog v-model="is_Show" title="历史报警记录" ref="" destroy-on-close>
|
||||||
<el-table :data="tableData" v-loading="dialogLoading" size="large" max-height="600px" stripe>
|
<div style="margin-bottom: 20px;">
|
||||||
<el-table-column type="index" :index="indexMethod" label="序号" min-width="10px" header-align="center" align="center"/>
|
<el-row :gutter="20">
|
||||||
<el-table-column property="context" label="报警详情" header-align="center"/>
|
<el-col :span="15">
|
||||||
</el-table>
|
<span style="margin-right: 10px;">日期:</span>
|
||||||
<div class=" pagination-class">
|
<el-date-picker
|
||||||
<el-pagination
|
v-model="selectTime"
|
||||||
v-model:current-page="searchConfig.pageNum"
|
type="datetimerange"
|
||||||
v-model:page-size="searchConfig.pageSize"
|
:shortcuts="shortcuts"
|
||||||
:page-sizes="[5, 10, 50, 100]"
|
range-separator="至"
|
||||||
:small="small"
|
format="YYYY/MM/DD HH:mm:ss"
|
||||||
:disabled="disabled"
|
start-placeholder="开始时间"
|
||||||
:background="background"
|
end-placeholder="结束时间"
|
||||||
layout=" prev, pager, next, jumper,sizes"
|
/>
|
||||||
:total="searchConfig.total"
|
</el-col>
|
||||||
@size-change="handleSizeChange"
|
<el-col :span="6">
|
||||||
@current-change="handleCurrentChange"
|
|
||||||
/>
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="18">
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-button type="primary" plain @click="searchpartData">搜索</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
v-loading="dialogLoading"
|
||||||
|
size="large"
|
||||||
|
max-height="600px"
|
||||||
|
stripe
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
type="index"
|
||||||
|
:index="(searchConfig.pageNum - 1) * searchConfig.pageSize + 1"
|
||||||
|
label="序号"
|
||||||
|
min-width="10px"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
property="context"
|
||||||
|
label="报警详情"
|
||||||
|
header-align="center"
|
||||||
|
/>
|
||||||
|
</el-table>
|
||||||
|
<div class="pagination-class">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="searchConfig.pageNum"
|
||||||
|
v-model:page-size="searchConfig.pageSize"
|
||||||
|
:page-sizes="[5, 10, 50, 100]"
|
||||||
|
:small="small"
|
||||||
|
:disabled="disabled"
|
||||||
|
:background="background"
|
||||||
|
layout=" prev, pager, next, jumper,sizes"
|
||||||
|
:total="props.total"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, reactive, ref } from "vue";
|
import { computed, onMounted, reactive, ref, watch } from "vue";
|
||||||
|
import { gettime } from "@/utils/time";
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
tableData: {
|
tableData: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
dialogTableVisible:{
|
dialogTableVisible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
dialogLoading:{
|
dialogLoading: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
type:{
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: "",
|
||||||
},
|
},
|
||||||
total:{
|
total: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
//总页数、每页数量、当前页
|
//总页数、每页数量、当前页
|
||||||
const searchConfig = reactive({
|
const searchConfig = reactive({
|
||||||
type:props.type,
|
type: props.type,
|
||||||
total:props.total,
|
startTime: "",
|
||||||
pageSize:10,
|
endTime: "",
|
||||||
pageNum:1
|
pageSize: 10,
|
||||||
})
|
pageNum: 1,
|
||||||
let small=ref(false)
|
});
|
||||||
let disabled=ref(false)
|
const selectTime = ref("");
|
||||||
let background=ref(false)
|
let small = ref(false);
|
||||||
const emits = defineEmits(["update:dialogTableVisible",'getDialogdatafun']);
|
let disabled = ref(false);
|
||||||
const indexMethod = (index: number) => {
|
let background = ref(false);
|
||||||
return index + 1
|
const emits = defineEmits(["update:dialogTableVisible", "getDialogdatafun"]);
|
||||||
}
|
|
||||||
const is_Show = computed({
|
const is_Show = computed({
|
||||||
get: () => props.dialogTableVisible,
|
get: () => props.dialogTableVisible,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
emits("update:dialogTableVisible", val);
|
emits("update:dialogTableVisible", val);
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
const handleSizeChange = (val: number) => {
|
computed({
|
||||||
searchConfig.pageSize=val
|
get: () => props.type,
|
||||||
emits("getDialogdatafun", searchConfig);
|
set: (val) => {
|
||||||
}
|
searchConfig.type = val;
|
||||||
const handleCurrentChange = (val: number) => {
|
},
|
||||||
searchConfig.pageNum=val
|
});
|
||||||
emits("getDialogdatafun", searchConfig);
|
watch(
|
||||||
}
|
() => selectTime,
|
||||||
onMounted(() => {
|
(newVal, oldVal) => {
|
||||||
|
//监听父组件宽高变化,随时重置本组件尺寸
|
||||||
|
console.log(newVal.value);
|
||||||
|
|
||||||
|
if (newVal.value) {
|
||||||
|
searchConfig.startTime = gettime(newVal.value[0], 2);
|
||||||
|
searchConfig.endTime = gettime(newVal.value[1], 2);
|
||||||
|
} else {
|
||||||
|
searchConfig.startTime = null;
|
||||||
|
searchConfig.endTime = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true, deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleSizeChange = (val: number) => {
|
||||||
})
|
searchConfig.pageSize = val;
|
||||||
|
|
||||||
|
emits("getDialogdatafun", searchConfig);
|
||||||
|
};
|
||||||
|
const handleCurrentChange = (val: number) => {
|
||||||
|
searchConfig.pageNum = val;
|
||||||
|
emits("getDialogdatafun", searchConfig);
|
||||||
|
};
|
||||||
|
|
||||||
|
const shortcuts = [
|
||||||
|
{
|
||||||
|
text: "最近一周",
|
||||||
|
value: () => {
|
||||||
|
const end = new Date();
|
||||||
|
const start = new Date();
|
||||||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
||||||
|
return [start, end];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "最近一个月",
|
||||||
|
value: () => {
|
||||||
|
const end = new Date();
|
||||||
|
const start = new Date();
|
||||||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
||||||
|
return [start, end];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "最近三个月",
|
||||||
|
value: () => {
|
||||||
|
const end = new Date();
|
||||||
|
const start = new Date();
|
||||||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
||||||
|
return [start, end];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
function searchpartData(){
|
||||||
|
emits("getDialogdatafun", searchConfig);
|
||||||
|
}
|
||||||
|
onMounted(() => {});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.pagination-class{
|
.pagination-class {
|
||||||
margin-top: 10px;
|
margin-top: 20px;
|
||||||
}</style>
|
}
|
||||||
|
</style>
|
||||||
|
@ -100,7 +100,7 @@ import useNowTime from "@/hook/nowTime";
|
|||||||
import { ClickOutside as vClickOutside } from "element-plus";
|
import { ClickOutside as vClickOutside } from "element-plus";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { devListType } from "@/type/InPlantProducts";
|
import { devListType } from "@/type/InPlantProducts";
|
||||||
import { getAlarmListData } from "@/http/index";
|
import { getAlarmListData,getAlarmListHistoryData } from "@/http/index";
|
||||||
import {
|
import {
|
||||||
onMounted,
|
onMounted,
|
||||||
onUnmounted,
|
onUnmounted,
|
||||||
@ -132,7 +132,7 @@ let popoverliDom = ref();
|
|||||||
let Abnormalpopovervisible = ref(false);
|
let Abnormalpopovervisible = ref(false);
|
||||||
let AbnormalpopovervisibleCtrl = ref(false); //解决点击历史报警数据弹窗外部关闭再打开问题
|
let AbnormalpopovervisibleCtrl = ref(false); //解决点击历史报警数据弹窗外部关闭再打开问题
|
||||||
//dialog
|
//dialog
|
||||||
let dialogdata = reactive([]);
|
let dialogdata = ref([]);
|
||||||
let dialogTableVisible = ref(false);
|
let dialogTableVisible = ref(false);
|
||||||
let dialogLoading = ref(true);
|
let dialogLoading = ref(true);
|
||||||
let dialogtotal=ref(0)
|
let dialogtotal=ref(0)
|
||||||
@ -224,7 +224,7 @@ function langJudge() {
|
|||||||
}
|
}
|
||||||
function showDialog() {
|
function showDialog() {
|
||||||
if (dialogTableVisible.value == false) {
|
if (dialogTableVisible.value == false) {
|
||||||
dialogdata.length = 0;
|
|
||||||
getDialogdatafun({
|
getDialogdatafun({
|
||||||
type: AbnormalType.type,
|
type: AbnormalType.type,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@ -235,12 +235,13 @@ function showDialog() {
|
|||||||
dialogTableVisible.value = true;
|
dialogTableVisible.value = true;
|
||||||
}
|
}
|
||||||
async function getDialogdatafun(config) {
|
async function getDialogdatafun(config) {
|
||||||
|
// dialogdata.length = 0;
|
||||||
dialogLoading.value = true;
|
dialogLoading.value = true;
|
||||||
let result: any = await getAlarmListData(config);
|
let result: any = await getAlarmListHistoryData(config);
|
||||||
|
|
||||||
if (result.code == 200) {
|
if (result.code == 200) {
|
||||||
dialogtotal.value=result.total
|
dialogtotal.value=result.total
|
||||||
dialogdata.push(...result.rows)
|
dialogdata.value=result.rows
|
||||||
dialogLoading.value = false;
|
dialogLoading.value = false;
|
||||||
}else{
|
}else{
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -249,6 +250,7 @@ async function getDialogdatafun(config) {
|
|||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
console.log(dialogdata);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* @FilePath: \wwwd:\code\screenFront\src\http\index.ts
|
* @FilePath: \code\gitscreenFront\src\http\index.ts
|
||||||
* @Author: 王路平
|
* @Author: 王路平
|
||||||
* @文件版本: V1.0.0
|
* @文件版本: V1.0.0
|
||||||
* @Date: 2023-03-14 11:14:41
|
* @Date: 2023-03-14 11:14:41
|
||||||
@ -12,4 +12,8 @@ import {get,post} from "@/utils/http"
|
|||||||
//报警数据
|
//报警数据
|
||||||
export function getAlarmListData(data:any){
|
export function getAlarmListData(data:any){
|
||||||
return get('/alarm/getAlarmList',data)
|
return get('/alarm/getAlarmList',data)
|
||||||
|
}
|
||||||
|
//报警历史数据查询
|
||||||
|
export function getAlarmListHistoryData(data:any){
|
||||||
|
return get('/alarm/getAlarmListHistory',data)
|
||||||
}
|
}
|
@ -12,6 +12,8 @@ import App from './App.vue'
|
|||||||
import ElementPlus from 'element-plus'
|
import ElementPlus from 'element-plus'
|
||||||
import 'element-plus/dist/index.css'
|
import 'element-plus/dist/index.css'
|
||||||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
import 'element-plus/theme-chalk/dark/css-vars.css'
|
||||||
|
import 'dayjs/locale/zh-cn'
|
||||||
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||||
// import echarts from '@/utils/echarts.js'
|
// import echarts from '@/utils/echarts.js'
|
||||||
import echarts from '@/utils/echarts'
|
import echarts from '@/utils/echarts'
|
||||||
import {createPinia} from 'pinia'
|
import {createPinia} from 'pinia'
|
||||||
@ -26,4 +28,4 @@ const store = createPinia()
|
|||||||
app.config.globalProperties.$echarts = echarts;//vue3的挂载方式
|
app.config.globalProperties.$echarts = echarts;//vue3的挂载方式
|
||||||
app.use(store)
|
app.use(store)
|
||||||
app.use(i18n)
|
app.use(i18n)
|
||||||
app.use(router).use(ElementPlus).use(dataV).mount('#app')
|
app.use(router).use(ElementPlus, {locale: zhCn,}).use(dataV).mount('#app')
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* @FilePath: \daping\src\utils\time.ts
|
* @FilePath: \code\gitscreenFront\src\utils\time.ts
|
||||||
* @Author: 王路平
|
* @Author: 王路平
|
||||||
* @文件版本: V1.0.0
|
* @文件版本: V1.0.0
|
||||||
* @Date: 2023-02-07 13:43:31
|
* @Date: 2023-02-07 13:43:31
|
||||||
@ -9,10 +9,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getStoredLanguage } from "../utils/languageStorage";
|
import { getStoredLanguage } from "../utils/languageStorage";
|
||||||
export function gettime(data = null) {
|
export function gettime(data = null,type = 1) {
|
||||||
var time
|
var time
|
||||||
if (data) {
|
if (data) {
|
||||||
time = new Date(data);
|
data instanceof Date? time=data : time = new Date(data);
|
||||||
} else {
|
} else {
|
||||||
time = new Date();
|
time = new Date();
|
||||||
}
|
}
|
||||||
@ -38,7 +38,14 @@ export function gettime(data = null) {
|
|||||||
if (minutes < 10) minutes = "0" + minutes;
|
if (minutes < 10) minutes = "0" + minutes;
|
||||||
if (seconds < 10) seconds = "0" + seconds;
|
if (seconds < 10) seconds = "0" + seconds;
|
||||||
|
|
||||||
return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds + ' ' + arr[day];
|
if(type==1){
|
||||||
|
return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds + ' ' + arr[day];
|
||||||
|
}else if (type == 2){
|
||||||
|
return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds;
|
||||||
|
}else{
|
||||||
|
return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds + ' ' + arr[day];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
export function clacendTime(endtime, nowtime) {
|
export function clacendTime(endtime, nowtime) {
|
||||||
let newDate = Math.abs(endtime - nowtime)
|
let newDate = Math.abs(endtime - nowtime)
|
||||||
@ -47,4 +54,4 @@ export function clacendTime(endtime, nowtime) {
|
|||||||
var m = Math.floor(newDate / 1000 / 60 % 60)
|
var m = Math.floor(newDate / 1000 / 60 % 60)
|
||||||
var s = Math.floor(newDate / 1000 % 60)
|
var s = Math.floor(newDate / 1000 % 60)
|
||||||
return day + '天' + h + '时' + m + '分' + s + '秒'
|
return day + '天' + h + '时' + m + '分' + s + '秒'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user