analysis monitor 模块的规则页面接口联调

This commit is contained in:
renpy 2023-08-04 14:52:22 +08:00
parent 1e25c77ca3
commit 1363296e95
2 changed files with 334 additions and 76 deletions

View File

@ -25,20 +25,12 @@
<img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" /> <img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" />
</a-select> </a-select>
</a-col> </a-col>
<a-col flex="310px"> <a-col flex="336px">
<span class="item-label">Data Sources</span> <span class="item-label">Data Sources</span>
<a-select style="width:180px" <DicSelect
v-model="queryParams.source" v-model="queryParams.source"
mode="multiple" dictCode="alarm_analyse_rule_source"
placeholder="select..." />
:maxTagCount="1"
:filter-option="filterOption"
show-arrow
:options="sourceOptions"
@change="onSourceChange"
>
<img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" />
</a-select>
</a-col> </a-col>
<a-col flex="265px"> <a-col flex="265px">
<span class="item-label">Nuclide</span> <span class="item-label">Nuclide</span>
@ -68,67 +60,69 @@
<div class="rules-content"> <div class="rules-content">
<a-spin :spinning="spinning"> <a-spin :spinning="spinning">
<div class="monitor-list"> <div class="monitor-list">
<div class="monitor-list-item"> <div class="monitor-list-item" v-for="item in monitorList" :key="item.id">
<div class="monitor-list-item-title"> <div class="monitor-list-item-title">
<div class="monitor-list-item-title-name">asdfsd</div> <div class="monitor-list-item-title-name">{{ item.name }}</div>
<div class="monitor-list-item-title-server"> <div class="monitor-list-item-title-server">
<span style="color: #5b9cba;">Qualifier</span> <span style="color: #5b9cba;">Qualifier</span>
<span style="color: #ade6ee;">FULL</span> <span style="color: #ade6ee;">{{ item.spectralQualifier.join("/") }}</span>
</div> </div>
</div> </div>
<div class="monitor-list-item-content"> <div class="monitor-list-item-content">
<div class="monitor-list-item-content-info"> <div class="monitor-list-item-content-info">
<div> <a-row>
Source <a-col :span="5" class="monitor-list-item-content-info-key">Source</a-col>
<a-tooltip> <a-tooltip>
<template slot="title"> <template slot="title">
asdfasdfas {{ item.source.join("/") }}
</template> </template>
<span>asdfasdfas</span> <a-col :span="17" class="monitor-list-item-content-info-val">
{{ item.source.join("/") }}
</a-col>
</a-tooltip> </a-tooltip>
</div> </a-row>
<div> <a-row>
Stations <a-col :span="5" class="monitor-list-item-content-info-key">Stations</a-col>
<a-tooltip> <a-tooltip>
<template slot="title"> <template slot="title">
asdfasdfas {{ item.stations.join("/") }}
</template> </template>
<span>asdfasdfas</span> <a-col :span="17" class="monitor-list-item-content-info-val">
{{ item.stations.join("/") }}
</a-col>
</a-tooltip> </a-tooltip>
</div> </a-row>
<div> <a-row>
Nuclides <a-col :span="5" class="monitor-list-item-content-info-key">Nuclides</a-col>
<a-tooltip> <a-tooltip>
<template slot="title"> <template slot="title">
asdfasdfas {{ item.nuclides.join("/") }}
</template> </template>
<span>asdfasdfas</span> <a-col :span="17" class="monitor-list-item-content-info-val">
{{ item.nuclides.join("/") }}
</a-col>
</a-tooltip> </a-tooltip>
</div> </a-row>
</div> </div>
<div :class="[1==1?'monitor-list-item-content-enable':'monitor-list-item-content-disable', 'monitor-list-item-content-btn']"> <div :class="[item.enabled==1?'monitor-list-item-content-enable':'monitor-list-item-content-disable', 'monitor-list-item-content-btn']">
{{ 1==1?"Enable":"Disabled" }}
</div>
<!-- <div :class="[item.enabled==1?'monitor-list-item-content-enable':'monitor-list-item-content-disable', 'monitor-list-item-content-btn']">
{{ item.enabled==1?"Enable":"Disabled" }} {{ item.enabled==1?"Enable":"Disabled" }}
</div> --> </div>
</div> </div>
<div class="monitor-list-item-footer"> <div class="monitor-list-item-footer">
<div class="monitor-list-item-footer-group"> <div class="monitor-list-item-footer-group">
<span style="color: #5b9cba;">Alarm Contact Group</span> <span style="color: #5b9cba;">Alarm Contact Group</span>
<span style="color: #ade6ee;">sadfasdfa</span> <span style="color: #ade6ee;">{{ item.groupName }}</span>
</div> </div>
<div class="monitor-list-item-footer-actions"> <div class="monitor-list-item-footer-actions">
<span title="Edit" class="actions-edit" @click="editItem()"></span> <span title="Edit" class="actions-edit" @click="editItem(item.id)"></span>
<span title="Delete" class="actions-delete" @click="deleteItem()"></span> <span title="Delete" class="actions-delete" @click="deleteItem(item.id)"></span>
<span v-if="1==1" title="Enable" class="actions-enable" @click="changeItemStatus()"> <span v-if="1==1" title="Enable" class="actions-enable" @click="changeItemStatus(item.id,item.enabled)">
</span> </span>
<span v-if="1==0" title="Disabled" class="actions-disable" @click="changeItemStatus()"> <span v-if="1==0" title="Disabled" class="actions-disable" @click="changeItemStatus(item.id,item.enabled)">
</span> </span>
</div> </div>
</div> </div>
</div> </div>
<!-- <j-multi-select-tag type="checkbox" dictCode="spectral_qualifier" /> -->
</div> </div>
</a-spin> </a-spin>
<a-pagination <a-pagination
@ -147,7 +141,7 @@
</div> </div>
<a-modal <a-modal
:title="isAdd ? 'Add Rule' : 'Edit Rule'" :title="isAdd ? 'Add Rule' : 'Edit Rule'"
:width="845" :width="800"
v-model="visible" v-model="visible"
@cancel="onCancel" @cancel="onCancel"
> >
@ -168,8 +162,8 @@
/> />
</a-form-item> </a-form-item>
<a-form-item label="Analyse Source"> <a-form-item label="Source">
<j-multi-select-tag <dic-select
type="checkbox" type="checkbox"
dictCode="alarm_analyse_rule_source" dictCode="alarm_analyse_rule_source"
v-decorator="[ v-decorator="[
@ -183,6 +177,7 @@
</a-form-item> </a-form-item>
<a-form-item label="Station"> <a-form-item label="Station">
<a-select <a-select
class="form-select"
mode="multiple" mode="multiple"
placeholder="select..." placeholder="select..."
:filter-option="filterOption" :filter-option="filterOption"
@ -201,6 +196,7 @@
</a-form-item> </a-form-item>
<a-form-item label="Nuclide"> <a-form-item label="Nuclide">
<a-select <a-select
class="form-select"
mode="multiple" mode="multiple"
placeholder="select..." placeholder="select..."
:maxTagCount="5" :maxTagCount="5"
@ -218,8 +214,8 @@
<img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" /> <img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" />
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="Spectral Qualifier"> <a-form-item label="Qualifier">
<j-multi-select-tag <dic-select
type="checkbox" type="checkbox"
dictCode="spectral_qualifier" dictCode="spectral_qualifier"
v-decorator="[ v-decorator="[
@ -232,7 +228,10 @@
/> />
</a-form-item> </a-form-item>
<a-form-item label="Condition"> <a-form-item label="Condition">
<a-checkbox-group <dic-select
type="checkbox"
layout="vertical"
dictCode="alarm_analyse_rule_condition"
v-decorator="[ v-decorator="[
'condition', 'condition',
{ {
@ -241,10 +240,25 @@
} }
]" ]"
> >
<a-row v-for="(item, key) in dictOptions" :key="key" > </dic-select>
<a-checkbox :value="item.value">{{ item.text || item.label }}</a-checkbox> </a-form-item>
</a-row> <a-form-item label="Contact Group">
</a-checkbox-group> <a-select
class="form-select"
:options="contactGroupOptions"
show-arrow
allowClear
placeholder="select..."
v-decorator="[
'contactGroup',
{
rules: [{ required: true }],
initialVale: this.formVal.contactGroup
}
]"
>
<img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" />
</a-select>
</a-form-item> </a-form-item>
<a-form-item label="Remark"> <a-form-item label="Remark">
<a-input <a-input
@ -271,7 +285,11 @@
<script> <script>
import { ajaxGetDictItems } from '@/api/api' import { ajaxGetDictItems } from '@/api/api'
import { getAction, postAction, httpAction, deleteAction } from '@/api/manage' import { getAction, postAction, httpAction, deleteAction } from '@/api/manage'
import DicSelect from '../../components/dicSelect.vue';
export default { export default {
components: {
DicSelect,
},
data() { data() {
return { return {
isAdd: true, isAdd: true,
@ -280,7 +298,7 @@ export default {
queryParams: { queryParams: {
station: undefined, station: undefined,
source: undefined, source: undefined,
buclide: undefined nuclide: undefined
}, },
sourceOptions: [ sourceOptions: [
{ {
@ -307,9 +325,9 @@ export default {
total: 0 total: 0
}, },
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 14 }, wrapperCol: { span: 18 },
form: this.$form.createForm(this), form: this.$form.createForm(this),
dictOptions: [], contactGroupOptions: [],
formVal: { formVal: {
name: "", name: "",
source: [], source: [],
@ -317,13 +335,17 @@ export default {
nuclide: [], nuclide: [],
qualifier: [], qualifier: [],
condition: [], condition: [],
contactGroup: undefined,
desc: "" desc: ""
} },
monitorList: [],
currId:"",
} }
}, },
created () { created () {
this.getCondition();
this.getStationList(); this.getStationList();
this.getAlarmGroup();
this.getAlarmRulesPage()
}, },
methods: { methods: {
getStationList() { getStationList() {
@ -354,44 +376,125 @@ export default {
); );
}, },
onStationChange(val) { onStationChange(val) {
console.log(val); this.queryParams.station = val
}, },
onSourceChange(val) { onSourceChange(val) {
console.log(val); this.queryParams.source = val
}, },
onNuclideChange(val) { onNuclideChange(val) {
console.log(val); this.queryParams.nuclide = val
},
getAlarmRulesPage() {
this.spinning = true
let params = {
pageNo: this.ipagination.current,
pageSize: this.ipagination.pageSize,
// stations: this.queryParams.station,
// source: this.queryParams.source,
source: [1,2],
stations: [101,102],
}
getAction("/alarmAnalysisRule/findPage", params).then(res => {
this.spinning = false
if (res.success) {
this.monitorList = res.result.records
this.ipagination.total = res.result.total
} else {
this.$message.warning("This operation fails. Contact your system administrator")
}
})
}, },
onSearch() { onSearch() {
// this.getAlarmRulesPage() this.getAlarmRulesPage()
}, },
editItem(id) { }, editItem(id) {
deleteItem(id) { }, this.currId = id
},
deleteItem(id) {
let _this = this
this.$confirm({
title: 'Are you sure to delete this item?',
onOk() {
deleteAction("/alarmAnalysisRule/delete", {id:id}).then(res => {
if (res.success) {
_this.$message.success("success")
_this.getAlarmRulesPage()
} else {
_this.$message.warning("This operation fails. Contact your system administrator")
}
})
},
onCancel() {
console.log('Cancel');
},
});
},
changeItemStatus(id, isEnabled) { }, changeItemStatus(id, isEnabled) { },
handlePageChange(page, pageSize) { handlePageChange(page, pageSize) {
this.ipagination.current = page this.ipagination.current = page
this.ipagination.pageSize = pageSize this.ipagination.pageSize = pageSize
// this.getAlarmRulesPage() this.getAlarmRulesPage()
}, },
handleSizeChange(current, size) { handleSizeChange(current, size) {
this.ipagination.current = current this.ipagination.current = current
this.ipagination.pageSize = size this.ipagination.pageSize = size
// this.getAlarmRulesPage() this.getAlarmRulesPage()
}, },
getCondition() { getAlarmGroup() {
//Code, let params = {
ajaxGetDictItems("alarm_analyse_rule_condition", null).then((res) => { pageNo: 1,
pageSize: 9999
}
getAction("/alarmContactGroup/findPage", params).then(res => {
if (res.success) { if (res.success) {
this.dictOptions = res.result; this.contactGroupOptions = res.result.records.map(item => {
return {
label: item.name,
value: item.id
}
})
} else {
this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },
onSave() { onSave() {
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
console.log('Received values of form: ', values); // if (!err) {
if (!err) { let params = {
this.visible = false conditions:values.condition,
} name:values.name,
remark:values.remark,
stations:values.station.join(","),
source: values.source,
enabled: 1,
// nuclides:values.nuclide.join(","),
nuclides:"A406,Bu12",
contactGroup:values.contactGroup,
spectralQualifier: values.qualifier,
}
if (this.isAdd) {
postAction("/alarmAnalysisRule/add", params).then(res => {
if (res.success) {
this.visible = false
this.$message.success("success")
this.getAlarmRulesPage()
} else {
this.$message.warning("This operation fails. Contact your system administrator")
}
})
} else {
httpAction("/alarmAnalysisRule/edit", {...params,id: this.currId}, "put").then(res => {
if (res.success) {
this.visible = false
this.$message.success("success")
this.getAlarmRulesPage()
} else {
this.$message.warning("This operation fails. Contact your system administrator")
}
})
}
// }
}) })
}, },
onCancel() { onCancel() {
@ -406,6 +509,12 @@ export default {
.ant-row-flex{ .ant-row-flex{
flex-flow: nowrap; flex-flow: nowrap;
} }
.ant-select{
width: 206px;
}
.form-select{
width: 100%;
}
.operators { .operators {
width: 100%; width: 100%;
justify-content: center; justify-content: center;
@ -508,9 +617,17 @@ export default {
font-family: ArialMT; font-family: ArialMT;
font-size: 16px; font-size: 16px;
color: #ade6ee; color: #ade6ee;
// span{ &-key{
// display: block; // display: inline-block;
// } // width: 120px;
// vertical-align: middle;
}
&-val{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
}
} }
&-btn{ &-btn{
margin-top: 10px; margin-top: 10px;

View File

@ -0,0 +1,141 @@
<template>
<a-checkbox-group v-if="tagType=='checkbox'" @change="onChange" :value="arrayValue" :disabled="disabled">
<template v-if="layout=='vertical'">
<a-row v-for="(item, key) in dictOptions" :key="key" >
<a-checkbox :value="item.value">{{ item.text || item.label }}</a-checkbox>
</a-row>
</template>
<template v-else>
<a-checkbox v-for="(item, key) in dictOptions" :key="key" :value="item.value">{{ item.text || item.label }}</a-checkbox>
</template>
</a-checkbox-group>
<a-select
v-else-if="tagType=='select'"
:value="arrayValue"
@change="onChange"
:disabled="disabled"
mode="multiple"
:maxTagCount="1"
:placeholder="placeholder"
:getPopupContainer="getParentContainer"
optionFilterProp="children"
:filterOption="filterOption"
allowClear>
<a-select-option
v-for="(item,index) in dictOptions"
:key="index"
:value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.text || item.label ">
{{ item.text || item.label }}
</span>
</a-select-option>
</a-select>
</template>
<script>
import {ajaxGetDictItems,getDictItemsFromCache} from '@/api/api'
export default {
name: 'JMultiSelectTag',
props: {
layout: String,
dictCode: String,
placeholder: String,
disabled: Boolean,
value: String,
type: String,
options:Array,
spliter:{
type: String,
required: false,
default: ','
},
popContainer:{
type:String,
default:'',
required:false
},
},
data() {
return {
dictOptions: [],
tagType:"",
arrayValue:!this.value?[]:this.value.split(this.spliter)
}
},
created() {
if(!this.type || this.type==="list_multi"){
this.tagType = "select"
}else{
this.tagType = this.type
}
//
//this.initDictData();
},
watch:{
options: function(val){
this.setCurrentDictOptions(val);
},
dictCode:{
immediate:true,
handler() {
this.initDictData()
},
},
value (val) {
if(!val){
this.arrayValue = []
}else{
this.arrayValue = this.value.split(this.spliter)
}
}
},
methods: {
initDictData() {
if(this.options && this.options.length>0){
this.dictOptions = [...this.options]
}else{
//
let cacheOption = getDictItemsFromCache(this.dictCode)
if(cacheOption && cacheOption.length>0){
this.dictOptions = cacheOption
return
}
//Code,
ajaxGetDictItems(this.dictCode, null).then((res) => {
if (res.success) {
this.dictOptions = res.result;
}
})
}
},
onChange (selectedValue) {
this.$emit('change', selectedValue.join(this.spliter));
},
setCurrentDictOptions(dictOptions){
this.dictOptions = dictOptions
},
getCurrentDictOptions(){
return this.dictOptions
},
getParentContainer(node){
if(!this.popContainer){
return node.parentNode
}else{
return document.querySelector(this.popContainer)
}
},
// update--begin--autor:lvdandan-----date:20201120------forLOWCOD-1086 ,codetext
filterOption(input, option) {
return option.componentOptions.children[0].children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
// update--end--autor:lvdandan-----date:20201120------forLOWCOD-1086 ,codetext
},
model: {
prop: 'value',
event: 'change'
}
}
</script>