Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety-progress
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-progress
Commits
f9d08cac
Commit
f9d08cac
authored
Mar 24, 2022
by
zhangjianqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应急处置消息 socket
parent
85929e34
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
553 additions
and
97 deletions
+553
-97
pom.xml
gassafetyprogress-common/pom.xml
+5
-1
WebSocketConfig.java
...c/main/java/com/zehong/common/config/WebSocketConfig.java
+14
-0
SecurityConfig.java
...main/java/com/zehong/framework/config/SecurityConfig.java
+1
-1
TEventReceiveController.java
...com/zehong/system/controller/TEventReceiveController.java
+2
-0
WebSocketController.java
...ava/com/zehong/system/controller/WebSocketController.java
+37
-0
WebSocketBean.java
...src/main/java/com/zehong/system/domain/WebSocketBean.java
+44
-0
TEventReceiveMapper.java
...in/java/com/zehong/system/mapper/TEventReceiveMapper.java
+2
-0
ITEventReceiveService.java
...java/com/zehong/system/service/ITEventReceiveService.java
+2
-0
WebSocketServer.java
.../main/java/com/zehong/system/service/WebSocketServer.java
+52
-0
TEventReceiveServiceImpl.java
.../zehong/system/service/impl/TEventReceiveServiceImpl.java
+21
-1
WebSocketServiceImpl.java
.../com/zehong/system/service/impl/WebSocketServiceImpl.java
+131
-0
TEventHandleMapper.xml
...m/src/main/resources/mapper/system/TEventHandleMapper.xml
+1
-0
TEventReceiveMapper.xml
.../src/main/resources/mapper/system/TEventReceiveMapper.xml
+6
-1
Timeline.vue
gassafetyprogress-web/src/components/emergency/Timeline.vue
+7
-7
rightBar.vue
gassafetyprogress-web/src/components/emergency/rightBar.vue
+116
-50
Navbar.vue
gassafetyprogress-web/src/layout/components/Navbar.vue
+97
-34
getters.js
gassafetyprogress-web/src/store/getters.js
+1
-0
bigWindowCompany.js
gassafetyprogress-web/src/store/modules/bigWindowCompany.js
+12
-0
index.vue
gassafetyprogress-web/src/views/emergency/index.vue
+2
-2
No files found.
gassafetyprogress-common/pom.xml
View file @
f9d08cac
...
@@ -112,7 +112,11 @@
...
@@ -112,7 +112,11 @@
<groupId>
eu.bitwalker
</groupId>
<groupId>
eu.bitwalker
</groupId>
<artifactId>
UserAgentUtils
</artifactId>
<artifactId>
UserAgentUtils
</artifactId>
</dependency>
</dependency>
<!-- websocket 支持 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-websocket
</artifactId>
</dependency>
<!-- servlet包 -->
<!-- servlet包 -->
<dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<groupId>
javax.servlet
</groupId>
...
...
gassafetyprogress-common/src/main/java/com/zehong/common/config/WebSocketConfig.java
0 → 100644
View file @
f9d08cac
package
com
.
zehong
.
common
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.socket.server.standard.ServerEndpointExporter
;
@Configuration
public
class
WebSocketConfig
{
@Bean
public
ServerEndpointExporter
serverEndpointExporter
()
{
return
new
ServerEndpointExporter
();
}
}
gassafetyprogress-framework/src/main/java/com/zehong/framework/config/SecurityConfig.java
View file @
f9d08cac
...
@@ -98,7 +98,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -98,7 +98,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
// 过滤请求
.
authorizeRequests
()
.
authorizeRequests
()
// 对于登录login 验证码captchaImage 允许匿名访问
// 对于登录login 验证码captchaImage 允许匿名访问
.
antMatchers
(
"/login"
,
"/captchaImage"
,
"/detector/detectorReport/**"
).
anonymous
()
.
antMatchers
(
"/login"
,
"/captchaImage"
,
"/websocket/**"
,
"/websocketServer"
,
"/detector/detectorReport/**"
).
anonymous
()
.
antMatchers
(
.
antMatchers
(
HttpMethod
.
GET
,
HttpMethod
.
GET
,
"/*.html"
,
"/*.html"
,
...
...
gassafetyprogress-system/src/main/java/com/zehong/system/controller/TEventReceiveController.java
View file @
f9d08cac
package
com
.
zehong
.
system
.
controller
;
package
com
.
zehong
.
system
.
controller
;
import
java.util.List
;
import
java.util.List
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
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
;
...
...
gassafetyprogress-system/src/main/java/com/zehong/system/controller/WebSocketController.java
0 → 100644
View file @
f9d08cac
package
com
.
zehong
.
system
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zehong.system.domain.TEventReceive
;
import
com.zehong.system.service.ITEventReceiveService
;
import
com.zehong.system.service.WebSocketServer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/websocket"
)
public
class
WebSocketController
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
WebSocketController
.
class
);
@Autowired
private
WebSocketServer
webSocketServer
;
@Autowired
private
ITEventReceiveService
tEventReceiveService
;
@GetMapping
(
"/send"
)
public
void
send
(
Integer
enterpriseId
){
try
{
//List<TEventReceive> list = tEventReceiveService.getReadReceiveList( enterpriseId);
webSocketServer
.
batchSendMessage
(
JSONObject
.
toJSONString
(
"success"
));
}
catch
(
Exception
e
)
{
log
.
error
(
"wesocket发送失败!"
);
}
}
}
gassafetyprogress-system/src/main/java/com/zehong/system/domain/WebSocketBean.java
0 → 100644
View file @
f9d08cac
package
com
.
zehong
.
system
.
domain
;
import
javax.websocket.Session
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
* <websocket信息对象>
* <用于存储secket连接信息>
* @author wzh
* @version 2018-07-08 18:49
* @see [相关类/方法] (可选)
**/
public
class
WebSocketBean
{
/**
* 连接session对象
*/
private
Session
session
;
/**
* 连接错误次数
*/
private
AtomicInteger
erroerLinkCount
=
new
AtomicInteger
(
0
);
public
int
getErroerLinkCount
()
{
// 线程安全,以原子方式将当前值加1,注意:这里返回的是自增前的值
return
erroerLinkCount
.
getAndIncrement
();
}
public
void
cleanErrorNum
()
{
// 清空计数
erroerLinkCount
=
new
AtomicInteger
(
0
);
}
public
Session
getSession
()
{
return
session
;
}
public
void
setSession
(
Session
session
)
{
this
.
session
=
session
;
}
}
\ No newline at end of file
gassafetyprogress-system/src/main/java/com/zehong/system/mapper/TEventReceiveMapper.java
View file @
f9d08cac
...
@@ -58,4 +58,6 @@ public interface TEventReceiveMapper
...
@@ -58,4 +58,6 @@ public interface TEventReceiveMapper
* @return 结果
* @return 结果
*/
*/
public
int
deleteTEventReceiveByIds
(
String
[]
ids
);
public
int
deleteTEventReceiveByIds
(
String
[]
ids
);
public
List
<
TEventReceive
>
getReadReceiveList
(
Integer
enterpriseId
);
}
}
gassafetyprogress-system/src/main/java/com/zehong/system/service/ITEventReceiveService.java
View file @
f9d08cac
...
@@ -58,4 +58,6 @@ public interface ITEventReceiveService
...
@@ -58,4 +58,6 @@ public interface ITEventReceiveService
* @return 结果
* @return 结果
*/
*/
public
int
deleteTEventReceiveById
(
String
id
);
public
int
deleteTEventReceiveById
(
String
id
);
public
List
<
TEventReceive
>
getReadReceiveList
(
Integer
enterpriseId
);
}
}
gassafetyprogress-system/src/main/java/com/zehong/system/service/WebSocketServer.java
0 → 100644
View file @
f9d08cac
package
com
.
zehong
.
system
.
service
;
import
javax.websocket.EndpointConfig
;
import
javax.websocket.Session
;
/**
* <基于javax websocket通讯>
* <功能详细描述>
* @author wzh
* @version 2018-07-08 17:11
* @see [相关类/方法] (可选)
**/
public
interface
WebSocketServer
{
/**
* 连接建立成功调用的方法
* @param session session 对象
*/
public
void
onOpen
(
Session
session
,
EndpointConfig
config
);
/**
* 断开连接方法
*/
public
void
onClose
(
Session
session
);
/**
* 收到客户端消息后调用的方法
* @param session session 对象
* @param message 返回客户端的消息
*/
public
void
onMessage
(
Session
session
,
String
message
);
/**
* 发生异常时触发的方法
* @param session session 对象
* @param throwable 抛出的异常
*/
public
void
onError
(
Session
session
,
Throwable
throwable
);
/**
* 向单个客户端发送消息
* @param session session 对象
* @param message 发送给客户端的消息
*/
public
void
sendMessage
(
Session
session
,
String
message
);
/**
* 向所有在线用户群发消息
* @param message 发送给客户端的消息
*/
public
void
batchSendMessage
(
String
message
);
}
\ No newline at end of file
gassafetyprogress-system/src/main/java/com/zehong/system/service/impl/TEventReceiveServiceImpl.java
View file @
f9d08cac
package
com
.
zehong
.
system
.
service
.
impl
;
package
com
.
zehong
.
system
.
service
.
impl
;
import
java.util.List
;
import
java.util.List
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.system.controller.WebSocketController
;
import
com.zehong.system.service.WebSocketServer
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.zehong.system.mapper.TEventReceiveMapper
;
import
com.zehong.system.mapper.TEventReceiveMapper
;
...
@@ -14,11 +19,14 @@ import com.zehong.system.service.ITEventReceiveService;
...
@@ -14,11 +19,14 @@ import com.zehong.system.service.ITEventReceiveService;
* @author zehong
* @author zehong
* @date 2022-03-18
* @date 2022-03-18
*/
*/
@Slf4j
@Service
@Service
public
class
TEventReceiveServiceImpl
implements
ITEventReceiveService
public
class
TEventReceiveServiceImpl
implements
ITEventReceiveService
{
{
@Autowired
@Autowired
private
TEventReceiveMapper
tEventReceiveMapper
;
private
TEventReceiveMapper
tEventReceiveMapper
;
@Autowired
private
WebSocketServer
webSocketServer
;
/**
/**
* 查询事件接报
* 查询事件接报
...
@@ -69,7 +77,14 @@ public class TEventReceiveServiceImpl implements ITEventReceiveService
...
@@ -69,7 +77,14 @@ public class TEventReceiveServiceImpl implements ITEventReceiveService
@Override
@Override
public
int
updateTEventReceive
(
TEventReceive
tEventReceive
)
public
int
updateTEventReceive
(
TEventReceive
tEventReceive
)
{
{
return
tEventReceiveMapper
.
updateTEventReceive
(
tEventReceive
);
int
a
=
tEventReceiveMapper
.
updateTEventReceive
(
tEventReceive
);
try
{
//List<TEventReceive> list = tEventReceiveService.getReadReceiveList( enterpriseId);
webSocketServer
.
batchSendMessage
(
JSONObject
.
toJSONString
(
"success"
));
}
catch
(
Exception
e
)
{
log
.
error
(
"wesocket发送失败!"
);
}
return
a
;
}
}
/**
/**
...
@@ -95,4 +110,9 @@ public class TEventReceiveServiceImpl implements ITEventReceiveService
...
@@ -95,4 +110,9 @@ public class TEventReceiveServiceImpl implements ITEventReceiveService
{
{
return
tEventReceiveMapper
.
deleteTEventReceiveById
(
id
);
return
tEventReceiveMapper
.
deleteTEventReceiveById
(
id
);
}
}
@Override
public
List
<
TEventReceive
>
getReadReceiveList
(
Integer
enterpriseId
){
return
tEventReceiveMapper
.
getReadReceiveList
(
enterpriseId
);
}
}
}
gassafetyprogress-system/src/main/java/com/zehong/system/service/impl/WebSocketServiceImpl.java
0 → 100644
View file @
f9d08cac
package
com
.
zehong
.
system
.
service
.
impl
;
import
com.zehong.system.domain.WebSocketBean
;
import
com.zehong.system.service.WebSocketServer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.web.servlet.server.Session
;
import
org.springframework.stereotype.Component
;
import
javax.websocket.*
;
import
javax.websocket.server.ServerEndpoint
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* <基于javax websocket通讯>
* <各个方法的参数都是可以根据项目的实际情况改的>
* @author wzh
* @version 2018-07-08 17:11
* @see [相关类/方法] (可选)
**/
@ServerEndpoint
(
value
=
"/websocketServer"
)
@Component
(
"webSocketService"
)
public
class
WebSocketServiceImpl
implements
WebSocketServer
{
private
Logger
log
=
LoggerFactory
.
getLogger
(
WebSocketServiceImpl
.
class
);
/**
* 错误最大重试次数
*/
private
static
final
int
MAX_ERROR_NUM
=
10
;
/**
* 用来存放每个客户端对应的webSocket对象。
*/
private
static
Map
<
String
,
WebSocketBean
>
webSocketInfo
;
static
{
// concurrent包的线程安全map
webSocketInfo
=
new
ConcurrentHashMap
<>();
}
@OnOpen
@Override
public
void
onOpen
(
javax
.
websocket
.
Session
session
,
EndpointConfig
config
)
{
// 如果是session没有激活的情况,就是没有请求获取或session,这里可能会取出空,需要实际业务处理
/* HttpSession httpSession= (HttpSession) config.getUserProperties().get(HttpSession.class.getName());
if(httpSession != null)
{
log.info("获取到httpsession" + httpSession.getId());
}else {
log.error("未获取到httpsession");
}*/
// 连接成功当前对象放入websocket对象集合
WebSocketBean
bean
=
new
WebSocketBean
();
bean
.
setSession
(
session
);
webSocketInfo
.
put
(
session
.
getId
(),
bean
);
log
.
info
(
"客户端连接服务器session id :"
+
session
.
getId
()+
",当前连接数:"
+
webSocketInfo
.
size
());
}
@OnClose
@Override
public
void
onClose
(
javax
.
websocket
.
Session
session
)
{
// 客户端断开连接移除websocket对象
webSocketInfo
.
remove
(
session
.
getId
());
log
.
info
(
"客户端断开连接,当前连接数:"
+
webSocketInfo
.
size
());
}
@OnMessage
@Override
public
void
onMessage
(
javax
.
websocket
.
Session
session
,
String
message
)
{
log
.
info
(
"客户端 session id: "
+
session
.
getId
()+
",消息:"
+
message
);
// 此方法为客户端给服务器发送消息后进行的处理,可以根据业务自己处理,这里返回页面
sendMessage
(
session
,
"服务端返回"
+
message
);
}
@OnError
@Override
public
void
onError
(
javax
.
websocket
.
Session
session
,
Throwable
throwable
)
{
log
.
error
(
"发生错误"
+
throwable
.
getMessage
(),
throwable
);
}
@Override
public
void
sendMessage
(
javax
.
websocket
.
Session
session
,
String
message
)
{
try
{
// 发送消息
session
.
getBasicRemote
().
sendText
(
message
);
// 清空错误计数
webSocketInfo
.
get
(
session
.
getId
()).
cleanErrorNum
();
}
catch
(
Exception
e
)
{
log
.
error
(
"发送消息失败"
+
e
.
getMessage
(),
e
);
int
errorNum
=
webSocketInfo
.
get
(
session
.
getId
()).
getErroerLinkCount
();
// 小于最大重试次数重发
if
(
errorNum
<=
MAX_ERROR_NUM
)
{
sendMessage
(
session
,
message
);
}
else
{
log
.
error
(
"发送消息失败超过最大次数"
);
// 清空错误计数
webSocketInfo
.
get
(
session
.
getId
()).
cleanErrorNum
();
}
}
}
@Override
public
void
batchSendMessage
(
String
message
)
{
Set
<
Map
.
Entry
<
String
,
WebSocketBean
>>
set
=
webSocketInfo
.
entrySet
();
for
(
Map
.
Entry
<
String
,
WebSocketBean
>
map
:
set
)
{
sendMessage
(
map
.
getValue
().
getSession
(),
message
);
}
}
}
gassafetyprogress-system/src/main/resources/mapper/system/TEventHandleMapper.xml
View file @
f9d08cac
...
@@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include
refid=
"selectTEventHandleVo"
/>
<include
refid=
"selectTEventHandleVo"
/>
<where>
<where>
<if
test=
"eventId != null "
>
and event_id = #{eventId}
</if>
<if
test=
"eventId != null "
>
and event_id = #{eventId}
</if>
<if
test=
"eventType != null "
>
and event_type = #{eventType}
</if>
</where>
</where>
</select>
</select>
...
...
gassafetyprogress-system/src/main/resources/mapper/system/TEventReceiveMapper.xml
View file @
f9d08cac
...
@@ -30,7 +30,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -30,7 +30,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, event_name, event_type, event_grade, address, longitude, latitude,
select id, event_name, event_type, event_grade, address, longitude, latitude,
company_read,government_read,informant, infor_time, informant_phone, `describe`, `status`,enterprise_id, enterprise_name, remarks, is_del, create_time from t_event_receive
company_read,government_read,informant, infor_time, informant_phone, `describe`, `status`,enterprise_id, enterprise_name, remarks, is_del, create_time from t_event_receive
</sql>
</sql>
<select
id=
"getReadReceiveList"
resultMap=
"TEventReceiveResult"
>
<include
refid=
"selectTEventReceiveVo"
/>
<where>
<if
test=
"enterpriseId != null and enterpriseId != -2"
>
and enterprise_id = #{enterpriseId}
</if>
</where>
</select>
<select
id=
"selectTEventReceiveList"
parameterType=
"TEventReceive"
resultMap=
"TEventReceiveResult"
>
<select
id=
"selectTEventReceiveList"
parameterType=
"TEventReceive"
resultMap=
"TEventReceiveResult"
>
<include
refid=
"selectTEventReceiveVo"
/>
<include
refid=
"selectTEventReceiveVo"
/>
<where>
<where>
...
...
gassafetyprogress-web/src/components/emergency/Timeline.vue
View file @
f9d08cac
...
@@ -63,8 +63,8 @@
...
@@ -63,8 +63,8 @@
position
:
absolute
;
position
:
absolute
;
.out-circle
{
.out-circle
{
width
:
1
6
px
;
width
:
1
8
px
;
height
:
1
6
px
;
height
:
1
8
px
;
background
:
rgba
(
14
,
116
,
218
,
0
.1
);
background
:
rgba
(
14
,
116
,
218
,
0
.1
);
box-shadow
:
0px
4px
12px
0px
rgba
(
0
,
0
,
0
,
0
.1
);
box-shadow
:
0px
4px
12px
0px
rgba
(
0
,
0
,
0
,
0
.1
);
/*opacity: 0.1;*/
/*opacity: 0.1;*/
...
@@ -73,8 +73,8 @@
...
@@ -73,8 +73,8 @@
align-items
:
center
;
align-items
:
center
;
.in-circle
{
.in-circle
{
width
:
12
px
;
width
:
8
px
;
height
:
12
px
;
height
:
8
px
;
margin
:
0
auto
;
margin
:
0
auto
;
background
:
rgba
(
14
,
116
,
218
,
1
);
background
:
rgba
(
14
,
116
,
218
,
1
);
border-radius
:
50%
;
border-radius
:
50%
;
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
}
}
.long-line
{
.long-line
{
width
:
2
px
;
width
:
1
px
;
height
:
98px
;
height
:
98px
;
background
:
#ffffff
;
background
:
#ffffff
;
box-shadow
:
0px
4px
12px
0px
rgba
(
0
,
0
,
0
,
0
.1
);
box-shadow
:
0px
4px
12px
0px
rgba
(
0
,
0
,
0
,
0
.1
);
...
@@ -101,7 +101,7 @@
...
@@ -101,7 +101,7 @@
margin-bottom
:
30px
;
margin-bottom
:
30px
;
.timeline-title
{
.timeline-title
{
font-size
:
1
4
px
;
font-size
:
1
5
px
;
word-break
:
break-all
;
word-break
:
break-all
;
margin-bottom
:
16px
;
margin-bottom
:
16px
;
color
:
#d9d9d9
;
color
:
#d9d9d9
;
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
}
}
.timeline-date
{
.timeline-date
{
font-size
:
1
6
px
;
font-size
:
1
3
px
;
color
:
#dfe4ed
;
color
:
#dfe4ed
;
font-weight
:
500
;
font-weight
:
500
;
margin-bottom
:
16px
;
margin-bottom
:
16px
;
...
...
gassafetyprogress-web/src/components/emergency/rightBar.vue
View file @
f9d08cac
...
@@ -31,10 +31,21 @@
...
@@ -31,10 +31,21 @@
<div
v-if=
"userType==-2"
class=
"button-div"
@
click=
"showList(item.id)"
>
预案指引
</div>
<div
v-if=
"userType==-2"
class=
"button-div"
@
click=
"showList(item.id)"
>
预案指引
</div>
<div
v-if=
"item.status==3 && userType==-2"
class=
"button-div"
@
click=
"endevent(item.id)"
>
事件结案
</div>
<div
v-if=
"item.status==3 && userType==-2"
class=
"button-div"
@
click=
"endevent(item.id)"
>
事件结案
</div>
<div
v-if=
"userType!=-2"
class=
"button-div"
@
click=
"showList(item.id)"
>
信息处置
</div>
<div
v-if=
"userType!=-2"
class=
"button-div"
@
click=
"showList(item.id)"
>
信息处置
</div>
<div
class=
"button-div"
@
click=
"showDetail(item.id,$event)"
>
详情
</div>
<div
class=
"button-div"
@
click=
"showDetail(item.id,item.eventName)"
>
详情
</div>
</div>
</div>
<div
id =
"detail"
class=
"show-detail"
style=
"display: none;margin-top: 15px;margin-bottom: 20px;position:fixed;right: 470px;width: 300px;
background: rgba(0, 0, 0, 0.7);top: 110px"
>
<div
class=
"el-form-div"
style=
"height: 30px;"
>
<div
class=
"detail-title"
>
{{
detailTitle
}}
</div>
<div
style=
"cursor: pointer;"
@
click=
"closeDetail()"
>
<img
style=
"width: 20px;height: 20px;margin-top: 5px;"
src=
"@/assets/mapImages/closeBtn.png"
alt=
""
/>
</div>
</div>
</div>
<div
:id =
"item.id"
style=
"display: none;margin-top: 15px;margin-bottom: 20px;"
>
<timeline
:timeline-list=
"handleList"
></timeline>
<timeline
:timeline-list=
"handleList"
></timeline>
<div
style=
"height: 40px;"
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -166,6 +177,7 @@
...
@@ -166,6 +177,7 @@
</template>
</template>
<
script
>
<
script
>
import
{
mapGetters
}
from
'vuex'
import
{
listReceive
,
getReceive
,
delReceive
,
addReceive
,
updateReceive
}
from
"@/api/system/receive"
;
import
{
listReceive
,
getReceive
,
delReceive
,
addReceive
,
updateReceive
}
from
"@/api/system/receive"
;
import
{
listHandle
,
getHandle
,
delHandle
,
addHandle
,
updateHandle
,
exportHandle
}
from
"@/api/system/handle"
;
import
{
listHandle
,
getHandle
,
delHandle
,
addHandle
,
updateHandle
,
exportHandle
}
from
"@/api/system/handle"
;
import
{
listPlanInfo
}
from
"@/api/system/planInfo"
;
import
{
listPlanInfo
}
from
"@/api/system/planInfo"
;
...
@@ -201,6 +213,7 @@ export default {
...
@@ -201,6 +213,7 @@ export default {
status
:
5
,
status
:
5
,
enterpriseId
:
""
enterpriseId
:
""
},
},
detailTitle
:
""
,
form
:
''
,
form
:
''
,
// 遮罩层
// 遮罩层
loading
:
true
,
loading
:
true
,
...
@@ -226,6 +239,11 @@ export default {
...
@@ -226,6 +239,11 @@ export default {
}
}
};
};
},
},
computed
:{
...
mapGetters
([
"emergencyData"
]),
},
mounted
()
{
mounted
()
{
// this.$nextTick(()=>{
// this.$nextTick(()=>{
// this.getScrollHeight();
// this.getScrollHeight();
...
@@ -235,10 +253,45 @@ export default {
...
@@ -235,10 +253,45 @@ export default {
if
(
this
.
userType
!=-
2
){
if
(
this
.
userType
!=-
2
){
this
.
queryParams
.
enterpriseId
=
response
.
data
.
deptId
;
this
.
queryParams
.
enterpriseId
=
response
.
data
.
deptId
;
}
}
this
.
getList
();
this
.
getList
(
1
);
});
});
//定时检测新消息
this
.
socket
();
setInterval
(()
=>
{
// //定时检测新消息
// setInterval(() => {
//
// }, 5000);
},
watch
:{
emergencyData
:{
handler
(
val
)
{
this
.
showDetail
(
val
.
eventId
,
val
.
eventName
);
console
.
log
(
'深度监听:'
,
val
);
},
deep
:
true
}
},
methods
:
{
socket
()
{
console
.
log
(
"socket执行"
);
this
.
ws
=
new
WebSocket
(
"ws://192.168.2.17:8903/gassafety/websocketServer"
);
this
.
ws
.
onopen
=
(
evt
)
=>
{
console
.
log
(
"WebSockets开启"
);
};
this
.
ws
.
onmessage
=
(
evt
)
=>
{
console
.
log
(
"推送"
,
evt
);
const
obj
=
JSON
.
parse
(
evt
.
data
);
console
.
log
(
"接受socketobj"
,
obj
);
this
.
getNow
();
};
this
.
ws
.
onclose
=
()
=>
{
console
.
log
(
"ws协议关闭"
);
};
},
getNow
(){
var
params
=
this
.
queryParams
;
var
params
=
this
.
queryParams
;
if
(
this
.
userType
==-
2
){
if
(
this
.
userType
==-
2
){
params
.
governmentRead
=
0
params
.
governmentRead
=
0
...
@@ -250,9 +303,9 @@ export default {
...
@@ -250,9 +303,9 @@ export default {
newList
.
forEach
((
model
)
=>
{
newList
.
forEach
((
model
)
=>
{
this
.
receiveList
.
forEach
((
item
)
=>
{
this
.
receiveList
.
forEach
((
item
)
=>
{
if
(
item
.
id
==
model
.
id
){
if
(
item
.
id
==
model
.
id
){
console
.
log
(
"---------------"
+
item
.
id
)
if
(
this
.
userType
==-
2
){
if
(
this
.
userType
==-
2
){
item
.
governmentRead
=
0
;
item
.
governmentRead
=
0
;
item
.
status
=
3
;
}
else
{
}
else
{
item
.
companyRead
=
0
;
item
.
companyRead
=
0
;
}
}
...
@@ -260,15 +313,19 @@ export default {
...
@@ -260,15 +313,19 @@ export default {
});
});
});
});
});
});
},
5000
);
},
},
methods
:
{
/** 查询事件接报列表 */
/** 查询事件接报列表 */
getList
()
{
getList
(
type
)
{
console
.
log
(
"******"
+
type
)
listReceive
(
this
.
queryParams
).
then
(
response
=>
{
listReceive
(
this
.
queryParams
).
then
(
response
=>
{
this
.
receiveList
=
response
.
rows
;
this
.
receiveList
=
response
.
rows
;
if
(
type
==
1
){
if
(
this
.
$route
.
query
.
eventId
!=
undefined
){
this
.
showDetail
(
this
.
$route
.
query
.
eventId
,
this
.
$route
.
query
.
eventName
);
}
}
//this.total = response.total;
//this.total = response.total;
console
.
log
(
this
.
receiveList
)
//
console.log(this.receiveList)
});
});
},
},
//获取事件处置列表
//获取事件处置列表
...
@@ -285,6 +342,11 @@ export default {
...
@@ -285,6 +342,11 @@ export default {
this
.
open
=
true
;
this
.
open
=
true
;
this
.
title
=
"事件处置"
;
this
.
title
=
"事件处置"
;
this
.
queryParams2
.
eventId
=
id
this
.
queryParams2
.
eventId
=
id
if
(
this
.
userType
==-
2
){
this
.
queryParams2
.
eventType
=
2
;
}
else
{
this
.
queryParams2
.
eventType
=
1
;
}
this
.
getHandleList
();
this
.
getHandleList
();
},
},
choice
()
{
choice
()
{
...
@@ -299,6 +361,7 @@ export default {
...
@@ -299,6 +361,7 @@ export default {
/** 新增按钮操作 */
/** 新增按钮操作 */
handleAdd
()
{
handleAdd
()
{
this
.
reset
();
this
.
reset
();
this
.
fileList
=
[]
this
.
readonly1
=
false
;
this
.
readonly1
=
false
;
this
.
display
=
""
;
this
.
display
=
""
;
this
.
display2
=
"display:none"
;
this
.
display2
=
"display:none"
;
...
@@ -306,7 +369,7 @@ export default {
...
@@ -306,7 +369,7 @@ export default {
this
.
title2
=
"添加事件处置"
;
this
.
title2
=
"添加事件处置"
;
this
.
form
.
eventId
=
this
.
queryParams2
.
eventId
this
.
form
.
eventId
=
this
.
queryParams2
.
eventId
},
},
/**
修改按钮操作
*/
/**
新增预案
*/
handleUpdate
()
{
handleUpdate
()
{
this
.
reset
();
this
.
reset
();
this
.
readonly1
=
true
;
this
.
readonly1
=
true
;
...
@@ -373,10 +436,11 @@ export default {
...
@@ -373,10 +436,11 @@ export default {
});
});
},
},
upReceive
(
id
){
upReceive
(
id
){
var
receiveform
=
{
id
:
id
,
status
:
3
}
var
receiveform
=
{
id
:
id
}
if
(
this
.
form
.
eventType
==
2
){
if
(
this
.
form
.
eventType
==
2
){
receiveform
.
companyRead
=
0
;
receiveform
.
companyRead
=
0
;
}
else
{
}
else
{
receiveform
.
status
=
3
;
receiveform
.
governmentRead
=
0
;
receiveform
.
governmentRead
=
0
;
}
}
updateReceive
(
receiveform
).
then
(
response
=>
{
updateReceive
(
receiveform
).
then
(
response
=>
{
...
@@ -435,27 +499,23 @@ export default {
...
@@ -435,27 +499,23 @@ export default {
assignTask
(
item
){
assignTask
(
item
){
this
.
$parent
.
handleUpdate
(
item
);
this
.
$parent
.
handleUpdate
(
item
);
},
},
async
showDetail
(
id
,
event
){
async
showDetail
(
id
,
title
){
var
that
=
this
;
var
that
=
this
;
that
.
detailTitle
=
title
;
that
.
queryParams2
.
eventId
=
id
that
.
queryParams2
.
eventId
=
id
that
.
queryParams2
.
pageSize
=
100
;
that
.
queryParams2
.
pageSize
=
100
;
if
(
event
.
target
.
innerText
==
"详情"
){
await
listHandle
(
that
.
queryParams2
).
then
(
response
=>
{
await
listHandle
(
that
.
queryParams2
).
then
(
response
=>
{
this
.
handleList
=
response
.
rows
;
this
.
handleList
=
response
.
rows
;
if
(
response
.
total
==
0
){
if
(
response
.
total
==
0
){
this
.
msgSuccess
(
"暂无详情"
);
this
.
msgSuccess
(
"暂无详情"
);
}
else
{
}
else
{
event
.
target
.
innerText
=
"关闭"
;
document
.
getElementById
(
"detail"
).
style
.
display
=
""
;
document
.
getElementById
(
id
).
style
.
display
=
""
;
that
.
updateRead
(
id
);
that
.
updateRead
(
id
);
}
}
});
});
}
else
{
},
event
.
target
.
innerText
=
"详情"
;
closeDetail
(
id
,
event
){
document
.
getElementById
(
id
).
style
.
display
=
"none"
;
document
.
getElementById
(
"detail"
).
style
.
display
=
"none"
;
}
},
},
//更改读取状态
//更改读取状态
updateRead
(
id
){
updateRead
(
id
){
...
@@ -607,6 +667,12 @@ export default {
...
@@ -607,6 +667,12 @@ export default {
border-width
:
0
;
border-width
:
0
;
color
:
rgb
(
48
,
180
,
107
);
color
:
rgb
(
48
,
180
,
107
);
}
}
.detail-title
{
height
:
100%
;
width
:
270px
;
color
:
white
;
margin-left
:
20px
;
}
.massage
{
.massage
{
color
:
#00ffff
;
color
:
#00ffff
;
}
}
...
...
gassafetyprogress-web/src/layout/components/Navbar.vue
View file @
f9d08cac
...
@@ -11,11 +11,30 @@
...
@@ -11,11 +11,30 @@
<!--
<img
src=
"@/assets/xiaoxi.png"
:hidden=
"xiaohidden"
style=
"height: 40px;width: 40px;margin-top: 5px;cursor: pointer;"
>
-->
<!--
<img
src=
"@/assets/xiaoxi.png"
:hidden=
"xiaohidden"
style=
"height: 40px;width: 40px;margin-top: 5px;cursor: pointer;"
>
-->
<!--
</div>
-->
<!--
</div>
-->
<!--
<search
id=
"header-search"
class=
"right-menu-item"
/>
-->
<!--
<search
id=
"header-search"
class=
"right-menu-item"
/>
-->
<el-badge
:value=
"total"
:max=
"99"
class=
"item"
>
<!--
<el-badge
:value=
"total"
:max=
"99"
class=
"item"
>
-->
<i
class=
"el-icon-chat-dot-round"
style=
"width: 10px;height: 10px;"
@
click=
"$router.push('/emergency/emergency')"
></i>
<!--
<i
class=
"el-icon-chat-dot-round"
style=
"width: 10px;height: 10px;"
></i>
-->
</el-badge>
<!--
</el-badge>
-->
<el-dropdown
class=
"avatar-container right-menu-item hover-effect"
style=
"margin-right: 0px"
trigger=
"click"
>
<div
class=
"avatar-wrapper"
>
<el-badge
:value=
"total"
:max=
"99"
class=
"item"
>
<i
class=
"el-icon-chat-dot-round"
style=
"width: 10px;height: 10px;"
></i>
</el-badge>
</div>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
v-if=
"total==0"
>
<span>
暂无消息
</span>
</el-dropdown-item>
<div
v-for=
"(item,index) in receivedList"
>
<el-dropdown-item
v-if=
"index==0"
@
click
.
native=
"openMassage(item.id,item.eventName)"
>
<span>
您有新消息:
{{
item
.
eventName
}}
</span>
</el-dropdown-item>
<el-dropdown-item
v-if=
"index>0"
divided
@
click
.
native=
"openMassage(item.id,item.eventName)"
>
<span>
您有新消息:
{{
item
.
eventName
}}
</span>
</el-dropdown-item>
</div>
</el-dropdown-menu>
</el-dropdown>
<screenfull
id=
"screenfull"
class=
"right-menu-item hover-effect"
/>
<screenfull
id=
"screenfull"
class=
"right-menu-item hover-effect"
/>
<!--
<el-tooltip
content=
"布局大小"
effect=
"dark"
placement=
"bottom"
>
<!--
<el-tooltip
content=
"布局大小"
effect=
"dark"
placement=
"bottom"
>
...
@@ -46,7 +65,7 @@
...
@@ -46,7 +65,7 @@
</template>
</template>
<
script
>
<
script
>
import
{
mapGetters
}
from
'vuex'
import
{
mapGetters
,
mapMutations
}
from
'vuex'
import
Breadcrumb
from
'@/components/Breadcrumb'
import
Breadcrumb
from
'@/components/Breadcrumb'
import
TopNav
from
'@/components/TopNav'
import
TopNav
from
'@/components/TopNav'
import
Hamburger
from
'@/components/Hamburger'
import
Hamburger
from
'@/components/Hamburger'
...
@@ -69,13 +88,15 @@ export default {
...
@@ -69,13 +88,15 @@ export default {
userType
:
-
2
,
userType
:
-
2
,
total
:
null
,
total
:
null
,
xiaohidden
:
false
,
xiaohidden
:
false
,
receivedList
:[],
routerPath
:
""
,
}
}
},
},
computed
:
{
computed
:
{
...
mapGetters
([
...
mapGetters
([
'sidebar'
,
'sidebar'
,
'avatar'
,
'avatar'
,
'device'
'device'
,
]),
]),
setting
:
{
setting
:
{
get
()
{
get
()
{
...
@@ -95,11 +116,71 @@ export default {
...
@@ -95,11 +116,71 @@ export default {
}
}
},
},
mounted
(){
mounted
(){
getUserProfile
().
then
(
response
=>
{
getUserProfile
().
then
(
response
=>
{
this
.
userType
=
response
.
data
.
deptId
;
this
.
userType
=
response
.
data
.
deptId
;
if
(
this
.
userType
!=-
2
){
this
.
queryParams
.
enterpriseId
=
response
.
data
.
deptId
;
}
this
.
getList
();
});
});
//定时检测新消息
this
.
socket
();
setInterval
(()
=>
{
},
methods
:
{
...
mapMutations
({
SET_EMERGENCY
:
"bigWindowCompany/SET_EMERGENCY"
}
),
toggleSideBar
()
{
this
.
$store
.
dispatch
(
'app/toggleSideBar'
)
},
async
logout
()
{
this
.
$confirm
(
'确定注销并退出系统吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
this
.
$store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
location
.
href
=
'/index'
;
})
}).
catch
(()
=>
{});
},
openMassage
(
id
,
title
){
//this.$router.push('/emergency/emergency?eventid='+id);
this
.
routerPath
=
"/emergency/emergency"
;
if
(
window
.
location
.
pathname
==
this
.
routerPath
){
// this.$parent.showDetail(id,title);
this
.
SET_EMERGENCY
({
eventId
:
id
,
eventName
:
title
,
})
}
else
{
this
.
$router
.
push
({
path
:
this
.
routerPath
,
query
:{
eventId
:
id
,
eventName
:
title
}});
}
},
socket
()
{
console
.
log
(
"socket执行"
);
this
.
ws
=
new
WebSocket
(
"ws://192.168.2.17:8903/gassafety/websocketServer"
);
this
.
ws
.
onopen
=
(
evt
)
=>
{
console
.
log
(
"WebSockets开启"
);
};
this
.
ws
.
onmessage
=
(
evt
)
=>
{
console
.
log
(
"推送"
,
evt
);
const
obj
=
JSON
.
parse
(
evt
.
data
);
console
.
log
(
"接受socketobj"
,
obj
);
this
.
getList
();
};
this
.
ws
.
onclose
=
()
=>
{
console
.
log
(
"ws协议关闭"
);
};
},
getList
(){
console
.
log
(
this
.
userType
)
var
params
=
{
var
params
=
{
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
100
,
pageSize
:
100
,
...
@@ -112,32 +193,14 @@ mounted(){
...
@@ -112,32 +193,14 @@ mounted(){
}
else
{
}
else
{
params
.
companyRead
=
0
params
.
companyRead
=
0
}
}
console
.
log
(
params
)
listReceive
(
params
).
then
(
response
=>
{
listReceive
(
params
).
then
(
response
=>
{
console
.
log
(
"total=="
,
response
)
;
this
.
receivedList
=
response
.
rows
;
if
(
response
.
total
!=
0
){
if
(
response
.
total
!=
0
){
this
.
total
=
response
.
total
;
this
.
total
=
response
.
total
;
}
else
{
}
else
{
this
.
total
=
""
;
this
.
total
=
""
;
}
}
});
});
},
5000
);
},
methods
:
{
toggleSideBar
()
{
this
.
$store
.
dispatch
(
'app/toggleSideBar'
)
},
async
logout
()
{
this
.
$confirm
(
'确定注销并退出系统吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
this
.
$store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
location
.
href
=
'/index'
;
})
}).
catch
(()
=>
{});
}
}
}
}
}
}
...
...
gassafetyprogress-web/src/store/getters.js
View file @
f9d08cac
...
@@ -24,5 +24,6 @@ const getters = {
...
@@ -24,5 +24,6 @@ const getters = {
defaultRoutes
:
state
=>
state
.
permission
.
defaultRoutes
,
defaultRoutes
:
state
=>
state
.
permission
.
defaultRoutes
,
sidebarRouters
:
state
=>
state
.
permission
.
sidebarRouters
,
sidebarRouters
:
state
=>
state
.
permission
.
sidebarRouters
,
company
:
state
=>
state
.
bigWindowCompany
.
company
,
company
:
state
=>
state
.
bigWindowCompany
.
company
,
emergencyData
:
state
=>
state
.
bigWindowCompany
.
emergencyData
,
}
}
export
default
getters
export
default
getters
gassafetyprogress-web/src/store/modules/bigWindowCompany.js
View file @
f9d08cac
...
@@ -11,6 +11,11 @@ import { getCompany } from "@/api/bigWindow/getDevice";
...
@@ -11,6 +11,11 @@ import { getCompany } from "@/api/bigWindow/getDevice";
const
state
=
{
const
state
=
{
// 公司名称
// 公司名称
company
:
{},
company
:
{},
//应急处置消息详情
emergencyData
:{
eventId
:
99999
,
eventName
:
""
,
}
};
};
const
mutations
=
{
const
mutations
=
{
...
@@ -21,6 +26,13 @@ const mutations = {
...
@@ -21,6 +26,13 @@ const mutations = {
}));
}));
console
.
log
(
state
.
company
);
console
.
log
(
state
.
company
);
},
},
SET_EMERGENCY
:
(
state
,
emergencyData
)
=>
{
state
.
emergencyData
=
emergencyData
}
};
};
const
actions
=
{
const
actions
=
{
...
...
gassafetyprogress-web/src/views/emergency/index.vue
View file @
f9d08cac
...
@@ -355,13 +355,13 @@ export default {
...
@@ -355,13 +355,13 @@ export default {
name
:
"医 院"
,
name
:
"医 院"
,
},
},
{
{
val
:
1
4
,
val
:
1
5
,
ischeck
:
false
,
ischeck
:
false
,
imgurl
:
require
(
"@/assets/image/yj-xf.png"
),
imgurl
:
require
(
"@/assets/image/yj-xf.png"
),
name
:
"消防队伍"
,
name
:
"消防队伍"
,
},
},
{
{
val
:
1
5
,
val
:
1
6
,
ischeck
:
false
,
ischeck
:
false
,
imgurl
:
require
(
"@/assets/image/yj-xj.png"
),
imgurl
:
require
(
"@/assets/image/yj-xj.png"
),
name
:
"巡检人员"
,
name
:
"巡检人员"
,
...
...
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