|
@@ -21,43 +21,29 @@
|
|
<el-table-column label="指标编码" align="left" prop="metricsCode" width="160"/>
|
|
<el-table-column label="指标编码" align="left" prop="metricsCode" width="160"/>
|
|
<el-table-column label="告警-低" align="center" width="80">
|
|
<el-table-column label="告警-低" align="center" width="80">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <span v-if="editRow.indexOf(scope.row.metricsId) === -1">
|
|
|
|
- {{ scope.row.alarmLow }}
|
|
|
|
- </span>
|
|
|
|
- <el-input v-model="scope.row.alarmLow" v-else size="small" @change="checkInput"/>
|
|
|
|
|
|
+ {{ scope.row.alarmLow }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="告警-中" align="center" width="80">
|
|
<el-table-column label="告警-中" align="center" width="80">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <span v-if="editRow.indexOf(scope.row.metricsId) === -1">
|
|
|
|
- {{ scope.row.alarmMid }}
|
|
|
|
- </span>
|
|
|
|
- <el-input v-model="scope.row.alarmMid" v-else size="small" @change="checkInput"/>
|
|
|
|
|
|
+ {{ scope.row.alarmMid }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="告警-高" align="center" width="80">
|
|
<el-table-column label="告警-高" align="center" width="80">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <span v-if="editRow.indexOf(scope.row.metricsId) === -1">
|
|
|
|
- {{ scope.row.alarmHigh }}
|
|
|
|
- </span>
|
|
|
|
- <el-input v-model="scope.row.alarmHigh" v-else size="small" @change="checkInput"/>
|
|
|
|
|
|
+ {{ scope.row.alarmHigh }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="健康事件" align="center" width="80">
|
|
<el-table-column label="健康事件" align="center" width="80">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <span v-if="editRow.indexOf(scope.row.metricsId) === -1">
|
|
|
|
- {{ scope.row.event }}
|
|
|
|
- </span>
|
|
|
|
- <el-input v-model="scope.row.event" v-else size="small" @change="checkInput"/>
|
|
|
|
|
|
+ {{ scope.row.event }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <el-button link type="primary" icon="Edit" @click="handleEdit(scope.row)"
|
|
|
|
- v-if="editRow.indexOf(scope.row.metricsId) === -1">
|
|
|
|
|
|
+ <el-button link type="primary" icon="Edit" @click="handleEdit(scope.row)">
|
|
修改
|
|
修改
|
|
</el-button>
|
|
</el-button>
|
|
- <el-button link type="primary" icon="Check" @click="handleUpdate(scope.row)" v-else>保存</el-button>
|
|
|
|
<el-popconfirm title="确定要删除吗?删除后无法恢复!" @confirm="handleDelete(scope.row)" width="260">
|
|
<el-popconfirm title="确定要删除吗?删除后无法恢复!" @confirm="handleDelete(scope.row)" width="260">
|
|
<template #reference>
|
|
<template #reference>
|
|
<el-button link type="primary" icon="Delete">删除</el-button>
|
|
<el-button link type="primary" icon="Delete">删除</el-button>
|
|
@@ -124,10 +110,13 @@
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
+ <el-dialog title="指标修改" v-model="visible" width="600" append-to-body>
|
|
|
|
+ <edit-indicator :rowsInfo="rowsInfo" ref="eiRef" @close="visible=false" @reload="getSelectData"/>
|
|
|
|
+ </el-dialog>
|
|
</template>
|
|
</template>
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import {addDetailByTplId, delDetail, listDetail, selectDetails, updateDetail} from "@/api/metrics/detail";
|
|
import {addDetailByTplId, delDetail, listDetail, selectDetails, updateDetail} from "@/api/metrics/detail";
|
|
-
|
|
|
|
|
|
+import editIndicator from "./editIndicator.vue";
|
|
const {proxy, emit} = getCurrentInstance();
|
|
const {proxy, emit} = getCurrentInstance();
|
|
|
|
|
|
const listData = ref([]);
|
|
const listData = ref([]);
|
|
@@ -140,39 +129,10 @@ const ids = ref([]);
|
|
const total = ref(0);
|
|
const total = ref(0);
|
|
const adTotal = ref(0);
|
|
const adTotal = ref(0);
|
|
const passValidate = ref(true)
|
|
const passValidate = ref(true)
|
|
|
|
+const visible = ref(false);
|
|
|
|
+const rowsInfo = ref({})
|
|
|
|
|
|
-const checkInput = (range) => {
|
|
|
|
- passValidate.value = validateRange(range)
|
|
|
|
- if (!passValidate.value) {
|
|
|
|
- proxy.$message.error("请输入正确的区间格式!")
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-const validateRange = (range) => {
|
|
|
|
- // 正则表达式匹配各种区间的格式
|
|
|
|
- const regex = /^(\[|\()\s*([0-9]+(\.[0-9]+)?|)\s*,\s*([0-9]+(\.[0-9]+)?|)\s*(\]|\))$/;
|
|
|
|
- const match = range.match(regex);
|
|
|
|
-
|
|
|
|
- if (!match) {
|
|
|
|
- return false; // 如果格式不正确,则返回false
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 提取括号类型和两个数值
|
|
|
|
- const openBracket = match[1];// 开始的括号
|
|
|
|
- const num1Str = match[2]; // 第一个数
|
|
|
|
- const num2Str = match[4]; // 第二个数
|
|
|
|
- const closeBracket = match[7]; // 结束的括号
|
|
|
|
-
|
|
|
|
- let num1 = num1Str ? parseFloat(num1Str) : -Infinity;
|
|
|
|
- let num2 = num2Str ? parseFloat(num2Str) : Infinity;
|
|
|
|
|
|
|
|
- // 检查区间的有效性
|
|
|
|
- if (openBracket === '[' && num1 > num2) return false; // [x,y] 要求 x <= y
|
|
|
|
- if (openBracket === '(' && num1 >= num2) return false; // (x,y) 要求 x < y
|
|
|
|
- if (closeBracket === ']' && num1 > num2) return false; // (x,y] 要求 x < y
|
|
|
|
- if (closeBracket === ')' && num1 >= num2) return false; // [x,y) 要求 x < y
|
|
|
|
-
|
|
|
|
- return true;
|
|
|
|
-}
|
|
|
|
|
|
|
|
const adParams = reactive({
|
|
const adParams = reactive({
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
@@ -203,10 +163,12 @@ const getSelectDetails = (tplId: number) => {
|
|
}
|
|
}
|
|
|
|
|
|
// 修改
|
|
// 修改
|
|
-const handleEdit = ({metricsId}) => {
|
|
|
|
- if (editRow.value.indexOf(metricsId) === -1) {
|
|
|
|
- editRow.value.push(metricsId)
|
|
|
|
- }
|
|
|
|
|
|
+const handleEdit = (row) => {
|
|
|
|
+ visible.value = true
|
|
|
|
+ rowsInfo.value = {...row}
|
|
|
|
+ proxy.$nextTick(()=>{
|
|
|
|
+ proxy.$refs.eiRef.editData(row)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
// 多选框选中数据
|
|
// 多选框选中数据
|
|
@@ -252,6 +214,7 @@ const handleAdd = () => {
|
|
}
|
|
}
|
|
|
|
|
|
const getSelectData = () => {
|
|
const getSelectData = () => {
|
|
|
|
+ visible.value = false
|
|
selectDetails(rowTplId.value, adParams).then(res => {
|
|
selectDetails(rowTplId.value, adParams).then(res => {
|
|
addListData.value = res.rows
|
|
addListData.value = res.rows
|
|
adTotal.value = res.total
|
|
adTotal.value = res.total
|