Browse Source

告警功能表单项添加到表格中

pull/1/head
ljlong_2630 1 year ago
parent
commit
6407eb4028
  1. 4
      .env.production
  2. 71
      src/views/model/alert/deviceparamalert.vue

4
.env.production

@ -5,8 +5,8 @@ VITE_APP_TITLE = 联美管理驾驶舱
VITE_APP_ENV = 'production'
# 若依管理系统/生产环境
VITE_APP_BASE_API = 'http://localhost:9000'
VITE_APP_BASE_API_IMAGE = 'http://localhost:9000'
VITE_APP_BASE_API = 'http://10.10.10.56:9000'
VITE_APP_BASE_API_IMAGE = 'http://10.10.10.56:9000'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip

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

@ -156,7 +156,7 @@
</template>
</el-dialog>
<!-- 添加或修改参数值状态策略对话框 -->
<el-dialog :title="titlePolicy" v-model="openPolicy" width="800px" append-to-body>
<el-dialog :title="titlePolicy" v-model="openPolicy" width="1200px" append-to-body>
<el-form ref="policyRef" :model="formPolicy" :rules="rulesPolicy" label-width="120px">
<el-row>
<el-col :span="12" v-show="beginValueVisiable">
@ -243,6 +243,35 @@
<el-input v-model="scope.row.level"></el-input>
</template>
</el-table-column>
<el-table-column label="告警方式" align="center" prop="methodId">
<template #default="scope">
<el-select v-model="scope.row.methodId" placeholder="请选择告警方式">
<el-option
v-for="item in methodList"
:key="item.id"
:label="item.methodName"
:value="item.id"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="状态值" align="center" prop="statusValue">
<template #default="scope">
<el-input v-model="scope.row.statusValue"></el-input>
</template>
</el-table-column>
<el-table-column label="状态类型" align="center" prop="statusType">
<template #default="scope">
<el-select v-model="scope.row.statusType" placeholder="请选择状态类型">
<el-option
v-for="item in status"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
@ -464,18 +493,18 @@ function handlePolicy(row) {
getModelListSwitch(row);
beginValueVisiable.value=true;
policyModelVisiable.value=false;
statusValueVisiable.value=false;
statusTypeVisiable.value=false;
statusValueVisiable.value=true;
statusTypeVisiable.value=true;
sortIdVisiable.value=false;
methodIdVisiable.value=true;
}else{
getModelList(row);
policyModelVisiable.value=true;
beginValueVisiable.value=false;
statusValueVisiable.value=true;
statusTypeVisiable.value=true;
statusValueVisiable.value=false;
statusTypeVisiable.value=false;
sortIdVisiable.value=false;
methodIdVisiable.value=true;
methodIdVisiable.value=false;
}
getMethodList();
queryParamsPolicy.value.alertId = row.id;
@ -578,7 +607,7 @@ function submitFormPolicy() {
getList();
});
}else{
addPolicy(formPolicy.value).then(response => {
updatePolicy(formPolicy.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
openPolicy.value = false;
getList();
@ -630,7 +659,7 @@ function getModelListSwitch(row){
formPolicy.value.beginValue = response.data[0].beginValue;
formPolicy.value.alertId = row.id;
formPolicy.value.deviceId = row.deviceUuid;
formPolicy.value.id = 1;
formPolicy.value.id = response.data[0].id;
//
}else{
formPolicy.value.alertId = row.id;
@ -654,13 +683,10 @@ function getModelList(row){
if(response.data && response.data.length>0){
console.log(response.data);
oldPolicyRows.value = response.data;
formPolicy.value.statusValue = response.data[0].statusValue;
formPolicy.value.statusType = response.data[0].statusType;
formPolicy.value.methodId = response.data[0].methodId;
formPolicy.value.alertFlag = response.data[0].alertFlag;
formPolicy.value.alertId = response.data[0].alertId;
formPolicy.value.deviceId = response.data[0].deviceId;
formPolicy.value.id = 1;
formPolicy.value.id = response.data[0].id;
modelList.value.map(element=>{
response.data.forEach(item=>{
if(item.alertModelId == element.id){
@ -670,6 +696,9 @@ function getModelList(row){
element.level = item.sortId;
element.name = item.name;
element.id = item.id;
element.statusValue = item.statusValue;
element.statusType = item.statusType;
element.methodId = item.methodId;
proxy.$refs.policyTable.toggleRowSelection(element,true);
return element;
}
@ -687,9 +716,6 @@ function mapFormTable(){
policyParams.value=[];
policyTableRows.forEach(item=>{
let policyParam = {};
policyParam.statusValue = formPolicy.value.statusValue;
policyParam.statusType = formPolicy.value.statusType;
policyParam.methodId = formPolicy.value.methodId;
policyParam.alertFlag = formPolicy.value.alertFlag;
policyParam.deviceId = policyDeviceUuid.value;
policyParam.alertId = policyAlertId.value;
@ -697,6 +723,9 @@ function mapFormTable(){
policyParam.sortId = item.level;
policyParam.alertModelId = item.id;
policyParam.name = item.name;
policyParam.statusValue = item.statusValue;
policyParam.statusType = item.statusType;
policyParam.methodId = item.methodId;
policyParams.value.push(policyParam);
})
}
@ -708,9 +737,6 @@ function mapFormTableUpdate(){
policyTableRows.forEach(item=>{
let policyParam = {};
policyParam.id = item.id;
policyParam.statusValue = formPolicy.value.statusValue;
policyParam.statusType = formPolicy.value.statusType;
policyParam.methodId = formPolicy.value.methodId;
policyParam.alertFlag = formPolicy.value.alertFlag;
policyParam.deviceId = policyDeviceUuid.value;
policyParam.alertId = item.alertId;
@ -718,6 +744,9 @@ function mapFormTableUpdate(){
policyParam.sortId = item.level;
policyParam.alertModelId = item.alertModelId;
policyParam.name = item.name;
policyParam.statusValue = item.statusValue;
policyParam.statusType = item.statusType;
policyParam.methodId = item.methodId;
policyParams.value.push(policyParam);
})
}
@ -784,9 +813,6 @@ function mapFormTableUpdataAdd(){
policyParamsUpdateAdd.value=[];
addPolicyRows.value.forEach(item=>{
let policyParam = {};
policyParam.statusValue = formPolicy.value.statusValue;
policyParam.statusType = formPolicy.value.statusType;
policyParam.methodId = formPolicy.value.methodId;
policyParam.alertFlag = formPolicy.value.alertFlag;
policyParam.deviceId = policyDeviceUuid.value;
policyParam.alertId = policyAlertId.value;
@ -794,6 +820,9 @@ function mapFormTableUpdataAdd(){
policyParam.sortId = item.level;
policyParam.alertModelId = item.id;
policyParam.name = item.name;
policyParam.statusValue = item.statusValue;
policyParam.statusType = item.statusType;
policyParam.methodId = item.methodId;
policyParamsUpdateAdd.value.push(policyParam);
})
}

Loading…
Cancel
Save