完成GPS和监控警告

master
lynn 5 months ago
parent 6aaa72859f
commit ae1aba3583

@ -23,7 +23,6 @@ export function destroyGasConfig(params) {
}) })
} }
export function getGasList(params) { export function getGasList(params) {
return request({ return request({
url: '/api/admin/gas/index', url: '/api/admin/gas/index',
@ -32,4 +31,36 @@ export function getGasList(params) {
}) })
} }
export function saveConfig(data) {
return request({
url: '/api/admin/config/save',
method: 'post',
data
})
}
export function getConfigList(data) {
return request({
url: '/api/admin/config/index',
method: 'post',
data
})
}
export function getNotificationsList(params, options = {}) {
return request({
url: '/api/admin/other/notifications-list',
method: 'get',
params,
...options
})
}
export function getMileageStatistics(params, options = {}) {
return request({
url: '/api/admin/gps/mileage-statistics',
method: 'get',
params,
...options
})
}

@ -94,7 +94,8 @@
<script> <script>
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { getDrivingOverview, getDrivingTrend, getDrivingRanking } from '@/api/car/statistics' import qs from 'qs'
import { getMileageStatistics } from '@/api/monitor'
export default { export default {
data() { data() {
@ -139,28 +140,38 @@ export default {
}, },
async loadData() { async loadData() {
try { try {
// const params = {}
const overviewRes = await getDrivingOverview({ if (this.filterForm.type === 'month') {
type: this.filterForm.type, params.month = this.filterForm.date
date: this.filterForm.date } else {
params.year = this.filterForm.date
}
const res = await getMileageStatistics(params, {
paramsSerializer: params => qs.stringify(params, { arrayFormat: 'indices' })
}) })
this.overviewData = overviewRes.data const data = res || {}
// //
const trendRes = await getDrivingTrend({ this.overviewData = {
type: this.filterForm.type, totalMileage: Number(data.top?.total_mileage) || 0,
date: this.filterForm.date avgMileage: Number(data.top?.average_mileage) || 0,
}) maxMileage: Number(data.top?.highest_mileage) || 0,
this.chartData = trendRes.data minMileage: Number(data.top?.lowest_mileage) || 0
this.updateChart() }
// //
const rankingRes = await getDrivingRanking({ this.chartData = {
type: this.filterForm.type, xAxis: (data.list || []).map(item => item.day),
date: this.filterForm.date, series: (data.list || []).map(item => Number(item.total_mileage) || 0)
limit: 10 }
})
this.rankingData = rankingRes.data //
this.rankingData = (data.ranking || []).map(item => ({
deviceName: item.section_boats?.name || '-',
mileage: Number(item.total_mileage) || 0
}))
this.updateChart()
} catch (error) { } catch (error) {
console.error('加载数据失败:', error) console.error('加载数据失败:', error)
this.$message.error('加载数据失败') this.$message.error('加载数据失败')

@ -3,8 +3,8 @@
<div class="warning-page"> <div class="warning-page">
<div class="filter-header"> <div class="filter-header">
<el-form :inline="true" class="filter-form"> <el-form :inline="true" class="filter-form">
<el-form-item label="设备"> <el-form-item label="泵车名称">
<el-input v-model="filterForm.keyword" placeholder="请输入设备号或设备名称" /> <el-input v-model="filterForm.keyword" placeholder="请输入泵车名称" clearable @clear="handleClear" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch"></el-button> <el-button type="primary" @click="handleSearch"></el-button>
@ -14,22 +14,24 @@
</div> </div>
<el-table :data="tableData" style="width: 100%" border> <el-table :data="tableData" style="width: 100%" border>
<el-table-column prop="device_no" label="泵车编号" width="120" /> <el-table-column label="泵车名称" width="320">
<el-table-column prop="device_name" label="泵车名称" width="120" />
<el-table-column label="预警类型" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="getWarningTypeStyle(scope.row.warning_type)"> {{ scope.row.detail ? scope.row.detail.name : '-' }}
{{ scope.row.warning_type }}
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="warning_time" label="预警时间" width="180" /> <el-table-column label="泵车编号" width="320">
<el-table-column prop="location" label="位置信息" />
<el-table-column prop="status" label="状态" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="getStatusStyle(scope.row.status)"> {{ scope.row.detail ? scope.row.detail.plate : '-' }}
{{ scope.row.status }} </template>
</el-tag> </el-table-column>
<el-table-column label="预警内容" width="320">
<template slot-scope="scope">
{{ getWarningContent(scope.row) }}
</template>
</el-table-column>
<el-table-column label="预警时间" width="180">
<template slot-scope="scope">
{{ formatDateTime(scope.row.created_at) }}
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -50,7 +52,8 @@
</template> </template>
<script> <script>
import { getWarningList, searchWarnings } from '@/api/car/warning' import qs from 'qs'
import { getNotificationsList } from '@/api/monitor'
export default { export default {
data() { data() {
@ -72,14 +75,18 @@ export default {
async loadData() { async loadData() {
this.loading = true this.loading = true
try { try {
const response = await getWarningList({ const params = {
page: this.currentPage, page: this.currentPage,
pageSize: this.pageSize page_size: this.pageSize,
type: 'GpsStatus',
filter: []
}
const response = await getNotificationsList(params, {
paramsSerializer: params => qs.stringify(params, { arrayFormat: 'indices' })
}) })
this.tableData = response.data this.tableData = response.data || []
this.total = response.total this.total = response.total || 0
} catch (error) { } catch (error) {
console.error('加载数据失败:', error)
this.$message.error('加载数据失败') this.$message.error('加载数据失败')
} finally { } finally {
this.loading = false this.loading = false
@ -88,58 +95,78 @@ export default {
async handleSearch() { async handleSearch() {
this.loading = true this.loading = true
try { try {
if (this.filterForm.keyword) { const params = {
const response = await searchWarnings({
keyword: this.filterForm.keyword,
page: this.currentPage, page: this.currentPage,
pageSize: this.pageSize page_size: this.pageSize,
}) type: 'GpsStatus',
this.tableData = response.data name: this.filterForm.keyword
this.total = response.total
} else {
await this.loadData()
} }
// if (this.filterForm.keyword) {
// params.filter.push({
// key: 'name',
// op: 'like',
// value: this.filterForm.keyword
// })
// }
const response = await getNotificationsList(params, {
paramsSerializer: params => qs.stringify(params, { arrayFormat: 'indices' })
})
this.tableData = response.data || []
this.total = response.total || 0
} catch (error) { } catch (error) {
console.error('搜索失败:', error)
this.$message.error('搜索失败') this.$message.error('搜索失败')
} finally { } finally {
this.loading = false this.loading = false
} }
}, },
resetForm() { resetForm() {
this.filterForm = { this.filterForm = { keyword: '' }
keyword: '' this.currentPage = 1
}
this.loadData() this.loadData()
}, },
handleClear() {
this.resetForm()
},
handleSizeChange(val) { handleSizeChange(val) {
this.pageSize = val this.pageSize = val
this.currentPage = 1
this.loadData() this.loadData()
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.currentPage = val this.currentPage = val
this.loadData() this.loadData()
}, },
getWarningContent(row) {
try {
if (row.data) {
const data = JSON.parse(row.data)
return data.content || '未知预警'
}
return '未知预警'
} catch (error) {
return '未知预警'
}
},
formatDateTime(dateTimeStr) {
if (!dateTimeStr) return ''
const date = new Date(dateTimeStr)
return date.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
})
},
getWarningTypeStyle(type) { getWarningTypeStyle(type) {
switch (type) { switch (type) {
case '低电量': case '低电量':
return 'warning' // return 'warning'
case '低电量预警': case '低电量预警':
return 'primary' // return 'primary'
case '低电量超低预警': case '低电量超低预警':
return 'danger' //
default:
return ''
}
},
getStatusStyle(status) {
switch (status) {
case '未处理':
return 'danger' return 'danger'
case '处理中':
return 'warning'
case '已处理':
return 'success'
default: default:
return '' return ''
} }

@ -119,6 +119,7 @@ export default {
try { try {
const response = await getGasList() const response = await getGasList()
const list = response.data ? response.data : [] const list = response.data ? response.data : []
console.log('原始数据:', list)
// node_id1,3,5 // node_id1,3,5
const wantedNodeIds = ['1', '3', '5'] const wantedNodeIds = ['1', '3', '5']
const filtered = wantedNodeIds.map(nodeId => { const filtered = wantedNodeIds.map(nodeId => {
@ -127,10 +128,9 @@ export default {
group.sort((a, b) => new Date(b.update_time || b.created_at || 0) - new Date(a.update_time || a.created_at || 0)) group.sort((a, b) => new Date(b.update_time || b.created_at || 0) - new Date(a.update_time || a.created_at || 0))
return group[0] return group[0]
}).filter(Boolean) }).filter(Boolean)
const nodeIdMap = { '5': '3', '3': '2', '1': '1' }
this.environmentPoints = filtered.map(item => ({ this.environmentPoints = filtered.map(item => ({
id: item.id, id: item.id,
name: `监控点${nodeIdMap[String(item.node_id)] || item.node_id}`, name: item.gas_config && item.gas_config.name ? item.gas_config.name : `监控点${item.node_id}`,
status: item.status || '正常', status: item.status || '正常',
coConcentration: item.co_concentration != null && item.co_concentration !== '' ? `${item.co_concentration} ppm` : '-', coConcentration: item.co_concentration != null && item.co_concentration !== '' ? `${item.co_concentration} ppm` : '-',
temperature: item.temperature != null && item.temperature !== '' ? `${item.temperature}` : '-', temperature: item.temperature != null && item.temperature !== '' ? `${item.temperature}` : '-',
@ -138,6 +138,7 @@ export default {
updateTime: item.record_time || '' updateTime: item.record_time || ''
})) }))
} catch (error) { } catch (error) {
console.error('环境检测数据获取失败:', error)
this.$message && this.$message.error('环境检测数据获取失败') this.$message && this.$message.error('环境检测数据获取失败')
} }
}, },

@ -0,0 +1,213 @@
<template>
<div class="container">
<div class="warning-page">
<div class="filter-header">
<el-form :inline="true" class="filter-form">
<el-form-item label="监控点">
<el-input v-model="filterForm.camera_name" placeholder="请输入监控点名称" clearable @clear="handleClear"/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch"></el-button>
<el-button @click="resetForm"></el-button>
</el-form-item>
</el-form>
</div>
<el-table :data="tableData" style="width: 100%" border>
<el-table-column label="监控点" width="150">
<template slot-scope="scope">
<span>{{ scope.row.detail && scope.row.detail.gas_config ? scope.row.detail.gas_config.name : scope.row.detail.camera_name || '未知监控点' }}</span>
</template>
</el-table-column>
<el-table-column label="设备ID" width="120">
<template slot-scope="scope">
<span>{{ scope.row.detail && scope.row.detail.gas_config ? scope.row.detail.gas_config.device_id : scope.row.detail.device_id || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="节点ID" width="100">
<template slot-scope="scope">
<span>{{ scope.row.detail && scope.row.detail.gas_config ? scope.row.detail.gas_config.node_id : scope.row.detail.node_id || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="预警内容" width="200">
<template slot-scope="scope">
<span>{{ getWarningContent(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column label="监测值" width="280">
<template slot-scope="scope">
<div v-if="scope.row.detail && scope.row.detail.gas_data">
<div>CO浓度: {{ scope.row.detail.gas_data.co_concentration || '-' }} ppm</div>
<div>温度: {{ scope.row.detail.gas_data.temperature || '-' }} </div>
<div>湿度: {{ scope.row.detail.gas_data.humidity || '-' }} %</div>
</div>
<div v-else>
<span>-</span>
</div>
</template>
</el-table-column>
<el-table-column label="阈值信息" width="278">
<template slot-scope="scope">
<div v-if="scope.row.detail && scope.row.detail.gas_config">
<div>CO阈值: {{ scope.row.detail.gas_config.co_threshold }} ppm</div>
<div>温度: {{ scope.row.detail.gas_config.temperature_low_threshold }}-{{ scope.row.detail.gas_config.temperature_high_threshold }}°C</div>
<div>湿度: {{ scope.row.detail.gas_config.humidity_low_threshold }}-{{ scope.row.detail.gas_config.humidity_high_threshold }}%</div>
</div>
<div v-else-if="scope.row.detail">
<div>CO阈值: {{ scope.row.detail.co_threshold }} ppm</div>
<div>温度: {{ scope.row.detail.temperature_low_threshold }}-{{ scope.row.detail.temperature_high_threshold }}°C</div>
<div>湿度: {{ scope.row.detail.humidity_low_threshold }}-{{ scope.row.detail.humidity_high_threshold }}%</div>
</div>
</template>
</el-table-column>
<el-table-column prop="created_at" label="预警时间" width="180">
<template slot-scope="scope">
{{ formatDateTime(scope.row.created_at) }}
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
:current-page="currentPage"
:page-sizes="[10, 20, 30, 50]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
</template>
<script>
import qs from 'qs'
import { getNotificationsList } from '@/api/monitor'
export default {
data() {
return {
filterForm: {
camera_name: ''
},
tableData: [],
loading: false,
currentPage: 1,
pageSize: 10,
total: 0
}
},
created() {
this.loadData()
},
methods: {
async loadData() {
this.loading = true
try {
const response = await getNotificationsList({
page: this.currentPage,
pageSize: this.pageSize,
type: 'GasAlarm'
})
this.tableData = response.data || []
this.total = response.total || 0
} catch (error) {
console.error('加载数据失败:', error)
this.$message.error('加载数据失败')
} finally {
this.loading = false
}
},
async handleSearch() {
this.loading = true
try {
const params = {
page: this.currentPage,
page_size: this.pageSize,
type: 'GasAlarm',
name: this.filterForm.camera_name
// filter: [{
// key: 'name',
// op: 'eq',
// value: this.filterForm.camera_name
// }]
}
const response = await getNotificationsList(params, {
paramsSerializer: params => qs.stringify(params, { arrayFormat: 'indices' })
})
this.tableData = response.data || []
this.total = response.total || 0
} catch (error) {
console.error('搜索失败:', error)
this.$message.error('搜索失败')
} finally {
this.loading = false
}
},
resetForm() {
this.filterForm = {
camera_name: ''
}
this.currentPage = 1
this.loadData()
},
handleSizeChange(val) {
this.pageSize = val
this.currentPage = 1
this.loadData()
},
handleCurrentChange(val) {
this.currentPage = val
this.loadData()
},
handleClear() {
this.resetForm()
},
getWarningContent(row) {
try {
if (row.data) {
const data = JSON.parse(row.data)
return data.content || '未知预警'
}
return '未知预警'
} catch (error) {
return '未知预警'
}
},
formatDateTime(dateTimeStr) {
if (!dateTimeStr) return ''
const date = new Date(dateTimeStr)
return date.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
})
}
}
}
</script>
<style scoped>
.warning-page {
padding: 20px;
}
.filter-header {
margin-bottom: 20px;
background: #fff;
padding: 20px;
border-radius: 4px;
}
.pagination-container {
margin-top: 20px;
text-align: right;
}
</style>

@ -19,24 +19,38 @@
<span>监控点 {{ point.name }}</span> <span>监控点 {{ point.name }}</span>
</div> </div>
<!-- 视频配置 --> <!-- 视频与设备信息两行两列布局 -->
<el-form-item :label="`摄像头地址`"> <el-row :gutter="20">
<el-col :span="12">
<el-form-item label="监控点名称">
<el-input v-model="point.name" placeholder="请输入监控点名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="摄像头地址">
<el-input v-model="point.videoUrl" placeholder="请输入摄像头视频流地址" /> <el-input v-model="point.videoUrl" placeholder="请输入摄像头视频流地址" />
</el-form-item> </el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="摄像头名称"> <el-form-item label="摄像头名称">
<el-input v-model="point.videoName" placeholder="请输入摄像头名称" /> <el-input v-model="point.videoName" placeholder="请输入摄像头名称" />
</el-form-item> </el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备地址"> <el-form-item label="设备地址">
<el-input v-model="point.deviceAddress" placeholder="请输入设备地址" /> <el-input v-model="point.deviceAddress" placeholder="请输入设备地址" />
</el-form-item> </el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="节点ID"> <el-form-item label="节点ID">
<el-input v-model="point.nodeId" placeholder="请输入节点ID" /> <el-input v-model="point.nodeId" placeholder="请输入节点ID" />
</el-form-item> </el-form-item>
</el-col>
</el-row>
<!-- 环境监测阈值 --> <!-- 环境监测阈值 -->
<el-divider content-position="left">环境监测阈值超过此值将触发预警</el-divider> <el-divider content-position="left">环境监测阈值超过此值将触发预警</el-divider>
@ -51,7 +65,6 @@
/> />
<span class="threshold-label">PPM</span> <span class="threshold-label">PPM</span>
</el-form-item> </el-form-item>
<el-form-item label="温度阈值(℃)"> <el-form-item label="温度阈值(℃)">
<el-row> <el-row>
<el-col :span="11"> <el-col :span="11">
@ -126,11 +139,23 @@
<div class="section-title">预警接收设置</div> <div class="section-title">预警接收设置</div>
<el-form ref="warningForm" :model="warningForm" label-width="120px"> <el-form ref="warningForm" :model="warningForm" label-width="120px">
<el-form-item label="预警手机号"> <el-form-item label="预警手机号">
<el-input v-model="warningForm.phoneNumber" placeholder="请输入接收预警信息的手机号"> <el-row :gutter="10" type="flex" align="middle">
<template slot="append"> <el-col :span="8">
<el-button @click="addReceiver"></el-button> <el-input
</template> v-model="warningForm.phoneNumber"
</el-input> placeholder="请输入接收预警信息的手机号"
maxlength="11"
type="tel"
@blur="validatePhone"
/>
</el-col>
<el-col :span="8">
<el-input v-model="warningForm.contactName" placeholder="请输入联系人姓名" />
</el-col>
<el-col :span="4" style="display: flex; align-items: center;">
<el-button @click="addReceiver" style="width: 100%;">添加</el-button>
</el-col>
</el-row>
</el-form-item> </el-form-item>
<el-table <el-table
@ -139,7 +164,7 @@
style="width: 100%; margin-top: 10px;" style="width: 100%; margin-top: 10px;"
> >
<el-table-column label="序号" type="index" width="50" /> <el-table-column label="序号" type="index" width="50" />
<el-table-column prop="phone" label="手机号" /> <el-table-column prop="mobile" label="手机号" />
<el-table-column prop="name" label="联系人" /> <el-table-column prop="name" label="联系人" />
<el-table-column label="操作" width="120"> <el-table-column label="操作" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
@ -157,8 +182,7 @@
</template> </template>
<script> <script>
import { getGasConfig, saveGasConfig, destroyGasConfig } from '@/api/monitor' import { getGasConfig, saveGasConfig, destroyGasConfig, saveConfig, getConfigList } from '@/api/monitor'
export default { export default {
name: 'WarningSetting', name: 'WarningSetting',
data() { data() {
@ -166,6 +190,7 @@ export default {
monitorPoints: [], monitorPoints: [],
warningForm: { warningForm: {
phoneNumber: '', phoneNumber: '',
contactName: '',
receivers: [ receivers: [
{ phone: '13800138000', name: '张三' }, { phone: '13800138000', name: '张三' },
{ phone: '13900139000', name: '李四' } { phone: '13900139000', name: '李四' }
@ -175,6 +200,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.loadWarningReceivers()
this.loadMonitorConfig() this.loadMonitorConfig()
}, },
methods: { methods: {
@ -186,6 +212,7 @@ export default {
const list = response.data ? response.data : [] const list = response.data ? response.data : []
this.monitorPoints = list.map(item => ({ this.monitorPoints = list.map(item => ({
id: item.id, id: item.id,
name: item.name || `监控点${item.id}`,
videoUrl: item.camera_url, videoUrl: item.camera_url,
videoName: item.camera_name, videoName: item.camera_name,
coThreshold: Number(item.co_threshold), coThreshold: Number(item.co_threshold),
@ -201,28 +228,73 @@ export default {
this.$message.error('加载监控点配置失败') this.$message.error('加载监控点配置失败')
} }
}, },
addReceiver() { async loadWarningReceivers() {
try {
const filter = [
{ key: 'id', op: 'eq', value: 1 }
]
const res = await getConfigList({ filter })
const list = res.data ? res.data : []
let receivers = []
if (list.length > 0) {
let value = {}
try {
value = JSON.parse(list[0].value)
} catch (e) {
console.warn('解析配置值失败:', e)
}
if (Array.isArray(value)) {
receivers = value
} else if (value && value.mobile) {
receivers = [{ mobile: value.mobile, name: value.name }]
}
}
this.warningForm.receivers = receivers
} catch (e) {
this.$message && this.$message.error('获取预警联系人失败')
}
},
async addReceiver() {
if (!this.warningForm.phoneNumber) { if (!this.warningForm.phoneNumber) {
this.$message.warning('请输入手机号') this.$message.warning('请输入手机号')
return return
} }
if (!this.warningForm.contactName) {
// this.$message.warning('请输入联系人姓名')
return
}
const phoneReg = /^1[3-9]\d{9}$/ const phoneReg = /^1[3-9]\d{9}$/
if (!phoneReg.test(this.warningForm.phoneNumber)) { if (!phoneReg.test(this.warningForm.phoneNumber)) {
this.$message.error('请输入正确的手机号格式') this.$message.error('请输入正确的手机号格式')
return return
} }
this.warningForm.receivers.push({ this.warningForm.receivers.push({
phone: this.warningForm.phoneNumber, mobile: this.warningForm.phoneNumber,
name: '联系人' + (this.warningForm.receivers.length + 1) name: this.warningForm.contactName
}) })
try {
await saveConfig({
id: 1,
value: JSON.stringify(this.warningForm.receivers)
})
this.$message.success('添加联系人成功')
} catch (e) {
this.$message.error('添加联系人失败')
}
this.warningForm.phoneNumber = '' this.warningForm.phoneNumber = ''
this.warningForm.contactName = ''
}, },
removeReceiver(index) { async removeReceiver(index) {
this.warningForm.receivers.splice(index, 1) this.warningForm.receivers.splice(index, 1)
try {
await saveConfig({
id: 1,
value: JSON.stringify(this.warningForm.receivers)
})
this.$message.success('删除联系人成功')
} catch (e) {
this.$message.error('删除联系人失败')
}
}, },
saveSettings() { saveSettings() {
// API // API
@ -241,7 +313,7 @@ export default {
}, },
addMonitorPoint() { addMonitorPoint() {
this.monitorPoints.push({ this.monitorPoints.push({
name: '监控点', name: `监控点${this.monitorPoints.length + 1}`,
videoName: '', videoName: '',
videoUrl: '', videoUrl: '',
deviceAddress: '', deviceAddress: '',
@ -259,6 +331,7 @@ export default {
const point = this.monitorPoints[index] const point = this.monitorPoints[index]
const param = { const param = {
id: point.id, id: point.id,
name: point.name,
camera_url: point.videoUrl, camera_url: point.videoUrl,
camera_name: point.videoName, camera_name: point.videoName,
co_threshold: point.coThreshold, co_threshold: point.coThreshold,
@ -293,7 +366,6 @@ export default {
const pointToDelete = this.monitorPoints[index] const pointToDelete = this.monitorPoints[index]
console.log(pointToDelete) console.log(pointToDelete)
await destroyGasConfig({ id: pointToDelete.id }) await destroyGasConfig({ id: pointToDelete.id })
this.monitorPoints.splice(index, 1) this.monitorPoints.splice(index, 1)
this.$message({ this.$message({
type: 'success', type: 'success',
@ -308,6 +380,12 @@ export default {
}, },
cancelAddMonitorPoint(index) { cancelAddMonitorPoint(index) {
this.monitorPoints.splice(index, 1) this.monitorPoints.splice(index, 1)
},
validatePhone() {
const phoneReg = /^1[3-9]\d{9}$/
if (this.warningForm.phoneNumber && !phoneReg.test(this.warningForm.phoneNumber)) {
this.$message.error('请输入正确的手机号格式')
}
} }
} }
} }

Loading…
Cancel
Save