Compare commits
14 Commits
merge_1.3
...
1b2c248fa2
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b2c248fa2 | |||
| 1c16d6ba0f | |||
| 49b8a975a8 | |||
| d17a502da1 | |||
| 430adc2112 | |||
| 5f5c47f528 | |||
| 92d74c47ce | |||
| 5d8e7b667f | |||
| 58449fc2f9 | |||
| 4c541f43b9 | |||
| 9a037ae446 | |||
| bb0eb60eae | |||
| fc6640b846 | |||
| 8914c8b143 |
@@ -3,10 +3,13 @@ package com.core.web.controller.system;
|
||||
import com.core.common.annotation.Log;
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.domain.model.LoginUser;
|
||||
import com.core.common.core.page.TableDataInfo;
|
||||
import com.core.common.enums.BusinessType;
|
||||
import com.core.system.domain.SysNotice;
|
||||
import com.core.common.core.domain.entity.SysUser;
|
||||
import com.core.system.service.ISysNoticeService;
|
||||
import com.core.system.service.ISysNoticeReadService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -25,6 +28,9 @@ public class SysNoticeController extends BaseController {
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeReadService noticeReadService;
|
||||
|
||||
/**
|
||||
* 获取通知公告列表
|
||||
*/
|
||||
@@ -36,6 +42,86 @@ public class SysNoticeController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户的公告列表(公开接口)
|
||||
* 公告类型:通常 noticeType = '1' 代表通知,noticeType = '2' 代表公告
|
||||
*/
|
||||
@GetMapping("/public/list")
|
||||
public TableDataInfo getPublicList(SysNotice notice) {
|
||||
// 只查询状态为正常(0)且已发布(1)的公告
|
||||
notice.setStatus("0");
|
||||
notice.setPublishStatus("1");
|
||||
// 公告类型设置为 '2'(公告)
|
||||
notice.setNoticeType("2");
|
||||
// 设置分页参数
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户的通知列表(公开接口)
|
||||
* 通知类型:通常 noticeType = '1' 代表通知
|
||||
*/
|
||||
@GetMapping("/public/notice")
|
||||
public AjaxResult getUserNotices() {
|
||||
// 获取当前用户信息
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser currentUser = loginUser.getUser();
|
||||
|
||||
// 只查询状态为正常(0)且已发布(1)的通知
|
||||
SysNotice notice = new SysNotice();
|
||||
notice.setStatus("0");
|
||||
notice.setPublishStatus("1");
|
||||
// 通知类型设置为 '1'(通知)
|
||||
notice.setNoticeType("1");
|
||||
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户未读公告/通知数量(公开接口)
|
||||
*/
|
||||
@GetMapping("/public/unread/count")
|
||||
public AjaxResult getUnreadCount() {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser currentUser = loginUser.getUser();
|
||||
int count = noticeReadService.getUnreadCount(currentUser.getUserId());
|
||||
return success(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记公告/通知为已读(公开接口)
|
||||
*/
|
||||
@PostMapping("/public/read/{noticeId}")
|
||||
public AjaxResult markAsRead(@PathVariable Long noticeId) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser currentUser = loginUser.getUser();
|
||||
return noticeReadService.markAsRead(noticeId, currentUser.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量标记公告/通知为已读(公开接口)
|
||||
*/
|
||||
@PostMapping("/public/read/all")
|
||||
public AjaxResult markAllAsRead(@RequestBody Long[] noticeIds) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser currentUser = loginUser.getUser();
|
||||
return noticeReadService.markAllAsRead(noticeIds, currentUser.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户已读公告/通知ID列表(公开接口)
|
||||
*/
|
||||
@GetMapping("/public/read/ids")
|
||||
public AjaxResult getReadNoticeIds() {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser currentUser = loginUser.getUser();
|
||||
List<Long> readIds = noticeReadService.selectReadNoticeIdsByUserId(currentUser.getUserId());
|
||||
return success(readIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
@@ -53,6 +139,10 @@ public class SysNoticeController extends BaseController {
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysNotice notice) {
|
||||
notice.setCreateBy(getUsername());
|
||||
// 新建的公告默认为未发布状态
|
||||
if (notice.getPublishStatus() == null || notice.getPublishStatus().isEmpty()) {
|
||||
notice.setPublishStatus("0");
|
||||
}
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
@@ -76,4 +166,42 @@ public class SysNoticeController extends BaseController {
|
||||
public AjaxResult remove(@PathVariable Long[] noticeIds) {
|
||||
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布公告/通知
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||
@Log(title = "发布公告", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/publish/{noticeId}")
|
||||
public AjaxResult publish(@PathVariable Long noticeId) {
|
||||
SysNotice notice = noticeService.selectNoticeById(noticeId);
|
||||
if (notice == null) {
|
||||
return error("公告不存在");
|
||||
}
|
||||
if ("1".equals(notice.getPublishStatus())) {
|
||||
return error("该公告已发布");
|
||||
}
|
||||
notice.setPublishStatus("1");
|
||||
notice.setUpdateBy(getUsername());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消发布公告/通知
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||
@Log(title = "取消发布", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/unpublish/{noticeId}")
|
||||
public AjaxResult unpublish(@PathVariable Long noticeId) {
|
||||
SysNotice notice = noticeService.selectNoticeById(noticeId);
|
||||
if (notice == null) {
|
||||
return error("公告不存在");
|
||||
}
|
||||
if ("0".equals(notice.getPublishStatus())) {
|
||||
return error("该公告未发布");
|
||||
}
|
||||
notice.setPublishStatus("0");
|
||||
notice.setUpdateBy(getUsername());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ public class SysNotice extends BaseEntity {
|
||||
/** 公告状态(0正常 1关闭) */
|
||||
private String status;
|
||||
|
||||
/** 发布状态(0未发布 1已发布) */
|
||||
private String publishStatus;
|
||||
|
||||
public Long getNoticeId() {
|
||||
return noticeId;
|
||||
}
|
||||
@@ -75,6 +78,14 @@ public class SysNotice extends BaseEntity {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getPublishStatus() {
|
||||
return publishStatus;
|
||||
}
|
||||
|
||||
public void setPublishStatus(String publishStatus) {
|
||||
this.publishStatus = publishStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("noticeId", getNoticeId())
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.core.system.domain;
|
||||
|
||||
import com.core.common.core.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* 公告/通知已读记录 sys_notice_read
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public class SysNoticeRead extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 阅读ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long readId;
|
||||
|
||||
/** 公告/通知ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long noticeId;
|
||||
|
||||
/** 用户ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
/** 阅读时间 */
|
||||
private String readTime;
|
||||
|
||||
public Long getReadId() {
|
||||
return readId;
|
||||
}
|
||||
|
||||
public void setReadId(Long readId) {
|
||||
this.readId = readId;
|
||||
}
|
||||
|
||||
public Long getNoticeId() {
|
||||
return noticeId;
|
||||
}
|
||||
|
||||
public void setNoticeId(Long noticeId) {
|
||||
this.noticeId = noticeId;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getReadTime() {
|
||||
return readTime;
|
||||
}
|
||||
|
||||
public void setReadTime(String readTime) {
|
||||
this.readTime = readTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.core.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.system.domain.SysNoticeRead;
|
||||
|
||||
/**
|
||||
* 公告/通知已读记录 Mapper接口
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public interface SysNoticeReadMapper {
|
||||
|
||||
/**
|
||||
* 查询公告/通知已读记录
|
||||
*
|
||||
* @param readId 阅读ID
|
||||
* @return 公告/通知已读记录
|
||||
*/
|
||||
public SysNoticeRead selectNoticeReadById(Long readId);
|
||||
|
||||
/**
|
||||
* 查询用户的已读公告/通知ID列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 已读公告/通知ID列表
|
||||
*/
|
||||
public List<Long> selectReadNoticeIdsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询公告/通知的已读用户数量
|
||||
*
|
||||
* @param noticeId 公告/通知ID
|
||||
* @return 已读用户数量
|
||||
*/
|
||||
public int countReadByNoticeId(Long noticeId);
|
||||
|
||||
/**
|
||||
* 新增公告/通知已读记录
|
||||
*
|
||||
* @param noticeRead 公告/通知已读记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNoticeRead(SysNoticeRead noticeRead);
|
||||
|
||||
/**
|
||||
* 删除公告/通知已读记录
|
||||
*
|
||||
* @param readId 阅读ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeReadById(Long readId);
|
||||
|
||||
/**
|
||||
* 批量删除公告/通知已读记录
|
||||
*
|
||||
* @param readIds 需要删除的阅读ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeReadByIds(Long[] readIds);
|
||||
|
||||
/**
|
||||
* 检查用户是否已阅读公告/通知
|
||||
*
|
||||
* @param noticeId 公告/通知ID
|
||||
* @param userId 用户ID
|
||||
* @return 是否已阅读
|
||||
*/
|
||||
public boolean checkNoticeRead(Long noticeId, Long userId);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.core.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.system.domain.SysNotice;
|
||||
import com.core.system.domain.SysNoticeRead;
|
||||
|
||||
/**
|
||||
* 公告/通知已读记录 服务层
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public interface ISysNoticeReadService {
|
||||
|
||||
/**
|
||||
* 查询用户的未读公告/通知数量
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 未读数量
|
||||
*/
|
||||
public int getUnreadCount(Long userId);
|
||||
|
||||
/**
|
||||
* 标记公告/通知为已读
|
||||
*
|
||||
* @param noticeId 公告/通知ID
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public AjaxResult markAsRead(Long noticeId, Long userId);
|
||||
|
||||
/**
|
||||
* 批量标记公告/通知为已读
|
||||
*
|
||||
* @param noticeIds 公告/通知ID列表
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public AjaxResult markAllAsRead(Long[] noticeIds, Long userId);
|
||||
|
||||
/**
|
||||
* 查询用户的已读公告/通知ID列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 已读公告/通知ID列表
|
||||
*/
|
||||
public List<Long> selectReadNoticeIdsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询带已读状态的公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @param userId 用户ID
|
||||
* @return 公告集合
|
||||
*/
|
||||
public List<SysNotice> selectNoticeListWithReadStatus(SysNotice notice, Long userId);
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.core.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.system.domain.SysNotice;
|
||||
import com.core.system.domain.SysNoticeRead;
|
||||
import com.core.system.mapper.SysNoticeMapper;
|
||||
import com.core.system.mapper.SysNoticeReadMapper;
|
||||
import com.core.system.service.ISysNoticeReadService;
|
||||
|
||||
/**
|
||||
* 公告/通知已读记录 服务层实现
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Service
|
||||
public class SysNoticeReadServiceImpl implements ISysNoticeReadService {
|
||||
|
||||
@Autowired
|
||||
private SysNoticeReadMapper noticeReadMapper;
|
||||
|
||||
@Autowired
|
||||
private SysNoticeMapper noticeMapper;
|
||||
|
||||
/**
|
||||
* 查询用户的未读公告/通知数量
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 未读数量
|
||||
*/
|
||||
@Override
|
||||
public int getUnreadCount(Long userId) {
|
||||
// 查询所有状态为正常(0)的公告/通知
|
||||
SysNotice notice = new SysNotice();
|
||||
notice.setStatus("0");
|
||||
List<SysNotice> allNotices = noticeMapper.selectNoticeList(notice);
|
||||
|
||||
// 查询用户已读的公告/通知ID
|
||||
List<Long> readNoticeIds = noticeReadMapper.selectReadNoticeIdsByUserId(userId);
|
||||
|
||||
// 计算未读数量
|
||||
int unreadCount = 0;
|
||||
for (SysNotice n : allNotices) {
|
||||
if (!readNoticeIds.contains(n.getNoticeId())) {
|
||||
unreadCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return unreadCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记公告/通知为已读
|
||||
*
|
||||
* @param noticeId 公告/通知ID
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult markAsRead(Long noticeId, Long userId) {
|
||||
// 检查是否已读
|
||||
boolean isRead = noticeReadMapper.checkNoticeRead(noticeId, userId);
|
||||
if (isRead) {
|
||||
return AjaxResult.success("已标记为已读");
|
||||
}
|
||||
|
||||
// 插入已读记录
|
||||
SysNoticeRead noticeRead = new SysNoticeRead();
|
||||
noticeRead.setNoticeId(noticeId);
|
||||
noticeRead.setUserId(userId);
|
||||
|
||||
int result = noticeReadMapper.insertNoticeRead(noticeRead);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("标记成功");
|
||||
}
|
||||
return AjaxResult.error("标记失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量标记公告/通知为已读
|
||||
*
|
||||
* @param noticeIds 公告/通知ID列表
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult markAllAsRead(Long[] noticeIds, Long userId) {
|
||||
int successCount = 0;
|
||||
for (Long noticeId : noticeIds) {
|
||||
boolean isRead = noticeReadMapper.checkNoticeRead(noticeId, userId);
|
||||
if (!isRead) {
|
||||
SysNoticeRead noticeRead = new SysNoticeRead();
|
||||
noticeRead.setNoticeId(noticeId);
|
||||
noticeRead.setUserId(userId);
|
||||
noticeReadMapper.insertNoticeRead(noticeRead);
|
||||
successCount++;
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("成功标记" + successCount + "条记录为已读");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户的已读公告/通知ID列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 已读公告/通知ID列表
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectReadNoticeIdsByUserId(Long userId) {
|
||||
return noticeReadMapper.selectReadNoticeIdsByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询带已读状态的公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @param userId 用户ID
|
||||
* @return 公告集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysNotice> selectNoticeListWithReadStatus(SysNotice notice, Long userId) {
|
||||
// 这里可以扩展为在查询结果中添加已读状态标记
|
||||
// 暂时返回普通列表
|
||||
return noticeMapper.selectNoticeList(notice);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
<result property="noticeType" column="notice_type"/>
|
||||
<result property="noticeContent" column="notice_content"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="publishStatus" column="publish_status"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@@ -21,8 +22,9 @@
|
||||
select notice_id,
|
||||
notice_title,
|
||||
notice_type,
|
||||
cast(notice_content as char) as notice_content,
|
||||
convert_from(notice_content, 'UTF8') as notice_content,
|
||||
status,
|
||||
publish_status,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
@@ -48,11 +50,19 @@
|
||||
<if test="createBy != null and createBy != ''">
|
||||
AND create_by like concat('%', #{createBy}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="publishStatus != null and publishStatus != ''">
|
||||
AND publish_status = #{publishStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<insert id="insertNotice" parameterType="SysNotice">
|
||||
insert into sys_notice (
|
||||
notice_id,
|
||||
<if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
|
||||
<if test="noticeType != null and noticeType != '' ">notice_type,</if>
|
||||
<if test="noticeContent != null and noticeContent != '' ">notice_content,</if>
|
||||
@@ -61,9 +71,10 @@
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
(SELECT COALESCE(MAX(notice_id), 0) + 1 FROM sys_notice),
|
||||
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle},</if>
|
||||
<if test="noticeType != null and noticeType != ''">#{noticeType},</if>
|
||||
<if test="noticeContent != null and noticeContent != ''">#{noticeContent},</if>
|
||||
<if test="noticeContent != null and noticeContent != ''">cast(#{noticeContent} as bytea),</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
@@ -76,8 +87,9 @@
|
||||
<set>
|
||||
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle},</if>
|
||||
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType},</if>
|
||||
<if test="noticeContent != null">notice_content = #{noticeContent},</if>
|
||||
<if test="noticeContent != null">notice_content = cast(#{noticeContent} as bytea),</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="publishStatus != null and publishStatus != ''">publish_status = #{publishStatus},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = now()
|
||||
</set>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.core.system.mapper.SysNoticeReadMapper">
|
||||
|
||||
<resultMap type="SysNoticeRead" id="SysNoticeReadResult">
|
||||
<result property="readId" column="read_id"/>
|
||||
<result property="noticeId" column="notice_id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="readTime" column="read_time"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectNoticeReadById" parameterType="Long" resultMap="SysNoticeReadResult">
|
||||
select read_id, notice_id, user_id, read_time
|
||||
from sys_notice_read
|
||||
where read_id = #{readId}
|
||||
</select>
|
||||
|
||||
<select id="selectReadNoticeIdsByUserId" parameterType="Long" resultType="Long">
|
||||
select notice_id
|
||||
from sys_notice_read
|
||||
where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="countReadByNoticeId" parameterType="Long" resultType="int">
|
||||
select count(1)
|
||||
from sys_notice_read
|
||||
where notice_id = #{noticeId}
|
||||
</select>
|
||||
|
||||
<select id="checkNoticeRead" resultType="boolean">
|
||||
select count(1) > 0
|
||||
from sys_notice_read
|
||||
where notice_id = #{noticeId} and user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<insert id="insertNoticeRead" parameterType="SysNoticeRead">
|
||||
insert into sys_notice_read (
|
||||
read_id,
|
||||
notice_id,
|
||||
user_id,
|
||||
read_time
|
||||
) values (
|
||||
(SELECT COALESCE(MAX(read_id), 0) + 1 FROM sys_notice_read),
|
||||
#{noticeId},
|
||||
#{userId},
|
||||
now()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="deleteNoticeReadById" parameterType="Long">
|
||||
delete from sys_notice_read where read_id = #{readId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteNoticeReadByIds" parameterType="Long">
|
||||
delete from sys_notice_read where read_id in
|
||||
<foreach item="readId" collection="array" open="(" separator="," close=")">
|
||||
#{readId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -7,4 +7,6 @@ public interface CallNumberVoiceConfigAppService {
|
||||
R<?> addCallNumberVoiceConfig(CallNumberVoiceConfig callNumberVoiceConfig);
|
||||
|
||||
R<?> updateCallNumberVoiceConfig(CallNumberVoiceConfig callNumberVoiceConfig);
|
||||
|
||||
R<?> getCallNumberVoiceConfig();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.openhis.web.triageandqueuemanage.appservice.CallNumberVoiceConfigAppS
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CallNumberVoiceConfigAppServiceImpl implements CallNumberVoiceConfigAppService {
|
||||
@@ -15,6 +16,12 @@ public class CallNumberVoiceConfigAppServiceImpl implements CallNumberVoiceConfi
|
||||
@Resource
|
||||
private CallNumberVoiceConfigService callNumberVoiceConfigService;
|
||||
|
||||
@Override
|
||||
public R<?> getCallNumberVoiceConfig() {
|
||||
List<CallNumberVoiceConfig> list = callNumberVoiceConfigService.list();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> addCallNumberVoiceConfig(CallNumberVoiceConfig callNumberVoiceConfig) {
|
||||
if(ObjectUtil.isNull(callNumberVoiceConfig)){
|
||||
@@ -32,4 +39,5 @@ public class CallNumberVoiceConfigAppServiceImpl implements CallNumberVoiceConfi
|
||||
boolean updateById = callNumberVoiceConfigService.updateById(callNumberVoiceConfig);
|
||||
return R.ok(updateById);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,16 @@ public class CallNumberVoiceConfigController {
|
||||
@Resource
|
||||
private CallNumberVoiceConfigAppService callNumberVoiceConfigAppService;
|
||||
|
||||
/**
|
||||
* 查询叫号语音设置
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/get")
|
||||
public R<?> getCallNumberVoiceConfig(){
|
||||
return R.ok(callNumberVoiceConfigAppService.getCallNumberVoiceConfig());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增叫号语音设置实体
|
||||
*
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
| | | | ____| /\ | | |__ __| | | | | |_ _| \ | | |/ / | | | |_ _|/ ____|
|
||||
| |__| | |__ / \ | | | | | |__| | | | | | \| | ' /_____| |__| | | | | (___
|
||||
| __ | __| / /\ \ | | | | | __ | | | | | . ` | <______| __ | | | \___ \
|
||||
| | | | |____ / ____ \| |____| | | | | | |____ _| |_| |\ | . \ | | | |_| |_ ____) |
|
||||
|_| |_|______/_/ \_\______|_| |_| |_|______|_____|_| \_|_|\_\ |_| |_|_____|_____/
|
||||
|
||||
|
||||
| | | |____ / ____ \| |____| | | | | | |____ _| |_| |\ | . \ | | | |_| |_ ____) |
|
||||
|_| |_|______/_/ \_\______|_| |_| |_|______|_____|_| \_|_\ \ |_| |_|_____|_____/
|
||||
|
||||
Application Version: ${core.version}
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
T3.price_code,
|
||||
T3.retail_price,
|
||||
T3.maximum_retail_price,
|
||||
T3.chrgitm_lv,--医保等级
|
||||
T3.children_json,--子项json
|
||||
T3.pricing_flag--划价标记
|
||||
T3.chrgitm_lv,
|
||||
T3.children_json,
|
||||
T3.pricing_flag
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
@@ -54,18 +54,18 @@
|
||||
T1.description_text,
|
||||
T1.rule_id,
|
||||
T1.tenant_id,
|
||||
T1.chrgitm_lv,--医保等级
|
||||
T1.chrgitm_lv,
|
||||
T2.type_code as item_type_code,
|
||||
T2.yb_type,
|
||||
T2.price_code,
|
||||
T2.price as retail_price,--零售价
|
||||
T4.amount as maximum_retail_price,--最高零售价
|
||||
T1.children_json,--子项json
|
||||
T1.pricing_flag--划价标记
|
||||
T2.price as retail_price,
|
||||
T4.amount as maximum_retail_price,
|
||||
T1.children_json,
|
||||
T1.pricing_flag
|
||||
FROM wor_activity_definition T1
|
||||
LEFT JOIN adm_charge_item_definition T2 ON T1.id = T2.instance_id
|
||||
LEFT JOIN adm_charge_item_definition T5 ON T5.instance_id = T1.id AND T5.instance_table = 'wor_activity_definition'
|
||||
LEFT JOIN adm_charge_item_def_detail T4 ON T4.definition_id = T5.id AND T4.condition_code = '4'--4:限制
|
||||
LEFT JOIN adm_charge_item_def_detail T4 ON T4.definition_id = T5.id AND T4.condition_code = '4'
|
||||
<where>
|
||||
T1.delete_flag = '0'
|
||||
AND T2.instance_table = 'wor_activity_definition'
|
||||
@@ -81,6 +81,7 @@
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY T1.bus_no DESC
|
||||
) T3
|
||||
|
||||
</select>
|
||||
|
||||
@@ -108,22 +109,23 @@
|
||||
T2.type_code as item_type_code,
|
||||
T2.yb_type,
|
||||
T2.price_code,
|
||||
T2.price as retail_price,--零售价,
|
||||
( SELECT T4.amount
|
||||
FROM adm_charge_item_definition T5
|
||||
LEFT JOIN adm_charge_item_def_detail T4 ON T4.definition_id = T5.id
|
||||
WHERE T4.condition_code = '4'--4:限制
|
||||
AND T5.instance_id = T1.id
|
||||
AND T5.instance_table = 'wor_activity_definition'
|
||||
) as maximum_retail_price,--最高零售价
|
||||
T1.chrgitm_lv,--医保等级
|
||||
T1.children_json,--子项json
|
||||
T1.pricing_flag--划价标记
|
||||
T2.price as retail_price,
|
||||
(
|
||||
SELECT T4.amount
|
||||
FROM adm_charge_item_definition T5
|
||||
LEFT JOIN adm_charge_item_def_detail T4 ON T4.definition_id = T5.id
|
||||
WHERE T4.condition_code = '4'
|
||||
AND T5.instance_id = T1.id
|
||||
AND T5.instance_table = 'wor_activity_definition'
|
||||
) as maximum_retail_price,
|
||||
T1.chrgitm_lv,
|
||||
T1.children_json,
|
||||
T1.pricing_flag
|
||||
FROM wor_activity_definition T1
|
||||
LEFT JOIN adm_charge_item_definition T2 ON T1.id = T2.instance_id
|
||||
<where>
|
||||
T1.delete_flag = '0'
|
||||
AND T2.instance_table = 'wor_activity_definition'
|
||||
AND T2.instance_table = 'wor_activity_definition'
|
||||
|
||||
<if test="id!= null">
|
||||
AND T1.id = #{id}
|
||||
|
||||
@@ -9,6 +9,23 @@ export function listNotice(query) {
|
||||
})
|
||||
}
|
||||
|
||||
// 获取公开的公告列表(给普通用户使用)
|
||||
export function getPublicNoticeList(query) {
|
||||
return request({
|
||||
url: '/system/notice/public/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取当前用户的通知列表
|
||||
export function getUserNotices() {
|
||||
return request({
|
||||
url: '/system/notice/public/notice',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询公告详细
|
||||
export function getNotice(noticeId) {
|
||||
return request({
|
||||
@@ -42,3 +59,52 @@ export function delNotice(noticeId) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 发布公告
|
||||
export function publishNotice(noticeId) {
|
||||
return request({
|
||||
url: '/system/notice/publish/' + noticeId,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
// 取消发布公告
|
||||
export function unpublishNotice(noticeId) {
|
||||
return request({
|
||||
url: '/system/notice/unpublish/' + noticeId,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取未读公告/通知数量
|
||||
export function getUnreadCount() {
|
||||
return request({
|
||||
url: '/system/notice/public/unread/count',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 标记公告/通知为已读
|
||||
export function markAsRead(noticeId) {
|
||||
return request({
|
||||
url: '/system/notice/public/read/' + noticeId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
// 批量标记公告/通知为已读
|
||||
export function markAllAsRead(noticeIds) {
|
||||
return request({
|
||||
url: '/system/notice/public/read/all',
|
||||
method: 'post',
|
||||
data: noticeIds
|
||||
})
|
||||
}
|
||||
|
||||
// 获取用户已读公告/通知ID列表
|
||||
export function getReadNoticeIds() {
|
||||
return request({
|
||||
url: '/system/notice/public/read/ids',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
249
openhis-ui-vue3/src/components/NoticePanel.vue
Normal file
249
openhis-ui-vue3/src/components/NoticePanel.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<template>
|
||||
<el-drawer v-model="noticeVisible" title="公告" direction="rtl" size="400px" destroy-on-close>
|
||||
<el-tabs v-model="activeTab">
|
||||
<el-tab-pane label="公告" name="notice">
|
||||
<el-empty v-if="noticeList.length === 0" description="暂无公告" />
|
||||
<div v-else class="notice-list">
|
||||
<div v-for="item in noticeList" :key="item.noticeId" class="notice-item" :class="{ 'is-read': isRead(item.noticeId) }" @click="viewDetail(item)">
|
||||
<div class="notice-title">
|
||||
<span v-if="!isRead(item.noticeId)" class="unread-dot"></span>
|
||||
{{ item.noticeTitle }}
|
||||
</div>
|
||||
<div class="notice-info">
|
||||
<span class="notice-type">
|
||||
<dict-tag :options="sys_notice_type" :value="item.noticeType" />
|
||||
</span>
|
||||
<span class="notice-time">{{ parseTime(item.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="通知" name="notification">
|
||||
<el-empty v-if="notificationList.length === 0" description="暂无通知" />
|
||||
<div v-else class="notice-list">
|
||||
<div v-for="item in notificationList" :key="item.noticeId" class="notice-item" :class="{ 'is-read': isRead(item.noticeId) }" @click="viewDetail(item)">
|
||||
<div class="notice-title">
|
||||
<span v-if="!isRead(item.noticeId)" class="unread-dot"></span>
|
||||
{{ item.noticeTitle }}
|
||||
</div>
|
||||
<div class="notice-info">
|
||||
<span class="notice-type">
|
||||
<dict-tag :options="sys_notice_type" :value="item.noticeType" />
|
||||
</span>
|
||||
<span class="notice-time">{{ parseTime(item.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<!-- 公告/通知详情对话框 -->
|
||||
<el-dialog v-model="detailVisible" :title="currentNotice.noticeTitle" width="800px" append-to-body>
|
||||
<div class="notice-detail">
|
||||
<div class="detail-header">
|
||||
<span class="detail-type">
|
||||
<dict-tag :options="sys_notice_type" :value="currentNotice.noticeType" />
|
||||
</span>
|
||||
<span class="detail-time">{{ parseTime(currentNotice.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</div>
|
||||
<div class="detail-content" v-html="currentNotice.noticeContent"></div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="detailVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { getPublicNoticeList, getUserNotices, markAsRead, getReadNoticeIds } from '@/api/system/notice'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_notice_type } = proxy.useDict('sys_notice_type')
|
||||
const emit = defineEmits(['updateUnreadCount'])
|
||||
const userStore = useUserStore()
|
||||
|
||||
const noticeVisible = ref(false)
|
||||
const detailVisible = ref(false)
|
||||
const activeTab = ref('notice')
|
||||
const noticeList = ref([])
|
||||
const notificationList = ref([])
|
||||
const currentNotice = ref({})
|
||||
const readNoticeIds = ref(new Set())
|
||||
|
||||
// 打开公告/通知面板
|
||||
function open() {
|
||||
noticeVisible.value = true
|
||||
loadNotices()
|
||||
loadReadNoticeIds()
|
||||
}
|
||||
|
||||
// 加载已读公告ID列表
|
||||
function loadReadNoticeIds() {
|
||||
getReadNoticeIds().then(response => {
|
||||
const ids = response.data || []
|
||||
readNoticeIds.value = new Set(ids)
|
||||
// 同步到 localStorage
|
||||
localStorage.setItem('readNoticeIds', JSON.stringify(ids))
|
||||
}).catch(() => {
|
||||
// 接口调用失败时从 localStorage 读取
|
||||
const readIds = localStorage.getItem('readNoticeIds')
|
||||
if (readIds) {
|
||||
try {
|
||||
const ids = JSON.parse(readIds)
|
||||
readNoticeIds.value = new Set(ids)
|
||||
} catch (e) {
|
||||
console.error('解析已读ID失败', e)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 排序:未读的排前面,已读的排后面,同类型按时间倒序
|
||||
function sortNoticeList(list) {
|
||||
return list.sort((a, b) => {
|
||||
const aRead = isRead(a.noticeId)
|
||||
const bRead = isRead(b.noticeId)
|
||||
|
||||
// 未读排在前面
|
||||
if (aRead !== bRead) {
|
||||
return aRead ? 1 : -1
|
||||
}
|
||||
|
||||
// 同类型按创建时间倒序(最新的在前)
|
||||
return new Date(b.createTime) - new Date(a.createTime)
|
||||
})
|
||||
}
|
||||
|
||||
// 加载公告和通知
|
||||
function loadNotices() {
|
||||
// 加载公告列表
|
||||
getPublicNoticeList({ pageNum: 1, pageSize: 10 }).then(response => {
|
||||
let list = response.rows || response.data || []
|
||||
noticeList.value = sortNoticeList(list)
|
||||
})
|
||||
|
||||
// 加载通知列表
|
||||
getUserNotices().then(response => {
|
||||
let list = response.data || []
|
||||
notificationList.value = sortNoticeList(list)
|
||||
})
|
||||
}
|
||||
|
||||
// 查看详情
|
||||
function viewDetail(item) {
|
||||
currentNotice.value = item
|
||||
detailVisible.value = true
|
||||
|
||||
// 标记为已读
|
||||
if (!readNoticeIds.value.has(item.noticeId)) {
|
||||
markAsRead(item.noticeId).then(() => {
|
||||
readNoticeIds.value.add(item.noticeId)
|
||||
// 保存到 localStorage
|
||||
saveReadNoticeIds()
|
||||
emit('updateUnreadCount')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 保存已读公告ID列表
|
||||
function saveReadNoticeIds() {
|
||||
const ids = Array.from(readNoticeIds.value)
|
||||
localStorage.setItem('readNoticeIds', JSON.stringify(ids))
|
||||
}
|
||||
|
||||
// 检查是否已读
|
||||
function isRead(noticeId) {
|
||||
return readNoticeIds.value.has(noticeId)
|
||||
}
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({
|
||||
open,
|
||||
isRead,
|
||||
readNoticeIds
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.notice-list {
|
||||
max-height: calc(100vh - 200px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.notice-item {
|
||||
padding: 12px 0;
|
||||
border-bottom: 1px solid #EBEEF5;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
|
||||
&:hover {
|
||||
background-color: #F5F7FA;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&.is-read {
|
||||
.notice-title {
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notice-title {
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
margin-bottom: 8px;
|
||||
line-height: 1.4;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.unread-dot {
|
||||
display: inline-block;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background-color: #f56c6c;
|
||||
border-radius: 50%;
|
||||
margin-right: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 1px solid #EBEEF5;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.detail-time {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.detail-content {
|
||||
font-size: 14px;
|
||||
line-height: 1.8;
|
||||
color: #303133;
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
:deep(.el-drawer__body) {
|
||||
padding: 0 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -4,6 +4,14 @@
|
||||
<template v-if="appStore.device !== 'mobile'">
|
||||
<header-search id="header-search" class="right-menu-item" />
|
||||
</template>
|
||||
<!-- 公告和通知按钮 -->
|
||||
<el-tooltip content="公告/通知" placement="bottom">
|
||||
<div class="right-menu-item notice-btn" @click="openNoticePanel">
|
||||
<el-badge :value="unreadCount" :hidden="unreadCount === 0" class="notice-badge">
|
||||
<el-icon><Bell /></el-icon>
|
||||
</el-badge>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
<div class="avatar-container">
|
||||
<div class="avatar-wrapper">
|
||||
<el-dropdown
|
||||
@@ -83,22 +91,28 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 公告/通知面板 -->
|
||||
<NoticePanel ref="noticePanelRef" @updateUnreadCount="updateUnreadCount" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { Bell } from '@element-plus/icons-vue';
|
||||
import Breadcrumb from '@/components/Breadcrumb';
|
||||
import TopNav from '@/components/TopNav';
|
||||
import Hamburger from '@/components/Hamburger';
|
||||
import Screenfull from '@/components/Screenfull';
|
||||
import SizeSelect from '@/components/SizeSelect';
|
||||
import HeaderSearch from '@/components/HeaderSearch';
|
||||
import NoticePanel from '@/components/NoticePanel';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import useSettingsStore from '@/store/modules/settings';
|
||||
import { getOrg, switchOrg } from '@/api/login';
|
||||
import { getUnreadCount } from '@/api/system/notice';
|
||||
|
||||
const appStore = useAppStore();
|
||||
const userStore = useUserStore();
|
||||
@@ -106,6 +120,22 @@ const settingsStore = useSettingsStore();
|
||||
const orgOptions = ref([]);
|
||||
const showDialog = ref(false);
|
||||
const orgId = ref('');
|
||||
const noticePanelRef = ref(null);
|
||||
const unreadCount = ref(0);
|
||||
|
||||
// 加载未读数量
|
||||
function loadUnreadCount() {
|
||||
getUnreadCount().then(res => {
|
||||
unreadCount.value = res.data || 0;
|
||||
}).catch(() => {
|
||||
unreadCount.value = 0;
|
||||
});
|
||||
}
|
||||
|
||||
// 更新未读数量
|
||||
function updateUnreadCount() {
|
||||
loadUnreadCount();
|
||||
}
|
||||
|
||||
function loadOrgList() {
|
||||
getOrg().then((res) => {
|
||||
@@ -115,6 +145,7 @@ function loadOrgList() {
|
||||
|
||||
onMounted(() => {
|
||||
loadOrgList();
|
||||
loadUnreadCount();
|
||||
});
|
||||
|
||||
function handleOrgSwitch(selectedOrgId) {
|
||||
@@ -160,12 +191,12 @@ function logout() {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
userStore.logOut().then(() => {
|
||||
location.href = '/index';
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
.then(() => {
|
||||
userStore.logOut().then(() => {
|
||||
location.href = '/index';
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
function submit() {
|
||||
@@ -182,6 +213,13 @@ const emits = defineEmits(['setLayout']);
|
||||
function setLayout() {
|
||||
emits('setLayout');
|
||||
}
|
||||
|
||||
// 打开公告/通知面板
|
||||
function openNoticePanel() {
|
||||
if (noticePanelRef.value) {
|
||||
noticePanelRef.value.open();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
@@ -222,7 +260,31 @@ function setLayout() {
|
||||
transition: background 0.3s;
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255,255,255,0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notice-btn {
|
||||
cursor: pointer;
|
||||
padding: 0 10px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.notice-badge {
|
||||
:deep(.el-badge__content) {
|
||||
top: -5px;
|
||||
right: -5px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-icon {
|
||||
font-size: 20px;
|
||||
color: #606266;
|
||||
|
||||
&:hover {
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ export const constantRoutes = [
|
||||
},
|
||||
{
|
||||
path: '/tpr',
|
||||
component: () => import('@/views/inpatientNurse/tprSheet/index.vue'),
|
||||
component: () => import('@/views/inpatientNurse/tprsheet/index.vue'),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -52,8 +52,23 @@
|
||||
<td class="sequence-number">{{ index + 1 }}</td>
|
||||
<td class="employee-info">
|
||||
<div class="input-container">
|
||||
<!-- 操作员字段始终不可编辑 -->
|
||||
<span class="employee-name">{{ item.operator || '-' }}</span>
|
||||
<!-- 超级管理员可以编辑操作员字段,普通用户不可编辑 -->
|
||||
<select
|
||||
v-if="item.isActive && isAdmin"
|
||||
v-model="item.employeeId"
|
||||
class="form-control"
|
||||
@change="updateOperatorFromEmployeeId(item)"
|
||||
>
|
||||
<option value="">请选择操作员</option>
|
||||
<option
|
||||
v-for="user in userList"
|
||||
:key="user.employeeId"
|
||||
:value="user.employeeId"
|
||||
>
|
||||
{{ user.name }} ({{ user.employeeId }})
|
||||
</option>
|
||||
</select>
|
||||
<span v-else class="employee-name">{{ item.operator || '-' }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="employee-id-cell">
|
||||
@@ -180,7 +195,7 @@ export default {
|
||||
name: '',
|
||||
nickName: '',
|
||||
employeeId: '',
|
||||
status: '' // 0: 启用(管理员), 1: 禁用(普通人员)
|
||||
status: '' // 0: 启用, 1: 禁用(仅用于显示,不再控制权限)
|
||||
},
|
||||
// 用户列表,用于操作员下拉选择(将在created中从后端获取)
|
||||
userList: [],
|
||||
@@ -195,10 +210,11 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 计算属性:判断是否为管理员
|
||||
// 计算属性:判断是否为超级管理员
|
||||
isAdmin() {
|
||||
// 管理员是指在用户管理界面中状态为启用的用户
|
||||
return this.currentUser.status === '0';
|
||||
// 只有用户名等于 'admin' 的用户才是超级管理员,可以查看所有数据
|
||||
const userStore = useUserStore();
|
||||
return userStore.name === 'admin';
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -260,14 +276,25 @@ export default {
|
||||
},
|
||||
// 从后端加载发票数据
|
||||
loadInvoiceData() {
|
||||
// 准备查询参数
|
||||
const queryParams = {
|
||||
pageNo: 1,
|
||||
pageSize: 10000 // 进一步增大分页大小,确保能获取数据库中的所有记录
|
||||
};
|
||||
|
||||
// 非超级管理员用户只能查询自己的发票数据
|
||||
if (!this.isAdmin && this.currentUser.employeeId) {
|
||||
queryParams.invoicingStaffId = this.currentUser.employeeId;
|
||||
console.log('普通用户模式,只查询自己的发票数据,员工ID:', this.currentUser.employeeId);
|
||||
} else {
|
||||
console.log('超级管理员模式,查询所有发票数据');
|
||||
}
|
||||
|
||||
// 使用request工具从后端API获取发票段数据
|
||||
request({
|
||||
url: '/basicmanage/invoice-segment/page', // 更新为发票段的API路径
|
||||
method: 'get',
|
||||
params: {
|
||||
pageNo: 1,
|
||||
pageSize: 10000 // 进一步增大分页大小,确保能获取数据库中的所有记录
|
||||
}
|
||||
params: queryParams
|
||||
}).then(res => {
|
||||
console.log('获取到的发票段数据响应:', res);
|
||||
// 添加更多调试信息
|
||||
@@ -400,18 +427,18 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 根据用户权限过滤数据
|
||||
// 根据用户权限过滤数据(作为后端过滤的补充保障)
|
||||
filterDataByPermission() {
|
||||
console.log('开始过滤数据,当前用户状态:', this.currentUser.status);
|
||||
console.log('开始过滤数据,当前用户:', this.currentUser.name, '是否超级管理员:', this.isAdmin);
|
||||
console.log('过滤前数据总量:', this.invoiceData.length);
|
||||
|
||||
if (this.isAdmin) {
|
||||
// 管理员可以看到所有数据
|
||||
console.log('管理员模式,显示所有数据');
|
||||
// 超级管理员可以看到所有数据
|
||||
console.log('超级管理员模式,显示所有数据');
|
||||
this.filteredData = [...this.invoiceData];
|
||||
} else {
|
||||
// 普通操作员只能看到自己的数据,确保类型一致
|
||||
console.log('操作员模式,过滤条件:', this.currentUser.employeeId);
|
||||
// 普通用户只能看到自己的数据,确保类型一致
|
||||
console.log('普通用户模式,过滤条件:', this.currentUser.employeeId);
|
||||
const currentEmployeeId = String(this.currentUser.employeeId);
|
||||
this.filteredData = this.invoiceData.filter(item =>
|
||||
String(item.employeeId) === currentEmployeeId
|
||||
@@ -441,6 +468,15 @@ export default {
|
||||
item.employeeId = employeeId;
|
||||
},
|
||||
|
||||
// 根据员工ID更新操作员名称(超级管理员使用)
|
||||
updateOperatorFromEmployeeId(item) {
|
||||
if (item.employeeId) {
|
||||
item.operator = this.getUserNameById(item.employeeId);
|
||||
} else {
|
||||
item.operator = '';
|
||||
}
|
||||
},
|
||||
|
||||
// 根据员工ID获取用户名称
|
||||
getUserNameById(employeeId) {
|
||||
if (!employeeId) return '';
|
||||
@@ -449,7 +485,7 @@ export default {
|
||||
},
|
||||
|
||||
addNewRow() {
|
||||
// 新增行时自动填充当前用户信息
|
||||
// 新增行时根据用户权限填充信息
|
||||
// 使用负数作为临时ID,避免与后端数据库ID冲突
|
||||
let maxId = 0;
|
||||
if (this.invoiceData.length > 0) {
|
||||
@@ -462,8 +498,8 @@ export default {
|
||||
const newRecord = {
|
||||
id: newId,
|
||||
segmentId: newSegmentId, // 为新记录设置segmentId
|
||||
operator: this.currentUser.name, // 自动使用当前用户名称
|
||||
employeeId: this.currentUser.employeeId,
|
||||
operator: this.isAdmin ? '' : this.currentUser.name, // 超级管理员可选择,普通用户自动填充
|
||||
employeeId: this.isAdmin ? '' : this.currentUser.employeeId, // 超级管理员可选择,普通用户自动填充
|
||||
date: currentDate, // 自动填充当日日期
|
||||
startNum: '',
|
||||
endNum: '',
|
||||
@@ -473,7 +509,7 @@ export default {
|
||||
isNewRecord: true // 添加标记表示这是新记录
|
||||
};
|
||||
|
||||
console.log('添加新行,自动填充领用日期为当日:', { newRecord });
|
||||
console.log('添加新行:', this.isAdmin ? '超级管理员模式,可选择操作员' : '普通用户模式,自动填充当前用户信息', { newRecord });
|
||||
this.invoiceData.push(newRecord);
|
||||
},
|
||||
|
||||
@@ -496,8 +532,8 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
// 严格检查权限:只能删除自己维护的发票号码段
|
||||
if (record.operator !== this.currentUser.name) {
|
||||
// 严格检查权限:超级管理员可以删除所有记录,普通用户只能删除自己维护的发票号码段
|
||||
if (!this.isAdmin && record.operator !== this.currentUser.name) {
|
||||
alert('您没有权限删除此记录!只能删除自己维护的发票号码段。');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,11 @@ watch(
|
||||
|
||||
getList();
|
||||
function getList() {
|
||||
// 验证是否已选择患者
|
||||
if (!props.patientInfo || Object.keys(props.patientInfo).length === 0) {
|
||||
return; // 不执行API调用
|
||||
}
|
||||
|
||||
queryParams.value.organizationId = props.patientInfo.orgId;
|
||||
getAdviceBaseInfo(queryParams.value).then((res) => {
|
||||
adviceBaseList.value = res.data.records;
|
||||
|
||||
@@ -412,6 +412,12 @@ function getRowDisabled(row) {
|
||||
|
||||
// 新增医嘱
|
||||
function handleAddPrescription() {
|
||||
// 验证是否已选择患者
|
||||
if (!props.patientInfo || Object.keys(props.patientInfo).length === 0) {
|
||||
proxy.$modal.msgWarning('请先选择患者');
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAdding.value) {
|
||||
proxy.$modal.msgWarning('请先保存当前医嘱');
|
||||
return;
|
||||
|
||||
@@ -795,3 +795,35 @@ export function getTestResult(queryParams) {
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取检验申请单列表
|
||||
*/
|
||||
export function getInspectionApplicationList(queryParams) {
|
||||
return request({
|
||||
url: '/doctor-station/inspection/application-list',
|
||||
method: 'get',
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存检验申请单
|
||||
*/
|
||||
export function saveInspectionApplication(data) {
|
||||
return request({
|
||||
url: '/doctor-station/inspection/application',
|
||||
method: 'post',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除检验申请单
|
||||
*/
|
||||
export function deleteInspectionApplication(id) {
|
||||
return request({
|
||||
url: '/doctor-station/inspection/application/' + id,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -981,7 +981,7 @@ import {
|
||||
checkServicesHistory,
|
||||
} from '../api';
|
||||
import { getAdjustPriceSwitchState } from '@/api/public';
|
||||
import adviceBaseList from '../advicebaselist';
|
||||
import adviceBaseList from '../adviceBaseList.vue';
|
||||
import { computed, getCurrentInstance, nextTick, ref, watch } from 'vue';
|
||||
import { calculateQuantityByDays, formatNumber } from '@/utils/his';
|
||||
import OrderGroupDrawer from './orderGroupDrawer';
|
||||
|
||||
@@ -161,6 +161,9 @@
|
||||
<el-tab-pane label="中医" name="tcm">
|
||||
<tcmAdvice :patientInfo="patientInfo" ref="tcmRef" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="检验" name="inspection">
|
||||
<inspectionApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="inspectionRef" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="电子处方" name="eprescription">
|
||||
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
||||
</el-tab-pane>
|
||||
@@ -214,6 +217,7 @@ import PrescriptionInfo from './components/prescription/prescriptionInfo.vue';
|
||||
import eprescriptionlist from './components/eprescriptionlist.vue';
|
||||
import HospitalizationDialog from './components/hospitalizationDialog.vue';
|
||||
import tcmAdvice from './components/tcm/tcmAdvice.vue';
|
||||
import inspectionApplication from './components/inspection/inspectionApplication.vue';
|
||||
import { formatDate, formatDateStr } from '@/utils/index';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import { nextTick } from 'vue';
|
||||
@@ -263,6 +267,7 @@ const registerTime = ref(formatDate(new Date()));
|
||||
const patientDrawerRef = ref();
|
||||
const prescriptionRef = ref();
|
||||
const tcmRef = ref();
|
||||
const inspectionRef = ref();
|
||||
const emrRef = ref();
|
||||
const diagnosisRef = ref();
|
||||
const waitCount = ref(0);
|
||||
@@ -396,6 +401,9 @@ function handleClick(tab) {
|
||||
case 'tcm':
|
||||
tcmRef.value.getDiagnosisInfo();
|
||||
break;
|
||||
case 'inspection':
|
||||
// 检验tab点击处理逻辑可以在这里添加
|
||||
break;
|
||||
case 'eprescription':
|
||||
eprescriptionRef.value.getList();
|
||||
break;
|
||||
@@ -453,6 +461,7 @@ function handleCardClick(item, index) {
|
||||
nextTick(() => {
|
||||
prescriptionRef.value.getListInfo();
|
||||
tcmRef.value.getListInfo();
|
||||
inspectionRef.value.getList();
|
||||
diagnosisRef.value.getList();
|
||||
eprescriptionRef.value.getList();
|
||||
// emrRef.value.getDetail(item.encounterId);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import inPatientBarDoctorFold from '@/components/patientBar/inPatientBarDoctorFold.vue';
|
||||
import Details from './compoents/details.vue';
|
||||
import Details from './components/details.vue';
|
||||
import { patientInfo, updatePatientInfo } from '@/views/inpatientNurse/components/store/patient';
|
||||
import PatientList from '@/components/PatientList/patient-list.vue';
|
||||
|
||||
|
||||
@@ -70,11 +70,12 @@
|
||||
|
||||
<el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="noticeId" width="100" />
|
||||
<el-table-column label="序号" align="center" prop="noticeId" width="80" />
|
||||
<el-table-column
|
||||
label="公告标题"
|
||||
align="center"
|
||||
prop="noticeTitle"
|
||||
min-width="200"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column label="公告类型" align="center" prop="noticeType" width="100">
|
||||
@@ -82,20 +83,40 @@
|
||||
<dict-tag :options="sys_notice_type" :value="scope.row.noticeType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<el-table-column label="状态" align="center" prop="status" width="90">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_notice_status" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建者" align="center" prop="createBy" width="100" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
|
||||
<el-table-column label="发布状态" align="center" prop="publishStatus" width="90">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.publishStatus === '1'" type="success">已发布</el-tag>
|
||||
<el-tag v-else type="info">未发布</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建者" align="center" prop="createBy" width="90" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="110">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="280">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:notice:edit']">修改</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.publishStatus !== '1'"
|
||||
link type="success"
|
||||
icon="Promotion"
|
||||
@click="handlePublish(scope.row)"
|
||||
v-hasPermi="['system:notice:edit']"
|
||||
>发布</el-button>
|
||||
<el-button
|
||||
v-else
|
||||
link type="warning"
|
||||
icon="RemoveFilled"
|
||||
@click="handleUnpublish(scope.row)"
|
||||
v-hasPermi="['system:notice:edit']"
|
||||
>取消发布</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:notice:remove']" >删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -159,7 +180,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Notice">
|
||||
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
|
||||
import { listNotice, getNotice, delNotice, addNotice, updateNotice, publishNotice, unpublishNotice } from "@/api/system/notice";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_notice_status, sys_notice_type } = proxy.useDict("sys_notice_status", "sys_notice_type");
|
||||
@@ -212,7 +233,8 @@ function reset() {
|
||||
noticeTitle: undefined,
|
||||
noticeType: undefined,
|
||||
noticeContent: undefined,
|
||||
status: "0"
|
||||
status: "0",
|
||||
publishStatus: "0"
|
||||
};
|
||||
proxy.resetForm("noticeRef");
|
||||
}
|
||||
@@ -259,6 +281,8 @@ function submitForm() {
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
// 新增时默认为未发布状态
|
||||
form.value.publishStatus = "0";
|
||||
addNotice(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
@@ -278,6 +302,24 @@ function handleDelete(row) {
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
/** 发布按钮操作 */
|
||||
function handlePublish(row) {
|
||||
proxy.$modal.confirm('确认发布该公告吗?发布后将对所有用户可见。').then(function() {
|
||||
return publishNotice(row.noticeId);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("发布成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
/** 取消发布按钮操作 */
|
||||
function handleUnpublish(row) {
|
||||
proxy.$modal.confirm('确认取消发布该公告吗?取消后将不再对用户可见。').then(function() {
|
||||
return unpublishNotice(row.noticeId);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("已取消发布");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
|
||||
27
openhis-ui-vue3/src/views/triageandqueuemanage/api.js
Normal file
27
openhis-ui-vue3/src/views/triageandqueuemanage/api.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询叫号语音设置
|
||||
export function getCallNumberVoiceConfig() {
|
||||
return request({
|
||||
url: '/CallNumberVoice/get',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增叫号语音设置
|
||||
export function addCallNumberVoiceConfig(data) {
|
||||
return request({
|
||||
url: '/CallNumberVoice/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改叫号语音设置
|
||||
export function updateCallNumberVoiceConfig(data) {
|
||||
return request({
|
||||
url: '/CallNumberVoice/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,754 @@
|
||||
<template>
|
||||
<div class="call-voice-settings">
|
||||
<!-- 标题区域 -->
|
||||
<div class="title-section">
|
||||
<h1>叫号语音设置</h1>
|
||||
</div>
|
||||
|
||||
<!-- 语音设置模块 -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">科室叫号语音设置</h2>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" @click="saveSettings" :disabled="loading">
|
||||
<span v-if="loading">保存中...</span>
|
||||
<span v-else>保存设置</span>
|
||||
</button>
|
||||
<button class="btn btn-secondary" @click="cancelSettings" :disabled="loading">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-section">
|
||||
<!-- 播放次数设置 -->
|
||||
<div class="setting-item">
|
||||
<div class="setting-title">
|
||||
<div class="icon">🔢</div>
|
||||
<div>播放次数</div>
|
||||
</div>
|
||||
<div class="setting-content">
|
||||
<div class="form-group">
|
||||
<label class="form-label">播放次数</label>
|
||||
<select v-model="settings.playCount" class="form-control" :disabled="loading">
|
||||
<option value="1">1次</option>
|
||||
<option value="2">2次</option>
|
||||
<option value="3">3次</option>
|
||||
<option value="4">4次</option>
|
||||
<option value="5">5次</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="play-controls">
|
||||
<div class="play-btn" @click="testPlay" :disabled="loading">
|
||||
<svg v-if="!isPlaying" width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M8 5V19L19 12L8 5Z" fill="white"/>
|
||||
</svg>
|
||||
<svg v-else width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M14 19H18V5H14V19ZM6 19H10V5H6V19Z" fill="white"/>
|
||||
</svg>
|
||||
</div>
|
||||
<span v-if="loading">加载中...</span>
|
||||
<span v-else-if="isPlaying">正在播放...</span>
|
||||
<span v-else>点击测试播放效果</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 语音内容设置 -->
|
||||
<div class="setting-item">
|
||||
<div class="setting-title">
|
||||
<div class="icon">🗣️</div>
|
||||
<div>语音内容</div>
|
||||
</div>
|
||||
<div class="setting-content">
|
||||
<div class="form-group">
|
||||
<label class="form-label">叫号前缀</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="例如:请"
|
||||
v-model="settings.prefix"
|
||||
:disabled="loading"
|
||||
>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">叫号后缀</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="例如:到诊室就诊"
|
||||
v-model="settings.suffix"
|
||||
:disabled="loading"
|
||||
>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">语音速度</label>
|
||||
<select v-model="settings.voiceSpeed" class="form-control" :disabled="loading">
|
||||
<option value="slow">较慢</option>
|
||||
<option value="normal">正常</option>
|
||||
<option value="fast">较快</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 其他设置 -->
|
||||
<div class="setting-item">
|
||||
<div class="setting-title">
|
||||
<div class="icon">⚙️</div>
|
||||
<div>其他设置</div>
|
||||
</div>
|
||||
<div class="setting-content">
|
||||
<div class="form-group">
|
||||
<label class="form-label">音量设置</label>
|
||||
<input
|
||||
type="range"
|
||||
min="0"
|
||||
max="100"
|
||||
v-model="settings.volume"
|
||||
class="form-control"
|
||||
@input="updateVolume"
|
||||
:disabled="loading"
|
||||
>
|
||||
<div style="text-align: center; margin-top: 5px; color: var(--text-light);">
|
||||
{{ settings.volume }}%
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">播放间隔</label>
|
||||
<select v-model="settings.playInterval" class="form-control" :disabled="loading">
|
||||
<option value="3">3秒</option>
|
||||
<option value="5">5秒</option>
|
||||
<option value="10">10秒</option>
|
||||
<option value="15">15秒</option>
|
||||
<option value="20">20秒</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="switch-label">
|
||||
<div class="switch">
|
||||
<input type="checkbox" v-model="settings.repeatPlay" :disabled="loading">
|
||||
<span class="slider"></span>
|
||||
</div>
|
||||
<span>开启重复播放</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElSelect, ElMessage } from 'element-plus'
|
||||
import {
|
||||
getCallNumberVoiceConfig,
|
||||
addCallNumberVoiceConfig,
|
||||
updateCallNumberVoiceConfig
|
||||
} from '../api'
|
||||
|
||||
// 响应式数据
|
||||
const isPlaying = ref(false)
|
||||
const loading = ref(false)
|
||||
|
||||
const settings = reactive({
|
||||
playCount: 2,
|
||||
prefix: '请',
|
||||
suffix: '到诊室就诊',
|
||||
voiceSpeed: 'normal',
|
||||
volume: 80,
|
||||
playInterval: 10,
|
||||
repeatPlay: true
|
||||
})
|
||||
|
||||
// 存储原始设置,用于取消时恢复
|
||||
const originalSettings = reactive({ ...settings })
|
||||
|
||||
// 速度值映射函数 - 后端期望中文值
|
||||
const mapSpeedToDatabase = (frontendSpeed) => {
|
||||
const speedMap = {
|
||||
'slow': '较慢',
|
||||
'normal': '正常',
|
||||
'fast': '较快'
|
||||
}
|
||||
const result = speedMap[frontendSpeed] || '正常'
|
||||
console.log(`🔄 mapSpeedToDatabase: ${frontendSpeed} -> ${result}`)
|
||||
return result
|
||||
}
|
||||
|
||||
const mapSpeedToFrontend = (databaseSpeed) => {
|
||||
console.log(`🔍 mapSpeedToFrontend 输入: ${databaseSpeed} (类型: ${typeof databaseSpeed})`)
|
||||
|
||||
const speedMap = {
|
||||
'较慢': 'slow',
|
||||
'正常': 'normal',
|
||||
'较快': 'fast'
|
||||
}
|
||||
|
||||
const result = speedMap[databaseSpeed] || 'normal'
|
||||
console.log(`✅ mapSpeedToFrontend 输出: ${databaseSpeed} -> ${result}`)
|
||||
return result
|
||||
}
|
||||
|
||||
// 方法
|
||||
const saveSettings = async () => {
|
||||
console.log('💾 开始保存设置...', settings)
|
||||
loading.value = true
|
||||
try {
|
||||
// 验证必填数据
|
||||
if (!settings.prefix || settings.prefix.trim() === '') {
|
||||
throw new Error('请填写叫号前缀')
|
||||
}
|
||||
if (!settings.suffix || settings.suffix.trim() === '') {
|
||||
throw new Error('请填写叫号后缀')
|
||||
}
|
||||
|
||||
const configData = {
|
||||
playCount: parseInt(settings.playCount),
|
||||
callPrefix: settings.prefix.trim(),
|
||||
callSuffix: settings.suffix.trim(),
|
||||
speed: mapSpeedToDatabase(settings.voiceSpeed),
|
||||
volume: parseInt(settings.volume),
|
||||
intervalSeconds: parseInt(settings.playInterval),
|
||||
cycleBroadcast: Boolean(settings.repeatPlay)
|
||||
}
|
||||
|
||||
console.log('📤 准备保存的数据:', configData)
|
||||
|
||||
// 验证ID是否存在
|
||||
if (!originalSettings.id) {
|
||||
console.log('⚠️ 未找到配置ID,尝试使用新增接口')
|
||||
|
||||
// 尝试新增配置
|
||||
const response = await addCallNumberVoiceConfig(configData)
|
||||
console.log('✅ 新增接口返回:', response)
|
||||
|
||||
if (response.data && response.data.id) {
|
||||
configData.id = response.data.id
|
||||
}
|
||||
} else {
|
||||
console.log('📝 使用更新接口,配置ID:', originalSettings.id)
|
||||
configData.id = originalSettings.id
|
||||
|
||||
// 使用更新接口保存设置
|
||||
const response = await updateCallNumberVoiceConfig(configData)
|
||||
console.log('✅ 更新接口返回:', response)
|
||||
}
|
||||
|
||||
// 更新原始设置
|
||||
Object.assign(originalSettings, {
|
||||
id: configData.id,
|
||||
playCount: configData.playCount,
|
||||
callPrefix: configData.callPrefix,
|
||||
callSuffix: configData.callSuffix,
|
||||
speed: configData.speed,
|
||||
volume: configData.volume,
|
||||
intervalSeconds: configData.intervalSeconds,
|
||||
cycleBroadcast: configData.cycleBroadcast
|
||||
})
|
||||
|
||||
console.log('✅ 原始设置已更新:', originalSettings)
|
||||
ElMessage.success('设置保存成功!')
|
||||
} catch (error) {
|
||||
console.error('❌ 保存失败:', error)
|
||||
ElMessage.error('保存失败:' + (error.message || '请稍后重试'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const cancelSettings = () => {
|
||||
if (confirm('确定要取消所有更改吗?')) {
|
||||
// 恢复到从服务器加载的原始数据
|
||||
if (originalSettings.id) {
|
||||
Object.assign(settings, {
|
||||
playCount: originalSettings.playCount || 2,
|
||||
prefix: originalSettings.callPrefix || '请',
|
||||
suffix: originalSettings.callSuffix || '到诊室就诊',
|
||||
voiceSpeed: originalSettings.speed || 'normal',
|
||||
volume: originalSettings.volume || 80,
|
||||
playInterval: originalSettings.intervalSeconds || 10,
|
||||
repeatPlay: originalSettings.cycleBroadcast !== undefined ? originalSettings.cycleBroadcast : true
|
||||
})
|
||||
} else {
|
||||
// 如果没有原始数据,恢复到默认值
|
||||
Object.assign(settings, {
|
||||
playCount: 2,
|
||||
prefix: '请',
|
||||
suffix: '到诊室就诊',
|
||||
voiceSpeed: 'normal',
|
||||
volume: 80,
|
||||
playInterval: 10,
|
||||
repeatPlay: true
|
||||
})
|
||||
}
|
||||
ElMessage.info('已恢复到原始设置')
|
||||
}
|
||||
}
|
||||
|
||||
const loadSettings = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const response = await getCallNumberVoiceConfig()
|
||||
|
||||
// 处理后端返回的数据结构:response.data.data
|
||||
let data = response.data
|
||||
if (response.data && response.data.data) {
|
||||
data = response.data.data
|
||||
}
|
||||
|
||||
// 验证数据有效性
|
||||
if (data && data.id) {
|
||||
// 播放次数处理 - 转换为字符串类型以匹配select选项
|
||||
const playCountParsed = parseInt(data.playCount)
|
||||
const playCountFinal = isNaN(playCountParsed) ? "2" : String(playCountParsed)
|
||||
settings.playCount = playCountFinal
|
||||
|
||||
// 音量处理
|
||||
const volumeParsed = parseInt(data.volume)
|
||||
const volumeFinal = isNaN(volumeParsed) ? 80 : volumeParsed
|
||||
settings.volume = volumeFinal
|
||||
|
||||
// 播放间隔处理 - 转换为字符串类型以匹配select选项
|
||||
const intervalParsed = parseInt(data.intervalSeconds)
|
||||
const intervalFinal = isNaN(intervalParsed) ? "10" : String(intervalParsed)
|
||||
settings.playInterval = intervalFinal
|
||||
|
||||
// 其他字段处理
|
||||
settings.prefix = data.callPrefix || '请'
|
||||
settings.suffix = data.callSuffix || '到诊室就诊'
|
||||
settings.voiceSpeed = mapSpeedToFrontend(data.speed) || 'normal'
|
||||
settings.repeatPlay = data.cycleBroadcast !== undefined ? Boolean(data.cycleBroadcast) : true
|
||||
|
||||
// 存储原始设置
|
||||
Object.assign(originalSettings, {
|
||||
id: data.id,
|
||||
playCount: data.playCount,
|
||||
callPrefix: data.callPrefix,
|
||||
callSuffix: data.callSuffix,
|
||||
speed: data.speed,
|
||||
volume: data.volume,
|
||||
intervalSeconds: data.intervalSeconds,
|
||||
cycleBroadcast: data.cycleBroadcast
|
||||
})
|
||||
|
||||
ElMessage.success('配置加载成功')
|
||||
} else {
|
||||
// 如果没有有效配置数据,使用默认设置
|
||||
if (data && Object.keys(data).length > 0) {
|
||||
ElMessage.info('未找到现有配置,使用默认设置')
|
||||
} else {
|
||||
ElMessage.warning('未找到配置数据,将使用默认设置')
|
||||
}
|
||||
|
||||
// 使用默认配置
|
||||
Object.assign(settings, {
|
||||
playCount: "2",
|
||||
prefix: '请',
|
||||
suffix: '到诊室就诊',
|
||||
voiceSpeed: 'normal',
|
||||
volume: 80,
|
||||
playInterval: "10",
|
||||
repeatPlay: true
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('获取设置失败:' + (error.message || '请稍后重试'))
|
||||
|
||||
// 错误时使用默认配置
|
||||
Object.assign(settings, {
|
||||
playCount: "2",
|
||||
prefix: '请',
|
||||
suffix: '到诊室就诊',
|
||||
voiceSpeed: 'normal',
|
||||
volume: 80,
|
||||
playInterval: "10",
|
||||
repeatPlay: true
|
||||
})
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 组件挂载时加载设置
|
||||
onMounted(() => {
|
||||
loadSettings()
|
||||
})
|
||||
|
||||
const testPlay = () => {
|
||||
if (isPlaying.value) return
|
||||
|
||||
isPlaying.value = true
|
||||
const playCount = parseInt(settings.playCount)
|
||||
|
||||
// 播放语音
|
||||
for (let i = 0; i < playCount; i++) {
|
||||
setTimeout(() => {
|
||||
speak(`${settings.prefix}1001号${settings.suffix}`)
|
||||
}, i * 1000)
|
||||
}
|
||||
|
||||
// 恢复按钮状态
|
||||
setTimeout(() => {
|
||||
isPlaying.value = false
|
||||
}, playCount * 1000)
|
||||
}
|
||||
|
||||
const speak = (text) => {
|
||||
// 使用Web Speech API进行语音合成
|
||||
if ('speechSynthesis' in window) {
|
||||
const utterance = new SpeechSynthesisUtterance()
|
||||
utterance.text = text
|
||||
utterance.lang = 'zh-CN'
|
||||
utterance.volume = settings.volume / 100
|
||||
|
||||
// 设置语音速度
|
||||
const speedMap = {
|
||||
slow: 0.8,
|
||||
normal: 1,
|
||||
fast: 1.2
|
||||
}
|
||||
utterance.rate = speedMap[settings.voiceSpeed] || 1
|
||||
|
||||
window.speechSynthesis.speak(utterance)
|
||||
} else {
|
||||
// 当前浏览器不支持语音合成功能
|
||||
}
|
||||
}
|
||||
|
||||
const updateVolume = () => {
|
||||
// 音量更新逻辑(显示在界面上)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 基础样式重置 */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
|
||||
}
|
||||
|
||||
:host {
|
||||
/* CSS变量定义,适配项目主题 */
|
||||
--primary-color: #409EFF; /* Element Plus 主色调 */
|
||||
--secondary-color: #909399; /* 次要色 - 中性灰 */
|
||||
--accent-color: #E6A23C; /* 强调色 - 警告色 */
|
||||
--background-color: #f5f7fa; /* 背景色 - 浅灰 */
|
||||
--card-color: #ffffff; /* 卡片背景色 */
|
||||
--text-color: #303133; /* 主文本色 */
|
||||
--text-light: #606266; /* 次要文本色 */
|
||||
--border-color: #dcdfe6; /* 边框色 */
|
||||
--success-color: #67C23A; /* 成功色 */
|
||||
--shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); /* Element Plus 阴影 */
|
||||
}
|
||||
|
||||
.call-voice-settings {
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-color);
|
||||
line-height: 1.6;
|
||||
padding: 20px;
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 标题区域 */
|
||||
.title-section {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 20px 30px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 4px 15px rgba(64, 158, 255, 0.15);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.title-section h1 {
|
||||
color: #000000;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 按钮样式 */
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
background-image: none;
|
||||
box-sizing: border-box;
|
||||
outline: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: #5b8fb9;
|
||||
color: white;
|
||||
border: 1px solid #5b8fb9;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background-color: #6c757d;
|
||||
color: white;
|
||||
border: 1px solid #6c757d;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
opacity: 0.9;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background-color: #4a7a9a;
|
||||
border-color: #4a7a9a;
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background-color: #5a6268;
|
||||
border-color: #5a6268;
|
||||
}
|
||||
|
||||
/* 语音设置卡片 */
|
||||
.card {
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 15px rgba(230, 162, 60, 0.15);
|
||||
padding: 25px;
|
||||
margin-bottom: 25px;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
color: var(--primary-color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card-title::before {
|
||||
content: "①";
|
||||
margin-right: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 设置区域样式 */
|
||||
.settings-section {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
background-color: rgba(64, 158, 255, 0.05);
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
flex: 1;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
.setting-title {
|
||||
font-weight: 600;
|
||||
margin-bottom: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.setting-title .icon {
|
||||
background-color: rgba(64, 158, 255, 0.1);
|
||||
color: var(--primary-color);
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 12px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.setting-content {
|
||||
padding-left: 44px;
|
||||
}
|
||||
|
||||
/* 表单控件样式 */
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 500;
|
||||
color: var(--text-color);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
width: 100%;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
transition: border-color 0.3s, box-shadow 0.3s;
|
||||
box-sizing: border-box;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.form-control:focus {
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
|
||||
}
|
||||
|
||||
select.form-control {
|
||||
appearance: none;
|
||||
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 12px center;
|
||||
background-size: 16px;
|
||||
padding-right: 40px;
|
||||
}
|
||||
|
||||
input[type="range"].form-control {
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 开关控件 */
|
||||
.switch-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 44px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
transition: .4s;
|
||||
border-radius: 22px;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
left: 2px;
|
||||
bottom: 2px;
|
||||
background-color: white;
|
||||
transition: .4s;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #4caf50;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
transform: translateX(22px);
|
||||
}
|
||||
|
||||
/* 播放控制区域 */
|
||||
.play-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.play-btn {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
background-color: #f8a978;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.play-btn:hover {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
||||
background-color: #e69965;
|
||||
}
|
||||
|
||||
/* 响应式布局 */
|
||||
@media (max-width: 768px) {
|
||||
.title-section {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.title-section h1 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.settings-section {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
min-width: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
BIN
发版记录/2025-12-24/~$ Microsoft Word 文档.docx
Normal file
BIN
发版记录/2025-12-24/~$ Microsoft Word 文档.docx
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
-- 添加公告/通知发布状态字段
|
||||
ALTER TABLE sys_notice ADD COLUMN publish_status VARCHAR(1) DEFAULT '0';
|
||||
|
||||
-- 添加字段注释
|
||||
COMMENT ON COLUMN sys_notice.publish_status IS '发布状态(0未发布 1已发布)';
|
||||
|
||||
-- 更新现有数据为已发布状态
|
||||
UPDATE sys_notice SET publish_status = '1' WHERE publish_status IS NULL;
|
||||
26
迁移记录-DB变更记录/2025-12-30 add_table_sys_notice_read.sql
Normal file
26
迁移记录-DB变更记录/2025-12-30 add_table_sys_notice_read.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
-- 公告/通知已读记录表
|
||||
CREATE TABLE IF NOT EXISTS sys_notice_read (
|
||||
read_id BIGINT PRIMARY KEY,
|
||||
notice_id BIGINT NOT NULL,
|
||||
user_id BIGINT NOT NULL,
|
||||
read_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT uk_notice_user UNIQUE (notice_id, user_id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE sys_notice_read IS '公告/通知已读记录表';
|
||||
COMMENT ON COLUMN sys_notice_read.read_id IS '阅读ID';
|
||||
COMMENT ON COLUMN sys_notice_read.notice_id IS '公告/通知ID';
|
||||
COMMENT ON COLUMN sys_notice_read.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN sys_notice_read.read_time IS '阅读时间';
|
||||
|
||||
-- 创建序列
|
||||
CREATE SEQUENCE IF NOT EXISTS sys_notice_read_read_id_seq
|
||||
INCREMENT 1
|
||||
MINVALUE 1
|
||||
MAXVALUE 99999999
|
||||
START 200
|
||||
CACHE 1;
|
||||
|
||||
-- 索引
|
||||
CREATE INDEX IF NOT EXISTS idx_notice_read_notice_id ON sys_notice_read(notice_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_notice_read_user_id ON sys_notice_read(user_id);
|
||||
50
迁移记录-DB变更记录/202512241430add_table_call_number_voice.sql
Normal file
50
迁移记录-DB变更记录/202512241430add_table_call_number_voice.sql
Normal file
@@ -0,0 +1,50 @@
|
||||
CREATE TABLE call_number_voice (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
play_count INT NOT NULL CHECK (play_count BETWEEN 1 AND 5),
|
||||
call_prefix VARCHAR(20),
|
||||
call_suffix VARCHAR(50),
|
||||
speed VARCHAR(10) NOT NULL CHECK (speed IN ('较慢', '正常', '较快')),
|
||||
volume INT NOT NULL CHECK (volume BETWEEN 0 AND 100),
|
||||
interval_seconds INT NOT NULL,
|
||||
cycle_broadcast BOOLEAN NOT NULL DEFAULT false,
|
||||
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
-- 核心约束:循环播放与间隔的逻辑关联
|
||||
CONSTRAINT chk_cycle_interval
|
||||
CHECK (
|
||||
(cycle_broadcast = false AND interval_seconds = 0)
|
||||
OR
|
||||
(cycle_broadcast = true AND interval_seconds > 0)
|
||||
)
|
||||
);
|
||||
|
||||
-- 1. 添加表注释(PostgreSQL 语法)
|
||||
COMMENT ON TABLE call_number_voice IS '叫号语音配置表';
|
||||
|
||||
-- 2. 逐个添加字段注释(PostgreSQL 语法)
|
||||
COMMENT ON COLUMN call_number_voice.id IS '主键ID,自增';
|
||||
COMMENT ON COLUMN call_number_voice.play_count IS '播放次数(1-5次)';
|
||||
COMMENT ON COLUMN call_number_voice.call_prefix IS '叫号前缀(如“请”)';
|
||||
COMMENT ON COLUMN call_number_voice.call_suffix IS '叫号后缀(如“到1号窗口就诊”)';
|
||||
COMMENT ON COLUMN call_number_voice.speed IS '语速(较慢/正常/较快)';
|
||||
COMMENT ON COLUMN call_number_voice.volume IS '音量(0-100%)';
|
||||
COMMENT ON COLUMN call_number_voice.interval_seconds IS '播报间隔(秒)';
|
||||
COMMENT ON COLUMN call_number_voice.cycle_broadcast IS '是否循环播报(默认关闭)';
|
||||
COMMENT ON COLUMN call_number_voice.create_time IS '创建时间(自动填充当前时间)';
|
||||
COMMENT ON COLUMN call_number_voice.update_time IS '更新时间(自动更新)';
|
||||
|
||||
-- 实现update_time自动更新(PostgreSQL需通过触发器)
|
||||
CREATE OR REPLACE FUNCTION update_call_number_voice_time()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.update_time = CURRENT_TIMESTAMP;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_call_number_voice_update
|
||||
BEFORE UPDATE ON call_number_voice
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_call_number_voice_time();
|
||||
|
||||
INSERT INTO call_number_voice (play_count, call_prefix, call_suffix, speed, volume, interval_seconds, cycle_broadcast) VALUES (2,'请','到诊室就诊','正常',80,10,TRUE);
|
||||
Reference in New Issue
Block a user