设备规则修改+报警弹窗书写

main
jinna 7 months ago
parent ab9326dd1e
commit 35a3c53636
  1. 15
      src/api/equipment/rule.js
  2. 224
      src/views/equipment/rule.vue
  3. 95
      src/views/garden/index.vue
  4. 64
      src/views/sourceAnaly/index.vue

@ -35,3 +35,18 @@ export const remove = (params) => {
params
})
}
export const checkValue = (params) =>{
return request({
url:'/api//blade-desk/equipRules/checkRules',
method:'get',
params
})
}
export const getWarnList = () =>{
return request({
url:"/api/blade-desk/equipment/warn-his/getWarnList",
method:'get'
})
}

@ -27,7 +27,7 @@
</div>
<basic-container class="content">
<div class="content-top">
<el-form
<!-- <el-form
:inline="true"
:model="queryForm"
class="serch_form"
@ -72,8 +72,8 @@
<i class="el-icon-search"></i>
</el-button>
</el-form-item>
</el-form>
<div>
</el-form> -->
<div style="margin-bottom: 20px;">
<el-button class="register" @click="handleAdd">新增规则</el-button>
<el-button v-if="multipleSelection.length != 0" class="register" @click="batchDeletion">批量删除</el-button>
</div>
@ -98,9 +98,24 @@
</el-table-column>
<el-table-column
prop="className"
label="设备类型">
label="设备类型"
>
</el-table-column>
<el-table-column
prop="count"
label="次数">
<template slot-scope="scope">
<div>{{ scope.row.classCode == '1000' ? '-' : scope.row.count != -1 ? scope.row.count : '-' }}</div>
</template>
</el-table-column>
<el-table-column
prop="timePeriod"
label="时间">
<template slot-scope="scope">
<div>{{ scope.row.classCode != '1000' ? '-' : scope.row.timePeriod != -1 ? scope.row.timePeriod : '-' }}</div>
</template>
</el-table-column>
<!-- <el-table-column
prop="typeName"
label="规则类型">
</el-table-column>
@ -152,7 +167,7 @@
<template slot-scope="scope">
<div>{{ scope.row.lowerThreshold ? scope.row.lowerThreshold : '-' }}</div>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
prop="remarks"
label="备注">
@ -236,7 +251,27 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="8" v-if="dialogForm.classCode != '1000'">
<el-form-item
label="间隔次数"
prop="count"
>
<el-input placeholder="请输入间隔次数" @input="handleInput" v-model="dialogForm.count" :disabled="dialogFormDisabled">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8" v-if="dialogForm.classCode == '1000'">
<el-form-item
label="间隔时间"
prop="timePeriod"
>
<el-input placeholder="请输入间隔时间" @input="handleInputTime" v-model="dialogForm.timePeriod" :disabled="dialogFormDisabled">
<template slot="append">分钟</template>
</el-input>
</el-form-item>
</el-col>
<!-- <el-col :span="8">
<el-form-item
label="规则类型"
prop="type"
@ -255,8 +290,8 @@
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8"></el-col>
</el-col> -->
<!-- <el-col :span="8"></el-col>
<el-col
:span="8"
v-if="dialogForm.type != '' && dialogForm.type == 1"
@ -379,7 +414,7 @@
:disabled="dialogFormDisabled"
/>
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="24">
<el-form-item
label="备注"
@ -409,7 +444,7 @@
</template>
<script>
import { findPage, save, detail, remove } from "@/api/equipment/rule";
import { findPage, save, detail, remove,checkValue } from "@/api/equipment/rule";
import {getDictionary} from '@/api/system/dictbiz'
import {mapGetters} from "vuex";
export default {
@ -433,20 +468,28 @@
dialogFormDisabled: false,
dialogForm: {
classCode: '',
type: '',
startDate: '',
endDate: '',
startTime: '',
endTime: '',
thresholdType: '',
upperThreshold: '',
lowerThreshold: '',
remarks: '',
count:null,
timePeriod:null,
// type: '',
// startDate: '',
// endDate: '',
// startTime: '',
// endTime: '',
// thresholdType: '',
// upperThreshold: '',
// lowerThreshold: '',
// remarks: '',
},
rules: {
classCode: [
{ required: true, message: '请选择设备类型', trigger: 'blur' },
],
count:[
{ required: true, message: '请输入间隔次数', trigger: 'blur' },
],
timePeriod:[
{ required: true, message: '请输入间隔时间', trigger: 'blur' },
],
type: [
{ required: true, message: '请选择规则类型', trigger: 'blur' },
],
@ -519,6 +562,14 @@
change() {
console.log(this.dialogForm)
},
handleInput(value) {
//
this.dialogForm.count = value.replace(/[^\d]/g, ''); //
},
handleInputTime(value) {
//
this.dialogForm.timePeriod = value.replace(/[^\d]/g, ''); //
},
// init
init() {
this.findPage()
@ -646,46 +697,107 @@
return
}
if(type == 'confirm') {
console.log('dislllllllllllllllllll',this.dialogForm)
// let fieldsToValidate = []
// if(this.dialogForm.type == '1') {
// fieldsToValidate = [
// 'classCode',
// 'type',
// 'startDate',
// 'endDate',
// 'startTime',
// 'endTime',
// ]
// } else if(this.dialogForm.type == '2') {
// fieldsToValidate = [
// 'classCode',
// 'type',
// 'thresholdType',
// 'upperThreshold',
// 'lowerThreshold',
// ]
// }
let fieldsToValidate = []
if(this.dialogForm.type == '1') {
fieldsToValidate = [
'classCode',
'type',
'startDate',
'endDate',
'startTime',
'endTime',
]
} else if(this.dialogForm.type == '2') {
fieldsToValidate = [
'classCode',
'type',
'thresholdType',
'upperThreshold',
'lowerThreshold',
]
}
if(this.dialogForm.classCode == '1000'){
fieldsToValidate = [
'classCode',
'timePeriod'
]
}else{
fieldsToValidate = [
'classCode',
'count'
]
}
this.$refs.dialogForm.validate((valid) => {
console.log('val-------------------',valid)
if (valid) {
let params = this.dialogForm
console.log(params)
save(params).then(res => {
this.$message({
message: params.id ? '修改成功' : '添加成功',
type: 'success'
});
this.dialogHandleClose()
this.currentPage = 1
this.pageSize = 10
this.findPage()
}).catch(error => {
this.$message({
message: '添加失败',
type: 'error'
});
})
} else {
return false;
let params = this.dialogForm
if(!params.id){
checkValue({classCode:params.classCode}).then(res =>{
console.log('res----------------',res)
if(res.data.msg != 'false'){
let params1 = {
...params,
count:params.count ? Number(params.count) : '',
timePeriod:params.timePeriod ? Number(params.timePeriod) : ''
}
console.log('params-------------',params1)
save(params1).then(res => {
this.$message({
message: params.id ? '修改成功' : '添加成功',
type: 'success'
});
this.dialogHandleClose()
this.currentPage = 1
this.pageSize = 10
this.findPage()
})
}else{
this.$message.error('已存在该设备类型规则')
}
})
}else{
let params1 = {
...params,
count:params.count ? Number(params.count) : '',
timePeriod:params.timePeriod ? Number(params.timePeriod) : ''
}
console.log('params1=================',params1)
save(params1).then(res => {
this.$message({
message: params.id ? '修改成功' : '添加成功',
type: 'success'
});
this.dialogHandleClose()
this.currentPage = 1
this.pageSize = 10
this.findPage()
})
}
// let params = this.dialogForm
// console.log(params)
// save(params).then(res => {
// this.$message({
// message: params.id ? '' : '',
// type: 'success'
// });
// this.dialogHandleClose()
// this.currentPage = 1
// this.pageSize = 10
// this.findPage()
// }).catch(error => {
// this.$message({
// message: '',
// type: 'error'
// });
// })
// } else {
// return false;
}
}, fieldsToValidate);
} else {

@ -63,6 +63,28 @@
塔台</div>
</div>
</div>
<el-dialog
custom-class="custom-error-dialog"
title="报警"
:visible.sync="isShowDoor"
width="20%"
:append-to-body="true"
:close-on-click-modal="false">
<div style="height: 200px;overflow: auto;">
<div v-for="item in warnList" :key="item.id" style="height: 30px;display: flex;justify-content: space-between;align-items: center;">
<div style="color: #fff;">
<span>{{ item.className }}</span>
<span>{{ item.equipName }}</span>
<span>{{ item.warnContent }}</span>
</div>
</div>
</div>
<!-- <span>门禁软件存在问题请尽快处理</span>-->
<span slot="footer" class="dialog-footer">
<!-- <el-button @click="isShowDoor = false"> </el-button> -->
<el-button type="primary" @click="gotoPage" style="background: #00eeff;border-color: #00eeff;"> </el-button>
</span>
</el-dialog>
</div>
</template>
@ -70,6 +92,7 @@
import * as bfHelper from '../../util/bfHelper';
import generalizePattern from './generalizePattern'
import browsePattern from './browsePattern'
import {getWarnList} from "@/api/equipment/rule";
import monitoringPattern from './monitoringPattern'
// import monitoringPattern from './monitoringPattern2'
export default {
@ -139,8 +162,9 @@ export default {
],
topbg1: require('../../../public/img/top_navBg.png'),
topbg2: require('../../../public/img/top_navBg1.png'),
clickNum: 1
clickNum: 1,
isShowDoor:false,
timer:null
};
},
watch: {
@ -172,9 +196,15 @@ export default {
},
mounted() {
console.log('this.rou-----------------',this.$route)
// if(this.$route.)
// if(config){
// }else{
if(!this.$route.query.showWarning){
this.getList()
}
this.startTimer()
if(this.$route.query.area) {
bfHelper.loadModel(this.$route.query.area);
} else {
@ -188,8 +218,35 @@ export default {
},
beforeDestroy() {
bfHelper.destroyViewer();
this.clearTimer()
},
methods: {
getList(){
getWarnList().then(res =>{
console.log('res----------------',res)
this.warnList = res.data.data
if(this.warnList.length != 0){
this.isShowDoor = true
}else{
this.isShowDoor = false
}
})
},
gotoPage(){
let type = this.warnList[0].className == '电表' ? '电' : this.warnList[0].className == '水表' ? '水' : this.warnList[0].className == '暖表' ? '热' : '电子门禁'
this.$router.push('/garden/index?showWarning=true&&code=3&&type=' + type + '&&area=' + this.warnList[0].area)
this.isShowDoor = false
},
startTimer() {
this.timer = setInterval(() =>{
this.getList()
},60 * 1000 * 5 ) //5
},
clearTimer() {
if (this.timer) {
clearInterval(this.timer);
}
},
//
statusCut(type) {
this.status = type;
@ -468,3 +525,37 @@ export default {
}
}
</style>
<style lang="scss">
.custom-error-dialog{
position: fixed !important;
bottom:0;
right:30px;
// ../../../public/img/home/bottom_bg.png
// background: url('../../../public/img/monitoring/electricity/newbg.png');
// ../../../../public/img/analysis/condition-analy.png
// ../../../public/img/generalize/leftBg1.png
// ../../../public/img/monitoring/electricity/genbac.png
background: url('../../../public/img/monitoring/electricity/genbac.png');
background-size: 100% 100%;
// border: 1px solid #00bbff;
// box-shadow: 0 1px 10px rgba(0, 0, 0, .3);
.el-dialog__header{
.el-dialog__title{
color: #fff;
font-size: 0.95rem !important;
letter-spacing: 0.187rem !important;
font-weight: bold !important;
}
.el-dialog__headerbtn{
.el-dialog__close{
color: #fff;
font-size: 0.95rem !important;
letter-spacing: 0.187rem !important;
font-weight: bold !important;
}
}
}
}
</style>

@ -23,7 +23,28 @@
<sortSource v-if="allSource == 2 && area == 1"></sortSource>
<towerAnaly v-if="area == 2"></towerAnaly>
<!-- </div> -->
<el-dialog
custom-class="custom-error-dialog"
title="报警"
:visible.sync="isShowDoor"
width="20%"
:append-to-body="true"
:close-on-click-modal="false">
<div style="height: 200px;overflow: auto;">
<div v-for="item in warnList" :key="item.id" style="height: 30px;display: flex;justify-content: space-between;align-items: center;">
<div style="color: #fff;">
<span>{{ item.className }}</span>
<span>{{ item.equipName }}</span>
<span>{{ item.warnContent }}</span>
</div>
</div>
</div>
<!-- <span>门禁软件存在问题请尽快处理</span>-->
<span slot="footer" class="dialog-footer">
<!-- <el-button @click="isShowDoor = false"> </el-button> -->
<el-button type="primary" @click="gotoPage" style="background: #00eeff;border-color: #00eeff;"> </el-button>
</span>
</el-dialog>
</div>
</template>
@ -31,13 +52,15 @@
import totalSource from './totalSource'
import sortSource from './sortSource'
import towerAnaly from './towerAnaly'
import {getWarnList} from "@/api/equipment/rule";
export default{
data() {
return {
key: 'value',
allSource:1, //12
area:1
area:1,
isShowDoor:false,
timer:null,
}
},
components: {
@ -45,13 +68,46 @@
sortSource,
towerAnaly
},
mounted(){
this.getList()
this.startTimer()
},
beforeDestroy(){
this.clearTimer()
},
methods: {
selectBim(i) {
this.allSource = i;
},
changeYwq(i){
this.area = i
}
},
getList(){
getWarnList().then(res =>{
console.log('res----------------',res)
this.warnList = res.data.data
if(this.warnList.length != 0){
this.isShowDoor = true
}else{
this.isShowDoor = false
}
})
},
gotoPage(){
let type = this.warnList[0].className == '电表' ? '电' : this.warnList[0].className == '水表' ? '水' : this.warnList[0].className == '暖表' ? '热' : '电子门禁'
this.$router.push('/garden/index?showWarning=true&&code=3&&type=' + type + '&&area=' + this.warnList[0].area)
this.isShowDoor = false
},
startTimer() {
this.timer = setInterval(() =>{
this.getList()
},60 * 1000 * 5) //5
},
clearTimer() {
if (this.timer) {
clearInterval(this.timer);
}
},
},
}
</script>

Loading…
Cancel
Save