Browse Source

修复bug第3波

pull/1/head
ljlong_2630 1 year ago
parent
commit
f2c949eee1
  1. 11
      src/api/model/logicconfig.js
  2. 9
      src/api/model/method.js
  3. 10
      src/views/flowable/params/index.vue
  4. 124
      src/views/model/alert/deviceparamalert.vue
  5. 34
      src/views/model/alert/logicconfig.vue
  6. 21
      src/views/model/alert/method.vue
  7. 20
      src/views/model/alert/model.vue
  8. 56
      src/views/model/alert/policy.vue
  9. 48
      src/views/model/params/index.vue

11
src/api/model/logicconfig.js

@ -51,3 +51,14 @@ export function exportLogicconfig(query) {
params: query
})
}
// 查询告警逻辑列表
export function listLogicconfigNoPage(query) {
return request({
url: '/model/dcBusiAlertLogicConfig/listNoPage',
method: 'get',
params: query
})
}

9
src/api/model/method.js

@ -51,3 +51,12 @@ export function exportMethod(query) {
params: query
})
}
// 查询告警方式列表
export function listMethodNoPage(query) {
return request({
url: '/model/dcBusiAlertMethod/listNoPage',
method: 'get',
params: query
})
}

10
src/views/flowable/params/index.vue

@ -1,10 +1,10 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="中台设备UUID" prop="deviceUuid">
<el-form-item label="中台设备编码" prop="deviceUuid">
<el-input
v-model="queryParams.deviceUuid"
placeholder="请输入中台设备UUID"
placeholder="请输入中台设备编码"
clearable
@keyup.enter="handleQuery"
/>
@ -151,7 +151,7 @@
<el-table v-loading="loading" :data="paramsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="中台设备UUID" align="center" prop="deviceUuid" />
<el-table-column label="中台设备编码" align="center" prop="deviceUuid" />
<el-table-column label="参数名称" align="center" prop="paramName" />
<el-table-column label="参数编码" align="center" prop="paramCode" />
<el-table-column label="数据类型" align="center" prop="paramType">
@ -204,8 +204,8 @@
<el-row>
<el-col :span="12">
<el-form-item label="中台设备UUID" prop="deviceUuid">
<el-input v-model="form.deviceUuid" placeholder="请输入中台设备UUID" />
<el-form-item label="中台设备编码" prop="deviceUuid">
<el-input v-model="form.deviceUuid" placeholder="请输入中台设备编码" />
</el-form-item>
</el-col>
<el-col :span="12">

124
src/views/model/alert/deviceparamalert.vue

@ -115,13 +115,13 @@
<template #default="scope">
<el-button
type="text"
icon="Delete"
icon="Edit"
@click="handlePolicy(scope.row)"
>维护告警策略</el-button>
<el-button
type="text"
icon="Delete"
@click="handleDeleteByRow(scope.row)"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
@ -196,7 +196,6 @@
<el-row>
<el-col :span="12" v-show="boolValueVisiable">
<el-form-item label="告警值" prop="boolValue">
<!-- <el-input v-model="formPolicy.boolValue" placeholder="请输入开始值" /> -->
<el-select v-model="formPolicy.boolValue" placeholder="请选择是否告警">
<el-option
v-for="item in alert_value"
@ -376,6 +375,7 @@ const paramTip = ref("请先选择设备");
const paramDisabled = ref(false);
const partionDisabled = ref(false);
const submitDisabled = ref(true);
const names = ref([]);
const alert_value = ref([
{label: '1', value: true, elTagType: 'default', elTagClass: null},
{label: '0', value: false, elTagType: 'default', elTagClass: null}
@ -415,7 +415,7 @@ const data = reactive({
},
rules: {
deviceUuid: [
{ required: true, message: "中台设备UUID不能为空", trigger: "blur" }
{ required: true, message: "中台设备编码不能为空", trigger: "blur" }
],
paramCode: [
{ required: true, message: "参数编码不能为空", trigger: "blur" }
@ -426,7 +426,7 @@ const data = reactive({
},
rulesPolicy: {
deviceUuid: [
{ required: true, message: "中台设备UUID不能为空", trigger: "blur" }
{ required: true, message: "中台设备编码不能为空", trigger: "blur" }
],
paramCode: [
{ required: true, message: "参数编码不能为空", trigger: "blur" }
@ -527,6 +527,8 @@ function resetQuery() {
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
names.value = selection.map(item => item.deviceName + "-" + item.paramName);
selection.forEach(item=>{
if(!rowPolicySelected.value.includes(item)){
handleValueChange(item);
@ -628,57 +630,66 @@ function submitForm() {
});
}
/** 删除按钮操作 */
function handleDelete() {
const rows = proxy.$refs.deviceParamsTable.getSelectionRows();
let names = "";
let _ids = [];
rows.forEach(item=>{
_ids.push(item.id);
if(names == ""){
names = item.deviceName + item.paramName;
}else{
names = names + "," + item.deviceName + item.paramName;
}
})
proxy.$modal.confirm('是否确认删除设备参数名称为"' + names + '"的数据项?').then(function() {
return delAlert(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
// /** */
// function handleDelete() {
// const rows = proxy.$refs.deviceParamsTable.getSelectionRows();
// let names = "";
// let _ids = [];
// rows.forEach(item=>{
// _ids.push(item.id);
// if(names == ""){
// names = item.deviceName + item.paramName;
// }else{
// names = names + "," + item.deviceName + item.paramName;
// }
// })
// proxy.$modal.confirm('"' + names + '"').then(function() {
// return delAlert(_ids);
// }).then(() => {
// getList();
// proxy.$modal.msgSuccess("");
// }).catch(() => {});
// }
function handleDeleteByRow(row) {
let rows = [];
let names = "";
let _ids = [];
rows.push(row);
rows.forEach(item=>{
_ids.push(item.id);
if(names == ""){
names = item.deviceName + item.paramName;
}else{
names = names + "," + item.deviceName + item.paramName;
}
})
proxy.$modal.confirm('是否确认删除设备参数名称为"' + names + '"的数据项?').then(function() {
return delAlert(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
// function handleDeleteByRow(row) {
// let rows = [];
// let names = "";
// let _ids = [];
// rows.push(row);
// rows.forEach(item=>{
// _ids.push(item.id);
// if(names == ""){
// names = item.deviceName + item.paramName;
// }else{
// names = names + "," + item.deviceName + item.paramName;
// }
// })
// proxy.$modal.confirm('"' + names + '"').then(function() {
// return delAlert(_ids);
// }).then(() => {
// getList();
// proxy.$modal.msgSuccess("");
// }).catch(() => {});
// }
/** 删除按钮操作 */
function handleDeleteRow(row) {
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除设备告警编号为"' + _ids + '"的数据项?').then(function() {
return delAlert(_ids);
if(_ids.length == 0){
ElMessageBox.alert('请先选择需要删除的记录', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
const _names = row.deviceName?row.deviceName + "-" + row.paramName : names.value;
proxy.$modal.confirm('是否确认删除"' + _names + '"的告警策略?').then(function() {
return delLogicconfig(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
@ -698,6 +709,7 @@ function getDeviceList(){
function getParamsListDevice(deviceUuid){
loading.value = true;
form.value.partion = null;
queryParamsParam.value.deviceUuid = deviceUuid;
if(queryParamsParam.value.partion == null){
partionDisabled.value = true;
@ -713,6 +725,7 @@ function getParamsListDevice(deviceUuid){
}
function getParamsListPartion(partion){
loading.value = true;
form.value.paramCode = null;
queryParamsParam.value.partion = partion;
if(queryParamsParam.value.deviceUuid == null){
paramTip.value = "请先选择设备";
@ -1018,7 +1031,16 @@ function setParamsType(val){
//
function handleValueChange(row){
let flag = true;
let needJudgeFlag = false;
const selectedRowsNow = proxy.$refs.policyTable.getSelectionRows();
selectedRowsNow.forEach(item=>{
if(item.id == row.id){
needJudgeFlag = true
}
})
if(!needJudgeFlag){
return;
}
if(selectedRowsNow.length>0){
selectedRowsNow.forEach(item=>{
if(item.sort < row.sort){
@ -1052,9 +1074,9 @@ function judgeIfRightValue(){
if(!handleValueChangeSub(item)){
flag = false;
};
// if(item.value === '' || item.methodIds == null || item.methodIds.length === 0){
// flag = false;
// }
if(item.value === ''){
flag = false;
}
})
}
return flag;

34
src/views/model/alert/logicconfig.vue

@ -167,7 +167,7 @@
@import "@/assets/styles/self-defined.scss";
</style>
<script setup name="Logicconfig">
import { listLogicconfig, getLogicconfig, delLogicconfig, addLogicconfig, updateLogicconfig } from "@/api/model/logicconfig";
import { listLogicconfig, getLogicconfig, delLogicconfig, addLogicconfig, updateLogicconfig,listLogicconfigNoPage } from "@/api/model/logicconfig";
import lock from "@/assets/icons/svg/lock.svg";
import { ElMessageBox } from 'element-plus';
const { proxy } = getCurrentInstance();
@ -199,6 +199,12 @@ const data = reactive({
note: null
},
rules: {
logicCode: [
{ required: true, message: "告警方式名称不能为空", trigger: "blur" }
],
paramValueType: [
{ required: true, message: "告警方式是否有效不能为空", trigger: "blur" }
],
}
});
@ -304,19 +310,43 @@ function handleUpdate(row) {
function submitForm() {
proxy.$refs["logicconfigRef"].validate(valid => {
if (valid) {
let param = {"paramValueType":form.value.paramValueType};
if (form.value.id != null) {
updateLogicconfig(form.value).then(response => {
listLogicconfigNoPage(param).then(response => {
const result = response.data;
const newArray = result.filter(item => item.id !== form.value.id);
if (newArray?.length > 0) {
ElMessageBox.alert('存在相同参数类型,请修改', '提示', {
confirmButtonText: '确定',
center: true,
})
}else{
listLogicconfigNoPage(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
}
});
} else {
listLogicconfig(param).then(response => {
const result = response.data;
const newArray = result.filter(item => item.id !== form.value.id);
if (newArray?.length > 0) {
ElMessageBox.alert('存在相同参数类型,请修改', '提示', {
confirmButtonText: '确定',
center: true,
})
}else{
addLogicconfig(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
});
}
}
});
}

21
src/views/model/alert/method.vue

@ -141,7 +141,7 @@
@import "@/assets/styles/self-defined.scss";
</style>
<script setup name="Method">
import { listMethod, getMethod, delMethod, addMethod, updateMethod } from "@/api/model/method";
import { listMethod, getMethod, delMethod, addMethod, updateMethod, listMethodNoPage } from "@/api/model/method";
import lock from "@/assets/icons/svg/lock.svg";
import { ElMessageBox } from 'element-plus';
const { proxy } = getCurrentInstance();
@ -281,17 +281,27 @@ function handleUpdate(row) {
function submitForm() {
proxy.$refs["methodRef"].validate(valid => {
if (valid) {
let param = {"methodName":form.value.methodName};
if (form.value.id != null) {
listMethodNoPage(param).then(response => {
const result = response.data;
if(result?.length > 0){
ElMessageBox.alert('该告警方式名称重复', '提示', {
confirmButtonText: '确定',
center: true,
})
}else{
updateMethod(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
}
});
} else {
let param = {"methodName":form.value.methodName};
listMethod(param).then(response => {
total.value = response.total;
if(response.total > 0){
listMethodNoPage(param).then(response => {
const result = response.data;
if(result?.length > 0){
ElMessageBox.alert('该告警方式名称重复', '提示', {
confirmButtonText: '确定',
center: true,
@ -303,7 +313,6 @@ function submitForm() {
getList();
});
}
});
}

20
src/views/model/alert/model.vue

@ -579,19 +579,13 @@ function judgeIfRightValue(){
}
function levelChange(value){
if(form.value.paramType == '4'){
dc_alert_level.value.forEach(item=>{
if(item.value == value){
form.value.name = item.label
}
})
}else{
dc_alert_level.value.forEach(item=>{
if(item.value == value){
form.value.name = item.label
}
})
}
// if(form.value.paramType == '4'){
// dc_alert_level.value.forEach(item=>{
// if(item.value == value){
// form.value.name = item.label
// }
// })
// }
}

56
src/views/model/alert/policy.vue

@ -35,10 +35,10 @@
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="设备Id" prop="deviceId">
<el-form-item label="设备编号" prop="deviceId">
<el-input
v-model="queryParams.deviceId"
placeholder="请输入设备Id"
placeholder="请输入设备编号"
clearable
@keyup.enter="handleQuery"
/>
@ -67,10 +67,10 @@
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="是否告警" prop="alertFlag">
<el-select v-model="queryParams.alertFlag" placeholder="请选择是否告警" clearable>
<el-form-item label="是否告警" prop="enabled">
<el-select v-model="queryParams.enabled" placeholder="请选择是否告警" clearable>
<el-option
v-for="item in alertFlag"
v-for="item in enabled"
:key="item.value"
:label="item.label"
:value="item.value"
@ -100,12 +100,12 @@
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="开关值" prop="boolValue">
<el-select v-model="form.value" placeholder="请选择开关值">
<el-select v-model="queryParams.boolValue" placeholder="请选择开关值">
<el-option
v-for="dict in dc_alert_value"
:key="dict.label"
:key="dict.value"
:label="dict.label"
:value="parseFloat(dict.label)"
:value="dict.value"
/>
</el-select>
</el-form-item>
@ -130,7 +130,7 @@
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<!-- <el-col :span="4" v-show="collapseVisible">
<el-form-item label="状态值" prop="statusValue">
<el-input
v-model="queryParams.statusValue"
@ -146,8 +146,8 @@
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
</el-col> -->
<!-- <el-col :span="4" v-show="collapseVisible">
<el-form-item label="中台设备ID" prop="deviceId">
<el-input
v-model="queryParams.deviceId"
@ -156,7 +156,7 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="排序" prop="sortId">
<el-input-number v-model="queryParams.sortId" :min="1" :max="1000" />
@ -205,18 +205,18 @@
</el-table-column>
<el-table-column label="字符值" align="center" prop="stringValue" />
<!-- <el-table-column label="结束值" align="center" prop="endValue" /> -->
<el-table-column label="是否告警" align="center" prop="alertFlag" >
<el-table-column label="是否告警" align="center" prop="enabled" >
<template #default="scope">
<dict-tag :options="alertFlag" :value="scope.row.alertFlag"/>
<dict-tag :options="enabledTable" :value="scope.row.enabled"/>
</template>
</el-table-column>
<el-table-column label="策略ID" align="center" prop="alertId" />
<el-table-column label="状态值" align="center" prop="statusValue" />
<el-table-column label="状态类型" align="center" prop="statusType" >
<!-- <el-table-column label="状态值" align="center" prop="statusValue" /> -->
<!-- <el-table-column label="状态类型" align="center" prop="statusType" >
<template #default="scope">
<dict-tag :options="statusType" :value="scope.row.statusType"/>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="排序" align="center" prop="sortId" />
<el-table-column label="告警方式" align="center" prop="methodIds" >
<template #default="scope">
@ -244,10 +244,10 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否告警" prop="alertFlag">
<el-select v-model="form.alertFlag" placeholder="请选择是否告警">
<el-form-item label="是否告警" prop="enabled">
<el-select v-model="form.enabled" placeholder="请选择是否告警">
<el-option
v-for="item in alertFlag"
v-for="item in enabled"
:key="item.value"
:label="item.label"
:value="item.value"
@ -309,7 +309,7 @@ import { selectDeviceParamPolicy, listPolicy, getPolicy, delPolicy, addPolicy, u
import { listMethod } from "@/api/model/method";
const { proxy } = getCurrentInstance();
const router = useRouter();
const { dc_param_value_type,dc_bool_value } = proxy.useDict('dc_param_value_type','dc_bool_value');
const { dc_param_value_type,dc_alert_value } = proxy.useDict('dc_param_value_type','dc_alert_value');
const policyList = ref([]);
const open = ref(false);
const loading = ref(true);
@ -328,9 +328,13 @@ const queryParamFilter = ref({});
const sortProps = ref([]);
const collapseVisible = ref(false);
const editName = ref("更多筛选项");
const alertFlag = ref([
{label: '告警', value: 'true', elTagType: 'default', elTagClass: null},
{label: '不告警', value: 'false', elTagType: 'default', elTagClass: null}
const enabled = ref([
{label: '告警', value: 1, elTagType: 'default', elTagClass: null},
{label: '不告警', value: 0, elTagType: 'default', elTagClass: null}
]);
const enabledTable = ref([
{label: '告警', value: '1', elTagType: 'default', elTagClass: null},
{label: '不告警', value: '0', elTagType: 'default', elTagClass: null}
]);
const statusType = ref([
{label: '状态1', value: '1', elTagType: 'default', elTagClass: null},
@ -361,7 +365,9 @@ const { queryParams, form, rules } = toRefs(data);
function getList() {
loading.value = true;
queryParams.value.deviceId = deviceUuid;
selectDeviceParamPolicy(queryParams.value).then(response => {
let paramForSearch = {...queryParams.value};
paramForSearch.methodIds = paramForSearch?.methodIds?.join(',');
selectDeviceParamPolicy(paramForSearch).then(response => {
policyList.value = response.rows;
total.value = response.total;
loading.value = false;

48
src/views/model/params/index.vue

@ -3,10 +3,10 @@
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="120px" class="my-custom-form">
<el-row>
<el-col :span="4">
<el-form-item label="中台设备UUID" prop="deviceUuid">
<el-form-item label="中台设备编码" prop="deviceUuid">
<el-input
v-model="queryParams.deviceUuid"
placeholder="请输入中台设备UUID"
placeholder="请输入中台设备编码"
:disabled="uuidDisabled"
@keyup.enter="handleQuery"
/>
@ -100,28 +100,8 @@
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="验证范围" prop="validateScope">
<el-input
v-model="queryParams.validateScope"
placeholder="请输入验证范围"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="全局统一编码" prop="globalCode">
<el-input
v-model="queryParams.globalCode"
placeholder="请输入全局统一编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="参数模版ID" prop="paramModelId">
<el-select v-model="queryParams.paramModelId" placeholder="请选择参数模版ID" clearable>
<el-form-item label="参数模版" prop="paramModelId">
<el-select v-model="queryParams.paramModelId" placeholder="请选择参数模版" clearable>
<el-option
v-for="dict in paramClassList"
:label="dict.paramClassName"
@ -196,7 +176,7 @@
<el-table ref="deviceParamTable" v-loading="loading" :data="paramsList" @selection-change="handleSelectionChange" @sort-change="sortChange" @filter-change="filterChange" :max-height="tableHeight" :border="true" :column-width-draggable="true">
<el-table-column type="selection" width="55" align="center" fixed="left"/>
<!-- <el-table-column label="主键" align="center" prop="id" />
<el-table-column label="中台设备UUID" align="center" prop="deviceUuid" :width="120"/> -->
<el-table-column label="中台设备编码" align="center" prop="deviceUuid" :width="120"/> -->
<el-table-column label="参数名称" align="center" prop="paramName" :width="130" sortable/>
<el-table-column label="参数编码" align="center" prop="paramCode" :width="120" sortable/>
<el-table-column label="数据类型" align="center" prop="paramType" column-key="paramType" filter-placement="bottom-end"
@ -217,7 +197,7 @@
<dict-tag :options="enabledTable" :value="scope.row.enabled"/>
</template>
</el-table-column>
<el-table-column label="计算单位" align="center" prop="contrlType" column-key="contrlType" filter-placement="bottom-end"
<el-table-column label="参数单位" align="center" prop="contrlType" column-key="contrlType" filter-placement="bottom-end"
:filters="getfilterNameItem('contrlType')" :filter-method="filterMethod" :width="120" sortable
>
<template #default="scope">
@ -313,6 +293,18 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数单位" prop="contrlType">
<el-select v-model="form.contrlType" placeholder="请选择参数单位">
<el-option
v-for="dict in dc_param_uint_type"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否可控" prop="contrlFlag">
<el-select v-model="form.contrlFlag" placeholder="请选择是否可控">
@ -463,7 +455,7 @@ const data = reactive({
},
rules: {
deviceUuid: [
{ required: true, message: "中台设备UUID不能为空", trigger: "blur" }
{ required: true, message: "中台设备编码不能为空", trigger: "blur" }
],
paramName: [
{ required: true, message: "参数名称不能为空", trigger: "blur" }
@ -712,6 +704,7 @@ function getParamModelName(id){
function checkedParamModel(val){
paramClassList.value.forEach(item=>{
form.value.contrlType = item.paramUnit;
if(item.paramClassCode == val){
paramClassCodeSeleted.value = item.paramClassCode;
if(form.value.partion !== undefined && form.value.partion !== null && form.value.partion !== ""){
@ -720,6 +713,7 @@ function checkedParamModel(val){
}else{
hintMessage.value = "请选择分区";
}
return;
}
})

Loading…
Cancel
Save