|
@@ -71,6 +71,11 @@
|
|
|
label="地区"
|
|
|
align="center"
|
|
|
/>
|
|
|
+ <el-table-column
|
|
|
+ prop="switchType"
|
|
|
+ label="开关类型"
|
|
|
+ align="center"
|
|
|
+ />
|
|
|
<el-table-column
|
|
|
label="策略"
|
|
|
align="center"
|
|
@@ -172,6 +177,15 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ v-if="userInfo.authorityId === 888"
|
|
|
+ label="开关类型"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="tunnelData.switchType"
|
|
|
+ style="width: 200px;"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
@@ -222,6 +236,15 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ v-if="userInfo.authorityId === 888"
|
|
|
+ label="开关类型"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="tunnelData.switchType"
|
|
|
+ style="width: 200px;"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
@@ -288,13 +311,50 @@
|
|
|
>
|
|
|
<el-collapse
|
|
|
v-model="activeNames"
|
|
|
- @change="handleChange"
|
|
|
>
|
|
|
<el-collapse-item
|
|
|
title="开关"
|
|
|
name="1"
|
|
|
>
|
|
|
- 1
|
|
|
+ <div v-if="tunnelTimeData.switchType === '四路控制器'">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in tunnelTimeData.devices"
|
|
|
+ key="index"
|
|
|
+ style="margin: 10px 0"
|
|
|
+ >
|
|
|
+ <span style="margin: 0 20px 0 0;font-weight: 600;font-size: 16px">道路 {{ item.radarId }}</span>
|
|
|
+ <el-switch
|
|
|
+ v-for="(v, k) in item.deviceRelays"
|
|
|
+ key="k"
|
|
|
+ v-model="v.state"
|
|
|
+ class="ml-2"
|
|
|
+ style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
|
|
+ @click="switchButton(item, v)"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-if="tunnelTimeData.switchType === '单灯控制器'">
|
|
|
+ <div style="margin: 0 0 0 20px">
|
|
|
+ <el-slider
|
|
|
+ v-model="tunnelTimeData.lampValue1"
|
|
|
+ :step="10"
|
|
|
+ style="width: 50%;"
|
|
|
+ show-stops
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div style="margin: 0 0 0 20px">
|
|
|
+ <el-slider
|
|
|
+ v-model="tunnelTimeData.lampValue2"
|
|
|
+ :step="10"
|
|
|
+ style="width: 50%;"
|
|
|
+ show-stops
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ @click="lampSet(tunnelTimeData)"
|
|
|
+ >设定</el-button>
|
|
|
+ </div>
|
|
|
</el-collapse-item>
|
|
|
<el-collapse-item
|
|
|
title="定时"
|
|
@@ -329,16 +389,16 @@
|
|
|
>
|
|
|
存储数据
|
|
|
</el-button>
|
|
|
- <span style="margin-left: 30px">
|
|
|
- <el-tag
|
|
|
- v-if="tunnelTimeData.tunnelTime.isComplete"
|
|
|
- type="success"
|
|
|
- >完成</el-tag>
|
|
|
- <el-tag
|
|
|
- v-if="!tunnelTimeData.tunnelTime.isComplete"
|
|
|
- type="warning"
|
|
|
- >正在发送</el-tag>
|
|
|
- </span>
|
|
|
+ <!-- <span style="margin-left: 30px">-->
|
|
|
+ <!-- <!– <el-tag–>-->
|
|
|
+ <!-- <!– v-if="tunnelTimeData.tunnelTime.isComplete"–>-->
|
|
|
+ <!-- <!– type="success"–>-->
|
|
|
+ <!-- <!– >完成</el-tag>–>-->
|
|
|
+ <!-- <el-tag-->
|
|
|
+ <!-- v-if="!tunnelTimeData.tunnelTime.isComplete"-->
|
|
|
+ <!-- type="warning"-->
|
|
|
+ <!-- >正在发送</el-tag>-->
|
|
|
+ <!-- </span>-->
|
|
|
</div>
|
|
|
</el-collapse-item>
|
|
|
</el-collapse>
|
|
@@ -353,12 +413,12 @@ import {
|
|
|
createTunnel,
|
|
|
deleteTunnel,
|
|
|
queryTunnelList, updateTactics,
|
|
|
- updateTunnel,
|
|
|
+ updateTunnel, updateTunnelLamp,
|
|
|
updateTunnelsRegion,
|
|
|
updateTunnelTime
|
|
|
} from '@/api/tunnel'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
-import { generateDeviceFile } from '@/api/device'
|
|
|
+import { deviceSwitch, generateDeviceFile } from '@/api/device'
|
|
|
import { useUserStore } from '@/pinia/modules/user'
|
|
|
const userData = useUserStore()
|
|
|
const userInfo = userData.userInfo
|
|
@@ -397,7 +457,6 @@ const getData = async() => {
|
|
|
total.value = res.data.total
|
|
|
searchData.value.pageInfo.page = res.data.page
|
|
|
searchData.value.pageInfo.pageSize = res.data.pageSize
|
|
|
- console.log(tunnel.value)
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -427,12 +486,16 @@ const tunnelData = ref({
|
|
|
id: 0,
|
|
|
name: '',
|
|
|
regionId: undefined,
|
|
|
- tunnelSn: ''
|
|
|
+ tunnelSn: '',
|
|
|
+ switchType: ''
|
|
|
})
|
|
|
|
|
|
const tunnelAdd = async() => {
|
|
|
tunnelData.value.id = 0
|
|
|
await createTunnel(tunnelData.value).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ ElMessage.success('添加成功')
|
|
|
+ }
|
|
|
tunnelAddDialog.value = false
|
|
|
getData()
|
|
|
})
|
|
@@ -444,6 +507,9 @@ const tunnelEditDialog = ref(false)
|
|
|
|
|
|
const tunnelEdit = async() => {
|
|
|
await updateTunnel(tunnelData.value).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ ElMessage.success('修改成功')
|
|
|
+ }
|
|
|
tunnelEditDialog.value = false
|
|
|
getData()
|
|
|
})
|
|
@@ -597,9 +663,6 @@ const tunnelControlPanel = (val) => {
|
|
|
}
|
|
|
|
|
|
const activeNames = ref(['1', '2'])
|
|
|
-const handleChange = (val) => {
|
|
|
- console.log(val)
|
|
|
-}
|
|
|
|
|
|
// 定时
|
|
|
|
|
@@ -618,6 +681,36 @@ const editTunnelTiming = async() => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const lampSet = async(val) => {
|
|
|
+ await updateTunnelLamp({
|
|
|
+ id: val.ID,
|
|
|
+ tunnelSn: val.tunnelSn,
|
|
|
+ lampValue1: val.lampValue1,
|
|
|
+ lampValue2: val.lampValue2
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ ElMessage.success('已发送')
|
|
|
+ }
|
|
|
+ getData()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 开关
|
|
|
+const switchButton = async(device, relay) => {
|
|
|
+ console.log(device, relay)
|
|
|
+ await deviceSwitch({
|
|
|
+ tunnelSn: device.tunnel.tunnelSn,
|
|
|
+ radarId: device.radarId,
|
|
|
+ relayId: relay.relayId,
|
|
|
+ state: relay.state
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ ElMessage.success('已切换')
|
|
|
+ }
|
|
|
+ getData()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getData()
|
|
|
})
|