Files
admin-sjzx/src/views/pqs/supervise/electricalEnergy/components1/online.vue

221 lines
8.0 KiB
Vue
Raw Normal View History

2024-05-16 14:00:49 +08:00
<template>
<!-- <div>1 监测点信息 发起预告警单 </div> -->
2024-06-18 16:38:33 +08:00
<TableHeader area datePicker nextFlag ref="TableHeaderRef">
2024-05-16 14:00:49 +08:00
<template v-slot:select>
<el-form-item label="超标指标">
2024-06-20 16:54:19 +08:00
<el-select v-model="tableStore.table.params.targetId" clearable placeholder="请选择超标指标">
2024-05-16 14:00:49 +08:00
<el-option v-for="item in exceeded" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
2024-06-20 16:54:19 +08:00
<el-form-item label="预警阈值">
<!-- <el-input v-model="tableStore.table.params.alertThreshold" placeholder="请输入预警阈值" clearable></el-input> -->
<el-input-number
v-model="tableStore.table.params.alertThreshold"
:min="0"
:step="1"
step-strictly
@change="changeAlert"
/>
</el-form-item>
<el-form-item label="告警阈值">
<el-input-number
v-model="tableStore.table.params.alarmThreshold"
:min="0"
:step="1"
step-strictly
@change="changeAlarm"
/>
</el-form-item>
2024-05-16 14:00:49 +08:00
</template>
</TableHeader>
<Table ref="tableRef" />
</template>
<script setup lang="ts">
import { ref, onMounted, provide, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useDictData } from '@/stores/dictData'
2024-06-20 16:54:19 +08:00
2024-06-05 15:08:24 +08:00
import { handleWarningAlarmFlag } from '@/api/process-boot/electricitymanagement'
2024-05-16 14:00:49 +08:00
// Steady_Statis
const dictData = useDictData()
//字典获取超标指标
2024-06-20 16:54:19 +08:00
const exceeded = dictData.getBasicData('Steady_Statis')
2024-05-16 14:00:49 +08:00
const tableRef = ref()
2024-06-20 16:54:19 +08:00
const industry = dictData.getBasicData('Business_Type')
2024-05-16 14:00:49 +08:00
const TableHeaderRef = ref()
const tableStore = new TableStore({
2024-06-20 16:54:19 +08:00
url: '/supervision-boot/onlineMonitor/list',
2024-05-16 14:00:49 +08:00
publicHeight: 65,
method: 'POST',
2024-05-31 09:45:41 +08:00
// isWebPaging:true,
2024-05-16 14:00:49 +08:00
column: [
{
title: '序号',
type: 'seq',
align: 'center',
width: 60,
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
2024-06-20 16:54:19 +08:00
{ field: 'substation', title: '变电站名称' },
{ field: 'lineName', title: '监测点名称' },
{ field: 'deviceName', title: '终端名称' },
{
2024-06-20 16:54:19 +08:00
field: 'businessType',
title: '监测对象类型',
formatter: (row: any) => {
return industry.find((item: any) => item.id == row.cellValue)?.name || '/'
}
},
2024-06-20 16:54:19 +08:00
{ field: 'objectName', title: '监测对象名称' },
{ field: 'dept', title: '负责单位' },
{
2024-06-20 16:54:19 +08:00
field: 'dataResource',
title: '数据来源',
render: 'tag',
custom: {
0: 'primary',
1: 'success'
},
replaceValue: {
0: '系统默认',
1: '自定义'
}
},
2024-06-20 16:54:19 +08:00
{ field: 'overLimitDay', title: '累计超标天数' },
2024-05-16 14:00:49 +08:00
{
title: '操作',
width: '180',
align: 'center',
render: 'buttons',
fixed: 'right',
buttons: [
{
name: 'productSetting',
title: '发起告警单',
type: 'warning',
disabled: row => {
2024-06-20 16:54:19 +08:00
return row.overLimitDay < tableStore.table.params.alarmThreshold
2024-05-16 14:00:49 +08:00
},
icon: 'el-icon-EditPen',
2024-06-20 16:54:19 +08:00
render: 'basicButton',
click: async row => {
// handleWarningAlarmFlag(row).then(res => {
// console.log(res)
// ElMessage.success('发起告警单成功!')
// tableStore.index()
// })
const { value } = await ElMessageBox.prompt('', '整改意见', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputType: 'textarea',
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
inputErrorMessage: '请输入整改意见'
})
handleWarningAlarmFlag({ ...row, reformAdvice: value }).then(res => {
ElMessage.success('发起告警单成功!')
tableStore.index()
})
}
2024-05-16 14:00:49 +08:00
},
{
name: 'edit',
title: '发起预警单',
type: 'primary',
icon: 'el-icon-Open',
disabled: row => {
2024-06-20 16:54:19 +08:00
return row.overLimitDay >= tableStore.table.params.alarmThreshold
2024-05-16 14:00:49 +08:00
},
2024-06-20 16:54:19 +08:00
render: 'basicButton',
click: async row => {
// handleWarningAlarmFlag(row).then(res => {
// console.log(res)
// ElMessage.success('发起预警单成功!')
// tableStore.index()
// })
const { value } = await ElMessageBox.prompt('', '整改意见', {
confirmButtonText: '确定',
cancelButtonText: '取消',
2024-05-16 14:00:49 +08:00
2024-06-20 16:54:19 +08:00
inputType: 'textarea',
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
inputErrorMessage: '请输入整改意见'
})
handleWarningAlarmFlag({ ...row, reformAdvice: value }).then(res => {
ElMessage.success('发起预警单成功!')
tableStore.index()
})
}
2024-05-16 14:00:49 +08:00
}
]
}
],
beforeSearchFun: () => {
2024-06-20 16:54:19 +08:00
tableStore.table.params.deptId = tableStore.table.params.deptIndex
2024-05-16 14:00:49 +08:00
tableStore.table.params.currentPage = tableStore.table.params.pageNum
},
loadCallback: () => {
// tableStore.table.data = [
// {
// orgName: '张家口',
// subName: '110kV马头山风电场',
// lineName: '111口头线',
// voltageScale: '110kV',
// overDay: '20',
// overDays: '10'
// },
// {
// orgName: '张家口',
// subName: '110kV韩家庄风电场',
// lineName: '111缘韩一线',
// voltageScale: '110kV',
// overDay: '20',
// overDays: '16'
// }
// ]
2024-05-16 14:00:49 +08:00
}
})
2024-06-20 16:54:19 +08:00
tableStore.table.params.alertThreshold = 10
2024-05-16 14:00:49 +08:00
2024-06-20 16:54:19 +08:00
tableStore.table.params.alarmThreshold = 15
// tableStore.table.params.targetId = ''
2024-05-16 14:00:49 +08:00
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
2024-06-20 16:54:19 +08:00
const changeAlert = e => {
if (e == null) {
tableStore.table.params.alertThreshold = 10
} else {
if (e > tableStore.table.params.alarmThreshold) {
ElMessage.warning('预警阈值不能大于报警阈值')
tableStore.table.params.alertThreshold = 10
}
}
}
const changeAlarm = e => {
if (e == null) {
tableStore.table.params.alarmThreshold = 15
} else {
if (e < tableStore.table.params.alertThreshold) {
ElMessage.warning('报警阈值不能小于预警阈值')
tableStore.table.params.alarmThreshold = 15
}
}
}
2024-05-16 14:00:49 +08:00
</script>
<style scoped lang="scss"></style>