19 Commits
Author SHA1 Message Date
wanghao c01fd0741d Merge remote-tracking branch 'origin/xc-new' into xc-new 2026-06-24 18:01:14 +08:00
wanghao 6bb4b97ff4 feat(emergency): 实现急救宣教推送到 IM 会话功能
- 新增 FirstAidPush 组件:分类筛选 + 搜索 + 单条/一键推送
- IM 端切换会话时 postMessage 携带 orderId 通知父页面
- 父页面监听 sessionChanged 联动推送按钮与后端调用
- 推送调后端 push/send 记录状态 + IM postMessage 推卡片
- 资源管理正文改富文本编辑器,修批量操作重复提示
- 重建 iweb 产物
2026-06-24 17:23:36 +08:00
wanghao a2a0e274f4 feat(resource): 新增急救宣教资源管理、分类标签、审核管理模块
- 资源管理:列表筛选 + 新增/编辑弹窗 + 移动端预览 + 版本历史,已接入后端 RESTful 接口
- 分类与标签:左侧分类树(支持新增子分类/编辑/删除)+ 右侧标签云管理
- 审核管理:待审核/已通过/已驳回/审核记录四个 tab,驳回原因弹窗已接入审核接口
- 开发环境 API 地址切换为同事本地后台
2026-06-23 17:54:28 +08:00
lianlonggangandClaude 0fa2e605a5 feat(watch): 部门数据统计表格新增关爱人员期初未佩戴人数列
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 17:25:17 +08:00
lianlonggang a47c2c7400 feat(personalData): 去掉部分电话规则校验 2026-05-15 16:46:33 +08:00
lianlonggang 8e7b857dbd feat(personalData): 优化个人数据弹窗布局与无数据提示展示
- 调整顶部操作栏布局为 space-between,增加垂直居中对齐
- 新增无数据提示文字(noDataTip)展示区域,位于日期切换按钮左侧
2026-05-15 09:46:33 +08:00
lianlonggang 8044ce0461 style(healthMonitor,user): 统一代码格式,清理多余空白字符
- 规范 sectoralData.data.ts 文件的代码缩进与空行
- 规范 HealthUserEmployeeEx.data.ts 文件的代码格式
- 规范 HealthUserEmployeeExList.vue 文件的模板格式
2026-05-14 10:03:38 +08:00
lianlonggang 592ffe1f50 fix(healthMonitor): 最后一次更新 2026-05-09 20:37:19 +08:00
lianlonggang eeb1496483 feat(upload): 配置文件上传组件的业务路径和文本提示
- 在 JImageUpload 组件中添加 bizPath 属性以指定上传路径
- 为头像上传功能统一设置 bizPath: 'avatar'
- 为图片上传功能设置 bizPath: 'img'
- 为视频上传功能设置 bizPath: 'video'
- 为PDF文件上传设置 bizPath: 'bizfile'
- 为APP文件上传设置 bizPath: 'appfile'
- 添加 text 属性统一显示 '上传头像' 提示文本
- 在系统横幅管理中配置图片上传的业务路径
- 为新资源管理模块添加完整的数据结构定义
2026-04-30 08:56:14 +08:00
lianlonggang 3da41ae2d3 fix(emergency): 解决消息解析异常问题
- 添加了对消息数据的类型检查
- 添加了JSON解析的异常捕获处理
- 防止非字符串数据导致的解析错误
- 确保消息处理的健壮性
2026-04-10 14:43:29 +08:00
lianlonggang 7106e99a7b fix(chat): 修复消息气泡组件头像加载及位置服务地图链接
- 实现头像加载失败处理机制,添加默认头像回退方案
- 使用 ref 状态追踪头像加载失败情况,避免 watchEffect 重置问题
- 更新位置服务地图链接,从腾讯地图切换到高德地图服务
- 配置 Vue 构建依赖转译,解决 element-plus 兼容性问题
- 移除多个无用的 SVG 图标文件,精简项目资源
2026-04-10 14:43:08 +08:00
lianlonggang c1a56aefd9 style(UserSelectByDepModal): 优化部门选择用户弹窗样式
- 将左侧部门树卡片的 minHeight 改为固定 height: 613px
- 将 overflow: auto 改为 overflowY: auto,避免横向滚动条
2026-04-01 15:31:19 +08:00
lianlonggang 4f848e7ce9 fix(emergency,healthMonitor): 修复通知消息弹窗重复提交问题并优化页面细节
- 为通知消息弹窗的\"保存并发送\"和\"保存\"按钮添加 loading 状态和 disabled 禁用,防止重复提交
- 优化应急管理列表页面和 AED 设备地图页面的代码格式
2026-04-01 14:48:34 +08:00
lianlonggang a9db38e5e1 修复手表数据日历展示问题,屏蔽非当前月的日期,切换日期发生年份变化时获取新年份月数据 2026-03-30 18:53:07 +08:00
weixin 80627d24c0 update 2026-03-24 10:14:26 +08:00
weixin a24c936cde update
1.修改健康银行访问链接,测试环境截取掉:+端口
2026-03-24 10:03:33 +08:00
weixin 5db0c7effc update
1.修改健康银行访问链接
2026-03-24 09:21:27 +08:00
weixin 28707b346e update
1.修改员工工号正则,emp_sysno为EMP_SYSNO
2026-03-19 16:09:23 +08:00
lianlonggang 8eff9119c7 信创改造,处理写死的表名 2026-03-16 17:37:48 +08:00
81 changed files with 3198 additions and 263 deletions
+4 -2
View File
@@ -11,12 +11,14 @@ VITE_PUBLIC_PATH = /
VITE_DROP_CONSOLE = false VITE_DROP_CONSOLE = false
#后台接口父地址(必填) #后台接口父地址(必填)
VITE_GLOB_API_URL=https://xj-api.mcrm.vip:8888 VITE_GLOB_API_URL=http://10.10.20.18
#VITE_GLOB_API_URL=https://xj-api.mcrm.vip:8888
#VITE_GLOB_API_URL=http://192.168.1.223 #VITE_GLOB_API_URL=http://192.168.1.223
#VITE_GLOB_API_URL=http://cqyt.test.yg.dt.io #VITE_GLOB_API_URL=http://cqyt.test.yg.dt.io
#后台接口全路径地址(必填) #后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=https://xj-api.mcrm.vip:8888 VITE_GLOB_DOMAIN_URL=http://10.10.20.18
#VITE_GLOB_DOMAIN_URL=https://xj-api.mcrm.vip:8888
#VITE_GLOB_DOMAIN_URL=http://192.168.1.223 #VITE_GLOB_DOMAIN_URL=http://192.168.1.223
#VITE_GLOB_DOMAIN_URL=http://cqyt.test.yg.dt.io #VITE_GLOB_DOMAIN_URL=http://cqyt.test.yg.dt.io
# 接口前缀 # 接口前缀
@@ -6,8 +6,7 @@
<!-- onerror="this.src='https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png'"--> <!-- onerror="this.src='https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png'"-->
<!-- alt=""--> <!-- alt=""-->
<!-- />--> <!-- />-->
<img class="avatar" v-if="getSrc(message)" :src="getSrc(message)" alt="" /> <img class="avatar" :src="avatarError ? defaultAvatar : (message?.avatar || defaultAvatar)" @error="onAvatarError" alt="" />
<img class="avatar" v-else src="@/assets/image/default_avatar.png" alt="" />
<main class="message-area"> <main class="message-area">
<label class="name" v-if="message.flow === 'in' && message.conversationType === 'GROUP'"> <label class="name" v-if="message.flow === 'in' && message.conversationType === 'GROUP'">
{{ message.nameCard || message.nick || message.from }} {{ message.nameCard || message.nick || message.from }}
@@ -86,6 +85,7 @@
import MessageReference from './message-reference.vue'; import MessageReference from './message-reference.vue';
import { Message } from '../interface'; import { Message } from '../interface';
import { TUIEnv } from '../../../../../TUIKit/TUIPlugin'; import { TUIEnv } from '../../../../../TUIKit/TUIPlugin';
import defaultAvatar from '@/assets/image/default_avatar.png';
import MessageEmojiReact from './message-emoji-react.vue'; import MessageEmojiReact from './message-emoji-react.vue';
import TIM from '../../../../TUICore/tim/index'; import TIM from '../../../../TUICore/tim/index';
@@ -145,6 +145,15 @@
needEmojiReact: false, needEmojiReact: false,
}); });
// 追踪头像加载失败状态,避免 watchEffect 重置时覆盖 @error 的修复
const avatarError = ref(false);
watch(() => (props.data as any)?.ID, () => {
avatarError.value = false;
});
const onAvatarError = () => {
avatarError.value = true;
};
watchEffect(() => { watchEffect(() => {
data.type = constant; data.type = constant;
data.messagesList = props.messagesList; data.messagesList = props.messagesList;
@@ -376,6 +385,9 @@
return { return {
getSrc, getSrc,
defaultAvatar,
avatarError,
onAvatarError,
...toRefs(data), ...toRefs(data),
toggleDialog, toggleDialog,
htmlRefHook, htmlRefHook,
@@ -269,14 +269,16 @@ export function handleLocationMessageShowContext(item: any) {
}; };
location.lon = item.payload.longitude.toFixed(6); location.lon = item.payload.longitude.toFixed(6);
location.lat = item.payload.latitude.toFixed(6); location.lat = item.payload.latitude.toFixed(6);
// 跳转高德地图标记点页面
location.href = location.href =
'https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&' + 'https://uri.amap.com/marker?' +
`pointx=${location.lon}&pointy=${location.lat}&name=${item.payload.description}`; `position=${location.lon},${location.lat}&name=${item.payload.description}&src=mypage&coordinate=gaode&callnative=0`;
// 高德静态地图图片
location.url = location.url =
'https://apis.map.qq.com/ws/staticmap/v2/?' + 'https://restapi.amap.com/v3/staticmap?' +
`center=${location.lat},${location.lon}&zoom=10&size=300*150&maptype=roadmap&` + `location=${location.lon},${location.lat}&zoom=10&size=300*150&` +
`markers=size:large|color:0xFFCCFF|label:k|${location.lat},${location.lon}&` + `markers=large,,A:${location.lon},${location.lat}&` +
'key=UBNBZ-PTP3P-TE7DB-LHRTI-Y4YLE-VWBBD'; 'key=8498ba3ba280654a7f6891b617f7d6ef';
location.description = item.payload.description; location.description = item.payload.description;
return location; return location;
} }
@@ -151,6 +151,19 @@
store.commit('setOrderId', item.children.orderId); store.commit('setOrderId', item.children.orderId);
store.commit('setSessionId', item.children.sessionId); store.commit('setSessionId', item.children.sessionId);
store.commit('setConsultInfo', { consultType: item.type, consultStatus: item?.children?.contentStatus }); store.commit('setConsultInfo', { consultType: item.type, consultStatus: item?.children?.contentStatus });
// 通知父页面会话切换,携带 orderId 用于急救宣教推送等场景
try {
window.parent.postMessage(
JSON.stringify({
code: 'sessionChanged',
orderId: item.children.orderId,
sessionId: item.children.sessionId,
}),
'*'
);
} catch (e) {
console.log(e);
}
const it = item.children; const it = item.children;
if (hrefParams.isSpecialized === 'expert') { if (hrefParams.isSpecialized === 'expert') {
store.commit( store.commit(
+1
View File
@@ -9,6 +9,7 @@ module.exports = {
outputDir: '../public/static/im-web', outputDir: '../public/static/im-web',
productionSourceMap: false, productionSourceMap: false,
lintOnSave: false, lintOnSave: false,
transpileDependencies: ['element-plus', 'vue-router', '@ctrl/tinycolor'],
chainWebpack: (config) => { chainWebpack: (config) => {
config.resolve.alias.set('@', resolve('src')).set('tim', resolve('src/tim.js')); config.resolve.alias.set('@', resolve('src')).set('tim', resolve('src/tim.js'));
// 删除预加载 // 删除预加载
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 731 B

After

Width:  |  Height:  |  Size: 731 B

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48px" height="48px" viewBox="0 0 48 48" version="1.1">
<title>ic_back_white</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="02.-查看信息-示例好友" transform="translate(-32.000000, -200.000000)">
<g id="编组-6" transform="translate(0.000000, 176.000000)">
<g id="ic_back_white" transform="translate(32.000000, 24.000000)">
<g id="ic_back_black" fill="#444444" fill-rule="nonzero">
<path d="M9.51231071,24 L23.5198286,38.7290411 C23.785378,39.0082689 23.7753168,39.4496082 23.4973187,39.7164448 L21.6255915,41.5130226 C21.3466827,41.7807332 20.9035602,41.7716553 20.6358496,41.4927466 C20.6351032,41.491969 20.6343586,41.4911896 20.6336157,41.4904085 L4.45876399,24.4823948 C4.2017544,24.2121467 4.2017544,23.7878533 4.45876399,23.5176052 L20.6336157,6.50959152 C20.900035,6.22944906 21.3431109,6.21832422 21.6232533,6.48474351 C21.6240344,6.48548634 21.6248138,6.48623097 21.6255915,6.48697741 L23.4973187,8.28355524 C23.7753168,8.55039175 23.785378,8.99173114 23.5198286,9.27095893 L9.51231071,24 L9.51231071,24 Z" id="Path-2"></path>
</g>
<rect id="矩形" x="0" y="0" width="48" height="48"></rect>
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="16px" viewBox="0 0 16 16" version="1.1">
<title>清除</title>
<g id="页面-2备份" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="创建群聊" transform="translate(-1243.000000, -413.000000)">
<g id="Group-1364" transform="translate(650.000000, 343.000000)">
<g id="Group-1363" transform="translate(290.000000, 46.000000)">
<g id="Group-1358" transform="translate(0.000000, 24.000000)">
<g id="清除" transform="translate(303.000000, 0.000000)">
<path d="M0,0 L16,0 L16,16 L0,16 L0,0 Z" id="矩形"></path>
<path d="M1,8 C1,11.8659999 4.13400006,15 8,15 C11.8659999,15 15,11.8659999 15,8 C15,4.13400006 11.8659999,1 8,1 L8,1 C4.13400006,1 1,4.13400006 1,8 Z" fill="#999999"></path>
<g id="编组" transform="translate(8.000000, 8.000000) rotate(-315.000000) translate(-8.000000, -8.000000) translate(4.000000, 4.000000)" fill="#FFFFFF">
<rect id="矩形备份" transform="translate(4.000000, 4.000000) rotate(-90.000000) translate(-4.000000, -4.000000) " x="1.8189894e-12" y="3.5" width="8" height="1" rx="0.5"></rect>
<rect id="矩形备份" transform="translate(4.000000, 4.000000) rotate(-360.000000) translate(-4.000000, -4.000000) " x="0" y="3.5" width="8" height="1" rx="0.5"></rect>
</g>
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 536 B

After

Width:  |  Height:  |  Size: 536 B

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 783 B

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 801 B

After

Width:  |  Height:  |  Size: 801 B

Before

Width:  |  Height:  |  Size: 711 B

After

Width:  |  Height:  |  Size: 711 B

Before

Width:  |  Height:  |  Size: 513 B

After

Width:  |  Height:  |  Size: 513 B

Before

Width:  |  Height:  |  Size: 517 B

After

Width:  |  Height:  |  Size: 517 B

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 937 B

After

Width:  |  Height:  |  Size: 937 B

Before

Width:  |  Height:  |  Size: 647 B

After

Width:  |  Height:  |  Size: 647 B

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="16px" viewBox="0 0 16 16" version="1.1">
<title>编组 14</title>
<defs>
<filter x="-10.6%" y="-5.4%" width="121.2%" height="110.9%" filterUnits="objectBoundingBox" id="filter-1">
<feOffset dx="0" dy="7" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="10" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1" result="shadowMatrixOuter1"></feColorMatrix>
<feMerge>
<feMergeNode in="shadowMatrixOuter1"></feMergeNode>
<feMergeNode in="SourceGraphic"></feMergeNode>
</feMerge>
</filter>
</defs>
<g id="new" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="自定义消息" transform="translate(-458.000000, -318.000000)">
<g id="编组-32" filter="url(#filter-1)" transform="translate(44.000000, 60.000000)">
<g id="编组-24" transform="translate(30.000000, 250.000000)">
<g id="编组-14" transform="translate(384.000000, 8.000000)">
<circle id="椭圆形" fill="#006EFF" fill-rule="nonzero" cx="8" cy="8" r="8"></circle>
<polyline id="路径-4" stroke="#FFFFFF" stroke-width="2" transform="translate(8.042641, 6.242641) rotate(-315.000000) translate(-8.042641, -6.242641) " points="6.04264069 10.2426407 10.0426407 10.2426407 10.0426407 2.24264069"></polyline>
</g>
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 281 B

After

Width:  |  Height:  |  Size: 281 B

+2 -2
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><link rel="icon" href="faviconnew.png"><title>即时通信</title><link href="css/vendors~app.03806786.css" rel="stylesheet"><link href="css/app.0de947d6.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but 腾讯云即时通信 Web-IM doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="./TCaptcha.js"></script><script src="./aegis.min.js"></script><script>/** <!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><link rel="icon" href="faviconnew.png"><title>即时通信</title><link href="css/vendors~app.3f294141.css" rel="stylesheet"><link href="css/app.e6e597ee.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but 腾讯云即时通信 Web-IM doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="./TCaptcha.js"></script><script src="./aegis.min.js"></script><script>/**
* 根据基础字体大小 和 效果图宽度设置 根节点字体大小 * 根据基础字体大小 和 效果图宽度设置 根节点字体大小
* @param baseFontSize 浏览器默认字体大小 [注]浏览器最小字体为12像素,所以该值必需大于等于12 * @param baseFontSize 浏览器默认字体大小 [注]浏览器最小字体为12像素,所以该值必需大于等于12
* @param baseWidth 设计稿的尺寸 * @param baseWidth 设计稿的尺寸
@@ -53,4 +53,4 @@
}, },
false false
); );
};</script><script src="js/vendors~app.de88239f.js"></script><script src="js/app.8ff38855.js"></script></body></html> };</script><script src="js/vendors~app.be028cd5.js"></script><script src="js/app.d3bfe68a.js"></script></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@
<BasicModal v-bind="$attrs" @register="register" :title="modalTitle" width="1200px" @ok="handleOk" destroyOnClose @visible-change="visibleChange"> <BasicModal v-bind="$attrs" @register="register" :title="modalTitle" width="1200px" @ok="handleOk" destroyOnClose @visible-change="visibleChange">
<a-row :gutter="10"> <a-row :gutter="10">
<a-col :md="7" :sm="24"> <a-col :md="7" :sm="24">
<a-card :style="{ minHeight: '613px', overflow: 'auto' }"> <a-card :style="{ height: '613px', overflowY: 'auto' }">
<!--组织机构--> <!--组织机构-->
<BasicTree <BasicTree
ref="treeRef" ref="treeRef"
+6 -6
View File
@@ -45,7 +45,7 @@
import { getToken } from '/@/utils/auth'; import { getToken } from '/@/utils/auth';
import { useLoading } from '/@/components/Loading'; import { useLoading } from '/@/components/Loading';
import { useGlobSetting } from '/@/hooks/setting'; import { useGlobSetting } from '/@/hooks/setting';
const { viteOutUrl } = useGlobSetting(); const { viteOutUrl, apiUrl } = useGlobSetting();
export default defineComponent({ export default defineComponent({
name: 'BasicMenu', name: 'BasicMenu',
@@ -130,16 +130,16 @@
async function handleMenuClick({ item, key }: { item: any; key: string; keyPath: string[] }) { async function handleMenuClick({ item, key }: { item: any; key: string; keyPath: string[] }) {
if (item.title === '健康银行') { if (item.title === '健康银行') {
open(); open();
const url = viteOutUrl;
console.log(url);
console.log(useGlobSetting());
await defHttp await defHttp
.get({ .get({
url: '/health-system/api/sys/encryptInfo', url: '/health-system/api/sys/encryptInfo',
params: { params: {
str: { str: {
scheme: url.split('://')[0], scheme: apiUrl.split('://')[0],
host: url.split('://')[1], host:
apiUrl.split('://')[1].indexOf(':') !== -1
? apiUrl.split('://')[1].substring(0, apiUrl.split('://')[1].indexOf(':'))
: apiUrl.split('://')[1],
tokenF: getToken(), tokenF: getToken(),
}, },
}, },
+1 -1
View File
@@ -20,7 +20,7 @@
fontSize: props.size ?? '30px', fontSize: props.size ?? '30px',
opacity: 0.5, opacity: 0.5,
transition: 'opacity 0.5s', transition: 'opacity 0.5s',
display: 'none', display: 'block',
}); });
const bodyStyle = ref({ const bodyStyle = ref({
+17
View File
@@ -0,0 +1,17 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
pendingList = '/health-emergency/emergency/firstAid/audit/pending',
passedList = '/health-emergency/emergency/firstAid/audit/passed',
rejectedList = '/health-emergency/emergency/firstAid/audit/rejected',
recordsList = '/health-emergency/emergency/firstAid/audit/records',
approve = '/health-emergency/emergency/firstAid/audit/approve',
reject = '/health-emergency/emergency/firstAid/audit/reject',
}
export const pendingListApi = (params: any) => defHttp.get({ url: Api.pendingList, params });
export const passedListApi = (params: any) => defHttp.get({ url: Api.passedList, params });
export const rejectedListApi = (params: any) => defHttp.get({ url: Api.rejectedList, params });
export const recordsListApi = (params: any) => defHttp.get({ url: Api.recordsList, params });
export const approveApi = (params: any) => defHttp.post({ url: Api.approve, params });
export const rejectApi = (params: any) => defHttp.post({ url: Api.reject, params });
@@ -0,0 +1,43 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="填写驳回原因" :width="520" :minHeight="300" @ok="handleSubmit">
<a-form layout="vertical">
<a-form-item label="驳回原因" required>
<a-textarea v-model:value="reason" :rows="5" placeholder="请填写驳回原因,将通知内容编辑人员修改..." />
</a-form-item>
</a-form>
</BasicModal>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { rejectApi } from '../check.api';
const emit = defineEmits(['success', 'register']);
const { createMessage } = useMessage();
const reason = ref('');
const record = ref<any>({});
const submitting = ref(false);
const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
record.value = data?.record || {};
reason.value = '';
});
async function handleSubmit() {
if (!reason.value.trim()) {
createMessage.warning('请填写驳回原因');
return;
}
setModalProps({ confirmLoading: true });
try {
await rejectApi({ id: record.value.id, reason: reason.value });
createMessage.success('已驳回,通知已发送');
emit('success');
closeModal();
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>
+327
View File
@@ -0,0 +1,327 @@
<template>
<div class="check-page">
<a-tabs v-model:activeKey="activeTab" @change="onTabChange">
<a-tab-pane key="pending">
<template #tab>
待审核
<a-badge :count="pendingTotal" :number-style="{ backgroundColor: '#fa8c16' }" :overflow-count="999" />
</template>
<div class="filter-bar">
<a-input v-model:value="pendingFilter.title" placeholder="搜索标题" allow-clear style="width: 240px" @press-enter="loadPending" />
<a-button type="primary" @click="loadPending">查询</a-button>
</div>
<a-spin :spinning="pendingLoading">
<div class="review-list">
<div v-for="item in pendingList" :key="item.id" class="review-card">
<div class="review-card-top">
<div class="review-card-main">
<div class="review-title">{{ item.title }}</div>
<div class="review-meta">
提交人{{ item.createBy || '-' }} | 创建时间{{ item.createTime || '-' }} | 分类{{ item.categoryName || '-' }} | 类型{{ getTypeLabel(item.contentType) }}
</div>
</div>
<div class="review-actions">
<a-button size="small" @click="handlePreview(item)">预览</a-button>
<a-button type="primary" size="small" @click="handlePass(item)">通过</a-button>
<a-button danger size="small" @click="handleReject(item)">驳回</a-button>
</div>
</div>
</div>
<a-empty v-if="!pendingLoading && pendingList.length === 0" description="暂无待审核资源" />
</div>
</a-spin>
</a-tab-pane>
<a-tab-pane key="passed" tab="已通过">
<div class="filter-bar">
<a-input v-model:value="passedFilter.title" placeholder="搜索标题" allow-clear style="width: 240px" @press-enter="loadPassed" />
<a-button type="primary" @click="loadPassed">查询</a-button>
</div>
<a-table
:columns="passedColumns"
:data-source="passedList"
:loading="passedLoading"
:pagination="false"
row-key="id"
size="middle"
>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<a-button type="link" size="small" @click="handlePreview(record)">查看</a-button>
</template>
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="rejected" tab="已驳回">
<div class="filter-bar">
<a-input v-model:value="rejectedFilter.title" placeholder="搜索标题" allow-clear style="width: 240px" @press-enter="loadRejected" />
<a-button type="primary" @click="loadRejected">查询</a-button>
</div>
<a-table
:columns="rejectedColumns"
:data-source="rejectedList"
:loading="rejectedLoading"
:pagination="false"
row-key="id"
size="middle"
>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<a-button type="link" size="small" @click="handleReEdit(record)">重新编辑</a-button>
</template>
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="records" tab="审核记录">
<div class="filter-bar">
<a-input v-model:value="recordsFilter.title" placeholder="搜索标题" allow-clear style="width: 200px" @press-enter="loadRecords" />
<a-select v-model:value="recordsFilter.auditStatus" placeholder="审核操作" allow-clear style="width: 140px">
<a-select-option :value="10">全部</a-select-option>
<a-select-option :value="11">已通过</a-select-option>
<a-select-option :value="12">已驳回</a-select-option>
</a-select>
<a-range-picker v-model:value="recordsFilter.dateRange" style="width: 240px" />
<a-button type="primary" @click="loadRecords">查询</a-button>
</div>
<a-table
:columns="recordColumns"
:data-source="recordsList"
:loading="recordsLoading"
:pagination="false"
row-key="id"
size="middle"
>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<a-tag :color="record.auditStatus === 11 ? 'green' : 'red'">
{{ record.auditStatus === 11 ? '通过' : '驳回' }}
</a-tag>
</template>
</template>
</a-table>
</a-tab-pane>
</a-tabs>
<PreviewModal @register="registerPreviewModal" />
<RejectReasonModal @register="registerRejectModal" @success="loadPending" />
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useModal } from '/@/components/Modal';
import {
pendingListApi,
passedListApi,
rejectedListApi,
recordsListApi,
approveApi,
rejectApi,
} from './check.api';
import dayjs from 'dayjs';
import { CONTENT_TYPE } from '/@/views/resource/resource.data';
import PreviewModal from '/@/views/resource/components/PreviewModal.vue';
import RejectReasonModal from './components/RejectReasonModal.vue';
const { createMessage, createConfirm } = useMessage();
const activeTab = ref('pending');
const pendingList = ref<any[]>([]);
const pendingTotal = ref(0);
const pendingLoading = ref(false);
const pendingFilter = reactive({ title: '' });
const passedList = ref<any[]>([]);
const passedLoading = ref(false);
const passedFilter = reactive({ title: '' });
const rejectedList = ref<any[]>([]);
const rejectedLoading = ref(false);
const rejectedFilter = reactive({ title: '' });
const recordsList = ref<any[]>([]);
const recordsLoading = ref(false);
const recordsFilter = reactive({
title: '',
auditStatus: undefined as number | undefined,
dateRange: undefined as any,
});
const [registerPreviewModal, { openModal: openPreviewModal }] = useModal();
const [registerRejectModal, { openModal: openRejectModal }] = useModal();
const passedColumns = [
{ title: '标题', dataIndex: 'title' },
{ title: '分类', dataIndex: 'categoryName', align: 'center', width: 120 },
{ title: '审核人', dataIndex: 'auditBy', align: 'center', width: 120 },
{ title: '审核时间', dataIndex: 'auditTime', align: 'center', width: 170 },
{ title: '审核意见', dataIndex: 'auditOpinion' },
{ title: '操作', dataIndex: 'action', align: 'center', width: 100 },
];
const rejectedColumns = [
{ title: '标题', dataIndex: 'title' },
{ title: '分类', dataIndex: 'categoryName', align: 'center', width: 120 },
{ title: '驳回人', dataIndex: 'auditBy', align: 'center', width: 120 },
{ title: '驳回时间', dataIndex: 'auditTime', align: 'center', width: 170 },
{ title: '驳回原因', dataIndex: 'auditRejectReason' },
{ title: '操作', dataIndex: 'action', align: 'center', width: 120 },
];
const recordColumns = [
{ title: '资源名称', dataIndex: 'title' },
{ title: '操作', dataIndex: 'action', align: 'center', width: 100 },
{ title: '审核人', dataIndex: 'auditBy', align: 'center', width: 120 },
{ title: '时间', dataIndex: 'auditTime', align: 'center', width: 170 },
{ title: '意见', dataIndex: 'auditOpinion' },
];
function getTypeLabel(type: string) {
return CONTENT_TYPE[type as keyof typeof CONTENT_TYPE]?.label || type || '-';
}
function handlePreview(record: any) {
openPreviewModal(true, { record });
}
function handlePass(record: any) {
createConfirm({
iconType: 'info',
title: '确认审核通过',
content: `是否通过《${record.title}》?`,
onOk: async () => {
await approveApi({ id: record.id });
createMessage.success('已审核通过');
loadPending();
},
});
}
function handleReject(record: any) {
openRejectModal(true, { record });
}
function handleReEdit(record: any) {
createMessage.info(`重新编辑:${record.title}(跳转到资源管理编辑)`);
}
async function loadPending() {
pendingLoading.value = true;
try {
const res: any = await pendingListApi({ pageNo: 1, pageSize: 100, title: pendingFilter.title || undefined });
pendingList.value = res?.records || [];
pendingTotal.value = res?.total || 0;
} finally {
pendingLoading.value = false;
}
}
async function loadPassed() {
passedLoading.value = true;
try {
const res: any = await passedListApi({ pageNo: 1, pageSize: 100, title: passedFilter.title || undefined });
passedList.value = res?.records || [];
} finally {
passedLoading.value = false;
}
}
async function loadRejected() {
rejectedLoading.value = true;
try {
const res: any = await rejectedListApi({ pageNo: 1, pageSize: 100, title: rejectedFilter.title || undefined });
rejectedList.value = res?.records || [];
} finally {
rejectedLoading.value = false;
}
}
async function loadRecords() {
recordsLoading.value = true;
try {
const params: any = {
pageNo: 1,
pageSize: 100,
title: recordsFilter.title || undefined,
auditStatus: recordsFilter.auditStatus ?? undefined,
startDate: recordsFilter.dateRange?.[0] ? dayjs(recordsFilter.dateRange[0]).format('YYYY-MM-DD') : undefined,
endDate: recordsFilter.dateRange?.[1] ? dayjs(recordsFilter.dateRange[1]).format('YYYY-MM-DD') : undefined,
};
const res: any = await recordsListApi(params);
recordsList.value = res?.records || [];
} finally {
recordsLoading.value = false;
}
}
function onTabChange(key: string) {
if (key === 'records' && recordsList.value.length === 0) {
loadRecords();
}
}
onMounted(() => {
loadPending();
loadPassed();
loadRejected();
});
</script>
<style lang="less" scoped>
.check-page {
background: #fff;
padding: 16px 20px;
}
.filter-bar {
display: flex;
gap: 8px;
margin-bottom: 16px;
}
.review-list {
display: flex;
flex-direction: column;
gap: 8px;
padding-top: 8px;
}
.review-card {
border: 1px solid #f0f0f0;
border-radius: 2px;
padding: 16px 20px;
transition: all 0.2s;
background: #fff;
&:hover {
border-color: #1890ff;
box-shadow: 0 1px 2px rgba(24, 144, 255, 0.08);
}
}
.review-card-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.review-card-main {
flex: 1;
}
.review-title {
font-size: 14px;
font-weight: 600;
margin-bottom: 4px;
color: rgba(0, 0, 0, 0.85);
}
.review-meta {
font-size: 12px;
color: rgba(0, 0, 0, 0.45);
}
.review-actions {
display: flex;
gap: 8px;
flex-shrink: 0;
margin-left: 16px;
}
</style>
@@ -102,6 +102,7 @@ export const formSchema: FormSchema[] = [
field: 'image', field: 'image',
component: 'JImageUpload', component: 'JImageUpload',
componentProps: { componentProps: {
bizPath: 'img',
fileMax: 1, fileMax: 1,
}, },
}, },
@@ -266,6 +266,8 @@ export const formSchema: FormSchema[] = [
component: 'JImageUpload', component: 'JImageUpload',
// rules: [{ required: true, message: '请选择头像' }], // rules: [{ required: true, message: '请选择头像' }],
componentProps: { componentProps: {
text: '上传头像',
bizPath: 'avatar',
//@ts-ignore //@ts-ignore
maxCount: 1, maxCount: 1,
}, },
@@ -190,6 +190,8 @@ export const formSchema: FormSchema[] = [
label: '头像', label: '头像',
component: 'JImageUpload', component: 'JImageUpload',
componentProps: { componentProps: {
text: '上传头像',
bizPath: 'avatar',
// @ts-ignore // @ts-ignore
maxCount: 1, maxCount: 1,
}, },
@@ -169,6 +169,7 @@ export const formSchema: FormSchema[] = [
field: 'img', field: 'img',
component: 'JImageUpload', component: 'JImageUpload',
componentProps: { componentProps: {
bizPath: 'img',
fileMax: 1, fileMax: 1,
}, },
rules: [{ required: false }], rules: [{ required: false }],
+12 -1
View File
@@ -40,7 +40,7 @@
/> />
<div class="bottom-top"> <div class="bottom-top">
<div class="top-title"> <img :src="aedP" alt="" /> {{ showWindowInfo?.name }} </div> <div class="top-title"> <img :src="aedP" alt="" /> {{ showWindowInfo?.name }} </div>
<div class="top-title-bottom"> 距离{{ showWindowInfo?.dis ? showWindowInfo?.dis : 0 }}m </div> <div class="top-title-bottom"> 距离{{ formatDistance(showWindowInfo?.dis) }} </div>
<div class="top-title-describe"> {{ showWindowInfo?.installAddress ? showWindowInfo?.installAddress : '无' }} </div> <div class="top-title-describe"> {{ showWindowInfo?.installAddress ? showWindowInfo?.installAddress : '无' }} </div>
<div class="table-list"> <div class="table-list">
<div class="label-d"> 设备厂家 </div> <div class="label-d"> 设备厂家 </div>
@@ -411,6 +411,17 @@
window.open(getFileAccessHttpUrl(v), '_blank'); window.open(getFileAccessHttpUrl(v), '_blank');
} }
/**
* 格式化距离:超过1000米换算为千米,保留两位小数
*/
function formatDistance(dis) {
if (!dis) return '0m';
if (dis >= 1000) {
return (dis / 1000).toFixed(2) + 'km';
}
return dis + 'm';
}
function getName(val, list) { function getName(val, list) {
if (!val && val !== 0) return ''; if (!val && val !== 0) return '';
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
@@ -306,6 +306,7 @@ export const getFormSchema = () => {
component: 'JUpload', component: 'JUpload',
componentProps: () => { componentProps: () => {
return { return {
bizPath: 'video',
maxCount: 1, maxCount: 1,
accept: '.mp4,video/mp4', accept: '.mp4,video/mp4',
tipText: '支持MP4格式,最大200M', tipText: '支持MP4格式,最大200M',
@@ -319,6 +320,7 @@ export const getFormSchema = () => {
component: 'JUpload', component: 'JUpload',
componentProps: () => { componentProps: () => {
return { return {
bizPath: 'bizfile',
maxCount: 1, maxCount: 1,
accept: 'application/pdf', accept: 'application/pdf',
tipText: '仅支持PDF格式文件,最大200M', tipText: '仅支持PDF格式文件,最大200M',
@@ -0,0 +1,429 @@
<template>
<div class="firstaid-section">
<div class="firstaid-header">
<span class="firstaid-title">急救宣教推送</span>
<button
class="firstaid-push-all-btn"
:disabled="list.length === 0 || batchLoading"
@click="pushAll"
>
{{ batchLoading ? '推送中...' : '一键推送' }}
</button>
</div>
<div class="firstaid-search-wrap">
<input
v-model="keyword"
placeholder="搜索宣教内容、分类或关键词…"
@input="onSearch"
@keyup.enter="loadList"
/>
<button v-if="keyword" class="firstaid-search-clear" title="清空" @click="clearSearch">×</button>
</div>
<!-- 分类标签 -->
<div class="firstaid-tabs">
<span
class="firstaid-tab"
:class="{ active: !currentCategoryId }"
@click="switchCategory('')"
>
全部
</span>
<span
v-for="cat in categoryList"
:key="cat.id"
class="firstaid-tab"
:class="{ active: currentCategoryId === cat.id }"
@click="switchCategory(cat.id)"
>
{{ cat.name }}
</span>
</div>
<!-- 宣教列表 -->
<div class="firstaid-list">
<a-spin :spinning="loading">
<div v-for="item in list" :key="item.id" class="firstaid-item">
<div class="firstaid-item-info">
<div class="firstaid-item-title" :title="item.title">{{ item.title }}</div>
<div class="firstaid-item-meta">
<span class="firstaid-type-tag" :style="getTypeTagStyle(item.contentType)">
{{ getTypeLabel(item.contentType) }}
</span>
<span v-if="item.categoryName">{{ item.categoryName }}</span>
</div>
</div>
<button
class="firstaid-push-btn"
:class="{ pushed: item.pushed }"
:disabled="item.pushed || pushingId === item.id"
@click="pushSingle(item)"
>
{{ item.pushed ? '已推送' : '推送' }}
</button>
</div>
<div v-if="!loading && list.length === 0" class="firstaid-empty">未找到相关宣教内容</div>
</a-spin>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, watch, onMounted, type PropType, type Ref } from 'vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { pushResourceListApi, pushSendApi, pushBatchSendApi } from './firstAidPush.api';
import { categoryListAllApi } from '/@/views/resource/resource.api';
import { CONTENT_TYPE } from '/@/views/resource/resource.data';
const props = defineProps({
orderId: { type: String, default: '' },
iframeRef: { type: Object as PropType<Ref<HTMLIFrameElement>>, default: null },
hasInteractedWithIm: { type: Boolean, default: false },
});
const { createMessage } = useMessage();
const keyword = ref('');
const currentCategoryId = ref('');
const categoryList = ref<any[]>([]);
const list = ref<any[]>([]);
const loading = ref(false);
const pushingId = ref('');
const batchLoading = ref(false);
let searchTimer: any = null;
function getTypeLabel(type: string) {
return CONTENT_TYPE[type as keyof typeof CONTENT_TYPE]?.label || type;
}
function getTypeTagStyle(type: string) {
const color = CONTENT_TYPE[type as keyof typeof CONTENT_TYPE]?.color || 'default';
const colorMap: Record<string, string> = {
blue: '#1890ff',
red: '#f5222d',
orange: '#fa8c16',
default: '#8c8c8c',
};
const c = colorMap[color] || colorMap.default;
return {
color: c,
borderColor: c,
};
}
async function loadList() {
loading.value = true;
try {
const res: any = await pushResourceListApi({
orderId: props.orderId || undefined,
keyword: keyword.value || undefined,
categoryId: currentCategoryId.value || undefined,
pageNo: 1,
pageSize: 50,
});
list.value = res?.records || [];
} finally {
loading.value = false;
}
}
function onSearch() {
if (searchTimer) clearTimeout(searchTimer);
searchTimer = setTimeout(loadList, 300);
}
function clearSearch() {
keyword.value = '';
loadList();
}
function switchCategory(id: string) {
currentCategoryId.value = id;
loadList();
}
// 通过 IM iframe 的 postMessage 发送自定义消息到当前会话
// 复用 iweb 端 message-custom.vue 中 businessID='system' 的卡片渲染
function postMessageToIm(item: any) {
// Vue 3 中父组件传 ref 给子组件 prop 会自动解包,props.iframeRef 已是 iframe DOM 元素
const iframe = props.iframeRef as any;
if (!iframe?.contentWindow) {
return false;
}
const payload = {
code: 'custom',
data: {
businessID: 'system',
title: item.title,
messageImageUrl: item.coverImage || '',
content: item.summary || '',
// 唯一时间戳,避免 IM SDK 对相同 payload 去重导致重复推送不显示
_ts: Date.now(),
},
};
iframe.contentWindow.postMessage(JSON.stringify(payload), '*');
return true;
}
async function pushSingle(item: any) {
if (!props.hasInteractedWithIm) {
createMessage.warning('请先在左侧选择会话');
return;
}
if (!props.orderId) {
createMessage.warning('当前会话未关联工单,无法记录推送状态');
return;
}
pushingId.value = item.id;
try {
// 1. 调后端接口写入推送记录(后端会触发推送通知给目标用户)
await pushSendApi({ resourceId: item.id, orderId: props.orderId });
// 2. 同时通过 IM iframe 推送卡片到当前会话(即时展示)
postMessageToIm(item);
item.pushed = true;
createMessage.success(`已推送:${item.title}`);
} finally {
pushingId.value = '';
}
}
async function pushAll() {
if (!props.hasInteractedWithIm) {
createMessage.warning('请先在左侧选择会话');
return;
}
if (!props.orderId) {
createMessage.warning('当前会话未关联工单,无法记录推送状态');
return;
}
const unpushed = list.value.filter((item) => !item.pushed);
if (unpushed.length === 0) {
createMessage.info('当前列表已全部推送');
return;
}
batchLoading.value = true;
try {
// 1. 调后端接口批量推送(后端按条件查出资源并触发推送通知)
await pushBatchSendApi({
orderId: props.orderId,
resourceIds: unpushed.map((item) => item.id),
});
// 2. 同时通过 IM iframe 推送卡片到当前会话(即时展示)
for (const item of unpushed) {
postMessageToIm(item);
await new Promise((resolve) => setTimeout(resolve, 100));
}
list.value.forEach((item) => (item.pushed = true));
createMessage.success(`已推送 ${unpushed.length} 条宣教内容`);
} finally {
batchLoading.value = false;
}
}
watch(
() => props.orderId,
() => {
// 切换对话后重新拉取,刷新每条资源的 pushed 状态
loadList();
}
);
onMounted(async () => {
try {
categoryList.value = (await categoryListAllApi()) || [];
} catch {
categoryList.value = [];
}
loadList();
});
</script>
<style lang="less" scoped>
.firstaid-section {
margin: 10px 15px 0 15px;
border-top: 1px solid #e8e8e8;
padding-top: 10px;
}
.firstaid-header {
font-size: 16px;
font-weight: bold;
margin-bottom: 8px;
display: flex;
align-items: center;
justify-content: space-between;
}
.firstaid-title {
color: rgba(0, 0, 0, 0.85);
}
.firstaid-push-all-btn {
font-size: 12px;
background: #1890ff;
color: white;
border: none;
border-radius: 4px;
padding: 3px 10px;
cursor: pointer;
transition: background 0.2s;
&:hover:not(:disabled) {
background: #096dd9;
}
&:disabled {
background: #d9d9d9;
color: rgba(255, 255, 255, 0.8);
cursor: not-allowed;
}
}
.firstaid-search-wrap {
display: flex;
align-items: center;
margin-bottom: 8px;
background: #f7f7f7;
border-radius: 6px;
padding: 0 8px;
border: 1px solid #ddd;
input {
flex: 1;
border: none;
background: transparent;
outline: none;
font-size: 13px;
padding: 6px 0;
color: #333;
&::placeholder {
color: #bbb;
}
}
}
.firstaid-search-clear {
border: none;
background: none;
cursor: pointer;
padding: 0;
color: #bbb;
font-size: 18px;
line-height: 1;
&:hover {
color: #999;
}
}
.firstaid-tabs {
display: flex;
gap: 6px;
margin-bottom: 8px;
flex-wrap: wrap;
}
.firstaid-tab {
font-size: 11px;
padding: 2px 8px;
border-radius: 12px;
border: 1px solid #d9d9d9;
background: #fff;
cursor: pointer;
color: #666;
transition: all 0.2s;
user-select: none;
&:hover {
border-color: #1890ff;
color: #1890ff;
}
&.active {
background: #1890ff;
color: #fff;
border-color: #1890ff;
}
}
.firstaid-list {
max-height: 260px;
overflow-y: auto;
border: 1px solid #e8e8e8;
border-radius: 6px;
background: #fafafa;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-track {
background: #f1f1f1;
}
&::-webkit-scrollbar-thumb {
background: #ccc;
border-radius: 2px;
}
}
.firstaid-item {
display: flex;
align-items: center;
padding: 7px 10px;
border-bottom: 1px solid #f0f0f0;
font-size: 12px;
background: #fff;
transition: background 0.15s;
&:last-child {
border-bottom: none;
}
&:hover {
background: #f0f7ff;
}
}
.firstaid-item-info {
flex: 1;
overflow: hidden;
}
.firstaid-item-title {
font-weight: 500;
color: #333;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 13px;
}
.firstaid-item-meta {
color: #999;
font-size: 11px;
margin-top: 2px;
display: flex;
align-items: center;
gap: 4px;
}
.firstaid-type-tag {
border-radius: 3px;
padding: 0 4px;
font-size: 10px;
border: 1px solid;
background: #fff;
}
.firstaid-push-btn {
flex-shrink: 0;
margin-left: 8px;
background: #52c41a;
color: white;
border: none;
border-radius: 4px;
padding: 3px 8px;
cursor: pointer;
font-size: 12px;
transition: all 0.2s;
min-width: 42px;
&:hover:not(:disabled) {
background: #389e0d;
}
&:disabled {
background: #b7eb8f;
color: #389e0d;
cursor: default;
}
}
.firstaid-empty {
text-align: center;
padding: 20px;
color: #bbb;
font-size: 13px;
}
</style>
@@ -0,0 +1,19 @@
import { defHttp } from '/@/utils/http/axios';
/**
* 急救宣教推送 - 应急工单场景下推送给求助者
*/
enum Api {
resourceList = '/health-emergency/emergency/firstAid/push/resourceList',
send = '/health-emergency/emergency/firstAid/push/send',
batchSend = '/health-emergency/emergency/firstAid/push/batchSend',
}
// 可推送资源列表(只返回已发布+审核通过+时间有效,每条带 pushed 字段)
export const pushResourceListApi = (params: any) => defHttp.get({ url: Api.resourceList, params });
// 推送单条 { resourceId, orderId }
export const pushSendApi = (params: any) => defHttp.post({ url: Api.send, params }, { successNeedMessage: false });
// 批量推送 { resourceIds: [], orderId } 或 { orderId, filterParams: {...} }
export const pushBatchSendApi = (params: any) => defHttp.post({ url: Api.batchSend, params }, { successNeedMessage: false });
@@ -153,16 +153,18 @@
</a-row> </a-row>
<forHelpAdv :isSpecialized="true" ref="forHelpAdvRef" /> <forHelpAdv :isSpecialized="true" ref="forHelpAdvRef" />
<detail ref="detailRef" /> <detail ref="detailRef" />
<FirstAidPush :orderId="orderId" :iframeRef="iframeRef" :hasInteractedWithIm="hasInteractedWithIm" />
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref, onMounted } from 'vue';
import { Dayjs } from 'dayjs'; import { Dayjs } from 'dayjs';
import detail from './detail.vue'; import detail from './detail.vue';
import { stat, scheduleRecordApi, scheduleRecordNewApi } from './commApi'; import { stat, scheduleRecordApi, scheduleRecordNewApi } from './commApi';
import forHelpAdv from './forHelpAdv.vue'; import forHelpAdv from './forHelpAdv.vue';
import FirstAidPush from './FirstAidPush.vue';
import moment from 'moment'; import moment from 'moment';
import qs from 'qs'; import qs from 'qs';
import { imAddressSrc } from '/@/utils/imAddressSrc'; import { imAddressSrc } from '/@/utils/imAddressSrc';
@@ -175,6 +177,20 @@
}); });
const route = useRoute(); const route = useRoute();
// 当前应急工单IDIM 会话 sessionId),用于急救宣教推送
// 初始值取 URL 中的 sessionId;后续用户在 IM 内切换会话时由 postMessage 更新
const orderId = ref<string>((route.query?.sessionId as string) || '');
// 用户是否已与 IM iframe 交互(粗略判断是否已选会话)
// 跨域 iframe 内部点击事件无法冒泡到父页面,用 window blur + activeElement 近似判断
const hasInteractedWithIm = ref(false);
onMounted(() => {
window.addEventListener('blur', () => {
if (document.activeElement && (document.activeElement as HTMLElement).tagName === 'IFRAME') {
hasInteractedWithIm.value = true;
}
});
});
moment.updateLocale('en', { moment.updateLocale('en', {
weekdaysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], weekdaysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
@@ -184,6 +200,7 @@
const statInfo = ref<Object>({}); const statInfo = ref<Object>({});
const dayS = ref<Array>(); const dayS = ref<Array>();
const loadingVisible = ref<Boolean>(true); // loading const loadingVisible = ref<Boolean>(true); // loading
const iframeRef = ref<HTMLIFrameElement>();
const forHelpDetail = (res) => { const forHelpDetail = (res) => {
detailRef.value.showDrawer(res); detailRef.value.showDrawer(res);
}; };
@@ -217,6 +234,10 @@
case 'forHelpDetail': case 'forHelpDetail':
forHelpDetail(result.userId); forHelpDetail(result.userId);
break; break;
case 'sessionChanged':
// 用户在 IM 内切换会话,更新当前工单 ID
orderId.value = result.orderId || '';
break;
case 'closeLoading': case 'closeLoading':
closeLoading(); closeLoading();
break; break;
@@ -212,17 +212,17 @@
const [registerTable, { reload, getForm, getDataSource, setTableData }] = tableContext; const [registerTable, { reload, getForm, getDataSource, setTableData }] = tableContext;
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
:deep(.ant-table-cell-fix-left, .ant-table-cell-fix-right) { //:deep(.ant-table-cell-fix-left, .ant-table-cell-fix-right) {
position: relative; // position: relative;
border-bottom: none !important; // //border-bottom: none !important;
// border-bottom: 2px solid #f0f0f0 !important;
&:after { // &:after {
position: absolute; // position: absolute;
content: ''; // content: '';
width: 100%; // width: 100%;
top: 0; // top: 0;
left: 0; // left: 0;
border-bottom: 1px solid #f0f0f0; // border-bottom: 1px solid #f0f0f0;
} // }
} //}
</style> </style>
+7 -1
View File
@@ -172,7 +172,13 @@
loadingVisible.value = false; loadingVisible.value = false;
}; };
window.onmessage = async (msg) => { window.onmessage = async (msg) => {
const result = JSON.parse(msg.data); if (!msg.data || typeof msg.data !== 'string') return;
let result: any;
try {
result = JSON.parse(msg.data);
} catch (e) {
return;
}
switch (result.code) { switch (result.code) {
case 'closeLoading': case 'closeLoading':
closeLoading(); closeLoading();
@@ -141,6 +141,8 @@ export const formSchema = function (showGoodAt: boolean): FormSchema[] {
component: 'JImageUpload', component: 'JImageUpload',
required: true, required: true,
componentProps: () => ({ componentProps: () => ({
text: '上传头像',
bizPath: 'avatar',
maxCount: 1, maxCount: 1,
}), }),
}, },
@@ -8,7 +8,7 @@
</template> </template>
</BasicTable> </BasicTable>
</template> </template>
<script setup lang="ts"> <script setup lang="ts" name="bindRecords-name">
import BasicTable from '/@/components/Table/src/BasicTable.vue'; import BasicTable from '/@/components/Table/src/BasicTable.vue';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import { bindRecordColumns, bindRecordSchema } from '/@/views/healthMonitor/healMonitorManage/monitorToll/bindRecords/bindRecords.data'; import { bindRecordColumns, bindRecordSchema } from '/@/views/healthMonitor/healMonitorManage/monitorToll/bindRecords/bindRecords.data';
@@ -7,8 +7,8 @@
</BasicForm> </BasicForm>
<template #footer v-if="title !== '查看'"> <template #footer v-if="title !== '查看'">
<a-button @click="handleCanel">取消</a-button> <a-button @click="handleCanel">取消</a-button>
<a-button type="primary" @click="handleSubmit(1)">保存并发送</a-button> <a-button type="primary" :loading="submitting" :disabled="submitting" @click="handleSubmit(1)">保存并发送</a-button>
<a-button type="primary" @click="handleSubmit(2)">保存</a-button> <a-button type="primary" :loading="submitting" :disabled="submitting" @click="handleSubmit(2)">保存</a-button>
</template> </template>
</BasicModal> </BasicModal>
<ChooseSome <ChooseSome
@@ -35,6 +35,7 @@
// Emits声明 // Emits声明
const emit = defineEmits(['register', 'success', 'userData']); const emit = defineEmits(['register', 'success', 'userData']);
const isUpdate = ref(true); const isUpdate = ref(true);
const submitting = ref(false);
const [examinationModal, { openDrawer }] = useDrawer(); const [examinationModal, { openDrawer }] = useDrawer();
//设置标题 //设置标题
const title = ref(String); const title = ref(String);
@@ -100,6 +101,7 @@
//表单提交事件 //表单提交事件
async function handleSubmit(type: number) { async function handleSubmit(type: number) {
try { try {
submitting.value = true;
let values = await validate(); let values = await validate();
setModalProps({ confirmLoading: true }); setModalProps({ confirmLoading: true });
//提交表单 //提交表单
@@ -109,6 +111,7 @@
//刷新列表 //刷新列表
emit('success'); emit('success');
} finally { } finally {
submitting.value = false;
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
} }
} }
@@ -19,7 +19,7 @@
<notification-news-modal @register="registerModal" @success="handleSuccess" /> <notification-news-modal @register="registerModal" @success="handleSuccess" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts" name="healthMonitor-notificationNews">
import { BasicTable, TableAction } from '/@/components/Table'; import { BasicTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import { list, deleteOne, batchDelete, queryByID, reSend } from './notificationNews.api'; import { list, deleteOne, batchDelete, queryByID, reSend } from './notificationNews.api';
@@ -10,7 +10,8 @@
<!-- <div>数据日期{{ userInfo.dataDate }}</div>--> <!-- <div>数据日期{{ userInfo.dataDate }}</div>-->
</div> </div>
<div style="width: 75%"> <div style="width: 75%">
<div style="display: flex; justify-content: flex-end; padding-right: 30px"> <div style="display: flex; justify-content: space-between; align-items: center; padding-right: 30px">
<div style="color: #faad14; font-size: 13px; padding-left: 4px">{{ noDataTip }}</div>
<div style="display: flex; font-size: 20px; align-items: center"> <div style="display: flex; font-size: 20px; align-items: center">
<a-button size="small" @click="changeDate('0')"> <a-button size="small" @click="changeDate('0')">
<LeftOutlined /> <LeftOutlined />
@@ -23,6 +24,7 @@
format="YYYY-MM-DD" format="YYYY-MM-DD"
@change="changeValue" @change="changeValue"
:allow-clear="false" :allow-clear="false"
dropdownClassName="personal-data-no-other-month"
style="opacity: 0; z-index: 99; position: absolute; top: 0; left: 0" style="opacity: 0; z-index: 99; position: absolute; top: 0; left: 0"
> >
<template #dateRender="{ current }"> <template #dateRender="{ current }">
@@ -47,23 +49,27 @@
</BasicModal> </BasicModal>
</template> </template>
<script setup lang="ts" name="personalDataModal"> <script setup lang="ts" name="personalDataModal">
import { computed, ref, watch } from 'vue'; import { computed, ref, watch, onMounted, onUnmounted, nextTick } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicModal, useModalInner } from '/@/components/Modal';
import AllLook from '/@/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/allLook.vue'; import AllLook from '/@/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/allLook.vue';
import { getDetail, userDataDayByMonth } from '/@/views/healthMonitor/healMonitorManage/monitorToll/personalData/personalData.api'; import { getDetail, userDataDayByMonth } from '/@/views/healthMonitor/healMonitorManage/monitorToll/personalData/personalData.api';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { Menu, message } from 'ant-design-vue'; import { Menu } from 'ant-design-vue';
import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue'; import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue';
const userInfo = ref({}); const userInfo = ref({});
const infoData = ref({}); const infoData = ref({});
const userId = ref(''); const userId = ref('');
const haveInfo = ref(''); const haveInfo = ref('');
const nowDate = ref(dayjs()); const nowDate = ref(dayjs());
const noDataTip = ref('');
const loadedYear = ref(dayjs().format('YYYY'));
const isRight = computed(() => dayjs(nowDate.value).format('YYYY-MM-DD') != dayjs().format('YYYY-MM-DD')); const isRight = computed(() => dayjs(nowDate.value).format('YYYY-MM-DD') != dayjs().format('YYYY-MM-DD'));
// //
const [registerModal, { setModalProps }] = useModalInner(async (data) => { const [registerModal, { setModalProps }] = useModalInner(async (data) => {
userInfo.value = data.record; userInfo.value = data.record;
userId.value = data.record.userId; userId.value = data.record.userId;
//
loadedYear.value = dayjs().format('YYYY');
await userDataDayByMonth({ userId: data.record.userId, year: dayjs().format('YYYY') }).then((res) => { await userDataDayByMonth({ userId: data.record.userId, year: dayjs().format('YYYY') }).then((res) => {
let year = dayjs().format('YYYY'); let year = dayjs().format('YYYY');
let month = ''; let month = '';
@@ -94,6 +100,8 @@
function getDisabled(current) { function getDisabled(current) {
let flag = false; let flag = false;
// bgc
if (dayjs(current).format('YYYY') !== loadedYear.value) return false;
for (let i = 0; i < Object.keys(haveInfo.value).length; i++) { for (let i = 0; i < Object.keys(haveInfo.value).length; i++) {
if (Object.keys(haveInfo.value)[i] == dayjs(current).format('MM') * 1) { if (Object.keys(haveInfo.value)[i] == dayjs(current).format('MM') * 1) {
@@ -109,15 +117,18 @@
} }
async function getInfo() { async function getInfo() {
const dateStr = dayjs(nowDate.value).format('YYYY-MM-DD');
await getDetail({ await getDetail({
userId: userId.value, userId: userId.value,
dataDate: dayjs(nowDate.value).format('YYYY-MM-DD'), dataDate: dateStr,
}).then((res) => { }).then((res) => {
// openModal(true, {
// record,
// dataInfo: res,
// });
infoData.value = res; infoData.value = res;
// API
if (!res || Object.keys(res).length === 0) {
noDataTip.value = `${dateStr}】暂无监测数据`;
} else {
noDataTip.value = '';
}
}); });
} }
@@ -132,7 +143,9 @@
if (getDisabled(nowDate.value)) { if (getDisabled(nowDate.value)) {
getInfo(); getInfo();
} else { } else {
message.info('当日暂无监测数据'); //
infoData.value = {};
noDataTip.value = `${dayjs(nowDate.value).format('YYYY-MM-DD')}】暂无监测数据`;
} }
} }
@@ -148,6 +161,31 @@
function changeValue() { function changeValue() {
getInfo(); getInfo();
} }
// bgc
async function loadYearData(year: string) {
if (year === loadedYear.value) return;
await userDataDayByMonth({ userId: userId.value, year }).then((res) => {
haveInfo.value = res;
loadedYear.value = year;
});
}
// DOM
function onPickerPanelClick(e: MouseEvent) {
const panel = document.querySelector('.personal-data-no-other-month');
if (!panel?.contains(e.target as Node)) return;
nextTick(() => {
const yearBtn = panel.querySelector('.ant-picker-year-btn');
if (!yearBtn) return;
// "2024" "2024"4
const year = yearBtn.textContent?.replace(/[^0-9]/g, '').slice(0, 4) || '';
if (year.length === 4) loadYearData(year);
});
}
onMounted(() => document.addEventListener('click', onPickerPanelClick));
onUnmounted(() => document.removeEventListener('click', onPickerPanelClick));
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@@ -185,3 +223,11 @@
cursor: pointer !important; cursor: pointer !important;
} }
</style> </style>
<style>
/* 隐藏日历面板中非当前月份的日期格,仅对该 picker 生效 */
.personal-data-no-other-month .ant-picker-cell:not(.ant-picker-cell-in-view) {
visibility: hidden;
pointer-events: none;
}
</style>
@@ -151,13 +151,39 @@ export const columnsNew: BasicColumn[] = [
}, },
}, },
{ {
title: '分配设备数', title: '分配设备数',
dataIndex: ['assignedDeviceNums'], dataIndex: ['assignedDeviceNums'],
customRender: ({ text }) => { customRender: ({ text }) => {
if (!text) return 0; if (!text) return 0;
return text; return text;
}, },
}, },
{
title: '未分配设备数',
dataIndex: 'undistributedDeviceNums',
customRender: ({ record }) => {
const total = record.totalAssignedDeviceNums ?? 0;
const assigned = record.assignedDeviceNums ?? 0;
return Math.max(0, total - assigned);
},
},
{
title: '已绑定设备数',
dataIndex: ['assignedDeviceNums'],
customRender: ({ text }) => {
if (!text) return 0;
return text;
},
},
{
title: '未绑定设备数',
dataIndex: 'undistributedDeviceNums',
customRender: ({ record }) => {
const total = record.totalAssignedDeviceNums ?? 0;
const assigned = record.assignedDeviceNums ?? 0;
return Math.max(0, total - assigned);
},
},
{ {
title: '佩戴人员数', title: '佩戴人员数',
dataIndex: ['assignedUserNums'], dataIndex: ['assignedUserNums'],
@@ -166,6 +192,15 @@ export const columnsNew: BasicColumn[] = [
return text; return text;
}, },
}, },
{
title: '关爱人员佩戴人数',
dataIndex: ['careWearNums'],
width: 150,
customRender: ({ text }) => {
if (!text) return 0;
return text;
},
},
{ {
title: '未佩戴人员数', title: '未佩戴人员数',
dataIndex: ['undistributedUserNums'], dataIndex: ['undistributedUserNums'],
@@ -174,6 +209,47 @@ export const columnsNew: BasicColumn[] = [
return text; return text;
}, },
}, },
{
title: '关爱人员未佩戴人数',
dataIndex: ['careUnwearNums'],
width: 160,
customRender: ({ text }) => {
if (!text) return 0;
return text;
},
},
{
title: '关爱人员未佩戴人数\n(仅计入统计日期起期已绑定的人数)',
dataIndex: ['careUnwearAtStartNums'],
width: 180,
customHeaderCell: () => {
return {
style: {
whiteSpace: 'pre-wrap',
},
};
},
customRender: ({ text }) => {
if (!text) return 0;
return text;
},
},
{
title: '非关爱人员数量',
dataIndex: ['nonCareNums'],
customRender: ({ text }) => {
if (!text) return 0;
return text;
},
},
{
title: '关爱人员数量',
dataIndex: ['careNums'],
customRender: ({ text }) => {
if (!text) return 0;
return text;
},
},
{ {
title: '心率异常人数', title: '心率异常人数',
dataIndex: ['heartRateNums'], dataIndex: ['heartRateNums'],
@@ -206,6 +282,7 @@ export const columnsNew: BasicColumn[] = [
return text; return text;
}, },
}, },
]; ];
const startTime = dayjs().subtract(6, 'day').format('YYYY-MM-DD'); const startTime = dayjs().subtract(6, 'day').format('YYYY-MM-DD');
@@ -350,6 +427,16 @@ export const detailColumns = (arr: BasicColumn[] = []) => {
title: '手表所属单位', title: '手表所属单位',
dataIndex: 'watchOrgName', dataIndex: 'watchOrgName',
}, },
{
title: '非关爱人员',
dataIndex: 'nonCareFlag',
width: 100,
customRender: ({ text }) => {
if (text === 1) return '是';
if (text === 0) return '否';
return '';
},
},
...arr, ...arr,
{ {
title: '应佩戴天数', title: '应佩戴天数',
@@ -8,7 +8,7 @@
<user-info-modal @register="registerModal" /> <user-info-modal @register="registerModal" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts" name="userInfoList-name">
import BasicTable from '/@/components/Table/src/BasicTable.vue'; import BasicTable from '/@/components/Table/src/BasicTable.vue';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import { columns, searchSchema } from '/@/views/healthMonitor/healMonitorManage/monitorToll/userInfo/userInfo.data'; import { columns, searchSchema } from '/@/views/healthMonitor/healMonitorManage/monitorToll/userInfo/userInfo.data';
@@ -0,0 +1,103 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" :width="520" :minHeight="300" @ok="handleSubmit">
<a-form layout="vertical">
<a-form-item label="分类名称" required>
<a-input v-model:value="formState.name" placeholder="请输入分类名称" :maxlength="50" />
</a-form-item>
<a-form-item label="父级分类">
<a-tree-select
v-model:value="formState.parentId"
:tree-data="categoryTreeData"
:field-names="{ label: 'name', value: 'id', children: 'children' }"
placeholder="顶级分类(不选)"
allow-clear
tree-default-expand-all
:disabled="!!formState.id"
/>
</a-form-item>
<a-form-item label="排序号">
<a-input-number v-model:value="formState.sortNo" :min="0" style="width: 100%" />
</a-form-item>
<a-form-item label="描述">
<a-textarea v-model:value="formState.description" :rows="3" placeholder="可选" :maxlength="200" />
</a-form-item>
</a-form>
</BasicModal>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { categoryListAllApi, categoryAddApi, categoryEditApi, buildTree } from '../label.api';
const emit = defineEmits(['success', 'register']);
const { createMessage } = useMessage();
const title = ref('新增分类');
const categoryTreeData = ref<any[]>([]);
const formState = reactive({
id: '',
name: '',
parentId: undefined as string | undefined,
sortNo: 1,
description: '',
});
const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
const isUpdate = data?.isUpdate;
title.value = isUpdate ? '编辑分类' : '新增分类';
formState.id = data?.record?.id || '';
formState.name = data?.record?.name || '';
formState.parentId = data?.record?.parentId || (data?.parentId || undefined);
formState.sortNo = data?.record?.sortNo ?? 1;
formState.description = data?.record?.description || '';
//
if (isUpdate) {
formState.parentId = data?.record?.parentId || undefined;
}
await loadCategoryTree();
});
async function loadCategoryTree() {
const list = (await categoryListAllApi()) || [];
categoryTreeData.value = buildTree(list);
}
function validate(): boolean {
if (!formState.name) {
createMessage.warning('请输入分类名称');
return false;
}
return true;
}
async function handleSubmit() {
if (!validate()) return;
setModalProps({ confirmLoading: true });
try {
const params = {
id: formState.id || undefined,
name: formState.name,
parentId: formState.parentId || undefined,
sortNo: formState.sortNo,
description: formState.description,
};
if (formState.id) {
await categoryEditApi(params);
createMessage.success('已更新分类');
} else {
await categoryAddApi(params);
createMessage.success('已新增分类');
}
emit('success');
closeModal();
} finally {
setModalProps({ confirmLoading: false });
}
}
onMounted(() => {
loadCategoryTree();
});
</script>
@@ -0,0 +1,74 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" :width="480" :minHeight="260" @ok="handleSubmit">
<a-form layout="vertical">
<a-form-item label="标签名称" required>
<a-input v-model:value="formState.name" placeholder="请输入标签名称" :maxlength="20" />
</a-form-item>
<a-form-item label="排序号">
<a-input-number v-model:value="formState.sortNo" :min="0" style="width: 100%" />
</a-form-item>
<a-form-item label="描述">
<a-textarea v-model:value="formState.description" :rows="3" placeholder="可选" :maxlength="200" />
</a-form-item>
</a-form>
</BasicModal>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { tagAddApi, tagEditApi } from '../label.api';
const emit = defineEmits(['success', 'register']);
const { createMessage } = useMessage();
const title = ref('新增标签');
const formState = reactive({
id: '',
name: '',
sortNo: 1,
description: '',
});
const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
const isUpdate = data?.isUpdate;
title.value = isUpdate ? '编辑标签' : '新增标签';
formState.id = data?.record?.id || '';
formState.name = data?.record?.name || '';
formState.sortNo = data?.record?.sortNo ?? 1;
formState.description = data?.record?.description || '';
});
function validate(): boolean {
if (!formState.name) {
createMessage.warning('请输入标签名称');
return false;
}
return true;
}
async function handleSubmit() {
if (!validate()) return;
setModalProps({ confirmLoading: true });
try {
const params = {
id: formState.id || undefined,
name: formState.name,
sortNo: formState.sortNo,
description: formState.description,
};
if (formState.id) {
await tagEditApi(params);
createMessage.success('已更新标签');
} else {
await tagAddApi(params);
createMessage.success('已新增标签');
}
emit('success');
closeModal();
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>
+328
View File
@@ -0,0 +1,328 @@
<template>
<div class="label-page">
<a-row :gutter="16">
<!-- 左侧分类树 -->
<a-col :span="7">
<a-card title="分类管理" :bordered="false" class="card-section">
<template #extra>
<a-button type="primary" size="small" @click="handleAddCategory()">
<template #icon><PlusOutlined /></template>
新增
</a-button>
</template>
<a-input-search v-model:value="categorySearch" placeholder="搜索分类" style="margin-bottom: 12px" allow-clear />
<a-spin :spinning="categoryLoading">
<div class="tree-wrap">
<a-tree
v-if="filteredTreeData.length > 0"
v-model:expandedKeys="expandedKeys"
v-model:selectedKeys="selectedKeys"
:tree-data="filteredTreeData"
:field-names="{ title: 'name', key: 'id', children: 'children' }"
block-node
@select="onSelectCategory"
>
<template #title="{ name, id, status, resourceCount }">
<div class="tree-node-content">
<span class="tree-name">{{ name }}</span>
<span v-if="resourceCount != null" class="tree-count">({{ resourceCount }})</span>
<a-tag v-if="status === 2" color="red" style="margin-left: 4px">冻结</a-tag>
<span class="tree-actions">
<a-button type="link" size="small" @click.stop="handleEditCategory({ id, name })"></a-button>
<a-button type="link" size="small" @click.stop="handleAddSubCategory(id)">+</a-button>
<a-button type="link" size="small" danger @click.stop="handleDeleteCategory({ id, name })"></a-button>
</span>
</div>
</template>
</a-tree>
<a-empty v-else description="暂无分类" />
</div>
</a-spin>
</a-card>
</a-col>
<!-- 右侧标签云 + 权限矩阵 -->
<a-col :span="17">
<a-card title="标签管理" :bordered="false" class="card-section">
<template #extra>
<a-button type="primary" size="small" @click="handleAddTag">
<template #icon><PlusOutlined /></template>
新增标签
</a-button>
</template>
<a-input-search v-model:value="tagSearch" placeholder="搜索标签" style="width: 240px; margin-bottom: 12px" allow-clear />
<a-spin :spinning="tagLoading">
<div class="tag-cloud">
<a-tag
v-for="tag in filteredTags"
:key="tag.id"
:color="getTagColor(tag.id)"
class="tag-item-cloud"
closable
@close.prevent="handleDeleteTag(tag)"
>
{{ tag.name }}
<span v-if="tag.resourceCount != null" class="tag-count">{{ tag.resourceCount }}</span>
</a-tag>
<a-empty v-if="filteredTags.length === 0 && !tagLoading" description="暂无标签" />
</div>
</a-spin>
</a-card>
<a-card title="分类权限配置" :bordered="false" class="card-section">
<!-- <a-alert message="权限矩阵接口后端尚未提供,当前为占位展示" type="info" show-icon style="margin-bottom: 12px" />-->
<a-table
:columns="permissionColumns"
:data-source="permissionList"
:pagination="false"
size="middle"
bordered
>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex !== 'role'">
<a-tag :color="getPermissionColor(record.permissions[column.idx])">
{{ getPermissionText(record.permissions[column.idx]) }}
</a-tag>
</template>
</template>
</a-table>
</a-card>
</a-col>
</a-row>
<!-- 分类新增/编辑弹窗 -->
<CategoryFormModal @register="registerCategoryModal" @success="loadCategoryTree" />
<!-- 标签新增/编辑弹窗 -->
<TagFormModal @register="registerTagModal" @success="loadTags" />
</div>
</template>
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue';
import { PlusOutlined } from '@ant-design/icons-vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useModal } from '/@/components/Modal';
import {
categoryListAllApi,
categoryDeleteApi,
tagListAllApi,
tagDeleteApi,
buildTree,
} from './label.api';
import CategoryFormModal from './components/CategoryFormModal.vue';
import TagFormModal from './components/TagFormModal.vue';
const { createMessage } = useMessage();
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
const [registerTagModal, { openModal: openTagModal }] = useModal();
// ============ ============
const categoryList = ref<any[]>([]);
const categoryLoading = ref(false);
const categorySearch = ref('');
const expandedKeys = ref<string[]>([]);
const selectedKeys = ref<string[]>([]);
const categoryTree = computed(() => buildTree(categoryList.value));
const filteredTreeData = computed(() => {
if (!categorySearch.value) return categoryTree.value;
const kw = categorySearch.value.toLowerCase();
const filter = (list: any[]): any[] =>
list
.map((item) => {
const children = item.children ? filter(item.children) : undefined;
if (item.name.toLowerCase().includes(kw) || (children && children.length > 0)) {
return { ...item, children };
}
return null;
})
.filter(Boolean);
return filter(categoryTree.value);
});
const categoryTreeSelectData = computed(() => categoryTree.value);
function onSelectCategory(keys: string[], info: any) {
if (keys.length > 0) {
createMessage.info(`已选中分类:${info.node.name}`);
}
}
function handleAddCategory(parentId?: string) {
openCategoryModal(true, { isUpdate: false, parentId });
}
function handleAddSubCategory(parentId: string) {
openCategoryModal(true, { isUpdate: false, parentId });
}
function handleEditCategory(record: any) {
openCategoryModal(true, { isUpdate: true, record });
}
function handleDeleteCategory(record: any) {
categoryDeleteApi({ id: record.id }, () => {
createMessage.success('已删除分类');
loadCategoryTree();
});
}
// ============ ============
const tagList = ref<any[]>([]);
const tagLoading = ref(false);
const tagSearch = ref('');
const filteredTags = computed(() => {
if (!tagSearch.value) return tagList.value;
return tagList.value.filter((t) => t.name.includes(tagSearch.value));
});
const tagColorPool = ['blue', 'green', 'orange', 'purple', 'red', 'default'];
function getTagColor(id: string) {
let hash = 0;
for (let i = 0; i < id.length; i++) {
hash = id.charCodeAt(i) + ((hash << 5) - hash);
}
return tagColorPool[Math.abs(hash) % tagColorPool.length];
}
function handleAddTag() {
openTagModal(true, { isUpdate: false });
}
function handleDeleteTag(tag: any) {
tagDeleteApi({ id: tag.id }, () => {
createMessage.success('已删除标签');
loadTags();
});
}
// ============ mock ============
const permissionList = ref<any[]>([
{ role: '系统管理员', permissions: ['rw', 'rw', 'rw', 'rw', 'rw'] },
{ role: '内容编辑', permissions: ['r', 'rw', 'rw', 'r', 'rw'] },
{ role: '审核员', permissions: ['r', 'r', 'r', 'r', 'r'] },
{ role: '普通用户', permissions: ['n', 'n', 'n', 'n', 'n'] },
]);
const permissionColumns = [
{ title: '角色', dataIndex: 'role', align: 'center', width: 120 },
{ title: '心肺复苏', dataIndex: 'p0', align: 'center', idx: 0 },
{ title: '创伤处理', dataIndex: 'p1', align: 'center', idx: 1 },
{ title: '中暑急救', dataIndex: 'p2', align: 'center', idx: 2 },
{ title: '骨折固定', dataIndex: 'p3', align: 'center', idx: 3 },
{ title: '烧烫伤', dataIndex: 'p4', align: 'center', idx: 4 },
];
function getPermissionColor(code: string) {
if (code === 'rw') return 'blue';
if (code === 'r') return 'default';
if (code === 'n') return 'red';
return 'default';
}
function getPermissionText(code: string) {
if (code === 'rw') return '读写';
if (code === 'r') return '只读';
if (code === 'n') return '无权限';
return code;
}
// ============ ============
const categoryModalVisible = ref(false);
const categoryModalTitle = ref('新增分类');
const categorySubmitting = ref(false);
const categoryForm = reactive({
id: '',
name: '',
parentId: undefined as string | undefined,
sortNo: 1,
description: '',
});
const tagModalVisible = ref(false);
const tagSubmitting = ref(false);
const tagForm = reactive({ name: '', sortNo: 1, description: '' });
// ============ ============
async function loadCategoryTree() {
categoryLoading.value = true;
try {
const res = await categoryListAllApi();
categoryList.value = res || [];
//
if (expandedKeys.value.length === 0 && categoryTree.value.length > 0) {
expandedKeys.value = [categoryTree.value[0].id];
}
} finally {
categoryLoading.value = false;
}
}
async function loadTags() {
tagLoading.value = true;
try {
const res = await tagListAllApi();
tagList.value = res || [];
} finally {
tagLoading.value = false;
}
}
onMounted(() => {
loadCategoryTree();
loadTags();
});
</script>
<style lang="less" scoped>
.label-page {
padding: 0;
}
.card-section {
margin-bottom: 16px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.tree-wrap {
min-height: 200px;
}
.tree-node-content {
display: flex;
align-items: center;
gap: 4px;
width: 100%;
}
.tree-name {
flex: 1;
}
.tree-count {
font-size: 11px;
color: #999;
margin-left: 4px;
}
.tree-actions {
display: none;
margin-left: auto;
}
:deep(.ant-tree-node-content-wrapper:hover) .tree-actions,
:deep(.ant-tree-treenode-selected) .tree-actions {
display: inline-flex;
}
.tag-cloud {
display: flex;
flex-wrap: wrap;
gap: 8px;
min-height: 60px;
}
.tag-item-cloud {
font-size: 13px;
padding: 4px 14px;
cursor: default;
}
.tag-count {
opacity: 0.5;
font-size: 11px;
margin-left: 4px;
}
</style>
+118
View File
@@ -0,0 +1,118 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
// 分类
categoryList = '/health-emergency/emergency/firstAid/category/list',
categoryListAll = '/health-emergency/emergency/firstAid/category/listAll',
categoryListRoot = '/health-emergency/emergency/firstAid/category/listRoot',
categoryListChildren = '/health-emergency/emergency/firstAid/category/listChildren',
categoryQueryById = '/health-emergency/emergency/firstAid/category/queryById',
categoryAdd = '/health-emergency/emergency/firstAid/category/add',
categoryEdit = '/health-emergency/emergency/firstAid/category/edit',
categoryDelete = '/health-emergency/emergency/firstAid/category/delete',
categoryDeleteBatch = '/health-emergency/emergency/firstAid/category/deleteBatch',
// 标签
tagList = '/health-emergency/emergency/firstAid/tag/list',
tagListAll = '/health-emergency/emergency/firstAid/tag/listAll',
tagQueryById = '/health-emergency/emergency/firstAid/tag/queryById',
tagAdd = '/health-emergency/emergency/firstAid/tag/add',
tagEdit = '/health-emergency/emergency/firstAid/tag/edit',
tagDelete = '/health-emergency/emergency/firstAid/tag/delete',
tagDeleteBatch = '/health-emergency/emergency/firstAid/tag/deleteBatch',
}
// ============ 分类 ============
export const categoryListApi = (params: any) => defHttp.get({ url: Api.categoryList, params });
export const categoryListAllApi = (params?: any) => defHttp.get({ url: Api.categoryListAll, params });
export const categoryListRootApi = (params?: any) => defHttp.get({ url: Api.categoryListRoot, params });
export const categoryListChildrenApi = (params: any) => defHttp.get({ url: Api.categoryListChildren, params });
export const categoryQueryByIdApi = (params: any) => defHttp.get({ url: Api.categoryQueryById, params });
export const categoryAddApi = (params: any) => defHttp.post({ url: Api.categoryAdd, params });
export const categoryEditApi = (params: any) => defHttp.post({ url: Api.categoryEdit, params });
export const categoryDeleteApi = (params: any, handleSuccess: any) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除该分类?',
onOk: async () => {
await defHttp.post({ url: Api.categoryDelete, params });
handleSuccess();
},
});
};
export const categoryDeleteBatchApi = (params: any, handleSuccess: any) => {
createConfirm({
iconType: 'warning',
title: '批量删除',
content: `是否删除选中的 ${params?.length || 0} 个分类?`,
onOk: async () => {
await defHttp.post({ url: Api.categoryDeleteBatch, params });
handleSuccess();
},
});
};
// ============ 标签 ============
export const tagListApi = (params: any) => defHttp.get({ url: Api.tagList, params });
export const tagListAllApi = (params?: any) => defHttp.get({ url: Api.tagListAll, params });
export const tagQueryByIdApi = (params: any) => defHttp.get({ url: Api.tagQueryById, params });
export const tagAddApi = (params: any) => defHttp.post({ url: Api.tagAdd, params });
export const tagEditApi = (params: any) => defHttp.post({ url: Api.tagEdit, params });
export const tagDeleteApi = (params: any, handleSuccess: any) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除该标签?',
onOk: async () => {
await defHttp.post({ url: Api.tagDelete, params });
handleSuccess();
},
});
};
export const tagDeleteBatchApi = (params: any, handleSuccess: any) => {
createConfirm({
iconType: 'warning',
title: '批量删除',
content: `是否删除选中的 ${params?.length || 0} 个标签?`,
onOk: async () => {
await defHttp.post({ url: Api.tagDeleteBatch, params });
handleSuccess();
},
});
};
// ============ 工具:扁平列表转树 ============
export function buildTree(list: any[]): any[] {
const map = new Map<string, any>();
const roots: any[] = [];
list.forEach((item) => {
map.set(item.id, { ...item, children: [] });
});
list.forEach((item) => {
const node = map.get(item.id);
if (item.parentId && map.has(item.parentId)) {
map.get(item.parentId).children.push(node);
} else {
roots.push(node);
}
});
// 移除空 children
const clean = (nodes: any[]) => {
nodes.forEach((n) => {
if (n.children.length === 0) {
delete n.children;
} else {
clean(n.children);
}
});
return nodes;
};
return clean(roots);
}
@@ -0,0 +1,143 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="移动端预览" :width="420" :minHeight="500" :showOkBtn="false" cancelText="关闭">
<div class="preview-wrap">
<div class="preview-phone">
<div class="phone-bar">
<span class="phone-status">急救宣教资源库</span>
<span class="phone-time">9:41</span>
</div>
<div class="phone-content">
<div class="phone-cover">
<img v-if="record.coverImage" :src="record.coverImage" class="cover-img" />
<span v-else>{{ typeIcon }}</span>
</div>
<div class="phone-tags">
<a-tag v-if="record.categoryName" color="blue">{{ record.categoryName }}</a-tag>
<a-tag v-if="record.contentType">{{ typeLabel }}</a-tag>
</div>
<div class="phone-title">{{ record.title }}</div>
<div class="phone-meta">
<span>🕐 {{ record.createTime || '-' }}</span>
<span style="margin-left: 8px">👁 {{ record.viewCount || 0 }}次阅读</span>
</div>
<div class="phone-body">
{{ record.summary || '暂无摘要' }}
</div>
<div class="phone-action">
<a-button type="primary" block> 播放视频</a-button>
</div>
<div class="phone-footer">
<span>👍 {{ Math.floor((record.viewCount || 0) / 6) }}</span>
<span> {{ record.favoriteCount || 0 }}</span>
<span>🔗 分享</span>
</div>
</div>
</div>
</div>
</BasicModal>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { CONTENT_TYPE } from '../resource.data';
const record = ref<any>({});
const typeIcon = computed(() => {
return CONTENT_TYPE[record.value.contentType as keyof typeof CONTENT_TYPE]?.icon || '📄';
});
const typeLabel = computed(() => {
return CONTENT_TYPE[record.value.contentType as keyof typeof CONTENT_TYPE]?.label || record.value.contentType;
});
const [registerModal] = useModalInner(async (data) => {
record.value = data?.record || {};
});
</script>
<style lang="less" scoped>
.preview-wrap {
background: #f5f5f5;
padding: 24px;
display: flex;
justify-content: center;
}
.preview-phone {
width: 300px;
border: 10px solid #001529;
border-radius: 32px;
background: #fff;
overflow: hidden;
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px rgba(0, 0, 0, 0.08);
}
.phone-bar {
background: #001529;
height: 40px;
display: flex;
align-items: center;
padding: 0 16px;
}
.phone-status {
color: rgba(255, 255, 255, 0.65);
font-size: 12px;
flex: 1;
}
.phone-time {
color: #fff;
font-size: 12px;
}
.phone-content {
padding: 16px;
}
.phone-cover {
width: 100%;
height: 140px;
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
border-radius: 2px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 32px;
margin-bottom: 12px;
overflow: hidden;
}
.cover-img {
width: 100%;
height: 100%;
object-fit: cover;
}
.phone-tags {
margin-bottom: 8px;
}
.phone-title {
font-size: 15px;
font-weight: 600;
margin-bottom: 8px;
color: rgba(0, 0, 0, 0.85);
}
.phone-meta {
font-size: 11px;
color: rgba(0, 0, 0, 0.45);
margin-bottom: 12px;
}
.phone-body {
font-size: 13px;
color: rgba(0, 0, 0, 0.65);
line-height: 1.8;
}
.phone-action {
margin-top: 16px;
}
.phone-footer {
display: flex;
gap: 20px;
margin-top: 14px;
padding-top: 10px;
border-top: 1px solid #f0f0f0;
font-size: 12px;
color: rgba(0, 0, 0, 0.45);
}
</style>
@@ -0,0 +1,273 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" :width="900" :minHeight="500" :useDefaultFooter="false" @ok="handleSubmit">
<div class="resource-form">
<a-form layout="vertical" :model="formState">
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="标题" required>
<a-input v-model:value="formState.title" placeholder="请输入资源标题" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="内容类型" required>
<a-select v-model:value="formState.contentType" :options="typeOptions" placeholder="请选择内容类型" />
</a-form-item>
</a-col>
</a-row>
<a-form-item label="摘要">
<a-input v-model:value="formState.summary" placeholder="请输入资源摘要(一句话简介)" />
</a-form-item>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="所属分类" required>
<a-select v-model:value="formState.categoryId" :options="categoryOptions" placeholder="请选择分类" :field-names="{ label: 'name', value: 'id' }" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="适用场景">
<a-select v-model:value="formState.applicableScenario" :options="sceneOptions" placeholder="请选择适用场景" allow-clear />
</a-form-item>
</a-col>
</a-row>
<a-form-item label="标签">
<a-select
v-model:value="formState.tagIdList"
mode="multiple"
:options="tagOptions"
placeholder="请选择标签"
:field-names="{ label: 'name', value: 'id' }"
allow-clear
/>
</a-form-item>
<a-form-item label="正文内容" required>
<JEditor v-model:value="formState.content" />
</a-form-item>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="封面图">
<JImageUpload
v-model:value="formState.coverImage"
bizPath="firstAid/cover"
text="上传封面图"
tipText="支持 JPG/PNG,建议尺寸 750×420px"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="附件/媒体文件">
<JUpload
v-model:value="fileList"
bizPath="firstAid/file"
:multiple="true"
text="上传文件"
tipText="支持 MP4/MP3/PDF,单文件最大 500MB"
/>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="生效时间">
<a-date-picker v-model:value="formState.effectiveTime" showTime valueFormat="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="失效时间">
<a-date-picker v-model:value="formState.expiryTime" showTime valueFormat="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</div>
<template #appendFooter>
<a-button @click="closeModal">取消</a-button>
<a-button @click="handleSaveDraft">保存草稿</a-button>
<a-button type="primary" @click="handleSubmit">提交审核</a-button>
</template>
</BasicModal>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { TYPE_OPTIONS, SCENE_OPTIONS } from '../resource.data';
import { addApi, editApi, submitForReviewApi, categoryListAllApi, tagListAllApi } from '../resource.api';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
import JEditor from '/@/components/Form/src/jeecg/components/JEditor.vue';
const emit = defineEmits(['success', 'register']);
const { createMessage } = useMessage();
const title = ref('新增急救宣教资源');
const categoryOptions = ref<any[]>([]);
const tagOptions = ref<any[]>([]);
// JUpload array JSON.stringify fileUrl
const fileList = ref<any[]>([]);
const formState = reactive({
id: '',
title: '',
summary: '',
contentType: 'IMAGE_TEXT',
categoryId: '' as string,
applicableScenario: '' as string,
tagIdList: [] as string[],
content: '',
coverImage: '',
fileUrl: '',
effectiveTime: null as any,
expiryTime: null as any,
});
const typeOptions = TYPE_OPTIONS;
const sceneOptions = SCENE_OPTIONS;
const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
if (data?.isUpdate) {
title.value = '编辑急救宣教资源';
Object.assign(formState, data.record);
// tags
if (formState.tagIdList && typeof (formState as any).tags === 'string') {
formState.tagIdList = ((formState as any).tags || '').split(',').filter(Boolean);
}
// fileUrl JSON parse JUpload
try {
fileList.value = formState.fileUrl ? JSON.parse(formState.fileUrl) : [];
} catch {
fileList.value = [];
}
} else {
title.value = '新增急救宣教资源';
resetForm();
}
});
function resetForm() {
formState.id = '';
formState.title = '';
formState.summary = '';
formState.contentType = 'IMAGE_TEXT';
formState.categoryId = '';
formState.applicableScenario = '';
formState.tagIdList = [];
formState.content = '';
formState.coverImage = '';
formState.fileUrl = '';
formState.effectiveTime = null;
formState.expiryTime = null;
fileList.value = [];
}
function buildPayload(): any {
return {
id: formState.id || undefined,
title: formState.title,
summary: formState.summary,
contentType: formState.contentType,
categoryId: formState.categoryId,
applicableScenario: formState.applicableScenario,
tags: formState.tagIdList.join(','),
content: formState.content,
coverImage: formState.coverImage,
fileUrl: JSON.stringify(fileList.value || []),
effectiveTime: formState.effectiveTime,
expiryTime: formState.expiryTime,
};
}
function validate(): boolean {
if (!formState.title) {
createMessage.warning('请输入资源标题');
return false;
}
if (!formState.categoryId) {
createMessage.warning('请选择所属分类');
return false;
}
if (!formState.content) {
createMessage.warning('请输入正文内容');
return false;
}
return true;
}
async function handleSaveDraft() {
if (!formState.title) {
createMessage.warning('请输入资源标题');
return;
}
setModalProps({ confirmLoading: true });
try {
if (formState.id) {
await editApi(buildPayload());
} else {
await addApi(buildPayload());
}
createMessage.success('已保存为草稿');
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
async function handleSubmit() {
if (!validate()) return;
setModalProps({ confirmLoading: true });
try {
const id = formState.id;
if (id) {
await editApi(buildPayload());
await submitForReviewApi({ id });
} else {
const res: any = await addApi(buildPayload());
await submitForReviewApi({ id: res?.id || res });
}
createMessage.success('已提交审核');
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
onMounted(async () => {
categoryOptions.value = (await categoryListAllApi()) || [];
tagOptions.value = (await tagListAllApi()) || [];
});
</script>
<style lang="less" scoped>
.resource-form {
padding: 4px 4px 0;
}
.upload-area {
border: 1px dashed #d9d9d9;
border-radius: 2px;
padding: 24px;
text-align: center;
cursor: pointer;
transition: all 0.2s;
background: #fafafa;
&:hover {
border-color: #1890ff;
background: #e6f7ff;
}
}
.upload-icon {
font-size: 32px;
color: rgba(0, 0, 0, 0.25);
}
.upload-text {
font-size: 14px;
color: rgba(0, 0, 0, 0.65);
margin-top: 8px;
}
.upload-hint {
font-size: 12px;
color: rgba(0, 0, 0, 0.45);
margin-top: 4px;
}
</style>
@@ -0,0 +1,252 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="modalTitle" :width="modalWidth" :minHeight="400" :showOkBtn="false" cancelText="关闭">
<!-- 版本列表视图 -->
<a-spin :spinning="loading" v-if="!diffVisible">
<div class="version-list">
<div v-for="(item, idx) in versions" :key="item.id" class="version-item">
<div class="version-num" :class="{ 'version-old': idx > 0 }">v{{ item.versionNo }}</div>
<div class="version-main">
<div class="version-op">{{ item.changeDescription || item.title }}</div>
<div class="version-meta">
{{ item.createBy }} · {{ item.createTime }}
<a v-if="idx < versions.length - 1" @click="handleDiff(item, idx)">查看差异</a>
<a v-if="idx > 0" @click="handleRollback(item)">回滚</a>
</div>
</div>
</div>
<a-empty v-if="!loading && versions.length === 0" description="暂无版本记录" />
</div>
</a-spin>
<!-- 差异对比视图 -->
<div v-else>
<div class="diff-toolbar">
<a-button size="small" @click="diffVisible = false"> 返回版本列表</a-button>
<span class="diff-toolbar-tip">v{{ diffCurrentVersionNo }} v{{ diffOlderVersionNo }}</span>
</div>
<a-spin :spinning="diffLoading">
<a-row :gutter="16" v-if="diffData">
<a-col :span="12">
<div class="diff-panel diff-old">
<div class="diff-panel-title">
v{{ diffData.version1?.versionNo }} · {{ diffData.version1?.createTime }}
</div>
<div class="diff-panel-sub">{{ diffData.version1?.title }}</div>
<div class="diff-panel-desc">{{ diffData.version1?.changeDescription }}</div>
<div class="diff-panel-body" v-html="diffData.version1?.content || '无内容'"></div>
</div>
</a-col>
<a-col :span="12">
<div class="diff-panel diff-new">
<div class="diff-panel-title">
v{{ diffData.version2?.versionNo }} · {{ diffData.version2?.createTime }}
</div>
<div class="diff-panel-sub">{{ diffData.version2?.title }}</div>
<div class="diff-panel-desc">{{ diffData.version2?.changeDescription }}</div>
<div class="diff-panel-body" v-html="diffData.version2?.content || '无内容'"></div>
</div>
</a-col>
</a-row>
<a-empty v-else description="无差异数据" />
</a-spin>
</div>
</BasicModal>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { versionListApi, versionRollbackApi, versionDiffApi } from '../resource.api';
const { createMessage, createConfirm } = useMessage();
const record = ref<any>({});
const versions = ref<any[]>([]);
const loading = ref(false);
const diffVisible = ref(false);
const diffLoading = ref(false);
const diffData = ref<any>(null);
const diffCurrentVersionNo = ref('');
const diffOlderVersionNo = ref('');
const modalTitle = computed(() => (diffVisible.value ? '版本差异对比' : '版本历史'));
const modalWidth = computed(() => (diffVisible.value ? 900 : 560));
const [registerModal] = useModalInner(async (data) => {
record.value = data?.record || {};
diffVisible.value = false;
await loadVersions();
});
async function loadVersions() {
if (!record.value.id) return;
loading.value = true;
try {
const res = await versionListApi({ resourceId: record.value.id });
versions.value = res || [];
} finally {
loading.value = false;
}
}
async function handleDiff(item: any, idx: number) {
const older = versions.value[idx + 1];
if (!older) {
createMessage.info('无更早版本可对比');
return;
}
diffCurrentVersionNo.value = item.versionNo;
diffOlderVersionNo.value = older.versionNo;
diffVisible.value = true;
diffLoading.value = true;
diffData.value = null;
try {
const res: any = await versionDiffApi({ versionId1: item.id, versionId2: older.id });
// {version1, version2} / [v1, v2] / {old, new}
let v1: any = null;
let v2: any = null;
if (Array.isArray(res)) {
[v1, v2] = res;
} else if (res?.version1 || res?.version2) {
v1 = res.version1;
v2 = res.version2;
} else if (res?.old || res?.new) {
v1 = res.old;
v2 = res.new;
} else if (res?.result) {
const inner = res.result;
if (Array.isArray(inner)) [v1, v2] = inner;
else { v1 = inner.version1 || inner.old; v2 = inner.version2 || inner.new; }
}
diffData.value = { version1: v1, version2: v2 };
} finally {
diffLoading.value = false;
}
}
function handleRollback(item: any) {
createConfirm({
iconType: 'warning',
title: '确认回滚',
content: `是否回滚至 v${item.versionNo}?回滚前会自动保存当前状态为新版本。`,
onOk: async () => {
await versionRollbackApi({ id: item.id });
createMessage.success('已回滚');
await loadVersions();
},
});
}
</script>
<style lang="less" scoped>
.version-list {
padding: 4px 0;
}
.version-item {
display: flex;
gap: 14px;
padding: 12px 0;
border-bottom: 1px solid #f0f0f0;
&:last-child {
border-bottom: none;
}
}
.version-num {
font-size: 12px;
background: #e6f7ff;
color: #1890ff;
padding: 0 7px;
border-radius: 2px;
white-space: nowrap;
border: 1px solid #91d5ff;
line-height: 20px;
height: fit-content;
}
.version-old {
background: #fafafa;
color: rgba(0, 0, 0, 0.45);
border-color: #d9d9d9;
}
.version-main {
flex: 1;
}
.version-op {
font-size: 14px;
color: rgba(0, 0, 0, 0.85);
}
.version-meta {
font-size: 12px;
color: rgba(0, 0, 0, 0.45);
margin-top: 3px;
a {
color: #1890ff;
cursor: pointer;
margin-left: 8px;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
.diff-wrap {
margin-top: 8px;
}
.diff-toolbar {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
padding-bottom: 8px;
border-bottom: 1px solid #f0f0f0;
}
.diff-toolbar-tip {
font-size: 13px;
color: #1890ff;
font-weight: 500;
}
.diff-panel {
border: 1px solid #f0f0f0;
border-radius: 2px;
padding: 12px;
max-height: 500px;
overflow-y: auto;
&.diff-old {
background: #fafafa;
}
&.diff-new {
background: #f6ffed;
border-color: #b7eb8f;
}
}
.diff-panel-title {
font-size: 13px;
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
margin-bottom: 6px;
}
.diff-panel-sub {
font-size: 13px;
color: rgba(0, 0, 0, 0.65);
margin-bottom: 4px;
}
.diff-panel-desc {
font-size: 12px;
color: rgba(0, 0, 0, 0.45);
margin-bottom: 8px;
padding-bottom: 8px;
border-bottom: 1px dashed #e8e8e8;
}
.diff-panel-body {
font-size: 13px;
color: rgba(0, 0, 0, 0.65);
line-height: 1.8;
:deep(img) {
max-width: 100%;
}
}
</style>
+362
View File
@@ -0,0 +1,362 @@
<template>
<BasicTable @register="registerTable" :rowSelection="{ type: 'checkbox', onChange: onSelectChange }">
<template #tableTitle>
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd"> 新增资源 </a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="handleExport"> 导出 </a-button>
<template v-if="selectedRowKeys.length > 0">
<a-button type="primary" preIcon="ant-design:cloud-upload-outlined" @click="handleBatchPublish"> 批量发布 </a-button>
<a-button preIcon="ant-design:cloud-download-outlined" @click="handleBatchOffline"> 批量下架 </a-button>
<a-button danger preIcon="ant-design:delete-outlined" @click="handleBatchDelete"> 批量删除 </a-button>
<span class="batch-tip">已选中 {{ selectedRowKeys.length }} </span>
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'coverImage'">
<div class="cover-box" :style="coverStyle(record)">
<img v-if="record.coverImage" :src="record.coverImage" class="cover-img" />
<span v-else>{{ typeIcon(record.contentType) }}</span>
</div>
</template>
<template v-if="column.dataIndex === 'title'">
<div class="title-cell">
<div class="title-main">{{ record.title }}</div>
<div class="title-sub">{{ record.summary }}</div>
</div>
</template>
<template v-if="column.dataIndex === 'categoryName'">
<a-tag v-if="record.categoryName" color="blue">{{ record.categoryName }}</a-tag>
</template>
<template v-if="column.dataIndex === 'contentType'">
<a-tag :color="typeColor(record.contentType)">{{ typeIcon(record.contentType) }} {{ typeLabel(record.contentType) }}</a-tag>
</template>
<template v-if="column.dataIndex === 'tagNameList'">
<a-tag v-for="tag in (record.tagNameList || [])" :key="tag" color="default">{{ tag }}</a-tag>
</template>
<template v-if="column.dataIndex === 'statusDisplay'">
<a-badge :status="getStatusInfo(record).color" :text="getStatusInfo(record).text" />
</template>
<template v-if="column.dataIndex === 'viewFavorite'">
<span>{{ record.viewCount || 0 }} / {{ record.favoriteCount || 0 }}</span>
</template>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
</BasicTable>
<ResourceFormModal @register="registerFormModal" @success="reload" />
<PreviewModal @register="registerPreviewModal" />
<VersionHistoryModal @register="registerVersionModal" />
</template>
<script setup lang="ts">
import { ref } from 'vue';
import BasicTable from '/@/components/Table/src/BasicTable.vue';
import { TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { useMessage } from '/@/hooks/web/useMessage';
import { useModal } from '/@/components/Modal';
import {
columns,
searchSchema,
CONTENT_TYPE,
STATUS,
AUDIT_STATUS,
getResourceDisplayStatus,
} from './resource.data';
import {
listApi,
deleteApi,
batchDeleteApi,
submitForReviewApi,
takeDownApi,
publishApi,
copyApi,
batchPublishApi,
batchTakeDownApi,
exportXlsApi,
} from './resource.api';
import ResourceFormModal from './components/ResourceFormModal.vue';
import PreviewModal from './components/PreviewModal.vue';
import VersionHistoryModal from './components/VersionHistoryModal.vue';
const { createMessage, createConfirm } = useMessage();
const selectedRowKeys = ref<string[]>([]);
const [registerFormModal, { openModal: openFormModal }] = useModal();
const [registerPreviewModal, { openModal: openPreviewModal }] = useModal();
const [registerVersionModal, { openModal: openVersionModal }] = useModal();
const { tableContext } = useListPage({
tableProps: {
title: '急救宣教资源列表',
api: listApi,
columns,
canResize: false,
showIndexColumn: false,
rowKey: 'id',
formConfig: {
schemas: searchSchema,
autoSubmitOnEnter: true,
showAdvancedButton: false,
},
actionColumn: {
width: 280,
fixed: 'right',
},
afterFetch: (data) => {
data.forEach((item: any) => {
const display = getResourceDisplayStatus(item.status, item.auditStatus);
item.statusDisplay = display;
});
return data;
},
},
});
const [registerTable, { reload, getForm }] = tableContext;
function onSelectChange(keys: string[]) {
selectedRowKeys.value = keys;
}
function coverStyle(record: Recordable) {
const t = CONTENT_TYPE[record.contentType as keyof typeof CONTENT_TYPE];
const bgMap: Record<string, string> = {
IMAGE_TEXT: '#fa8c16',
VIDEO: '#001529',
AUDIO: '#8c8c8c',
PDF: '#434343',
};
return { background: bgMap[record.contentType] || '#001529' };
}
function typeColor(type: string) {
return CONTENT_TYPE[type as keyof typeof CONTENT_TYPE]?.color || 'default';
}
function typeIcon(type: string) {
return CONTENT_TYPE[type as keyof typeof CONTENT_TYPE]?.icon || '';
}
function typeLabel(type: string) {
return CONTENT_TYPE[type as keyof typeof CONTENT_TYPE]?.label || type;
}
function getStatusInfo(record: Recordable) {
return getResourceDisplayStatus(record.status, record.auditStatus);
}
//
const isPublished = (r: Recordable) => r.status === STATUS.PUBLISHED;
const isOffline = (r: Recordable) => r.status === STATUS.OFFLINE;
const isPending = (r: Recordable) => r.auditStatus === AUDIT_STATUS.PENDING;
const isRejected = (r: Recordable) => r.auditStatus === AUDIT_STATUS.REJECTED;
const isDraft = (r: Recordable) => r.status === STATUS.DRAFT && r.auditStatus == null;
function getTableAction(record: Recordable) {
const actions: any[] = [
{
label: '预览',
onClick: () => openPreviewModal(true, { record }),
},
{
label: '编辑',
onClick: () => openFormModal(true, { isUpdate: true, record }),
},
];
if (isPublished(record)) {
actions.push({
label: '下架',
color: 'error',
popConfirm: {
title: `是否下架《${record.title}》?`,
confirm: () => handleOffline(record),
},
});
} else if (isOffline(record)) {
actions.push({
label: '上架',
onClick: () => handlePublish(record),
});
} else if (isPending(record)) {
//
} else if (isRejected(record)) {
actions.push({
label: '提交审核',
onClick: () => handleSubmitReview(record),
});
} else if (isDraft(record)) {
actions.push({
label: '提交审核',
onClick: () => handleSubmitReview(record),
});
actions.push({
label: '删除',
color: 'error',
popConfirm: {
title: `是否删除《${record.title}》?`,
confirm: () => handleDelete(record),
},
});
} else if (record.status === STATUS.DRAFT && record.auditStatus === AUDIT_STATUS.PASSED) {
// 稿退稿
actions.push({
label: '提交审核',
onClick: () => handleSubmitReview(record),
});
}
return actions;
}
function getDropDownAction(record: Recordable) {
const dropdown: any[] = [
{
label: '版本历史',
onClick: () => openVersionModal(true, { record }),
},
];
// 稿
if (!isDraft(record)) {
dropdown.push({
label: '复制',
onClick: () => handleCopy(record),
});
}
//
if (isRejected(record) || isOffline(record)) {
dropdown.push({
label: '删除',
color: 'error',
popConfirm: {
title: `是否删除《${record.title}》?`,
confirm: () => handleDelete(record),
},
});
}
return dropdown;
}
function handleAdd() {
openFormModal(true, { isUpdate: false });
}
async function handleExport() {
const formValues = getForm().getFieldsValue() || {};
const params: any = {
title: formValues.title || undefined,
categoryId: formValues.categoryId || undefined,
contentType: formValues.contentType || undefined,
// combinedStatus status/auditStatus9 status10 auditStatus
status: formValues.combinedStatus != null && formValues.combinedStatus <= 9 ? formValues.combinedStatus : undefined,
auditStatus: formValues.combinedStatus != null && formValues.combinedStatus >= 10 ? formValues.combinedStatus : undefined,
//
selections: selectedRowKeys.value.length > 0 ? selectedRowKeys.value.join(',') : undefined,
};
Object.keys(params).forEach((k) => params[k] === undefined && delete params[k]);
await exportXlsApi(params);
createMessage.success('导出成功');
}
async function handleOffline(record: Recordable) {
await takeDownApi({ id: record.id });
createMessage.success('已下架');
reload();
}
async function handlePublish(record: Recordable) {
await publishApi({ id: record.id });
createMessage.success('已上架');
reload();
}
async function handleSubmitReview(record: Recordable) {
await submitForReviewApi({ id: record.id });
createMessage.success('已提交审核');
reload();
}
async function handleCopy(record: Recordable) {
await copyApi({ id: record.id });
createMessage.success('已复制为草稿');
reload();
}
function handleDelete(record: Recordable) {
deleteApi({ id: record.id }, () => {
createMessage.success('已删除');
reload();
});
}
function handleBatchPublish() {
createConfirm({
iconType: 'info',
title: '批量发布',
content: `是否发布选中的 ${selectedRowKeys.value.length} 条资源?`,
onOk: async () => {
await batchPublishApi(selectedRowKeys.value);
createMessage.success('批量发布成功');
selectedRowKeys.value = [];
reload();
},
});
}
function handleBatchOffline() {
createConfirm({
iconType: 'warning',
title: '批量下架',
content: `是否下架选中的 ${selectedRowKeys.value.length} 条资源?`,
onOk: async () => {
await batchTakeDownApi(selectedRowKeys.value);
createMessage.success('批量下架成功');
selectedRowKeys.value = [];
reload();
},
});
}
function handleBatchDelete() {
batchDeleteApi(selectedRowKeys.value, () => {
createMessage.success('已批量删除');
selectedRowKeys.value = [];
reload();
});
}
</script>
<style lang="less" scoped>
.batch-tip {
margin-left: 8px;
color: #1890ff;
font-size: 13px;
}
.cover-box {
width: 50px;
height: 36px;
border-radius: 2px;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
margin: 0 auto;
overflow: hidden;
}
.cover-img {
width: 100%;
height: 100%;
object-fit: cover;
}
.title-cell {
.title-main {
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
}
.title-sub {
font-size: 11px;
color: #999;
margin-top: 2px;
}
}
</style>
+83
View File
@@ -0,0 +1,83 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { downloadFile } from '/@/api/common/api';
const { createConfirm } = useMessage();
enum Api {
// 资源 CRUD
list = '/health-emergency/emergency/firstAid/resource/list',
queryById = '/health-emergency/emergency/firstAid/resource/queryById',
add = '/health-emergency/emergency/firstAid/resource/add',
edit = '/health-emergency/emergency/firstAid/resource/edit',
delete = '/health-emergency/emergency/firstAid/resource/delete',
deleteBatch = '/health-emergency/emergency/firstAid/resource/deleteBatch',
submitForReview = '/health-emergency/emergency/firstAid/resource/submitForReview',
takeDown = '/health-emergency/emergency/firstAid/resource/takeDown',
publish = '/health-emergency/emergency/firstAid/resource/publish',
batchTakeDown = '/health-emergency/emergency/firstAid/resource/batchTakeDown',
batchPublish = '/health-emergency/emergency/firstAid/resource/batchPublish',
incrementView = '/health-emergency/emergency/firstAid/resource/incrementView',
copy = '/health-emergency/emergency/firstAid/resource/copy',
exportXls = '/health-emergency/emergency/firstAid/resource/exportXls',
// 版本
versionList = '/health-emergency/emergency/firstAid/version/list',
versionRollback = '/health-emergency/emergency/firstAid/version/rollback',
versionDiff = '/health-emergency/emergency/firstAid/version/diff',
// 分类 & 标签(下拉用)
categoryListAll = '/health-emergency/emergency/firstAid/category/listAll',
tagListAll = '/health-emergency/emergency/firstAid/tag/listAll',
}
export const listApi = (params: any) => defHttp.get({ url: Api.list, params });
export const queryByIdApi = (params: any) => defHttp.get({ url: Api.queryById, params });
export const addApi = (params: any) => defHttp.post({ url: Api.add, params }, { successNeedMessage: false });
export const editApi = (params: any) => defHttp.post({ url: Api.edit, params }, { successNeedMessage: false });
export const submitForReviewApi = (params: any) => defHttp.post({ url: Api.submitForReview, params }, { successNeedMessage: false });
export const takeDownApi = (params: any) => defHttp.post({ url: Api.takeDown, params }, { successNeedMessage: false });
export const publishApi = (params: any) => defHttp.post({ url: Api.publish, params }, { successNeedMessage: false });
export const batchTakeDownApi = (params: any) => defHttp.post({ url: Api.batchTakeDown, params }, { successNeedMessage: false });
export const batchPublishApi = (params: any) => defHttp.post({ url: Api.batchPublish, params }, { successNeedMessage: false });
export const incrementViewApi = (params: any) => defHttp.post({ url: Api.incrementView, params });
export const copyApi = (params: any) => defHttp.post({ url: Api.copy, params }, { successNeedMessage: false });
/**
* Excel
* selectionsID+
*/
export const exportXlsApi = (params: any) => {
return downloadFile(Api.exportXls, '急救宣教资源报表.xls', params);
};
export const versionListApi = (params: any) => defHttp.get({ url: Api.versionList, params });
export const versionRollbackApi = (params: any) => defHttp.post({ url: Api.versionRollback, params }, { successNeedMessage: false });
export const versionDiffApi = (params: any) => defHttp.get({ url: Api.versionDiff, params });
export const categoryListAllApi = (params?: any) => defHttp.get({ url: Api.categoryListAll, params });
export const tagListAllApi = (params?: any) => defHttp.get({ url: Api.tagListAll, params });
export const deleteApi = (params: any, handleSuccess: any) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否将选中资源移入回收站?',
okText: '确认',
cancelText: '取消',
onOk: async () => {
await defHttp.post({ url: Api.delete, params }, { successNeedMessage: false });
handleSuccess();
},
});
};
export const batchDeleteApi = (params: any, handleSuccess: any) => {
createConfirm({
iconType: 'warning',
title: '批量删除',
content: `是否将选中的 ${params?.length || 0} 条资源移入回收站?`,
okText: '确认',
cancelText: '取消',
onOk: async () => {
await defHttp.post({ url: Api.deleteBatch, params }, { successNeedMessage: false });
handleSuccess();
},
});
};
+166
View File
@@ -0,0 +1,166 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
// 发布状态
export const STATUS = {
DRAFT: 0,
PUBLISHED: 1,
OFFLINE: 2,
};
// 审核状态
export const AUDIT_STATUS = {
PENDING: 10,
PASSED: 11,
REJECTED: 12,
};
// 复合状态(搜索用)
export const COMBINED_STATUS = {
DRAFT: '0',
PUBLISHED: '1',
OFFLINE: '2',
PENDING: '10',
PASSED: '11',
REJECTED: '12',
};
// 内容类型
export const CONTENT_TYPE = {
IMAGE_TEXT: { label: '图文', color: 'orange', icon: '📄' },
VIDEO: { label: '视频', color: 'purple', icon: '🎬' },
AUDIO: { label: '音频', color: 'green', icon: '🎧' },
PDF: { label: 'PDF', color: 'red', icon: '📑' },
};
// 根据发布状态+审核状态返回展示信息
export function getResourceDisplayStatus(status: number, auditStatus: number | null) {
if (status === STATUS.PUBLISHED) return { text: '已发布', color: 'success' };
if (status === STATUS.OFFLINE) return { text: '已下架', color: 'error' };
if (auditStatus === AUDIT_STATUS.PENDING) return { text: '待审核', color: 'warning' };
if (auditStatus === AUDIT_STATUS.REJECTED) return { text: '已驳回', color: 'error' };
return { text: '草稿', color: 'default' };
}
// 内容类型选项
export const TYPE_OPTIONS = [
{ label: '图文', value: 'IMAGE_TEXT' },
{ label: '视频', value: 'VIDEO' },
{ label: '音频', value: 'AUDIO' },
{ label: 'PDF', value: 'PDF' },
];
// 复合状态选项
export const STATUS_OPTIONS = [
{ label: '草稿', value: '0' },
{ label: '已发布', value: '1' },
{ label: '已下架', value: '2' },
{ label: '待审核', value: '10' },
{ label: '已通过', value: '11' },
{ label: '已驳回', value: '12' },
];
// 适用场景
export const SCENE_OPTIONS = [
{ label: '油田现场', value: '油田现场' },
{ label: '日常生活', value: '日常生活' },
{ label: '高原环境', value: '高原环境' },
{ label: '高温环境', value: '高温环境' },
];
// 表格列定义
export const columns: BasicColumn[] = [
{
title: '封面',
dataIndex: 'coverImage',
width: 80,
align: 'center',
},
{
title: '标题',
dataIndex: 'title',
align: 'left',
},
{
title: '分类',
dataIndex: 'categoryName',
width: 100,
align: 'center',
},
{
title: '类型',
dataIndex: 'contentType',
width: 90,
align: 'center',
},
{
title: '标签',
dataIndex: 'tagNameList',
width: 160,
align: 'left',
},
{
title: '状态',
dataIndex: 'statusDisplay',
width: 100,
align: 'center',
},
{
title: '阅读/收藏',
dataIndex: 'viewFavorite',
width: 110,
align: 'center',
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 170,
align: 'center',
},
];
// 搜索表单
export const searchSchema: FormSchema[] = [
{
field: 'title',
label: '标题',
component: 'Input',
componentProps: {
placeholder: '搜索标题',
},
colProps: { span: 6 },
},
{
field: 'categoryId',
label: '分类',
component: 'ApiSelect',
componentProps: {
api: () => import('./resource.api').then((m) => m.categoryListAllApi()),
labelField: 'name',
valueField: 'id',
placeholder: '全部分类',
},
colProps: { span: 6 },
},
{
field: 'combinedStatus',
label: '状态',
component: 'Select',
componentProps: {
options: STATUS_OPTIONS,
placeholder: '全部状态',
allowClear: true,
},
colProps: { span: 6 },
},
{
field: 'contentType',
label: '类型',
component: 'Select',
componentProps: {
options: TYPE_OPTIONS,
placeholder: '全部类型',
allowClear: true,
},
colProps: { span: 6 },
},
];
+1 -1
View File
@@ -73,7 +73,7 @@ export const formSchema: FormSchema[] = [
dynamicDisabled: ({ values }) => { dynamicDisabled: ({ values }) => {
return !!values.id; return !!values.id;
}, },
dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('sys_dict', 'dict_code', model, schema, true), dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('QH_SYS_DICT', 'dict_code', model, schema, true),
}, },
{ {
label: '描述', label: '描述',
@@ -77,7 +77,7 @@ export const formSchemas: FormSchema[] = [
field: 'templateCode', field: 'templateCode',
component: 'Input', component: 'Input',
dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
return [...rules.duplicateCheckRule('sys_sms_template', 'template_code', model, schema, true)]; return [...rules.duplicateCheckRule('QH_SYS_SMS_TEMPLATE', 'template_code', model, schema, true)];
}, },
// 编辑模式下不可修改编码 // 编辑模式下不可修改编码
dynamicDisabled: (params) => !!params.values.id, dynamicDisabled: (params) => !!params.values.id,
@@ -74,6 +74,8 @@ export const searchFormSchema: FormSchema[] = [
}, },
]; ];
//表单数据 //表单数据
// @ts-ignore
// @ts-ignore
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
{ {
label: '序号', label: '序号',
@@ -91,6 +93,10 @@ export const formSchema: FormSchema[] = [
label: '图片', label: '图片',
field: 'photoUrl', field: 'photoUrl',
component: 'JImageUpload', component: 'JImageUpload',
componentProps: {
bizPath: 'img',
maxCount: 1,
},
rules: [{ required: true, message: '请上传图片' }], rules: [{ required: true, message: '请上传图片' }],
}, },
{ {
@@ -85,6 +85,13 @@ export const columns: BasicColumn[] = [
dataIndex: ['departTree', '3'], dataIndex: ['departTree', '3'],
width: 180, width: 180,
}, },
{
title: '非关爱人员',
align: 'center',
dataIndex: ['extension', 'nonCareFlag'],
width: 100,
slots: { customRender: 'nonCareTag' },
},
{ {
title: '出生日期', title: '出生日期',
align: 'center', align: 'center',
@@ -160,6 +167,17 @@ export const searchFormSchema: FormSchema[] = [
field: 'phone', field: 'phone',
component: 'Input', component: 'Input',
}, },
{
label: '非关爱人员',
field: 'nonCareFlag',
component: 'Select',
componentProps: {
options: [
{ label: '否', value: 0 },
{ label: '是', value: 1 },
],
},
},
{ {
label: '单位名称', label: '单位名称',
field: 'orgCode', field: 'orgCode',
@@ -311,7 +329,7 @@ export const formSchema: (isUpdate: boolean) => FormSchema[] = (isUpdate) => {
}; };
}, },
dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
let rule = rules.duplicateCheckRuleAndDelFlag('health_user_employee_ex', 'emp_sysno', 'false', model, schema, false); let rule = rules.duplicateCheckRuleAndDelFlag('QH_HLT_USER_EMPLOYEE_EX', 'EMP_SYSNO', 'false', model, schema, false);
rule[0] = { ...rule[0], required: false }; rule[0] = { ...rule[0], required: false };
return rule; return rule;
}, },
@@ -330,6 +348,8 @@ export const formSchema: (isUpdate: boolean) => FormSchema[] = (isUpdate) => {
field: 'avatar', field: 'avatar',
component: 'JImageUpload', component: 'JImageUpload',
componentProps: { componentProps: {
text: '上传头像',
bizPath: 'avatar',
maxCount: 1, maxCount: 1,
}, },
}, },
@@ -674,28 +694,44 @@ export const formSchema: (isUpdate: boolean) => FormSchema[] = (isUpdate) => {
label: '关爱联络员姓名', label: '关爱联络员姓名',
field: 'careLiaisonName', field: 'careLiaisonName',
component: 'Input', component: 'Input',
show: false,
}, },
{ {
label: '关爱联络员职务', label: '关爱联络员职务',
field: 'careLiaisonJob', field: 'careLiaisonJob',
component: 'Input', component: 'Input',
show: false,
}, },
{ {
label: '关爱联络员电话', label: '关爱联络员电话',
field: 'careLiaisonPhone', field: 'careLiaisonPhone',
component: 'Input', component: 'Input',
rules: [{ required: false, pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' }], // rules: [{ required: false, pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' }],
show: false,
}, },
{ {
label: '急救人员姓名', label: '急救人员姓名',
field: 'lifeguardName', field: 'lifeguardName',
component: 'Input', component: 'Input',
show: false,
}, },
{ {
label: '急救人员电话', label: '急救人员电话',
field: 'lifeguardPhone', field: 'lifeguardPhone',
component: 'Input', component: 'Input',
rules: [{ required: false, pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' }], // rules: [{ required: false, pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' }],
show: false,
},
{
label: '非关爱人员',
field: 'nonCareFlag',
component: 'RadioButtonGroup',
componentProps: {
options: [
{ label: '否', value: 0 },
{ label: '是', value: 1 },
],
},
}, },
{ {
label: '', label: '',
@@ -109,6 +109,10 @@
{{ record.status_dictText }} {{ record.status_dictText }}
</Tag> </Tag>
</template> </template>
<template #nonCareTag="{ record }">
<Tag v-if="record.extension?.nonCareFlag === 1" color="orange"></Tag>
<Tag v-else-if="record.extension?.nonCareFlag === 0" color="blue"></Tag>
</template>
</BasicTable> </BasicTable>
<!-- 表单区域 --> <!-- 表单区域 -->
<HealthUserEmployeeExDrawer :showFooter="showFooter" @register="registerDrawer" @success="handleSuccess" /> <HealthUserEmployeeExDrawer :showFooter="showFooter" @register="registerDrawer" @success="handleSuccess" />
@@ -207,6 +207,8 @@ export const formSchema: FormSchema[] = [
label: '头像', label: '头像',
component: 'JImageUpload', component: 'JImageUpload',
componentProps: { componentProps: {
text: '上传头像',
bizPath: 'avatar',
maxCount: 1, maxCount: 1,
}, },
}, },
@@ -141,6 +141,8 @@ export const formSchema = function (showGoodAt: boolean): FormSchema[] {
component: 'JImageUpload', component: 'JImageUpload',
required: true, required: true,
componentProps: () => ({ componentProps: () => ({
text: '上传头像',
bizPath: 'avatar',
maxCount: 1, maxCount: 1,
}), }),
}, },
+4 -4
View File
@@ -219,7 +219,7 @@ export const formSchema: FormSchema[] = [
}, },
dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
if (model.id) { if (model.id) {
return rules.duplicateCheckRule('sys_user', 'username', model, schema, true); return rules.duplicateCheckRule('QH_SYS_USER', 'username', model, schema, true);
} else { } else {
return Promise.resolve(); return Promise.resolve();
} }
@@ -266,7 +266,7 @@ export const formSchema: FormSchema[] = [
field: 'workNo', field: 'workNo',
required: true, required: true,
component: 'Input', component: 'Input',
dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('sys_user', 'work_no', model, schema, true), dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('QH_SYS_USER', 'work_no', model, schema, true),
}, },
{ {
label: '职务', label: '职务',
@@ -379,7 +379,7 @@ export const formSchema: FormSchema[] = [
field: 'email', field: 'email',
component: 'Input', component: 'Input',
dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
return [{ ...rules.duplicateCheckRule('sys_user', 'email', model, schema, true)[0] }, { ...rules.rule('email', false)[0] }]; return [{ ...rules.duplicateCheckRule('QH_SYS_USER', 'email', model, schema, true)[0] }, { ...rules.rule('email', false)[0] }];
}, },
}, },
{ {
@@ -388,7 +388,7 @@ export const formSchema: FormSchema[] = [
component: 'Input', component: 'Input',
dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
return [ return [
{ ...rules.duplicateCheckRule('sys_user', 'phone', model, schema, true)[0] }, { ...rules.duplicateCheckRule('QH_SYS_USER', 'phone', model, schema, true)[0] },
{ pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误' }, { pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误' },
]; ];
}, },
@@ -35,7 +35,7 @@
const validatorRules: Record<string, Rule[]> = { const validatorRules: Record<string, Rule[]> = {
email: [ email: [
{ ...rules.duplicateCheckRule('sys_user', 'email', formState, { label: '邮箱' })[0] }, { ...rules.duplicateCheckRule('QH_SYS_USER', 'email', formState, { label: '邮箱' })[0] },
{ required: true, type: 'email', message: '邮箱格式不正确' }, { required: true, type: 'email', message: '邮箱格式不正确' },
], ],
}; };
@@ -40,7 +40,7 @@
const validatorRules: Record<string, Rule[]> = { const validatorRules: Record<string, Rule[]> = {
phone: [ phone: [
{ ...rules.duplicateCheckRule('sys_user', 'phone', formState, { label: '手机号' })[0] }, { ...rules.duplicateCheckRule('QH_SYS_USER', 'phone', formState, { label: '手机号' })[0] },
{ pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误' }, { pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误' },
], ],
smscode: [{ required: true, message: '请输入验证码' }], smscode: [{ required: true, message: '请输入验证码' }],
@@ -154,6 +154,7 @@ export const itemFormSchema: FormSchema[] = [
component: 'JUpload', component: 'JUpload',
componentProps: () => { componentProps: () => {
return { return {
bizPath: 'appfile',
maxCount: 1, maxCount: 1,
}; };
}, },