1.新增历史记录查询类型搜索选项

This commit is contained in:
15133876896-BGG25 2023-06-08 16:15:41 +08:00
parent 7a9efc72a8
commit 05f7321cc2
2 changed files with 115 additions and 33 deletions

View File

@ -10,31 +10,50 @@
<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>
<div style="margin-bottom: 20px;"> <div style="margin-bottom: 20px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="15"> <el-col :span="13">
<span style="margin-right: 10px;">日期</span> <span style="margin-right: 10px">日期</span>
<el-date-picker <el-date-picker
v-model="selectTime" v-model="selectTime"
type="datetimerange" type="datetimerange"
:shortcuts="shortcuts" :shortcuts="shortcuts"
range-separator="至" range-separator="至"
format="YYYY/MM/DD HH:mm:ss" format="YYYY/MM/DD HH:mm:ss"
start-placeholder="开始时间" start-placeholder="开始时间"
end-placeholder="结束时间" end-placeholder="结束时间"
/> />
</el-col> </el-col>
<el-col :span="6"> <el-col :span="7">
<span style="margin-right: 10px">类型</span>
</el-col> <el-select v-model="searchConfig.alarmType" clearable placeholder="请选择报警类型">
</el-row> <el-option
<el-row :gutter="20"> v-for="item in alarmTypeOptions"
<el-col :span="18"> :key="item.value"
</el-col> :label="item.label"
<el-col :span="6"> :value="item.value"
<el-button type="primary" plain @click="searchpartData">搜索</el-button> />
</el-col> </el-select>
</el-row> </el-col>
<el-col :span="2">
<el-button type="primary" plain @click="searchpartData"
>搜索</el-button
>
</el-col>
<el-col :span="2">
<el-button type="primary" plain @click="searchpartReset"
>重置</el-button
>
</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 <el-table
@ -103,6 +122,7 @@ const props = defineProps({
}); });
// //
const searchConfig = reactive({ const searchConfig = reactive({
alarmType:'',
type: props.type, type: props.type,
startTime: "", startTime: "",
endTime: "", endTime: "",
@ -113,6 +133,57 @@ const selectTime = ref("");
let small = ref(false); let small = ref(false);
let disabled = ref(false); let disabled = ref(false);
let background = ref(false); let background = ref(false);
//
const alarmTypeOptions = [
{
value: 'pm25',
label: '粉尘pm2.5超标报警',
},
{
value: 'pm10',
label: '粉尘pm10超标报警',
},
{
value: 'flame',
label: '明火报警',
},
{
value: 'TVOC',
label: 'tvoc报警',
},
{
value: 'CH2O',
label: 'CH2O甲醛报警',
},
{
value: 'smoke',
label: '烟雾报警',
},
{
value: 'methane',
label: '燃气报警',
},
{
value: 'pressure',
label: '管道压力报警',
},
{
value: 'noise',
label: '噪音报警',
},
{
value: 'huim',
label: '湿度报警',
},
{
value: 'temp',
label: '温度报警',
},
{
value: 'offline',
label: '离线提醒',
},
]
const emits = defineEmits(["update:dialogTableVisible", "getDialogdatafun"]); const emits = defineEmits(["update:dialogTableVisible", "getDialogdatafun"]);
const is_Show = computed({ const is_Show = computed({
get: () => props.dialogTableVisible, get: () => props.dialogTableVisible,
@ -126,12 +197,14 @@ computed({
searchConfig.type = val; searchConfig.type = val;
}, },
}); });
watch(()=>props.type,
(newVal, oldVal)=>{
searchConfig.type=newVal
}, { immediate: true, deep: true })
watch( watch(
() => selectTime, () => selectTime,
(newVal, oldVal) => { (newVal, oldVal) => {
// //
console.log(newVal.value);
if (newVal.value) { if (newVal.value) {
searchConfig.startTime = gettime(newVal.value[0], 2); searchConfig.startTime = gettime(newVal.value[0], 2);
searchConfig.endTime = gettime(newVal.value[1], 2); searchConfig.endTime = gettime(newVal.value[1], 2);
@ -182,7 +255,20 @@ const shortcuts = [
}, },
}, },
]; ];
function searchpartData(){ //
function searchpartData() {
console.log(searchConfig,'search');
emits("getDialogdatafun", searchConfig);
}
//
function searchpartReset(){
searchConfig.alarmType=''
selectTime.value=''
//startTimeendTime
searchConfig.startTime = null;
searchConfig.endTime = null;
console.log(searchConfig,'reset');
emits("getDialogdatafun", searchConfig); emits("getDialogdatafun", searchConfig);
} }
onMounted(() => {}); onMounted(() => {});

View File

@ -235,7 +235,6 @@ 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 getAlarmListHistoryData(config); let result: any = await getAlarmListHistoryData(config);
@ -250,9 +249,6 @@ async function getDialogdatafun(config) {
} }
}, 0); }, 0);
} }
console.log(dialogdata);
} }
// //
watch( watch(