@ -1,71 +1,87 @@ |
|||
//package org.nl.acs.plc.rest;
|
|||
//
|
|||
//import org.nl.common.logging.annotation.Log;
|
|||
//import org.nl.acs.plc.service.OpcPlcService;
|
|||
//import org.nl.acs.opc.service.dto.OpcPlcDto;
|
|||
//import org.nl.acs.opc.service.dto.OpcPlcQueryParam;
|
|||
//import org.springframework.data.domain.Pageable;
|
|||
//import lombok.RequiredArgsConstructor;
|
|||
//import org.springframework.http.HttpStatus;
|
|||
//import org.springframework.http.ResponseEntity;
|
|||
//import org.springframework.validation.annotation.Validated;
|
|||
//import org.springframework.web.bind.annotation.*;
|
|||
//import io.swagger.annotations.*;
|
|||
//import java.util.Set;
|
|||
//
|
|||
///**
|
|||
//* @author jiaolm
|
|||
//* @date 2023-05-09
|
|||
//**/
|
|||
//@RestController
|
|||
//@RequiredArgsConstructor
|
|||
//@Api(tags = "plc服务管理")
|
|||
//@RequestMapping("/api/opcPlc")
|
|||
//public class OpcPlcController {
|
|||
//
|
|||
// private final OpcPlcService opcPlcService;
|
|||
//
|
|||
// @GetMapping
|
|||
// @Log("查询plc服务")
|
|||
// @ApiOperation("查询plc服务")
|
|||
// //@PreAuthorize("@el.check('opcPlc:list')")
|
|||
// public ResponseEntity query(OpcPlcQueryParam query, Pageable pageable){
|
|||
// return new ResponseEntity<>(opcPlcService.queryAll(query,pageable),HttpStatus.OK);
|
|||
// }
|
|||
//
|
|||
// @PostMapping
|
|||
// @Log("新增plc服务")
|
|||
// @ApiOperation("新增plc服务")
|
|||
// //@PreAuthorize("@el.check('opcPlc:add')")
|
|||
// public ResponseEntity create(@Validated @RequestBody OpcPlcDto resources){
|
|||
// return new ResponseEntity<>(opcPlcService.insert(resources),HttpStatus.CREATED);
|
|||
// }
|
|||
//
|
|||
// @PutMapping
|
|||
// @Log("修改plc服务")
|
|||
// @ApiOperation("修改plc服务")
|
|||
// //@PreAuthorize("@el.check('opcPlc:edit')")
|
|||
// public ResponseEntity update(@Validated @RequestBody OpcPlcDto resources){
|
|||
// opcPlcService.updateById(resources);
|
|||
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
|||
// }
|
|||
//
|
|||
// @DeleteMapping
|
|||
// @Log("删除plc服务")
|
|||
// @ApiOperation("删除plc服务")
|
|||
// //@PreAuthorize("@el.check('opcPlc:del')")
|
|||
// public ResponseEntity delete(@RequestBody Set<String> ids) {
|
|||
// opcPlcService.removeByIds(ids);
|
|||
// return new ResponseEntity<>(HttpStatus.OK);
|
|||
// }
|
|||
//
|
|||
// /*
|
|||
// @Log("导出plc服务")
|
|||
// @ApiOperation("导出plc服务")
|
|||
// @GetMapping(value = "/download")
|
|||
// //@PreAuthorize("@el.check('opcPlc:list')")
|
|||
// public void download(HttpServletResponse response, OpcPlcQueryParam query) throws IOException {
|
|||
// opcPlcService.download(opcPlcService.queryAll(query), response);
|
|||
// }*/
|
|||
//
|
|||
//}
|
|||
package org.nl.acs.plc.rest; |
|||
|
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.acs.plc.service.OpcPlcService; |
|||
import org.nl.acs.opc.service.dto.OpcPlcDto; |
|||
import org.nl.acs.opc.service.dto.OpcPlcQueryParam; |
|||
import org.springframework.data.domain.Pageable; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import io.swagger.annotations.*; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author jiaolm |
|||
* @date 2023-05-09 |
|||
**/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "plc服务管理") |
|||
@RequestMapping("/api/opcPlc") |
|||
public class OpcPlcController { |
|||
|
|||
private final OpcPlcService opcPlcService; |
|||
|
|||
@GetMapping |
|||
@Log("查询plc服务") |
|||
@ApiOperation("查询plc服务") |
|||
//@PreAuthorize("@el.check('opcPlc:list')")
|
|||
public ResponseEntity query(OpcPlcQueryParam query, Pageable pageable){ |
|||
return new ResponseEntity<>(opcPlcService.queryAll(query,pageable),HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增plc服务") |
|||
@ApiOperation("新增plc服务") |
|||
//@PreAuthorize("@el.check('opcPlc:add')")
|
|||
public ResponseEntity create(@Validated @RequestBody OpcPlcDto resources){ |
|||
return new ResponseEntity<>(opcPlcService.insert(resources),HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改plc服务") |
|||
@ApiOperation("修改plc服务") |
|||
//@PreAuthorize("@el.check('opcPlc:edit')")
|
|||
public ResponseEntity update(@Validated @RequestBody OpcPlcDto resources){ |
|||
opcPlcService.updateById(resources); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
@Log("删除plc服务") |
|||
@ApiOperation("删除plc服务") |
|||
//@PreAuthorize("@el.check('opcPlc:del')")
|
|||
public ResponseEntity delete(@RequestBody Set<String> ids) { |
|||
opcPlcService.removeByIds(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@GetMapping("/selectList") |
|||
@Log("下拉选PLC") |
|||
@ApiOperation("下拉选PLC") |
|||
//@PreAuthorize("@el.check('routePlan:list')")
|
|||
public ResponseEntity<Object> selectList() { |
|||
return new ResponseEntity<>(opcPlcService.selectList(), HttpStatus.OK); |
|||
} |
|||
|
|||
@GetMapping("/selectList/{opc_uuid}") |
|||
@Log("下拉选PLC") |
|||
@ApiOperation("下拉选PLC") |
|||
//@PreAuthorize("@el.check('routePlan:list')")
|
|||
public ResponseEntity<Object> selectListByOpcID(@PathVariable String opc_uuid) { |
|||
return new ResponseEntity<>(opcPlcService.selectListByOpcID(opc_uuid), HttpStatus.OK); |
|||
} |
|||
|
|||
/* |
|||
@Log("导出plc服务") |
|||
@ApiOperation("导出plc服务") |
|||
@GetMapping(value = "/download") |
|||
//@PreAuthorize("@el.check('opcPlc:list')")
|
|||
public void download(HttpServletResponse response, OpcPlcQueryParam query) throws IOException { |
|||
opcPlcService.download(opcPlcService.queryAll(query), response); |
|||
}*/ |
|||
|
|||
} |
|||
|
@ -0,0 +1,42 @@ |
|||
|
|||
package org.nl.acs.udw.rest; |
|||
|
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.udw.service.UdwManageService; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "内存点位管理") |
|||
@RequestMapping("/api/udw") |
|||
@Slf4j |
|||
public class UdwManagerController { |
|||
|
|||
private final UdwManageService udwManageService; |
|||
|
|||
// @GetMapping
|
|||
// @Log("查询内存点位")
|
|||
// @ApiOperation("查询内存点位")
|
|||
// @SaIgnore
|
|||
// public ResponseEntity<Object> query(@RequestParam JSONObject whereJson) {
|
|||
// return new ResponseEntity<>(udwManageService.queryByConditions(whereJson), HttpStatus.OK);
|
|||
// }
|
|||
|
|||
@GetMapping |
|||
@ApiOperation("查询内存点位") |
|||
@SaIgnore |
|||
//@PreAuthorize("@el.check('device:list')")
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) { |
|||
return new ResponseEntity<>(udwManageService.queryAll(whereJson, page), HttpStatus.OK); |
|||
} |
|||
} |
@ -1,21 +0,0 @@ |
|||
package org.nl.start; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.boot.ApplicationArguments; |
|||
import org.springframework.boot.ApplicationRunner; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 随项目启动模块 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RequiredArgsConstructor |
|||
public class Init implements ApplicationRunner { |
|||
|
|||
@Override |
|||
public void run(ApplicationArguments args) throws Exception { |
|||
System.out.println("项目启动成功!"); |
|||
} |
|||
} |
@ -1,120 +0,0 @@ |
|||
# 端口 |
|||
server: |
|||
port: 9000 |
|||
|
|||
# Sa-Token 配置 |
|||
sa-token: |
|||
# ------- SSO-模式一相关配置 (非模式一不需要配置) |
|||
|
|||
# 配置 Cookie 作用域 |
|||
|
|||
# ------- SSO-模式二相关配置 |
|||
sso: |
|||
# Ticket有效期 (单位: 秒),默认五分钟 |
|||
ticket-timeout: 300 |
|||
# 所有允许的授权回调地址比较重要 |
|||
allow-url: "*" |
|||
# 是否打开单点注销功能 |
|||
is-slo: true |
|||
# ------- SSO-模式三相关配置 (下面的配置在SSO模式三并且 is-slo=true 时打开) |
|||
# # 是否打开模式三 |
|||
isHttp: true |
|||
# # 接口调用秘钥(用于SSO模式三的单点注销功能) |
|||
secretkey: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor |
|||
token-name: EL-ADMIN-TOEKN |
|||
# # ---- 除了以上配置项,你还需要为 Sa-Token 配置http请求处理器(文档有步骤说明) |
|||
# |
|||
spring: |
|||
#配置 Jpa |
|||
jpa: |
|||
hibernate: |
|||
ddl-auto: none |
|||
open-in-view: true |
|||
properties: |
|||
hibernate: |
|||
dialect: org.hibernate.dialect.MySQL5InnoDBDialect |
|||
enable_lazy_load_no_trans: true |
|||
# 数据源 |
|||
datasource: |
|||
druid: |
|||
db-type: com.alibaba.druid.pool.DruidDataSource |
|||
driverClassName: com.mysql.cj.jdbc.Driver |
|||
# url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:whxr_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true |
|||
url: jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:whxr}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true |
|||
username: ${DB_USER:root} |
|||
password: ${DB_PWD:P@ssw0rd} |
|||
# username: ${DB_USER:root} |
|||
# password: ${DB_PWD:root} |
|||
# 初始连接数 |
|||
initial-size: 5 |
|||
# 最小连接数 |
|||
min-idle: 15 |
|||
# 最大连接数 |
|||
max-active: 30 |
|||
# 是否自动回收超时连接 |
|||
remove-abandoned: true |
|||
# 超时时间(以秒数为单位) |
|||
remove-abandoned-timeout: 180 |
|||
# 获取连接超时时间 |
|||
max-wait: 300 |
|||
# 连接有效性检测时间 |
|||
time-between-eviction-runs-millis: 60000 |
|||
# 连接在池中最小生存的时间 |
|||
min-evictable-idle-time-millis: 300000 |
|||
# 连接在池中最大生存的时间 |
|||
max-evictable-idle-time-millis: 900000 |
|||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除 |
|||
test-while-idle: true |
|||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个 |
|||
test-on-borrow: true |
|||
# 是否在归还到池中前进行检验 |
|||
test-on-return: false |
|||
# 检测连接是否有效 |
|||
validation-query: select 1 |
|||
# 配置监控统计 |
|||
# webStatFilter: |
|||
# enabled: true |
|||
# stat-view-servlet: |
|||
# enabled: true |
|||
# url-pattern: /druid/* |
|||
# reset-enable: false |
|||
# filter: |
|||
# stat: |
|||
# enabled: true |
|||
# # 记录慢SQL |
|||
# log-slow-sql: true |
|||
# slow-sql-millis: 1000 |
|||
# merge-sql: true |
|||
# wall: |
|||
# config: |
|||
# multi-statement-allow: true |
|||
|
|||
# Redis配置 (SSO模式一和模式二使用Redis来同步会话) |
|||
redis: |
|||
# Redis数据库索引(默认为0) |
|||
database: 1 |
|||
# Redis服务器地址 |
|||
host: 47.96.133.178 |
|||
# Redis服务器连接端口 |
|||
port: 6479 |
|||
# Redis服务器连接密码(默认为空) |
|||
password: 942464Yy |
|||
# 连接超时时间 |
|||
timeout: 10s |
|||
lettuce: |
|||
pool: |
|||
# 连接池最大连接数 |
|||
max-active: 200 |
|||
# 连接池最大阻塞等待时间(使用负值表示没有限制) |
|||
max-wait: -1ms |
|||
# 连接池中的最大空闲连接 |
|||
max-idle: 10 |
|||
# 连接池中的最小空闲连接 |
|||
min-idle: 0 |
|||
|
|||
forest: |
|||
# 关闭 forest 请求日志打印 |
|||
log-enabled: false |
|||
|
|||
|
|||
|
@ -0,0 +1,27 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function add(data) { |
|||
return request({ |
|||
url: 'api/deviceErrorLog', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function del(ids) { |
|||
return request({ |
|||
url: 'api/deviceErrorLog/', |
|||
method: 'delete', |
|||
data: ids |
|||
}) |
|||
} |
|||
|
|||
export function edit(data) { |
|||
return request({ |
|||
url: 'api/deviceErrorLog', |
|||
method: 'put', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export default { add, edit, del } |
@ -0,0 +1,28 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function add(data) { |
|||
return request({ |
|||
url: 'api/task', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function del(ids) { |
|||
return request({ |
|||
url: 'api/task/', |
|||
method: 'delete', |
|||
data: ids |
|||
}) |
|||
} |
|||
|
|||
export function edit(data) { |
|||
return request({ |
|||
url: 'api/task', |
|||
method: 'put', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export default { edit, del } |
|||
|
@ -0,0 +1,34 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function getDicts() { |
|||
return request({ |
|||
url: 'api/dict/all', |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
export function add(data) { |
|||
return request({ |
|||
url: 'api/dict', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function del(ids) { |
|||
return request({ |
|||
url: 'api/dict/', |
|||
method: 'delete', |
|||
data: ids |
|||
}) |
|||
} |
|||
|
|||
export function edit(data) { |
|||
return request({ |
|||
url: 'api/dict', |
|||
method: 'put', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export default { add, edit, del } |
@ -0,0 +1,35 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function add(data) { |
|||
return request({ |
|||
url: 'api/param', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function del(ids) { |
|||
return request({ |
|||
url: 'api/param/', |
|||
method: 'delete', |
|||
data: ids |
|||
}) |
|||
} |
|||
|
|||
export function edit(data) { |
|||
return request({ |
|||
url: 'api/param', |
|||
method: 'put', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function getValueByCode(code) { |
|||
return request({ |
|||
url: 'api/param/getValueByCode', |
|||
method: 'post', |
|||
data: code |
|||
}) |
|||
} |
|||
|
|||
export default { add, edit, del, getValueByCode } |
After Width: | Height: | Size: 838 B |
After Width: | Height: | Size: 884 B |
After Width: | Height: | Size: 888 B |
After Width: | Height: | Size: 973 B |
After Width: | Height: | Size: 884 B |
After Width: | Height: | Size: 884 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 884 B |
After Width: | Height: | Size: 886 B |
After Width: | Height: | Size: 949 B |
@ -0,0 +1,181 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!--工具栏--> |
|||
<div class="head-container"> |
|||
<div v-if="crud.props.searchToggle"> |
|||
<!-- 搜索 --> |
|||
<el-select |
|||
v-model="form.unified_key" |
|||
placeholder="unified_key" |
|||
class="filter-item" |
|||
clearable |
|||
filterable |
|||
size="small" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option v-for="(item,index) in unified_key" :key="index" :label="item.label" :value="item.value" /> |
|||
</el-select> |
|||
<el-input |
|||
v-model="query.code" |
|||
size="small" |
|||
clearable |
|||
placeholder="编号" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
</div> |
|||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
|||
<crudOperation :permission="permission" /> |
|||
<!--表单组件--> |
|||
<el-dialog |
|||
:close-on-click-modal="false" |
|||
:before-close="crud.cancelCU" |
|||
:visible.sync="crud.status.cu > 0" |
|||
:title="crud.status.title" |
|||
width="500px" |
|||
> |
|||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
|||
<el-form-item label="unified_key"> |
|||
<el-input v-model="form.unified_key" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="编号"> |
|||
<el-input v-model="form.key" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="值"> |
|||
<el-input v-model="form.value" style="width: 370px;" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="text" @click="crud.cancelCU">取消</el-button> |
|||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="table" |
|||
v-loading="crud.loading" |
|||
:data="crud.data" |
|||
size="small" |
|||
style="width: 100%;" |
|||
@selection-change="crud.selectionChangeHandler" |
|||
> |
|||
<el-table-column prop="unified_key" label="unified_key" /> |
|||
<el-table-column prop="key" label="编号" /> |
|||
<el-table-column prop="value" label="值" /> |
|||
<el-table-column |
|||
v-permission="['admin','instruction:edit','instruction:del']" |
|||
fixed="left" |
|||
label="操作" |
|||
width="150px" |
|||
align="center" |
|||
> |
|||
<template slot-scope="scope"> |
|||
<el-button slot="right" size="mini" style="margin-left: -1px;margin-right: 2px" type="text" @click="dialogFormVisible = true"> |
|||
查询历史 |
|||
</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination /> |
|||
<!--弹窗设置设备与图标绑定与角度--> |
|||
<el-dialog title="历史" :visible.sync="dialogFormVisible" width="35%"> |
|||
<el-form :model="form" size="small"> |
|||
<el-form-item label="unified_key" prop="unified_key" label-width="100px"> |
|||
<el-input v-model="form.unified_key" :disabled="true" /> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="code" prop="key" label-width="100px"> |
|||
<el-input v-model="form.key" :disabled="true" /> |
|||
</el-form-item> |
|||
|
|||
</el-form> |
|||
</el-dialog> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import pagination from '@crud/Pagination' |
|||
import crudUdwData from '@/api/acs/history/udwData' |
|||
import CRUD, { crud, form, header, presenter } from '@crud/crud' |
|||
import crudOperation from '@crud/CRUD.operation' |
|||
import { getDicts } from '@/api/system/dict' |
|||
|
|||
const defaultForm = { |
|||
unified_key: '', |
|||
key: null, |
|||
value: null, |
|||
last_modify_date: null |
|||
} |
|||
export default { |
|||
dicts: [], |
|||
name: 'UdwData', |
|||
components: { pagination, crudOperation }, |
|||
mixins: [presenter(), header(), form(defaultForm), crud()], |
|||
cruds() { |
|||
return CRUD({ |
|||
title: '数据源', |
|||
url: 'api/udw/', |
|||
idField: 'key', |
|||
sort: 'key', |
|||
query: {}, |
|||
crudMethod: { ...crudUdwData }, |
|||
optShow: { |
|||
} |
|||
}) |
|||
}, |
|||
data() { |
|||
return { |
|||
unified_key: [ |
|||
{ |
|||
value: '1', |
|||
label: 'opc_value' |
|||
}, |
|||
{ |
|||
value: '2', |
|||
label: 'cached' |
|||
}, |
|||
{ |
|||
value: '3', |
|||
label: 'socket' |
|||
} |
|||
], |
|||
permission: { |
|||
}, |
|||
dialogFormVisible: false, |
|||
rules: { |
|||
}, |
|||
form: { |
|||
unified_key: 'opc_value', |
|||
key: null, |
|||
value: null, |
|||
last_modify_date: null |
|||
} |
|||
} |
|||
}, |
|||
created() { |
|||
getDicts().then(data => { |
|||
this.dicts = data |
|||
}) |
|||
}, |
|||
methods: { |
|||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
return true |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.el-dropdown-link { |
|||
cursor: pointer; |
|||
color: #409EFF; |
|||
} |
|||
|
|||
.el-icon-arrow-down { |
|||
font-size: 12px; |
|||
} |
|||
</style> |
@ -0,0 +1,18 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function getLogData(param) { |
|||
return request({ |
|||
url: 'api/lucene/getAll', |
|||
method: 'get', |
|||
data: param |
|||
}) |
|||
} |
|||
|
|||
export function labelsValues() { |
|||
return request({ |
|||
url: 'api/loki/labels/values', |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
export default { getLogData, labelsValues } |
@ -0,0 +1,109 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div class="head-container"> |
|||
<Search /> |
|||
<crudOperation /> |
|||
</div> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="table" |
|||
v-loading="crud.loading" |
|||
:data="crud.data" |
|||
style="width: 100%;" |
|||
@selection-change="crud.selectionChangeHandler" |
|||
> |
|||
<!-- <el-table-column type="selection" width="55"/>--> |
|||
<!-- <el-table-column v-if="false" prop="id" label="id"/>--> |
|||
<el-table-column prop="operate" width="50" label="操作" /> |
|||
<el-table-column prop="device_code" label="设备号" min-width="130" show-overflow-tooltip /> |
|||
<el-table-column prop="task_code" label="任务编号" /> |
|||
<el-table-column prop="instruct_code" label="指令编号" /> |
|||
<el-table-column prop="method" label="方法" /> |
|||
<el-table-column prop="status_code" label="状态码" /> |
|||
<el-table-column prop="requestparam" label="请求参数" /> |
|||
<el-table-column prop="responseparam" label="返回参数" /> |
|||
<el-table-column prop="logTime" width="170" label="记录时间" /> |
|||
<el-table-column prop="content" width="500" label="内容详情" /> |
|||
|
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Search from './search' |
|||
import CRUD, { crud, header, presenter } from '@crud/crud' |
|||
import crudOperation from '@crud/CRUD.operation' |
|||
import pagination from '@crud/Pagination' |
|||
import { delAll } from '@/api/acs/lucene/log' |
|||
|
|||
export default { |
|||
name: 'LuceneLog', |
|||
components: { Search, pagination, crudOperation }, |
|||
mixins: [presenter(), header(), crud()], |
|||
cruds: function() { |
|||
return CRUD({ |
|||
title: '系统参数', url: 'api/lucene/getAll', idField: 'id', sort: 'id,desc', |
|||
queryOnPresenterCreated: true, |
|||
optShow: { |
|||
add: false, |
|||
edit: false, |
|||
del: false, |
|||
download: false |
|||
}, |
|||
page: { |
|||
size: 40, |
|||
total: 0, |
|||
page: 0 |
|||
}, |
|||
query: { |
|||
createTime: [new Date(new Date().setTime(new Date().getTime() - 3600 * 1000)), new Date(new Date().setTime(new Date().getTime() + 3600 * 1000))] |
|||
} |
|||
}) |
|||
}, |
|||
data() { |
|||
return { |
|||
query: { blurry: '123' }, |
|||
permission: { |
|||
add: ['admin', 'param:add'], |
|||
edit: ['admin', 'param:edit'], |
|||
del: ['admin', 'param:del'] |
|||
}, |
|||
|
|||
rules: {} |
|||
} |
|||
}, |
|||
created() { |
|||
}, |
|||
methods: { |
|||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
return true |
|||
}, |
|||
confirmDelAll() { |
|||
this.$confirm(`确认清空所有操作日志吗?`, '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
this.crud.delAllLoading = true |
|||
delAll('device_execute').then(res => { |
|||
this.crud.delAllLoading = false |
|||
this.crud.dleChangePage(1) |
|||
this.crud.delSuccessNotify() |
|||
this.crud.toQuery() |
|||
}).catch(err => { |
|||
this.crud.delAllLoading = false |
|||
console.log(err.response.data.message) |
|||
}) |
|||
}).catch(() => { |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
@ -0,0 +1,150 @@ |
|||
<template> |
|||
<div v-if="crud.props.searchToggle"> |
|||
|
|||
<!-- <el-input |
|||
v-model="query.device_code" |
|||
clearable |
|||
size="small" |
|||
placeholder="请输入你要搜索的设备号" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
/> --> |
|||
<!-- <el-select |
|||
v-model="query.device_code" |
|||
clearable |
|||
filterable |
|||
size="small" |
|||
placeholder="请输入你要搜索的设备号" |
|||
class="filter-item" |
|||
style="width: 190px" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option v-for="item in device_codes" :key="item.id" :label="item.label" :value="item.value" /> |
|||
</el-select> --> |
|||
<el-select |
|||
ref="test" |
|||
v-model="query.device_code" |
|||
filterable |
|||
clearable |
|||
reserve-keyword |
|||
placeholder="设备号" |
|||
style="width: 190px;" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option |
|||
v-for="item in deviceList" |
|||
:key="item.device_code" |
|||
:label="item.device_code" |
|||
:value="item.device_code" |
|||
/> |
|||
</el-select> |
|||
|
|||
<el-input |
|||
v-model="query.method" |
|||
clearable |
|||
size="small" |
|||
placeholder="请输入你要搜索的方法名" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
/> |
|||
<el-input |
|||
v-model="query.status_code" |
|||
clearable |
|||
size="small" |
|||
placeholder="请输入你要搜索的状态码" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
/> |
|||
<el-input |
|||
v-model="query.requestparam" |
|||
clearable |
|||
size="small" |
|||
placeholder="请输入你要搜索的请求参数" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
/> |
|||
<el-input |
|||
v-model="query.responseparam" |
|||
clearable |
|||
size="small" |
|||
placeholder="请输入你要搜索的返回参数" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
/> |
|||
<el-input |
|||
v-model="query.blurry" |
|||
clearable |
|||
size="small" |
|||
placeholder="请输入你要搜索的内容详情" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
/> |
|||
<!-- |
|||
<date-range-picker v-model="query.createTime" class="date-item" /> |
|||
--> |
|||
|
|||
<el-date-picker |
|||
v-model="query.createTime" |
|||
type="datetimerange" |
|||
:picker-options="pickerOptions" |
|||
format="yyyy-MM-dd HH:mm:ss" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
align="right" |
|||
/> |
|||
<rrOperation /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { header } from '@crud/crud' |
|||
import rrOperation from '@crud/RR.operation' |
|||
import deviceCrud from '@/api/acs/device/device' |
|||
|
|||
export default { |
|||
components: { rrOperation }, |
|||
mixins: [header()], |
|||
|
|||
data() { |
|||
return { |
|||
pickerOptions: { |
|||
shortcuts: [{ |
|||
text: '最近一周', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}, { |
|||
text: '最近一个月', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}, { |
|||
text: '最近三个月', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}] |
|||
}, |
|||
value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)], |
|||
value2: '', |
|||
deviceList: [], |
|||
device_code: '' |
|||
} |
|||
}, |
|||
created() { |
|||
deviceCrud.selectDeviceList().then(data => { |
|||
this.deviceList = data |
|||
}) |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,64 @@ |
|||
<template> |
|||
<div v-if="crud.props.searchToggle"> |
|||
<!-- |
|||
<date-range-picker v-model="query.createTime" class="date-item" /> |
|||
--> |
|||
|
|||
<el-date-picker |
|||
v-model="query.createTime" |
|||
type="datetimerange" |
|||
:picker-options="pickerOptions" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
align="right" |
|||
/> |
|||
<rrOperation /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { header } from '@crud/crud' |
|||
import rrOperation from '@crud/RR.operation' |
|||
|
|||
export default { |
|||
components: { rrOperation }, |
|||
mixins: [header()], |
|||
|
|||
data() { |
|||
return { |
|||
pickerOptions: { |
|||
shortcuts: [{ |
|||
text: '最近一周', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}, { |
|||
text: '最近一个月', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}, { |
|||
text: '最近三个月', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}] |
|||
}, |
|||
value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)], |
|||
value2: '' |
|||
} |
|||
}, |
|||
created() { |
|||
} |
|||
} |
|||
</script> |
@ -1,223 +0,0 @@ |
|||
<template> |
|||
<el-dialog |
|||
title="监控详情" |
|||
append-to-body |
|||
:visible.sync="dialogVisible" |
|||
fullscreen |
|||
@open="open" |
|||
@close="close" |
|||
> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="18" style="border: 1px solid white"> |
|||
<span /> |
|||
</el-col> |
|||
<el-col :span="6" style="margin-bottom: 20px"> |
|||
<!-- <span style="float: right"> |
|||
<el-button icon="el-icon-close" size="mini" type="info" @click="dialogVisible = false">返 回</el-button> |
|||
</span>--> |
|||
</el-col> |
|||
</el-row> |
|||
<el-card class="box-card" shadow="never"> |
|||
<el-form ref="form" disabled :inline="true" :model="form" :rules="rules" size="mini" label-width="80px"> |
|||
<el-form-item label="设备编码"> |
|||
<el-input v-model="device_code" placeholder="自动生产" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="设备名称" prop="dtl_count"> |
|||
<el-input v-model="device_name" style="width: 200px;" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
</el-card> |
|||
<div class="crud-opts2" style="margin-top: 30px;margin-bottom: 15px"> |
|||
<el-form ref="form" disabled :inline="true" :model="form" :rules="rules" size="mini" label-width="200px"> |
|||
<el-form-item label="心跳"> |
|||
<el-input v-model="form.heartbeat" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="工作模式"> |
|||
<el-input v-model="form.mode" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="故障"> |
|||
<el-input v-model="form.error" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="故障次数"> |
|||
<el-input v-model="form.error_num" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="待机时间(调试)"> |
|||
<el-input v-model="form.ready_time" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="生产时间"> |
|||
<el-input v-model="form.running_time" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="故障时间"> |
|||
<el-input v-model="form.error_time" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="温度"> |
|||
<el-input v-model="form.temperature" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="当前生产产品编号"> |
|||
<el-input v-model="form.material" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="缺料信号"> |
|||
<el-input v-model="form.lack_material" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="上料数量"> |
|||
<el-input v-model="form.feeding_qty" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="下料数量"> |
|||
<el-input v-model="form.blanking_qty" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="当前生产合格品数量"> |
|||
<el-input v-model="form.qualified_qty" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="当前生产不合格品数量"> |
|||
<el-input v-model="form.unqualified_qty" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="生产完成"> |
|||
<el-input v-model="form.finish" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="任务号"> |
|||
<el-input v-model="form.task" style="width: 200px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="设备暂停"> |
|||
<el-input v-model="form.pause" style="width: 200px;" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import { crud } from '@crud/crud' |
|||
|
|||
export default { |
|||
name: 'XJDeviceMonitor', |
|||
components: {}, |
|||
mixins: [crud()], |
|||
props: { |
|||
dialogShow: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
openParam: { |
|||
type: Object |
|||
} |
|||
}, |
|||
dicts: [], |
|||
data() { |
|||
return { |
|||
dialogVisible: false, |
|||
form: { |
|||
heartbeat: '', |
|||
mode: '', |
|||
error: '', |
|||
error_num: '', |
|||
ready_time: '', |
|||
running_time: '', |
|||
error_time: '', |
|||
temperature: '', |
|||
material: '', |
|||
lack_material: '', |
|||
feeding_qty: '', |
|||
blanking_qty: '', |
|||
qualified_qty: '', |
|||
unqualified_qty: '', |
|||
finish: '', |
|||
task: '', |
|||
pause: '' |
|||
}, |
|||
device_code: '', |
|||
device_name: '', |
|||
rules: { |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
dialogShow: { |
|||
handler(newValue) { |
|||
this.dialogVisible = newValue |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
open() { |
|||
this.webSocket() |
|||
}, |
|||
close() { |
|||
this.$emit('AddChanged') |
|||
}, |
|||
setForm(data) { |
|||
this.dialogVisible = true |
|||
this.form = data.data |
|||
this.device_code = data.device_code |
|||
this.device_name = data.device_name |
|||
// this.form = row |
|||
}, |
|||
webSocket() { |
|||
const that = this |
|||
if (typeof (WebSocket) === 'undefined') { |
|||
this.$notify({ |
|||
title: '提示', |
|||
message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器!', |
|||
type: 'warning', |
|||
duration: 0 |
|||
}) |
|||
} else { |
|||
const id = 'xj_device_monitor' |
|||
// 获取token保存到vuex中的用户信息,此处仅适用于本项目,注意删除或修改 |
|||
// 实例化socket,这里我把用户名传给了后台,使后台能判断要把消息发给哪个用户,其实也可以后台直接获取用户IP来判断并推送 |
|||
|
|||
// const wsUri = process.env.VUE_APP_WS_API + '/webSocket/' + id |
|||
const wsUri = window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') + '/webSocket/' + id |
|||
this.socket = new WebSocket(wsUri) |
|||
// 监听socket打开 |
|||
this.socket.onopen = function() { |
|||
console.log('浏览器WebSocket已打开') |
|||
// that.socket.send('测试客户端发送消息') |
|||
} |
|||
|
|||
// 监听socket消息接收 |
|||
this.socket.onmessage = function(msg) { |
|||
const list = JSON.parse(msg.data).msg.detail |
|||
// console.log(list) |
|||
|
|||
for (const item of list) { |
|||
const obj = JSON.parse(JSON.stringify(item)) |
|||
if (obj.device_code === that.device_code) { |
|||
that.form = obj.data |
|||
} |
|||
} |
|||
} |
|||
|
|||
// 监听socket错误 |
|||
this.socket.onerror = function() { |
|||
that.$notify({ |
|||
title: '错误', |
|||
message: '服务器错误,无法接收实时报警信息', |
|||
type: 'error', |
|||
duration: 0 |
|||
}) |
|||
} |
|||
// 监听socket关闭 |
|||
this.socket.onclose = function() { |
|||
console.log('WebSocket已关闭') |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.crud-opts2 { |
|||
padding: 0 0; |
|||
display: -webkit-flex; |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
.crud-opts2 .crud-opts-right2 { |
|||
margin-left: auto; |
|||
padding: 4px 4px; |
|||
} |
|||
.input-with-select { |
|||
background-color: #fff; |
|||
} |
|||
</style> |