Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
gassafety
Commits
e04b77c3
Commit
e04b77c3
authored
Aug 06, 2021
by
王晓倩
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
68ff9026
ac7f0330
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1281 additions
and
64 deletions
+1281
-64
TDeviceAlarmController.java
...web/controller/dataMonitoring/TDeviceAlarmController.java
+9
-0
TMonitorDeviceController.java
...ehong/web/controller/device/TMonitorDeviceController.java
+135
-0
WebSocketController.java
.../zehong/web/controller/websocket/WebSocketController.java
+15
-15
TMonitorDevice.java
...rc/main/java/com/zehong/system/domain/TMonitorDevice.java
+154
-0
RelationTMonitorDevice.java
...com/zehong/system/domain/form/RelationTMonitorDevice.java
+50
-0
TMonitorDeviceFrom.java
...ava/com/zehong/system/domain/form/TMonitorDeviceFrom.java
+38
-0
TDeviceAlarmMapper.java
...ain/java/com/zehong/system/mapper/TDeviceAlarmMapper.java
+6
-0
TMonitorDeviceMapper.java
...n/java/com/zehong/system/mapper/TMonitorDeviceMapper.java
+61
-0
ITDeviceAlarmService.java
.../java/com/zehong/system/service/ITDeviceAlarmService.java
+6
-0
ITMonitorDeviceService.java
...ava/com/zehong/system/service/ITMonitorDeviceService.java
+61
-0
TDeviceAlarmServiceImpl.java
...m/zehong/system/service/impl/TDeviceAlarmServiceImpl.java
+9
-0
TMonitorDeviceServiceImpl.java
...zehong/system/service/impl/TMonitorDeviceServiceImpl.java
+96
-0
TDeviceAlarmMapper.xml
...m/src/main/resources/mapper/system/TDeviceAlarmMapper.xml
+20
-0
TMonitorDeviceMapper.xml
...src/main/resources/mapper/system/TMonitorDeviceMapper.xml
+89
-0
deviceAlarm.js
gassafety-web/src/api/dataMonitoring/deviceAlarm.js
+12
-1
deviceMonitor.js
gassafety-web/src/api/device/deviceMonitor.js
+61
-0
index.vue
gassafety-web/src/views/device/devicemonitor/index.vue
+459
-48
No files found.
gassafety-admin/src/main/java/com/zehong/web/controller/dataMonitoring/TDeviceAlarmController.java
View file @
e04b77c3
...
@@ -102,4 +102,13 @@ public class TDeviceAlarmController extends BaseController
...
@@ -102,4 +102,13 @@ public class TDeviceAlarmController extends BaseController
{
{
return
toAjax
(
tDeviceAlarmService
.
deleteTDeviceAlarmByIds
(
alarmIds
));
return
toAjax
(
tDeviceAlarmService
.
deleteTDeviceAlarmByIds
(
alarmIds
));
}
}
/**
* 查询报警设备
* @return TDeviceAlarm
*/
@GetMapping
(
"selectAlarmDevice"
)
public
List
<
TDeviceAlarm
>
selectAlarmDevice
(){
return
tDeviceAlarmService
.
selectAlarmDevice
();
}
}
}
gassafety-admin/src/main/java/com/zehong/web/controller/device/TMonitorDeviceController.java
0 → 100644
View file @
e04b77c3
package
com
.
zehong
.
web
.
controller
.
device
;
import
java.util.List
;
import
com.zehong.system.domain.form.RelationTMonitorDevice
;
import
com.zehong.system.domain.form.TMonitorDeviceFrom
;
import
com.zehong.system.service.ITDeviceInfoService
;
import
com.zehong.system.service.impl.TPipeServiceImpl
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.zehong.common.annotation.Log
;
import
com.zehong.common.core.controller.BaseController
;
import
com.zehong.common.core.domain.AjaxResult
;
import
com.zehong.common.enums.BusinessType
;
import
com.zehong.system.domain.TMonitorDevice
;
import
com.zehong.system.service.ITMonitorDeviceService
;
import
com.zehong.common.utils.poi.ExcelUtil
;
import
com.zehong.common.core.page.TableDataInfo
;
/**
* 设备监控Controller
*
* @author zehong
* @date 2021-08-05
*/
@RestController
@RequestMapping
(
"/system/device"
)
public
class
TMonitorDeviceController
extends
BaseController
{
@Autowired
private
ITMonitorDeviceService
tMonitorDeviceService
;
@Autowired
private
ITDeviceInfoService
itDeviceInfoService
;
@Autowired
private
TPipeServiceImpl
tPipeService
;
/**
* 查询设备监控列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
TMonitorDevice
tMonitorDevice
)
{
startPage
();
List
<
TMonitorDevice
>
list
=
tMonitorDeviceService
.
selectTMonitorDeviceList
(
tMonitorDevice
);
for
(
TMonitorDevice
device:
list
){
device
.
setDeviceName
(
itDeviceInfoService
.
selectTDeviceInfoById
(
device
.
getDeviceId
().
intValue
()).
getDeviceName
());
device
.
setRelationDeviceName
(
itDeviceInfoService
.
selectTDeviceInfoById
(
device
.
getRelationDeviceId
().
intValue
()).
getDeviceName
());
device
.
setRelationPipeName
(
tPipeService
.
selectTPipeById
(
device
.
getRelationPipeId
().
intValue
()).
getPipeName
());
}
return
getDataTable
(
list
);
}
/**
* 导出设备监控列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:export')"
)
@Log
(
title
=
"设备监控"
,
businessType
=
BusinessType
.
EXPORT
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
TMonitorDevice
tMonitorDevice
)
{
List
<
TMonitorDevice
>
list
=
tMonitorDeviceService
.
selectTMonitorDeviceList
(
tMonitorDevice
);
ExcelUtil
<
TMonitorDevice
>
util
=
new
ExcelUtil
<
TMonitorDevice
>(
TMonitorDevice
.
class
);
return
util
.
exportExcel
(
list
,
"设备监控数据"
);
}
/**
* 获取设备监控详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:query')"
)
@GetMapping
(
value
=
"/{monitorId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"monitorId"
)
Long
monitorId
)
{
return
AjaxResult
.
success
(
tMonitorDeviceService
.
selectTMonitorDeviceById
(
monitorId
));
}
/**
* 新增设备监控
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:add')"
)
@Log
(
title
=
"设备监控"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
TMonitorDevice
tMonitorDevice
)
{
return
toAjax
(
tMonitorDeviceService
.
insertTMonitorDevice
(
tMonitorDevice
));
}
@PostMapping
(
"/batchAdd"
)
public
AjaxResult
batchAdd
(
@RequestBody
TMonitorDeviceFrom
tMonitorDeviceFrom
){
for
(
RelationTMonitorDevice
relationTMonitorDevice
:
tMonitorDeviceFrom
.
getRelationDevices
()){
TMonitorDevice
tMonitorDevice
=
new
TMonitorDevice
();
tMonitorDevice
.
setDeviceId
(
tMonitorDeviceFrom
.
getDeviceId
());
tMonitorDevice
.
setDeviceThreshold
(
tMonitorDeviceFrom
.
getDeviceThreshold
());
tMonitorDevice
.
setRelationDeviceId
(
relationTMonitorDevice
.
getRelationDeviceId
());
tMonitorDevice
.
setRelationDeviceThreshold
(
relationTMonitorDevice
.
getRelationDeviceThreshold
());
tMonitorDevice
.
setRelationPipeId
(
relationTMonitorDevice
.
getRelationPipeId
());
tMonitorDevice
.
setRelationPipeThreshold
(
relationTMonitorDevice
.
getRelationPipeThreshold
());
tMonitorDeviceService
.
insertTMonitorDevice
(
tMonitorDevice
);
}
return
AjaxResult
.
success
();
}
/**
* 修改设备监控
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:edit')"
)
@Log
(
title
=
"设备监控"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
TMonitorDevice
tMonitorDevice
)
{
return
toAjax
(
tMonitorDeviceService
.
updateTMonitorDevice
(
tMonitorDevice
));
}
/**
* 删除设备监控
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:remove')"
)
@Log
(
title
=
"设备监控"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{monitorIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
monitorIds
)
{
return
toAjax
(
tMonitorDeviceService
.
deleteTMonitorDeviceByIds
(
monitorIds
));
}
}
gassafety-admin/src/main/java/com/zehong/web/controller/websocket/WebSocketController.java
View file @
e04b77c3
package
com
.
zehong
.
web
.
controller
.
websocket
;
package
com
.
zehong
.
web
.
controller
.
websocket
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zehong.system.domain.TDeviceAlarm
;
import
com.zehong.system.domain.vo.DeviceAlarmVo
;
import
com.zehong.system.domain.vo.DeviceAlarmVo
;
import
com.zehong.system.service.ITDeviceAlarmService
;
import
com.zehong.system.service.ITDeviceAlarmService
;
import
com.zehong.system.service.ITDeviceInfoService
;
import
com.zehong.system.service.ITDeviceInfoService
;
import
com.zehong.system.service.ITPipeService
;
import
com.zehong.system.service.ITPipeService
;
import
com.zehong.system.service.WebSocketServer
;
import
com.zehong.system.service.WebSocketServer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@RestController
@RestController
@RequestMapping
(
"/websocket"
)
@RequestMapping
(
"/websocket"
)
public
class
WebSocketController
{
public
class
WebSocketController
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
WebSocketController
.
class
);
@Autowired
@Autowired
private
WebSocketServer
webSocketServer
;
private
WebSocketServer
webSocketServer
;
...
@@ -35,19 +35,19 @@ public class WebSocketController {
...
@@ -35,19 +35,19 @@ public class WebSocketController {
@GetMapping
(
"/send"
)
@GetMapping
(
"/send"
)
public
void
send
(
int
alarmId
){
public
void
send
(
int
alarmId
){
DeviceAlarmVo
alarm
=
null
;
try
{
try
{
alarm
=
itDeviceAlarmService
.
selectTDeviceAlarmById
(
alarmId
);
DeviceAlarmVo
alarm
=
itDeviceAlarmService
.
selectTDeviceAlarmById
(
alarmId
);
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"alarmInfo"
,
alarm
);
if
(
PIPE_TYPE
.
equals
(
alarm
.
getAlarmType
())){
json
.
put
(
"deviceInfo"
,
itPipeService
.
selectTPipeById
(
alarm
.
getDeviceId
()));
}
else
{
json
.
put
(
"deviceInfo"
,
itDeviceInfoService
.
selectTDeviceInfoById
(
alarm
.
getDeviceId
()));
}
webSocketServer
.
batchSendMessage
(
alarm
.
toString
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
log
.
error
(
"wesocket发送失败!"
);
}
}
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"alarmInfo"
,
alarm
);
if
(
PIPE_TYPE
.
equals
(
alarm
.
getAlarmType
())){
json
.
put
(
"deviceInfo"
,
itPipeService
.
selectTPipeById
(
alarm
.
getDeviceId
()));
}
else
{
json
.
put
(
"deviceInfo"
,
itDeviceInfoService
.
selectTDeviceInfoById
(
alarm
.
getDeviceId
()));
}
webSocketServer
.
batchSendMessage
(
alarm
.
toString
());
}
}
}
}
gassafety-system/src/main/java/com/zehong/system/domain/TMonitorDevice.java
0 → 100644
View file @
e04b77c3
package
com
.
zehong
.
system
.
domain
;
import
java.math.BigDecimal
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.zehong.common.annotation.Excel
;
import
com.zehong.common.core.domain.BaseEntity
;
/**
* 设备监控对象 t_monitor_device
*
* @author zehong
* @date 2021-08-05
*/
public
class
TMonitorDevice
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 设备监控id */
private
Long
monitorId
;
/** 设备id */
@Excel
(
name
=
"设备id"
)
private
Long
deviceId
;
/** 设备阈值 */
@Excel
(
name
=
"设备阈值"
)
private
BigDecimal
deviceThreshold
;
/** 关联管道id */
@Excel
(
name
=
"关联管道id"
)
private
Long
relationPipeId
;
/** 关联管道阈值 */
@Excel
(
name
=
"关联管道阈值"
)
private
BigDecimal
relationPipeThreshold
;
/** 关联设备id */
@Excel
(
name
=
"关联设备id"
)
private
Long
relationDeviceId
;
/** 关联设备阈值 */
@Excel
(
name
=
"关联设备阈值"
)
private
BigDecimal
relationDeviceThreshold
;
private
String
relationPipeName
;
private
String
deviceName
;
private
String
relationDeviceName
;
public
String
getRelationPipeName
()
{
return
relationPipeName
;
}
public
void
setRelationPipeName
(
String
relationPipeName
)
{
this
.
relationPipeName
=
relationPipeName
;
}
public
String
getDeviceName
()
{
return
deviceName
;
}
public
void
setDeviceName
(
String
deviceName
)
{
this
.
deviceName
=
deviceName
;
}
public
String
getRelationDeviceName
()
{
return
relationDeviceName
;
}
public
void
setRelationDeviceName
(
String
relationDeviceName
)
{
this
.
relationDeviceName
=
relationDeviceName
;
}
public
void
setMonitorId
(
Long
monitorId
)
{
this
.
monitorId
=
monitorId
;
}
public
Long
getMonitorId
()
{
return
monitorId
;
}
public
void
setDeviceId
(
Long
deviceId
)
{
this
.
deviceId
=
deviceId
;
}
public
Long
getDeviceId
()
{
return
deviceId
;
}
public
void
setDeviceThreshold
(
BigDecimal
deviceThreshold
)
{
this
.
deviceThreshold
=
deviceThreshold
;
}
public
BigDecimal
getDeviceThreshold
()
{
return
deviceThreshold
;
}
public
void
setRelationPipeId
(
Long
relationPipeId
)
{
this
.
relationPipeId
=
relationPipeId
;
}
public
Long
getRelationPipeId
()
{
return
relationPipeId
;
}
public
void
setRelationPipeThreshold
(
BigDecimal
relationPipeThreshold
)
{
this
.
relationPipeThreshold
=
relationPipeThreshold
;
}
public
BigDecimal
getRelationPipeThreshold
()
{
return
relationPipeThreshold
;
}
public
void
setRelationDeviceId
(
Long
relationDeviceId
)
{
this
.
relationDeviceId
=
relationDeviceId
;
}
public
Long
getRelationDeviceId
()
{
return
relationDeviceId
;
}
public
void
setRelationDeviceThreshold
(
BigDecimal
relationDeviceThreshold
)
{
this
.
relationDeviceThreshold
=
relationDeviceThreshold
;
}
public
BigDecimal
getRelationDeviceThreshold
()
{
return
relationDeviceThreshold
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"monitorId"
,
getMonitorId
())
.
append
(
"deviceId"
,
getDeviceId
())
.
append
(
"deviceThreshold"
,
getDeviceThreshold
())
.
append
(
"relationPipeId"
,
getRelationPipeId
())
.
append
(
"relationPipeThreshold"
,
getRelationPipeThreshold
())
.
append
(
"relationDeviceId"
,
getRelationDeviceId
())
.
append
(
"relationDeviceThreshold"
,
getRelationDeviceThreshold
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
toString
();
}
}
gassafety-system/src/main/java/com/zehong/system/domain/form/RelationTMonitorDevice.java
0 → 100644
View file @
e04b77c3
package
com
.
zehong
.
system
.
domain
.
form
;
import
java.math.BigDecimal
;
public
class
RelationTMonitorDevice
{
/** 关联管道id */
private
Long
relationPipeId
;
/** 关联管道阈值 */
private
BigDecimal
relationPipeThreshold
;
/** 关联设备id */
private
Long
relationDeviceId
;
/** 关联设备阈值 */
private
BigDecimal
relationDeviceThreshold
;
public
Long
getRelationPipeId
()
{
return
relationPipeId
;
}
public
void
setRelationPipeId
(
Long
relationPipeId
)
{
this
.
relationPipeId
=
relationPipeId
;
}
public
BigDecimal
getRelationPipeThreshold
()
{
return
relationPipeThreshold
;
}
public
void
setRelationPipeThreshold
(
BigDecimal
relationPipeThreshold
)
{
this
.
relationPipeThreshold
=
relationPipeThreshold
;
}
public
Long
getRelationDeviceId
()
{
return
relationDeviceId
;
}
public
void
setRelationDeviceId
(
Long
relationDeviceId
)
{
this
.
relationDeviceId
=
relationDeviceId
;
}
public
BigDecimal
getRelationDeviceThreshold
()
{
return
relationDeviceThreshold
;
}
public
void
setRelationDeviceThreshold
(
BigDecimal
relationDeviceThreshold
)
{
this
.
relationDeviceThreshold
=
relationDeviceThreshold
;
}
}
gassafety-system/src/main/java/com/zehong/system/domain/form/TMonitorDeviceFrom.java
0 → 100644
View file @
e04b77c3
package
com
.
zehong
.
system
.
domain
.
form
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
TMonitorDeviceFrom
{
/** 设备id */
private
Long
deviceId
;
/** 设备阈值 */
private
BigDecimal
deviceThreshold
;
private
List
<
RelationTMonitorDevice
>
relationDevices
;
public
Long
getDeviceId
()
{
return
deviceId
;
}
public
void
setDeviceId
(
Long
deviceId
)
{
this
.
deviceId
=
deviceId
;
}
public
BigDecimal
getDeviceThreshold
()
{
return
deviceThreshold
;
}
public
void
setDeviceThreshold
(
BigDecimal
deviceThreshold
)
{
this
.
deviceThreshold
=
deviceThreshold
;
}
public
List
<
RelationTMonitorDevice
>
getRelationDevices
()
{
return
relationDevices
;
}
public
void
setRelationDevices
(
List
<
RelationTMonitorDevice
>
relationDevices
)
{
this
.
relationDevices
=
relationDevices
;
}
}
gassafety-system/src/main/java/com/zehong/system/mapper/TDeviceAlarmMapper.java
View file @
e04b77c3
...
@@ -58,4 +58,10 @@ public interface TDeviceAlarmMapper
...
@@ -58,4 +58,10 @@ public interface TDeviceAlarmMapper
* @return 结果
* @return 结果
*/
*/
public
int
deleteTDeviceAlarmByIds
(
int
[]
alarmIds
);
public
int
deleteTDeviceAlarmByIds
(
int
[]
alarmIds
);
/**
* 查询报警设备
* @return TDeviceAlarm
*/
List
<
TDeviceAlarm
>
selectAlarmDevice
();
}
}
gassafety-system/src/main/java/com/zehong/system/mapper/TMonitorDeviceMapper.java
0 → 100644
View file @
e04b77c3
package
com
.
zehong
.
system
.
mapper
;
import
java.util.List
;
import
com.zehong.system.domain.TMonitorDevice
;
/**
* 设备监控Mapper接口
*
* @author zehong
* @date 2021-08-05
*/
public
interface
TMonitorDeviceMapper
{
/**
* 查询设备监控
*
* @param monitorId 设备监控ID
* @return 设备监控
*/
public
TMonitorDevice
selectTMonitorDeviceById
(
Long
monitorId
);
/**
* 查询设备监控列表
*
* @param tMonitorDevice 设备监控
* @return 设备监控集合
*/
public
List
<
TMonitorDevice
>
selectTMonitorDeviceList
(
TMonitorDevice
tMonitorDevice
);
/**
* 新增设备监控
*
* @param tMonitorDevice 设备监控
* @return 结果
*/
public
int
insertTMonitorDevice
(
TMonitorDevice
tMonitorDevice
);
/**
* 修改设备监控
*
* @param tMonitorDevice 设备监控
* @return 结果
*/
public
int
updateTMonitorDevice
(
TMonitorDevice
tMonitorDevice
);
/**
* 删除设备监控
*
* @param monitorId 设备监控ID
* @return 结果
*/
public
int
deleteTMonitorDeviceById
(
Long
monitorId
);
/**
* 批量删除设备监控
*
* @param monitorIds 需要删除的数据ID
* @return 结果
*/
public
int
deleteTMonitorDeviceByIds
(
Long
[]
monitorIds
);
}
gassafety-system/src/main/java/com/zehong/system/service/ITDeviceAlarmService.java
View file @
e04b77c3
...
@@ -59,4 +59,10 @@ public interface ITDeviceAlarmService
...
@@ -59,4 +59,10 @@ public interface ITDeviceAlarmService
* @return 结果
* @return 结果
*/
*/
public
int
deleteTDeviceAlarmById
(
int
alarmId
);
public
int
deleteTDeviceAlarmById
(
int
alarmId
);
/**
* 查询报警设备
* @return TDeviceAlarm
*/
List
<
TDeviceAlarm
>
selectAlarmDevice
();
}
}
gassafety-system/src/main/java/com/zehong/system/service/ITMonitorDeviceService.java
0 → 100644
View file @
e04b77c3
package
com
.
zehong
.
system
.
service
;
import
java.util.List
;
import
com.zehong.system.domain.TMonitorDevice
;
/**
* 设备监控Service接口
*
* @author zehong
* @date 2021-08-05
*/
public
interface
ITMonitorDeviceService
{
/**
* 查询设备监控
*
* @param monitorId 设备监控ID
* @return 设备监控
*/
public
TMonitorDevice
selectTMonitorDeviceById
(
Long
monitorId
);
/**
* 查询设备监控列表
*
* @param tMonitorDevice 设备监控
* @return 设备监控集合
*/
public
List
<
TMonitorDevice
>
selectTMonitorDeviceList
(
TMonitorDevice
tMonitorDevice
);
/**
* 新增设备监控
*
* @param tMonitorDevice 设备监控
* @return 结果
*/
public
int
insertTMonitorDevice
(
TMonitorDevice
tMonitorDevice
);
/**
* 修改设备监控
*
* @param tMonitorDevice 设备监控
* @return 结果
*/
public
int
updateTMonitorDevice
(
TMonitorDevice
tMonitorDevice
);
/**
* 批量删除设备监控
*
* @param monitorIds 需要删除的设备监控ID
* @return 结果
*/
public
int
deleteTMonitorDeviceByIds
(
Long
[]
monitorIds
);
/**
* 删除设备监控信息
*
* @param monitorId 设备监控ID
* @return 结果
*/
public
int
deleteTMonitorDeviceById
(
Long
monitorId
);
}
gassafety-system/src/main/java/com/zehong/system/service/impl/TDeviceAlarmServiceImpl.java
View file @
e04b77c3
...
@@ -143,4 +143,13 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
...
@@ -143,4 +143,13 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
{
{
return
tDeviceAlarmMapper
.
deleteTDeviceAlarmById
(
alarmId
);
return
tDeviceAlarmMapper
.
deleteTDeviceAlarmById
(
alarmId
);
}
}
/**
* 查询报警设备
* @return TDeviceAlarm
*/
@Override
public
List
<
TDeviceAlarm
>
selectAlarmDevice
(){
return
tDeviceAlarmMapper
.
selectAlarmDevice
();
}
}
}
gassafety-system/src/main/java/com/zehong/system/service/impl/TMonitorDeviceServiceImpl.java
0 → 100644
View file @
e04b77c3
package
com
.
zehong
.
system
.
service
.
impl
;
import
java.util.List
;
import
com.zehong.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.zehong.system.mapper.TMonitorDeviceMapper
;
import
com.zehong.system.domain.TMonitorDevice
;
import
com.zehong.system.service.ITMonitorDeviceService
;
/**
* 设备监控Service业务层处理
*
* @author zehong
* @date 2021-08-05
*/
@Service
public
class
TMonitorDeviceServiceImpl
implements
ITMonitorDeviceService
{
@Autowired
private
TMonitorDeviceMapper
tMonitorDeviceMapper
;
/**
* 查询设备监控
*
* @param monitorId 设备监控ID
* @return 设备监控
*/
@Override
public
TMonitorDevice
selectTMonitorDeviceById
(
Long
monitorId
)
{
return
tMonitorDeviceMapper
.
selectTMonitorDeviceById
(
monitorId
);
}
/**
* 查询设备监控列表
*
* @param tMonitorDevice 设备监控
* @return 设备监控
*/
@Override
public
List
<
TMonitorDevice
>
selectTMonitorDeviceList
(
TMonitorDevice
tMonitorDevice
)
{
return
tMonitorDeviceMapper
.
selectTMonitorDeviceList
(
tMonitorDevice
);
}
/**
* 新增设备监控
*
* @param tMonitorDevice 设备监控
* @return 结果
*/
@Override
public
int
insertTMonitorDevice
(
TMonitorDevice
tMonitorDevice
)
{
tMonitorDevice
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
tMonitorDeviceMapper
.
insertTMonitorDevice
(
tMonitorDevice
);
}
/**
* 修改设备监控
*
* @param tMonitorDevice 设备监控
* @return 结果
*/
@Override
public
int
updateTMonitorDevice
(
TMonitorDevice
tMonitorDevice
)
{
tMonitorDevice
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
tMonitorDeviceMapper
.
updateTMonitorDevice
(
tMonitorDevice
);
}
/**
* 批量删除设备监控
*
* @param monitorIds 需要删除的设备监控ID
* @return 结果
*/
@Override
public
int
deleteTMonitorDeviceByIds
(
Long
[]
monitorIds
)
{
return
tMonitorDeviceMapper
.
deleteTMonitorDeviceByIds
(
monitorIds
);
}
/**
* 删除设备监控信息
*
* @param monitorId 设备监控ID
* @return 结果
*/
@Override
public
int
deleteTMonitorDeviceById
(
Long
monitorId
)
{
return
tMonitorDeviceMapper
.
deleteTMonitorDeviceById
(
monitorId
);
}
}
gassafety-system/src/main/resources/mapper/system/TDeviceAlarmMapper.xml
View file @
e04b77c3
...
@@ -97,4 +97,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -97,4 +97,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{alarmId}
#{alarmId}
</foreach>
</foreach>
</delete>
</delete>
<select
id=
"selectAlarmDevice"
resultMap=
"TDeviceAlarmResult"
>
SELECT
alarm_id,
device_id,
device_type,
order_id,
alarm_type,
alarm_value,
start_time,
end_time,
deal_status,
update_time,
create_time
FROM
t_device_alarm
WHERE
end_time IS NULL
</select>
</mapper>
</mapper>
\ No newline at end of file
gassafety-system/src/main/resources/mapper/system/TMonitorDeviceMapper.xml
0 → 100644
View file @
e04b77c3
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.zehong.system.mapper.TMonitorDeviceMapper"
>
<resultMap
type=
"TMonitorDevice"
id=
"TMonitorDeviceResult"
>
<result
property=
"monitorId"
column=
"monitor_id"
/>
<result
property=
"deviceId"
column=
"device_id"
/>
<result
property=
"deviceThreshold"
column=
"device_threshold"
/>
<result
property=
"relationPipeId"
column=
"relation_pipe_id"
/>
<result
property=
"relationPipeThreshold"
column=
"relation_pipe_threshold"
/>
<result
property=
"relationDeviceId"
column=
"relation_device_id"
/>
<result
property=
"relationDeviceThreshold"
column=
"relation_device_threshold"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<sql
id=
"selectTMonitorDeviceVo"
>
select monitor_id, device_id, device_threshold, relation_pipe_id, relation_pipe_threshold, relation_device_id, relation_device_threshold, create_time, update_time from t_monitor_device
</sql>
<select
id=
"selectTMonitorDeviceList"
parameterType=
"TMonitorDevice"
resultMap=
"TMonitorDeviceResult"
>
<include
refid=
"selectTMonitorDeviceVo"
/>
<where>
<if
test=
"deviceId != null "
>
and device_id = #{deviceId}
</if>
<if
test=
"deviceThreshold != null "
>
and device_threshold = #{deviceThreshold}
</if>
<if
test=
"relationPipeId != null "
>
and relation_pipe_id = #{relationPipeId}
</if>
<if
test=
"relationPipeThreshold != null "
>
and relation_pipe_threshold = #{relationPipeThreshold}
</if>
<if
test=
"relationDeviceId != null "
>
and relation_device_id = #{relationDeviceId}
</if>
<if
test=
"relationDeviceThreshold != null "
>
and relation_device_threshold = #{relationDeviceThreshold}
</if>
</where>
</select>
<select
id=
"selectTMonitorDeviceById"
parameterType=
"Long"
resultMap=
"TMonitorDeviceResult"
>
<include
refid=
"selectTMonitorDeviceVo"
/>
where monitor_id = #{monitorId}
</select>
<insert
id=
"insertTMonitorDevice"
parameterType=
"TMonitorDevice"
useGeneratedKeys=
"true"
keyProperty=
"monitorId"
>
insert into t_monitor_device
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"deviceId != null"
>
device_id,
</if>
<if
test=
"deviceThreshold != null"
>
device_threshold,
</if>
<if
test=
"relationPipeId != null"
>
relation_pipe_id,
</if>
<if
test=
"relationPipeThreshold != null"
>
relation_pipe_threshold,
</if>
<if
test=
"relationDeviceId != null"
>
relation_device_id,
</if>
<if
test=
"relationDeviceThreshold != null"
>
relation_device_threshold,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"deviceId != null"
>
#{deviceId},
</if>
<if
test=
"deviceThreshold != null"
>
#{deviceThreshold},
</if>
<if
test=
"relationPipeId != null"
>
#{relationPipeId},
</if>
<if
test=
"relationPipeThreshold != null"
>
#{relationPipeThreshold},
</if>
<if
test=
"relationDeviceId != null"
>
#{relationDeviceId},
</if>
<if
test=
"relationDeviceThreshold != null"
>
#{relationDeviceThreshold},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
</trim>
</insert>
<update
id=
"updateTMonitorDevice"
parameterType=
"TMonitorDevice"
>
update t_monitor_device
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"deviceId != null"
>
device_id = #{deviceId},
</if>
<if
test=
"deviceThreshold != null"
>
device_threshold = #{deviceThreshold},
</if>
<if
test=
"relationPipeId != null"
>
relation_pipe_id = #{relationPipeId},
</if>
<if
test=
"relationPipeThreshold != null"
>
relation_pipe_threshold = #{relationPipeThreshold},
</if>
<if
test=
"relationDeviceId != null"
>
relation_device_id = #{relationDeviceId},
</if>
<if
test=
"relationDeviceThreshold != null"
>
relation_device_threshold = #{relationDeviceThreshold},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
</trim>
where monitor_id = #{monitorId}
</update>
<delete
id=
"deleteTMonitorDeviceById"
parameterType=
"Long"
>
delete from t_monitor_device where monitor_id = #{monitorId}
</delete>
<delete
id=
"deleteTMonitorDeviceByIds"
parameterType=
"String"
>
delete from t_monitor_device where monitor_id in
<foreach
item=
"monitorId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{monitorId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
gassafety-web/src/api/dataMonitoring/deviceAlarm.js
View file @
e04b77c3
...
@@ -50,4 +50,15 @@ export function exportDeviceAlarm(query) {
...
@@ -50,4 +50,15 @@ export function exportDeviceAlarm(query) {
method
:
'get'
,
method
:
'get'
,
params
:
query
params
:
query
})
})
}
}
\ No newline at end of file
//查询报警设备
export
function
selectAlarmDevice
()
{
return
request
({
url
:
'/dataMonitoring/deviceAlarm/selectAlarmDevice'
,
method
:
'get'
,
params
:
query
})
}
gassafety-web/src/api/device/deviceMonitor.js
0 → 100644
View file @
e04b77c3
import
request
from
'@/utils/request'
// 查询设备监控列表
export
function
listDevice
(
query
)
{
return
request
({
url
:
'/system/device/list'
,
method
:
'get'
,
params
:
query
})
}
// 查询设备监控详细
export
function
getDevice
(
monitorId
)
{
return
request
({
url
:
'/system/device/'
+
monitorId
,
method
:
'get'
})
}
// 新增设备监控
export
function
addDevice
(
data
)
{
return
request
({
url
:
'/system/device'
,
method
:
'post'
,
data
:
data
})
}
export
function
batchAdd
(
data
)
{
return
request
({
url
:
'/system/device/batchAdd'
,
method
:
'post'
,
data
:
data
})
}
// 修改设备监控
export
function
updateDevice
(
data
)
{
return
request
({
url
:
'/system/device'
,
method
:
'put'
,
data
:
data
})
}
// 删除设备监控
export
function
delDevice
(
monitorId
)
{
return
request
({
url
:
'/system/device/'
+
monitorId
,
method
:
'delete'
})
}
// 导出设备监控
export
function
exportDevice
(
query
)
{
return
request
({
url
:
'/system/device/export'
,
method
:
'get'
,
params
:
query
})
}
gassafety-web/src/views/device/devicemonitor/index.vue
View file @
e04b77c3
<
template
>
<
template
>
<div
class=
"add-div"
style=
"width: 100%;height: 100%;padding: 50px;"
>
<div
class=
"app-container"
>
<el-row
:gutter=
"20"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
:inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<span>
新增设备
</span>
<el-form-item
label=
"设备"
prop=
"deviceId"
>
<el-input
placeholder=
"请输入设备名称"
style=
"width: 300px;margin-left: 20px;"
></el-input>
<el-select
v-model=
"queryParams.deviceId"
placeholder=
"请选择设备"
>
<el-input
placeholder=
"请输入设备阈值"
style=
"width: 300px;margin-left: 50px;"
></el-input>
<el-option
</el-row>
v-for=
"dict in devices"
<el-button
type=
"primary"
class=
"el-icon-plus clolos1"
@
click=
"addPdfFile"
style=
"margin-top: 20px;margin-bottom: 20px;"
>
新增关联设备
</el-button>
:key=
"dict.deviceId"
<div
class=
"add_pdf"
v-for=
"(item, index) in addPdf"
:key=
"index"
style=
"margin-bottom: 30px;"
>
:label=
"dict.deviceName"
:value=
"dict.deviceId"
<el-form
ref=
"form"
:model=
"form"
label-width=
"80px"
>
></el-option>
<el-row
:gutter=
"20"
>
</el-select>
<el-col
:span=
"11"
style=
"float: left;box-shadow: rgb(233, 229, 229) 3px 3px 7px 2px;padding-top: 20px;padding-left: 15px;"
>
</el-form-item>
<el-form-item
label=
"关联管道:"
prop=
"pipeCode"
>
<el-form-item
label=
"设备阈值"
prop=
"deviceThreshold"
>
<el-input
v-model=
"form.sss"
placeholder=
"请输入关联管道名称"
style=
"width: 40%;margin-left: 20px;"
></el-input>
<el-input
<el-input
v-model=
"form.aaa"
placeholder=
"请输入关联管道阈值"
style=
"width: 40%;margin-left: 50px;"
></el-input>
v-model=
"queryParams.deviceThreshold"
</el-form-item>
placeholder=
"请输入设备阈值"
<el-form-item
label=
"关联设备:"
prop=
"pipeCode"
>
clearable
<el-input
placeholder=
"请输入关联设备名称"
style=
"width: 40%;margin-left: 20px;"
></el-input>
size=
"small"
<el-input
placeholder=
"请输入关联设备阈值"
style=
"width: 40%;margin-left: 50px;"
></el-input>
@
keyup
.
enter
.
native=
"handleQuery"
</el-form-item>
/>
</el-col>
</el-form-item>
<div
style=
"float: left;margin-top: 50px;margin-left: 50px;"
>
<el-form-item
label=
"关联管道"
prop=
"relationPipeId"
>
<el-button
type=
"danger"
class=
"el-icon-delete clolos clolos3"
@
click=
"deletePdf(index)"
circle
></el-button>
<el-select
v-model=
"queryParams.relationPipeId"
placeholder=
"请选择关联管道"
>
</div>
<el-option
</el-row>
v-for=
"dict in pipes"
</el-form>
:key=
"dict.pipeId"
<!--
<div
v-show=
"index !== 0"
>
-->
:label=
"dict.pipeName"
</div>
:value=
"dict.pipeId"
<el-form
label-width=
"100px"
>
></el-option>
<el-form-item
style=
"margin-left:200px;margin-top:40px;"
>
</el-select>
<el-button
type=
"primary"
@
click=
"submitForm()"
>
提交
</el-button>
</el-form-item>
<el-button
@
click=
"close()"
>
返回
</el-button>
<el-form-item
label=
"关联管道阈值"
prop=
"relationPipeThreshold"
>
<el-input
v-model=
"queryParams.relationPipeThreshold"
placeholder=
"请输入关联管道阈值"
clearable
size=
"small"
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"关联设备"
prop=
"relationDeviceId"
>
<el-select
v-model=
"queryParams.relationDeviceId"
placeholder=
"请选择关联设备"
>
<el-option
v-for=
"dict in devices"
:key=
"dict.deviceId"
:label=
"dict.deviceName"
:value=
"dict.deviceId"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"关联设备阈值"
prop=
"relationDeviceThreshold"
>
<el-input
v-model=
"queryParams.relationDeviceThreshold"
placeholder=
"请输入关联设备阈值"
clearable
size=
"small"
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
v-hasPermi=
"['system:device:add']"
>
新增
</el-button>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"dialogVisible = true"
>
批量新增
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"success"
plain
icon=
"el-icon-edit"
size=
"mini"
:disabled=
"single"
@
click=
"handleUpdate"
v-hasPermi=
"['system:device:edit']"
>
修改
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"danger"
plain
icon=
"el-icon-delete"
size=
"mini"
:disabled=
"multiple"
@
click=
"handleDelete"
v-hasPermi=
"['system:device:remove']"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-download"
size=
"mini"
:loading=
"exportLoading"
@
click=
"handleExport"
v-hasPermi=
"['system:device:export']"
>
导出
</el-button>
</el-col>
<right-toolbar
:showSearch
.
sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<el-table
v-loading=
"loading"
:data=
"deviceList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"设备监控id"
align=
"center"
prop=
"monitorId"
/>
<el-table-column
label=
"设备"
align=
"center"
prop=
"deviceName"
/>
<el-table-column
label=
"设备阈值"
align=
"center"
prop=
"deviceThreshold"
/>
<el-table-column
label=
"关联管道"
align=
"center"
prop=
"relationPipeName"
/>
<el-table-column
label=
"关联管道阈值"
align=
"center"
prop=
"relationPipeThreshold"
/>
<el-table-column
label=
"关联设备"
align=
"center"
prop=
"relationDeviceName"
/>
<el-table-column
label=
"关联设备阈值"
align=
"center"
prop=
"relationDeviceThreshold"
/>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<template
slot-scope=
"scope"
>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"handleUpdate(scope.row)"
v-hasPermi=
"['system:device:edit']"
>
修改
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['system:device:remove']"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<pagination
v-show=
"total>0"
:total=
"total"
:page
.
sync=
"queryParams.pageNum"
:limit
.
sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<!-- 添加或修改设备监控对话框 -->
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"500px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"设备id"
prop=
"deviceId"
>
<!--<el-input v-model="form.deviceId" placeholder="请输入设备id" />-->
<el-select
v-model=
"form.deviceId"
placeholder=
"请选择设备"
>
<el-option
v-for=
"dict in devices"
:key=
"dict.deviceId"
:label=
"dict.deviceName"
:value=
"dict.deviceId"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"设备阈值"
prop=
"deviceThreshold"
>
<el-input
v-model=
"form.deviceThreshold"
placeholder=
"请输入设备阈值"
/>
</el-form-item>
<el-form-item
label=
"关联管道id"
prop=
"relationPipeId"
>
<!--<el-input v-model="form.relationPipeId" placeholder="请输入关联管道id" />-->
<el-select
v-model=
"form.relationPipeId"
placeholder=
"请选择关联管道"
>
<el-option
v-for=
"dict in pipes"
:key=
"dict.pipeId"
:label=
"dict.pipeName"
:value=
"dict.pipeId"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"关联管道阈值"
prop=
"relationPipeThreshold"
>
<el-input
v-model=
"form.relationPipeThreshold"
placeholder=
"请输入关联管道阈值"
/>
</el-form-item>
<el-form-item
label=
"关联设备id"
prop=
"relationDeviceId"
>
<!-- <el-input v-model="form.relationDeviceId" placeholder="请输入关联设备id" />-->
<el-select
v-model=
"form.relationDeviceId"
placeholder=
"请选择关联设备"
>
<el-option
v-for=
"dict in devices"
:key=
"dict.deviceId"
:label=
"dict.deviceName"
:value=
"dict.deviceId"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"关联设备阈值"
prop=
"relationDeviceThreshold"
>
<el-input
v-model=
"form.relationDeviceThreshold"
placeholder=
"请输入关联设备阈值"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</el-dialog>
<!--批量新增-->
<el-dialog
title=
"批量新增"
:visible
.
sync=
"dialogVisible"
append-to-body
>
<div
class=
"add-div"
style=
"width: 100%;height: 100%;padding: 50px;"
>
<el-row
:gutter=
"50"
>
<span>
新增设备
</span>
<!--<el-input placeholder="请输入设备名称" style="width: 260px;margin-left: 20px;"></el-input>-->
<el-select
v-model=
"subForm.deviceId"
placeholder=
"请选择设备名称"
>
<el-option
v-for=
"dict in devices"
:key=
"dict.deviceId"
:label=
"dict.deviceName"
:value=
"dict.deviceId"
></el-option>
</el-select>
<el-input
v-model=
"subForm.deviceThreshold"
placeholder=
"请输入设备阈值"
style=
"width: 260px;margin-left: 50px;"
></el-input>
</el-row>
<el-button
type=
"primary"
class=
"el-icon-plus clolos1"
@
click=
"addPdfFile"
style=
"margin-top: 20px;margin-bottom: 20px;"
>
新增关联设备
</el-button>
<div
class=
"add_pdf"
v-for=
"(item, index) in subForm.relationDevices"
:key=
"index"
style=
"margin-bottom: 30px;"
>
<el-form
:model=
"item"
label-width=
"80px"
>
<el-row
:gutter=
"50"
>
<el-col
:span=
"20"
style=
"float: left;box-shadow: rgb(233, 229, 229) 3px 3px 7px 2px;padding-top: 20px;padding-left: 15px;"
>
<el-form-item
label=
"关联管道:"
prop=
"pipeCode"
>
<!--<el-input v-model="item.sss" placeholder="请输入关联管道名称" style="width: 40%;margin-left: 20px;"></el-input>-->
<el-select
v-model=
"item.relationPipeId"
placeholder=
"请选择关联管道名称"
>
<el-option
v-for=
"dict in pipes"
:key=
"dict.pipeId"
:label=
"dict.pipeName"
:value=
"dict.pipeId"
></el-option>
</el-select>
<el-input
v-model=
"item.relationPipeThreshold"
placeholder=
"请输入关联管道阈值"
style=
"width: 40%;margin-left: 50px;"
></el-input>
</el-form-item>
<el-form-item
label=
"关联设备:"
prop=
"pipeCode"
>
<!-- <el-input v-model="item.qqq" placeholder="请输入关联设备名称" style="width: 40%;margin-left: 20px;"></el-input>-->
<el-select
v-model=
"item.relationDeviceId"
placeholder=
"请选择关联设备名称"
>
<el-option
v-for=
"dict in devices"
:key=
"dict.deviceId"
:label=
"dict.deviceName"
:value=
"dict.deviceId"
></el-option>
</el-select>
<el-input
v-model=
"item.relationDeviceThreshold"
placeholder=
"请输入关联设备阈值"
style=
"width: 40%;margin-left: 50px;"
></el-input>
</el-form-item>
</el-col>
<div
style=
"float: left;margin-top: 50px;margin-left: 50px;"
>
<el-button
type=
"danger"
class=
"el-icon-delete clolos clolos3"
@
click=
"deletePdf(index)"
circle
></el-button>
</div>
</el-row>
</el-form>
<!-- <div v-show="index !== 0"> -->
</div>
<el-form
label-width=
"100px"
>
<el-form-item
style=
"margin-left:100px;margin-top:40px;"
>
<el-button
type=
"primary"
@
click=
"batchSubmit()"
>
提交
</el-button>
<el-button
@
click=
"dialogVisible = false"
>
返回
</el-button>
</el-form-item>
</el-form>
</div>
</el-dialog>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
export
default
{
import
{
listDevice
,
getDevice
,
delDevice
,
addDevice
,
updateDevice
,
exportDevice
,
batchAdd
}
from
"@/api/device/deviceMonitor"
;
data
()
{
import
{
getAllDeviceInfo
}
from
"@/api/device/deviceInfo"
;
return
{
import
{
pipeAllInfoList
}
from
"@/api/device/pipe"
;
addPdf
:
[
1
],
export
default
{
form
:
{}
name
:
"Device"
,
};
components
:
{
},
},
methods
:{
data
()
{
addPdfFile
(){
return
{
this
.
addPdf
.
push
([]);
// 遮罩层
loading
:
true
,
// 导出遮罩层
exportLoading
:
false
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 设备监控表格数据
deviceList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
deviceId
:
null
,
deviceThreshold
:
null
,
relationPipeId
:
null
,
relationPipeThreshold
:
null
,
relationDeviceId
:
null
,
relationDeviceThreshold
:
null
,
},
// 表单参数
form
:
{},
// 表单校验
rules
:
{
},
},
deletePdf
(
index
){
devices
:
[],
this
.
addPdf
.
splice
(
index
,
1
);
pipes
:
[],
dialogVisible
:
false
,
subForm
:{
relationDevices
:
[{}]
}
}
};
},
created
()
{
this
.
getList
();
this
.
getAllDeviceInfo
();
this
.
pipeAllInfoList
();
},
methods
:
{
/** 查询设备监控列表 */
getList
()
{
this
.
loading
=
true
;
listDevice
(
this
.
queryParams
).
then
(
response
=>
{
this
.
deviceList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
});
},
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
},
// 表单重置
reset
()
{
this
.
form
=
{
monitorId
:
null
,
deviceId
:
null
,
deviceThreshold
:
null
,
relationPipeId
:
null
,
relationPipeThreshold
:
null
,
relationDeviceId
:
null
,
relationDeviceThreshold
:
null
,
createTime
:
null
,
updateTime
:
null
};
this
.
resetForm
(
"form"
);
},
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
;
this
.
getList
();
},
/** 重置按钮操作 */
resetQuery
()
{
this
.
resetForm
(
"queryForm"
);
this
.
handleQuery
();
},
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
monitorId
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
},
/** 新增按钮操作 */
handleAdd
()
{
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
"添加设备监控"
;
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
();
const
monitorId
=
row
.
monitorId
||
this
.
ids
getDevice
(
monitorId
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
open
=
true
;
this
.
title
=
"修改设备监控"
;
});
},
/** 提交按钮 */
submitForm
()
{
this
.
$refs
[
"form"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
form
.
monitorId
!=
null
)
{
updateDevice
(
this
.
form
).
then
(
response
=>
{
this
.
msgSuccess
(
"修改成功"
);
this
.
open
=
false
;
this
.
getList
();
});
}
else
{
addDevice
(
this
.
form
).
then
(
response
=>
{
this
.
msgSuccess
(
"新增成功"
);
this
.
open
=
false
;
this
.
getList
();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
monitorIds
=
row
.
monitorId
||
this
.
ids
;
this
.
$confirm
(
'是否确认删除设备监控编号为"'
+
monitorIds
+
'"的数据项?'
,
"警告"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
}).
then
(
function
()
{
return
delDevice
(
monitorIds
);
}).
then
(()
=>
{
this
.
getList
();
this
.
msgSuccess
(
"删除成功"
);
}).
catch
(()
=>
{});
},
/** 导出按钮操作 */
handleExport
()
{
const
queryParams
=
this
.
queryParams
;
this
.
$confirm
(
'是否确认导出所有设备监控数据项?'
,
"警告"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
}).
then
(()
=>
{
this
.
exportLoading
=
true
;
return
exportDevice
(
queryParams
);
}).
then
(
response
=>
{
this
.
download
(
response
.
msg
);
this
.
exportLoading
=
false
;
}).
catch
(()
=>
{});
},
getAllDeviceInfo
(){
getAllDeviceInfo
().
then
(
response
=>
{
this
.
devices
=
response
.
data
;
});
},
pipeAllInfoList
(){
pipeAllInfoList
().
then
(
res
=>
{
this
.
pipes
=
res
.
data
;
});
},
addPdfFile
(){
this
.
subForm
.
relationDevices
.
push
({});
},
deletePdf
(
index
){
this
.
subForm
.
relationDevices
.
splice
(
index
,
1
);
console
.
log
(
this
.
subForm
,
"fdfdfdfasdfdsf"
);
},
batchSubmit
(){
batchAdd
(
this
.
subForm
).
then
(
res
=>
{
this
.
msgSuccess
(
"新增成功"
);
this
.
dialogVisible
=
false
;
this
.
getList
();
});
}
}
}
}
};
</
script
>
</
script
>
<
style
lang=
'scss'
scoped
>
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment