2021-04-13 20:33:12 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div>
|
2021-10-20 14:53:28 +08:00
|
|
|
|
<nzDetailView
|
2022-03-25 15:40:05 +08:00
|
|
|
|
v-my-loading="detailViewLoading || tools.loading"
|
2021-10-20 14:53:28 +08:00
|
|
|
|
v-if="detailType !== 'list'"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
ref="detailList"
|
|
|
|
|
|
:layout="['searchInput', 'elementSet', 'pagination','detailViewSet']"
|
|
|
|
|
|
:from="fromRoute.alertRule"
|
|
|
|
|
|
:search-msg="searchMsg"
|
|
|
|
|
|
:detailType="detailType"
|
|
|
|
|
|
:detailViewRightObj="detailViewRightObj"
|
|
|
|
|
|
:dataLength="tableData.length"
|
|
|
|
|
|
@search="search"
|
|
|
|
|
|
@changeDetailType="changeDetailType"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template v-slot:top-tool-left>
|
|
|
|
|
|
<!-- <detailViewTopSearch :selectValue.sync="selectValue" :detailSearchList="detailSearchList" @reload="reloadTable" />-->
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:top-tool-right>
|
2022-06-16 15:58:17 +08:00
|
|
|
|
<button id="asset-create-asset" v-has="'asset_add'" :title="$t('asset.createAsset')" class="top-tool-btn" @click.stop="add">
|
2021-10-20 14:53:28 +08:00
|
|
|
|
<i class="nz-icon nz-icon-create-square"></i>
|
|
|
|
|
|
</button>
|
2021-12-21 19:19:35 +08:00
|
|
|
|
<top-tool-more-options
|
2021-11-02 15:47:17 +08:00
|
|
|
|
:delete-objs="batchDeleteObjs"
|
2021-10-20 14:53:28 +08:00
|
|
|
|
ref="export"
|
|
|
|
|
|
id="model"
|
|
|
|
|
|
:params="searchLabel"
|
|
|
|
|
|
:params2="searchCheckBox"
|
2022-01-11 17:05:21 +08:00
|
|
|
|
:permissions="{import: 'alertRule_add', export: 'alertRule_edit'}"
|
2021-10-20 14:53:28 +08:00
|
|
|
|
class="top-tool-export margin-l-10 margin-r-10"
|
2021-11-05 17:18:53 +08:00
|
|
|
|
export-file-name="AlertRule"
|
|
|
|
|
|
export-url="/alert/rule/export"
|
|
|
|
|
|
import-url="/alert/rule/import"
|
2021-10-20 14:53:28 +08:00
|
|
|
|
@afterImport="getTableData"
|
|
|
|
|
|
>
|
|
|
|
|
|
</top-tool-more-options>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:nz-detail-view-list>
|
|
|
|
|
|
<alertRuleDetail
|
|
|
|
|
|
class="data-detail"
|
|
|
|
|
|
ref="dataDetail"
|
|
|
|
|
|
:orderByFa="orderBy"
|
2022-03-25 15:40:05 +08:00
|
|
|
|
v-my-loading="tools.loading"
|
2021-10-22 19:39:49 +08:00
|
|
|
|
:loading="tools.loading"
|
2021-10-20 14:53:28 +08:00
|
|
|
|
:detailViewRightObj="detailViewRightObj"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
:table-data="tableData"
|
|
|
|
|
|
@detailViewRightShow = 'detailViewRightShow'
|
|
|
|
|
|
@orderDetail="orderDetail"
|
|
|
|
|
|
>
|
|
|
|
|
|
</alertRuleDetail>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 分页组件 -->
|
|
|
|
|
|
<template v-slot:pagination>
|
|
|
|
|
|
<el-pagination
|
|
|
|
|
|
@current-change="pageNo"
|
|
|
|
|
|
:current-page.sync="pageObj.pageNo"
|
|
|
|
|
|
:page-size="20"
|
|
|
|
|
|
:total="pageObj.total"
|
|
|
|
|
|
layout="prev, slot, next"
|
|
|
|
|
|
small
|
|
|
|
|
|
>
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<el-input-number ref="jumpInput" v-model="pageObj.pageNo" :controls="false" :min="1" :max="pageObj.pages" class="jump-input" @change="getTableData" @keyup.enter.native="getTableData" size="mini"/>
|
|
|
|
|
|
<span class="jump-pages">/ {{pageObj.pages}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-pagination>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</nzDetailView>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
<nz-data-list
|
|
|
|
|
|
ref="dataList"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
:custom-table-title.sync="tools.customTableTitle"
|
|
|
|
|
|
:from="fromRoute.alertRule"
|
2021-10-20 14:53:28 +08:00
|
|
|
|
:layout="['searchInput', 'elementSet', 'pagination','detailViewSet']"
|
2021-04-29 22:24:38 +08:00
|
|
|
|
:search-msg="searchMsg"
|
|
|
|
|
|
@search="search"
|
2021-10-20 14:53:28 +08:00
|
|
|
|
:detailType="detailType"
|
|
|
|
|
|
@changeDetailType="changeDetailType"
|
|
|
|
|
|
@getTableData="getTableData"
|
2021-04-29 22:24:38 +08:00
|
|
|
|
>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
<template v-slot:top-tool-right>
|
2021-05-17 16:41:01 +08:00
|
|
|
|
<button id="alert-add" v-has="'alertRule_add'" :title="$t('overall.createAlertRule')" class="top-tool-btn"
|
|
|
|
|
|
@click="add">
|
|
|
|
|
|
<i class="nz-icon-create-square nz-icon"></i>
|
|
|
|
|
|
</button>
|
2021-12-21 19:19:35 +08:00
|
|
|
|
<top-tool-more-options
|
2021-11-02 15:47:17 +08:00
|
|
|
|
:delete-objs="batchDeleteObjs"
|
2021-05-17 16:41:01 +08:00
|
|
|
|
ref="export"
|
2021-04-13 20:33:12 +08:00
|
|
|
|
id="alert-rule"
|
|
|
|
|
|
:params="searchLabel"
|
2022-01-11 17:05:21 +08:00
|
|
|
|
:permissions="{import: 'alertRule_add', export: 'alertRule_edit'}"
|
2021-05-17 16:41:01 +08:00
|
|
|
|
class="top-tool-export margin-l-10 margin-r-10"
|
2021-04-13 20:33:12 +08:00
|
|
|
|
export-file-name="AlertRule"
|
|
|
|
|
|
export-url="/alert/rule/export"
|
|
|
|
|
|
import-url="/alert/rule/import"
|
|
|
|
|
|
@afterImport="getTableData"
|
|
|
|
|
|
>
|
2021-05-17 16:41:01 +08:00
|
|
|
|
<template v-slot:before>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-dropdown-item>
|
|
|
|
|
|
<delete-button :type="'link'" :title="$t('overall.batchDel')" id="alert-rule-batch-delete" v-has="'alertRule_delete'" :api="url" :delete-objs="batchDeleteObjs" @after="getTableData" @before="delFlag=true"></delete-button>
|
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
|
</div>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
</template>
|
2021-05-17 16:41:01 +08:00
|
|
|
|
</top-tool-more-options>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:default="slotProps">
|
|
|
|
|
|
<alert-rule-table
|
|
|
|
|
|
ref="dataTable"
|
2022-03-04 13:59:25 +08:00
|
|
|
|
:orderByFa="orderBy"
|
2022-03-25 15:40:05 +08:00
|
|
|
|
v-my-loading="tools.loading"
|
2021-10-25 14:38:43 +08:00
|
|
|
|
:loading="tools.loading"
|
2021-04-13 20:33:12 +08:00
|
|
|
|
:api="url"
|
|
|
|
|
|
:custom-table-title="tools.customTableTitle"
|
|
|
|
|
|
:height="mainTableHeight"
|
|
|
|
|
|
:table-data="tableData"
|
|
|
|
|
|
@del="del"
|
|
|
|
|
|
@edit="edit"
|
2021-08-26 14:51:38 +08:00
|
|
|
|
@copy="copy"
|
2021-04-13 20:33:12 +08:00
|
|
|
|
@orderBy="tableDataSort"
|
|
|
|
|
|
@queryMessage="queryMessage"
|
|
|
|
|
|
@reload="getTableData"
|
2021-06-01 14:26:09 +08:00
|
|
|
|
@addSilence="addSilence"
|
2021-08-30 15:02:44 +08:00
|
|
|
|
@statusChange='statusChange'
|
2021-04-13 20:33:12 +08:00
|
|
|
|
@selectionChange="selectionChange"
|
|
|
|
|
|
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"></alert-rule-table>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 分页组件 -->
|
|
|
|
|
|
<template v-slot:pagination>
|
|
|
|
|
|
<Pagination ref="Pagination" :pageObj="pageObj" :tableId="tableId" @pageNo='pageNo' @pageSize='pageSize'></Pagination>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</nz-data-list>
|
|
|
|
|
|
<transition name="right-box">
|
2022-06-30 15:47:54 +08:00
|
|
|
|
<alert-rule-box v-if="rightBox.show" ref="alertConfigBox" :severityData="severityData" :alert-rule="object" @close="closeRightBox"></alert-rule-box>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
</transition>
|
2021-06-01 15:19:47 +08:00
|
|
|
|
<transition name="right-box"><alert-silence-box v-if='silenceBoxShow' :alert-silence="objectSilence" @close="closeSilenceBox"></alert-silence-box>
|
2021-12-21 19:19:35 +08:00
|
|
|
|
</transition>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import bus from '@/libs/bus'
|
|
|
|
|
|
import exportXLSX from '@/components/common/exportXLSX'
|
|
|
|
|
|
import alertRuleBox from '@/components/common/rightBox/alertRuleBox'
|
|
|
|
|
|
import deleteButton from '@/components/common/deleteButton'
|
|
|
|
|
|
import nzDataList from '@/components/common/table/nzDataList'
|
|
|
|
|
|
import dataListMixin from '@/components/common/mixin/dataList'
|
|
|
|
|
|
import alertRuleTable from '@/components/common/table/alert/alertRuleTable'
|
2021-05-17 16:41:01 +08:00
|
|
|
|
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
|
2021-06-01 15:19:47 +08:00
|
|
|
|
import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox'
|
2021-10-20 14:53:28 +08:00
|
|
|
|
import nzDetailView from '@/components/common/detailView/nzDetailView'
|
|
|
|
|
|
import detailViewMixin from '@/components/common/mixin/detailViewMixin'
|
|
|
|
|
|
import alertRuleDetail from '@/components/common/detailView/list/alertRule/alertRuleDetail'
|
|
|
|
|
|
import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch'
|
2021-12-21 19:19:35 +08:00
|
|
|
|
import routerPathParams from '@/components/common/mixin/routerPathParams'
|
2021-05-17 16:41:01 +08:00
|
|
|
|
|
2021-04-13 20:33:12 +08:00
|
|
|
|
export default {
|
2021-06-17 11:24:38 +08:00
|
|
|
|
name: 'alertRule',
|
2021-04-13 20:33:12 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
deleteButton,
|
|
|
|
|
|
alertRuleBox,
|
|
|
|
|
|
alertRuleTable,
|
|
|
|
|
|
nzDataList,
|
2021-05-17 16:41:01 +08:00
|
|
|
|
'export-excel': exportXLSX,
|
2021-06-01 14:26:09 +08:00
|
|
|
|
topToolMoreOptions,
|
2021-10-20 14:53:28 +08:00
|
|
|
|
alertSilenceBox,
|
|
|
|
|
|
nzDetailView,
|
|
|
|
|
|
alertRuleDetail,
|
|
|
|
|
|
detailViewTopSearch
|
2021-04-13 20:33:12 +08:00
|
|
|
|
},
|
2021-12-21 19:19:35 +08:00
|
|
|
|
mixins: [dataListMixin, detailViewMixin, routerPathParams],
|
2021-04-13 20:33:12 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
url: 'alert/rule',
|
|
|
|
|
|
tableId: 'alertRuleTable', // 需要分页的table的id,用于记录每页数量
|
2021-12-21 19:19:35 +08:00
|
|
|
|
orderBy: 'id',
|
|
|
|
|
|
searchLabel: {},
|
2021-04-13 20:33:12 +08:00
|
|
|
|
blankObject: {
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
alertName: '',
|
|
|
|
|
|
linkObject: { id: '', name: '' },
|
|
|
|
|
|
expr: '',
|
2021-09-08 17:15:59 +08:00
|
|
|
|
state: 1,
|
2021-09-03 17:23:41 +08:00
|
|
|
|
type: 1,
|
2021-04-13 20:33:12 +08:00
|
|
|
|
unit: 2,
|
|
|
|
|
|
operator: '>',
|
|
|
|
|
|
last: 60,
|
2022-06-30 15:47:54 +08:00
|
|
|
|
// severityId: '',
|
2021-04-13 20:33:12 +08:00
|
|
|
|
summary: '',
|
2021-05-08 09:40:53 +08:00
|
|
|
|
description: '',
|
2021-09-08 17:15:59 +08:00
|
|
|
|
method: [],
|
|
|
|
|
|
name: '',
|
2022-06-30 15:47:54 +08:00
|
|
|
|
// threshold: '',
|
2021-09-08 17:15:59 +08:00
|
|
|
|
receiver: [],
|
|
|
|
|
|
autoExpired: 1,
|
|
|
|
|
|
schedEnable: 0,
|
|
|
|
|
|
schedDays: '',
|
|
|
|
|
|
schedStime: '00:00',
|
|
|
|
|
|
schedEtime: '23:59',
|
2021-09-10 14:46:08 +08:00
|
|
|
|
notifyActive: 0,
|
|
|
|
|
|
notifyExpired: 0,
|
|
|
|
|
|
timeout: 300,
|
2022-06-30 15:47:54 +08:00
|
|
|
|
trbShot: '',
|
|
|
|
|
|
condition: []
|
2021-04-13 20:33:12 +08:00
|
|
|
|
},
|
2021-06-01 14:26:09 +08:00
|
|
|
|
blankSilenceObject: {
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
startAt: '',
|
|
|
|
|
|
endAt: '',
|
|
|
|
|
|
ruleId: '',
|
|
|
|
|
|
type: 'asset',
|
|
|
|
|
|
linkId: '',
|
|
|
|
|
|
remark: '',
|
|
|
|
|
|
time: [],
|
|
|
|
|
|
matchers: [
|
|
|
|
|
|
{ name: '', value: '', regex: 0 }
|
|
|
|
|
|
],
|
|
|
|
|
|
name: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
objectSilence: {},
|
|
|
|
|
|
silenceBoxShow: false,
|
2021-04-13 20:33:12 +08:00
|
|
|
|
searchMsg: { // 给搜索框子组件传递的信息
|
|
|
|
|
|
zheze_none: true,
|
2022-06-30 15:47:54 +08:00
|
|
|
|
searchLabelList: [
|
|
|
|
|
|
{
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
name: 'ID',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'ids',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id: 2,
|
|
|
|
|
|
name: this.$t('alert.alertName'),
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'name',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
},
|
|
|
|
|
|
// {
|
|
|
|
|
|
// id: 4,
|
|
|
|
|
|
// name: this.$t('alert.severity'),
|
|
|
|
|
|
// type: 'severity',
|
|
|
|
|
|
// label: 'severityIds',
|
|
|
|
|
|
// readonly: true,
|
|
|
|
|
|
// disabled: false
|
|
|
|
|
|
// },
|
|
|
|
|
|
{
|
|
|
|
|
|
id: 5,
|
|
|
|
|
|
name: this.$t('overall.type'),
|
|
|
|
|
|
type: 'alertTypes',
|
|
|
|
|
|
label: 'type',
|
|
|
|
|
|
readonly: true,
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
2021-04-13 20:33:12 +08:00
|
|
|
|
},
|
2022-02-25 14:31:36 +08:00
|
|
|
|
searchTime: bus.getTimezontDateRange(),
|
|
|
|
|
|
needAlertDaysData: true,
|
2022-03-07 09:37:27 +08:00
|
|
|
|
trendKey: 'ruleId'
|
2021-04-13 20:33:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
queryMessage (alertRule) {
|
|
|
|
|
|
if (!this.hasButton('alertMessage_view')) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2021-05-08 18:08:32 +08:00
|
|
|
|
this.$refs.dataList.showBottomBox('alertRuleAlertMessage', alertRule)
|
2021-04-13 20:33:12 +08:00
|
|
|
|
},
|
|
|
|
|
|
getTableData () {
|
2021-10-13 18:24:09 +08:00
|
|
|
|
if (this.orderBy) {
|
|
|
|
|
|
this.$set(this.searchLabel, 'orderBy', this.orderBy)
|
2022-03-03 17:35:42 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
delete this.searchLabel.orderBy
|
2021-10-13 18:24:09 +08:00
|
|
|
|
}
|
2021-04-13 20:33:12 +08:00
|
|
|
|
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
|
|
|
|
|
|
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
|
|
|
|
|
|
this.tools.loading = true
|
2021-12-22 14:20:13 +08:00
|
|
|
|
const param = {
|
|
|
|
|
|
...this.searchLabel
|
|
|
|
|
|
}
|
|
|
|
|
|
const path = this.fromRoute.alertRule
|
|
|
|
|
|
this.updatePath(param, path)
|
2021-04-13 20:33:12 +08:00
|
|
|
|
this.$get(this.url, this.searchLabel).then(response => {
|
|
|
|
|
|
this.tools.loading = false
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
response.data.list.forEach(item => {
|
|
|
|
|
|
let temp = []
|
|
|
|
|
|
if (item.receiver) {
|
|
|
|
|
|
temp = item.receiver.split(',').map(t => {
|
|
|
|
|
|
return parseInt(t)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
item.receiverShow = temp
|
|
|
|
|
|
})
|
2022-02-25 14:31:36 +08:00
|
|
|
|
if (this.needAlertDaysData) {
|
|
|
|
|
|
response.data.list.forEach(item => {
|
|
|
|
|
|
item.trendLoading = true
|
2022-03-07 09:37:27 +08:00
|
|
|
|
item.left = 0
|
|
|
|
|
|
item.top = 0
|
|
|
|
|
|
item.alertNumtooltipShow = false
|
2022-02-25 14:31:36 +08:00
|
|
|
|
item.alertDaysData = [
|
|
|
|
|
|
{
|
|
|
|
|
|
metric: { priority: 'P1' },
|
|
|
|
|
|
values: [[0, 0]]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
metric: { priority: 'P2' },
|
|
|
|
|
|
values: [[0, 0]]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
metric: { priority: 'P3' },
|
|
|
|
|
|
values: [[0, 0]]
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-04-13 20:33:12 +08:00
|
|
|
|
this.tableData = response.data.list
|
2022-01-18 10:06:33 +08:00
|
|
|
|
const globalSearchId = this.$store.getters.getGlobalSearchId
|
|
|
|
|
|
let detailViewRightObj = ''
|
|
|
|
|
|
if (globalSearchId) {
|
|
|
|
|
|
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
detailViewRightObj = this.tableData[0]
|
|
|
|
|
|
}
|
|
|
|
|
|
this.detailViewRightObj = detailViewRightObj
|
2021-04-13 20:33:12 +08:00
|
|
|
|
this.pageObj.total = response.data.total
|
2021-10-20 14:53:28 +08:00
|
|
|
|
this.pageObj.pages = response.data.pages
|
2022-03-07 09:37:27 +08:00
|
|
|
|
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
|
2021-04-13 20:33:12 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
|
|
|
|
|
|
this.toTopBtnHandler(this.scrollbarWrap)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-08-30 15:02:44 +08:00
|
|
|
|
statusChange (alertRule) {
|
|
|
|
|
|
const params = { ...alertRule, severity: null }
|
|
|
|
|
|
this.$put(this.url, params).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.rightBox.show = false
|
|
|
|
|
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-08-26 14:51:38 +08:00
|
|
|
|
edit (u, copyFlag) {
|
2021-05-08 09:40:53 +08:00
|
|
|
|
this.$get(`${this.url}/${u.id}`).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.object = {
|
|
|
|
|
|
...response.data,
|
2021-05-12 19:07:07 +08:00
|
|
|
|
method: response.data.method ? response.data.method.split(',').map(item => Number(item)) : [],
|
2021-09-08 17:15:59 +08:00
|
|
|
|
schedDays: response.data.schedDays ? response.data.schedDays.split(',').map(item => Number(item)) : [],
|
2021-05-12 19:07:07 +08:00
|
|
|
|
receiverShow: response.data.receiver ? response.data.receiver.split(',').map(item => Number(item)) : []
|
2021-05-08 09:40:53 +08:00
|
|
|
|
}
|
2021-11-17 11:35:18 +08:00
|
|
|
|
if (this.object.inr == 0) {
|
|
|
|
|
|
this.object.inr = undefined
|
|
|
|
|
|
}
|
2021-08-26 14:51:38 +08:00
|
|
|
|
if (copyFlag) {
|
|
|
|
|
|
this.object.id = ''
|
|
|
|
|
|
this.object.name = this.object.name + '-copy'
|
|
|
|
|
|
if (this.object.name.length > 64) {
|
|
|
|
|
|
const length = this.object.name.length - 64
|
|
|
|
|
|
this.object.name = u.name.substring(0, u.name.length - length) + '-copy'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-05-08 09:40:53 +08:00
|
|
|
|
this.rightBox.show = true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-08-26 14:51:38 +08:00
|
|
|
|
},
|
|
|
|
|
|
copy (u) {
|
|
|
|
|
|
this.edit(u, true)
|
2022-06-30 15:47:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
getSeverityData () {
|
|
|
|
|
|
this.$get('alert/severity', { pageNo: 1, pageSize: -1 }).then(response => {
|
|
|
|
|
|
if (response.code == 200) {
|
|
|
|
|
|
this.severityData = response.data.list
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-04-13 20:33:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-12-21 19:19:35 +08:00
|
|
|
|
created () {
|
2021-12-22 14:20:13 +08:00
|
|
|
|
const searchKeys = {
|
|
|
|
|
|
// key: path 键
|
|
|
|
|
|
// value: vue set 参数
|
|
|
|
|
|
pageNo: { target: this.pageObj, propertyName: 'pageNo', type: 'number' },
|
|
|
|
|
|
pageSize: { target: this.pageObj, propertyName: 'pageSize', type: 'number' },
|
|
|
|
|
|
orderBy: { target: this.$data, propertyName: 'orderBy', type: 'string' },
|
2021-12-22 19:54:51 +08:00
|
|
|
|
ids: {
|
|
|
|
|
|
target: this.searchLabel,
|
2022-01-05 10:34:22 +08:00
|
|
|
|
isSearchInput: true,
|
2021-12-22 19:54:51 +08:00
|
|
|
|
propertyName: 'ids',
|
|
|
|
|
|
type: 'string',
|
|
|
|
|
|
defaultJson: {
|
|
|
|
|
|
disabled: false,
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
label: 'ids',
|
|
|
|
|
|
name: 'ID',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
val: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
jsonKey: 'val'
|
|
|
|
|
|
},
|
2022-06-30 15:47:54 +08:00
|
|
|
|
// severityIds: {
|
|
|
|
|
|
// target: this.searchLabel,
|
|
|
|
|
|
// isSearchInput: true,
|
|
|
|
|
|
// propertyName: 'severityIds',
|
|
|
|
|
|
// type: 'string',
|
|
|
|
|
|
// defaultJson: {
|
|
|
|
|
|
// disabled: false,
|
|
|
|
|
|
// id: 4,
|
|
|
|
|
|
// label: 'severityIds',
|
|
|
|
|
|
// name: 'Priority',
|
|
|
|
|
|
// readonly: true,
|
|
|
|
|
|
// type: 'severity',
|
|
|
|
|
|
// val: '',
|
|
|
|
|
|
// valnum: '',
|
|
|
|
|
|
// valString: '',
|
|
|
|
|
|
// listStr: 'severitySelect'
|
|
|
|
|
|
// },
|
|
|
|
|
|
// jsonKey: 'valnum'
|
|
|
|
|
|
// },
|
2021-12-22 14:55:22 +08:00
|
|
|
|
type: {
|
|
|
|
|
|
target: this.searchLabel,
|
2022-01-05 10:34:22 +08:00
|
|
|
|
isSearchInput: true,
|
2021-12-22 14:55:22 +08:00
|
|
|
|
propertyName: 'type',
|
|
|
|
|
|
type: 'number',
|
2021-12-22 19:54:51 +08:00
|
|
|
|
defaultJson: {
|
|
|
|
|
|
name: 'Type',
|
|
|
|
|
|
id: 5,
|
|
|
|
|
|
type: 'alertTypes',
|
|
|
|
|
|
label: 'type',
|
|
|
|
|
|
disabled: false,
|
|
|
|
|
|
readonly: true,
|
|
|
|
|
|
val: '',
|
|
|
|
|
|
valnum: '',
|
2021-12-24 14:44:04 +08:00
|
|
|
|
listStr: 'alertTypesSelect'
|
2021-12-22 19:54:51 +08:00
|
|
|
|
},
|
2021-12-23 20:24:18 +08:00
|
|
|
|
jsonKey: 'valnum'
|
2021-12-22 14:55:22 +08:00
|
|
|
|
},
|
|
|
|
|
|
name: {
|
|
|
|
|
|
target: this.searchLabel,
|
2022-01-05 10:34:22 +08:00
|
|
|
|
isSearchInput: true,
|
2021-12-22 14:55:22 +08:00
|
|
|
|
propertyName: 'name',
|
|
|
|
|
|
type: 'string',
|
2021-12-22 19:54:51 +08:00
|
|
|
|
defaultJson: {
|
|
|
|
|
|
disabled: false,
|
|
|
|
|
|
id: 2,
|
|
|
|
|
|
label: 'name',
|
|
|
|
|
|
name: 'Name',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
val: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
jsonKey: 'val'
|
2021-12-22 14:55:22 +08:00
|
|
|
|
}
|
2021-12-22 14:20:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.initQueryFromPath(searchKeys)
|
2022-06-30 15:47:54 +08:00
|
|
|
|
this.getSeverityData()
|
2021-12-21 19:19:35 +08:00
|
|
|
|
},
|
2021-04-13 20:33:12 +08:00
|
|
|
|
mounted () {
|
2021-05-12 16:19:43 +08:00
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
$route: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
handler () {
|
|
|
|
|
|
const add = this.$route.query.add
|
|
|
|
|
|
if (add) {
|
|
|
|
|
|
if (add === 'alertRule') {
|
|
|
|
|
|
this.add()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-05-11 22:29:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-04-13 20:33:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|