Compare commits
7 Commits
feffa239a6
...
kit_agv_ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b3d23e497 | ||
|
|
eb3ef7fd34 | ||
|
|
6285b8a823 | ||
|
|
bc1e4ca31f | ||
|
|
ea5c4cef7b | ||
|
|
ad95f612a0 | ||
|
|
4b24afc89f |
@@ -43,8 +43,7 @@ public class KitToAcsController {
|
||||
for (String o : kitToAcsParam.keySet()) {
|
||||
param = JSONObject.parseObject(o);
|
||||
}
|
||||
log.info("---kit上报请求---"+param.toString());
|
||||
System.out.println("---kit上报请求---"+param.toString());
|
||||
log.info("---kit上报请求---{}", param);
|
||||
return new ResponseEntity<>(kitToAcsService.agvCallback(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public enum TaskStateEnum {
|
||||
*/
|
||||
public static TaskStateEnum fromValue(String value) {
|
||||
for (TaskStateEnum state : values()) {
|
||||
if (state.getValue() == value) {
|
||||
if (state.getValue().equals(value)) {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.extInterface.wms.service.dto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CreateTaskRequest {
|
||||
private String houseCode;
|
||||
private String systemCode;
|
||||
private JSONObject parameters;
|
||||
private String taskCode;
|
||||
private String taskType;
|
||||
private String taskCreateDateTime;
|
||||
private String containerCode;
|
||||
private String containerType;
|
||||
private String locationFrom;
|
||||
private String locationTo;
|
||||
private Integer priority;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package org.nl.system.controller.notice;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.notice.IVersionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 版本更新通知控制器
|
||||
*
|
||||
* @author miguannan
|
||||
* @date 2026-05-06
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/version")
|
||||
public class VersionController {
|
||||
|
||||
@Autowired
|
||||
private IVersionService versionService;
|
||||
|
||||
/**
|
||||
* 发布版本更新通知
|
||||
*
|
||||
* @param json 版本信息
|
||||
* @return ResponseEntity
|
||||
*/
|
||||
@PostMapping("/release")
|
||||
@SaCheckPermission("version:release")
|
||||
public ResponseEntity<Object> release(@RequestBody JSONObject json) {
|
||||
versionService.releaseVersion(json);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前版本信息(供前端轮询)
|
||||
*
|
||||
* @return 版本信息
|
||||
*/
|
||||
@GetMapping("/current")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> current() {
|
||||
return new ResponseEntity<>(versionService.getCurrentVersion(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询版本通知列表
|
||||
*
|
||||
* @param pageQuery 分页参数
|
||||
* @return 版本通知分页数据
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@SaCheckPermission("version:list")
|
||||
public ResponseEntity<Object> list(PageQuery pageQuery) {
|
||||
return new ResponseEntity<>(versionService.listVersions(pageQuery), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改版本通知
|
||||
*
|
||||
* @param json 通知信息(id, title, content)
|
||||
* @return ResponseEntity
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
@SaCheckPermission("version:edit")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject json) {
|
||||
versionService.updateVersion(json);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除版本通知
|
||||
*
|
||||
* @param id 通知ID
|
||||
* @return ResponseEntity
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@SaCheckPermission("version:del")
|
||||
public ResponseEntity<Object> delete(@PathVariable String id) {
|
||||
versionService.deleteVersion(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.nl.system.service.notice;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.notice.dao.SysNotice;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 版本更新通知服务接口
|
||||
*
|
||||
* @author miguannan
|
||||
* @date 2026-05-06
|
||||
*/
|
||||
public interface IVersionService {
|
||||
|
||||
/**
|
||||
* 发布版本更新通知
|
||||
*
|
||||
* @param json 版本信息(version, title, content)
|
||||
*/
|
||||
void releaseVersion(JSONObject json);
|
||||
|
||||
/**
|
||||
* 获取当前版本信息
|
||||
*
|
||||
* @return 包含 version、enabled、pollInterval、releaseTime 的 Map
|
||||
*/
|
||||
Map<String, Object> getCurrentVersion();
|
||||
|
||||
/**
|
||||
* 查询版本通知列表
|
||||
*
|
||||
* @param pageQuery 分页参数
|
||||
* @return 版本通知分页数据
|
||||
*/
|
||||
IPage<SysNotice> listVersions(PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 修改版本通知
|
||||
*
|
||||
* @param json 通知信息(id, title, content)
|
||||
*/
|
||||
void updateVersion(JSONObject json);
|
||||
|
||||
/**
|
||||
* 删除版本通知
|
||||
*
|
||||
* @param id 通知ID
|
||||
*/
|
||||
void deleteVersion(String id);
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package org.nl.system.service.notice.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.enums.NoticeEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.mnt.websocket.MsgType;
|
||||
import org.nl.common.mnt.websocket.SocketMsg;
|
||||
import org.nl.common.mnt.websocket.WebSocketServer;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.system.service.notice.IVersionService;
|
||||
import org.nl.system.service.notice.dao.SysNotice;
|
||||
import org.nl.system.service.notice.dao.mapper.SysNoticeMapper;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 版本更新通知服务实现
|
||||
*
|
||||
* @author miguannan
|
||||
* @date 2026-05-06
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class VersionServiceImpl implements IVersionService {
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
@Autowired
|
||||
private ISysParamService paramService;
|
||||
|
||||
@Autowired
|
||||
private SysNoticeMapper noticeMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void releaseVersion(JSONObject json) {
|
||||
String version = json.getString("version");
|
||||
String title = json.getString("title");
|
||||
String content = json.getString("content");
|
||||
|
||||
if (StrUtil.isBlank(version)) {
|
||||
throw new BadRequestException("版本号不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(title)) {
|
||||
throw new BadRequestException("标题不能为空");
|
||||
}
|
||||
|
||||
// 检查是否已有相同版本的未读通知,避免重复发布
|
||||
long count = noticeMapper.selectCount(new LambdaQueryWrapper<SysNotice>()
|
||||
.eq(SysNotice::getNotice_type, "version_update")
|
||||
.likeRight(SysNotice::getNotice_title, version + " "));
|
||||
if (count > 0) {
|
||||
throw new BadRequestException("已存在相同版本发布信息,请先处理后再发布");
|
||||
}
|
||||
|
||||
// 1. 创建通知记录
|
||||
noticeService.createNotice(content, version + " " + title, "version_update");
|
||||
|
||||
// 2. 更新系统版本号
|
||||
Param appVersionParam = paramService.findByCode("app_version");
|
||||
if (appVersionParam == null) {
|
||||
throw new BadRequestException("系统参数 app_version 不存在,请先执行初始化脚本");
|
||||
}
|
||||
appVersionParam.setValue(version);
|
||||
paramService.update(appVersionParam);
|
||||
|
||||
// 3. WebSocket 广播给所有在线用户
|
||||
JSONObject msgData = new JSONObject();
|
||||
msgData.put("data", "version_update");
|
||||
msgData.put("version", version);
|
||||
msgData.put("title", title);
|
||||
SocketMsg socketMsg = new SocketMsg(msgData, MsgType.INFO);
|
||||
try {
|
||||
WebSocketServer.sendInfo(socketMsg, null);
|
||||
} catch (IOException e) {
|
||||
log.error("版本更新WebSocket广播失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCurrentVersion() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 当前版本号
|
||||
Param appVersionParam = paramService.findByCode("app_version");
|
||||
String version = (appVersionParam != null) ? appVersionParam.getValue() : "1.0.0";
|
||||
|
||||
// 功能开关
|
||||
Param enabledParam = paramService.findByCode("version_notify_enabled");
|
||||
boolean enabled = (enabledParam == null) || "true".equals(enabledParam.getValue());
|
||||
|
||||
// 轮询间隔
|
||||
Param intervalParam = paramService.findByCode("version_notify_poll_interval");
|
||||
int pollInterval = 30;
|
||||
if (intervalParam != null && StrUtil.isNotBlank(intervalParam.getValue())) {
|
||||
try {
|
||||
pollInterval = Integer.parseInt(intervalParam.getValue());
|
||||
} catch (NumberFormatException e) {
|
||||
log.warn("version_notify_poll_interval 值非法: {}", intervalParam.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
result.put("version", version);
|
||||
result.put("enabled", enabled);
|
||||
result.put("pollInterval", pollInterval);
|
||||
|
||||
// 最新版本通知的发布时间
|
||||
SysNotice latest = noticeMapper.selectOne(new QueryWrapper<SysNotice>()
|
||||
.eq("notice_type", "version_update")
|
||||
.orderByDesc("create_time")
|
||||
.last("LIMIT 1"));
|
||||
if (latest != null) {
|
||||
result.put("releaseTime", latest.getCreate_time());
|
||||
// notice_title 存储格式为 "version title",分离出版本号和标题
|
||||
String noticeTitle = latest.getNotice_title();
|
||||
if (StrUtil.isNotBlank(noticeTitle) && noticeTitle.startsWith(version + " ")) {
|
||||
result.put("title", noticeTitle.substring(version.length() + 1));
|
||||
} else {
|
||||
result.put("title", noticeTitle);
|
||||
}
|
||||
result.put("content", latest.getNotice_content());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<SysNotice> listVersions(PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysNotice> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(SysNotice::getNotice_type, "version_update")
|
||||
.orderByDesc(SysNotice::getCreate_time);
|
||||
IPage<SysNotice> pages = new Page<>(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
noticeMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateVersion(JSONObject json) {
|
||||
String id = json.getString("id");
|
||||
String title = json.getString("title");
|
||||
String content = json.getString("content");
|
||||
|
||||
if (StrUtil.isBlank(id)) {
|
||||
throw new BadRequestException("ID不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(title)) {
|
||||
throw new BadRequestException("标题不能为空");
|
||||
}
|
||||
|
||||
SysNotice notice = noticeMapper.selectById(id);
|
||||
if (notice == null || !"version_update".equals(notice.getNotice_type())) {
|
||||
throw new BadRequestException("版本通知不存在");
|
||||
}
|
||||
|
||||
notice.setNotice_title(title);
|
||||
notice.setNotice_content(content);
|
||||
noticeMapper.updateById(notice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteVersion(String id) {
|
||||
if (StrUtil.isBlank(id)) {
|
||||
throw new BadRequestException("ID不能为空");
|
||||
}
|
||||
SysNotice notice = noticeMapper.selectById(id);
|
||||
if (notice == null || !"version_update".equals(notice.getNotice_type())) {
|
||||
throw new BadRequestException("版本通知不存在");
|
||||
}
|
||||
noticeMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
@@ -144,6 +144,8 @@ security:
|
||||
- /api/localStorage/pictures
|
||||
# 参数
|
||||
- /api/param/getValueByCode
|
||||
# 版本
|
||||
- /api/version/current
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: false
|
||||
|
||||
@@ -1,17 +1,49 @@
|
||||
<template>
|
||||
<div id="app" @mousemove="moveEvent" @click="moveEvent">
|
||||
<router-view />
|
||||
<version-notification ref="versionDialog" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import VersionNotification from '@/components/VersionNotification/VersionNotification.vue'
|
||||
import { getCurrentVersion } from '@/api/system/version'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
VersionNotification
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
timmer: null
|
||||
timmer: null,
|
||||
pollTimer: null,
|
||||
pollIntervalMs: 30000
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$bus.on('version_update', msg => {
|
||||
this.checkVersion(msg.version)
|
||||
})
|
||||
this.$bus.on('version_check', () => {
|
||||
this.doVersionCheck()
|
||||
})
|
||||
if (this.$route.path === '/login') {
|
||||
return
|
||||
}
|
||||
this.startPolling()
|
||||
if (localStorage.getItem('needVersionCheck') === '1') {
|
||||
localStorage.removeItem('needVersionCheck')
|
||||
this.doVersionCheck()
|
||||
} else {
|
||||
this.doVersionCheck()
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearInterval(this.pollTimer)
|
||||
this.$bus.off('version_update')
|
||||
this.$bus.off('version_check')
|
||||
},
|
||||
methods: {
|
||||
moveEvent: function() {
|
||||
const path = ['/login']
|
||||
@@ -24,12 +56,47 @@ export default {
|
||||
this.timmer = setTimeout(() => {
|
||||
sessionStorage.clear()
|
||||
this.logout()
|
||||
}, 1000 * 60 * 151) // 15分钟 https://blog.csdn.net/qq_42345108/article/details/103496456
|
||||
}, 1000 * 60 * 151)
|
||||
},
|
||||
logout() {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.reload()
|
||||
})
|
||||
},
|
||||
checkVersion(serverVersion) {
|
||||
const lastSeen = localStorage.getItem('lastSeenVersion')
|
||||
if (!serverVersion || serverVersion === lastSeen) {
|
||||
return
|
||||
}
|
||||
this.$refs.versionDialog.show(serverVersion)
|
||||
},
|
||||
/**
|
||||
* 执行版本检查(登录后或手动触发)
|
||||
*/
|
||||
doVersionCheck() {
|
||||
getCurrentVersion().then(res => {
|
||||
if (!res.enabled) return
|
||||
this.checkVersion(res.version)
|
||||
})
|
||||
},
|
||||
startPolling() {
|
||||
this.pollTimer = setInterval(() => {
|
||||
getCurrentVersion().then(res => {
|
||||
if (!res.enabled) return
|
||||
this.checkVersion(res.version)
|
||||
const interval = (res.pollInterval || 30) * 1000
|
||||
if (interval !== this.pollIntervalMs) {
|
||||
this.pollIntervalMs = interval
|
||||
clearInterval(this.pollTimer)
|
||||
this.pollTimer = setInterval(() => {
|
||||
getCurrentVersion().then(r => {
|
||||
if (!r.enabled) return
|
||||
this.checkVersion(r.version)
|
||||
})
|
||||
}, interval)
|
||||
}
|
||||
})
|
||||
}, this.pollIntervalMs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
64
acs2/nladmin-ui/src/api/system/version.js
Normal file
64
acs2/nladmin-ui/src/api/system/version.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 获取当前版本信息
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
export function getCurrentVersion() {
|
||||
return request({
|
||||
url: '/api/version/current',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布版本更新通知
|
||||
* @param {Object} data - { version, title, content }
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
export function releaseVersion(data) {
|
||||
return request({
|
||||
url: '/api/version/release',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询版本通知列表
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
export function listVersions(params) {
|
||||
return request({
|
||||
url: '/api/version/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改版本通知
|
||||
* @param {Object} data - { id, title, content }
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
export function updateVersion(data) {
|
||||
return request({
|
||||
url: '/api/version/update',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除版本通知
|
||||
* @param {string} id
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
export function deleteVersion(id) {
|
||||
return request({
|
||||
url: '/api/version/delete/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export default { getCurrentVersion, releaseVersion, listVersions, updateVersion, deleteVersion }
|
||||
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisible"
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:title="$t('auto.version.title')"
|
||||
width="600px"
|
||||
>
|
||||
<div class="version-notification">
|
||||
<div class="version-info">
|
||||
<span class="label">{{ $t('auto.version.versionNo') }}:</span>
|
||||
<el-tag type="success" size="medium">v{{ versionInfo.version }}</el-tag>
|
||||
</div>
|
||||
<div v-if="versionInfo.title" class="version-info">
|
||||
<span class="label">{{ $t('auto.version.noticeTitle') }}:</span>
|
||||
<span>{{ versionInfo.title }}</span>
|
||||
</div>
|
||||
<div v-if="versionInfo.releaseTime" class="version-info">
|
||||
<span class="label">{{ $t('auto.version.releaseTime') }}:</span>
|
||||
<span>{{ versionInfo.releaseTime }}</span>
|
||||
</div>
|
||||
<div v-if="versionInfo.content" class="version-content">
|
||||
<div class="label">{{ $t('auto.version.content') }}:</div>
|
||||
<div class="content-body" v-html="versionInfo.content" />
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handleConfirm">{{ $t('auto.version.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCurrentVersion } from '@/api/system/version'
|
||||
|
||||
export default {
|
||||
name: 'VersionNotification',
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
versionInfo: {
|
||||
version: '',
|
||||
title: '',
|
||||
releaseTime: '',
|
||||
content: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
hasShown() {
|
||||
return this.dialogVisible
|
||||
},
|
||||
/**
|
||||
* 检查版本是否需要弹窗
|
||||
* @param {string} serverVersion 服务端版本号
|
||||
*/
|
||||
checkVersion(serverVersion) {
|
||||
const lastSeen = localStorage.getItem('lastSeenVersion')
|
||||
if (!serverVersion || serverVersion === lastSeen) {
|
||||
return
|
||||
}
|
||||
this.show(serverVersion)
|
||||
},
|
||||
/**
|
||||
* 显示版本更新弹窗
|
||||
* @param {string} serverVersion 版本号
|
||||
*/
|
||||
show(serverVersion) {
|
||||
getCurrentVersion().then(res => {
|
||||
if (!res.enabled) return
|
||||
this.versionInfo.version = res.version || serverVersion
|
||||
this.versionInfo.title = res.title || ''
|
||||
this.versionInfo.releaseTime = res.releaseTime || ''
|
||||
this.versionInfo.content = res.content || ''
|
||||
this.dialogVisible = true
|
||||
})
|
||||
},
|
||||
handleConfirm() {
|
||||
localStorage.setItem('lastSeenVersion', this.versionInfo.version)
|
||||
this.dialogVisible = false
|
||||
// 点击后跳转到版本信息页面
|
||||
this.$router.push('/system/version')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.version-notification {
|
||||
padding: 10px 0;
|
||||
}
|
||||
.version-info {
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.version-info .label {
|
||||
font-weight: bold;
|
||||
color: #303133;
|
||||
}
|
||||
.version-content {
|
||||
margin-top: 16px;
|
||||
}
|
||||
.version-content .label {
|
||||
font-weight: bold;
|
||||
color: #303133;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.version-content .content-body {
|
||||
padding: 12px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
line-height: 1.8;
|
||||
}
|
||||
.dialog-footer {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -115,6 +115,22 @@ export default {
|
||||
'disk': 'Disk Utilization',
|
||||
'cpu_monitoring': 'Cpu Utilization Monitoring',
|
||||
'memory_monitoring': 'Memory Utilization Monitoring'
|
||||
},
|
||||
'version': {
|
||||
'title': 'System Version Update',
|
||||
'versionNo': 'Version',
|
||||
'releaseTime': 'Release Time',
|
||||
'content': 'Update Content',
|
||||
'confirm': 'I Know',
|
||||
'releaseTitle': 'Publish Version Notice',
|
||||
'noticeTitle': 'Notice Title',
|
||||
'release': 'Publish',
|
||||
'currentInfo': 'Current Version Info',
|
||||
'switch': 'Notification Switch',
|
||||
'pollInterval': 'Polling Interval',
|
||||
'enabled': 'Enabled',
|
||||
'disabled': 'Disabled',
|
||||
'seconds': 's'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,22 @@ export default {
|
||||
'disk': 'Kadar penggunaan disk',
|
||||
'cpu_monitoring': 'Monitor penggunaan CPU',
|
||||
'memory_monitoring': 'Monitor penggunaan memori'
|
||||
},
|
||||
'version': {
|
||||
'title': 'Update Versi Sistem',
|
||||
'versionNo': 'Versi',
|
||||
'releaseTime': 'Waktu Rilis',
|
||||
'content': 'Konten Update',
|
||||
'confirm': 'Saya Mengerti',
|
||||
'releaseTitle': 'Terbitkan Notifikasi Versi',
|
||||
'noticeTitle': 'Judul Notifikasi',
|
||||
'release': 'Terbitkan',
|
||||
'currentInfo': 'Info Versi Saat Ini',
|
||||
'switch': 'Sakelar Notifikasi',
|
||||
'pollInterval': 'Interval Polling',
|
||||
'enabled': 'Diaktifkan',
|
||||
'disabled': 'Dinonaktifkan',
|
||||
'seconds': 'detik'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,22 @@ export default {
|
||||
'disk': '磁盘使用率',
|
||||
'cpu_monitoring': 'CPU使用率监控',
|
||||
'memory_monitoring': '内存使用率监控'
|
||||
},
|
||||
'version': {
|
||||
'title': '系统版本更新',
|
||||
'versionNo': '版本号',
|
||||
'releaseTime': '发布时间',
|
||||
'content': '更新内容',
|
||||
'confirm': '我知道了',
|
||||
'releaseTitle': '发布版本通知',
|
||||
'noticeTitle': '通知标题',
|
||||
'release': '发布',
|
||||
'currentInfo': '当前版本信息',
|
||||
'switch': '通知开关',
|
||||
'pollInterval': '轮询间隔',
|
||||
'enabled': '已启用',
|
||||
'disabled': '已禁用',
|
||||
'seconds': '秒'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,8 +168,11 @@ export default {
|
||||
webSocketOnMessage(e) {
|
||||
const data = JSON.parse(e.data)
|
||||
if (data.msgType === 'INFO') {
|
||||
console.log('data', data)
|
||||
this.$bus.emit(data.msg.data, data.msg.msgType)
|
||||
if (data.msg.data === 'notice_message_update') {
|
||||
this.$bus.emit(data.msg.data, data.msg.msgType)
|
||||
} else if (data.msg.data === 'version_update') {
|
||||
this.$bus.emit('version_update', data.msg)
|
||||
}
|
||||
} else if (data.msgType === 'ERROR') {
|
||||
this.$notify({
|
||||
title: '',
|
||||
|
||||
@@ -3,22 +3,21 @@
|
||||
<vue-particles
|
||||
class="lizi"
|
||||
color="#dedede"
|
||||
:particleOpacity="0.7"
|
||||
:particlesNumber="80"
|
||||
shapeType="circle"
|
||||
:particleSize="4"
|
||||
linesColor="#dedede"
|
||||
:linesWidth="1"
|
||||
:lineLinked="true"
|
||||
:lineOpacity="0.4"
|
||||
:linesDistance="150"
|
||||
:moveSpeed="3"
|
||||
:hoverEffect="true"
|
||||
hoverMode="grab"
|
||||
:clickEffect="true"
|
||||
clickMode="push"
|
||||
>
|
||||
</vue-particles>
|
||||
:particle-opacity="0.7"
|
||||
:particles-number="80"
|
||||
shape-type="circle"
|
||||
:particle-size="4"
|
||||
lines-color="#dedede"
|
||||
:lines-width="1"
|
||||
:line-linked="true"
|
||||
:line-opacity="0.4"
|
||||
:lines-distance="150"
|
||||
:move-speed="3"
|
||||
:hover-effect="true"
|
||||
hover-mode="grab"
|
||||
:click-effect="true"
|
||||
click-mode="push"
|
||||
/>
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" label-position="left" label-width="0px" class="login-form">
|
||||
<h3 class="title">
|
||||
{{ title }}</h3>
|
||||
@@ -187,6 +186,7 @@ export default {
|
||||
}
|
||||
this.$store.dispatch('Login', user).then(() => {
|
||||
this.loading = false
|
||||
localStorage.setItem('needVersionCheck', '1')
|
||||
window.location.href = this.redirect
|
||||
// if (this.redirect === 'http://localhost:8013/dashboard'){
|
||||
// window.location.href = this.redirect
|
||||
|
||||
@@ -13,3 +13,6 @@ export const NOTICE_MESSAGE_UPDATE = 'notice_message_update'
|
||||
* ws测试事件
|
||||
*/
|
||||
export const EVENT_TEST_WEBSOCKET = 'event_test_websocket'
|
||||
|
||||
/** 版本更新 */
|
||||
export const VERSION_UPDATE = 'version_update'
|
||||
|
||||
274
acs2/nladmin-ui/src/views/system/version/index.vue
Normal file
274
acs2/nladmin-ui/src/views/system/version/index.vue
Normal file
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<div class="version-container">
|
||||
<!-- 当前版本信息 -->
|
||||
<el-card class="version-card" style="margin-top: 20px">
|
||||
<div slot="header" class="card-header">
|
||||
<span>{{ $t('auto.version.currentInfo') }}</span>
|
||||
</div>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item :label="$t('auto.version.versionNo')">
|
||||
<el-tag type="success">{{ currentVersion }}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('auto.version.switch')">
|
||||
<el-tag
|
||||
:type="enabled ? 'success' : 'danger'"
|
||||
>{{ enabled ? $t('auto.version.enabled') : $t('auto.version.disabled') }}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
:label="$t('auto.version.pollInterval')"
|
||||
>{{ pollInterval }}{{ $t('auto.version.seconds') }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('auto.version.releaseTime')">{{ releaseTime || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
|
||||
<!-- 版本历史列表 -->
|
||||
<el-card class="version-card" style="margin-top: 20px">
|
||||
<div slot="header" class="card-header">
|
||||
<span>版本历史</span>
|
||||
</div>
|
||||
<el-table v-loading="tableLoading" :data="tableData" style="width: 100%">
|
||||
<el-table-column prop="_versionNo" label="版本号" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="_noticeTitle" label="通知标题" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="notice_content" label="更新内容" min-width="300" show-overflow-tooltip />
|
||||
<el-table-column prop="create_time" label="发布时间" width="180" />
|
||||
<el-table-column v-if="isAdmin" label="操作" width="180" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="isAdmin" type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
||||
<el-button
|
||||
v-if="isAdmin"
|
||||
type="text"
|
||||
size="small"
|
||||
style="color: #f56c6c"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<!-- 发布版本表单(仅管理员可见) -->
|
||||
<el-card v-if="isAdmin" class="version-card">
|
||||
<div slot="header" class="card-header">
|
||||
<span>{{ $t('auto.version.releaseTitle') }}</span>
|
||||
</div>
|
||||
<el-form ref="publishForm" :model="publishForm" :rules="rules" label-width="100px">
|
||||
<el-form-item :label="$t('auto.version.versionNo')" prop="version">
|
||||
<el-input v-model="publishForm.version" placeholder="例如:2.7.0" style="width: 300px" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('auto.version.noticeTitle')" prop="title">
|
||||
<el-input v-model="publishForm.title" placeholder="例如:新增AGV多车调度功能" style="width: 500px" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('auto.version.content')" prop="content">
|
||||
<el-input
|
||||
v-model="publishForm.content"
|
||||
type="textarea"
|
||||
:rows="8"
|
||||
placeholder="请输入更新内容,支持HTML格式"
|
||||
style="width: 600px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
v-if="isAdmin"
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
@click="handleRelease"
|
||||
>{{ $t('auto.version.release') }}</el-button>
|
||||
<el-button @click="handleReset">{{ $t('auto.common.Reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<el-dialog title="编辑版本通知" :visible.sync="editDialogVisible" width="700px">
|
||||
<el-form ref="editForm" :model="editForm" :rules="editRules" label-width="100px">
|
||||
<el-form-item label="通知标题" prop="title">
|
||||
<el-input v-model="editForm.title" style="width: 520px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新内容" prop="content">
|
||||
<el-input
|
||||
v-model="editForm.content"
|
||||
type="textarea"
|
||||
:rows="8"
|
||||
placeholder="请输入更新内容,支持HTML格式"
|
||||
style="width: 520px"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="editDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="editLoading" @click="submitEdit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getCurrentVersion,
|
||||
releaseVersion,
|
||||
listVersions,
|
||||
updateVersion,
|
||||
deleteVersion
|
||||
} from '@/api/system/version'
|
||||
|
||||
export default {
|
||||
name: 'VersionRelease',
|
||||
data() {
|
||||
return {
|
||||
// 发布表单
|
||||
loading: false,
|
||||
publishForm: {
|
||||
version: '',
|
||||
title: '',
|
||||
content: ''
|
||||
},
|
||||
rules: {
|
||||
version: [{ required: true, message: '请输入版本号', trigger: 'blur' }],
|
||||
title: [{ required: true, message: '请输入标题', trigger: 'blur' }]
|
||||
},
|
||||
// 当前版本信息
|
||||
currentVersion: '',
|
||||
enabled: false,
|
||||
pollInterval: 30,
|
||||
releaseTime: '',
|
||||
// 表格
|
||||
tableLoading: false,
|
||||
tableData: [],
|
||||
// 编辑弹窗
|
||||
editDialogVisible: false,
|
||||
editLoading: false,
|
||||
editForm: {
|
||||
id: '',
|
||||
title: '',
|
||||
content: ''
|
||||
},
|
||||
editRules: {
|
||||
title: [{ required: true, message: '请输入标题', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
/**
|
||||
* 判断当前用户是否为管理员
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isAdmin() {
|
||||
const roles = this.$store.getters && this.$store.getters.roles
|
||||
return roles && roles.includes('admin')
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.fetchCurrentVersion()
|
||||
this.fetchList()
|
||||
},
|
||||
methods: {
|
||||
fetchCurrentVersion() {
|
||||
getCurrentVersion().then(res => {
|
||||
this.currentVersion = res.version || '-'
|
||||
// 表单默认填充当前版本号,供管理员参考修改
|
||||
this.publishForm.version = res.version || ''
|
||||
this.enabled = res.enabled
|
||||
this.pollInterval = res.pollInterval || 30
|
||||
this.releaseTime = res.releaseTime || ''
|
||||
})
|
||||
},
|
||||
fetchList() {
|
||||
this.tableLoading = true
|
||||
listVersions({ page: 0, size: 999 })
|
||||
.then(res => {
|
||||
// notice_title 格式为 "version title",拆分出版本号和标题
|
||||
this.tableData = (res.records || []).map(item => {
|
||||
const titleStr = item.notice_title || ''
|
||||
const idx = titleStr.indexOf(' ')
|
||||
const versionNo = idx >= 0 ? titleStr.substring(0, idx) : titleStr
|
||||
const noticeTitle = idx >= 0 ? titleStr.substring(idx + 1) : ''
|
||||
return {
|
||||
...item,
|
||||
_versionNo: versionNo,
|
||||
_noticeTitle: noticeTitle
|
||||
}
|
||||
})
|
||||
})
|
||||
.finally(() => {
|
||||
this.tableLoading = false
|
||||
})
|
||||
},
|
||||
handleRelease() {
|
||||
this.$refs.publishForm.validate(valid => {
|
||||
if (!valid) return
|
||||
this.loading = true
|
||||
releaseVersion(this.publishForm)
|
||||
.then(() => {
|
||||
this.$message.success('版本更新通知已发布')
|
||||
this.handleReset()
|
||||
this.fetchCurrentVersion()
|
||||
this.fetchList()
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
})
|
||||
},
|
||||
handleReset() {
|
||||
this.publishForm = {
|
||||
version: '',
|
||||
title: '',
|
||||
content: ''
|
||||
}
|
||||
this.$refs.publishForm && this.$refs.publishForm.clearValidate()
|
||||
},
|
||||
handleEdit(row) {
|
||||
this.editForm = {
|
||||
id: row.notice_id,
|
||||
title: row.notice_title,
|
||||
content: row.notice_content || ''
|
||||
}
|
||||
this.editDialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.editForm && this.$refs.editForm.clearValidate()
|
||||
})
|
||||
},
|
||||
submitEdit() {
|
||||
this.$refs.editForm.validate(valid => {
|
||||
if (!valid) return
|
||||
this.editLoading = true
|
||||
updateVersion(this.editForm)
|
||||
.then(() => {
|
||||
this.$message.success('修改成功')
|
||||
this.editDialogVisible = false
|
||||
this.fetchList()
|
||||
})
|
||||
.finally(() => {
|
||||
this.editLoading = false
|
||||
})
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$confirm('确认删除该版本通知?', '提示', { type: 'warning' }).then(
|
||||
() => {
|
||||
deleteVersion(row.notice_id).then(() => {
|
||||
this.$message.success('删除成功')
|
||||
this.fetchList()
|
||||
this.fetchCurrentVersion()
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.version-container {
|
||||
padding: 20px;
|
||||
}
|
||||
.version-card {
|
||||
}
|
||||
.card-header {
|
||||
font-weight: bold;
|
||||
}
|
||||
.dialog-footer {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user