|
@@ -0,0 +1,217 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="alarm-config-page">
|
|
|
|
|
+ <div class="alarm-config-header">
|
|
|
|
|
+ <div class="alarm-config-rollback" @click="">
|
|
|
|
|
+ <img src="../reportmessage/img/rollback.png" /><span>返回</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <span>新建报表配置</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="alarm-config-content">
|
|
|
|
|
+ <div class="alarm-config-form">
|
|
|
|
|
+ <el-form ref="formRef" :model="alarmConfigForm" :rules="rules" label-width="auto">
|
|
|
|
|
+ <el-form-item label="违规类型:">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ class="alarm-config-input"
|
|
|
|
|
+ v-model="alarmConfigForm.violationType"
|
|
|
|
|
+ placeholder="请选择违规类型"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in AlarmTypes"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ /></el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="报警等级:">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ class="alarm-config-input"
|
|
|
|
|
+ v-model="alarmConfigForm.violationLevel"
|
|
|
|
|
+ placeholder="请选择报警等级"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in AlarmLevels"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ /></el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="推送渠道:">
|
|
|
|
|
+ <el-checkbox-group v-model="alarmConfigForm.pushChannel">
|
|
|
|
|
+ <el-checkbox
|
|
|
|
|
+ v-for="channel in PushChannels"
|
|
|
|
|
+ :key="channel.id"
|
|
|
|
|
+ :label="channel.label"
|
|
|
|
|
+ :value="channel.id"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-checkbox>
|
|
|
|
|
+ </el-checkbox-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="推送阶段:">
|
|
|
|
|
+ <el-checkbox-group
|
|
|
|
|
+ class="alarm-config-checkbox-group"
|
|
|
|
|
+ v-model="alarmConfigForm.pushOccasions"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div v-for="occasion in PushOccasions">
|
|
|
|
|
+ <el-checkbox :key="occasion.id" :label="occasion.label" :value="occasion.id">
|
|
|
|
|
+ </el-checkbox>
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-if="alarmConfigForm.pushPhaseVOList.some((it) => it.pushPhase === occasion.id)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <PushOccasionsCard
|
|
|
|
|
+ :form="alarmConfigForm.pushPhaseVOList.find((it) => it.pushPhase === occasion.id)!"
|
|
|
|
|
+ :type="AlarmTypes.find((it) => it.id === alarmConfigForm.violationType)?.label!"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-checkbox-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="创建人:">
|
|
|
|
|
+ <el-input class="alarm-config-input" v-model="alarmConfigForm.creator" disabled />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item> </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <div style="text-align: right; margin-right: 32px">
|
|
|
|
|
+ <el-button> 取 消 </el-button>
|
|
|
|
|
+ <el-button type="primary" @click="submitForm(formRef)"> 确 定 </el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="alarm-config-example">
|
|
|
|
|
+ <AlarmExample />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script setup lang="ts">
|
|
|
|
|
+ import PushOccasionsCard from './components/PushOccasionsCard.vue';
|
|
|
|
|
+ import AlarmExample from './components/AlarmExample.vue';
|
|
|
|
|
+ import {
|
|
|
|
|
+ ElForm,
|
|
|
|
|
+ ElFormItem,
|
|
|
|
|
+ ElSelect,
|
|
|
|
|
+ ElCheckboxGroup,
|
|
|
|
|
+ ElCheckbox,
|
|
|
|
|
+ FormInstance,
|
|
|
|
|
+ FormRules,
|
|
|
|
|
+ } from 'element-plus';
|
|
|
|
|
+ import { AlarmConfigForm } from './types';
|
|
|
|
|
+ import { ref, watch } from 'vue';
|
|
|
|
|
+ import { useUserStore } from '@/store/modules/user';
|
|
|
|
|
+
|
|
|
|
|
+ const useUser = useUserStore();
|
|
|
|
|
+
|
|
|
|
|
+ const alarmConfigForm = ref<AlarmConfigForm>({
|
|
|
|
|
+ violationType: undefined,
|
|
|
|
|
+ violationLevel: undefined,
|
|
|
|
|
+ pushChannel: [],
|
|
|
|
|
+ pushOccasions: [],
|
|
|
|
|
+ pushPhaseVOList: [],
|
|
|
|
|
+ creator: useUser.info.nickname,
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ watch(
|
|
|
|
|
+ () => alarmConfigForm.value.pushOccasions,
|
|
|
|
|
+ () => {
|
|
|
|
|
+ alarmConfigForm.value.pushOccasions.forEach((occasion) => {
|
|
|
|
|
+ if (!alarmConfigForm.value.pushPhaseVOList.some((it) => it.pushPhase === occasion)) {
|
|
|
|
|
+ alarmConfigForm.value.pushPhaseVOList.push({
|
|
|
|
|
+ pushPhase: occasion,
|
|
|
|
|
+ recipientType: undefined,
|
|
|
|
|
+ content: '',
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ alarmConfigForm.value.pushPhaseVOList.forEach((vo) => {
|
|
|
|
|
+ if (!alarmConfigForm.value.pushOccasions.some((occ) => occ === vo.pushPhase)) {
|
|
|
|
|
+ alarmConfigForm.value.pushPhaseVOList.splice(
|
|
|
|
|
+ alarmConfigForm.value.pushPhaseVOList.findIndex((it) => it.pushPhase === vo.pushPhase),
|
|
|
|
|
+ 1,
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ const formRef = ref<FormInstance>();
|
|
|
|
|
+
|
|
|
|
|
+ const rules = ref<FormRules<AlarmConfigForm>>();
|
|
|
|
|
+ // 违规类型
|
|
|
|
|
+ const AlarmTypes = [
|
|
|
|
|
+ { id: 1, label: '违规类型1' },
|
|
|
|
|
+ { id: 2, label: '违规类型2' },
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ // 报警等级
|
|
|
|
|
+ const AlarmLevels = [
|
|
|
|
|
+ { id: 1, label: '报警等级1' },
|
|
|
|
|
+ { id: 2, label: '报警等级2' },
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ // 推送渠道
|
|
|
|
|
+ const PushChannels = [
|
|
|
|
|
+ { id: 1, label: '平台' },
|
|
|
|
|
+ { id: 2, label: '蓝信' },
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ // 推送阶段
|
|
|
|
|
+ const PushOccasions = [
|
|
|
|
|
+ { id: 1, label: '问题发生时推送', value: {} },
|
|
|
|
|
+ { id: 2, label: '问题生效后推送', value: {} },
|
|
|
|
|
+ { id: 3, label: '审核通过后推送', value: {} },
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ const submitForm = async (formEl: FormInstance | undefined) => {
|
|
|
|
|
+ if (!formEl) return;
|
|
|
|
|
+ await formEl.validate((valid, fields) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ console.log('submit!');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log('error submit!', fields);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped lang="scss">
|
|
|
|
|
+ .alarm-config-page {
|
|
|
|
|
+ background-color: rgba(255, 255, 255, 1);
|
|
|
|
|
+ .alarm-config-header {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ padding: 16px 0 15px 20px;
|
|
|
|
|
+ border-bottom: 1px solid #e9e9e9;
|
|
|
|
|
+ .alarm-config-rollback {
|
|
|
|
|
+ width: 60px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .alarm-config-content {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ height: calc(100vh - 137px);
|
|
|
|
|
+
|
|
|
|
|
+ .alarm-config-form {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ padding: 20px 0 32px 32px;
|
|
|
|
|
+ width: 803px;
|
|
|
|
|
+ border-right: 1px solid rgba(0, 0, 0, 0.06);
|
|
|
|
|
+ overflow-y: auto;
|
|
|
|
|
+
|
|
|
|
|
+ .alarm-config-input {
|
|
|
|
|
+ max-width: 446px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .alarm-config-checkbox-group {
|
|
|
|
|
+ max-height: 556px;
|
|
|
|
|
+ overflow: auto;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .alarm-config-example {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|