报警邮件设置 未完成
This commit is contained in:
parent
674198c8b8
commit
34eda2a916
46
src/api/alarm/index.js
Normal file
46
src/api/alarm/index.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
//big/getScreen
|
||||||
|
|
||||||
|
//监控列表
|
||||||
|
export function getEmailList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/email/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取监控列表详情
|
||||||
|
export function getEmailInfo(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/email/getInfo?deviceId=' + query,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加监控列表
|
||||||
|
export function AddEmailAlarm(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/email/add',
|
||||||
|
method: 'post',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改监控列表
|
||||||
|
export function EditEmailAlarm(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/email/edit',
|
||||||
|
method: 'put',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除监控列表
|
||||||
|
export function DeleteEmailAlarm(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/email/remove?deviceId=' + query,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -15,8 +15,8 @@
|
|||||||
</template>
|
</template>
|
||||||
<el-input v-model="prop.form.email" placeholder="邮箱" />
|
<el-input v-model="prop.form.email" placeholder="邮箱" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="监控类型">
|
<el-form-item label="设备类型">
|
||||||
<el-select v-model="prop.form.typeId" @change="typeChange" filterable placeholder="选择监控类型">
|
<el-select v-model="prop.form.typeId" @change="typeChange" filterable placeholder="选择设备类型">
|
||||||
<el-option value="" label="请选择"></el-option>
|
<el-option value="" label="请选择"></el-option>
|
||||||
<el-option v-for="item in monitorList" :key="item.value" :label="item.label" :value="item.value" />
|
<el-option v-for="item in monitorList" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
@ -49,8 +49,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch, getCurrentInstance } from 'vue'
|
import { ref, watch, getCurrentInstance,onMounted } from 'vue'
|
||||||
import { Check, Close } from '@element-plus/icons-vue'
|
import { Check, Close } from '@element-plus/icons-vue'
|
||||||
|
import { getDeptList } from '@/api/big/dept'
|
||||||
import { addScreen, updateScreen } from '@/api/big/screen'
|
import { addScreen, updateScreen } from '@/api/big/screen'
|
||||||
import { getDeviceTypeList } from '@/api/big/deviceType'
|
import { getDeviceTypeList } from '@/api/big/deviceType'
|
||||||
import { getDeviceList } from '@/api/big/device'
|
import { getDeviceList } from '@/api/big/device'
|
||||||
@ -80,21 +81,24 @@ const prop = defineProps({
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
let monitorList = ref([
|
let monitorList = ref()
|
||||||
{ label: '设备', value: 1 },
|
//获取设备类型列表
|
||||||
{ label: '类型', value: 2 }
|
function remoteMethodTypeId() {
|
||||||
])
|
getDeviceTypeList({ pageSize: 100 }).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
monitorList.value = res.rows.map(item => {
|
||||||
|
return {
|
||||||
|
label: item.desc,
|
||||||
|
value: item.desc
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function typeChange(val) {
|
function typeChange(val) {
|
||||||
prop.form.ids = undefined
|
emit('clearIds')
|
||||||
if (val == 1) {
|
DeviceList(val)
|
||||||
DeviceList()
|
|
||||||
} else if(val == 2) {
|
|
||||||
remoteMethodTypeId()
|
|
||||||
} else {
|
|
||||||
optionsList.value = []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const optionsList = ref([])
|
const optionsList = ref([])
|
||||||
const { proxy: ctx } = getCurrentInstance()
|
const { proxy: ctx } = getCurrentInstance()
|
||||||
@ -112,7 +116,7 @@ const handleOpen = () => {
|
|||||||
|
|
||||||
|
|
||||||
// 刷新表格事件
|
// 刷新表格事件
|
||||||
const emit = defineEmits(['refreshTable', 'closeDialog'])
|
const emit = defineEmits(['refreshTable', 'closeDialog','clearIds'])
|
||||||
// 添加/修改
|
// 添加/修改
|
||||||
async function addDeductionInfo() {
|
async function addDeductionInfo() {
|
||||||
emit('closeDialog')
|
emit('closeDialog')
|
||||||
@ -150,9 +154,9 @@ const handleConfirm = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 查询设备列表 */
|
/** 查询设备列表 */
|
||||||
function DeviceList() {
|
function DeviceList(type) {
|
||||||
// console.log(JSON.stringify(queryParams.value));
|
// console.log(JSON.stringify(queryParams.value));
|
||||||
getDeviceList({userId: 1}).then(res => {
|
getDeviceList({userId: 1,type}).then(res => {
|
||||||
optionsList.value = res.rows.map(item => {
|
optionsList.value = res.rows.map(item => {
|
||||||
return {
|
return {
|
||||||
label: item.name,
|
label: item.name,
|
||||||
@ -160,22 +164,11 @@ function DeviceList() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取设备类型列表
|
onMounted(() => {
|
||||||
function remoteMethodTypeId() {
|
remoteMethodTypeId()
|
||||||
getDeviceTypeList({ pageSize: 100 }).then(res => {
|
})
|
||||||
if (res.code === 200) {
|
|
||||||
optionsList.value = res.rows.map(item => {
|
|
||||||
return {
|
|
||||||
label: item.desc,
|
|
||||||
value: item.id
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,4 @@
|
|||||||
<!--
|
|
||||||
* @FilePath: \code\Goats-Cloud-ui\src\views\big\device\index.vue
|
|
||||||
* @Author: 王路平
|
|
||||||
* @文件版本: V1.0.0
|
|
||||||
* @Date: 2023-06-17 08:22:57
|
|
||||||
* @Description:
|
|
||||||
*
|
|
||||||
* 版权信息 : 2023 by ${再登软件}, All Rights Reserved.
|
|
||||||
-->
|
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
|
||||||
@ -26,10 +18,10 @@
|
|||||||
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.label" />
|
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.label" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="部门名称" prop="dept">
|
<!-- <el-form-item label="部门名称" prop="dept">
|
||||||
<el-input v-model="queryParams.dept" placeholder="请输入部门名称" clearable style="width: 200px"
|
<el-input v-model="queryParams.dept" placeholder="请输入部门名称" clearable style="width: 200px"
|
||||||
@keyup.enter="handleQuery" />
|
@keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
@ -57,14 +49,13 @@
|
|||||||
<el-table-column label="序号" type="index" width="120" />
|
<el-table-column label="序号" type="index" width="120" />
|
||||||
<!-- <el-table-column label="部门id" prop="id" width="120" /> -->
|
<!-- <el-table-column label="部门id" prop="id" width="120" /> -->
|
||||||
<el-table-column label="设备名称" prop="name" :show-overflow-tooltip="true" />
|
<el-table-column label="设备名称" prop="name" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="机架号" prop="label" :show-overflow-tooltip="true" />
|
<el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="类型" prop="type" :show-overflow-tooltip="true" />
|
<!-- <el-table-column label="类型" prop="type" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="型号" prop="model" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="型号" prop="model" align="center" :show-overflow-tooltip="true" /> -->
|
||||||
<el-table-column label="所属部门" prop="deptName" align="center" :show-overflow-tooltip="true" />
|
<el-table-column label="是否启用" align="center" :show-overflow-tooltip="true">
|
||||||
<el-table-column label="状态" align="center" :show-overflow-tooltip="true">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.status == 'true'" type="success">在线</el-tag>
|
<el-tag v-if="scope.row.enable == '启用'" type="success">启用</el-tag>
|
||||||
<el-tag v-else type="warning">离线</el-tag>
|
<el-tag v-else type="warning">未启用</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
||||||
@ -85,7 +76,7 @@
|
|||||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
<add_edit @closeDialog="open = false" :type="type" :title="title" :form="form" :visible="open"
|
<add_edit @closeDialog="open = false" :type="type" :title="title" :form="form" :visible="open"
|
||||||
@refreshTable="getList" />
|
@refreshTable="getList" @clearIds="clearIds" />
|
||||||
<!-- <assemblyVue @closeDialog="assemblyOpen = false" :form="assemblyForm" :title="assemblyTitle" :visible="assemblyOpen"></assemblyVue>
|
<!-- <assemblyVue @closeDialog="assemblyOpen = false" :form="assemblyForm" :title="assemblyTitle" :visible="assemblyOpen"></assemblyVue>
|
||||||
<el-dialog v-model="imgDialogVisible">
|
<el-dialog v-model="imgDialogVisible">
|
||||||
<img w-full :src="dialogImageUrl" alt="Preview Image" class="img-preview" />
|
<img w-full :src="dialogImageUrl" alt="Preview Image" class="img-preview" />
|
||||||
@ -98,15 +89,12 @@
|
|||||||
import { ref, reactive, toRefs, getCurrentInstance, onMounted } from 'vue'
|
import { ref, reactive, toRefs, getCurrentInstance, onMounted } from 'vue'
|
||||||
import { Picture as IconPicture } from '@element-plus/icons-vue'
|
import { Picture as IconPicture } from '@element-plus/icons-vue'
|
||||||
import { getDeviceList, delDevice } from '@/api/big/device'
|
import { getDeviceList, delDevice } from '@/api/big/device'
|
||||||
import { getDeptList } from '@/api/big/dept'
|
import { getEmailList, getEmailInfo,AddEmailAlarm,EditEmailAlarm,DeleteEmailAlarm} from '@/api/alarm/index'
|
||||||
import { getDeviceTypeList } from '@/api/big/deviceType'
|
|
||||||
import useDeviceStore from '@/store/modules/device'
|
import useDeviceStore from '@/store/modules/device'
|
||||||
import add_edit from './components/add_edit.vue'
|
import add_edit from './components/add_edit.vue'
|
||||||
import useUserStore from '@/store/modules/user'
|
|
||||||
// import assemblyVue from './components/assembly'
|
// import assemblyVue from './components/assembly'
|
||||||
// import devInfo from './components/devInfo.vue'
|
// import devInfo from './components/devInfo.vue'
|
||||||
const store = useDeviceStore()
|
const store = useDeviceStore()
|
||||||
const userStore = useUserStore()
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
@ -142,13 +130,13 @@ const type = ref("add");
|
|||||||
const typeList = ref([])
|
const typeList = ref([])
|
||||||
/** 查询设备列表 */
|
/** 查询设备列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
// loading.value = true;
|
loading.value = true;
|
||||||
// console.log(JSON.stringify(queryParams.value));
|
// console.log(JSON.stringify(queryParams.value));
|
||||||
// getDeviceList(queryParams.value).then(res => {
|
getEmailList(queryParams.value).then(res => {
|
||||||
// loading.value = false;
|
loading.value = false;
|
||||||
// deviceList.value = res.rows;
|
deviceList.value = res.rows;
|
||||||
// total.value = res.total;
|
total.value = res.total;
|
||||||
// });
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +149,9 @@ function resetQuery() {
|
|||||||
proxy.resetForm("queryRef");
|
proxy.resetForm("queryRef");
|
||||||
handleQuery();
|
handleQuery();
|
||||||
}
|
}
|
||||||
|
function clearIds() {
|
||||||
|
form.value.ids = []
|
||||||
|
}
|
||||||
|
|
||||||
/** 添加部门 */
|
/** 添加部门 */
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
@ -218,59 +209,14 @@ function handleSelectionChange(selection) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//获取设备类型列表
|
|
||||||
function remoteMethodTypeId() {
|
|
||||||
getDeviceTypeList({ pageSize: 100 }).then(res => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
typeList.value = res.rows.map(item => {
|
|
||||||
return {
|
|
||||||
label: item.desc,
|
|
||||||
value: item.id
|
|
||||||
}
|
|
||||||
})
|
|
||||||
store.setTypeList(typeList.value)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取部门列表
|
|
||||||
function remoteMethodDeptId() {
|
|
||||||
getDeptList({ pageSize: 100 }).then(res => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
let deptList = res.rows.map(item => {
|
|
||||||
return {
|
|
||||||
label: item.deptName,
|
|
||||||
value: String(item.deptId)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
store.setDeptList(deptList)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
//获取网关列表
|
|
||||||
function remoteMethodGetwayId() {
|
|
||||||
getDeviceList({ pageNum: 1,pageSize: 100, type: '网关',userId:1 }).then(res => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
let getwayList = res.rows.map(item => {
|
|
||||||
return {
|
|
||||||
label: item.name,
|
|
||||||
value: item.id
|
|
||||||
}
|
|
||||||
})
|
|
||||||
store.setGetwayList(getwayList)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取表单选项
|
|
||||||
function getAddFormOptions() {
|
|
||||||
remoteMethodTypeId()
|
|
||||||
remoteMethodDeptId()
|
|
||||||
remoteMethodGetwayId()
|
|
||||||
}
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
getAddFormOptions()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user