169 Commits

Author SHA1 Message Date
guanj
1abd7dbc45 Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2026-07-21 15:10:58 +08:00
guanj
472babe0ce 修改全局悬浮框添加最大高度 2026-07-21 15:10:48 +08:00
8054b44e88 适配辽宁现场调整 2026-07-21 10:45:50 +08:00
guanj
5eb5a01b50 调整电网一张图污染水平评估 2026-07-20 10:04:02 +08:00
guanj
e77c57f8d0 修改辽宁测试问题 2026-07-20 09:30:48 +08:00
guanj
22011188a1 修改辽宁全景展示 2026-07-17 16:13:49 +08:00
guanj
c72ba3e5db 添加一类监测点字段 2026-07-17 11:27:40 +08:00
guanj
7f1c3e31c0 监测点评估添加字段 2026-07-17 11:17:38 +08:00
guanj
6c70a776a0 列设置添加缓存
调整监测点台账导出id重复问题
2026-07-17 08:50:25 +08:00
guanj
dc3b3cfc74 全局下拉框添加filterable属性 2026-07-15 09:21:35 +08:00
guanj
04c5eb7185 调整退出问题 2026-07-14 14:49:10 +08:00
guanj
d0d62ab0af 修改菜单树无法展开问题 2026-07-14 14:39:59 +08:00
guanj
b3d671a93e 调整前端两套互不连通的 HTTP 请求层并存、两套布局框架并存、两套 Pinia 实例并存问题 2026-07-10 14:52:29 +08:00
guanj
888b8d1bf4 修改点击列问题 2026-07-10 08:57:37 +08:00
guanj
ee9cd057b8 优化菜单切换导致浏览器刷新问题 2026-07-09 15:40:56 +08:00
guanj
8bca4191f2 调整代码 2026-07-09 15:26:01 +08:00
guanj
69e6a1f93f 调整 2026-07-09 14:41:56 +08:00
guanj
71df1ac4be 修改冲突 2026-07-09 13:59:02 +08:00
guanj
cd2be0f4aa Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx
# Conflicts:
#	src/views/pqs/business/terminal/terminaCkeck/index.vue
2026-07-09 13:57:58 +08:00
guanj
855c569535 全局表格添加列配置功能 2026-07-09 13:54:18 +08:00
6a84d28101 添加辽宁周期检测功能 2026-07-09 11:41:01 +08:00
guanj
1a69be62a0 修改监测点信息 2026-07-09 11:08:56 +08:00
guanj
02caca969e 修改用户性质 2026-07-09 10:33:22 +08:00
guanj
3f1af5e4cc 监测点信息添加终端型号 2026-07-08 16:08:02 +08:00
guanj
88e9812d5f 联调周期监测 2026-07-08 14:37:19 +08:00
guanj
83a827ba5b 修改文件上传问题 2026-07-08 11:14:32 +08:00
40b1092718 添加周期 2026-07-08 09:21:59 +08:00
guanj
83a1128884 用户管理添加监测报告,评估报告 2026-07-07 13:52:53 +08:00
1a44a2f9e0 添加周期 2026-07-07 10:18:22 +08:00
guanj
5044c88946 优化全景展示页面 2026-07-07 10:15:33 +08:00
guanj
51a862ed00 修改进程显示 2026-07-06 10:58:02 +08:00
guanj
1ca8e536dd 修改限值显示问题 2026-07-06 10:41:33 +08:00
guanj
2445cfbff3 修改辽宁全景展示问题 2026-07-06 10:12:51 +08:00
guanj
21ac0611cd 修改地图api 2026-06-29 14:41:12 +08:00
guanj
ff841cfa93 修改Socket路径问题 2026-06-26 10:17:43 +08:00
guanj
01cc29c8b2 修改电网一张图 2026-06-24 09:57:48 +08:00
guanj
a324f7afcf 修改算法库拖动问题 2026-06-23 21:36:43 +08:00
guanj
4272f7756e 修改配置 2026-06-23 21:28:35 +08:00
guanj
070e404bbb 修改辽宁反馈问题 2026-06-23 21:27:15 +08:00
ed60e2b7f3 台账新增修改添加objName 2026-06-23 16:09:41 +08:00
7785d4f708 台账新增修改添加objName 2026-06-23 15:12:58 +08:00
0c64711dd8 辽宁页面调整 2026-06-22 15:50:31 +08:00
guanj
d85dba8bf8 修改补召 2026-06-16 09:56:38 +08:00
guanj
56b8158f4a 优化波形 2026-06-16 08:36:22 +08:00
cdf
765507398e 辽宁单点登录 2026-06-15 17:57:14 +08:00
cdf
9224ea17b8 区域报告调整 2026-06-07 15:56:31 +08:00
cdf
dc08f7d1ac 辽宁统一认证登录 2026-06-03 17:41:37 +08:00
cdf
1652b5faf8 辽宁统一认证登录 2026-06-03 15:54:15 +08:00
guanj
fae2a7d735 修改辽宁嵌入 2026-06-02 16:33:08 +08:00
guanj
bf3a99cbf3 提交代码 2026-06-02 16:30:29 +08:00
guanj
2e7c0b7f44 修改辽宁免登录 2026-06-02 09:30:10 +08:00
guanj
98e0f9de02 修改关键字 2026-05-28 19:28:12 +08:00
guanj
21756e05d4 修改地图 2026-05-27 10:47:31 +08:00
guanj
abfdf29a38 修改页面样式 调整查询条件 2026-05-22 09:58:07 +08:00
guanj
120892808b 提交代码 2026-04-25 15:21:53 +08:00
guanj
0f5cb1d3c5 提交代码 2026-04-09 11:44:06 +08:00
cdf
dbaa42ff7e 通用台账查询页面调整 2026-04-09 11:42:54 +08:00
guanj
48472bdb85 微调 2026-04-03 14:48:10 +08:00
guanj
fafc5f82c4 修改itic点击波形图 2026-03-26 14:53:34 +08:00
cdf
93ee7e4034 通用台账查询页面调整 2026-03-23 09:19:43 +08:00
guanj
7d2ce51510 修改问题 2026-03-17 08:43:51 +08:00
guanj
9202da17f1 微调 2026-03-05 15:42:15 +08:00
guanj
30eddd0572 修改用户台账管理接口 2026-03-05 11:08:36 +08:00
sjl
15bd1ac6d2 事件报告导出 2026-03-02 15:35:29 +08:00
sjl
f5c76c1b7a 报告模版配置 2026-02-27 14:46:19 +08:00
sjl
b25515b5db 系统相关配置 2026-02-27 08:49:57 +08:00
guanj
bfa061fb03 冀北数据总览添加导出功能 2026-02-06 14:45:15 +08:00
sjl
15e3d4aec8 微调 2026-02-06 10:10:24 +08:00
sjl
59489aaafa 微调 2026-01-30 15:01:19 +08:00
guanj
5d0421dd40 Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2026-01-29 14:10:32 +08:00
guanj
6d7ef7cf5d 修改终端型号 2026-01-29 14:10:18 +08:00
sjl
8d9ccf97a7 前置管理分配终端 2026-01-29 13:44:12 +08:00
sjl
7188e3e681 微调 2026-01-28 14:33:42 +08:00
sjl
a9fc77eb8b 区域概览未关联暂降次数和已关联处理事件合并 2026-01-28 10:33:59 +08:00
sjl
87af11288d 微调 2026-01-28 08:45:38 +08:00
sjl
0763187744 前置管理重启,稳态统计报表重置 2026-01-23 13:46:00 +08:00
sjl
ae641604ba 区域概览表格sarfi9总计 2026-01-23 09:20:57 +08:00
sjl
564e6ef4ab Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx
# Conflicts:
#	src/views/pqs/voltageSags/Region/components/echart.vue
2026-01-23 09:07:11 +08:00
sjl
c84c5dae3b 微调 2026-01-23 09:04:08 +08:00
guanj
c902dabb73 微调 2026-01-23 09:03:37 +08:00
guanj
8d1497032f Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2026-01-23 08:51:12 +08:00
guanj
6aeac753ef 修改触发类型 2026-01-23 08:51:03 +08:00
sjl
56d65a6c17 9000系统测试用例调整 2026-01-22 16:15:33 +08:00
sjl
8b356c87a3 微调 2026-01-20 14:33:06 +08:00
guanj
c0feeaee7b 删除海南备份技术监督 2026-01-20 14:25:24 +08:00
guanj
6a112c8ae2 修改表格操作列 2026-01-20 14:18:41 +08:00
guanj
a19952b771 调整云南曲靖问题 2026-01-16 14:03:40 +08:00
guanj
0b76347853 Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2026-01-12 14:49:30 +08:00
guanj
379951699d 修改日志 2026-01-12 14:49:21 +08:00
sjl
003737cf52 Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2026-01-12 14:02:06 +08:00
sjl
20e6d3719a 微调 2026-01-12 14:01:43 +08:00
guanj
77617412dd Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx
# Conflicts:
#	src/views/pqs/voltageSags/monitoringPoint/online/navigation/index.vue
修改冲突
2026-01-12 14:01:09 +08:00
guanj
68ea43c42b 修改在线监测数据问题 2026-01-12 13:56:49 +08:00
sjl
e65df4daad Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx
# Conflicts:
#	src/views/pqs/voltageSags/monitoringPoint/online/navigation/index.vue
2026-01-12 11:24:34 +08:00
sjl
136248eec2 角色用户管理,区域概览 2026-01-12 11:22:42 +08:00
guanj
bfafb6dc5b 修改曲靖问题 2026-01-12 11:19:05 +08:00
sjl
0b91027da4 微调 2026-01-09 11:21:07 +08:00
guanj
22aeb0bf4c Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2026-01-09 11:20:10 +08:00
guanj
87bc9d9017 添加绑定监测点筛选 2026-01-09 11:20:02 +08:00
sjl
43d4d37cd0 Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2026-01-09 10:45:07 +08:00
sjl
ad1528e53b 导出日志 2026-01-09 10:44:35 +08:00
guanj
c1e36440e7 修改实时数据 2026-01-09 10:40:55 +08:00
guanj
16f5213d7a Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2026-01-09 08:47:18 +08:00
guanj
ab891e6125 修改角色管理页面 2026-01-09 08:47:07 +08:00
sjl
36c8ab87a2 微调 2026-01-08 15:17:19 +08:00
guanj
6c3037f19b 修改云南曲靖项目 2026-01-08 14:52:01 +08:00
sjl
54517c0d5f 稳态合格率,畸变率表格调整 2026-01-08 14:50:29 +08:00
guanj
715cdb892f 修改树 2026-01-07 08:38:45 +08:00
sjl
953b96fe05 Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx
# Conflicts:
#	src/components/tree/pqs/bearingTree.vue
#	src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaizhibiaohegelv/index.vue
2026-01-06 08:38:11 +08:00
sjl
cb19fef4c6 微调 2026-01-06 08:35:36 +08:00
guanj
98c887b79d 添加云南曲靖打包命令修改5层树逻辑 2026-01-05 10:13:53 +08:00
guanj
fd09e24cf0 Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2026-01-04 09:01:56 +08:00
guanj
2a11891988 正则替换[] 2026-01-04 09:01:32 +08:00
sjl
e7d90c3a73 微调 2026-01-04 08:39:17 +08:00
sjl
72b1f39814 预告警单 2025-12-31 08:36:14 +08:00
sjl
38028b5cb0 预告警查看报告 2025-12-30 10:16:56 +08:00
sjl
409999b37b Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx
# Conflicts:
#	src/components/PreviewFile/index.vue
2025-12-30 10:05:00 +08:00
sjl
0fc7b528d4 微调 2025-12-30 10:02:01 +08:00
guanj
06764c073a 修改算法库 2025-12-29 20:46:24 +08:00
guanj
26ff8087c6 修改冀北现场问题 2025-12-29 19:44:17 +08:00
sjl
83e57c92b4 区域,海南不调getLastData 2025-12-26 11:16:48 +08:00
sjl
a9245abb5c 稳态数据分析趋势图值显示 2025-12-25 18:56:57 +08:00
sjl
7a7c584217 微调 2025-12-25 18:21:25 +08:00
sjl
bf3d033f39 预览小眼睛放开 2025-12-25 15:11:52 +08:00
guanj
42ce7aec5a Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2025-12-25 13:19:37 +08:00
guanj
17589e30da 修改文件预览 2025-12-25 13:19:24 +08:00
sjl
eb38fdd601 稳态数据调整 2025-12-25 13:17:49 +08:00
sjl
454d612a32 完整性图表 2025-12-24 16:06:03 +08:00
sjl
4dde761784 暂态事件列表调整 2025-12-24 13:17:49 +08:00
GGJ
5f4f75d9dd 修改稳态告警统计,异常数据清洗详情 2025-12-24 11:22:57 +08:00
sjl
cf7e5fa991 数据完整性图表显示 2025-12-24 11:19:41 +08:00
sjl
4f0dc512e2 Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2025-12-24 10:42:23 +08:00
sjl
a77b153ac8 微调 2025-12-24 10:42:17 +08:00
sjl
dbb6a9f72b 修改部分预览,数据完整性,暂态列表等bug调整 2025-12-24 10:41:04 +08:00
GGJ
9567fe1295 添加海南打包命令 2025-12-24 10:38:27 +08:00
sjl
a52021572a 解决下载路径为空 2025-12-22 15:13:43 +08:00
GGJ
d69a6e1e5d Merge branch 'master' of http://pqmcc.com:3000/Web/admin-sjzx
# Conflicts:
#	src/views/pqs/supervise/technology/feedbackPopup.vue
2025-12-19 14:08:17 +08:00
GGJ
a67535abbf 修改打包报错 2025-12-19 14:05:56 +08:00
sjl
dffc735edb 待办任务提交审核返回刷新 2025-12-19 13:27:18 +08:00
sjl
38806367b4 Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2025-12-19 13:12:46 +08:00
sjl
6f770aa91d 修改文件查看只有冀北可行 2025-12-19 13:12:38 +08:00
GGJ
dc32cc3bb7 修改冀北现场反馈问题 2025-12-19 11:58:26 +08:00
sjl
d64d18f330 微调 2025-12-19 10:56:30 +08:00
sjl
909f43e257 电能质量异常管理,谐波测试计划管理bug修改 2025-12-18 16:09:44 +08:00
GGJ
92aa66436e 修改冀北现场问题 2025-12-17 09:22:19 +08:00
GGJ
264f33302f 修改冀北问题 2025-12-16 13:38:12 +08:00
sjl
7b9f5302d0 流程图时间和结果,流程审核表单默认勾选 2025-12-16 11:15:27 +08:00
sjl
72d836020b 编辑打开时,干扰源类型决定类别 2025-12-15 17:41:49 +08:00
sjl
67efef738a 干扰源接入,终端检测,台账管理bug修复 2025-12-15 16:19:33 +08:00
GGJ
6918611d06 添加上传全局提示 2025-12-15 10:35:34 +08:00
GGJ
9f5b2ecc46 修改冀北现场反馈问题 2025-12-15 09:33:34 +08:00
sjl
d30b8247cf 微调 2025-12-15 09:24:25 +08:00
GGJ
0b61c4b7ba 修改冀北现场问题 2025-12-14 12:47:53 +08:00
sjl
ff2b9db7b8 我的任务,干扰源分析,常态化干扰源用户管理,终端检测,bug调整 2025-12-12 15:44:56 +08:00
sjl
289900f9ff Merge branch 'master' of http://192.168.1.22:3000/Web/admin-sjzx 2025-12-12 09:29:16 +08:00
sjl
e87d05c587 微调 2025-12-12 09:29:09 +08:00
GGJ
46c55d48ec 修改冀北现场问题 2025-12-12 09:26:56 +08:00
GGJ
b36f765d07 修改技术监督 2025-12-11 15:03:11 +08:00
guanj
0fe2d2b911 修改冀北问题 2025-12-09 20:04:55 +08:00
guanj
8c41a8fc77 冀北问题修改 2025-12-08 16:28:34 +08:00
guanj
c779bec0cb 调整现场部署报错问题 2025-12-02 15:23:56 +08:00
guanj
5443996fa9 微调 2025-12-01 13:21:24 +08:00
guanj
dac950c4c1 修改冀北页面 2025-12-01 13:19:18 +08:00
guanj
a19cbf233e 修改冀北问题 2025-11-28 16:27:52 +08:00
guanj
028fd44490 调整代码 2025-11-20 15:12:01 +08:00
sjl
0a52d1afae 监测点框位置,tab切换缓存 2025-11-14 08:42:07 +08:00
sjl
e655611954 微调 2025-11-12 16:10:46 +08:00
sjl
b982cee382 微调 2025-11-12 15:42:31 +08:00
sjl
d6336f7ba8 污染值报表 2025-11-12 13:23:15 +08:00
713 changed files with 104522 additions and 113446 deletions

6
.env.LN Normal file
View File

@@ -0,0 +1,6 @@
# 辽宁嵌入
NODE_ENV = LN
VITE_NAME="LN"
# 电网一张图 地图图层
VITE_NARIMAP=null
VITE_NRGISCOMMON=null

6
.env.LNqr Normal file
View File

@@ -0,0 +1,6 @@
# 辽宁嵌入
NODE_ENV = LNqr
VITE_NAME="LNqr"
# 电网一张图 地图图层
VITE_NARIMAP=null
VITE_NRGISCOMMON=null

5
.env.hainan Normal file
View File

@@ -0,0 +1,5 @@
NODE_ENV = hainan
VITE_NAME="hainan"
# 电网一张图 地图图层
VITE_NARIMAP=null
VITE_NRGISCOMMON=null

6
.env.qujing Normal file
View File

@@ -0,0 +1,6 @@
# 云南曲靖
NODE_ENV = qujing
VITE_NAME="qujing"
# 电网一张图 地图图层
VITE_NARIMAP=null
VITE_NRGISCOMMON=null

156
README.md
View File

@@ -1,78 +1,78 @@
#### 介绍 #### 介绍
``` ```
Vue 3 + TypeScript + Vite这个模板可以帮助您开始使用Vue 3和TypeScript在Vite中进行开发。该模板使用了Vue 3的<script setup>单文件组件请查看script setup文档了解更多信息。 Vue 3 + TypeScript + Vite这个模板可以帮助您开始使用Vue 3和TypeScript在Vite中进行开发。该模板使用了Vue 3的<script setup>单文件组件请查看script setup文档了解更多信息。
``` ```
#### 安装依赖&运行项目 #### 安装依赖&运行项目
> node version:^18.17.0 || >=20.5.0" > node version:^18.17.0 || >=20.5.0"
```shell ```shell
#项目使用pnpm包管理器 #项目使用pnpm包管理器
npm i pnpm -g npm i pnpm -g
#安装依赖 #安装依赖
pnpm i pnpm i
#运行项目 #运行项目
npm run dev npm run dev
#冀北现场启动命令 区分是否加载现场电网一张图内网api #jb现场启动命令 区分是否加载现场电网一张图内网api
npm run dev:jibei npm run dev:jibei
#去除后台所有模块名 如除/xxxx-boot #去除后台所有模块名 如除/xxxx-boot
npm run dev:removeMode npm run dev:removeMode
#因海南和冀北技术监督不同 通过修改文件的方式来区分 #因海南和jb技术监督不同 通过修改文件的方式来区分
#海南打包 需要吧pqs目录下supervise_hn 文件夹改成supervise 原文件改成supervise_jb #海南打包 需要吧pqs目录下supervise_hn 文件夹改成supervise 原文件改成supervise_jb
#冀北打包 需要吧pqs目录下supervise_jb 文件夹改成supervise 原文件改成supervise_hn #jb打包 需要吧pqs目录下supervise_jb 文件夹改成supervise 原文件改成supervise_hn
``` ```
#### 页面编写-示例 #### 页面编写-示例
``` ```
基础页面写法请查看`src/template`下的readme.md 基础页面写法请查看`src/template`下的readme.md
``` ```
#### 开发规范 #### 开发规范
> 初衷:养成合理的习惯,精力留在技术调研、业务开发中。 > 初衷:养成合理的习惯,精力留在技术调研、业务开发中。
> >
> 常见点如下描述,更多的规范待前端开发人员有时间后,慢慢丰富。 > 常见点如下描述,更多的规范待前端开发人员有时间后,慢慢丰富。
- 命名风格:所有的包(文件夹)、文件名以小驼峰的风格命名,比如 xxxAaa禁止 XxxAaa 或者 xxx-aaa。 - 命名风格:所有的包(文件夹)、文件名以小驼峰的风格命名,比如 xxxAaa禁止 XxxAaa 或者 xxx-aaa。
- 命名语义:禁止中文命名或拼音,英文命名借用下工具,稍微准确一点,不要与实际业务相差太远。 - 命名语义:禁止中文命名或拼音,英文命名借用下工具,稍微准确一点,不要与实际业务相差太远。
- 功能组件创建风格:以**功能名称**命名文件夹,每个功能下以**index.vue**作为该功能的组件入口。正确示例参考:/src/views/auth/menu/index.vue。 - 功能组件创建风格:以**功能名称**命名文件夹,每个功能下以**index.vue**作为该功能的组件入口。正确示例参考:/src/views/auth/menu/index.vue。
![组件层级图](./src/assets/readme/moduleLevel.png) ![组件层级图](./src/assets/readme/moduleLevel.png)
- todo...:待后续补充。 - todo...:待后续补充。
#### 开发助手 #### 开发助手
##### 1、表格系列 ##### 1、表格系列
- 页面表格以及表格页面按钮的弹出等功能参考:/views/pqs/voltageSags/sagGovern/index.vue - 页面表格以及表格页面按钮的弹出等功能参考:/views/pqs/voltageSags/sagGovern/index.vue
- 表格中需要替换数据: - 表格中需要替换数据:
```js ```js
// 通过formatter函数返回实际需要返回的值 // 通过formatter函数返回实际需要返回的值
{ {
title: '数据来源', field: 'dataSource', minWidth: '130', title: '数据来源', field: 'dataSource', minWidth: '130',
formatter: (row: any) => { formatter: (row: any) => {
return row.dataSource == 0 ? '离线导入' : '监测点同步' return row.dataSource == 0 ? '离线导入' : '监测点同步'
} }
}**** }****
``` ```
##### 2、样式系列 ##### 2、样式系列
- 获取当前主体的高度import { mainHeight } from '@/utils/layout' - 获取当前主体的高度import { mainHeight } from '@/utils/layout'
- 弹框内输入框长度设置 1 行 1 个 class="form-one" 1 行 2 个 class="form-two" - 弹框内输入框长度设置 1 行 1 个 class="form-one" 1 行 2 个 class="form-two"
#### 依赖变更记录 #### 依赖变更记录
- 2024-04-25 新增 vform3by 洪圣文,用于页面表单设计保存为 json命令pnpm i vform3-builds - 2024-04-25 新增 vform3by 洪圣文,用于页面表单设计保存为 json命令pnpm i vform3-builds

View File

@@ -15,7 +15,7 @@
<script src="/static/luckysheet/plugin.js"></script> <script src="/static/luckysheet/plugin.js"></script>
<script src="/static/luckysheet/luckysheet.umd.js"></script> <script src="/static/luckysheet/luckysheet.umd.js"></script>
<!-- 冀北地图 --> <!-- jb地图 -->
<!--引入样式文件--> <!--引入样式文件-->
<script src="%VITE_NARIMAP%"></script> <script src="%VITE_NARIMAP%"></script>
<!-- <script src="%VITE_NRGISCOMMON%"></script> --> <!-- <script src="%VITE_NRGISCOMMON%"></script> -->

View File

@@ -1,99 +1,108 @@
{ {
"name": "canneng-admin", "name": "canneng-admin",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --mode dev", "dev": "vite --mode dev",
"dev:jibei": "vite --mode jibei", "dev:jibei": "vite --mode jibei",
"dev:removeMode": "vite --mode removeMode", "dev:hainan": "vite --mode hainan",
"build": "vite build --mode dev", "dev:qujing": "vite --mode qujing",
"build:jibei": "vite build --mode jibei", "dev:LN": "vite --mode LN",
"build:removeMode": "vite build --mode removeMode", "dev:LNqr": "vite --mode LNqr",
"preview": "vite preview" "dev:removeMode": "vite --mode removeMode",
}, "build": "vite build --mode dev",
"dependencies": { "build:jibei": "vite build --mode jibei",
"@ant-design/colors": "^7.0.2", "build:hainan": "vite build --mode hainan",
"@element-plus/icons-vue": "^2.3.1", "build:qujing": "vite build --mode qujing",
"@form-create/designer": "^3.1.3", "build:LN": "vite build --mode LN",
"@form-create/element-ui": "^3.1.24", "build:LNqr": "vite build --mode LNqr",
"@fortawesome/fontawesome-free": "^6.5.1", "build:removeMode": "vite build --mode removeMode",
"@kjgl77/datav-vue3": "^1.7.4", "preview": "vite preview"
"@vue-office/docx": "^1.6.2", },
"@vue-office/excel": "^1.7.8", "dependencies": {
"@vue-office/pdf": "^2.0.2", "@ant-design/colors": "^7.0.2",
"@vueuse/core": "^10.7.0", "@element-plus/icons-vue": "^2.3.1",
"@wangeditor/editor": "^5.1.23", "@form-create/designer": "^3.1.3",
"@wangeditor/editor-for-vue": "^5.1.12", "@form-create/element-ui": "^3.1.24",
"@wangeditor/plugin-formula": "^1.0.11", "@fortawesome/fontawesome-free": "^6.5.1",
"axios": "^1.6.2", "@kjgl77/datav-vue3": "^1.7.4",
"bpmn-js": "8.9.0", "@vue-office/docx": "^1.6.3",
"bpmn-js-properties-panel": "0.46.0", "@vue-office/excel": "^1.7.8",
"bpmn-js-token-simulation": "^0.10.0", "@vue-office/pdf": "^2.0.2",
"bpmn-moddle": "^6.0.0", "@vueuse/core": "^10.7.0",
"camunda-bpmn-moddle": "^7.0.1", "@wangeditor/editor": "^5.1.23",
"crypto-js": "^4.2.0", "@wangeditor/editor-for-vue": "^5.1.12",
"dayjs": "^1.11.10", "@wangeditor/plugin-formula": "^1.0.11",
"diagram-js": "^11.4.1", "axios": "^1.6.2",
"diagram-js-minimap": "^2.0.4", "bpmn-js": "8.9.0",
"echarts": "^5.4.3", "bpmn-js-properties-panel": "0.46.0",
"echarts-gl": "^2.0.9", "bpmn-js-token-simulation": "^0.10.0",
"echarts-liquidfill": "^3.1.0", "bpmn-moddle": "^6.0.0",
"echarts4": "npm:echarts@^4.9.0", "camunda-bpmn-moddle": "^7.0.1",
"element-plus": "^2.9.11", "crypto-js": "^4.2.0",
"exceljs": "^4.4.0", "dayjs": "^1.11.10",
"file-saver": "^2.0.5", "diagram-js": "^11.4.1",
"grid-layout-plus": "^1.1.0", "diagram-js-minimap": "^2.0.4",
"html2canvas": "^1.4.1", "echarts": "^5.4.3",
"jquery": "^3.7.1", "echarts-gl": "^2.0.9",
"js-pinyin": "^0.2.5", "echarts-liquidfill": "^3.1.0",
"jsencrypt": "^3.3.2", "echarts4": "npm:echarts@^4.9.0",
"katex": "^0.16.11", "element-plus": "^2.9.11",
"less": "^4.2.0", "exceljs": "^4.4.0",
"lodash-es": "^4.17.21", "file-saver": "^2.0.5",
"luckyexcel": "^1.0.1", "grid-layout-plus": "^1.1.0",
"luckysheet": "^2.1.13", "html2canvas": "^1.4.1",
"mathjax": "^3.2.2", "jquery": "^3.7.1",
"min-dash": "^4.2.1", "js-pinyin": "^0.2.5",
"mitt": "^3.0.1", "jsencrypt": "^3.3.2",
"mqtt": "^5.13.3", "katex": "^0.16.11",
"nprogress": "^0.2.0", "less": "^4.2.0",
"pinia": "^2.1.7", "lodash-es": "^4.17.21",
"pinia-plugin-persistedstate": "^3.2.1", "luckyexcel": "^1.0.1",
"qs": "^6.12.0", "luckysheet": "^2.1.13",
"screenfull": "^6.0.2", "mathjax": "^3.2.2",
"splitpanes": "^3.1.5", "min-dash": "^4.2.1",
"steady-xml": "0.1.0", "mitt": "^3.0.1",
"svg-pan-zoom": "^3.6.2", "mqtt": "^5.13.3",
"use-element-plus-theme": "^0.0.5", "nprogress": "^0.2.0",
"vexip-ui": "^2.3.28", "pinia": "^2.1.7",
"vue": "^3.3.11", "pinia-plugin-persistedstate": "^3.2.1",
"vue-baidu-map-3x": "^1.0.35", "qs": "^6.12.0",
"vue-baidu-map-offline": "^1.0.7", "screenfull": "^6.0.2",
"vue-demi": "^0.14.8", "splitpanes": "^3.1.5",
"vue-draggable-resizable": "3.0.0-beta.2", "steady-xml": "0.1.0",
"vue-i18n": "9.10.2", "svg-pan-zoom": "^3.6.2",
"vue-katex": "^0.5.0", "use-element-plus-theme": "^0.0.5",
"vue-router": "4", "vexip-ui": "^2.3.28",
"vue-types": "^5.1.1", "vue": "^3.3.11",
"vxe-table": "^4.5.17", "vue-baidu-map-3x": "^1.0.35",
"vxe-table-plugin-export-xlsx": "^4.0.1", "vue-baidu-map-offline": "^1.0.7",
"web-storage-cache": "^1.1.1", "vue-demi": "^0.14.8",
"xe-utils": "^3.5.14", "vue-draggable-resizable": "3.0.0-beta.2",
"yarn": "^1.22.22" "vue-i18n": "9.10.2",
}, "vue-katex": "^0.5.0",
"devDependencies": { "vue-router": "4",
"@purge-icons/generated": "^0.9.0", "vue-types": "^5.1.1",
"@types/lodash-es": "^4.17.12", "vxe-pc-ui": "~4.15.19",
"@types/node": "^20.10.5", "vxe-table": "^4.19.22",
"@types/splitpanes": "^2.2.6", "vxe-table-plugin-export-xlsx": "^4.0.7",
"@vitejs/plugin-vue": "^4.5.2", "web-storage-cache": "^1.1.1",
"@vitejs/plugin-vue-jsx": "^3.1.0", "xe-utils": "^3.5.14",
"sass": "^1.69.5", "yarn": "^1.22.22"
"typescript": "^5.2.2", },
"unplugin-auto-import": "^0.16.7", "devDependencies": {
"vite": "^5.0.8", "@purge-icons/generated": "^0.9.0",
"vite-plugin-mkcert": "^1.17.3", "@types/lodash-es": "^4.17.12",
"vue-tsc": "^1.8.25" "@types/node": "^20.10.5",
} "@types/splitpanes": "^2.2.6",
"@vitejs/plugin-vue": "^4.5.2",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"sass": "^1.69.5",
"typescript": "^5.2.2",
"unplugin-auto-import": "^0.16.7",
"vite": "^5.0.8",
"vite-plugin-mkcert": "^1.17.3",
"vue-tsc": "^1.8.25"
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

BIN
public/favicon3.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
public/favicon4.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -9,14 +9,20 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import useSetTheme from '@/utils/setTheme' import useSetTheme from '@/utils/setTheme'
import { onMounted } from 'vue' import { onMounted } from 'vue'
useSetTheme() useSetTheme()
onMounted(async () => { const fetchMqttUrl = async () => {
const response = await fetch('/') const response = await fetch('/')
const WebSocketUrl:any = response.headers.get('X-WebSocket-Url') const WebSocketUrl: any = response.headers.get('X-WebSocket-Url')
const WebSocketUrl2:any = response.headers.get('X-WebSocket-Url2') const WebSocketUrl2: any = response.headers.get('X-WebSocket-Url2')
const MqttUrl:any = response.headers.get('X-MqttUrl-Url') const WebSocketUrl3: any = response.headers.get('X-WebSocket-Url3')
localStorage.setItem('WebSocketUrl2', WebSocketUrl2) const MqttUrl: any = response.headers.get('X-MqttUrl-Url')
localStorage.setItem('WebSocketUrl', WebSocketUrl) localStorage.setItem('WebSocketUrl', WebSocketUrl)
localStorage.setItem('WebSocketUrl2', WebSocketUrl2)
localStorage.setItem('WebSocketUrl3', WebSocketUrl3)
localStorage.setItem('MqttUrl', MqttUrl) localStorage.setItem('MqttUrl', MqttUrl)
}
onMounted(() => {
fetchMqttUrl()
}) })
</script> </script>

View File

@@ -1,5 +1,6 @@
import createAxios from '@/utils/request' import createAxios from '@/utils/request'
// 密码规则修改 // 密码规则修改
export function ruleUpdate(data) { export function ruleUpdate(data) {
return createAxios({ return createAxios({
@@ -24,3 +25,77 @@ export function unlockRoot(data) {
data data
}) })
} }
//根据客户端名查询信息
export function getClientInfoByPath() {
return createAxios({
url: '/user-boot/authClient/getAuthClientByName/njcn',
method: 'GET',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
}
//客户端会话配置更新
export function updateClientSessionConfig(data) {
return createAxios({
url: '/user-boot/authClient/sessionConfigUpdate',
method: 'post',
data
})
}
//获取用户配置
export function getUserConfig() {
return createAxios({
url: '/user-boot/password/getUserStrategyList',
method: 'post'
})
}
//查询系统列表
export function getSystemList() {
return createAxios({
url: '/system-boot/config/getSysConfigData',
method: 'get'
})
}
//激活系统配置
export function activeSystemConfig(data) {
return createAxios({
url: '/system-boot/config/updateSysConfig',
method: 'post',
data
})
}
//删除系统配置
export function deleteSystemConfig( data) {
return createAxios({
url: '/system-boot/config/removeSysConfigById',
method: 'get',
params: data
})
}
//新增系统配置
export function addSystemConfig(data) {
return createAxios({
url: '/system-boot/config/addSysConfig',
method: 'post',
data
})
}
//修改系统配置
export function updateSystemConfig(data) {
return createAxios({
url: '/system-boot/config/updateSysConfig',
method: 'post',
data
})
}

View File

@@ -1,4 +1,4 @@
import request from '@/config/axios' import { requestData, requestDownload } from '@/utils/request'
// BPM 流程表达式 VO // BPM 流程表达式 VO
export interface ProcessExpressionVO { export interface ProcessExpressionVO {
@@ -12,31 +12,36 @@ export interface ProcessExpressionVO {
export const ProcessExpressionApi = { export const ProcessExpressionApi = {
// 查询BPM 流程表达式分页 // 查询BPM 流程表达式分页
getProcessExpressionPage: async (params: any) => { getProcessExpressionPage: async (params: any) => {
return await request.get({ url: `/bpm/process-expression/page`, params }) return await requestData({ url: '/bpm/process-expression/page', method: 'GET', params })
}, },
// 查询BPM 流程表达式详情 // 查询BPM 流程表达式详情
getProcessExpression: async (id: number) => { getProcessExpression: async (id: number) => {
return await request.get({ url: `/bpm/process-expression/get?id=` + id }) return await requestData({ url: '/bpm/process-expression/get?id=' + id, method: 'GET' })
}, },
// 新增BPM 流程表达式 // 新增BPM 流程表达式
createProcessExpression: async (data: ProcessExpressionVO) => { createProcessExpression: async (data: ProcessExpressionVO) => {
return await request.post({ url: `/bpm/process-expression/create`, data }) return await requestData({ url: '/bpm/process-expression/create', method: 'POST', data })
}, },
// 修改BPM 流程表达式 // 修改BPM 流程表达式
updateProcessExpression: async (data: ProcessExpressionVO) => { updateProcessExpression: async (data: ProcessExpressionVO) => {
return await request.put({ url: `/bpm/process-expression/update`, data }) return await requestData({ url: '/bpm/process-expression/update', method: 'PUT', data })
}, },
// 删除BPM 流程表达式 // 删除BPM 流程表达式
deleteProcessExpression: async (id: number) => { deleteProcessExpression: async (id: number) => {
return await request.delete({ url: `/bpm/process-expression/delete?id=` + id }) return await requestData({ url: '/bpm/process-expression/delete?id=' + id, method: 'DELETE' })
}, },
// 导出BPM 流程表达式 Excel // 导出BPM 流程表达式 Excel
exportProcessExpression: async (params) => { exportProcessExpression: async (params) => {
return await request.download({ url: `/bpm/process-expression/export-excel`, params }) return await requestDownload({
url: '/bpm/process-expression/export-excel',
method: 'GET',
params,
responseType: 'blob'
})
} }
} }

View File

@@ -1,4 +1,4 @@
import request from '@/config/axios' import { requestData } from '@/utils/request'
// BPM 流程监听器 VO // BPM 流程监听器 VO
export interface ProcessListenerVO { export interface ProcessListenerVO {
@@ -15,26 +15,26 @@ export interface ProcessListenerVO {
export const ProcessListenerApi = { export const ProcessListenerApi = {
// 查询流程监听器分页 // 查询流程监听器分页
getProcessListenerPage: async (params: any) => { getProcessListenerPage: async (params: any) => {
return await request.get({ url: `/bpm/process-listener/page`, params }) return await requestData({ url: '/bpm/process-listener/page', method: 'GET', params })
}, },
// 查询流程监听器详情 // 查询流程监听器详情
getProcessListener: async (id: number) => { getProcessListener: async (id: number) => {
return await request.get({ url: `/bpm/process-listener/get?id=` + id }) return await requestData({ url: '/bpm/process-listener/get?id=' + id, method: 'GET' })
}, },
// 新增流程监听器 // 新增流程监听器
createProcessListener: async (data: ProcessListenerVO) => { createProcessListener: async (data: ProcessListenerVO) => {
return await request.post({ url: `/bpm/process-listener/create`, data }) return await requestData({ url: '/bpm/process-listener/create', method: 'POST', data })
}, },
// 修改流程监听器 // 修改流程监听器
updateProcessListener: async (data: ProcessListenerVO) => { updateProcessListener: async (data: ProcessListenerVO) => {
return await request.put({ url: `/bpm/process-listener/update`, data }) return await requestData({ url: '/bpm/process-listener/update', method: 'PUT', data })
}, },
// 删除流程监听器 // 删除流程监听器
deleteProcessListener: async (id: number) => { deleteProcessListener: async (id: number) => {
return await request.delete({ url: `/bpm/process-listener/delete?id=` + id }) return await requestData({ url: '/bpm/process-listener/delete?id=' + id, method: 'DELETE' })
} }
} }

View File

@@ -1,47 +1,41 @@
import request from '@/config/axios' import { requestData } from '@/utils/request'
export type UserGroupVO = { export type UserGroupVO = {
id: number id: number
name: string name: string
description: string description: string
userIds: number[] userIds: number[]
status: number status: number
remark: string remark: string
createTime: string createTime: string
} }
// 创建用户组 // 创建用户组
export const createUserGroup = async (data: UserGroupVO) => { export const createUserGroup = async (data: UserGroupVO) => {
return await request.post({ return await requestData({ url: '/bpm/user-group/create', method: 'POST', data })
url: '/bpm/user-group/create', }
data: data
}) // 更新用户组
} export const updateUserGroup = async (data: UserGroupVO) => {
return await requestData({ url: '/bpm/user-group/update', method: 'PUT', data })
// 更新用户组 }
export const updateUserGroup = async (data: UserGroupVO) => {
return await request.put({ // 删除用户组
url: '/bpm/user-group/update', export const deleteUserGroup = async (id: number) => {
data: data return await requestData({ url: '/bpm/user-group/delete?id=' + id, method: 'DELETE' })
}) }
}
// 获得用户组
// 删除用户组 export const getUserGroup = async (id: number) => {
export const deleteUserGroup = async (id: number) => { return await requestData({ url: '/bpm/user-group/get?id=' + id, method: 'GET' })
return await request.delete({ url: '/bpm/user-group/delete?id=' + id }) }
}
// 获得用户组分页
// 获得用户组 export const getUserGroupPage = async (params) => {
export const getUserGroup = async (id: number) => { return await requestData({ url: '/bpm/user-group/page', method: 'GET', params })
return await request.get({ url: '/bpm/user-group/get?id=' + id }) }
}
// 获取用户组精简信息列表
// 获得用户组分页 export const getUserGroupSimpleList = async (): Promise<UserGroupVO[]> => {
export const getUserGroupPage = async (params) => { return await requestData({ url: '/bpm/user-group/simple-list', method: 'GET' })
return await request.get({ url: '/bpm/user-group/page', params }) }
}
// 获取用户组精简信息列表
export const getUserGroupSimpleList = async (): Promise<UserGroupVO[]> => {
return await request.get({ url: '/bpm/user-group/simple-list' })
}

View File

@@ -129,11 +129,27 @@ export function queryAllByType(params: any) {
//获取用户 //获取用户
export function selectUserList(data: any) { export function selectUserList(data: any) {
return createAxios({ return createAxios({
url: '/supervision-boot/userReport/selectUserList', url: '/device-boot/userReport/selectUserList',
method: 'post', method: 'post',
data data
}) })
} }
//获取用户
export function selectUserAssessMentList(data: any) {
return createAxios({
url: '/supervision-boot/userReport/selectUserAssessMentList',
method: 'post',
data
})
}
//绑定用户
export function bindAssessmentId(data: any) {
return createAxios({
url: '/supervision-boot/userReport/bindAssessmentId',
method: 'get',
params: data
})
}
//查询列表 //查询列表
export function getStatusManageList(data: any) { export function getStatusManageList(data: any) {
return createAxios({ return createAxios({
@@ -190,3 +206,11 @@ export function exportTerminalBase() {
responseType: 'blob' responseType: 'blob'
}) })
} }
//一键分配终端
export function allotTerminal(data: any) {
return createAxios({
url: '/device-boot/nodeDevice/oneKeyDistribution',
method: 'post',
params: data
})
}

View File

@@ -1,7 +1,7 @@
import request from '@/utils/request' import request from '@/utils/request'
// 获取区域中断终端 // 获取区域中断终端
export function getAreaOffDev(data) { export function getAreaOffDev(data:any) {
return request({ return request({
url: '/device-boot/device/getAreaOffDev', url: '/device-boot/device/getAreaOffDev',
method: 'post', method: 'post',
@@ -9,10 +9,28 @@ export function getAreaOffDev(data) {
}) })
} }
// 获取区域中断终端 // 获取区域中断终端
export function getYwZtSubstation(data) { export function getYwZtSubstation(data:any) {
return request({ return request({
url: '/device-boot/ywZt/getYwZtSubstation', url: '/device-boot/ywZt/getYwZtSubstation',
method: 'GET', method: 'GET',
params: data params: data
}) })
} }
//终端周期检测
export function terminalCheckPage(data:any) {
return request({
url: '/device-boot/alarm/terminalCheckPage',
method: 'post',
data
})
}
export function userCheckUpload(data:any) {
return request({
url: '/device-boot/userReport/userCheckUpload',
method: 'post',
data
})
}

View File

@@ -1,32 +1,57 @@
import request from '@/utils/request' import request from '@/utils/request'
import { DEVICE_BOOT } from '@/utils/constantRequest' import { DEVICE_BOOT } from '@/utils/constantRequest'
const MAPPING_PATH = DEVICE_BOOT + '/line' const MAPPING_PATH = DEVICE_BOOT + '/line'
/** /**
* 查询终端详细信息 * 查询终端详细信息
*/ */
export const getDeviceDetailData = (id: string) => { export const getDeviceDetailData = (id: string) => {
return request({ return request({
url: MAPPING_PATH + '/getDeviceDetailData?id=' + id, url: MAPPING_PATH + '/getDeviceDetailData?id=' + id,
method: 'POST' method: 'POST'
}) })
} }
/** /**
* 查询监测点详细信息 * 查询监测点详细信息
*/ */
export const getLineDetailData = (id: string) => { export const getLineDetailData = (id: string) => {
return request({ return request({
url: MAPPING_PATH + '/getLineDetailData?id=' + id, url: MAPPING_PATH + '/getLineDetailData?id=' + id,
method: 'POST' method: 'POST'
}) })
} }
export const getSubstationSelect = () => { export const getSubstationSelect = () => {
return request({ return request({
url: 'device-boot/substation/getSubstationSelect', url: 'device-boot/substation/getSubstationSelect',
method: 'get' method: 'get'
}) })
} }
// 查询变电站详情
export const getSubstationSelectLine = (id: string) => {
return request({
url: '/device-boot/line/getSubstationData',
method: 'post',
data: [id]
})
}
// 查询监测点
export const getLineOverLimitData = (id: string) => {
return request({
url: '/device-boot/line/getLineOverLimitData?id=' + id,
method: 'post'
})
}
//导出数据总览
export function dataVerifyExcel(params: any) {
return request({
url: '/device-boot/dataVerify/dataVerifyExcel',
method: 'get',
params,
responseType: 'blob'
})
}

View File

@@ -31,4 +31,13 @@ export function getDevTypeList() {
method: 'post', method: 'post',
}) })
}
export const getDeviceTypeList = (params: any) => {
return createAxios({
url: '/device-boot/devType/pageDevTypeList',
method: 'POST',
data: params
})
} }

View File

@@ -4,6 +4,10 @@ import request from '@/utils/request'
export function getSubLineGiveAnAlarm(data: any) { export function getSubLineGiveAnAlarm(data: any) {
return request({ url: '/harmonic-boot/gridDiagram/getSubLineGiveAnAlarm', method: 'post', data }) return request({ url: '/harmonic-boot/gridDiagram/getSubLineGiveAnAlarm', method: 'post', data })
} }
export function getAreaObjAlarm(data: any) {
return request({ url: '/harmonic-boot/gridDiagram/getAreaObjAlarm', method: 'post', data })
}
// 变电站详细列表 // 变电站详细列表
export function getPollutionAlarmPageData(data: any) { export function getPollutionAlarmPageData(data: any) {
return request({ url: '/harmonic-boot/gridDiagram/getPollutionAlarmPageData', method: 'post', data }) return request({ url: '/harmonic-boot/gridDiagram/getPollutionAlarmPageData', method: 'post', data })
@@ -165,3 +169,24 @@ export function getSupervisionDetailsData(data: any) {
export function getSupervisionCityDetailsData(data: any) { export function getSupervisionCityDetailsData(data: any) {
return request({ url: '/supervision-boot/gridDiagram/getSupervisionCityDetailsData', method: 'post', data }) return request({ url: '/supervision-boot/gridDiagram/getSupervisionCityDetailsData', method: 'post', data })
} }
//区域污染值统计
export function getAreaPollution(data: any) {
return request({ url: '/harmonic-boot/PollutionSubstation/getAreaPollution', method: 'post', data })
}
//场站级评估
export function downPollutionSubCalc(data: any) {
return request({ url: '/harmonic-boot/PollutionSubstation/downPollutionSubCalc', method: 'post', data })
}
//监测点评价
export function limitTableDetail(data: any) {
return request({ url: '/device-boot/dataVerify/limitTableDetail', method: 'post', data })
}
//重要及敏感用户详情
export function downPollutionSensitiveUser(data: any) {
return request({ url: '/harmonic-boot/PollutionSubstation/downPollutionSensitiveUser', method: 'post', data })
}
//干扰源类型统计
export function loadTypeVOList(data: any) {
return request({ url: '/device-boot/gridDiagram/loadTypeVOList', method: 'post', data })
}

View File

@@ -0,0 +1,103 @@
import request from '@/utils/request'
// 新增敏感用户
export function saveUser(data: any) {
return request({
url: '/device-boot/pqSensitiveUser/save',
method: 'post',
data: data
})
}
// 修改敏感用户
export function updateUser(data: any) {
return request({
url: '/device-boot/pqSensitiveUser/update',
method: 'post',
data: data
})
}
// 删除敏感用户
export function deleteUser(data: any) {
return request({
url: '/device-boot/pqSensitiveUser/delete',
method: 'post',
data: data
})
}
/**
* 干扰源接入功能删除流程
*/
export const deleteUserReport = (data: any) => {
return request({
url: '/device-boot/userReport/deleteUserReport',
method: 'POST',
data
})
}
/**
* 提交表单数据
*/
export const submitFormData = (data: any) => {
return request({
url: '/device-boot/userReport/add',
method: 'POST',
data: data
})
}
// 根据id获取用户档案录入的详细数据
export const getById = (data: any) => {
return request({
url: '/device-boot/userReport/getById',
method: 'get',
params: data
})
}
/**
* 提交表单数据
*/
export const addEditor = (data: any) => {
return request({
url: '/device-boot/userReportRenewal/addEditor',
method: 'POST',
data: data
})
}
// 根据id获取用户档案录入的详细数据
export const getByDeptDevLine = (params: any) => {
return request({
url: '/device-boot/line/getByDeptDevLine',
method: 'get',
params
})
}
/**
* 根据id获取用户档案录入的详细数据
*/
export const getUserReportUpdateById = (id: any) => {
return request({
url: '/device-boot/userReportRenewal/getUserReportUpdateById?businessId='+id,
method: 'POST',
})
}
// 根据id获取用户档案录入的详细数据
export const getUserReportById = (id: any) => {
return request({
url: '/device-boot/userReport/getUserReportById?id='+id,
method: 'get'
})
}
// 根据id查询文件信息集合
export const getFileById = (params: any) => {
return request({
url: '/device-boot/fileUrl/getFileById',
method: 'get',
params
})
}

View File

@@ -1,72 +1,137 @@
import createAxios from '@/utils/request' import createAxios from '@/utils/request'
import { genFileId, ElMessage, ElNotification } from 'element-plus'
//事件报告
export function getEventReport(data) { //事件报告
return createAxios({ // export function getEventReport(data) {
url: '/event-boot/report/getEventReport', // return createAxios({
method: 'post', // url: '/event-boot/report/getEventReport',
data // method: 'post',
}) // data
} // })
// 生成报告 // }
export function getAreaReport(data) {
return createAxios({ export function getEventReport(data) {
url: '/event-boot/report/getAreaReport', return createAxios({
method: 'post', url: '/event-boot/report/createEventReport',
data, method: 'post',
responseType: 'blob' data,
}) responseType: 'blob'
} }).then(async res => {
//查询所有模板 let load: any = await readJsonBlob(res)
export function getList(data) { if (load.code) {
return createAxios({ if (load.data.code == 'A0011') {
url: '/system-boot/EventTemplate/getList', ElMessage.warning('下载失败!')
method: 'post', } else {
data ElMessage.warning(load.data.message)
}) }
} } else {
export function selectReleation(data) { return res
return createAxios({ }
url: '/system-boot/EventTemplate/selectReleation', })
method: 'post', }
params: data
})
} // 生成报告
export function getLineExport(data) { export function getAreaReport(data) {
return createAxios({ return createAxios({
url: '/event-boot/report/getLineExport', url: '/event-boot/report/getAreaReport',
method: 'post', method: 'post',
data: data, data,
responseType: 'blob' responseType: 'blob'
}) }).then(async res => {
} let load: any = await readJsonBlob(res)
export function getVoltage(data: any) { if (load.code) {
return createAxios({ if (load.data.code == 'A0011') {
url: '/event-boot/report/getVoltage', ElMessage.warning('下载失败!')
method: 'post', } else {
data ElMessage.warning(load.data.message)
}) }
} } else {
export function getGeneralSituation(data: any) { return res
return createAxios({ }
url: '/event-boot/report/getGeneralSituation', })
method: 'post', }
data async function readJsonBlob(blob) {
}) try {
} // 1. Blob.text() 读取二进制 → 直接转为 字符串(自动处理编码)
export function getTransientValue(data: any) { const jsonStr = await blob.text()
return createAxios({ // 2. JSON.parse 解析字符串 → 得到可用的 JS 对象/数组
url: '/event-boot/transient/getTransientValue', const jsonData = JSON.parse(jsonStr)
method: 'post', // 3. 拿到数据,后续随便用
data return {
}) code: true,
} data: jsonData
// 周报导出 }
export function getExport(data: any) { } catch (err) {
return createAxios({ return {
url: '/event-boot/report/getExport', code: false,
method: 'post', data: {}
data, }
responseType: 'blob' // console.error('解析Blob的JSON数据失败', err)
}) }
} }
//查询所有模板
export function getList(data) {
return createAxios({
url: '/system-boot/EventTemplate/getList',
method: 'post',
data
})
}
export function selectReleation(data) {
return createAxios({
url: '/system-boot/EventTemplate/selectReleation',
method: 'post',
params: data
})
}
export function getLineExport(data) {
return createAxios({
url: '/event-boot/report/getLineExport',
method: 'post',
data: data,
responseType: 'blob'
}).then(async res => {
let load: any = await readJsonBlob(res)
if (load.code) {
if (load.data.code == 'A0011') {
ElMessage.warning('下载失败!')
} else {
ElMessage.warning(load.data.message)
}
} else {
return res
}
})
}
export function getVoltage(data: any) {
return createAxios({
url: '/event-boot/report/getVoltage',
method: 'post',
data
})
}
export function getGeneralSituation(data: any) {
return createAxios({
url: '/event-boot/report/getGeneralSituation',
method: 'post',
data
})
}
export function getTransientValue(data: any) {
return createAxios({
url: '/event-boot/transient/getTransientValue',
method: 'post',
data
})
}
// 周报导出
export function getExport(data: any) {
return createAxios({
url: '/event-boot/report/getExport',
method: 'post',
data,
responseType: 'blob'
})
}

View File

@@ -1,106 +1,114 @@
import request from '@/utils/request' import request from '@/utils/request'
export function getTypeIdData(data: any) { export function getTypeIdData(data: any) {
return request({ return request({
url: '/system-boot/dictData/getTypeIdData', url: '/system-boot/dictData/getTypeIdData',
method: 'post', method: 'post',
data: data data: data
}) })
} }
export function getOnlineRateData2(data:any) { export function getOnlineRateData2(data:any) {
return request({ return request({
url: '/harmonic-boot/onlineRateData/getOnlineRateData', url: '/harmonic-boot/onlineRateData/getOnlineRateData',
method: 'post', method: 'post',
data: data data: data
}) })
} }
export function getAreaDept() { export function getAreaDept() {
return request({ return request({
url: '/user-boot/dept/loginDeptTree', url: '/user-boot/dept/loginDeptTree',
method: 'post' method: 'post'
}) })
} }
export function getOnlineRateDataCensus(data:any) { // 承载能力评估去除前缀
return request({ export function getAreaDeptRemoveMode(params) {
url: '/device-boot/terminalOnlineRateData/getOnlineRateDataCensus', return request({
method: 'post', url: '/user-boot/dept/loginDeptTree',
data: data method: 'GET',
}) params: params
} })
export function IntegrityIcon(data:any) { }
return request({ export function getOnlineRateDataCensus(data:any) {
url: '/harmonic-boot/integrity/getIntegrityIcon', return request({
method: 'post', url: '/device-boot/terminalOnlineRateData/getOnlineRateDataCensus',
data: data method: 'post',
}) data: data
} })
export function getDeptIdAreaTree() { }
return request({ export function IntegrityIcon(data:any) {
url: '/system-boot/area/getDeptIdAreaTree', return request({
method: 'post' url: '/harmonic-boot/integrity/getIntegrityIcon',
}) method: 'post',
} data: data
export function getOnlineRateData(data:any) { })
return request({ }
url: '/device-boot/terminalOnlineRateData/getOnlineRateData', export function getDeptIdAreaTree() {
method: 'post', return request({
data: data url: '/system-boot/area/getDeptIdAreaTree',
}) method: 'post'
} })
export function getSubstationInfoById(data:any) { }
return request({ export function getOnlineRateData(data:any) {
url: '/harmonic-boot/PollutionSubstation/getSubstationInfoById', return request({
method: 'post', url: '/device-boot/terminalOnlineRateData/getOnlineRateData',
data: data method: 'post',
}) data: data
} })
export function getLineInfoById(data:any) { }
return request({ export function getSubstationInfoById(data:any) {
url: '/harmonic-boot/PollutionSubstation/getLineInfoById', return request({
method: 'post', url: '/harmonic-boot/PollutionSubstation/getSubstationInfoById',
data: data method: 'post',
}) data: data
} })
export function getLineRank(data:any) { }
return request({ export function getLineInfoById(data:any) {
url: '/harmonic-boot/PollutionSubstation/getLineRank', return request({
method: 'post', url: '/harmonic-boot/PollutionSubstation/getLineInfoById',
data: data method: 'post',
}) data: data
} })
export function deptInfo(data:any) { }
return request({ export function getLineRank(data:any) {
url: '/harmonic-boot/detailAnalysis/deptInfo', return request({
method: 'post', url: '/harmonic-boot/PollutionSubstation/getLineRank',
data: data method: 'post',
}) data: data
} })
export function getXbLineInfoById(data:any) { }
return request({ export function deptInfo(data:any) {
url: '/harmonic-boot/detailAnalysis/getXbLineInfoById', return request({
method: 'post', url: '/harmonic-boot/detailAnalysis/deptInfo',
data: data method: 'post',
}) data: data
} })
export function getSubInfoById(data:any) { }
return request({ export function getXbLineInfoById(data:any) {
url: '/harmonic-boot/detailAnalysis/getSubInfoById', return request({
method: 'post', url: '/harmonic-boot/detailAnalysis/getXbLineInfoById',
data: data method: 'post',
}) data: data
} })
export function getXbLineRank(data:any) { }
return request({ export function getSubInfoById(data:any) {
url: '/harmonic-boot/detailAnalysis/getXbLineRank', return request({
method: 'post', url: '/harmonic-boot/detailAnalysis/getSubInfoById',
data: data method: 'post',
}) data: data
} })
// 数据补招 }
export function FullRecall(data:any) { export function getXbLineRank(data:any) {
return request({ return request({
url: '/data-processing-boot/data/FullRecall', url: '/harmonic-boot/detailAnalysis/getXbLineRank',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 数据补招
export function FullRecall(data:any) {
return request({
url: '/data-processing-boot/data/FullRecall',
method: 'post',
data: data
})
}

View File

@@ -0,0 +1,119 @@
import request from '@/utils/request'
// 主要监测点列表查询>>分页
export function mainLineList(data: any) {
return request({
url: '/harmonic-boot/mainLine/list',
method: 'post',
data: data
})
}
// 主要监测点指标越限详情
export function statLimitRateDetails(data: any) {
return request({
url: '/harmonic-boot/mainLine/statLimitRateDetails',
method: 'post',
data: data
})
}
// 查询监测点列表=全部>>不分页
export function cslineList(data: any) {
return request({
url: '/cs-device-boot/csline/list',
method: 'post',
data: data
})
}
// 监测点详情 趋势图数据
export function trendData(data: any) {
return request({
url: '/cs-device-boot/csGroup/trendData',
method: 'post',
data: data
})
}
// 每日越限占比统计
export function totalLimitStatisticsDetails(data: any) {
return request({
url: '/harmonic-boot/totalLimitStatistics/details',
method: 'post',
data: data
})
}
// 总体指标越限统计列表
export function totalLimitStatisticsList(data: any) {
return request({
url: '/harmonic-boot/totalLimitStatistics/list',
method: 'post',
data: data
})
}
// 总体指标越限统计数据
export function totalLimitStatisticsData(data: any) {
return request({
url: '/harmonic-boot/totalLimitStatistics/data',
method: 'post',
data: data
})
}
// 指标越限程度数据
export function limitExtentData(data: any) {
return request({
url: '/harmonic-boot/limitRateDetailD/limitExtentData',
method: 'post',
data: data
})
}
// 指标日趋势图数据
export function limitExtentDayData(data: any) {
return request({
url: '/harmonic-boot/limitRateDetailD/limitExtentDayData',
method: 'post',
data: data
})
}
// 指标越限明细日历数据
export function limitCalendarData(data: any) {
return request({
url: '/harmonic-boot/limitRateDetailD/limitCalendarData',
method: 'post',
data: data
})
}
//指标拟合图数据
export function fittingData(data: any) {
return request({
url: '/cs-device-boot/csGroup/fittingData',
method: 'post',
data: data
})
}
//指标越限时间概率分布
export function limitTimeProbabilityData(data: any) {
return request({
url: '/harmonic-boot/limitRateDetailD/limitTimeProbabilityData',
method: 'post',
data: data
})
}
//指标越限程度概率分布
export function limitProbabilityData(data: any) {
return request({
url: '/harmonic-boot/limitRateDetailD/limitProbabilityData',
method: 'post',
data: data
})
}

View File

@@ -1,18 +1,48 @@
import request from '@/utils/request' import request from '@/utils/request'
import { genFileId, ElMessage, ElNotification } from 'element-plus'
export function getHistoryResult(data: any) { export function getHistoryResult(data: any) {
return request({ return request({
url: '/harmonic-boot/harmonic/getHistoryResult', url: '/harmonic-boot/harmonic/getHistoryResult',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// word报告 // word报告
export function exportModelJB(data: any) { export function exportModelJB(data: any) {
return request({ return request({
url: '/harmonic-boot/exportmodel/exportModelJB', url: '/harmonic-boot/exportmodel/exportModelJB',
method: 'post', method: 'post',
responseType: 'blob', responseType: 'blob',
data: data data: data
}) }).then(async res => {
} let load: any = await readJsonBlob(res)
if (load.code) {
if (load.data.code == 'A0011') {
ElMessage.warning('下载失败!')
} else {
ElMessage.warning(load.data.message)
}
} else {
return res
}
})
}
async function readJsonBlob(blob) {
try {
// 1. Blob.text() 读取二进制 → 直接转为 字符串(自动处理编码)
const jsonStr = await blob.text()
// 2. JSON.parse 解析字符串 → 得到可用的 JS 对象/数组
const jsonData = JSON.parse(jsonStr)
// 3. 拿到数据,后续随便用
return {
code: true,
data: jsonData
}
} catch (err) {
return {
code: false,
data: {}
}
// console.error('解析Blob的JSON数据失败', err)
}
}

View File

@@ -6,7 +6,7 @@ export function getUndocumentednonlinearData() {
method: 'get' method: 'get'
}) })
} }
//获取入网评估报告审核数据 //获取系统接入方案审核数据
export function getReportreviewData() { export function getReportreviewData() {
return createAxios({ return createAxios({
url: '/Process-supervision/Reportreview/getReportreview', url: '/Process-supervision/Reportreview/getReportreview',

View File

@@ -1,10 +1,60 @@
import createAxios from '@/utils/request' import createAxios from '@/utils/request'
import { genFileId, ElMessage, ElNotification } from 'element-plus'
export function exportModel(data: any) {
return createAxios({ export function exportModel(data: any) {
url: '/harmonic-boot/exportmodel/exportModel', return createAxios({
method: 'post', url: '/harmonic-boot/exportmodel/exportModel',
data: data, method: 'post',
responseType: 'blob' data: data,
}) responseType: 'blob'
} }).then(async res => {
let load: any = await readJsonBlob(res)
if (load.code) {
if (load.data.code == 'A0011') {
ElMessage.warning('下载失败!')
} else {
ElMessage.warning(load.data.message)
}
} else {
return res
}
})
}
export function areaHarmonicReport(data: any) {
return createAxios({
url: '/harmonic-boot/areaHarmonicReport/areaHarmonicReport',
method: 'post',
data: data,
responseType: 'blob'
}).then(async res => {
let load: any = await readJsonBlob(res)
if (load.code) {
if (load.data.code == 'A0011') {
ElMessage.warning('下载失败!')
} else {
ElMessage.warning(load.data.message)
}
} else {
return res
}
})
}
async function readJsonBlob(blob) {
try {
// 1. Blob.text() 读取二进制 → 直接转为 字符串(自动处理编码)
const jsonStr = await blob.text()
// 2. JSON.parse 解析字符串 → 得到可用的 JS 对象/数组
const jsonData = JSON.parse(jsonStr)
// 3. 拿到数据,后续随便用
return {
code: true,
data: jsonData
}
} catch (err) {
return {
code: false,
data: {}
}
// console.error('解析Blob的JSON数据失败', err)
}
}

View File

@@ -0,0 +1,42 @@
import request from "@/utils/request";
//查询所有模板
export function getList(data: any) {
return request({
url: "/system-boot/EventTemplate/getList",
method: "post",
data,
});
}
//字典树
export function getDictTree(data: any) {
return request({
url: "/system-boot/reportDict/DictTree",
method: "post",
params:data
});
}
//新增模板
export function addData(data: any) {
return request({
url: "/system-boot/EventTemplate/add",
method: "post",
data,
});
}
//修改模板
export function updateData(data: any) {
return request({
url: "/system-boot/EventTemplate/update",
method: "post",
data,
});
}
//删除模板
export function deleteData(data: any) {
return request({
url: "/system-boot/EventTemplate/delete",
method: "post",
data,
});
}

View File

@@ -0,0 +1,43 @@
import request from '@/utils/request'
//获取字典树数据
export function getDictTree(data) {
return request({
url: "/system-boot/reportDict/DictTree",
method: "post",
params:data
});
}
//查询字典列表
export function getReportDictList(data: any) {
return request({
url: "/system-boot/reportDict/getReportDictList",
method: "post",
data
});
}
//新增字典表
export function addDict(data: any) {
return request({
url: "/system-boot/reportDict/addDict",
method: "post",
data
});
}
//更新字典表
export function updateDict(data: any) {
return request({
url: "/system-boot/reportDict/updateDict",
method: "put",
data
});
}
//删除字典表
export function deleteDict(data: any) {
return request({
url: "/system-boot/reportDict/deleteDict",
method: "delete",
params:data
});
}

View File

@@ -0,0 +1,37 @@
import request from '@/utils/request'
//区域树形表格接口
export function areaTree(data: any) {
return request({
url: '/system-boot/area/areaTree',
method: 'post',
params: data,
})
}
export function areaAdd(data: any) {
return request({
url: '/system-boot/area/add',
method: 'post',
data: data,
})
}
export function areaDelete(data: any) {
return request({
url: '/system-boot/area/delete',
method: 'post',
data: data,
})
}
export function update(data: any) {
return request({
url: '/system-boot/area/update',
method: 'post',
data: data,
})
}
export function selectPid(data: any) {
return request({
url: '/system-boot/area/selectPid',
method: 'post',
data: data,
})
}

View File

@@ -1,70 +1,87 @@
import createAxios from '@/utils/request' import createAxios from '@/utils/request'
// 查询指标 // 查询指标
export const queryStatistical = (id: string) => { export const queryStatistical = (id:string) => {
let form = new FormData() let form = new FormData()
form.append('id', id) form.append('id', id)
return createAxios({ return createAxios({
url: '/system-boot/csstatisticalset/queryStatistical', url: '/system-boot/csstatisticalset/queryStatistical',
method: 'post', method: 'post',
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
data: form data: form
}) })
} }
// 绑定指标 // 绑定指标
export const addStatistical = (params: any) => { export const addStatistical = (params:any) => {
return createAxios({ return createAxios({
url: '/system-boot/csstatisticalset/addStatistical', url: '/system-boot/csstatisticalset/addStatistical',
method: 'post', method: 'post',
data: params data: params
}) })
} }
// 新增驾驶舱页面
export const addDashboard = (data: any) => { // 新增驾驶舱页面
return createAxios({ export const addDashboard = (data: any) => {
url: '/system-boot/dashboard/addDashboard', return createAxios({
method: 'post', url: '/system-boot/dashboard/addDashboard',
data: data method: 'post',
}) data: data
} })
// 修改驾驶舱页面 }
export const updateDashboard = (data: any) => { // 修改驾驶舱页面
return createAxios({ export const updateDashboard = (data: any) => {
url: '/system-boot/dashboard/updateDashboard', return createAxios({
method: 'post', url: '/system-boot/dashboard/updateDashboard',
data: data method: 'post',
}) data: data
} })
// 删除驾驶舱页面 }
export const deleteDashboard = (params: any) => { // 删除驾驶舱页面
return createAxios({ export const deleteDashboard = (params: any) => {
url: '/system-boot/dashboard/deleteDashboard', return createAxios({
method: 'post', url: '/system-boot/dashboard/deleteDashboard',
params method: 'post',
}) params
} })
// 激活的驾驶舱页面 }
export const activatePage = (params: any) => { // 激活的驾驶舱页面
return createAxios({ export const activatePage = (params: any) => {
url: '/system-boot/dashboard/activatePage', return createAxios({
method: 'post', url: '/system-boot/dashboard/activatePage',
params method: 'post',
}) params
} })
// 查询激活的驾驶舱页面 }
export const queryActivatePage = () => { // 查询激活的驾驶舱页面
return createAxios({ export const queryActivatePage = () => {
url: '/system-boot/dashboard/queryActivatePage', return createAxios({
method: 'post' url: '/system-boot/dashboard/queryActivatePage',
}) method: 'post'
} })
// 更具id 查询驾驶舱页面 }
export const queryById = (params: any) => { // 更具id 查询驾驶舱页面
return createAxios({ export const queryById = (params: any) => {
url: '/system-boot/dashboard/queryById', return createAxios({
method: 'post', url: '/system-boot/dashboard/queryById',
params method: 'post',
}) params
} })
}
// 更具id 查询驾驶舱页面
export const queryByPagePath = (params: any) => {
return createAxios({
url: '/system-boot/dashboard/queryByPagePath',
method: 'post',
params
})
}
// 根据用户id查询用户驾驶舱
export const getDashboardPageByUserId = (params: any) => {
return createAxios({
url: '/system-boot/dashboard/getDashboardPageByUserId',
method: 'post',
params
})
}

View File

@@ -1,5 +1,5 @@
import createAxios from '@/utils/request' import createAxios from '@/utils/request'
import { ElMessage } from 'element-plus'
const SYSTEM_PREFIX = '/system-boot' const SYSTEM_PREFIX = '/system-boot'
/** /**
@@ -7,8 +7,20 @@ const SYSTEM_PREFIX = '/system-boot'
* @param file * @param file
*/ */
export const uploadFile = (file: any, path: string) => { export const uploadFile = (file: any, path: string) => {
const regex = /\[|\]/g
// 替换规则:[ 换成 (] 换成 )
const newFile = new File(
[file], // 原文件的二进制内容
file.name.replace(regex, match => (match === '[' ? '(' : ')')), // 新的文件名
{
type: file.type, // 复用原文件的MIME类型
lastModified: file.lastModified // 复用最后修改时间
}
)
let form = new FormData() let form = new FormData()
form.append('file', file) form.append('file', newFile)
form.append('path', path) form.append('path', path)
return createAxios({ return createAxios({
url: SYSTEM_PREFIX + '/file/upload', url: SYSTEM_PREFIX + '/file/upload',
@@ -17,6 +29,11 @@ export const uploadFile = (file: any, path: string) => {
'Content-Type': 'multipart/form-data' 'Content-Type': 'multipart/form-data'
}, },
data: form data: form
}).then(res => {
if (res.code == `A0000`) {
ElMessage.success('文件上传成功!')
return res
}
}) })
} }
@@ -50,7 +67,7 @@ export const downloadFile = (filePath: any) => {
/** /**
* 获取文件的短期url展示 * 获取文件的短期url展示
*/ */
export const getFileUrl = (params:any) => { export const getFileUrl = (params: any) => {
let form = new FormData() let form = new FormData()
// form.append('filePath', filePath) // form.append('filePath', filePath)
return createAxios({ return createAxios({

View File

@@ -1,49 +1,49 @@
import request from '@/config/axios' import { requestData, requestDownload } from '@/utils/request'
export type DictDataVO = { export type DictDataVO = {
id: number | undefined id: number | undefined
sort: number | undefined sort: number | undefined
label: string label: string
value: string value: string
dictType: string dictType: string
status: number status: number
colorType: string colorType: string
cssClass: string cssClass: string
remark: string remark: string
createTime: Date createTime: Date
} }
// 查询字典数据(精简)列表 // 查询字典数据(精简)列表
export const getSimpleDictDataList = () => { export const getSimpleDictDataList = () => {
return request.get({ url: '/system/dict-data/simple-list' }) return requestData({ url: '/system/dict-data/simple-list', method: 'GET' })
} }
// 查询字典数据列表 // 查询字典数据列表
export const getDictDataPage = (params: PageParam) => { export const getDictDataPage = (params: PageParam) => {
return request.get({ url: '/system/dict-data/page', params }) return requestData({ url: '/system/dict-data/page', method: 'GET', params })
} }
// 查询字典数据详情 // 查询字典数据详情
export const getDictData = (id: number) => { export const getDictData = (id: number) => {
return request.get({ url: '/system/dict-data/get?id=' + id }) return requestData({ url: '/system/dict-data/get?id=' + id, method: 'GET' })
} }
// 新增字典数据 // 新增字典数据
export const createDictData = (data: DictDataVO) => { export const createDictData = (data: DictDataVO) => {
return request.post({ url: '/system/dict-data/create', data }) return requestData({ url: '/system/dict-data/create', method: 'POST', data })
} }
// 修改字典数据 // 修改字典数据
export const updateDictData = (data: DictDataVO) => { export const updateDictData = (data: DictDataVO) => {
return request.put({ url: '/system/dict-data/update', data }) return requestData({ url: '/system/dict-data/update', method: 'PUT', data })
} }
// 删除字典数据 // 删除字典数据
export const deleteDictData = (id: number) => { export const deleteDictData = (id: number) => {
return request.delete({ url: '/system/dict-data/delete?id=' + id }) return requestData({ url: '/system/dict-data/delete?id=' + id, method: 'DELETE' })
} }
// 导出字典类型数据 // 导出字典类型数据
export const exportDictData = (params) => { export const exportDictData = (params) => {
return request.download({ url: '/system/dict-data/export', params }) return requestDownload({ url: '/system/dict-data/export', method: 'GET', params, responseType: 'blob' })
} }

View File

@@ -1,44 +1,45 @@
import request from '@/config/axios' import { requestData, requestDownload } from '@/utils/request'
export type DictTypeVO = { export type DictTypeVO = {
id: number | undefined id: number | undefined
name: string name: string
type: string type: string
status: number status: number
remark: string remark: string
createTime: Date createTime: Date
} }
// 查询字典(精简)列表 // 查询字典(精简)列表
export const getSimpleDictTypeList = () => { export const getSimpleDictTypeList = () => {
return request.get({ url: '/system/dict-type/list-all-simple' }) return requestData({ url: '/system/dict-type/list-all-simple', method: 'GET' })
} }
// 查询字典列表 // 查询字典列表
export const getDictTypePage = (params: PageParam) => { export const getDictTypePage = (params: PageParam) => {
return request.get({ url: '/system/dict-type/page', params }) return requestData({ url: '/system/dict-type/page', method: 'GET', params })
} }
// 查询字典详情 // 查询字典详情
export const getDictType = (id: number) => { export const getDictType = (id: number) => {
return request.get({ url: '/system/dict-type/get?id=' + id }) return requestData({ url: '/system/dict-type/get?id=' + id, method: 'GET' })
} }
// 新增字典 // 新增字典
export const createDictType = (data: DictTypeVO) => { export const createDictType = (data: DictTypeVO) => {
return request.post({ url: '/system/dict-type/create', data }) return requestData({ url: '/system/dict-type/create', method: 'POST', data })
} }
// 修改字典 // 修改字典
export const updateDictType = (data: DictTypeVO) => { export const updateDictType = (data: DictTypeVO) => {
return request.put({ url: '/system/dict-type/update', data }) return requestData({ url: '/system/dict-type/update', method: 'PUT', data })
} }
// 删除字典 // 删除字典
export const deleteDictType = (id: number) => { export const deleteDictType = (id: number) => {
return request.delete({ url: '/system/dict-type/delete?id=' + id }) return requestData({ url: '/system/dict-type/delete?id=' + id, method: 'DELETE' })
} }
// 导出字典类型
export const exportDictType = (params) => { // 导出字典类型
return request.download({ url: '/system/dict-type/export', params }) export const exportDictType = (params) => {
} return requestDownload({ url: '/system/dict-type/export', method: 'GET', params, responseType: 'blob' })
}

View File

@@ -1,49 +1,50 @@
import request from '@/config/axios' import { requestData } from '@/utils/request'
import qs from 'qs' import qs from 'qs'
export interface NotifyMessageVO { export interface NotifyMessageVO {
id: number id: number
userId: number userId: number
userType: number userType: number
templateId: number templateId: number
templateCode: string templateCode: string
templateNickname: string templateNickname: string
templateContent: string templateContent: string
templateType: number templateType: number
templateParams: string templateParams: string
readStatus: boolean readStatus: boolean
readTime: Date readTime: Date
createTime: Date createTime: Date
} }
// 查询站内信消息列表 // 查询站内信消息列表
export const getNotifyMessagePage = async (params: PageParam) => { export const getNotifyMessagePage = async (params: any) => {
return await request.get({ url: '/system/notify-message/page', params }) return await requestData({ url: '/system/notify-message/page', method: 'GET', params })
} }
// 获得我的站内信分页 // 获得我的站内信分页
export const getMyNotifyMessagePage = async (params: PageParam) => { export const getMyNotifyMessagePage = async (params: any) => {
return await request.get({ url: '/system/notify-message/my-page', params }) return await requestData({ url: '/system/notify-message/my-page', method: 'GET', params })
} }
// 批量标记已读 // 批量标记已读
export const updateNotifyMessageRead = async (ids) => { export const updateNotifyMessageRead = async (ids: any) => {
return await request.put({ return await requestData({
url: '/system/notify-message/update-read?' + qs.stringify({ ids: ids }, { indices: false }) url: '/system/notify-message/update-read?' + qs.stringify({ ids: ids }, { indices: false }),
}) method: 'PUT'
} })
}
// 标记所有站内信为已读
export const updateAllNotifyMessageRead = async () => { // 标记所有站内信为已读
return await request.put({ url: '/system/notify-message/update-all-read' }) export const updateAllNotifyMessageRead = async () => {
} return await requestData({ url: '/system/notify-message/update-all-read', method: 'PUT' })
}
// 获取当前用户的最新站内信列表
export const getUnreadNotifyMessageList = async () => { // 获取当前用户的最新站内信列表
return await request.get({ url: '/system/notify-message/get-unread-list' }) export const getUnreadNotifyMessageList = async () => {
} return await requestData({ url: '/system/notify-message/get-unread-list', method: 'GET' })
}
// 获得当前用户的未读站内信数量
export const getUnreadNotifyMessageCount = async () => { // 获得当前用户的未读站内信数量
return await request.get({ url: '/system/notify-message/get-unread-count' }) export const getUnreadNotifyMessageCount = async () => {
} return await requestData({ url: '/system/notify-message/get-unread-count', method: 'GET' })
}

View File

@@ -1,49 +1,49 @@
import request from '@/config/axios' import { requestData } from '@/utils/request'
export interface NotifyTemplateVO { export interface NotifyTemplateVO {
id?: number id?: number
name: string name: string
nickname: string nickname: string
code: string code: string
content: string content: string
type?: number type?: number
params: string params: string
status: number status: number
remark: string remark: string
} }
export interface NotifySendReqVO { export interface NotifySendReqVO {
userId: number | null userId: number | null
templateCode: string templateCode: string
templateParams: Map<String, Object> templateParams: Map<String, Object>
} }
// 查询站内信模板列表 // 查询站内信模板列表
export const getNotifyTemplatePage = async (params: PageParam) => { export const getNotifyTemplatePage = async (params: PageParam) => {
return await request.get({ url: '/system/notify-template/page', params }) return await requestData({ url: '/system/notify-template/page', method: 'GET', params })
} }
// 查询站内信模板详情 // 查询站内信模板详情
export const getNotifyTemplate = async (id: number) => { export const getNotifyTemplate = async (id: number) => {
return await request.get({ url: '/system/notify-template/get?id=' + id }) return await requestData({ url: '/system/notify-template/get?id=' + id, method: 'GET' })
} }
// 新增站内信模板 // 新增站内信模板
export const createNotifyTemplate = async (data: NotifyTemplateVO) => { export const createNotifyTemplate = async (data: NotifyTemplateVO) => {
return await request.post({ url: '/system/notify-template/create', data }) return await requestData({ url: '/system/notify-template/create', method: 'POST', data })
} }
// 修改站内信模板 // 修改站内信模板
export const updateNotifyTemplate = async (data: NotifyTemplateVO) => { export const updateNotifyTemplate = async (data: NotifyTemplateVO) => {
return await request.put({ url: '/system/notify-template/update', data }) return await requestData({ url: '/system/notify-template/update', method: 'PUT', data })
} }
// 删除站内信模板 // 删除站内信模板
export const deleteNotifyTemplate = async (id: number) => { export const deleteNotifyTemplate = async (id: number) => {
return await request.delete({ url: '/system/notify-template/delete?id=' + id }) return await requestData({ url: '/system/notify-template/delete?id=' + id, method: 'DELETE' })
} }
// 发送站内信 // 发送站内信
export const sendNotify = (data: NotifySendReqVO) => { export const sendNotify = (data: NotifySendReqVO) => {
return request.post({ url: '/system/notify-template/send-notify', data }) return requestData({ url: '/system/notify-template/send-notify', method: 'POST', data })
} }

View File

@@ -1,215 +1,250 @@
import request from '@/utils/request' import request from '@/utils/request'
import { LoginData } from '@/api/types' import { LoginData } from '@/api/types'
import { useAdminInfo } from '@/stores/adminInfo' import { useAdminInfo } from '@/stores/adminInfo'
import { sm3Digest } from '@/assets/commjs/sm3.js' import { sm3Digest } from '@/assets/commjs/sm3.js'
import { sm2, encrypt } from '@/assets/commjs/sm2.js' import { sm2, encrypt } from '@/assets/commjs/sm2.js'
// 获取公钥 // 获取公钥
export function gongkey(params?: any) { export function gongkey(params?: any) {
if (!params) { if (!params) {
const adminInfo = useAdminInfo() const adminInfo = useAdminInfo()
params = { params = {
loginName: encrypt(adminInfo.$state.loginName) loginName: encrypt(adminInfo.$state.loginName)
} }
} }
return request({ return request({
url: '/user-boot/user/generateSm2Key', url: '/user-boot/user/generateSm2Key',
method: 'get', method: 'get',
params params
}) })
} }
export async function pwdSm3(pwd: any, loginName?: string) { export async function pwdSm3(pwd: any, loginName?: string) {
let publicKey = await gongkey( let publicKey = await gongkey(
loginName loginName
? { ? {
loginName: encrypt(loginName) loginName: encrypt(loginName)
} }
: false : false
) )
let sm3Pwd = sm3Digest(pwd) //SM3加密 let sm3Pwd = sm3Digest(pwd) //SM3加密
return sm2(sm3Pwd + '|' + pwd, publicKey.data, 0) return sm2(sm3Pwd + '|' + pwd, publicKey.data, 0)
} }
//登录获取token //登录获取token
export async function login(params: any) { export async function login(params: any) {
if (params.refresh_token == undefined) { if (params.refresh_token == undefined) {
params.password = await pwdSm3(params.password, params.username) params.password = await pwdSm3(params.password, params.username)
} }
params.username = encrypt(params.username) params.username = encrypt(params.username)
return request({ return request({
url: '/pqs-auth/oauth/token', url: '/pqs-auth/oauth/token',
method: 'post', method: 'post',
params params
}) })
} }
//辽宁嵌入登录获取token
//获取用户信息 export async function loginLNqr(data: any) {
export function getUserById() { return request({
const adminInfo = useAdminInfo() url: '/pqs-auth/oauth/lnLogin',
return request({ method: 'get',
url: '/user-boot/user/getUserById?id=' + adminInfo.userIndex, params: data
method: 'get' })
}) }
}
export async function lnRefreshToken(data: any) {
// 刷新token return request({
// 导出一个名为refreshToken的函数该函数返回一个Promise对象 url: '/pqs-auth/oauth/lnRefreshToken',
export function refreshToken(): Promise<any> { method: 'get',
// 调用useAdminInfo函数获取管理员信息并将其赋值给adminInfo变量 params: data
const adminInfo = useAdminInfo() })
// 调用login函数传入一个对象作为参数该对象包含grant_type、refresh_token和username三个属性 }
// grant_type设置为'refresh_token',表示使用刷新令牌的方式获取新的访问令牌
// refresh_token使用adminInfo中的refresh_token属性 export async function logout() {
// username使用adminInfo中的loginName属性 return request({
// 返回login函数的调用结果即一个Promise对象 url: '/pqs-auth/oauth/logout',
return login({ method: 'DELETE',
grant_type: 'refresh_token', })
refresh_token: adminInfo.refresh_token, }
username: adminInfo.loginName
})
} //获取用户信息
export function getUserById() {
/** const adminInfo = useAdminInfo()
* 获取营销用户列表 return request({
* @returns {AxiosPromise} url: '/user-boot/user/getUserById?id=' + adminInfo.userIndex,
*/ method: 'get'
export const getMarketList = () => { })
return request({ }
url: '/user-boot/user/getMarketList',
method: 'post' // 刷新token
}) // 导出一个名为refreshToken的函数该函数返回一个Promise对象
} export function refreshToken(): Promise<any> {
// 调用useAdminInfo函数获取管理员信息并将其赋值给adminInfo变量
export function add(data: any) { const adminInfo = useAdminInfo()
return request({ // 调用login函数传入一个对象作为参数该对象包含grant_type、refresh_token和username三个属性
url: '/user-boot/user/add', // grant_type设置为'refresh_token',表示使用刷新令牌的方式获取新的访问令牌
method: 'post', // refresh_token使用adminInfo中的refresh_token属性
data: data // username使用adminInfo中的loginName属性
}) // 返回login函数的调用结果即一个Promise对象
} return login({
grant_type: 'refresh_token',
export function edit(data: any) { refresh_token: adminInfo.refresh_token,
return request({ username: adminInfo.loginName
url: '/user-boot/user/update', })
method: 'put', }
data: data
})
} export function lnRefreshTokenTo(): Promise<any> {
// 调用useAdminInfo函数获取管理员信息并将其赋值给adminInfo变量
export async function passwordConfirm(pwd: string) { const adminInfo = useAdminInfo()
return request({ return lnRefreshToken({
url: '/user-boot/user/passwordConfirm?password=' + (await pwdSm3(pwd)), refreshToken: adminInfo.refresh_token,
method: 'get' clientId: "njcn",
}) clientSecret:"njcnpqs"
} })
}
export function deluser(data: any) {
return request({ /**
url: '/user-boot/user/delete', * 获取营销用户列表
method: 'delete', * @returns {AxiosPromise}
params: data */
}) export const getMarketList = () => {
} return request({
url: '/user-boot/user/getMarketList',
export function activateUser(data: any) { method: 'post'
return request({ })
url: '/user-boot/user/activateUser', }
method: 'put',
params: data export function add(data: any) {
}) return request({
} url: '/user-boot/user/add',
method: 'post',
export async function updatePassword(params: any) { data: data
return request({ })
url: '/user-boot/user/updatePassword', }
method: 'put',
params: { export function edit(data: any) {
id: params.id, return request({
newPassword: await pwdSm3(params.newPassword) url: '/user-boot/user/update',
} method: 'put',
}) data: data
} })
}
export async function updateFirstPassword(params: any) {
return request({ export async function passwordConfirm(pwd: string) {
url: '/user-boot/user/updateFirstPassword', return request({
method: 'put', url: '/user-boot/user/passwordConfirm?password=' + (await pwdSm3(pwd)),
data: { method: 'get'
name: encrypt(params.name), })
password: await pwdSm3(params.password, params.name) }
}
}) export function deluser(data: any) {
} return request({
url: '/user-boot/user/delete',
export function checkUser(data: any) { method: 'delete',
return request({ params: data
url: '/user-boot/user/check', })
method: 'put', }
data: data
}) export function activateUser(data: any) {
} return request({
export function existMonitorDeptTree() { url: '/user-boot/user/activateUser',
return request({ method: 'put',
url: '/user-boot/dept/existMonitorDeptTree', params: data
method: 'post' })
}) }
}
// 获取用户 export async function updatePassword(params: any) {
export function getUserByRoleType(data: any) { return request({
return request({ url: '/user-boot/user/updatePassword',
url: '/user-boot/user/getUserByRoleType?roleType=' + data, method: 'put',
method: 'GET' params: {
}) id: params.id,
} newPassword: await pwdSm3(params.newPassword)
}
// 获取部门下所有用户 })
export function listAllUserByDeptId(data: any) { }
return request({
url: '/user-boot/user/listAllUserByDeptId?deptId=' + data, export async function updateFirstPassword(params: any) {
method: 'GET' return request({
}) url: '/user-boot/user/updateFirstPassword',
} method: 'put',
data: {
// 根据id获取所有用户信息 name: encrypt(params.name),
export function getUserListByIds(data: any) { password: await pwdSm3(params.password, params.name)
return request({ }
url: '/user-boot/user/getUserListByIds', })
method: 'POST', }
data
}) export function checkUser(data: any) {
} return request({
url: '/user-boot/user/check',
/** method: 'put',
* 查询所有用户不包括管理员 data: data
*/ })
export const getUserSimpleList = () => { }
return request({ export function existMonitorDeptTree() {
url: '/user-boot/user/simpleList', return request({
method: 'GET' url: '/user-boot/dept/existMonitorDeptTree',
}) method: 'post'
} })
}
/** // 获取用户
* 查询所有用户包括管理员 export function getUserByRoleType(data: any) {
*/ return request({
export const getAllUserSimpleList = () => { url: '/user-boot/user/getUserByRoleType?roleType=' + data,
return request({ method: 'GET'
url: '/user-boot/user/getAllUserSimpleList', })
method: 'GET' }
})
} // 获取部门下所有用户
export function listAllUserByDeptId(data: any) {
export const getSysConfig = () => { return request({
return request({ url: '/user-boot/user/listAllUserByDeptId?deptId=' + data,
url: '/system-boot/config/getSysConfig', method: 'GET'
method: 'get' })
}) }
}
// 驾驶舱组件配置 // 根据id获取所有用户信息
export const componentTree = () => { export function getUserListByIds(data: any) {
return request({ return request({
url: '/user-boot/component/componentTree', url: '/user-boot/user/getUserListByIds',
method: 'GET' method: 'POST',
}) data
} })
}
/**
* 查询所有用户不包括管理员
*/
export const getUserSimpleList = () => {
return request({
url: '/user-boot/user/simpleList',
method: 'GET'
})
}
/**
* 查询所有用户包括管理员
*/
export const getAllUserSimpleList = () => {
return request({
url: '/user-boot/user/getAllUserSimpleList',
method: 'GET'
})
}
export const getSysConfig = () => {
return request({
url: '/system-boot/config/getSysConfig',
method: 'get'
})
}
// 驾驶舱组件配置
export const componentTree = () => {
return request({
url: '/user-boot/component/componentTree',
method: 'GET'
})
}

View File

@@ -54,6 +54,54 @@
<div class="content unicode" style="display: block;"> <div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box"> <ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe782;</span>
<div class="name">253_ipower</div>
<div class="code-name">&amp;#xe782;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe665;</span>
<div class="name">电压</div>
<div class="code-name">&amp;#xe665;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe758;</span>
<div class="name">三相电压幅值不平衡</div>
<div class="code-name">&amp;#xe758;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe61e;</span>
<div class="name">电压总谐波畸变率</div>
<div class="code-name">&amp;#xe61e;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe612;</span>
<div class="name">闪变</div>
<div class="code-name">&amp;#xe612;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe65d;</span>
<div class="name">停运事件管理</div>
<div class="code-name">&amp;#xe65d;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe604;</span>
<div class="name">在运设备</div>
<div class="code-name">&amp;#xe604;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe666;</span>
<div class="name">异常类_14非智能表在运异常</div>
<div class="code-name">&amp;#xe666;</div>
</li>
<li class="dib"> <li class="dib">
<span class="icon iconfont">&#xe82f;</span> <span class="icon iconfont">&#xe82f;</span>
<div class="name">综合评价</div> <div class="name">综合评价</div>
@@ -234,9 +282,9 @@
<pre><code class="language-css" <pre><code class="language-css"
>@font-face { >@font-face {
font-family: 'iconfont'; font-family: 'iconfont';
src: url('iconfont.woff2?t=1744179175277') format('woff2'), src: url('iconfont.woff2?t=1765612648830') format('woff2'),
url('iconfont.woff?t=1744179175277') format('woff'), url('iconfont.woff?t=1765612648830') format('woff'),
url('iconfont.ttf?t=1744179175277') format('truetype'); url('iconfont.ttf?t=1765612648830') format('truetype');
} }
</code></pre> </code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3> <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -262,6 +310,78 @@
<div class="content font-class"> <div class="content font-class">
<ul class="icon_lists dib-box"> <ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-a-253_ipower"></span>
<div class="name">
253_ipower
</div>
<div class="code-name">.icon-a-253_ipower
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-dianya"></span>
<div class="name">
电压
</div>
<div class="code-name">.icon-dianya
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-sanxiangdianyafuzhibupingheng"></span>
<div class="name">
三相电压幅值不平衡
</div>
<div class="code-name">.icon-sanxiangdianyafuzhibupingheng
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-dianyazongxiebojibianshuai"></span>
<div class="name">
电压总谐波畸变率
</div>
<div class="code-name">.icon-dianyazongxiebojibianshuai
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-shanbian"></span>
<div class="name">
闪变
</div>
<div class="code-name">.icon-shanbian
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-tingyunshijianguanli"></span>
<div class="name">
停运事件管理
</div>
<div class="code-name">.icon-tingyunshijianguanli
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-zaiyunshebei"></span>
<div class="name">
在运设备
</div>
<div class="code-name">.icon-zaiyunshebei
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-yichanglei_14feizhinengbiaozaiyunyichang"></span>
<div class="name">
异常类_14非智能表在运异常
</div>
<div class="code-name">.icon-yichanglei_14feizhinengbiaozaiyunyichang
</div>
</li>
<li class="dib"> <li class="dib">
<span class="icon iconfont icon-zonghepingjia1"></span> <span class="icon iconfont icon-zonghepingjia1"></span>
<div class="name"> <div class="name">
@@ -532,6 +652,70 @@
<div class="content symbol"> <div class="content symbol">
<ul class="icon_lists dib-box"> <ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-a-253_ipower"></use>
</svg>
<div class="name">253_ipower</div>
<div class="code-name">#icon-a-253_ipower</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-dianya"></use>
</svg>
<div class="name">电压</div>
<div class="code-name">#icon-dianya</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-sanxiangdianyafuzhibupingheng"></use>
</svg>
<div class="name">三相电压幅值不平衡</div>
<div class="code-name">#icon-sanxiangdianyafuzhibupingheng</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-dianyazongxiebojibianshuai"></use>
</svg>
<div class="name">电压总谐波畸变率</div>
<div class="code-name">#icon-dianyazongxiebojibianshuai</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-shanbian"></use>
</svg>
<div class="name">闪变</div>
<div class="code-name">#icon-shanbian</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-tingyunshijianguanli"></use>
</svg>
<div class="name">停运事件管理</div>
<div class="code-name">#icon-tingyunshijianguanli</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zaiyunshebei"></use>
</svg>
<div class="name">在运设备</div>
<div class="code-name">#icon-zaiyunshebei</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-yichanglei_14feizhinengbiaozaiyunyichang"></use>
</svg>
<div class="name">异常类_14非智能表在运异常</div>
<div class="code-name">#icon-yichanglei_14feizhinengbiaozaiyunyichang</div>
</li>
<li class="dib"> <li class="dib">
<svg class="icon svg-icon" aria-hidden="true"> <svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zonghepingjia1"></use> <use xlink:href="#icon-zonghepingjia1"></use>

View File

@@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 3482754 */ font-family: "iconfont"; /* Project id 3482754 */
src: url('iconfont.woff2?t=1744179175277') format('woff2'), src: url('iconfont.woff2?t=1765612648830') format('woff2'),
url('iconfont.woff?t=1744179175277') format('woff'), url('iconfont.woff?t=1765612648830') format('woff'),
url('iconfont.ttf?t=1744179175277') format('truetype'); url('iconfont.ttf?t=1765612648830') format('truetype');
} }
.iconfont { .iconfont {
@@ -13,6 +13,38 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-a-253_ipower:before {
content: "\e782";
}
.icon-dianya:before {
content: "\e665";
}
.icon-sanxiangdianyafuzhibupingheng:before {
content: "\e758";
}
.icon-dianyazongxiebojibianshuai:before {
content: "\e61e";
}
.icon-shanbian:before {
content: "\e612";
}
.icon-tingyunshijianguanli:before {
content: "\e65d";
}
.icon-zaiyunshebei:before {
content: "\e604";
}
.icon-yichanglei_14feizhinengbiaozaiyunyichang:before {
content: "\e666";
}
.icon-zonghepingjia1:before { .icon-zonghepingjia1:before {
content: "\e82f"; content: "\e82f";
} }

File diff suppressed because one or more lines are too long

View File

@@ -5,6 +5,62 @@
"css_prefix_text": "icon-", "css_prefix_text": "icon-",
"description": "", "description": "",
"glyphs": [ "glyphs": [
{
"icon_id": "33424624",
"name": "253_ipower",
"font_class": "a-253_ipower",
"unicode": "e782",
"unicode_decimal": 59266
},
{
"icon_id": "12331657",
"name": "电压",
"font_class": "dianya",
"unicode": "e665",
"unicode_decimal": 58981
},
{
"icon_id": "33073330",
"name": "三相电压幅值不平衡",
"font_class": "sanxiangdianyafuzhibupingheng",
"unicode": "e758",
"unicode_decimal": 59224
},
{
"icon_id": "37400988",
"name": "电压总谐波畸变率",
"font_class": "dianyazongxiebojibianshuai",
"unicode": "e61e",
"unicode_decimal": 58910
},
{
"icon_id": "43700638",
"name": "闪变",
"font_class": "shanbian",
"unicode": "e612",
"unicode_decimal": 58898
},
{
"icon_id": "25458995",
"name": "停运事件管理",
"font_class": "tingyunshijianguanli",
"unicode": "e65d",
"unicode_decimal": 58973
},
{
"icon_id": "35341056",
"name": "在运设备",
"font_class": "zaiyunshebei",
"unicode": "e604",
"unicode_decimal": 58884
},
{
"icon_id": "22630860",
"name": "异常类_14非智能表在运异常",
"font_class": "yichanglei_14feizhinengbiaozaiyunyichang",
"unicode": "e666",
"unicode_decimal": 58982
},
{ {
"icon_id": "32402696", "icon_id": "32402696",
"name": "综合评价", "name": "综合评价",

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
src/assets/img/amplify.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/assets/img/inlogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
src/assets/img/reduce.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
src/assets/img/region.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

295
src/assets/img/view.vue Normal file
View File

@@ -0,0 +1,295 @@
<template>
<div class="default-main">
<!-- <div class=" layoutHeader">
<div class="title">{{title}}</div>
<back-component />
</div> -->
<TableHeader :showSearch="false">
<template v-slot:select>
<el-form-item label="统计时间">
<DatePicker ref="datePickerRef" :nextFlag="false" :theCurrentTime="true"></DatePicker>
</el-form-item>
</template>
<template v-slot:operation>
<back-component />
</template>
</TableHeader>
<GridLayout
v-model:layout="layout"
:row-height="rowHeight"
:is-resizable="false"
:is-draggable="false"
:responsive="false"
:vertical-compact="false"
prevent-collision
:col-num="12"
>
<template #item="{ item }">
<div class="box">
<div class="title">
<div style="display: flex; align-items: center">
<Icon class="HelpFilled" :name="item.icon" />
{{ item.name }}
</div>
<!-- <FullScreen class="HelpFilled" style="cursor: pointer" @click="zoom(item)" /> -->
<img :src="flag ? img : img1" style="cursor: pointer; height: 16px" @click="zoom(item)" />
</div>
<div>
<component
:is="item.component"
v-if="item.component"
class="pd10"
:key="key"
:timeValue="datePickerRef.timeValue"
:height="rowHeight * item.h - seRowHeight(item.h) + 'px'"
:width="rowWidth * item.w - 30 + 'px'"
:timeKey="item.timeKey"
/>
<div v-else class="pd10">组件加载失败...</div>
</div>
</div>
</template>
</GridLayout>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, markRaw, onUnmounted, defineAsyncComponent, type Component } from 'vue'
import { GridLayout } from 'grid-layout-plus'
import { useDebounceFn } from '@vueuse/core'
import { useRouter } from 'vue-router'
import TableHeader from '@/components/table/header/index.vue'
import DatePicker from '@/components/form/datePicker/index.vue'
import BackComponent from '@/components/icon/back/index.vue'
import { queryById } from '@/api/system-boot/csstatisticalset'
import { HelpFilled, FullScreen } from '@element-plus/icons-vue'
import { useRoute } from 'vue-router'
// defineOptions({
// name: 'cockpit/view'
// })
const { query } = useRoute()
// 定义类型
interface LayoutItem {
x: number
y: number
w: number
h: number
i: string | number
name: string
path: string
component?: Component | string
loading?: boolean
error?: any
}
const datePickerRef = ref()
const title = ref('')
const key = ref(0)
const img = new URL(`@/assets/img/amplify.png`, import.meta.url)
const img1 = new URL(`@/assets/img/reduce.png`, import.meta.url)
// 响应式数据
const rowHeight = ref(0)
const rowWidth = ref(0)
const layout: any = ref<LayoutItem[]>([
// {
// x: 4,
// y: 0,
// w: 4,
// h: 2,
// i: '1',
// name: '',
// path: '/src/views/pqs/runManage/assessment/components/uese/index.vue'
// },
])
const layoutCopy = ref<LayoutItem[]>([])
const flag = ref(true)
// 组件映射
const componentMap = reactive(new Map<string, Component | string>())
// 获取主内容区域高度
const getMainHeight = () => {
const elMain = document.querySelector('.el-main')
return (elMain?.offsetHeight || 0) - 70
}
// 获取主内容区域高度
const getMainWidth = () => {
const elMain = document.querySelector('.el-main')
return (elMain?.offsetWidth || 0) - 20
}
// 初始化行高
const initRowHeight = () => {
rowHeight.value = Math.max(0, (getMainHeight() - 72) / 6)
rowWidth.value = Math.max(0, getMainWidth() / 12)
}
// 动态注册组件
const registerComponent = (path: string): Component | string | null => {
if (!path) return null
const cacheKey = path
// 使用缓存的组件
if (componentMap.has(cacheKey)) {
return componentMap.get(cacheKey)!
}
try {
// 动态导入组件
const modules = import.meta.glob('@/**/*.vue')
if (!modules[path]) {
console.error(`组件加载失败: ${path}`)
return null
}
const AsyncComponent = defineAsyncComponent({
loader: modules[path],
loadingComponent: () => h('div', '加载中...'),
errorComponent: ({ error }) => h('div', `加载错误: ${error.message}`),
delay: 200,
timeout: 10000
})
// 保存到映射中
componentMap.set(cacheKey, markRaw(AsyncComponent))
return AsyncComponent
} catch (error) {
console.error('注册组件失败:', error)
return null
}
}
// 缩放
const zoom = (value: any) => {
if (flag.value) {
layout.value = [{ ...value, x: 0, y: 0, w: 12, h: 6 }]
} else {
layout.value = layoutCopy.value.map((item, index) => ({
...item,
i: item.i || index, // 确保有唯一标识
component: registerComponent(item.path)
}))
}
flag.value = !flag.value
key.value += 1
}
// 获取布局数据
const fetchLayoutData = async () => {
try {
const { data } = await queryById({ id: query.id })
title.value = data.pageName + '_预览'
const parsedLayout = JSON.parse(data.containerConfig || '[]') as LayoutItem[]
// 处理布局数据
layout.value = parsedLayout.map((item, index) => ({
...item,
i: item.i || index, // 确保有唯一标识
component: registerComponent(item.path)
}))
layoutCopy.value = JSON.parse(JSON.stringify(layout.value))
} catch (error) {
console.error('获取布局数据失败:', error)
// 可以添加错误提示逻辑
}
}
// 计算组件高度
const seRowHeight = (value: any) => {
if (value == 6) return 0
if (value == 5) return 12
if (value == 4) return 20
if (value == 3) return 30
if (value == 2) return 40
if (value == 1) return 50
return 0
}
// 窗口大小变化处理 - 使用防抖
const handleResize = useDebounceFn(() => {
initRowHeight()
key.value += 1
}, 200)
// 生命周期钩子
onMounted(() => {
initRowHeight()
fetchLayoutData()
// 添加窗口大小变化监听器
window.addEventListener('resize', handleResize)
})
onUnmounted(() => {
// 移除监听器防止内存泄漏
window.removeEventListener('resize', handleResize)
})
</script>
<style lang="scss" scoped>
.vgl-layout {
background-color: #f8f9fa;
border-radius: 4px;
overflow: hidden;
}
:deep(.vgl-item:not(.vgl-item--placeholder)) {
background-color: #ffffff;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
transition: all 0.3s ease;
}
:deep(.vgl-item:hover:not(.vgl-item--placeholder)) {
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
}
:deep(.vgl-item--static) {
background-color: #f0f2f5;
}
.text {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #606266;
}
:deep(.vgl-item) {
overflow: hidden;
}
.box {
overflow: hidden;
.title {
border-bottom: 1px solid #000;
font-size: 14px;
height: 30px;
font-weight: 600;
padding: 0px 10px;
color: #fff;
background-color: var(--el-color-primary);
display: flex;
align-items: center;
justify-content: space-between;
}
.HelpFilled {
height: 16px;
width: 16px;
color: #fff !important;
margin-right: 5px;
}
}
.layoutHeader {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
font-size: 16px;
.title {
font-weight: 600;
}
}
</style>

BIN
src/assets/imgs/m0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
src/assets/imgs/m1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
src/assets/imgs/m2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
src/assets/imgs/m3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
src/assets/imgs/m4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
src/assets/logo/海南.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
src/assets/logo/灿能.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
src/assets/logo/电网.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

BIN
src/assets/logo/电网1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

File diff suppressed because one or more lines are too long

View File

@@ -1,46 +1,46 @@
<!-- 数据字典 Select 选择器 --> <!-- 数据字典 Select 选择器 -->
<template> <template>
<el-select class="w-1/1" v-bind="attrs"> <el-select class="w-1/1" v-bind="attrs" filterable>
<template v-if="valueType === 'int'"> <template v-if="valueType === 'int'">
<el-option <el-option
v-for="(dict, index) in getIntDictOptions(dictType)" v-for="(dict, index) in getIntDictOptions(dictType)"
:key="index" :key="index"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
/> />
</template> </template>
<template v-if="valueType === 'str'"> <template v-if="valueType === 'str'">
<el-option <el-option
v-for="(dict, index) in getStrDictOptions(dictType)" v-for="(dict, index) in getStrDictOptions(dictType)"
:key="index" :key="index"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
/> />
</template> </template>
<template v-if="valueType === 'bool'"> <template v-if="valueType === 'bool'">
<el-option <el-option
v-for="(dict, index) in getBoolDictOptions(dictType)" v-for="(dict, index) in getBoolDictOptions(dictType)"
:key="index" :key="index"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
/> />
</template> </template>
</el-select> </el-select>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { getBoolDictOptions, getIntDictOptions, getStrDictOptions } from '@/utils/dict' import { getBoolDictOptions, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
// 接受父组件参数 // 接受父组件参数
interface Props { interface Props {
dictType: string // 字典类型 dictType: string // 字典类型
valueType: string // 字典值类型 valueType: string // 字典值类型
} }
withDefaults(defineProps<Props>(), { withDefaults(defineProps<Props>(), {
dictType: '', dictType: '',
valueType: 'str' valueType: 'str'
}) })
const attrs = useAttrs() const attrs = useAttrs()
defineOptions({ name: 'DictSelect' }) defineOptions({ name: 'DictSelect' })
</script> </script>

View File

@@ -23,7 +23,7 @@ export function upper(str) {
} }
export function makeOptionsRule(t, to, userOptions) { export function makeOptionsRule(t, to, userOptions) {
console.log(userOptions[0]) //console.log(userOptions[0])
const options = [ const options = [
{ label: t('props.optionsType.struct'), value: 0 }, { label: t('props.optionsType.struct'), value: 0 },
{ label: t('props.optionsType.json'), value: 1 }, { label: t('props.optionsType.json'), value: 1 },

View File

@@ -1,11 +1,19 @@
<template> <template>
<div style="overflow: auto; height: 100vh"> <div style="overflow: auto; height: 100vh">
<vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" /> <vue-office-docx v-if="urlKey.includes('.doc') || urlKey.includes('.docx')" :src="url" />
<vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url" :options="excelOptions" /> <vue-office-excel
v-if="urlKey.includes('.xls') || urlKey.includes('.xlsx')"
:src="url"
:options="excelOptions"
/>
<!-- <vue-office-pdf v-if="url.includes('.pdf')" :src="url" /> --> <!-- <vue-office-pdf v-if="url.includes('.pdf')" :src="url" /> -->
<iframe v-if="url.includes('.pdf')" :src="url" style="width: 100%; height: 99%"></iframe> <iframe v-if="urlKey.includes('.pdf')||urlKey.includes('.txt')" :src="url" style="width: 100%; height: 99%"></iframe>
<img v-if="url.includes('.png') || url.includes('.jpg') || url.includes('.gif') || url.includes('.bmp')" <img
:src="url" /> v-if="
urlKey.includes('.png') || urlKey.includes('.jpg') || urlKey.includes('.gif') || urlKey.includes('.bmp')
"
:src="url"
/>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -18,15 +26,34 @@ import VueOfficeDocx from '@vue-office/docx'
import VueOfficeExcel from '@vue-office/excel' import VueOfficeExcel from '@vue-office/excel'
//引入VueOfficePdf组件 //引入VueOfficePdf组件
import VueOfficePdf from '@vue-office/pdf' import VueOfficePdf from '@vue-office/pdf'
const { push, options, currentRoute } = useRouter() import { downloadFile } from '@/api/system-boot/file'
// const url = 'http://192.168.1.22:9009/excelreport' + currentRoute.value.href?.split('?')[1] import { previewFile } from '@/utils/fileDownLoad'
const { push, options, currentRoute } = useRouter()
const VITE_FLAG = false//import.meta.env.VITE_NAME == 'jibei'
// const url = 'http://192.168.1.22:9009/excelreport' + currentRoute.value.href?.split('?')[1]
const url = ref('')
const excelOptions = ref({})
const urlKey = currentRoute.value?.href?.split('?')[1]
if (VITE_FLAG) {
url.value = '/api-docx/excelreport' + currentRoute.value?.href?.split('?')[1]
excelOptions.value = ref({
xls: currentRoute.value.href?.split('?')[1].split('.')[1] == 'xls' ? true : false
})
} else {
setTimeout(async () => {
const previewUrl = await previewFile(currentRoute.value?.href?.split('?')[1])
url.value = previewUrl
excelOptions.value = ref({
xls: currentRoute.value.href?.split('?')[1].split('.')[1] == 'xls' ? true : false
})
}, 0)
}
const url = '/api-docx/excelreport' + currentRoute.value?.href?.split('?')[1]
console.log("🚀 ~ url:", url)
const excelOptions = ref({
xls: currentRoute.value.href?.split('?')[1].split('.')[1] == 'xls' ? true : false
})
onMounted(() => { onMounted(() => {
// 从路由参数获取文件路径
console.log() console.log()
}) })
</script> </script>

View File

@@ -1,310 +1,310 @@
<template> <template>
<div class="w100"> <div class="w100">
<!-- el-select 的远程下拉只在有搜索词时才会加载数据显示出 option 列表 --> <!-- el-select 的远程下拉只在有搜索词时才会加载数据显示出 option 列表 -->
<!-- 使用 el-popover 在无数据/无搜索词时显示一个无数据的提醒 --> <!-- 使用 el-popover 在无数据/无搜索词时显示一个无数据的提醒 -->
<el-popover <el-popover
width="100%" width="100%"
placement="bottom" placement="bottom"
popper-class="remote-select-popper" popper-class="remote-select-popper"
:visible="state.focusStatus && !state.loading && !state.keyword && !state.options.length" :visible="state.focusStatus && !state.loading && !state.keyword && !state.options.length"
:teleported="false" :teleported="false"
:content="$t('utils.No data')" :content="$t('utils.No data')"
> >
<template #reference> <template #reference>
<el-select <el-select
ref="selectRef" ref="selectRef"
class="w100" class="w100"
@focus="onFocus" @focus="onFocus"
@blur="onBlur" @blur="onBlur"
:loading="state.loading || state.accidentBlur" :loading="state.loading || state.accidentBlur"
:filterable="true" :filterable="true"
:remote="true" :remote="true"
clearable clearable
remote-show-suffix remote-show-suffix
:remote-method="onLogKeyword" :remote-method="onLogKeyword"
v-model="state.value" v-model="state.value"
@change="onChangeSelect" @change="onChangeSelect"
:multiple="multiple" :multiple="multiple"
:key="state.selectKey" :key="state.selectKey"
@clear="onClear" @clear="onClear"
@visible-change="onVisibleChange" @visible-change="onVisibleChange"
v-bind="$attrs" v-bind="$attrs"
> >
<el-option <el-option
class="remote-select-option" class="remote-select-option"
v-for="item in state.options" v-for="item in state.options"
:label="item[field]" :label="item[field]"
:value="item[state.primaryKey].toString()" :value="item[state.primaryKey].toString()"
:key="item[state.primaryKey]" :key="item[state.primaryKey]"
> >
<el-tooltip placement="right" effect="light" v-if="!isEmpty(tooltipParams)"> <el-tooltip placement="right" effect="light" v-if="!isEmpty(tooltipParams)">
<template #content> <template #content>
<p v-for="(tooltipParam, key) in tooltipParams" :key="key">{{ key }}: {{ item[tooltipParam] }}</p> <p v-for="(tooltipParam, key) in tooltipParams" :key="key">{{ key }}: {{ item[tooltipParam] }}</p>
</template> </template>
<div>{{ item[field] }}</div> <div>{{ item[field] }}</div>
</el-tooltip> </el-tooltip>
</el-option> </el-option>
<el-pagination <el-pagination
v-if="state.total" v-if="state.total"
:currentPage="state.currentPage" :currentPage="state.currentPage"
:page-size="state.pageSize" :page-size="state.pageSize"
class="select-pagination" class="select-pagination"
layout="->, prev, next" layout="->, prev, next"
:total="state.total" :total="state.total"
@current-change="onSelectCurrentPageChange" @current-change="onSelectCurrentPageChange"
/> />
</el-select> </el-select>
</template> </template>
</el-popover> </el-popover>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, watch, onMounted, onUnmounted, ref, nextTick, getCurrentInstance, toRaw } from 'vue' import { reactive, watch, onMounted, onUnmounted, ref, nextTick, getCurrentInstance, toRaw } from 'vue'
import { getSelectData } from '@/api/common' // import { getSelectData } from '@/api/common'
import { uuid } from '@/utils/random' import { uuid } from '@/utils/random'
import type { ElSelect } from 'element-plus' import type { ElSelect } from 'element-plus'
import { isEmpty } from 'lodash-es' import { isEmpty } from 'lodash-es'
import { getArrayKey } from '@/utils/common' // import { getArrayKey } from '@/utils/common'
const selectRef = ref<InstanceType<typeof ElSelect> | undefined>() const selectRef = ref<InstanceType<typeof ElSelect> | undefined>()
type ElSelectProps = Partial<InstanceType<typeof ElSelect>['$props']> type ElSelectProps = Partial<InstanceType<typeof ElSelect>['$props']>
type valType = string | number | string[] | number[] type valType = string | number | string[] | number[]
interface Props extends /* @vue-ignore */ ElSelectProps { interface Props extends /* @vue-ignore */ ElSelectProps {
pk?: string pk?: string
field?: string field?: string
params?: anyObj params?: anyObj
multiple?: boolean multiple?: boolean
remoteUrl: string remoteUrl: string
modelValue: valType modelValue: valType
labelFormatter?: (optionData: anyObj, optionKey: string) => string labelFormatter?: (optionData: anyObj, optionKey: string) => string
tooltipParams?: anyObj tooltipParams?: anyObj
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
pk: 'id', pk: 'id',
field: 'name', field: 'name',
params: () => { params: () => {
return {} return {}
}, },
remoteUrl: '', remoteUrl: '',
modelValue: '', modelValue: '',
multiple: false, multiple: false,
tooltipParams: () => { tooltipParams: () => {
return {} return {}
}, },
}) })
const state: { const state: {
// 主表字段名(不带表别名) // 主表字段名(不带表别名)
primaryKey: string primaryKey: string
options: anyObj[] options: anyObj[]
loading: boolean loading: boolean
total: number total: number
currentPage: number currentPage: number
pageSize: number pageSize: number
params: anyObj params: anyObj
keyword: string keyword: string
value: valType value: valType
selectKey: string selectKey: string
initializeData: boolean initializeData: boolean
accidentBlur: boolean accidentBlur: boolean
focusStatus: boolean focusStatus: boolean
} = reactive({ } = reactive({
primaryKey: props.pk, primaryKey: props.pk,
options: [], options: [],
loading: false, loading: false,
total: 0, total: 0,
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
params: props.params, params: props.params,
keyword: '', keyword: '',
value: props.modelValue ? props.modelValue : '', value: props.modelValue ? props.modelValue : '',
selectKey: uuid(), selectKey: uuid(),
initializeData: false, initializeData: false,
accidentBlur: false, accidentBlur: false,
focusStatus: false, focusStatus: false,
}) })
let io: null | IntersectionObserver = null let io: null | IntersectionObserver = null
const instance = getCurrentInstance() const instance = getCurrentInstance()
const emits = defineEmits<{ const emits = defineEmits<{
(e: 'update:modelValue', value: valType): void (e: 'update:modelValue', value: valType): void
(e: 'row', value: any): void (e: 'row', value: any): void
}>() }>()
const onChangeSelect = (val: valType) => { const onChangeSelect = (val: valType) => {
emits('update:modelValue', val) emits('update:modelValue', val)
if (typeof instance?.vnode.props?.onRow == 'function') { if (typeof instance?.vnode.props?.onRow == 'function') {
let pkArr = props.pk.split('.') let pkArr = props.pk.split('.')
let pk = pkArr[pkArr.length - 1] let pk = pkArr[pkArr.length - 1]
if (typeof val == 'number' || typeof val == 'string') { if (typeof val == 'number' || typeof val == 'string') {
const dataKey = getArrayKey(state.options, pk, val.toString()) // const dataKey = getArrayKey(state.options, pk, val.toString())
emits('row', dataKey ? toRaw(state.options[dataKey]) : {}) // emits('row', dataKey ? toRaw(state.options[dataKey]) : {})
} else { } else {
const valueArr = [] // const valueArr = []
for (const key in val) { // for (const key in val) {
let dataKey = getArrayKey(state.options, pk, val[key].toString()) // let dataKey = getArrayKey(state.options, pk, val[key].toString())
if (dataKey) valueArr.push(toRaw(state.options[dataKey])) // if (dataKey) valueArr.push(toRaw(state.options[dataKey]))
} // }
emits('row', valueArr) // emits('row', valueArr)
} }
} }
} }
const onVisibleChange = (val: boolean) => { const onVisibleChange = (val: boolean) => {
// 保持面板状态和焦点状态一致 // 保持面板状态和焦点状态一致
if (!val) { if (!val) {
nextTick(() => { nextTick(() => {
selectRef.value?.blur() selectRef.value?.blur()
}) })
} }
} }
const onFocus = () => { const onFocus = () => {
state.focusStatus = true state.focusStatus = true
if (selectRef.value?.query != state.keyword) { if (selectRef.value?.query != state.keyword) {
state.keyword = '' state.keyword = ''
state.initializeData = false state.initializeData = false
// el-select 自动清理搜索词会产生意外的脱焦 // el-select 自动清理搜索词会产生意外的脱焦
state.accidentBlur = true state.accidentBlur = true
} }
if (!state.initializeData) { if (!state.initializeData) {
getData() getData()
} }
} }
const onBlur = () => { const onBlur = () => {
state.focusStatus = false state.focusStatus = false
} }
const onClear = () => { const onClear = () => {
state.keyword = '' state.keyword = ''
state.initializeData = false state.initializeData = false
} }
const onLogKeyword = (q: string) => { const onLogKeyword = (q: string) => {
if (state.keyword != q) { if (state.keyword != q) {
state.keyword = q state.keyword = q
getData() getData()
} }
} }
const getData = (initValue: valType = '') => { const getData = (initValue: valType = '') => {
state.loading = true state.loading = true
state.params.page = state.currentPage state.params.page = state.currentPage
state.params.initKey = props.pk state.params.initKey = props.pk
state.params.initValue = initValue state.params.initValue = initValue
getSelectData(props.remoteUrl, state.keyword, state.params) // getSelectData(props.remoteUrl, state.keyword, state.params)
.then((res) => { // .then((res) => {
let initializeData = true // let initializeData = true
let opts = res.data.options ? res.data.options : res.data.list // let opts = res.data.options ? res.data.options : res.data.list
if (typeof props.labelFormatter == 'function') { // if (typeof props.labelFormatter == 'function') {
for (const key in opts) { // for (const key in opts) {
opts[key][props.field] = props.labelFormatter(opts[key], key) // opts[key][props.field] = props.labelFormatter(opts[key], key)
} // }
} // }
state.options = opts // state.options = opts
state.total = res.data.total ?? 0 // state.total = res.data.total ?? 0
if (initValue) { // if (initValue) {
// 重新渲染组件,确保在赋值前,opts已加载到-兼容 modelValue 更新 // // 重新渲染组件,确保在赋值前,opts已加载到-兼容 modelValue 更新
state.selectKey = uuid() // state.selectKey = uuid()
initializeData = false // initializeData = false
} // }
state.loading = false // state.loading = false
state.initializeData = initializeData // state.initializeData = initializeData
if (state.accidentBlur) { // if (state.accidentBlur) {
nextTick(() => { // nextTick(() => {
const inputEl = selectRef.value?.$el.querySelector('.el-select__tags .el-select__input') // const inputEl = selectRef.value?.$el.querySelector('.el-select__tags .el-select__input')
inputEl && inputEl.focus() // inputEl && inputEl.focus()
state.accidentBlur = false // state.accidentBlur = false
}) // })
} // }
}) // })
.catch(() => { // .catch(() => {
state.loading = false // state.loading = false
}) // })
} }
const onSelectCurrentPageChange = (val: number) => { const onSelectCurrentPageChange = (val: number) => {
state.currentPage = val state.currentPage = val
getData() getData()
} }
const initDefaultValue = () => { const initDefaultValue = () => {
if (state.value) { if (state.value) {
// number[]转string[]确保默认值能够选中 // number[]转string[]确保默认值能够选中
if (typeof state.value === 'object') { if (typeof state.value === 'object') {
for (const key in state.value as string[]) { for (const key in state.value as string[]) {
state.value[key] = state.value[key].toString() state.value[key] = state.value[key].toString()
} }
} else if (typeof state.value === 'number') { } else if (typeof state.value === 'number') {
state.value = state.value.toString() state.value = state.value.toString()
} }
getData(state.value) getData(state.value)
} }
} }
onMounted(() => { onMounted(() => {
if (props.pk.indexOf('.') > 0) { if (props.pk.indexOf('.') > 0) {
let pk = props.pk.split('.') let pk = props.pk.split('.')
state.primaryKey = pk[1] ? pk[1] : pk[0] state.primaryKey = pk[1] ? pk[1] : pk[0]
} }
initDefaultValue() initDefaultValue()
setTimeout(() => { setTimeout(() => {
if (window?.IntersectionObserver) { if (window?.IntersectionObserver) {
io = new IntersectionObserver((entries) => { io = new IntersectionObserver((entries) => {
for (const key in entries) { for (const key in entries) {
if (!entries[key].isIntersecting) selectRef.value?.blur() if (!entries[key].isIntersecting) selectRef.value?.blur()
} }
}) })
if (selectRef.value?.$el instanceof Element) { if (selectRef.value?.$el instanceof Element) {
io.observe(selectRef.value.$el) io.observe(selectRef.value.$el)
} }
} }
}, 500) }, 500)
}) })
onUnmounted(() => { onUnmounted(() => {
io?.disconnect() io?.disconnect()
}) })
watch( watch(
() => props.modelValue, () => props.modelValue,
(newVal) => { (newVal) => {
if (String(state.value) != String(newVal)) { if (String(state.value) != String(newVal)) {
state.value = newVal ? newVal : '' state.value = newVal ? newVal : ''
initDefaultValue() initDefaultValue()
} }
} }
) )
const getSelectRef = () => { const getSelectRef = () => {
return selectRef.value return selectRef.value
} }
const focus = () => { const focus = () => {
selectRef.value?.focus() selectRef.value?.focus()
} }
const blur = () => { const blur = () => {
selectRef.value?.blur() selectRef.value?.blur()
} }
defineExpose({ defineExpose({
blur, blur,
focus, focus,
getSelectRef, getSelectRef,
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
:deep(.remote-select-popper) { :deep(.remote-select-popper) {
text-align: center; text-align: center;
} }
.remote-select-option { .remote-select-option {
white-space: pre; white-space: pre;
} }
</style> </style>

View File

@@ -1,414 +1,414 @@
<script lang="ts"> <script lang="ts">
import type { PropType, VNode } from 'vue' import type { PropType, VNode } from 'vue'
import type { modelValueTypes, InputAttr, InputData } from '@/components/baInput' import type { modelValueTypes, InputAttr, InputData } from '@/components/baInput'
import { createVNode, resolveComponent, defineComponent, computed, reactive } from 'vue' import { createVNode, resolveComponent, defineComponent, computed, reactive } from 'vue'
import { inputTypes } from '@/components/baInput' import { inputTypes } from '@/components/baInput'
import Array from '@/components/baInput/components/array.vue' import Array from '@/components/baInput/components/array.vue'
import RemoteSelect from '@/components/baInput/components/remoteSelect.vue' import RemoteSelect from '@/components/baInput/components/remoteSelect.vue'
import IconSelector from '@/components/baInput/components/iconSelector.vue' import IconSelector from '@/components/baInput/components/iconSelector.vue'
import Editor from '@/components/baInput/components/editor.vue' import Editor from '@/components/baInput/components/editor.vue'
import { getArea } from '@/api/common' // import { getArea } from '@/api/common'
export default defineComponent({ export default defineComponent({
name: 'baInput', name: 'baInput',
props: { props: {
// 输入框类型,支持的输入框见 inputTypes // 输入框类型,支持的输入框见 inputTypes
type: { type: {
type: String, type: String,
required: true, required: true,
validator: (value: string) => { validator: (value: string) => {
return inputTypes.includes(value) return inputTypes.includes(value)
}, },
}, },
// 双向绑定值 // 双向绑定值
modelValue: { modelValue: {
type: null, type: null,
required: true, required: true,
}, },
// 输入框的附加属性 // 输入框的附加属性
attr: { attr: {
type: Object as PropType<InputAttr>, type: Object as PropType<InputAttr>,
default: () => {}, default: () => {},
}, },
// 额外数据,radio、checkbox的选项等数据 // 额外数据,radio、checkbox的选项等数据
data: { data: {
type: Object as PropType<InputData>, type: Object as PropType<InputData>,
default: () => {}, default: () => {},
}, },
}, },
emits: ['update:modelValue'], emits: ['update:modelValue'],
setup(props, { emit }) { setup(props, { emit }) {
const onValueUpdate = (value: modelValueTypes) => { const onValueUpdate = (value: modelValueTypes) => {
emit('update:modelValue', value) emit('update:modelValue', value)
} }
// 子级元素属性 // 子级元素属性
let childrenAttr = props.data && props.data.childrenAttr ? props.data.childrenAttr : {} let childrenAttr = props.data && props.data.childrenAttr ? props.data.childrenAttr : {}
// string number textarea password // string number textarea password
const sntp = () => { const sntp = () => {
return () => return () =>
createVNode(resolveComponent('el-input'), { createVNode(resolveComponent('el-input'), {
type: props.type == 'string' ? 'text' : props.type, type: props.type == 'string' ? 'text' : props.type,
...props.attr, ...props.attr,
modelValue: props.modelValue, modelValue: props.modelValue,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
}) })
} }
// radio checkbox // radio checkbox
const rc = () => { const rc = () => {
if (!props.data || !props.data.content) { if (!props.data || !props.data.content) {
console.warn('请传递 ' + props.type + '的 content') console.warn('请传递 ' + props.type + '的 content')
} }
let vNode: VNode[] = [] let vNode: VNode[] = []
for (const key in props.data.content) { for (const key in props.data.content) {
vNode.push( vNode.push(
createVNode( createVNode(
resolveComponent('el-' + props.type), resolveComponent('el-' + props.type),
{ {
label: key, label: key,
...childrenAttr, ...childrenAttr,
}, },
() => props.data.content[key] () => props.data.content[key]
) )
) )
} }
return () => { return () => {
const valueComputed = computed(() => { const valueComputed = computed(() => {
if (props.type == 'radio') { if (props.type == 'radio') {
if (props.modelValue == undefined) return '' if (props.modelValue == undefined) return ''
return '' + props.modelValue return '' + props.modelValue
} else { } else {
let modelValueArr: anyObj = [] let modelValueArr: anyObj = []
for (const key in props.modelValue) { for (const key in props.modelValue) {
modelValueArr[key] = '' + props.modelValue[key] modelValueArr[key] = '' + props.modelValue[key]
} }
return modelValueArr return modelValueArr
} }
}) })
return createVNode( return createVNode(
resolveComponent('el-' + props.type + '-group'), resolveComponent('el-' + props.type + '-group'),
{ {
...props.attr, ...props.attr,
modelValue: valueComputed.value, modelValue: valueComputed.value,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
}, },
() => vNode () => vNode
) )
} }
} }
// select selects // select selects
const select = () => { const select = () => {
let vNode: VNode[] = [] let vNode: VNode[] = []
if (!props.data || !props.data.content) { if (!props.data || !props.data.content) {
console.warn('请传递 ' + props.type + '的 content') console.warn('请传递 ' + props.type + '的 content')
} }
for (const key in props.data.content) { for (const key in props.data.content) {
vNode.push( vNode.push(
createVNode(resolveComponent('el-option'), { createVNode(resolveComponent('el-option'), {
key: key, key: key,
label: props.data.content[key], label: props.data.content[key],
value: key, value: key,
...childrenAttr, ...childrenAttr,
}) })
) )
} }
return () => { return () => {
const valueComputed = computed(() => { const valueComputed = computed(() => {
if (props.type == 'select') { if (props.type == 'select') {
if (props.modelValue == undefined) return '' if (props.modelValue == undefined) return ''
return '' + props.modelValue return '' + props.modelValue
} else { } else {
let modelValueArr: anyObj = [] let modelValueArr: anyObj = []
for (const key in props.modelValue) { for (const key in props.modelValue) {
modelValueArr[key] = '' + props.modelValue[key] modelValueArr[key] = '' + props.modelValue[key]
} }
return modelValueArr return modelValueArr
} }
}) })
return createVNode( return createVNode(
resolveComponent('el-select'), resolveComponent('el-select'),
{ {
class: 'w100', class: 'w100',
multiple: props.type == 'select' ? false : true, multiple: props.type == 'select' ? false : true,
clearable: true, clearable: true,
...props.attr, ...props.attr,
modelValue: valueComputed.value, modelValue: valueComputed.value,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
}, },
() => vNode () => vNode
) )
} }
} }
// datetime // datetime
const datetime = () => { const datetime = () => {
let valueFormat = 'YYYY-MM-DD HH:mm:ss' let valueFormat = 'YYYY-MM-DD HH:mm:ss'
switch (props.type) { switch (props.type) {
case 'date': case 'date':
valueFormat = 'YYYY-MM-DD' valueFormat = 'YYYY-MM-DD'
break break
case 'year': case 'year':
valueFormat = 'YYYY' valueFormat = 'YYYY'
break break
} }
return () => return () =>
createVNode(resolveComponent('el-date-picker'), { createVNode(resolveComponent('el-date-picker'), {
class: 'w100', class: 'w100',
type: props.type, type: props.type,
'value-format': valueFormat, 'value-format': valueFormat,
...props.attr, ...props.attr,
modelValue: props.modelValue, modelValue: props.modelValue,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
}) })
} }
// remoteSelect remoteSelects // remoteSelect remoteSelects
const remoteSelect = () => { const remoteSelect = () => {
return () => return () =>
createVNode(RemoteSelect, { createVNode(RemoteSelect, {
modelValue: props.modelValue, modelValue: props.modelValue,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
multiple: props.type == 'remoteSelect' ? false : true, multiple: props.type == 'remoteSelect' ? false : true,
...props.attr, ...props.attr,
}) })
} }
const buildFun = new Map([ const buildFun = new Map([
['string', sntp], ['string', sntp],
['number', sntp], ['number', sntp],
['textarea', sntp], ['textarea', sntp],
['password', sntp], ['password', sntp],
['radio', rc], ['radio', rc],
['checkbox', rc], ['checkbox', rc],
[ [
'switch', 'switch',
() => { () => {
const valueType = computed(() => typeof props.modelValue) const valueType = computed(() => typeof props.modelValue)
const valueComputed = computed(() => { const valueComputed = computed(() => {
if (valueType.value === 'boolean') { if (valueType.value === 'boolean') {
return props.modelValue return props.modelValue
} else { } else {
let valueTmp = parseInt(props.modelValue as string) let valueTmp = parseInt(props.modelValue as string)
return isNaN(valueTmp) || valueTmp <= 0 ? false : true return isNaN(valueTmp) || valueTmp <= 0 ? false : true
} }
}) })
return () => return () =>
createVNode(resolveComponent('el-switch'), { createVNode(resolveComponent('el-switch'), {
...props.attr, ...props.attr,
modelValue: valueComputed.value, modelValue: valueComputed.value,
'onUpdate:modelValue': (value: boolean) => { 'onUpdate:modelValue': (value: boolean) => {
let newValue: boolean | string | number = value let newValue: boolean | string | number = value
switch (valueType.value) { switch (valueType.value) {
case 'string': case 'string':
newValue = value ? '1' : '0' newValue = value ? '1' : '0'
break break
case 'number': case 'number':
newValue = value ? 1 : 0 newValue = value ? 1 : 0
} }
emit('update:modelValue', newValue) emit('update:modelValue', newValue)
}, },
}) })
}, },
], ],
['datetime', datetime], ['datetime', datetime],
[ [
'year', 'year',
() => { () => {
return () => { return () => {
const valueComputed = computed(() => (!props.modelValue ? null : '' + props.modelValue)) const valueComputed = computed(() => (!props.modelValue ? null : '' + props.modelValue))
return createVNode(resolveComponent('el-date-picker'), { return createVNode(resolveComponent('el-date-picker'), {
class: 'w100', class: 'w100',
type: props.type, type: props.type,
'value-format': 'YYYY', 'value-format': 'YYYY',
...props.attr, ...props.attr,
modelValue: valueComputed.value, modelValue: valueComputed.value,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
}) })
} }
}, },
], ],
['date', datetime], ['date', datetime],
[ [
'time', 'time',
() => { () => {
const valueComputed = computed(() => { const valueComputed = computed(() => {
if (props.modelValue instanceof Date) { if (props.modelValue instanceof Date) {
return props.modelValue return props.modelValue
} else if (!props.modelValue) { } else if (!props.modelValue) {
return '' return ''
} else { } else {
let date = new Date() let date = new Date()
return new Date(date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + props.modelValue) return new Date(date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + props.modelValue)
} }
}) })
return () => return () =>
createVNode(resolveComponent('el-time-picker'), { createVNode(resolveComponent('el-time-picker'), {
class: 'w100', class: 'w100',
clearable: true, clearable: true,
format: 'HH:mm:ss', format: 'HH:mm:ss',
...props.attr, ...props.attr,
modelValue: valueComputed.value, modelValue: valueComputed.value,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
}) })
}, },
], ],
['select', select], ['select', select],
['selects', select], ['selects', select],
[ [
'array', 'array',
() => { () => {
return () => return () =>
createVNode(Array, { createVNode(Array, {
modelValue: props.modelValue, modelValue: props.modelValue,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
...props.attr, ...props.attr,
}) })
}, },
], ],
['remoteSelect', remoteSelect], ['remoteSelect', remoteSelect],
['remoteSelects', remoteSelect], ['remoteSelects', remoteSelect],
[ [
'city', 'city',
() => { () => {
type Node = { value?: number; label?: string; leaf?: boolean } type Node = { value?: number; label?: string; leaf?: boolean }
let maxLevel = props.data && props.data.level ? props.data.level - 1 : 2 let maxLevel = props.data && props.data.level ? props.data.level - 1 : 2
const lastLazyValue: { const lastLazyValue: {
value: string | number[] | unknown value: string | number[] | unknown
nodes: Node[] nodes: Node[]
key: string key: string
currentRequest: any currentRequest: any
} = reactive({ } = reactive({
value: 'ready', value: 'ready',
nodes: [], nodes: [],
key: '', key: '',
currentRequest: null, currentRequest: null,
}) })
// 请求到的node备份-s // 请求到的node备份-s
let nodeEbak: anyObj = {} let nodeEbak: anyObj = {}
const getNodes = (level: number, key: string) => { const getNodes = (level: number, key: string) => {
if (nodeEbak[level] && nodeEbak[level][key]) { if (nodeEbak[level] && nodeEbak[level][key]) {
return nodeEbak[level][key] return nodeEbak[level][key]
} }
return false return false
} }
const setNodes = (level: number, key: string, nodes: Node[] = []) => { const setNodes = (level: number, key: string, nodes: Node[] = []) => {
if (!nodeEbak[level]) { if (!nodeEbak[level]) {
nodeEbak[level] = {} nodeEbak[level] = {}
} }
nodeEbak[level][key] = nodes nodeEbak[level][key] = nodes
} }
// 请求到的node备份-e // 请求到的node备份-e
return () => return () =>
createVNode(resolveComponent('el-cascader'), { createVNode(resolveComponent('el-cascader'), {
modelValue: props.modelValue, modelValue: props.modelValue,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
class: 'w100', class: 'w100',
clearable: true, clearable: true,
props: { props: {
lazy: true, lazy: true,
lazyLoad(node: any, resolve: any) { lazyLoad(node: any, resolve: any) {
// lazyLoad会频繁触发,在本地存储请求结果,供重复触发时直接读取 // lazyLoad会频繁触发,在本地存储请求结果,供重复触发时直接读取
const { level, pathValues } = node const { level, pathValues } = node
let key = pathValues.join(',') let key = pathValues.join(',')
key = key ? key : 'init' key = key ? key : 'init'
let locaNode = getNodes(level, key) let locaNode = getNodes(level, key)
if (locaNode) { if (locaNode) {
return resolve(locaNode) return resolve(locaNode)
} }
if (lastLazyValue.key == key && lastLazyValue.value == props.modelValue) { if (lastLazyValue.key == key && lastLazyValue.value == props.modelValue) {
if (lastLazyValue.currentRequest) { if (lastLazyValue.currentRequest) {
return lastLazyValue.currentRequest return lastLazyValue.currentRequest
} }
return resolve(lastLazyValue.nodes) return resolve(lastLazyValue.nodes)
} }
let nodes: Node[] = [] let nodes: Node[] = []
lastLazyValue.key = key lastLazyValue.key = key
lastLazyValue.value = props.modelValue lastLazyValue.value = props.modelValue
lastLazyValue.currentRequest = getArea(pathValues).then((res) => { lastLazyValue.currentRequest = getArea(pathValues).then((res) => {
let toStr = false let toStr = false
if (props.modelValue && typeof (props.modelValue as anyObj)[0] === 'string') { if (props.modelValue && typeof (props.modelValue as anyObj)[0] === 'string') {
toStr = true toStr = true
} }
for (const key in res.data) { for (const key in res.data) {
if (toStr) { if (toStr) {
res.data[key].value = res.data[key].value.toString() res.data[key].value = res.data[key].value.toString()
} }
res.data[key].leaf = level >= maxLevel res.data[key].leaf = level >= maxLevel
nodes.push(res.data[key]) nodes.push(res.data[key])
} }
lastLazyValue.nodes = nodes lastLazyValue.nodes = nodes
lastLazyValue.currentRequest = null lastLazyValue.currentRequest = null
setNodes(level, key, nodes) setNodes(level, key, nodes)
resolve(nodes) resolve(nodes)
}) })
}, },
}, },
...props.attr, ...props.attr,
}) })
}, },
], ],
['image', upload], ['image', upload],
['images', upload], ['images', upload],
['file', upload], ['file', upload],
['files', upload], ['files', upload],
[ [
'icon', 'icon',
() => { () => {
return () => return () =>
createVNode(IconSelector, { createVNode(IconSelector, {
modelValue: props.modelValue, modelValue: props.modelValue,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
...props.attr, ...props.attr,
}) })
}, },
], ],
[ [
'color', 'color',
() => { () => {
return () => return () =>
createVNode(resolveComponent('el-color-picker'), { createVNode(resolveComponent('el-color-picker'), {
modelValue: props.modelValue, modelValue: props.modelValue,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
...props.attr, ...props.attr,
}) })
}, },
], ],
[ [
'editor', 'editor',
() => { () => {
return () => return () =>
createVNode(Editor, { createVNode(Editor, {
modelValue: props.modelValue, modelValue: props.modelValue,
'onUpdate:modelValue': onValueUpdate, 'onUpdate:modelValue': onValueUpdate,
...props.attr, ...props.attr,
}) })
}, },
], ],
[ [
'default', 'default',
() => { () => {
console.warn('暂不支持' + props.type + '的输入框类型,你可以自行在 BaInput 组件内添加逻辑') console.warn('暂不支持' + props.type + '的输入框类型,你可以自行在 BaInput 组件内添加逻辑')
}, },
], ],
]) ])
let action = buildFun.get(props.type) || buildFun.get('default') let action = buildFun.get(props.type) || buildFun.get('default')
return action!.call(this) return action!.call(this)
}, },
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.ba-upload-image :deep(.el-upload--picture-card) { .ba-upload-image :deep(.el-upload--picture-card) {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.ba-upload-file :deep(.el-upload-list) { .ba-upload-file :deep(.el-upload-list) {
margin-left: -10px; margin-left: -10px;
} }
</style> </style>

View File

@@ -707,7 +707,7 @@ const processSave = async () => {
// return result.value || '&nbsp;' // return result.value || '&nbsp;'
// } // }
onBeforeMount(() => { onBeforeMount(() => {
console.log(props, 'propspropspropsprops') //console.log(props, 'propspropspropsprops')
}) })
onMounted(() => { onMounted(() => {
initBpmnModeler() initBpmnModeler()

View File

@@ -103,7 +103,7 @@ const highlightDiagram = async () => {
let findProcessTask = false //是否已经高亮了进行中的任务 let findProcessTask = false //是否已经高亮了进行中的任务
//进行中高亮之后的任务 key 集合,用于过滤掉 taskList 进行中后面的任务,避免进行中后面的数据 Hover 还有数据 //进行中高亮之后的任务 key 集合,用于过滤掉 taskList 进行中后面的任务,避免进行中后面的数据 Hover 还有数据
let removeTaskDefinitionKeyList = [] let removeTaskDefinitionKeyList = []
// debugger //
//芋道这里取值是rootElements[0].flowElements //芋道这里取值是rootElements[0].flowElements
bpmnModeler.getDefinitions().rootElements[1].flowElements?.forEach((n: any) => { bpmnModeler.getDefinitions().rootElements[1].flowElements?.forEach((n: any) => {
let activity: any = activityList.find((m: any) => m.key === n.id) // 找到对应的活动 let activity: any = activityList.find((m: any) => m.key === n.id) // 找到对应的活动
@@ -135,7 +135,6 @@ const highlightDiagram = async () => {
// 处理 outgoing 出线 // 处理 outgoing 出线
const outgoing = getActivityOutgoing(activity) const outgoing = getActivityOutgoing(activity)
outgoing?.forEach((nn: any) => { outgoing?.forEach((nn: any) => {
// debugger
let targetActivity: any = activityList.find((m: any) => m.key === nn.targetRef.id) let targetActivity: any = activityList.find((m: any) => m.key === nn.targetRef.id)
// 如果目标活动存在则根据该活动是否结束进行【bpmn:SequenceFlow】连线的高亮设置 // 如果目标活动存在则根据该活动是否结束进行【bpmn:SequenceFlow】连线的高亮设置
if (targetActivity) { if (targetActivity) {
@@ -279,6 +278,27 @@ const getResultCss = (status) => {
return '' return ''
} }
const getTaskNameItemType = (itemStatus: any) => {
if (itemStatus === 1) {
return '审批中'
}else if (itemStatus === 2) {
return '审批通过'
}else if (itemStatus === 3) {
return '审批不通过'
}else if (itemStatus === 4) {
return '已取消'
}else if (itemStatus === 5) {
return '退回'
} else if (itemStatus === 6) {
return '委派'
} else if (itemStatus === 7) {
return '审批通过中'
} else if (itemStatus === 0) {
return '待审批'
}
return ''
}
const getActivityOutgoing = (activity) => { const getActivityOutgoing = (activity) => {
// 如果有 outgoing则直接使用它 // 如果有 outgoing则直接使用它
if (activity.outgoing && activity.outgoing.length > 0) { if (activity.outgoing && activity.outgoing.length > 0) {
@@ -316,7 +336,9 @@ const elementHover = (element) => {
!overlays.value && (overlays.value = bpmnModeler.get('overlays')) !overlays.value && (overlays.value = bpmnModeler.get('overlays'))
// 展示信息 // 展示信息
// console.log(activityLists.value, 'activityLists.value') // console.log(activityLists.value, 'activityLists.value')
// console.log(element.value, 'element.value') if (element.value.type === 'bpmn:SequenceFlow') {
return
}
const activity = activityLists.value.find((m) => m.key === element.value.id) const activity = activityLists.value.find((m) => m.key === element.value.id)
// console.log(activity, 'activityactivityactivityactivity') // console.log(activity, 'activityactivityactivityactivity')
if (!activity) { if (!activity) {
@@ -330,22 +352,22 @@ const elementHover = (element) => {
if (element.value.type === 'bpmn:StartEvent' && processInstance.value) { if (element.value.type === 'bpmn:StartEvent' && processInstance.value) {
html = `<p>发起人:${processInstance.value.startUser.name}</p> html = `<p>发起人:${processInstance.value.startUser.name}</p>
<p>部门:${processInstance.value.startUser.deptName}</p> <p>部门:${processInstance.value.startUser.deptName}</p>
<p>创建时间:${formatDate(processInstance.value.createTime)}` <p>创建时间:${formatDate(processInstance.value.startTime)}`
} else if (element.value.type === 'bpmn:UserTask') { } else if (element.value.type === 'bpmn:UserTask') {
let task = taskList.value.find((m) => m.id === activity.taskId) // 找到活动对应的 taskId let task = taskList.value.find((m) => m.id === activity.taskId) // 找到活动对应的 taskId
if (!task) { if (!task) {
return return
} }
let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS) // let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS)
let dataResult = '' // let dataResult = ''
optionData.forEach((element) => { // optionData.forEach((element) => {
if (element.value == task.status) { // if (element.value == task.status) {
dataResult = element.label // dataResult = element.label
} // }
}) // })
html = `<p>审批人:${task.assigneeUser.name}</p> html = `<p>审批人:${task.assigneeUser.name}</p>
<p>部门:${task.assigneeUser.deptName}</p> <p>部门:${task.assigneeUser.deptName}</p>
<p>结果:${dataResult}</p> <p>结果:${getTaskNameItemType(task.status)}</p>
<p>创建时间:${formatDate(task.createTime)}</p>` <p>创建时间:${formatDate(task.createTime)}</p>`
// html = `<p>审批人:${task.assigneeUser.nickname}</p> // html = `<p>审批人:${task.assigneeUser.nickname}</p>
// <p>部门:${task.assigneeUser.deptName}</p> // <p>部门:${task.assigneeUser.deptName}</p>
@@ -368,20 +390,20 @@ const elementHover = (element) => {
html += `<p>结束时间:${formatDate(activity.endTime)}</p>` html += `<p>结束时间:${formatDate(activity.endTime)}</p>`
} }
} else if (element.value.type === 'bpmn:EndEvent' && processInstance.value) { } else if (element.value.type === 'bpmn:EndEvent' && processInstance.value) {
let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS) // let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS)
let dataResult = '' // let dataResult = ''
optionData.forEach((element) => { // optionData.forEach((element) => {
if (element.value == processInstance.value.status) { // if (element.value == processInstance.value.status) {
dataResult = element.label // dataResult = element.label
} // }
}) // })
html = `<p>结果:${dataResult}</p>` // html = `<p>结果:${dataResult}</p>`
// html = `<p>结果:${getIntDictOptions( // html = `<p>结果:${getIntDictOptions(
// DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, // DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
// processInstance.value.status // processInstance.value.status
// )}</p>` // )}</p>`
if (processInstance.value.endTime) { if (processInstance.value.endTime) {
html += `<p>结束时间:${formatDate(processInstance.value.endTime)}</p>` html = `<p>结束时间:${formatDate(processInstance.value.endTime)}</p>`
} }
} }
elementOverlayIds.value[element.value.id] = toRaw(overlays.value)?.add(element.value, { elementOverlayIds.value[element.value.id] = toRaw(overlays.value)?.add(element.value, {
@@ -660,7 +682,7 @@ watch(
} }
.element-overlays { .element-overlays {
width: 200px; width: 250px;
padding: 8px; padding: 8px;
color: #fafafa; color: #fafafa;
background: rgb(0 0 0 / 60%); background: rgb(0 0 0 / 60%);

View File

@@ -15,7 +15,7 @@ const addTask = (event, options: any = {}) => {
const ElementFactory = bpmnInstances().elementFactory const ElementFactory = bpmnInstances().elementFactory
const create = bpmnInstances().modeler.get('create') const create = bpmnInstances().modeler.get('create')
console.log(ElementFactory, create) //console.log(ElementFactory, create)
const shape = ElementFactory.createShape(assign({ type: 'bpmn:UserTask' }, options)) const shape = ElementFactory.createShape(assign({ type: 'bpmn:UserTask' }, options))
@@ -23,8 +23,8 @@ const addTask = (event, options: any = {}) => {
shape.businessObject.di.isExpanded = options.isExpanded shape.businessObject.di.isExpanded = options.isExpanded
} }
console.log(event, 'event') //console.log(event, 'event')
console.log(shape, 'shape') //console.log(shape, 'shape')
create.start(event, shape) create.start(event, shape)
} }
</script> </script>

View File

@@ -172,7 +172,7 @@ const unwatchBpmn = watch(
return return
} }
console.log('props.bpmnModeler 有值了!!!') //console.log('props.bpmnModeler 有值了!!!')
const w = window as any const w = window as any
w.bpmnInstances = { w.bpmnInstances = {
modeler: props.bpmnModeler, modeler: props.bpmnModeler,

View File

@@ -2,14 +2,14 @@
<div class="panel-tab__content"> <div class="panel-tab__content">
<el-form :model="flowConditionForm" label-width="90px" size="small"> <el-form :model="flowConditionForm" label-width="90px" size="small">
<el-form-item label="流转类型"> <el-form-item label="流转类型">
<el-select v-model="flowConditionForm.type" @change="updateFlowType"> <el-select v-model="flowConditionForm.type" @change="updateFlowType" filterable>
<el-option label="普通流转路径" value="normal" /> <el-option label="普通流转路径" value="normal" />
<el-option label="默认流转路径" value="default" /> <el-option label="默认流转路径" value="default" />
<el-option label="条件流转路径" value="condition" /> <el-option label="条件流转路径" value="condition" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="条件格式" v-if="flowConditionForm.type === 'condition'" key="condition"> <el-form-item label="条件格式" v-if="flowConditionForm.type === 'condition'" key="condition">
<el-select v-model="flowConditionForm.conditionType"> <el-select v-model="flowConditionForm.conditionType" filterable>
<el-option label="表达式" value="expression" /> <el-option label="表达式" value="expression" />
<el-option label="脚本" value="script" /> <el-option label="脚本" value="script" />
</el-select> </el-select>
@@ -33,7 +33,7 @@
<el-input v-model="flowConditionForm.language" clearable @change="updateFlowCondition" /> <el-input v-model="flowConditionForm.language" clearable @change="updateFlowCondition" />
</el-form-item> </el-form-item>
<el-form-item label="脚本类型" key="scriptType"> <el-form-item label="脚本类型" key="scriptType">
<el-select v-model="flowConditionForm.scriptType"> <el-select v-model="flowConditionForm.scriptType" filterable>
<el-option label="内联脚本" value="inlineScript" /> <el-option label="内联脚本" value="inlineScript" />
<el-option label="外部脚本" value="externalScript" /> <el-option label="外部脚本" value="externalScript" />
</el-select> </el-select>
@@ -179,7 +179,7 @@ onBeforeUnmount(() => {
watch( watch(
() => props.businessObject, () => props.businessObject,
(val) => { (val) => {
console.log(val, 'val') //console.log(val, 'val')
nextTick(() => { nextTick(() => {
resetFlowCondition() resetFlowCondition()
}) })

View File

@@ -1,481 +1,481 @@
<template> <template>
<div class="panel-tab__content"> <div class="panel-tab__content">
<el-form label-width="80px"> <el-form label-width="80px">
<el-form-item label="流程表单"> <el-form-item label="流程表单">
<!-- <el-input v-model="formKey" clearable @change="updateElementFormKey" />--> <!-- <el-input v-model="formKey" clearable @change="updateElementFormKey" />-->
<el-select v-model="formKey" clearable @change="updateElementFormKey"> <el-select v-model="formKey" clearable @change="updateElementFormKey" filterable>
<el-option v-for="form in formList" :key="form.id" :label="form.name" :value="form.id" /> <el-option v-for="form in formList" :key="form.id" :label="form.name" :value="form.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item label="业务标识">--> <!-- <el-form-item label="业务标识">-->
<!-- <el-select v-model="businessKey" @change="updateElementBusinessKey">--> <!-- <el-select v-model="businessKey" @change="updateElementBusinessKey">-->
<!-- <el-option v-for="i in fieldList" :key="i.id" :value="i.id" :label="i.label" />--> <!-- <el-option v-for="i in fieldList" :key="i.id" :value="i.id" :label="i.label" />-->
<!-- <el-option label="无" value="" />--> <!-- <el-option label="无" value="" />-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
</el-form> </el-form>
<!--字段列表--> <!--字段列表-->
<!-- <div class="element-property list-property">--> <!-- <div class="element-property list-property">-->
<!-- <el-divider><Icon icon="ep:coin" /> 表单字段</el-divider>--> <!-- <el-divider><Icon icon="ep:coin" /> 表单字段</el-divider>-->
<!-- <el-table :data="fieldList" max-height="240" fit border>--> <!-- <el-table :data="fieldList" max-height="240" fit border>-->
<!-- <el-table-column label="序号" type="index" width="50px" />--> <!-- <el-table-column label="序号" type="index" width="50px" />-->
<!-- <el-table-column label="字段名称" prop="label" min-width="80px" show-overflow-tooltip />--> <!-- <el-table-column label="字段名称" prop="label" min-width="80px" show-overflow-tooltip />-->
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- label="字段类型"--> <!-- label="字段类型"-->
<!-- prop="type"--> <!-- prop="type"-->
<!-- min-width="80px"--> <!-- min-width="80px"-->
<!-- :formatter="(row) => fieldType[row.type] || row.type"--> <!-- :formatter="(row) => fieldType[row.type] || row.type"-->
<!-- show-overflow-tooltip--> <!-- show-overflow-tooltip-->
<!-- />--> <!-- />-->
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- label="默认值"--> <!-- label="默认值"-->
<!-- prop="defaultValue"--> <!-- prop="defaultValue"-->
<!-- min-width="80px"--> <!-- min-width="80px"-->
<!-- show-overflow-tooltip--> <!-- show-overflow-tooltip-->
<!-- />--> <!-- />-->
<!-- <el-table-column label="操作" width="90px">--> <!-- <el-table-column label="操作" width="90px">-->
<!-- <template #default="scope">--> <!-- <template #default="scope">-->
<!-- <el-button type="primary" link @click="openFieldForm(scope, scope.$index)"--> <!-- <el-button type="primary" link @click="openFieldForm(scope, scope.$index)"-->
<!-- >编辑</el-button--> <!-- >编辑</el-button-->
<!-- >--> <!-- >-->
<!-- <el-divider direction="vertical" />--> <!-- <el-divider direction="vertical" />-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="primary"--> <!-- type="primary"-->
<!-- link--> <!-- link-->
<!-- style="color: #ff4d4f"--> <!-- style="color: #ff4d4f"-->
<!-- @click="removeField(scope, scope.$index)"--> <!-- @click="removeField(scope, scope.$index)"-->
<!-- >移除</el-button--> <!-- >移除</el-button-->
<!-- >--> <!-- >-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- </el-table>--> <!-- </el-table>-->
<!-- </div>--> <!-- </div>-->
<!-- <div class="element-drawer__button">--> <!-- <div class="element-drawer__button">-->
<!-- <XButton type="primary" proIcon="ep:plus" title="添加字段" @click="openFieldForm(null, -1)" />--> <!-- <XButton type="primary" proIcon="ep:plus" title="添加字段" @click="openFieldForm(null, -1)" />-->
<!-- </div>--> <!-- </div>-->
<!--字段配置侧边栏--> <!--字段配置侧边栏-->
<!-- <el-drawer--> <!-- <el-drawer-->
<!-- v-model="fieldModelVisible"--> <!-- v-model="fieldModelVisible"-->
<!-- title="字段配置"--> <!-- title="字段配置"-->
<!-- :size="`${width}px`"--> <!-- :size="`${width}px`"-->
<!-- append-to-body--> <!-- append-to-body-->
<!-- destroy-on-close--> <!-- destroy-on-close-->
<!-- >--> <!-- >-->
<!-- <el-form :model="formFieldForm" label-width="90px">--> <!-- <el-form :model="formFieldForm" label-width="90px">-->
<!-- <el-form-item label="字段ID">--> <!-- <el-form-item label="字段ID">-->
<!-- <el-input v-model="formFieldForm.id" clearable />--> <!-- <el-input v-model="formFieldForm.id" clearable />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="类型">--> <!-- <el-form-item label="类型">-->
<!-- <el-select--> <!-- <el-select-->
<!-- v-model="formFieldForm.typeType"--> <!-- v-model="formFieldForm.typeType"-->
<!-- placeholder="请选择字段类型"--> <!-- placeholder="请选择字段类型"-->
<!-- clearable--> <!-- clearable-->
<!-- @change="changeFieldTypeType"--> <!-- @change="changeFieldTypeType"-->
<!-- >--> <!-- >-->
<!-- <el-option v-for="(value, key) of fieldType" :label="value" :value="key" :key="key" />--> <!-- <el-option v-for="(value, key) of fieldType" :label="value" :value="key" :key="key" />-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="类型名称" v-if="formFieldForm.typeType === 'custom'">--> <!-- <el-form-item label="类型名称" v-if="formFieldForm.typeType === 'custom'">-->
<!-- <el-input v-model="formFieldForm.type" clearable />--> <!-- <el-input v-model="formFieldForm.type" clearable />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="名称">--> <!-- <el-form-item label="名称">-->
<!-- <el-input v-model="formFieldForm.label" clearable />--> <!-- <el-input v-model="formFieldForm.label" clearable />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="时间格式" v-if="formFieldForm.typeType === 'date'">--> <!-- <el-form-item label="时间格式" v-if="formFieldForm.typeType === 'date'">-->
<!-- <el-input v-model="formFieldForm.datePattern" clearable />--> <!-- <el-input v-model="formFieldForm.datePattern" clearable />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="默认值">--> <!-- <el-form-item label="默认值">-->
<!-- <el-input v-model="formFieldForm.defaultValue" clearable />--> <!-- <el-input v-model="formFieldForm.defaultValue" clearable />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- </el-form>--> <!-- </el-form>-->
<!-- &lt;!&ndash; 枚举值设置 &ndash;&gt;--> <!-- &lt;!&ndash; 枚举值设置 &ndash;&gt;-->
<!-- <template v-if="formFieldForm.type === 'enum'">--> <!-- <template v-if="formFieldForm.type === 'enum'">-->
<!-- <el-divider key="enum-divider" />--> <!-- <el-divider key="enum-divider" />-->
<!-- <p class="listener-filed__title" key="enum-title">--> <!-- <p class="listener-filed__title" key="enum-title">-->
<!-- <span><Icon icon="ep:menu" />枚举值列表</span>--> <!-- <span><Icon icon="ep:menu" />枚举值列表</span>-->
<!-- <el-button type="primary" @click="openFieldOptionForm(null, -1, 'enum')"--> <!-- <el-button type="primary" @click="openFieldOptionForm(null, -1, 'enum')"-->
<!-- >添加枚举值</el-button--> <!-- >添加枚举值</el-button-->
<!-- >--> <!-- >-->
<!-- </p>--> <!-- </p>-->
<!-- <el-table :data="fieldEnumList" key="enum-table" max-height="240" fit border>--> <!-- <el-table :data="fieldEnumList" key="enum-table" max-height="240" fit border>-->
<!-- <el-table-column label="序号" width="50px" type="index" />--> <!-- <el-table-column label="序号" width="50px" type="index" />-->
<!-- <el-table-column label="枚举值编号" prop="id" min-width="100px" show-overflow-tooltip />--> <!-- <el-table-column label="枚举值编号" prop="id" min-width="100px" show-overflow-tooltip />-->
<!-- <el-table-column label="枚举值名称" prop="name" min-width="100px" show-overflow-tooltip />--> <!-- <el-table-column label="枚举值名称" prop="name" min-width="100px" show-overflow-tooltip />-->
<!-- <el-table-column label="操作" width="90px">--> <!-- <el-table-column label="操作" width="90px">-->
<!-- <template #default="scope">--> <!-- <template #default="scope">-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="primary"--> <!-- type="primary"-->
<!-- link--> <!-- link-->
<!-- @click="openFieldOptionForm(scope, scope.$index, 'enum')"--> <!-- @click="openFieldOptionForm(scope, scope.$index, 'enum')"-->
<!-- >编辑</el-button--> <!-- >编辑</el-button-->
<!-- >--> <!-- >-->
<!-- <el-divider direction="vertical" />--> <!-- <el-divider direction="vertical" />-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="primary"--> <!-- type="primary"-->
<!-- link--> <!-- link-->
<!-- style="color: #ff4d4f"--> <!-- style="color: #ff4d4f"-->
<!-- @click="removeFieldOptionItem(scope, scope.$index, 'enum')"--> <!-- @click="removeFieldOptionItem(scope, scope.$index, 'enum')"-->
<!-- >移除</el-button--> <!-- >移除</el-button-->
<!-- >--> <!-- >-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- </el-table>--> <!-- </el-table>-->
<!-- </template>--> <!-- </template>-->
<!-- &lt;!&ndash; 校验规则 &ndash;&gt;--> <!-- &lt;!&ndash; 校验规则 &ndash;&gt;-->
<!-- <el-divider key="validation-divider" />--> <!-- <el-divider key="validation-divider" />-->
<!-- <p class="listener-filed__title" key="validation-title">--> <!-- <p class="listener-filed__title" key="validation-title">-->
<!-- <span><Icon icon="ep:menu" />约束条件列表</span>--> <!-- <span><Icon icon="ep:menu" />约束条件列表</span>-->
<!-- <el-button type="primary" @click="openFieldOptionForm(null, -1, 'constraint')"--> <!-- <el-button type="primary" @click="openFieldOptionForm(null, -1, 'constraint')"-->
<!-- >添加约束</el-button--> <!-- >添加约束</el-button-->
<!-- >--> <!-- >-->
<!-- </p>--> <!-- </p>-->
<!-- <el-table :data="fieldConstraintsList" key="validation-table" max-height="240" fit border>--> <!-- <el-table :data="fieldConstraintsList" key="validation-table" max-height="240" fit border>-->
<!-- <el-table-column label="序号" width="50px" type="index" />--> <!-- <el-table-column label="序号" width="50px" type="index" />-->
<!-- <el-table-column label="约束名称" prop="name" min-width="100px" show-overflow-tooltip />--> <!-- <el-table-column label="约束名称" prop="name" min-width="100px" show-overflow-tooltip />-->
<!-- <el-table-column label="约束配置" prop="config" min-width="100px" show-overflow-tooltip />--> <!-- <el-table-column label="约束配置" prop="config" min-width="100px" show-overflow-tooltip />-->
<!-- <el-table-column label="操作" width="90px">--> <!-- <el-table-column label="操作" width="90px">-->
<!-- <template #default="scope">--> <!-- <template #default="scope">-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="primary"--> <!-- type="primary"-->
<!-- link--> <!-- link-->
<!-- @click="openFieldOptionForm(scope, scope.$index, 'constraint')"--> <!-- @click="openFieldOptionForm(scope, scope.$index, 'constraint')"-->
<!-- >编辑</el-button--> <!-- >编辑</el-button-->
<!-- >--> <!-- >-->
<!-- <el-divider direction="vertical" />--> <!-- <el-divider direction="vertical" />-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="primary"--> <!-- type="primary"-->
<!-- link--> <!-- link-->
<!-- style="color: #ff4d4f"--> <!-- style="color: #ff4d4f"-->
<!-- @click="removeFieldOptionItem(scope, scope.$index, 'constraint')"--> <!-- @click="removeFieldOptionItem(scope, scope.$index, 'constraint')"-->
<!-- >移除</el-button--> <!-- >移除</el-button-->
<!-- >--> <!-- >-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- </el-table>--> <!-- </el-table>-->
<!-- &lt;!&ndash; 表单属性 &ndash;&gt;--> <!-- &lt;!&ndash; 表单属性 &ndash;&gt;-->
<!-- <el-divider key="property-divider" />--> <!-- <el-divider key="property-divider" />-->
<!-- <p class="listener-filed__title" key="property-title">--> <!-- <p class="listener-filed__title" key="property-title">-->
<!-- <span><Icon icon="ep:menu" />字段属性列表</span>--> <!-- <span><Icon icon="ep:menu" />字段属性列表</span>-->
<!-- <el-button type="primary" @click="openFieldOptionForm(null, -1, 'property')"--> <!-- <el-button type="primary" @click="openFieldOptionForm(null, -1, 'property')"-->
<!-- >添加属性</el-button--> <!-- >添加属性</el-button-->
<!-- >--> <!-- >-->
<!-- </p>--> <!-- </p>-->
<!-- <el-table :data="fieldPropertiesList" key="property-table" max-height="240" fit border>--> <!-- <el-table :data="fieldPropertiesList" key="property-table" max-height="240" fit border>-->
<!-- <el-table-column label="序号" width="50px" type="index" />--> <!-- <el-table-column label="序号" width="50px" type="index" />-->
<!-- <el-table-column label="属性编号" prop="id" min-width="100px" show-overflow-tooltip />--> <!-- <el-table-column label="属性编号" prop="id" min-width="100px" show-overflow-tooltip />-->
<!-- <el-table-column label="属性值" prop="value" min-width="100px" show-overflow-tooltip />--> <!-- <el-table-column label="属性值" prop="value" min-width="100px" show-overflow-tooltip />-->
<!-- <el-table-column label="操作" width="90px">--> <!-- <el-table-column label="操作" width="90px">-->
<!-- <template #default="scope">--> <!-- <template #default="scope">-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="primary"--> <!-- type="primary"-->
<!-- link--> <!-- link-->
<!-- @click="openFieldOptionForm(scope, scope.$index, 'property')"--> <!-- @click="openFieldOptionForm(scope, scope.$index, 'property')"-->
<!-- >编辑</el-button--> <!-- >编辑</el-button-->
<!-- >--> <!-- >-->
<!-- <el-divider direction="vertical" />--> <!-- <el-divider direction="vertical" />-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="primary"--> <!-- type="primary"-->
<!-- link--> <!-- link-->
<!-- style="color: #ff4d4f"--> <!-- style="color: #ff4d4f"-->
<!-- @click="removeFieldOptionItem(scope, scope.$index, 'property')"--> <!-- @click="removeFieldOptionItem(scope, scope.$index, 'property')"-->
<!-- >移除</el-button--> <!-- >移除</el-button-->
<!-- >--> <!-- >-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- </el-table>--> <!-- </el-table>-->
<!-- &lt;!&ndash; 底部按钮 &ndash;&gt;--> <!-- &lt;!&ndash; 底部按钮 &ndash;&gt;-->
<!-- <div class="element-drawer__button">--> <!-- <div class="element-drawer__button">-->
<!-- <el-button> </el-button>--> <!-- <el-button> </el-button>-->
<!-- <el-button type="primary" @click="saveField"> </el-button>--> <!-- <el-button type="primary" @click="saveField"> </el-button>-->
<!-- </div>--> <!-- </div>-->
<!-- </el-drawer>--> <!-- </el-drawer>-->
<!-- <el-dialog--> <!-- <el-dialog-->
<!-- v-model="fieldOptionModelVisible"--> <!-- v-model="fieldOptionModelVisible"-->
<!-- :title="optionModelTitle"--> <!-- :title="optionModelTitle"-->
<!-- width="600px"--> <!-- width="600px"-->
<!-- append-to-body--> <!-- append-to-body-->
<!-- destroy-on-close--> <!-- destroy-on-close-->
<!-- >--> <!-- >-->
<!-- <el-form :model="fieldOptionForm" label-width="96px">--> <!-- <el-form :model="fieldOptionForm" label-width="96px">-->
<!-- <el-form-item label="编号/ID" v-if="fieldOptionType !== 'constraint'" key="option-id">--> <!-- <el-form-item label="编号/ID" v-if="fieldOptionType !== 'constraint'" key="option-id">-->
<!-- <el-input v-model="fieldOptionForm.id" clearable />--> <!-- <el-input v-model="fieldOptionForm.id" clearable />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="名称" v-if="fieldOptionType !== 'property'" key="option-name">--> <!-- <el-form-item label="名称" v-if="fieldOptionType !== 'property'" key="option-name">-->
<!-- <el-input v-model="fieldOptionForm.name" clearable />--> <!-- <el-input v-model="fieldOptionForm.name" clearable />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="配置" v-if="fieldOptionType === 'constraint'" key="option-config">--> <!-- <el-form-item label="配置" v-if="fieldOptionType === 'constraint'" key="option-config">-->
<!-- <el-input v-model="fieldOptionForm.config" clearable />--> <!-- <el-input v-model="fieldOptionForm.config" clearable />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="值" v-if="fieldOptionType === 'property'" key="option-value">--> <!-- <el-form-item label="值" v-if="fieldOptionType === 'property'" key="option-value">-->
<!-- <el-input v-model="fieldOptionForm.value" clearable />--> <!-- <el-input v-model="fieldOptionForm.value" clearable />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- </el-form>--> <!-- </el-form>-->
<!-- <template #footer>--> <!-- <template #footer>-->
<!-- <el-button @click="fieldOptionModelVisible = false"> </el-button>--> <!-- <el-button @click="fieldOptionModelVisible = false"> </el-button>-->
<!-- <el-button type="primary" @click="saveFieldOption"> </el-button>--> <!-- <el-button type="primary" @click="saveFieldOption"> </el-button>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-dialog>--> <!-- </el-dialog>-->
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { getFormSimpleList } from '@/api/bpm-boot/form' import { getFormSimpleList } from '@/api/bpm-boot/form'
defineOptions({ name: 'ElementForm' }) defineOptions({ name: 'ElementForm' })
const props = defineProps({ const props = defineProps({
id: String, id: String,
type: String type: String
}) })
const prefix = inject('prefix') const prefix = inject('prefix')
const width = inject('width') const width = inject('width')
const formKey = ref('') const formKey = ref('')
const businessKey = ref('') const businessKey = ref('')
const optionModelTitle = ref('') const optionModelTitle = ref('')
const fieldList = ref<any[]>([]) const fieldList = ref<any[]>([])
const formFieldForm = ref<any>({}) const formFieldForm = ref<any>({})
const fieldType = ref({ const fieldType = ref({
long: '长整型', long: '长整型',
string: '字符串', string: '字符串',
boolean: '布尔类', boolean: '布尔类',
date: '日期类', date: '日期类',
enum: '枚举类', enum: '枚举类',
custom: '自定义类型' custom: '自定义类型'
}) })
const formFieldIndex = ref(-1) // 编辑中的字段, -1 为新增 const formFieldIndex = ref(-1) // 编辑中的字段, -1 为新增
const formFieldOptionIndex = ref(-1) // 编辑中的字段配置项, -1 为新增 const formFieldOptionIndex = ref(-1) // 编辑中的字段配置项, -1 为新增
const fieldModelVisible = ref(false) const fieldModelVisible = ref(false)
const fieldOptionModelVisible = ref(false) const fieldOptionModelVisible = ref(false)
const fieldOptionForm = ref<any>({}) // 当前激活的字段配置项数据 const fieldOptionForm = ref<any>({}) // 当前激活的字段配置项数据
const fieldOptionType = ref('') // 当前激活的字段配置项弹窗 类型 const fieldOptionType = ref('') // 当前激活的字段配置项弹窗 类型
const fieldEnumList = ref<any[]>([]) // 枚举值列表 const fieldEnumList = ref<any[]>([]) // 枚举值列表
const fieldConstraintsList = ref<any[]>([]) // 约束条件列表 const fieldConstraintsList = ref<any[]>([]) // 约束条件列表
const fieldPropertiesList = ref<any[]>([]) // 绑定属性列表 const fieldPropertiesList = ref<any[]>([]) // 绑定属性列表
const bpmnELement = ref() const bpmnELement = ref()
const elExtensionElements = ref() const elExtensionElements = ref()
const formData = ref() const formData = ref()
const otherExtensions = ref() const otherExtensions = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances const bpmnInstances = () => (window as any)?.bpmnInstances
const resetFormList = () => { const resetFormList = () => {
bpmnELement.value = bpmnInstances().bpmnElement bpmnELement.value = bpmnInstances().bpmnElement
formKey.value = bpmnELement.value.businessObject.formKey formKey.value = bpmnELement.value.businessObject.formKey
// if (formKey.value?.length > 0) { // if (formKey.value?.length > 0) {
// formKey.value = parseInt(formKey.value) // formKey.value = parseInt(formKey.value)
// } // }
// 获取元素扩展属性 或者 创建扩展属性 // 获取元素扩展属性 或者 创建扩展属性
elExtensionElements.value = elExtensionElements.value =
bpmnELement.value.businessObject.get('extensionElements') || bpmnELement.value.businessObject.get('extensionElements') ||
bpmnInstances().moddle.create('bpmn:ExtensionElements', { values: [] }) bpmnInstances().moddle.create('bpmn:ExtensionElements', { values: [] })
// 获取元素表单配置 或者 创建新的表单配置 // 获取元素表单配置 或者 创建新的表单配置
formData.value = formData.value =
elExtensionElements.value.values.filter((ex) => ex.$type === `${prefix}:FormData`)?.[0] || elExtensionElements.value.values.filter((ex) => ex.$type === `${prefix}:FormData`)?.[0] ||
bpmnInstances().moddle.create(`${prefix}:FormData`, { fields: [] }) bpmnInstances().moddle.create(`${prefix}:FormData`, { fields: [] })
// 业务标识 businessKey 绑定在 formData 中 // 业务标识 businessKey 绑定在 formData 中
businessKey.value = formData.value.businessKey businessKey.value = formData.value.businessKey
// 保留剩余扩展元素,便于后面更新该元素对应属性 // 保留剩余扩展元素,便于后面更新该元素对应属性
otherExtensions.value = elExtensionElements.value.values.filter( otherExtensions.value = elExtensionElements.value.values.filter(
(ex) => ex.$type !== `${prefix}:FormData` (ex) => ex.$type !== `${prefix}:FormData`
) )
// 复制原始值,填充表格 // 复制原始值,填充表格
fieldList.value = JSON.parse(JSON.stringify(formData.value.fields || [])) fieldList.value = JSON.parse(JSON.stringify(formData.value.fields || []))
// 更新元素扩展属性,避免后续报错 // 更新元素扩展属性,避免后续报错
updateElementExtensions() updateElementExtensions()
} }
const updateElementFormKey = () => { const updateElementFormKey = () => {
bpmnInstances().modeling.updateProperties(toRaw(bpmnELement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnELement.value), {
formKey: formKey.value formKey: formKey.value
}) })
} }
const updateElementBusinessKey = () => { const updateElementBusinessKey = () => {
bpmnInstances().modeling.updateModdleProperties(toRaw(bpmnELement.value), formData.value, { bpmnInstances().modeling.updateModdleProperties(toRaw(bpmnELement.value), formData.value, {
businessKey: businessKey.value businessKey: businessKey.value
}) })
} }
// 根据类型调整字段type // 根据类型调整字段type
const changeFieldTypeType = (type) => { const changeFieldTypeType = (type) => {
// this.$set(this.formFieldForm, "type", type === "custom" ? "" : type); // this.$set(this.formFieldForm, "type", type === "custom" ? "" : type);
formFieldForm.value['type'] = type === 'custom' ? '' : type formFieldForm.value['type'] = type === 'custom' ? '' : type
} }
// 打开字段详情侧边栏 // 打开字段详情侧边栏
const openFieldForm = (field, index) => { const openFieldForm = (field, index) => {
formFieldIndex.value = index formFieldIndex.value = index
if (index !== -1) { if (index !== -1) {
const FieldObject = formData.value.fields[index] const FieldObject = formData.value.fields[index]
formFieldForm.value = JSON.parse(JSON.stringify(field)) formFieldForm.value = JSON.parse(JSON.stringify(field))
// 设置自定义类型 // 设置自定义类型
// this.$set(this.formFieldForm, "typeType", !this.fieldType[field.type] ? "custom" : field.type); // this.$set(this.formFieldForm, "typeType", !this.fieldType[field.type] ? "custom" : field.type);
formFieldForm.value['typeType'] = !fieldType.value[field.type] ? 'custom' : field.type formFieldForm.value['typeType'] = !fieldType.value[field.type] ? 'custom' : field.type
// 初始化枚举值列表 // 初始化枚举值列表
field.type === 'enum' && field.type === 'enum' &&
(fieldEnumList.value = JSON.parse(JSON.stringify(FieldObject?.values || []))) (fieldEnumList.value = JSON.parse(JSON.stringify(FieldObject?.values || [])))
// 初始化约束条件列表 // 初始化约束条件列表
fieldConstraintsList.value = JSON.parse( fieldConstraintsList.value = JSON.parse(
JSON.stringify(FieldObject?.validation?.constraints || []) JSON.stringify(FieldObject?.validation?.constraints || [])
) )
// 初始化自定义属性列表 // 初始化自定义属性列表
fieldPropertiesList.value = JSON.parse(JSON.stringify(FieldObject?.properties?.values || [])) fieldPropertiesList.value = JSON.parse(JSON.stringify(FieldObject?.properties?.values || []))
} else { } else {
formFieldForm.value = {} formFieldForm.value = {}
// 初始化枚举值列表 // 初始化枚举值列表
fieldEnumList.value = [] fieldEnumList.value = []
// 初始化约束条件列表 // 初始化约束条件列表
fieldConstraintsList.value = [] fieldConstraintsList.value = []
// 初始化自定义属性列表 // 初始化自定义属性列表
fieldPropertiesList.value = [] fieldPropertiesList.value = []
} }
fieldModelVisible.value = true fieldModelVisible.value = true
} }
// 打开字段 某个 配置项 弹窗 // 打开字段 某个 配置项 弹窗
const openFieldOptionForm = (option, index, type) => { const openFieldOptionForm = (option, index, type) => {
fieldOptionModelVisible.value = true fieldOptionModelVisible.value = true
fieldOptionType.value = type fieldOptionType.value = type
formFieldOptionIndex.value = index formFieldOptionIndex.value = index
if (type === 'property') { if (type === 'property') {
fieldOptionForm.value = option ? JSON.parse(JSON.stringify(option)) : {} fieldOptionForm.value = option ? JSON.parse(JSON.stringify(option)) : {}
return (optionModelTitle.value = '属性配置') return (optionModelTitle.value = '属性配置')
} }
if (type === 'enum') { if (type === 'enum') {
fieldOptionForm.value = option ? JSON.parse(JSON.stringify(option)) : {} fieldOptionForm.value = option ? JSON.parse(JSON.stringify(option)) : {}
return (optionModelTitle.value = '枚举值配置') return (optionModelTitle.value = '枚举值配置')
} }
fieldOptionForm.value = option ? JSON.parse(JSON.stringify(option)) : {} fieldOptionForm.value = option ? JSON.parse(JSON.stringify(option)) : {}
return (optionModelTitle.value = '约束条件配置') return (optionModelTitle.value = '约束条件配置')
} }
// 保存字段 某个 配置项 // 保存字段 某个 配置项
const saveFieldOption = () => { const saveFieldOption = () => {
if (formFieldOptionIndex.value === -1) { if (formFieldOptionIndex.value === -1) {
if (fieldOptionType.value === 'property') { if (fieldOptionType.value === 'property') {
fieldPropertiesList.value.push(fieldOptionForm.value) fieldPropertiesList.value.push(fieldOptionForm.value)
} }
if (fieldOptionType.value === 'constraint') { if (fieldOptionType.value === 'constraint') {
fieldConstraintsList.value.push(fieldOptionForm.value) fieldConstraintsList.value.push(fieldOptionForm.value)
} }
if (fieldOptionType.value === 'enum') { if (fieldOptionType.value === 'enum') {
fieldEnumList.value.push(fieldOptionForm.value) fieldEnumList.value.push(fieldOptionForm.value)
} }
} else { } else {
fieldOptionType.value === 'property' && fieldOptionType.value === 'property' &&
fieldPropertiesList.value.splice(formFieldOptionIndex.value, 1, fieldOptionForm.value) fieldPropertiesList.value.splice(formFieldOptionIndex.value, 1, fieldOptionForm.value)
fieldOptionType.value === 'constraint' && fieldOptionType.value === 'constraint' &&
fieldConstraintsList.value.splice(formFieldOptionIndex.value, 1, fieldOptionForm.value) fieldConstraintsList.value.splice(formFieldOptionIndex.value, 1, fieldOptionForm.value)
fieldOptionType.value === 'enum' && fieldOptionType.value === 'enum' &&
fieldEnumList.value.splice(formFieldOptionIndex.value, 1, fieldOptionForm.value) fieldEnumList.value.splice(formFieldOptionIndex.value, 1, fieldOptionForm.value)
} }
fieldOptionModelVisible.value = false fieldOptionModelVisible.value = false
fieldOptionForm.value = {} fieldOptionForm.value = {}
} }
// 保存字段配置 // 保存字段配置
const saveField = () => { const saveField = () => {
const { id, type, label, defaultValue, datePattern } = formFieldForm.value const { id, type, label, defaultValue, datePattern } = formFieldForm.value
const Field = bpmnInstances().moddle.create(`${prefix}:FormField`, { id, type, label }) const Field = bpmnInstances().moddle.create(`${prefix}:FormField`, { id, type, label })
defaultValue && (Field.defaultValue = defaultValue) defaultValue && (Field.defaultValue = defaultValue)
datePattern && (Field.datePattern = datePattern) datePattern && (Field.datePattern = datePattern)
// 构建属性 // 构建属性
if (fieldPropertiesList.value && fieldPropertiesList.value.length) { if (fieldPropertiesList.value && fieldPropertiesList.value.length) {
const fieldPropertyList = fieldPropertiesList.value.map((fp) => { const fieldPropertyList = fieldPropertiesList.value.map((fp) => {
return bpmnInstances().moddle.create(`${prefix}:Property`, { return bpmnInstances().moddle.create(`${prefix}:Property`, {
id: fp.id, id: fp.id,
value: fp.value value: fp.value
}) })
}) })
Field.properties = bpmnInstances().moddle.create(`${prefix}:Properties`, { Field.properties = bpmnInstances().moddle.create(`${prefix}:Properties`, {
values: fieldPropertyList values: fieldPropertyList
}) })
} }
// 构建校验规则 // 构建校验规则
if (fieldConstraintsList.value && fieldConstraintsList.value.length) { if (fieldConstraintsList.value && fieldConstraintsList.value.length) {
const fieldConstraintList = fieldConstraintsList.value.map((fc) => { const fieldConstraintList = fieldConstraintsList.value.map((fc) => {
return bpmnInstances().moddle.create(`${prefix}:Constraint`, { return bpmnInstances().moddle.create(`${prefix}:Constraint`, {
name: fc.name, name: fc.name,
config: fc.config config: fc.config
}) })
}) })
Field.validation = bpmnInstances().moddle.create(`${prefix}:Validation`, { Field.validation = bpmnInstances().moddle.create(`${prefix}:Validation`, {
constraints: fieldConstraintList constraints: fieldConstraintList
}) })
} }
// 构建枚举值 // 构建枚举值
if (fieldEnumList.value && fieldEnumList.value.length) { if (fieldEnumList.value && fieldEnumList.value.length) {
Field.values = fieldEnumList.value.map((fe) => { Field.values = fieldEnumList.value.map((fe) => {
return bpmnInstances().moddle.create(`${prefix}:Value`, { name: fe.name, id: fe.id }) return bpmnInstances().moddle.create(`${prefix}:Value`, { name: fe.name, id: fe.id })
}) })
} }
// 更新数组 与 表单配置实例 // 更新数组 与 表单配置实例
if (formFieldIndex.value === -1) { if (formFieldIndex.value === -1) {
fieldList.value.push(formFieldForm.value) fieldList.value.push(formFieldForm.value)
formData.value.fields.push(Field) formData.value.fields.push(Field)
} else { } else {
fieldList.value.splice(formFieldIndex.value, 1, formFieldForm.value) fieldList.value.splice(formFieldIndex.value, 1, formFieldForm.value)
formData.value.fields.splice(formFieldIndex.value, 1, Field) formData.value.fields.splice(formFieldIndex.value, 1, Field)
} }
updateElementExtensions() updateElementExtensions()
fieldModelVisible.value = false fieldModelVisible.value = false
} }
// 移除某个 字段的 配置项 // 移除某个 字段的 配置项
const removeFieldOptionItem = (option, index, type) => { const removeFieldOptionItem = (option, index, type) => {
// console.log(option, 'option') // console.log(option, 'option')
if (type === 'property') { if (type === 'property') {
fieldPropertiesList.value.splice(index, 1) fieldPropertiesList.value.splice(index, 1)
return return
} }
if (type === 'enum') { if (type === 'enum') {
fieldEnumList.value.splice(index, 1) fieldEnumList.value.splice(index, 1)
return return
} }
fieldConstraintsList.value.splice(index, 1) fieldConstraintsList.value.splice(index, 1)
} }
// 移除 字段 // 移除 字段
const removeField = (field, index) => { const removeField = (field, index) => {
console.log(field, 'field') console.log(field, 'field')
fieldList.value.splice(index, 1) fieldList.value.splice(index, 1)
formData.value.fields.splice(index, 1) formData.value.fields.splice(index, 1)
updateElementExtensions() updateElementExtensions()
} }
const updateElementExtensions = () => { const updateElementExtensions = () => {
// 更新回扩展元素 // 更新回扩展元素
const newElExtensionElements = bpmnInstances().moddle.create(`bpmn:ExtensionElements`, { const newElExtensionElements = bpmnInstances().moddle.create(`bpmn:ExtensionElements`, {
values: otherExtensions.value.concat(formData.value) values: otherExtensions.value.concat(formData.value)
}) })
// 更新到元素上 // 更新到元素上
bpmnInstances().modeling.updateProperties(toRaw(bpmnELement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnELement.value), {
extensionElements: newElExtensionElements extensionElements: newElExtensionElements
}) })
} }
const formList = ref([]) // 流程表单的下拉框的数据 const formList = ref([]) // 流程表单的下拉框的数据
onMounted(async () => { onMounted(async () => {
await getFormSimpleList().then(res => { await getFormSimpleList().then(res => {
formList.value = res.data formList.value = res.data
}) })
}) })
watch( watch(
() => props.id, () => props.id,
(val) => { (val) => {
val && val &&
val.length && val.length &&
nextTick(() => { nextTick(() => {
resetFormList() resetFormList()
}) })
}, },
{ immediate: true } { immediate: true }
) )
</script> </script>

View File

@@ -1,463 +1,459 @@
<template> <template>
<div class='panel-tab__content'> <div class='panel-tab__content'>
<el-table :data='elementListenersList' size='small' border> <el-table :data='elementListenersList' size='small' border>
<el-table-column label='序号' width='80px' type='index' /> <el-table-column label='序号' width='80px' type='index' />
<el-table-column label='事件类型' min-width='100px' prop='event' /> <el-table-column label='事件类型' min-width='100px' prop='event' />
<el-table-column <el-table-column
label='监听器类型' label='监听器类型'
min-width='100px' min-width='100px'
show-overflow-tooltip show-overflow-tooltip
:formatter='(row) => listenerTypeObject[row.listenerType]' :formatter='(row) => listenerTypeObject[row.listenerType]'
/> />
<el-table-column label='操作' width='100px'> <el-table-column label='操作' width='100px'>
<template #default='scope'> <template #default='scope'>
<el-button size='small' link @click='openListenerForm(scope.row, scope.$index)' <el-button size='small' link @click='openListenerForm(scope.row, scope.$index)'
>编辑 >编辑
</el-button </el-button
> >
<el-divider direction='vertical' /> <el-divider direction='vertical' />
<el-button size='small' link style='color: #ff4d4f' @click='removeListener(scope.$index)' <el-button size='small' link style='color: #ff4d4f' @click='removeListener(scope.$index)'
>移除 >移除
</el-button </el-button
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class='element-drawer__button'> <div class='element-drawer__button'>
<XButton <XButton
type="primary" type="primary"
preIcon="ep:plus" preIcon="ep:plus"
title="添加监听器" title="添加监听器"
size="small" size="small"
@click="openListenerForm(null)" @click="openListenerForm(null)"
/> />
<!-- <Plus type='primary'--> <!-- <Plus type='primary'-->
<!-- title='添加监听器'--> <!-- title='添加监听器'-->
<!-- size='small'--> <!-- size='small'-->
<!-- @click='openListenerForm(null)' />--> <!-- @click='openListenerForm(null)' />-->
<XButton <XButton
type="success" type="success"
preIcon="ep:select" preIcon="ep:select"
title="选择监听器" title="选择监听器"
size="small" size="small"
@click="openProcessListenerDialog" @click="openProcessListenerDialog"
/> />
<!-- <Select--> <!-- <Select-->
<!-- type='success'--> <!-- type='success'-->
<!-- title='选择监听器'--> <!-- title='选择监听器'-->
<!-- size='small'--> <!-- size='small'-->
<!-- @click='openProcessListenerDialog'--> <!-- @click='openProcessListenerDialog'-->
<!-- />--> <!-- />-->
</div> </div>
<!-- 监听器 编辑/创建 部分 --> <!-- 监听器 编辑/创建 部分 -->
<el-drawer <el-drawer
v-model='listenerFormModelVisible' v-model='listenerFormModelVisible'
title='执行监听器' title='执行监听器'
:size='`${width}px`' :size='`${width}px`'
append-to-body append-to-body
destroy-on-close destroy-on-close
> >
<el-form :model='listenerForm' label-width='96px' ref='listenerFormRef'> <el-form :model='listenerForm' label-width='96px' ref='listenerFormRef'>
<el-form-item <el-form-item
label='事件类型' label='事件类型'
prop='event' prop='event'
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-select v-model='listenerForm.event'> <el-select v-model='listenerForm.event' filterable>
<el-option label='start' value='start' /> <el-option label='start' value='start' />
<el-option label='end' value='end' /> <el-option label='end' value='end' />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label='监听器类型' label='监听器类型'
prop='listenerType' prop='listenerType'
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-select v-model='listenerForm.listenerType'> <el-select v-model='listenerForm.listenerType' filterable>
<el-option <el-option
v-for='i in Object.keys(listenerTypeObject)' v-for='i in Object.keys(listenerTypeObject)'
:key='i' :key='i'
:label='listenerTypeObject[i]' :label='listenerTypeObject[i]'
:value='i' :value='i'
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerForm.listenerType === 'classListener'" v-if="listenerForm.listenerType === 'classListener'"
label='Java类' label='Java类'
prop='class' prop='class'
key='listener-class' key='listener-class'
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model='listenerForm.class' clearable /> <el-input v-model='listenerForm.class' clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerForm.listenerType === 'expressionListener'" v-if="listenerForm.listenerType === 'expressionListener'"
label='表达式' label='表达式'
prop='expression' prop='expression'
key='listener-expression' key='listener-expression'
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model='listenerForm.expression' clearable /> <el-input v-model='listenerForm.expression' clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerForm.listenerType === 'delegateExpressionListener'" v-if="listenerForm.listenerType === 'delegateExpressionListener'"
label='代理表达式' label='代理表达式'
prop='delegateExpression' prop='delegateExpression'
key='listener-delegate' key='listener-delegate'
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model='listenerForm.delegateExpression' clearable /> <el-input v-model='listenerForm.delegateExpression' clearable />
</el-form-item> </el-form-item>
<template v-if="listenerForm.listenerType === 'scriptListener'"> <template v-if="listenerForm.listenerType === 'scriptListener'">
<el-form-item <el-form-item
label='脚本格式' label='脚本格式'
prop='scriptFormat' prop='scriptFormat'
key='listener-script-format' key='listener-script-format'
:rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本格式' }" :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本格式' }"
> >
<el-input v-model='listenerForm.scriptFormat' clearable /> <el-input v-model='listenerForm.scriptFormat' clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label='脚本类型' label='脚本类型'
prop='scriptType' prop='scriptType'
key='listener-script-type' key='listener-script-type'
:rules="{ required: true, trigger: ['blur', 'change'], message: '请选择脚本类型' }" :rules="{ required: true, trigger: ['blur', 'change'], message: '请选择脚本类型' }"
> >
<el-select v-model='listenerForm.scriptType'> <el-select v-model='listenerForm.scriptType' filterable>
<el-option label='内联脚本' value='inlineScript' /> <el-option label='内联脚本' value='inlineScript' />
<el-option label='外部脚本' value='externalScript' /> <el-option label='外部脚本' value='externalScript' />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerForm.scriptType === 'inlineScript'" v-if="listenerForm.scriptType === 'inlineScript'"
label='脚本内容' label='脚本内容'
prop='value' prop='value'
key='listener-script' key='listener-script'
:rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本内容' }" :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本内容' }"
> >
<el-input v-model='listenerForm.value' clearable /> <el-input v-model='listenerForm.value' clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerForm.scriptType === 'externalScript'" v-if="listenerForm.scriptType === 'externalScript'"
label='资源地址' label='资源地址'
prop='resource' prop='resource'
key='listener-resource' key='listener-resource'
:rules="{ required: true, trigger: ['blur', 'change'], message: '请填写资源地址' }" :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写资源地址' }"
> >
<el-input v-model='listenerForm.resource' clearable /> <el-input v-model='listenerForm.resource' clearable />
</el-form-item> </el-form-item>
</template> </template>
</el-form> </el-form>
<el-divider /> <el-divider />
<p class='listener-filed__title'> <p class='listener-filed__title'>
<span><Menu />注入字段</span> <span><Menu />注入字段</span>
<XButton type='primary' @click='openListenerFieldForm(null)' title='添加字段' /> <XButton type='primary' @click='openListenerFieldForm(null)' title='添加字段' />
</p> </p>
<el-table <el-table
:data='fieldsListOfListener' :data='fieldsListOfListener'
size='small' size='small'
max-height='240' max-height='240'
fit fit
border border
style='flex: none' style='flex: none'
> >
<el-table-column label='序号' width='80px' type='index' /> <el-table-column label='序号' width='80px' type='index' />
<el-table-column label='字段名称' min-width='100px' prop='name' /> <el-table-column label='字段名称' min-width='100px' prop='name' />
<el-table-column <el-table-column
label='字段类型' label='字段类型'
min-width='80px' min-width='80px'
show-overflow-tooltip show-overflow-tooltip
:formatter='(row) => fieldTypeObject[row.fieldType]' :formatter='(row) => fieldTypeObject[row.fieldType]'
/> />
<el-table-column <el-table-column
label='字段值/表达式' label='字段值/表达式'
min-width='100px' min-width='100px'
show-overflow-tooltip show-overflow-tooltip
:formatter='(row) => row.string || row.expression' :formatter='(row) => row.string || row.expression'
/> />
<el-table-column label='操作' width='130px'> <el-table-column label='操作' width='130px'>
<template #default='scope'> <template #default='scope'>
<el-button size='small' link @click='openListenerFieldForm(scope.row, scope.$index)' <el-button size='small' link @click='openListenerFieldForm(scope.row, scope.$index)'
>编辑 >编辑
</el-button </el-button
> >
<el-divider direction='vertical' /> <el-divider direction='vertical' />
<el-button <el-button
size='small' size='small'
link link
style='color: #ff4d4f' style='color: #ff4d4f'
@click='removeListenerField(scope.$index)' @click='removeListenerField(scope.$index)'
>移除 >移除
</el-button </el-button
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class='element-drawer__button'> <div class='element-drawer__button'>
<el-button @click='listenerFormModelVisible = false'> </el-button> <el-button @click='listenerFormModelVisible = false'> </el-button>
<el-button type='primary' @click='saveListenerConfig'> </el-button> <el-button type='primary' @click='saveListenerConfig'> </el-button>
</div> </div>
</el-drawer> </el-drawer>
<!-- 注入西段 编辑/创建 部分 --> <!-- 注入西段 编辑/创建 部分 -->
<el-dialog <el-dialog
title='字段配置' title='字段配置'
v-model='listenerFieldFormModelVisible' v-model='listenerFieldFormModelVisible'
width='600px' width='600px'
append-to-body append-to-body
destroy-on-close destroy-on-close
> >
<el-form <el-form
:model='listenerFieldForm' :model='listenerFieldForm'
label-width='96spx' label-width='96spx'
ref='listenerFieldFormRef' ref='listenerFieldFormRef'
style='height: 136px' style='height: 136px'
> >
<el-form-item <el-form-item
label='字段名称:' label='字段名称:'
prop='name' prop='name'
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model='listenerFieldForm.name' clearable /> <el-input v-model='listenerFieldForm.name' clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label='字段类型:' label='字段类型:'
prop='fieldType' prop='fieldType'
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-select v-model='listenerFieldForm.fieldType'> <el-select v-model='listenerFieldForm.fieldType' filterable>
<el-option <el-option
v-for='i in Object.keys(fieldTypeObject)' v-for='i in Object.keys(fieldTypeObject)'
:key='i' :key='i'
:label='fieldTypeObject[i]' :label='fieldTypeObject[i]'
:value='i' :value='i'
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerFieldForm.fieldType === 'string'" v-if="listenerFieldForm.fieldType === 'string'"
label='字段值:' label='字段值:'
prop='string' prop='string'
key='field-string' key='field-string'
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model='listenerFieldForm.string' clearable /> <el-input v-model='listenerFieldForm.string' clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerFieldForm.fieldType === 'expression'" v-if="listenerFieldForm.fieldType === 'expression'"
label='表达式:' label='表达式:'
prop='expression' prop='expression'
key='field-expression' key='field-expression'
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model='listenerFieldForm.expression' clearable /> <el-input v-model='listenerFieldForm.expression' clearable />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<el-button size='small' @click='listenerFieldFormModelVisible = false'> </el-button> <el-button size='small' @click='listenerFieldFormModelVisible = false'> </el-button>
<el-button size='small' type='primary' @click='saveListenerFiled'> </el-button> <el-button size='small' type='primary' @click='saveListenerFiled'> </el-button>
</template> </template>
</el-dialog> </el-dialog>
</div> </div>
<!-- 选择弹窗 --> <!-- 选择弹窗 -->
<ProcessListenerDialog ref='processListenerDialogRef' @select='selectProcessListener' /> <ProcessListenerDialog ref='processListenerDialogRef' @select='selectProcessListener' />
</template> </template>
<script lang='ts' setup> <script lang='ts' setup>
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import XButton from '@/components/XButton/src/XButton.vue' import XButton from '@/components/XButton/src/XButton.vue'
import { Plus, Select, Menu } from '@element-plus/icons-vue' import { Plus, Select, Menu } from '@element-plus/icons-vue'
import { createListenerObject, updateElementExtensions } from '../../utils' import { createListenerObject, updateElementExtensions } from '../../utils'
import { import {
initListenerType, initListenerType,
initListenerForm, initListenerForm,
listenerType, listenerType,
fieldType, fieldType,
initListenerForm2 initListenerForm2
} from './utilSelf' } from './utilSelf'
import ProcessListenerDialog from './ProcessListenerDialog.vue' import ProcessListenerDialog from './ProcessListenerDialog.vue'
defineOptions({ name: 'ElementListeners' }) defineOptions({ name: 'ElementListeners' })
const props = defineProps({ const props = defineProps({
id: String, id: String,
type: String type: String
}) })
const prefix = inject('prefix') const prefix = inject('prefix')
const width = inject('width') const width = inject('width')
const elementListenersList = ref<any[]>([]) // 监听器列表 const elementListenersList = ref<any[]>([]) // 监听器列表
const listenerForm = ref<any>({}) // 监听器详情表单 const listenerForm = ref<any>({}) // 监听器详情表单
const listenerFormModelVisible = ref(false) // 监听器 编辑 侧边栏显示状态 const listenerFormModelVisible = ref(false) // 监听器 编辑 侧边栏显示状态
const fieldsListOfListener = ref<any[]>([]) const fieldsListOfListener = ref<any[]>([])
const listenerFieldForm = ref<any>({}) // 监听器 注入字段 详情表单 const listenerFieldForm = ref<any>({}) // 监听器 注入字段 详情表单
const listenerFieldFormModelVisible = ref(false) // 监听器 注入字段表单弹窗 显示状态 const listenerFieldFormModelVisible = ref(false) // 监听器 注入字段表单弹窗 显示状态
const editingListenerIndex = ref(-1) // 监听器所在下标,-1 为新增 const editingListenerIndex = ref(-1) // 监听器所在下标,-1 为新增
const editingListenerFieldIndex = ref(-1) // 字段所在下标,-1 为新增 const editingListenerFieldIndex = ref(-1) // 字段所在下标,-1 为新增
const listenerTypeObject = ref(listenerType) const listenerTypeObject = ref(listenerType)
const fieldTypeObject = ref(fieldType) const fieldTypeObject = ref(fieldType)
const bpmnElement = ref() const bpmnElement = ref()
const otherExtensionList = ref() const otherExtensionList = ref()
const bpmnElementListeners = ref() const bpmnElementListeners = ref()
const listenerFormRef = ref() const listenerFormRef = ref()
const listenerFieldFormRef = ref() const listenerFieldFormRef = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances const bpmnInstances = () => (window as any)?.bpmnInstances
const resetListenersList = () => { const resetListenersList = () => {
bpmnElement.value = bpmnInstances().bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
otherExtensionList.value = [] otherExtensionList.value = []
bpmnElementListeners.value = bpmnElementListeners.value =
bpmnElement.value.businessObject?.extensionElements?.values?.filter( bpmnElement.value.businessObject?.extensionElements?.values?.filter(
(ex) => ex.$type === `${prefix}:ExecutionListener` (ex) => ex.$type === `${prefix}:ExecutionListener`
) ?? [] ) ?? []
elementListenersList.value = bpmnElementListeners.value.map((listener) => elementListenersList.value = bpmnElementListeners.value.map((listener) =>
initListenerType(listener) initListenerType(listener)
) )
} }
// 打开 监听器详情 侧边栏 // 打开 监听器详情 侧边栏
const openListenerForm = (listener, index?) => { const openListenerForm = (listener, index?) => {
// debugger if (listener) {
if (listener) { listenerForm.value = initListenerForm(listener)
listenerForm.value = initListenerForm(listener) editingListenerIndex.value = index
editingListenerIndex.value = index } else {
} else { listenerForm.value = {}
listenerForm.value = {} editingListenerIndex.value = -1 // 标记为新增
editingListenerIndex.value = -1 // 标记为新增 }
} if (listener && listener.fields) {
if (listener && listener.fields) { fieldsListOfListener.value = listener.fields.map((field) => ({
fieldsListOfListener.value = listener.fields.map((field) => ({ ...field,
...field, fieldType: field.string ? 'string' : 'expression'
fieldType: field.string ? 'string' : 'expression' }))
})) } else {
} else { fieldsListOfListener.value = []
fieldsListOfListener.value = [] listenerForm.value['fields'] = []
listenerForm.value['fields'] = [] }
} // 打开侧边栏并清楚验证状态
// 打开侧边栏并清楚验证状态 listenerFormModelVisible.value = true
listenerFormModelVisible.value = true nextTick(() => {
nextTick(() => { if (listenerFormRef.value) {
if (listenerFormRef.value) { listenerFormRef.value.clearValidate()
listenerFormRef.value.clearValidate() }
} })
}) }
} // 打开监听器字段编辑弹窗
// 打开监听器字段编辑弹窗 const openListenerFieldForm = (field, index?) => {
const openListenerFieldForm = (field, index?) => { listenerFieldForm.value = field ? JSON.parse(JSON.stringify(field)) : {}
listenerFieldForm.value = field ? JSON.parse(JSON.stringify(field)) : {} editingListenerFieldIndex.value = field ? index : -1
editingListenerFieldIndex.value = field ? index : -1 listenerFieldFormModelVisible.value = true
listenerFieldFormModelVisible.value = true nextTick(() => {
nextTick(() => { if (listenerFieldFormRef.value) {
if (listenerFieldFormRef.value) { listenerFieldFormRef.value.clearValidate()
listenerFieldFormRef.value.clearValidate() }
} })
}) }
} // 保存监听器注入字段
// 保存监听器注入字段 const saveListenerFiled = async () => {
const saveListenerFiled = async () => { let validateStatus = await listenerFieldFormRef.value.validate()
// debugger if (!validateStatus) return // 验证不通过直接返回
let validateStatus = await listenerFieldFormRef.value.validate() if (editingListenerFieldIndex.value === -1) {
if (!validateStatus) return // 验证不通过直接返回 fieldsListOfListener.value.push(listenerFieldForm.value)
if (editingListenerFieldIndex.value === -1) { listenerForm.value.fields.push(listenerFieldForm.value)
fieldsListOfListener.value.push(listenerFieldForm.value) } else {
listenerForm.value.fields.push(listenerFieldForm.value) fieldsListOfListener.value.splice(editingListenerFieldIndex.value, 1, listenerFieldForm.value)
} else { listenerForm.value.fields.splice(editingListenerFieldIndex.value, 1, listenerFieldForm.value)
fieldsListOfListener.value.splice(editingListenerFieldIndex.value, 1, listenerFieldForm.value) }
listenerForm.value.fields.splice(editingListenerFieldIndex.value, 1, listenerFieldForm.value) listenerFieldFormModelVisible.value = false
} nextTick(() => {
listenerFieldFormModelVisible.value = false listenerFieldForm.value = {}
nextTick(() => { })
listenerFieldForm.value = {} }
}) // 移除监听器字段
} const removeListenerField = (index) => {
// 移除监听器字段 ElMessageBox.confirm('确认移除该字段吗?', '提示', {
const removeListenerField = (index) => { confirmButtonText: '确 认',
// debugger cancelButtonText: '取 消'
ElMessageBox.confirm('确认移除该字段吗?', '提示', { })
confirmButtonText: '确 认', .then(() => {
cancelButtonText: '取 消' fieldsListOfListener.value.splice(index, 1)
}) listenerForm.value.fields.splice(index, 1)
.then(() => { })
fieldsListOfListener.value.splice(index, 1) .catch(() => console.info('操作取消'))
listenerForm.value.fields.splice(index, 1) }
}) // 移除监听器
.catch(() => console.info('操作取消')) const removeListener = (index) => {
} ElMessageBox.confirm('确认移除该监听器吗?', '提示', {
// 移除监听器 confirmButtonText: '确 认',
const removeListener = (index) => { cancelButtonText: '取 消'
ElMessageBox.confirm('确认移除该监听器吗?', '提示', { })
confirmButtonText: '确 认', .then(() => {
cancelButtonText: '取 消' bpmnElementListeners.value.splice(index, 1)
}) elementListenersList.value.splice(index, 1)
.then(() => { updateElementExtensions(
bpmnElementListeners.value.splice(index, 1) bpmnElement.value,
elementListenersList.value.splice(index, 1) otherExtensionList.value.concat(bpmnElementListeners.value)
updateElementExtensions( )
bpmnElement.value, })
otherExtensionList.value.concat(bpmnElementListeners.value) .catch(() => console.info('操作取消'))
) }
}) // 保存监听器配置
.catch(() => console.info('操作取消')) const saveListenerConfig = async () => {
} let validateStatus = await listenerFormRef.value.validate()
// 保存监听器配置 if (!validateStatus) return // 验证不通过直接返回
const saveListenerConfig = async () => { const listenerObject = createListenerObject(listenerForm.value, false, prefix)
// debugger if (editingListenerIndex.value === -1) {
let validateStatus = await listenerFormRef.value.validate() bpmnElementListeners.value.push(listenerObject)
if (!validateStatus) return // 验证不通过直接返回 elementListenersList.value.push(listenerForm.value)
const listenerObject = createListenerObject(listenerForm.value, false, prefix) } else {
if (editingListenerIndex.value === -1) { bpmnElementListeners.value.splice(editingListenerIndex.value, 1, listenerObject)
bpmnElementListeners.value.push(listenerObject) elementListenersList.value.splice(editingListenerIndex.value, 1, listenerForm.value)
elementListenersList.value.push(listenerForm.value) }
} else { // 保存其他配置
bpmnElementListeners.value.splice(editingListenerIndex.value, 1, listenerObject) otherExtensionList.value =
elementListenersList.value.splice(editingListenerIndex.value, 1, listenerForm.value) bpmnElement.value.businessObject?.extensionElements?.values?.filter(
} (ex) => ex.$type !== `${prefix}:ExecutionListener`
// 保存其他配置 ) ?? []
otherExtensionList.value = updateElementExtensions(
bpmnElement.value.businessObject?.extensionElements?.values?.filter( bpmnElement.value,
(ex) => ex.$type !== `${prefix}:ExecutionListener` otherExtensionList.value.concat(bpmnElementListeners.value)
) ?? [] )
updateElementExtensions( // 4. 隐藏侧边栏
bpmnElement.value, listenerFormModelVisible.value = false
otherExtensionList.value.concat(bpmnElementListeners.value) listenerForm.value = {}
) }
// 4. 隐藏侧边栏
listenerFormModelVisible.value = false // 打开监听器弹窗
listenerForm.value = {} const processListenerDialogRef = ref()
} const openProcessListenerDialog = async () => {
processListenerDialogRef.value.open('execution')
// 打开监听器弹窗 }
const processListenerDialogRef = ref() const selectProcessListener = (listener) => {
const openProcessListenerDialog = async () => { const listenerForm = initListenerForm2(listener)
processListenerDialogRef.value.open('execution') const listenerObject = createListenerObject(listenerForm, false, prefix)
} bpmnElementListeners.value.push(listenerObject)
const selectProcessListener = (listener) => { elementListenersList.value.push(listenerForm)
const listenerForm = initListenerForm2(listener)
const listenerObject = createListenerObject(listenerForm, false, prefix) // 保存其他配置
bpmnElementListeners.value.push(listenerObject) otherExtensionList.value =
elementListenersList.value.push(listenerForm) bpmnElement.value.businessObject?.extensionElements?.values?.filter(
(ex) => ex.$type !== `${prefix}:ExecutionListener`
// 保存其他配置 ) ?? []
otherExtensionList.value = updateElementExtensions(
bpmnElement.value.businessObject?.extensionElements?.values?.filter( bpmnElement.value,
(ex) => ex.$type !== `${prefix}:ExecutionListener` otherExtensionList.value.concat(bpmnElementListeners.value)
) ?? [] )
updateElementExtensions( }
bpmnElement.value,
otherExtensionList.value.concat(bpmnElementListeners.value) watch(
) () => props.id,
} (val) => {
val &&
watch( val.length &&
() => props.id, nextTick(() => {
(val) => { resetListenersList()
val && })
val.length && },
nextTick(() => { { immediate: true }
resetListenersList() )
}) </script>
},
{ immediate: true }
)
</script>

View File

@@ -1,491 +1,491 @@
<template> <template>
<div class="panel-tab__content"> <div class="panel-tab__content">
<el-table :data="elementListenersList" size="small" border> <el-table :data="elementListenersList" size="small" border>
<el-table-column label="序号" width="80px" type="index" /> <el-table-column label="序号" width="80px" type="index" />
<el-table-column <el-table-column
label="事件类型" label="事件类型"
min-width="80px" min-width="80px"
show-overflow-tooltip show-overflow-tooltip
:formatter="(row) => listenerEventTypeObject[row.event]" :formatter="(row) => listenerEventTypeObject[row.event]"
/> />
<el-table-column label="事件id" min-width="80px" prop="id" show-overflow-tooltip /> <el-table-column label="事件id" min-width="80px" prop="id" show-overflow-tooltip />
<el-table-column <el-table-column
label="监听器类型" label="监听器类型"
min-width="80px" min-width="80px"
show-overflow-tooltip show-overflow-tooltip
:formatter="(row) => listenerTypeObject[row.listenerType]" :formatter="(row) => listenerTypeObject[row.listenerType]"
/> />
<el-table-column label="操作" width="90px"> <el-table-column label="操作" width="90px">
<template #default="scope"> <template #default="scope">
<el-button size="small" link @click="openListenerForm(scope.row, scope.$index)" <el-button size="small" link @click="openListenerForm(scope.row, scope.$index)"
>编辑</el-button >编辑</el-button
> >
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<el-button <el-button
size="small" size="small"
link link
style="color: #ff4d4f" style="color: #ff4d4f"
@click="removeListener(scope.row, scope.$index)" @click="removeListener(scope.row, scope.$index)"
>移除</el-button >移除</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="element-drawer__button"> <div class="element-drawer__button">
<XButton <XButton
size="small" size="small"
type="primary" type="primary"
preIcon="ep:plus" preIcon="ep:plus"
title="添加监听器" title="添加监听器"
@click="openListenerForm(null)" @click="openListenerForm(null)"
/> />
<XButton <XButton
type="success" type="success"
preIcon="ep:select" preIcon="ep:select"
title="选择监听器" title="选择监听器"
size="small" size="small"
@click="openProcessListenerDialog" @click="openProcessListenerDialog"
/> />
</div> </div>
<!-- 监听器 编辑/创建 部分 --> <!-- 监听器 编辑/创建 部分 -->
<el-drawer <el-drawer
v-model="listenerFormModelVisible" v-model="listenerFormModelVisible"
title="任务监听器" title="任务监听器"
:size="`${width}px`" :size="`${width}px`"
append-to-body append-to-body
destroy-on-close destroy-on-close
> >
<el-form size="small" :model="listenerForm" label-width="96px" ref="listenerFormRef"> <el-form size="small" :model="listenerForm" label-width="96px" ref="listenerFormRef">
<el-form-item <el-form-item
label="事件类型" label="事件类型"
prop="event" prop="event"
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-select v-model="listenerForm.event"> <el-select v-model="listenerForm.event" filterable>
<el-option <el-option
v-for="i in Object.keys(listenerEventTypeObject)" v-for="i in Object.keys(listenerEventTypeObject)"
:key="i" :key="i"
:label="listenerEventTypeObject[i]" :label="listenerEventTypeObject[i]"
:value="i" :value="i"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="监听器ID" label="监听器ID"
prop="id" prop="id"
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model="listenerForm.id" clearable /> <el-input v-model="listenerForm.id" clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="监听器类型" label="监听器类型"
prop="listenerType" prop="listenerType"
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-select v-model="listenerForm.listenerType"> <el-select v-model="listenerForm.listenerType" filterable>
<el-option <el-option
v-for="i in Object.keys(listenerTypeObject)" v-for="i in Object.keys(listenerTypeObject)"
:key="i" :key="i"
:label="listenerTypeObject[i]" :label="listenerTypeObject[i]"
:value="i" :value="i"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerForm.listenerType === 'classListener'" v-if="listenerForm.listenerType === 'classListener'"
label="Java类" label="Java类"
prop="class" prop="class"
key="listener-class" key="listener-class"
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model="listenerForm.class" clearable /> <el-input v-model="listenerForm.class" clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerForm.listenerType === 'expressionListener'" v-if="listenerForm.listenerType === 'expressionListener'"
label="表达式" label="表达式"
prop="expression" prop="expression"
key="listener-expression" key="listener-expression"
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model="listenerForm.expression" clearable /> <el-input v-model="listenerForm.expression" clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerForm.listenerType === 'delegateExpressionListener'" v-if="listenerForm.listenerType === 'delegateExpressionListener'"
label="代理表达式" label="代理表达式"
prop="delegateExpression" prop="delegateExpression"
key="listener-delegate" key="listener-delegate"
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model="listenerForm.delegateExpression" clearable /> <el-input v-model="listenerForm.delegateExpression" clearable />
</el-form-item> </el-form-item>
<template v-if="listenerForm.listenerType === 'scriptListener'"> <template v-if="listenerForm.listenerType === 'scriptListener'">
<el-form-item <el-form-item
label="脚本格式" label="脚本格式"
prop="scriptFormat" prop="scriptFormat"
key="listener-script-format" key="listener-script-format"
:rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本格式' }" :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本格式' }"
> >
<el-input v-model="listenerForm.scriptFormat" clearable /> <el-input v-model="listenerForm.scriptFormat" clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="脚本类型" label="脚本类型"
prop="scriptType" prop="scriptType"
key="listener-script-type" key="listener-script-type"
:rules="{ required: true, trigger: ['blur', 'change'], message: '请选择脚本类型' }" :rules="{ required: true, trigger: ['blur', 'change'], message: '请选择脚本类型' }"
> >
<el-select v-model="listenerForm.scriptType"> <el-select v-model="listenerForm.scriptType" filterable>
<el-option label="内联脚本" value="inlineScript" /> <el-option label="内联脚本" value="inlineScript" />
<el-option label="外部脚本" value="externalScript" /> <el-option label="外部脚本" value="externalScript" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerForm.scriptType === 'inlineScript'" v-if="listenerForm.scriptType === 'inlineScript'"
label="脚本内容" label="脚本内容"
prop="value" prop="value"
key="listener-script" key="listener-script"
:rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本内容' }" :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本内容' }"
> >
<el-input v-model="listenerForm.value" clearable /> <el-input v-model="listenerForm.value" clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerForm.scriptType === 'externalScript'" v-if="listenerForm.scriptType === 'externalScript'"
label="资源地址" label="资源地址"
prop="resource" prop="resource"
key="listener-resource" key="listener-resource"
:rules="{ required: true, trigger: ['blur', 'change'], message: '请填写资源地址' }" :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写资源地址' }"
> >
<el-input v-model="listenerForm.resource" clearable /> <el-input v-model="listenerForm.resource" clearable />
</el-form-item> </el-form-item>
</template> </template>
<template v-if="listenerForm.event === 'timeout'"> <template v-if="listenerForm.event === 'timeout'">
<el-form-item label="定时器类型" prop="eventDefinitionType" key="eventDefinitionType"> <el-form-item label="定时器类型" prop="eventDefinitionType" key="eventDefinitionType">
<el-select v-model="listenerForm.eventDefinitionType"> <el-select v-model="listenerForm.eventDefinitionType" filterable>
<el-option label="日期" value="date" /> <el-option label="统计时间" value="date" />
<el-option label="持续时长" value="duration" /> <el-option label="持续时长" value="duration" />
<el-option label="循环" value="cycle" /> <el-option label="循环" value="cycle" />
<el-option label="无" value="null" /> <el-option label="无" value="null" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="!!listenerForm.eventDefinitionType && listenerForm.eventDefinitionType !== 'null'" v-if="!!listenerForm.eventDefinitionType && listenerForm.eventDefinitionType !== 'null'"
label="定时器" label="定时器"
prop="eventTimeDefinitions" prop="eventTimeDefinitions"
key="eventTimeDefinitions" key="eventTimeDefinitions"
:rules="{ required: true, trigger: ['blur', 'change'], message: '请填写定时器配置' }" :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写定时器配置' }"
> >
<el-input v-model="listenerForm.eventTimeDefinitions" clearable /> <el-input v-model="listenerForm.eventTimeDefinitions" clearable />
</el-form-item> </el-form-item>
</template> </template>
</el-form> </el-form>
<el-divider /> <el-divider />
<p class="listener-filed__title"> <p class="listener-filed__title">
<span><Icon icon="ep:menu" />注入字段</span> <span><Icon icon="ep:menu" />注入字段</span>
<el-button size="small" type="primary" @click="openListenerFieldForm(null)" <el-button size="small" type="primary" @click="openListenerFieldForm(null)"
>添加字段</el-button >添加字段</el-button
> >
</p> </p>
<el-table <el-table
:data="fieldsListOfListener" :data="fieldsListOfListener"
size="small" size="small"
max-height="240" max-height="240"
fit fit
border border
style="flex: none" style="flex: none"
> >
<el-table-column label="序号" width="80px" type="index" /> <el-table-column label="序号" width="80px" type="index" />
<el-table-column label="字段名称" min-width="100px" prop="name" /> <el-table-column label="字段名称" min-width="100px" prop="name" />
<el-table-column <el-table-column
label="字段类型" label="字段类型"
min-width="80px" min-width="80px"
show-overflow-tooltip show-overflow-tooltip
:formatter="(row) => fieldTypeObject[row.fieldType]" :formatter="(row) => fieldTypeObject[row.fieldType]"
/> />
<el-table-column <el-table-column
label="字段值/表达式" label="字段值/表达式"
min-width="100px" min-width="100px"
show-overflow-tooltip show-overflow-tooltip
:formatter="(row) => row.string || row.expression" :formatter="(row) => row.string || row.expression"
/> />
<el-table-column label="操作" width="100px"> <el-table-column label="操作" width="100px">
<template #default="scope"> <template #default="scope">
<el-button size="small" link @click="openListenerFieldForm(scope.row, scope.$index)" <el-button size="small" link @click="openListenerFieldForm(scope.row, scope.$index)"
>编辑</el-button >编辑</el-button
> >
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<el-button <el-button
size="small" size="small"
link link
style="color: #ff4d4f" style="color: #ff4d4f"
@click="removeListenerField(scope.row, scope.$index)" @click="removeListenerField(scope.row, scope.$index)"
>移除</el-button >移除</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="element-drawer__button"> <div class="element-drawer__button">
<el-button size="small" @click="listenerFormModelVisible = false"> </el-button> <el-button size="small" @click="listenerFormModelVisible = false"> </el-button>
<el-button size="small" type="primary" @click="saveListenerConfig"> </el-button> <el-button size="small" type="primary" @click="saveListenerConfig"> </el-button>
</div> </div>
</el-drawer> </el-drawer>
<!-- 注入西段 编辑/创建 部分 --> <!-- 注入西段 编辑/创建 部分 -->
<el-dialog <el-dialog
title="字段配置" title="字段配置"
v-model="listenerFieldFormModelVisible" v-model="listenerFieldFormModelVisible"
width="600px" width="600px"
append-to-body append-to-body
destroy-on-close destroy-on-close
> >
<el-form <el-form
:model="listenerFieldForm" :model="listenerFieldForm"
size="small" size="small"
label-width="96px" label-width="96px"
ref="listenerFieldFormRef" ref="listenerFieldFormRef"
style="height: 136px" style="height: 136px"
> >
<el-form-item <el-form-item
label="字段名称:" label="字段名称:"
prop="name" prop="name"
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model="listenerFieldForm.name" clearable /> <el-input v-model="listenerFieldForm.name" clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="字段类型:" label="字段类型:"
prop="fieldType" prop="fieldType"
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-select v-model="listenerFieldForm.fieldType"> <el-select v-model="listenerFieldForm.fieldType" filterable>
<el-option <el-option
v-for="i in Object.keys(fieldTypeObject)" v-for="i in Object.keys(fieldTypeObject)"
:key="i" :key="i"
:label="fieldTypeObject[i]" :label="fieldTypeObject[i]"
:value="i" :value="i"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerFieldForm.fieldType === 'string'" v-if="listenerFieldForm.fieldType === 'string'"
label="字段值:" label="字段值:"
prop="string" prop="string"
key="field-string" key="field-string"
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model="listenerFieldForm.string" clearable /> <el-input v-model="listenerFieldForm.string" clearable />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="listenerFieldForm.fieldType === 'expression'" v-if="listenerFieldForm.fieldType === 'expression'"
label="表达式:" label="表达式:"
prop="expression" prop="expression"
key="field-expression" key="field-expression"
:rules="{ required: true, trigger: ['blur', 'change'] }" :rules="{ required: true, trigger: ['blur', 'change'] }"
> >
<el-input v-model="listenerFieldForm.expression" clearable /> <el-input v-model="listenerFieldForm.expression" clearable />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<el-button size="small" @click="listenerFieldFormModelVisible = false"> </el-button> <el-button size="small" @click="listenerFieldFormModelVisible = false"> </el-button>
<el-button size="small" type="primary" @click="saveListenerFiled"> </el-button> <el-button size="small" type="primary" @click="saveListenerFiled"> </el-button>
</template> </template>
</el-dialog> </el-dialog>
</div> </div>
<!-- 选择弹窗 --> <!-- 选择弹窗 -->
<ProcessListenerDialog ref="processListenerDialogRef" @select="selectProcessListener" /> <ProcessListenerDialog ref="processListenerDialogRef" @select="selectProcessListener" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import { createListenerObject, updateElementExtensions } from '../../utils' import { createListenerObject, updateElementExtensions } from '../../utils'
import { import {
initListenerForm, initListenerForm,
initListenerType, initListenerType,
eventType, eventType,
listenerType, listenerType,
fieldType, fieldType,
initListenerForm2 initListenerForm2
} from './utilSelf' } from './utilSelf'
import ProcessListenerDialog from '@/components/bpmnProcessDesigner/package/penal/listeners/ProcessListenerDialog.vue' import ProcessListenerDialog from '@/components/bpmnProcessDesigner/package/penal/listeners/ProcessListenerDialog.vue'
defineOptions({ name: 'UserTaskListeners' }) defineOptions({ name: 'UserTaskListeners' })
const props = defineProps({ const props = defineProps({
id: String, id: String,
type: String type: String
}) })
const prefix = inject('prefix') const prefix = inject('prefix')
const width = inject('width') const width = inject('width')
const elementListenersList = ref<any[]>([]) const elementListenersList = ref<any[]>([])
const listenerEventTypeObject = ref(eventType) const listenerEventTypeObject = ref(eventType)
const listenerTypeObject = ref(listenerType) const listenerTypeObject = ref(listenerType)
const listenerFormModelVisible = ref(false) const listenerFormModelVisible = ref(false)
const listenerForm = ref<any>({}) const listenerForm = ref<any>({})
const fieldTypeObject = ref(fieldType) const fieldTypeObject = ref(fieldType)
const fieldsListOfListener = ref<any[]>([]) const fieldsListOfListener = ref<any[]>([])
const listenerFieldFormModelVisible = ref(false) // 监听器 注入字段表单弹窗 显示状态 const listenerFieldFormModelVisible = ref(false) // 监听器 注入字段表单弹窗 显示状态
const editingListenerIndex = ref(-1) // 监听器所在下标,-1 为新增 const editingListenerIndex = ref(-1) // 监听器所在下标,-1 为新增
const editingListenerFieldIndex = ref(-1) // 字段所在下标,-1 为新增 const editingListenerFieldIndex = ref(-1) // 字段所在下标,-1 为新增
const listenerFieldForm = ref<any>({}) // 监听器 注入字段 详情表单 const listenerFieldForm = ref<any>({}) // 监听器 注入字段 详情表单
const bpmnElement = ref() const bpmnElement = ref()
const bpmnElementListeners = ref() const bpmnElementListeners = ref()
const otherExtensionList = ref() const otherExtensionList = ref()
const listenerFormRef = ref() const listenerFormRef = ref()
const listenerFieldFormRef = ref() const listenerFieldFormRef = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances const bpmnInstances = () => (window as any)?.bpmnInstances
const resetListenersList = () => { const resetListenersList = () => {
// console.log( // console.log(
// bpmnInstances().bpmnElement, // bpmnInstances().bpmnElement,
// 'window.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElement' // 'window.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElement'
// ) // )
bpmnElement.value = bpmnInstances().bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
otherExtensionList.value = [] otherExtensionList.value = []
bpmnElementListeners.value = bpmnElementListeners.value =
bpmnElement.value.businessObject?.extensionElements?.values.filter( bpmnElement.value.businessObject?.extensionElements?.values.filter(
(ex) => ex.$type === `${prefix}:TaskListener` (ex) => ex.$type === `${prefix}:TaskListener`
) ?? [] ) ?? []
elementListenersList.value = bpmnElementListeners.value.map((listener) => elementListenersList.value = bpmnElementListeners.value.map((listener) =>
initListenerType(listener) initListenerType(listener)
) )
} }
const openListenerForm = (listener, index?) => { const openListenerForm = (listener, index?) => {
if (listener) { if (listener) {
listenerForm.value = initListenerForm(listener) listenerForm.value = initListenerForm(listener)
editingListenerIndex.value = index editingListenerIndex.value = index
} else { } else {
listenerForm.value = {} listenerForm.value = {}
editingListenerIndex.value = -1 // 标记为新增 editingListenerIndex.value = -1 // 标记为新增
} }
if (listener && listener.fields) { if (listener && listener.fields) {
fieldsListOfListener.value = listener.fields.map((field) => ({ fieldsListOfListener.value = listener.fields.map((field) => ({
...field, ...field,
fieldType: field.string ? 'string' : 'expression' fieldType: field.string ? 'string' : 'expression'
})) }))
} else { } else {
fieldsListOfListener.value = [] fieldsListOfListener.value = []
listenerForm.value['fields'] = [] listenerForm.value['fields'] = []
} }
// 打开侧边栏并清楚验证状态 // 打开侧边栏并清楚验证状态
listenerFormModelVisible.value = true listenerFormModelVisible.value = true
nextTick(() => { nextTick(() => {
if (listenerFormRef.value) listenerFormRef.value.clearValidate() if (listenerFormRef.value) listenerFormRef.value.clearValidate()
}) })
} }
// 移除监听器 // 移除监听器
const removeListener = (listener, index?) => { const removeListener = (listener, index?) => {
console.log(listener, 'listener') //console.log(listener, 'listener')
ElMessageBox.confirm('确认移除该监听器吗?', '提示', { ElMessageBox.confirm('确认移除该监听器吗?', '提示', {
confirmButtonText: '确 认', confirmButtonText: '确 认',
cancelButtonText: '取 消' cancelButtonText: '取 消'
}) })
.then(() => { .then(() => {
bpmnElementListeners.value.splice(index, 1) bpmnElementListeners.value.splice(index, 1)
elementListenersList.value.splice(index, 1) elementListenersList.value.splice(index, 1)
updateElementExtensions( updateElementExtensions(
bpmnElement.value, bpmnElement.value,
otherExtensionList.value.concat(bpmnElementListeners.value) otherExtensionList.value.concat(bpmnElementListeners.value)
) )
}) })
.catch(() => console.info('操作取消')) .catch(() => console.info('操作取消'))
} }
// 保存监听器 // 保存监听器
const saveListenerConfig = async () => { const saveListenerConfig = async () => {
let validateStatus = await listenerFormRef.value.validate() let validateStatus = await listenerFormRef.value.validate()
if (!validateStatus) return // 验证不通过直接返回 if (!validateStatus) return // 验证不通过直接返回
const listenerObject = createListenerObject(listenerForm.value, true, prefix) const listenerObject = createListenerObject(listenerForm.value, true, prefix)
if (editingListenerIndex.value === -1) { if (editingListenerIndex.value === -1) {
bpmnElementListeners.value.push(listenerObject) bpmnElementListeners.value.push(listenerObject)
elementListenersList.value.push(listenerForm.value) elementListenersList.value.push(listenerForm.value)
} else { } else {
bpmnElementListeners.value.splice(editingListenerIndex.value, 1, listenerObject) bpmnElementListeners.value.splice(editingListenerIndex.value, 1, listenerObject)
elementListenersList.value.splice(editingListenerIndex.value, 1, listenerForm.value) elementListenersList.value.splice(editingListenerIndex.value, 1, listenerForm.value)
} }
// 保存其他配置 // 保存其他配置
otherExtensionList.value = otherExtensionList.value =
bpmnElement.value.businessObject?.extensionElements?.values?.filter( bpmnElement.value.businessObject?.extensionElements?.values?.filter(
(ex) => ex.$type !== `${prefix}:TaskListener` (ex) => ex.$type !== `${prefix}:TaskListener`
) ?? [] ) ?? []
updateElementExtensions( updateElementExtensions(
bpmnElement.value, bpmnElement.value,
otherExtensionList.value.concat(bpmnElementListeners.value) otherExtensionList.value.concat(bpmnElementListeners.value)
) )
// 4. 隐藏侧边栏 // 4. 隐藏侧边栏
listenerFormModelVisible.value = false listenerFormModelVisible.value = false
listenerForm.value = {} listenerForm.value = {}
} }
// 打开监听器字段编辑弹窗 // 打开监听器字段编辑弹窗
const openListenerFieldForm = (field, index?) => { const openListenerFieldForm = (field, index?) => {
listenerFieldForm.value = field ? JSON.parse(JSON.stringify(field)) : {} listenerFieldForm.value = field ? JSON.parse(JSON.stringify(field)) : {}
editingListenerFieldIndex.value = field ? index : -1 editingListenerFieldIndex.value = field ? index : -1
listenerFieldFormModelVisible.value = true listenerFieldFormModelVisible.value = true
nextTick(() => { nextTick(() => {
if (listenerFieldFormRef.value) listenerFieldFormRef.value.clearValidate() if (listenerFieldFormRef.value) listenerFieldFormRef.value.clearValidate()
}) })
} }
// 保存监听器注入字段 // 保存监听器注入字段
const saveListenerFiled = async () => { const saveListenerFiled = async () => {
let validateStatus = await listenerFieldFormRef.value.validate() let validateStatus = await listenerFieldFormRef.value.validate()
if (!validateStatus) return // 验证不通过直接返回 if (!validateStatus) return // 验证不通过直接返回
if (editingListenerFieldIndex.value === -1) { if (editingListenerFieldIndex.value === -1) {
fieldsListOfListener.value.push(listenerFieldForm.value) fieldsListOfListener.value.push(listenerFieldForm.value)
listenerForm.value.fields.push(listenerFieldForm.value) listenerForm.value.fields.push(listenerFieldForm.value)
} else { } else {
fieldsListOfListener.value.splice(editingListenerFieldIndex.value, 1, listenerFieldForm.value) fieldsListOfListener.value.splice(editingListenerFieldIndex.value, 1, listenerFieldForm.value)
listenerForm.value.fields.splice(editingListenerFieldIndex.value, 1, listenerFieldForm.value) listenerForm.value.fields.splice(editingListenerFieldIndex.value, 1, listenerFieldForm.value)
} }
listenerFieldFormModelVisible.value = false listenerFieldFormModelVisible.value = false
nextTick(() => { nextTick(() => {
listenerFieldForm.value = {} listenerFieldForm.value = {}
}) })
} }
// 移除监听器字段 // 移除监听器字段
const removeListenerField = (field, index) => { const removeListenerField = (field, index) => {
console.log(field, 'field') console.log(field, 'field')
ElMessageBox.confirm('确认移除该字段吗?', '提示', { ElMessageBox.confirm('确认移除该字段吗?', '提示', {
confirmButtonText: '确 认', confirmButtonText: '确 认',
cancelButtonText: '取 消' cancelButtonText: '取 消'
}) })
.then(() => { .then(() => {
fieldsListOfListener.value.splice(index, 1) fieldsListOfListener.value.splice(index, 1)
listenerForm.value.fields.splice(index, 1) listenerForm.value.fields.splice(index, 1)
}) })
.catch(() => console.info('操作取消')) .catch(() => console.info('操作取消'))
} }
// 打开监听器弹窗 // 打开监听器弹窗
const processListenerDialogRef = ref() const processListenerDialogRef = ref()
const openProcessListenerDialog = async () => { const openProcessListenerDialog = async () => {
processListenerDialogRef.value.open('task') processListenerDialogRef.value.open('task')
} }
const selectProcessListener = (listener) => { const selectProcessListener = (listener) => {
const listenerForm = initListenerForm2(listener) const listenerForm = initListenerForm2(listener)
const listenerObject = createListenerObject(listenerForm, true, prefix) const listenerObject = createListenerObject(listenerForm, true, prefix)
bpmnElementListeners.value.push(listenerObject) bpmnElementListeners.value.push(listenerObject)
elementListenersList.value.push(listenerForm) elementListenersList.value.push(listenerForm)
// 保存其他配置 // 保存其他配置
otherExtensionList.value = otherExtensionList.value =
bpmnElement.value.businessObject?.extensionElements?.values?.filter( bpmnElement.value.businessObject?.extensionElements?.values?.filter(
(ex) => ex.$type !== `${prefix}:TaskListener` (ex) => ex.$type !== `${prefix}:TaskListener`
) ?? [] ) ?? []
updateElementExtensions( updateElementExtensions(
bpmnElement.value, bpmnElement.value,
otherExtensionList.value.concat(bpmnElementListeners.value) otherExtensionList.value.concat(bpmnElementListeners.value)
) )
} }
watch( watch(
() => props.id, () => props.id,
(val) => { (val) => {
val && val &&
val.length && val.length &&
nextTick(() => { nextTick(() => {
resetListenersList() resetListenersList()
}) })
}, },
{ immediate: true } { immediate: true }
) )
</script> </script>

View File

@@ -20,7 +20,7 @@ export function initListenerForm(listener) {
self.eventDefinitionType = key.replace('time', '').toLowerCase() self.eventDefinitionType = key.replace('time', '').toLowerCase()
} }
} }
console.log(k) //console.log(k)
self.eventTimeDefinitions = listener.eventDefinitions[0][k].body self.eventTimeDefinitions = listener.eventDefinitions[0][k].body
} }
} }

View File

@@ -1,280 +1,280 @@
<template> <template>
<div class="panel-tab__content"> <div class="panel-tab__content">
<el-form label-width="90px"> <el-form label-width="90px">
<el-form-item label="快捷配置"> <el-form-item label="快捷配置">
<el-button size="small" @click="changeConfig('依次审批')">依次审批</el-button> <el-button size="small" @click="changeConfig('依次审批')">依次审批</el-button>
<el-button size="small" @click="changeConfig('会签')">会签</el-button> <el-button size="small" @click="changeConfig('会签')">会签</el-button>
<el-button size="small" @click="changeConfig('或签')">或签</el-button> <el-button size="small" @click="changeConfig('或签')">或签</el-button>
</el-form-item> </el-form-item>
<el-form-item label="会签类型"> <el-form-item label="会签类型">
<el-select v-model="loopCharacteristics" @change="changeLoopCharacteristicsType"> <el-select v-model="loopCharacteristics" @change="changeLoopCharacteristicsType" filterable>
<el-option label="并行多重事件" value="ParallelMultiInstance" /> <el-option label="并行多重事件" value="ParallelMultiInstance" />
<el-option label="时序多重事件" value="SequentialMultiInstance" /> <el-option label="时序多重事件" value="SequentialMultiInstance" />
<el-option label="无" value="Null" /> <el-option label="无" value="Null" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<template <template
v-if=" v-if="
loopCharacteristics === 'ParallelMultiInstance' || loopCharacteristics === 'ParallelMultiInstance' ||
loopCharacteristics === 'SequentialMultiInstance' loopCharacteristics === 'SequentialMultiInstance'
" "
> >
<el-form-item label="循环数量" key="loopCardinality"> <el-form-item label="循环数量" key="loopCardinality">
<el-input <el-input
v-model="loopInstanceForm.loopCardinality" v-model="loopInstanceForm.loopCardinality"
clearable clearable
@change="updateLoopCardinality" @change="updateLoopCardinality"
/> />
</el-form-item> </el-form-item>
<el-form-item label="集合" key="collection" v-show="false"> <el-form-item label="集合" key="collection" v-show="false">
<el-input v-model="loopInstanceForm.collection" clearable @change="updateLoopBase" /> <el-input v-model="loopInstanceForm.collection" clearable @change="updateLoopBase" />
</el-form-item> </el-form-item>
<!-- add by 芋艿:由于「元素变量」暂时用不到,所以这里 display 为 none --> <!-- add by 芋艿:由于「元素变量」暂时用不到,所以这里 display 为 none -->
<el-form-item label="元素变量" key="elementVariable" style="display: none"> <el-form-item label="元素变量" key="elementVariable" style="display: none">
<el-input v-model="loopInstanceForm.elementVariable" clearable @change="updateLoopBase" /> <el-input v-model="loopInstanceForm.elementVariable" clearable @change="updateLoopBase" />
</el-form-item> </el-form-item>
<el-form-item label="完成条件" key="completionCondition"> <el-form-item label="完成条件" key="completionCondition">
<el-input <el-input
v-model="loopInstanceForm.completionCondition" v-model="loopInstanceForm.completionCondition"
clearable clearable
@change="updateLoopCondition" @change="updateLoopCondition"
/> />
</el-form-item> </el-form-item>
<!-- add by 芋艿:由于「异步状态」暂时用不到,所以这里 display 为 none --> <!-- add by 芋艿:由于「异步状态」暂时用不到,所以这里 display 为 none -->
<el-form-item label="异步状态" key="async" style="display: none"> <el-form-item label="异步状态" key="async" style="display: none">
<el-checkbox <el-checkbox
v-model="loopInstanceForm.asyncBefore" v-model="loopInstanceForm.asyncBefore"
label="异步前" label="异步前"
@change="updateLoopAsync('asyncBefore')" @change="updateLoopAsync('asyncBefore')"
/> />
<el-checkbox <el-checkbox
v-model="loopInstanceForm.asyncAfter" v-model="loopInstanceForm.asyncAfter"
label="异步后" label="异步后"
@change="updateLoopAsync('asyncAfter')" @change="updateLoopAsync('asyncAfter')"
/> />
<el-checkbox <el-checkbox
v-model="loopInstanceForm.exclusive" v-model="loopInstanceForm.exclusive"
v-if="loopInstanceForm.asyncAfter || loopInstanceForm.asyncBefore" v-if="loopInstanceForm.asyncAfter || loopInstanceForm.asyncBefore"
label="排除" label="排除"
@change="updateLoopAsync('exclusive')" @change="updateLoopAsync('exclusive')"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="重试周期" label="重试周期"
prop="timeCycle" prop="timeCycle"
v-if="loopInstanceForm.asyncAfter || loopInstanceForm.asyncBefore" v-if="loopInstanceForm.asyncAfter || loopInstanceForm.asyncBefore"
key="timeCycle" key="timeCycle"
> >
<el-input v-model="loopInstanceForm.timeCycle" clearable @change="updateLoopTimeCycle" /> <el-input v-model="loopInstanceForm.timeCycle" clearable @change="updateLoopTimeCycle" />
</el-form-item> </el-form-item>
</template> </template>
</el-form> </el-form>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
defineOptions({ name: 'ElementMultiInstance' }) defineOptions({ name: 'ElementMultiInstance' })
const props = defineProps({ const props = defineProps({
businessObject: Object, businessObject: Object,
type: String type: String
}) })
const prefix = inject('prefix') const prefix = inject('prefix')
const loopCharacteristics = ref('') const loopCharacteristics = ref('')
//默认配置,用来覆盖原始不存在的选项,避免报错 //默认配置,用来覆盖原始不存在的选项,避免报错
const defaultLoopInstanceForm = ref({ const defaultLoopInstanceForm = ref({
completionCondition: '', completionCondition: '',
loopCardinality: '', loopCardinality: '',
extensionElements: [], extensionElements: [],
asyncAfter: false, asyncAfter: false,
asyncBefore: false, asyncBefore: false,
exclusive: false exclusive: false
}) })
const loopInstanceForm = ref<any>({}) const loopInstanceForm = ref<any>({})
const bpmnElement = ref(null) const bpmnElement = ref(null)
const multiLoopInstance = ref(null) const multiLoopInstance = ref(null)
const bpmnInstances = () => (window as any)?.bpmnInstances const bpmnInstances = () => (window as any)?.bpmnInstances
const getElementLoop = (businessObject) => { const getElementLoop = (businessObject) => {
if (!businessObject.loopCharacteristics) { if (!businessObject.loopCharacteristics) {
loopCharacteristics.value = 'Null' loopCharacteristics.value = 'Null'
loopInstanceForm.value = {} loopInstanceForm.value = {}
return return
} }
if (businessObject.loopCharacteristics.$type === 'bpmn:StandardLoopCharacteristics') { if (businessObject.loopCharacteristics.$type === 'bpmn:StandardLoopCharacteristics') {
loopCharacteristics.value = 'StandardLoop' loopCharacteristics.value = 'StandardLoop'
loopInstanceForm.value = {} loopInstanceForm.value = {}
return return
} }
if (businessObject.loopCharacteristics.isSequential) { if (businessObject.loopCharacteristics.isSequential) {
loopCharacteristics.value = 'SequentialMultiInstance' loopCharacteristics.value = 'SequentialMultiInstance'
} else { } else {
loopCharacteristics.value = 'ParallelMultiInstance' loopCharacteristics.value = 'ParallelMultiInstance'
} }
// 合并配置 // 合并配置
loopInstanceForm.value = { loopInstanceForm.value = {
...defaultLoopInstanceForm.value, ...defaultLoopInstanceForm.value,
...businessObject.loopCharacteristics, ...businessObject.loopCharacteristics,
completionCondition: businessObject.loopCharacteristics?.completionCondition?.body ?? '', completionCondition: businessObject.loopCharacteristics?.completionCondition?.body ?? '',
loopCardinality: businessObject.loopCharacteristics?.loopCardinality?.body ?? '' loopCardinality: businessObject.loopCharacteristics?.loopCardinality?.body ?? ''
} }
// 保留当前元素 businessObject 上的 loopCharacteristics 实例 // 保留当前元素 businessObject 上的 loopCharacteristics 实例
multiLoopInstance.value = bpmnInstances().bpmnElement.businessObject.loopCharacteristics multiLoopInstance.value = bpmnInstances().bpmnElement.businessObject.loopCharacteristics
// 更新表单 // 更新表单
if ( if (
businessObject.loopCharacteristics.extensionElements && businessObject.loopCharacteristics.extensionElements &&
businessObject.loopCharacteristics.extensionElements.values && businessObject.loopCharacteristics.extensionElements.values &&
businessObject.loopCharacteristics.extensionElements.values.length businessObject.loopCharacteristics.extensionElements.values.length
) { ) {
loopInstanceForm.value['timeCycle'] = loopInstanceForm.value['timeCycle'] =
businessObject.loopCharacteristics.extensionElements.values[0].body businessObject.loopCharacteristics.extensionElements.values[0].body
} }
} }
const changeLoopCharacteristicsType = (type) => { const changeLoopCharacteristicsType = (type) => {
// this.loopInstanceForm = { ...this.defaultLoopInstanceForm }; // 切换类型取消原表单配置 // this.loopInstanceForm = { ...this.defaultLoopInstanceForm }; // 切换类型取消原表单配置
// 取消多实例配置 // 取消多实例配置
if (type === 'Null') { if (type === 'Null') {
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: null loopCharacteristics: null
}) })
return return
} }
// 配置循环 // 配置循环
if (type === 'StandardLoop') { if (type === 'StandardLoop') {
const loopCharacteristicsObject = bpmnInstances().moddle.create( const loopCharacteristicsObject = bpmnInstances().moddle.create(
'bpmn:StandardLoopCharacteristics' 'bpmn:StandardLoopCharacteristics'
) )
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: loopCharacteristicsObject loopCharacteristics: loopCharacteristicsObject
}) })
multiLoopInstance.value = null multiLoopInstance.value = null
return return
} }
// 时序 // 时序
if (type === 'SequentialMultiInstance') { if (type === 'SequentialMultiInstance') {
multiLoopInstance.value = bpmnInstances().moddle.create( multiLoopInstance.value = bpmnInstances().moddle.create(
'bpmn:MultiInstanceLoopCharacteristics', 'bpmn:MultiInstanceLoopCharacteristics',
{ isSequential: true } { isSequential: true }
) )
} else { } else {
multiLoopInstance.value = bpmnInstances().moddle.create( multiLoopInstance.value = bpmnInstances().moddle.create(
'bpmn:MultiInstanceLoopCharacteristics', 'bpmn:MultiInstanceLoopCharacteristics',
{ collection: '${coll_userList}' } { collection: '${coll_userList}' }
) )
} }
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: toRaw(multiLoopInstance.value) loopCharacteristics: toRaw(multiLoopInstance.value)
}) })
} }
// 循环基数 // 循环基数
const updateLoopCardinality = (cardinality) => { const updateLoopCardinality = (cardinality) => {
let loopCardinality = null let loopCardinality = null
if (cardinality && cardinality.length) { if (cardinality && cardinality.length) {
loopCardinality = bpmnInstances().moddle.create('bpmn:FormalExpression', { loopCardinality = bpmnInstances().moddle.create('bpmn:FormalExpression', {
body: cardinality body: cardinality
}) })
} }
bpmnInstances().modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
multiLoopInstance.value, multiLoopInstance.value,
{ {
loopCardinality loopCardinality
} }
) )
} }
// 完成条件 // 完成条件
const updateLoopCondition = (condition) => { const updateLoopCondition = (condition) => {
let completionCondition = null let completionCondition = null
if (condition && condition.length) { if (condition && condition.length) {
completionCondition = bpmnInstances().moddle.create('bpmn:FormalExpression', { completionCondition = bpmnInstances().moddle.create('bpmn:FormalExpression', {
body: condition body: condition
}) })
} }
bpmnInstances().modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
multiLoopInstance.value, multiLoopInstance.value,
{ {
completionCondition completionCondition
} }
) )
} }
// 重试周期 // 重试周期
const updateLoopTimeCycle = (timeCycle) => { const updateLoopTimeCycle = (timeCycle) => {
const extensionElements = bpmnInstances().moddle.create('bpmn:ExtensionElements', { const extensionElements = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
values: [ values: [
bpmnInstances().moddle.create(`${prefix}:FailedJobRetryTimeCycle`, { bpmnInstances().moddle.create(`${prefix}:FailedJobRetryTimeCycle`, {
body: timeCycle body: timeCycle
}) })
] ]
}) })
bpmnInstances().modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
multiLoopInstance.value, multiLoopInstance.value,
{ {
extensionElements extensionElements
} }
) )
} }
// 直接更新的基础信息 // 直接更新的基础信息
const updateLoopBase = () => { const updateLoopBase = () => {
bpmnInstances().modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
multiLoopInstance.value, multiLoopInstance.value,
{ {
collection: loopInstanceForm.value.collection || null, collection: loopInstanceForm.value.collection || null,
elementVariable: loopInstanceForm.value.elementVariable || null elementVariable: loopInstanceForm.value.elementVariable || null
} }
) )
} }
// 各异步状态 // 各异步状态
const updateLoopAsync = (key) => { const updateLoopAsync = (key) => {
const { asyncBefore, asyncAfter } = loopInstanceForm.value const { asyncBefore, asyncAfter } = loopInstanceForm.value
let asyncAttr = Object.create(null) let asyncAttr = Object.create(null)
if (!asyncBefore && !asyncAfter) { if (!asyncBefore && !asyncAfter) {
// this.$set(this.loopInstanceForm, "exclusive", false); // this.$set(this.loopInstanceForm, "exclusive", false);
loopInstanceForm.value['exclusive'] = false loopInstanceForm.value['exclusive'] = false
asyncAttr = { asyncBefore: false, asyncAfter: false, exclusive: false, extensionElements: null } asyncAttr = { asyncBefore: false, asyncAfter: false, exclusive: false, extensionElements: null }
} else { } else {
asyncAttr[key] = loopInstanceForm.value[key] asyncAttr[key] = loopInstanceForm.value[key]
} }
bpmnInstances().modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
multiLoopInstance.value, multiLoopInstance.value,
asyncAttr asyncAttr
) )
} }
const changeConfig = (config) => { const changeConfig = (config) => {
if (config === '依次审批') { if (config === '依次审批') {
changeLoopCharacteristicsType('SequentialMultiInstance') changeLoopCharacteristicsType('SequentialMultiInstance')
updateLoopCardinality('1') updateLoopCardinality('1')
updateLoopCondition('${ nrOfCompletedInstances >= nrOfInstances }') updateLoopCondition('${ nrOfCompletedInstances >= nrOfInstances }')
} else if (config === '会签') { } else if (config === '会签') {
changeLoopCharacteristicsType('ParallelMultiInstance') changeLoopCharacteristicsType('ParallelMultiInstance')
updateLoopCondition('${ nrOfCompletedInstances >= nrOfInstances }') updateLoopCondition('${ nrOfCompletedInstances >= nrOfInstances }')
} else if (config === '或签') { } else if (config === '或签') {
changeLoopCharacteristicsType('ParallelMultiInstance') changeLoopCharacteristicsType('ParallelMultiInstance')
updateLoopCondition('${ nrOfCompletedInstances > 0 }') updateLoopCondition('${ nrOfCompletedInstances > 0 }')
} }
} }
onBeforeUnmount(() => { onBeforeUnmount(() => {
multiLoopInstance.value = null multiLoopInstance.value = null
bpmnElement.value = null bpmnElement.value = null
}) })
watch( watch(
() => props.businessObject, () => props.businessObject,
(val) => { (val) => {
bpmnElement.value = bpmnInstances().bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
getElementLoop(val) getElementLoop(val)
}, },
{ immediate: true } { immediate: true }
) )
</script> </script>

View File

@@ -68,7 +68,7 @@ const modelConfig = computed(() => {
const bpmnInstances = () => (window as any)?.bpmnInstances const bpmnInstances = () => (window as any)?.bpmnInstances
const initDataList = () => { const initDataList = () => {
console.log(window, 'window') //console.log(window, 'window')
rootElements.value = bpmnInstances().modeler.getDefinitions().rootElements rootElements.value = bpmnInstances().modeler.getDefinitions().rootElements
messageIdMap.value = {} messageIdMap.value = {}
signalIdMap.value = {} signalIdMap.value = {}

View File

@@ -1,125 +1,125 @@
<template> <template>
<div style="margin-top: 16px"> <div style="margin-top: 16px">
<el-form-item label="消息实例"> <el-form-item label="消息实例">
<div <div
style=" style="
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
flex-wrap: nowrap; flex-wrap: nowrap;
" "
> >
<el-select v-model="bindMessageId" @change="updateTaskMessage"> <el-select v-model="bindMessageId" @change="updateTaskMessage" filterable>
<el-option <el-option
v-for="key in Object.keys(messageMap)" v-for="key in Object.keys(messageMap)"
:value="key" :value="key"
:label="messageMap[key]" :label="messageMap[key]"
:key="key" :key="key"
/> />
</el-select> </el-select>
<XButton <XButton
type="primary" type="primary"
preIcon="ep:plus" preIcon="ep:plus"
style="margin-left: 8px" style="margin-left: 8px"
@click="openMessageModel" @click="openMessageModel"
/> />
</div> </div>
</el-form-item> </el-form-item>
<el-dialog <el-dialog
v-model="messageModelVisible" v-model="messageModelVisible"
:close-on-click-modal="false" :close-on-click-modal="false"
title="创建新消息" title="创建新消息"
width="400px" width="400px"
append-to-body append-to-body
destroy-on-close destroy-on-close
> >
<el-form :model="newMessageForm" size="small" label-width="90px"> <el-form :model="newMessageForm" size="small" label-width="90px">
<el-form-item label="消息ID"> <el-form-item label="消息ID">
<el-input v-model="newMessageForm.id" clearable /> <el-input v-model="newMessageForm.id" clearable />
</el-form-item> </el-form-item>
<el-form-item label="消息名称"> <el-form-item label="消息名称">
<el-input v-model="newMessageForm.name" clearable /> <el-input v-model="newMessageForm.name" clearable />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<el-button size="small" type="primary" @click="createNewMessage"> </el-button> <el-button size="small" type="primary" @click="createNewMessage"> </el-button>
</template> </template>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
defineOptions({ name: 'ReceiveTask' }) defineOptions({ name: 'ReceiveTask' })
const props = defineProps({ const props = defineProps({
id: String, id: String,
type: String type: String
}) })
const message = useMessage() const message = useMessage()
const bindMessageId = ref('') const bindMessageId = ref('')
const newMessageForm = ref<any>({}) const newMessageForm = ref<any>({})
const messageMap = ref<any>({}) const messageMap = ref<any>({})
const messageModelVisible = ref(false) const messageModelVisible = ref(false)
const bpmnElement = ref<any>() const bpmnElement = ref<any>()
const bpmnMessageRefsMap = ref<any>() const bpmnMessageRefsMap = ref<any>()
const bpmnRootElements = ref<any>() const bpmnRootElements = ref<any>()
const bpmnInstances = () => (window as any).bpmnInstances const bpmnInstances = () => (window as any).bpmnInstances
const getBindMessage = () => { const getBindMessage = () => {
bpmnElement.value = bpmnInstances().bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
bindMessageId.value = bpmnElement.value.businessObject?.messageRef?.id || '-1' bindMessageId.value = bpmnElement.value.businessObject?.messageRef?.id || '-1'
} }
const openMessageModel = () => { const openMessageModel = () => {
messageModelVisible.value = true messageModelVisible.value = true
newMessageForm.value = {} newMessageForm.value = {}
} }
const createNewMessage = () => { const createNewMessage = () => {
if (messageMap.value[newMessageForm.value.id]) { if (messageMap.value[newMessageForm.value.id]) {
message.error('该消息已存在请修改id后重新保存') message.error('该消息已存在请修改id后重新保存')
return return
} }
const newMessage = bpmnInstances().moddle.create('bpmn:Message', newMessageForm.value) const newMessage = bpmnInstances().moddle.create('bpmn:Message', newMessageForm.value)
bpmnRootElements.value.push(newMessage) bpmnRootElements.value.push(newMessage)
messageMap.value[newMessageForm.value.id] = newMessageForm.value.name messageMap.value[newMessageForm.value.id] = newMessageForm.value.name
bpmnMessageRefsMap.value[newMessageForm.value.id] = newMessage bpmnMessageRefsMap.value[newMessageForm.value.id] = newMessage
messageModelVisible.value = false messageModelVisible.value = false
} }
const updateTaskMessage = (messageId) => { const updateTaskMessage = (messageId) => {
if (messageId === '-1') { if (messageId === '-1') {
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
messageRef: null messageRef: null
}) })
} else { } else {
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
messageRef: bpmnMessageRefsMap.value[messageId] messageRef: bpmnMessageRefsMap.value[messageId]
}) })
} }
} }
onMounted(() => { onMounted(() => {
bpmnMessageRefsMap.value = Object.create(null) bpmnMessageRefsMap.value = Object.create(null)
bpmnRootElements.value = bpmnInstances().modeler.getDefinitions().rootElements bpmnRootElements.value = bpmnInstances().modeler.getDefinitions().rootElements
bpmnRootElements.value bpmnRootElements.value
.filter((el) => el.$type === 'bpmn:Message') .filter((el) => el.$type === 'bpmn:Message')
.forEach((m) => { .forEach((m) => {
bpmnMessageRefsMap.value[m.id] = m bpmnMessageRefsMap.value[m.id] = m
messageMap.value[m.id] = m.name messageMap.value[m.id] = m.name
}) })
messageMap.value['-1'] = '无' messageMap.value['-1'] = '无'
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
bpmnElement.value = null bpmnElement.value = null
}) })
watch( watch(
() => props.id, () => props.id,
() => { () => {
// bpmnElement.value = bpmnInstances().bpmnElement // bpmnElement.value = bpmnInstances().bpmnElement
nextTick(() => { nextTick(() => {
getBindMessage() getBindMessage()
}) })
}, },
{ immediate: true } { immediate: true }
) )
</script> </script>

View File

@@ -1,99 +1,99 @@
<template> <template>
<div style="margin-top: 16px"> <div style="margin-top: 16px">
<el-form-item label="脚本格式"> <el-form-item label="脚本格式">
<el-input <el-input
v-model="scriptTaskForm.scriptFormat" v-model="scriptTaskForm.scriptFormat"
clearable clearable
@input="updateElementTask()" @input="updateElementTask()"
@change="updateElementTask()" @change="updateElementTask()"
/> />
</el-form-item> </el-form-item>
<el-form-item label="脚本类型"> <el-form-item label="脚本类型">
<el-select v-model="scriptTaskForm.scriptType"> <el-select v-model="scriptTaskForm.scriptType" filterable>
<el-option label="内联脚本" value="inline" /> <el-option label="内联脚本" value="inline" />
<el-option label="外部资源" value="external" /> <el-option label="外部资源" value="external" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="脚本" v-show="scriptTaskForm.scriptType === 'inline'"> <el-form-item label="脚本" v-show="scriptTaskForm.scriptType === 'inline'">
<el-input <el-input
v-model="scriptTaskForm.script" v-model="scriptTaskForm.script"
type="textarea" type="textarea"
resize="vertical" resize="vertical"
:autosize="{ minRows: 2, maxRows: 4 }" :autosize="{ minRows: 2, maxRows: 4 }"
clearable clearable
@input="updateElementTask()" @input="updateElementTask()"
@change="updateElementTask()" @change="updateElementTask()"
/> />
</el-form-item> </el-form-item>
<el-form-item label="资源地址" v-show="scriptTaskForm.scriptType === 'external'"> <el-form-item label="资源地址" v-show="scriptTaskForm.scriptType === 'external'">
<el-input <el-input
v-model="scriptTaskForm.resource" v-model="scriptTaskForm.resource"
clearable clearable
@input="updateElementTask()" @input="updateElementTask()"
@change="updateElementTask()" @change="updateElementTask()"
/> />
</el-form-item> </el-form-item>
<el-form-item label="结果变量"> <el-form-item label="结果变量">
<el-input <el-input
v-model="scriptTaskForm.resultVariable" v-model="scriptTaskForm.resultVariable"
clearable clearable
@input="updateElementTask()" @input="updateElementTask()"
@change="updateElementTask()" @change="updateElementTask()"
/> />
</el-form-item> </el-form-item>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
defineOptions({ name: 'ScriptTask' }) defineOptions({ name: 'ScriptTask' })
const props = defineProps({ const props = defineProps({
id: String, id: String,
type: String type: String
}) })
const defaultTaskForm = ref({ const defaultTaskForm = ref({
scriptFormat: '', scriptFormat: '',
script: '', script: '',
resource: '', resource: '',
resultVariable: '' resultVariable: ''
}) })
const scriptTaskForm = ref<any>({}) const scriptTaskForm = ref<any>({})
const bpmnElement = ref() const bpmnElement = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances const bpmnInstances = () => (window as any)?.bpmnInstances
const resetTaskForm = () => { const resetTaskForm = () => {
for (let key in defaultTaskForm.value) { for (let key in defaultTaskForm.value) {
let value = bpmnElement.value?.businessObject[key] || defaultTaskForm.value[key] let value = bpmnElement.value?.businessObject[key] || defaultTaskForm.value[key]
scriptTaskForm.value[key] = value scriptTaskForm.value[key] = value
} }
scriptTaskForm.value.scriptType = scriptTaskForm.value.script ? 'inline' : 'external' scriptTaskForm.value.scriptType = scriptTaskForm.value.script ? 'inline' : 'external'
} }
const updateElementTask = () => { const updateElementTask = () => {
let taskAttr = Object.create(null) let taskAttr = Object.create(null)
taskAttr.scriptFormat = scriptTaskForm.value.scriptFormat || null taskAttr.scriptFormat = scriptTaskForm.value.scriptFormat || null
taskAttr.resultVariable = scriptTaskForm.value.resultVariable || null taskAttr.resultVariable = scriptTaskForm.value.resultVariable || null
if (scriptTaskForm.value.scriptType === 'inline') { if (scriptTaskForm.value.scriptType === 'inline') {
taskAttr.script = scriptTaskForm.value.script || null taskAttr.script = scriptTaskForm.value.script || null
taskAttr.resource = null taskAttr.resource = null
} else { } else {
taskAttr.resource = scriptTaskForm.value.resource || null taskAttr.resource = scriptTaskForm.value.resource || null
taskAttr.script = null taskAttr.script = null
} }
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), taskAttr) bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
} }
onBeforeUnmount(() => { onBeforeUnmount(() => {
bpmnElement.value = null bpmnElement.value = null
}) })
watch( watch(
() => props.id, () => props.id,
() => { () => {
bpmnElement.value = bpmnInstances().bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
nextTick(() => { nextTick(() => {
resetTaskForm() resetTaskForm()
}) })
}, },
{ immediate: true } { immediate: true }
) )
</script> </script>

View File

@@ -1,185 +1,188 @@
<template> <template>
<el-form label-width='100px'> <el-form label-width='100px'>
<el-form-item label='规则类型' prop='candidateStrategy'> <el-form-item label='规则类型' prop='candidateStrategy'>
<el-select <el-select
v-model='userTaskForm.candidateStrategy' v-model='userTaskForm.candidateStrategy'
clearable clearable
style='width: 100%' style='width: 100%'
@change='changeCandidateStrategy' @change='changeCandidateStrategy'
> filterable
<el-option >
v-for='dict in RuleTypeList' <el-option
:key='dict.code' v-for='dict in RuleTypeList'
:label='dict.name' :key='dict.code'
:value='dict.code' :label='dict.name'
/> :value='dict.code'
</el-select> />
</el-form-item> </el-select>
<el-form-item </el-form-item>
v-if='userTaskForm.candidateStrategy == 10' <el-form-item
label='指定角色' v-if='userTaskForm.candidateStrategy == 10'
prop='candidateParam' label='指定角色'
> prop='candidateParam'
<el-select >
v-model='userTaskForm.candidateParam' <el-select
clearable v-model='userTaskForm.candidateParam'
multiple clearable
style='width: 100%' multiple
@change='updateElementTask' style='width: 100%'
> @change='updateElementTask'
<el-option v-for='item in roleOptions' :key='item.id' :label='item.name' :value='item.id' /> filterable
</el-select> >
</el-form-item> <el-option v-for='item in roleOptions' :key='item.id' :label='item.name' :value='item.id' />
<el-form-item </el-select>
v-if='userTaskForm.candidateStrategy == 20' </el-form-item>
label='指定部门' <el-form-item
prop='candidateParam' v-if='userTaskForm.candidateStrategy == 20'
span='24' label='指定部门'
> prop='candidateParam'
<el-tree-select span='24'
ref='treeRef' >
v-model='userTaskForm.candidateParam' <el-tree-select
:data='deptTreeOptions' ref='treeRef'
:props='defaultProps' v-model='userTaskForm.candidateParam'
empty-text='加载中请稍后' :data='deptTreeOptions'
multiple :props='defaultProps'
node-key='id' empty-text='加载中请稍后'
show-checkbox multiple
@change='updateElementTask' node-key='id'
/> show-checkbox
</el-form-item> @change='updateElementTask'
/>
<el-form-item </el-form-item>
v-if='userTaskForm.candidateStrategy == 30'
label='指定用户' <el-form-item
prop='candidateParam' v-if='userTaskForm.candidateStrategy == 30'
span='24' label='指定用户'
> prop='candidateParam'
<el-select span='24'
v-model='userTaskForm.candidateParam' >
clearable <el-select
multiple v-model='userTaskForm.candidateParam'
style='width: 100%' clearable
@change='updateElementTask' multiple
> style='width: 100%'
<el-option @change='updateElementTask'
v-for='item in userOptions' filterable
:key='item.id' >
:label='item.name' <el-option
:value='item.id' v-for='item in userOptions'
/> :key='item.id'
</el-select> :label='item.name'
</el-form-item> :value='item.id'
/>
</el-form> </el-select>
</template> </el-form-item>
<script lang='ts' setup> </el-form>
import { defaultProps, handleTree } from '@/utils/tree' </template>
import { useDictData } from '@/stores/dictData'
const dictData = useDictData() <script lang='ts' setup>
const RuleTypeList = ref() import { defaultProps, handleTree } from '@/utils/tree'
import { getRoleSimpleList } from '@/api/user-boot/role' import { useDictData } from '@/stores/dictData'
import { getUserSimpleList } from '@/api/user-boot/user' const dictData = useDictData()
const RuleTypeList = ref()
defineOptions({ name: 'UserTask' }) import { getRoleSimpleList } from '@/api/user-boot/role'
const props = defineProps({ import { getUserSimpleList } from '@/api/user-boot/user'
id: String,
type: String defineOptions({ name: 'UserTask' })
}) const props = defineProps({
const userTaskForm = ref({ id: String,
candidateStrategy: '', // 分配规则 type: String
candidateParam: [] // 分配选项 })
}) const userTaskForm = ref({
const bpmnElement = ref() candidateStrategy: '', // 分配规则
const bpmnInstances = () => (window as any)?.bpmnInstances candidateParam: [] // 分配选项
})
export interface optionVO { const bpmnElement = ref()
id: string const bpmnInstances = () => (window as any)?.bpmnInstances
name: string
} export interface optionVO {
id: string
const roleOptions = ref<optionVO[]>([]) // 角色列表 name: string
const userOptions = ref<optionVO[]>([]) // 用户列表 }
const deptTreeOptions = ref() // 部门树
const roleOptions = ref<optionVO[]>([]) // 角色列表
const resetTaskForm = () => { const userOptions = ref<optionVO[]>([]) // 用户列表
const businessObject = bpmnElement.value.businessObject const deptTreeOptions = ref() // 部门树
if (!businessObject) {
return const resetTaskForm = () => {
} const businessObject = bpmnElement.value.businessObject
if (businessObject.candidateStrategy != undefined) { if (!businessObject) {
userTaskForm.value.candidateStrategy = businessObject.candidateStrategy return
} else { }
userTaskForm.value.candidateStrategy = undefined if (businessObject.candidateStrategy != undefined) {
} userTaskForm.value.candidateStrategy = businessObject.candidateStrategy
if (businessObject.candidateParam && businessObject.candidateParam.length > 0) { } else {
if (userTaskForm.value.candidateStrategy === 60) { userTaskForm.value.candidateStrategy = undefined
// 特殊:流程表达式,只有一个 input 输入框 }
userTaskForm.value.candidateParam = [businessObject.candidateParam] if (businessObject.candidateParam && businessObject.candidateParam.length > 0) {
} else { if (userTaskForm.value.candidateStrategy === 60) {
userTaskForm.value.candidateParam = businessObject.candidateParam.split(',') // 特殊:流程表达式,只有一个 input 输入框
} userTaskForm.value.candidateParam = [businessObject.candidateParam]
} else { } else {
userTaskForm.value.candidateParam = [] userTaskForm.value.candidateParam = businessObject.candidateParam.split(',')
} }
} } else {
userTaskForm.value.candidateParam = []
/** 更新 candidateStrategy 字段时,需要清空 candidateParam并触发 bpmn 图更新 */ }
const changeCandidateStrategy = () => { }
userTaskForm.value.candidateParam = []
updateElementTask() /** 更新 candidateStrategy 字段时,需要清空 candidateParam并触发 bpmn 图更新 */
} const changeCandidateStrategy = () => {
userTaskForm.value.candidateParam = []
/** 选中某个 options 时候,更新 bpmn 图 */ updateElementTask()
const updateElementTask = () => { }
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
candidateStrategy: userTaskForm.value.candidateStrategy, /** 选中某个 options 时候,更新 bpmn 图 */
candidateParam: userTaskForm.value.candidateParam.join(',') const updateElementTask = () => {
}) bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
} candidateStrategy: userTaskForm.value.candidateStrategy,
candidateParam: userTaskForm.value.candidateParam.join(',')
// 打开监听器弹窗 })
const processExpressionDialogRef = ref() }
const openProcessExpressionDialog = async () => {
processExpressionDialogRef.value.open() // 打开监听器弹窗
} const processExpressionDialogRef = ref()
const selectProcessExpression = (expression) => { const openProcessExpressionDialog = async () => {
userTaskForm.value.candidateParam = [expression.expression] processExpressionDialogRef.value.open()
} }
const selectProcessExpression = (expression) => {
watch( userTaskForm.value.candidateParam = [expression.expression]
() => props.id, }
() => {
bpmnElement.value = bpmnInstances().bpmnElement watch(
nextTick(() => { () => props.id,
resetTaskForm() () => {
}) bpmnElement.value = bpmnInstances().bpmnElement
}, nextTick(() => {
{ immediate: true } resetTaskForm()
) })
},
{ immediate: true }
onMounted(async () => { )
// 获得角色列表
await getRoleSimpleList().then(res => {
roleOptions.value = res.data onMounted(async () => {
}) // 获得角色列表
await getRoleSimpleList().then(res => {
// 获得用户列表 roleOptions.value = res.data
await getUserSimpleList().then(res => { })
userOptions.value = res.data
}) // 获得用户列表
//传入type的名称 await getUserSimpleList().then(res => {
RuleTypeList.value = dictData.getBasicData('rule_type') userOptions.value = res.data
})
// //传入type的名称
// // 获得部门列表 RuleTypeList.value = dictData.getBasicData('rule_type')
// const deptOptions = await DeptApi.getSimpleDeptList()
// deptTreeOptions.value = handleTree(deptOptions, 'id') //
}) // // 获得部门列表
// const deptOptions = await DeptApi.getSimpleDeptList()
onBeforeUnmount(() => { // deptTreeOptions.value = handleTree(deptOptions, 'id')
bpmnElement.value = null })
})
</script> onBeforeUnmount(() => {
bpmnElement.value = null
})
</script>

View File

@@ -39,7 +39,7 @@ function xml2json(xml) {
function xmlObj2json(xml) { function xmlObj2json(xml) {
const xmlObj = xmlStr2XmlObj(xml) const xmlObj = xmlStr2XmlObj(xml)
console.log(xmlObj) // console.log(xmlObj)
let jsonObj = {} let jsonObj = {}
if (xmlObj.childNodes.length > 0) { if (xmlObj.childNodes.length > 0) {
jsonObj = xml2json(xmlObj) jsonObj = xml2json(xmlObj)

View File

@@ -0,0 +1,518 @@
<template>
<div>
<!--异常数据清洗 -->
<TableHeader
:showReset="false"
ref="TableHeaderRef"
@selectChange="selectChange"
datePicker
v-if="fullscreen"
></TableHeader>
<div
class="monitoringPoints"
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`,
overflow: 'auto'
}"
v-loading="tableStore.table.loading"
>
<div style="flex: 1">
<div class="title">监测点统计</div>
<div>
<div class="statistics">
<div class="divBox">
<span class="iconfont icon-qiyezongshu" style="color: #57bc6e"></span>
<span class="divBox_title">监测点总数</span>
<span class="divBox_num" style="color: #57bc6e">
{{ monitoringPoints.runNum }}
</span>
</div>
<div class="divBox mt10">
<span class="iconfont icon-igw-f-warning-data" style="color: #ff6600"></span>
<span class="divBox_title">异常测点数</span>
<span class="divBox_num" style="color: #ff6600">
{{ monitoringPoints.abnormalNum }}
</span>
</div>
</div>
<div class="echartTitle">
<div class="title">异常占比</div>
<div>
{{
isNaN((monitoringPoints.abnormalNum / monitoringPoints.runNum) * 100)
? 0
: Math.floor((monitoringPoints.abnormalNum / monitoringPoints.runNum) * 10000) /
100
}}%
</div>
</div>
<div style="height: 30px">
<MyEchart :options="percentage"></MyEchart>
</div>
</div>
</div>
<div style="flex: 2" class="ml15">
<div class="title">异常指标统计</div>
<div class="mb5" style="height: 40px">
<el-segmented
style="height: 100%"
v-model="segmented"
:options="segmentedList"
block
@change="change"
>
<template #default="scope">
<div>
<div
class="segmentedIcon"
:style="{
backgroundColor:
scope.item.num > 0 ? '#FF9100' : scope.item.num > 99 ? '#ff0000' : '#007D7B'
}"
>
{{ scope.item.num > 99 ? '99+' : scope.item.num }}
</div>
<div>{{ scope.item.label }}</div>
</div>
</template>
</el-segmented>
</div>
<div class="header">
<span style="width: 170px; text-align: left">指标名称</span>
<span style="flex: 1">合理范围</span>
<span style="width: 90px">异常测点数</span>
</div>
<div
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px - 105px )`,
overflow: 'auto'
}"
>
<div v-for="o in abnormal.filter(item => item.remark == segmented)" class="abnormal mb10">
<span style="width: 170px; height: 24px" class="iconDiv">
<div :style="{ backgroundColor: o.ids.length > 0 ? '#FF9100' : '' }"></div>
{{ o.targetName }}
</span>
<span style="flex: 1; text-align: center">
<!-- 合理范围 -->
<span style="color: #388e3c" class="text">{{ o.rangeDesc }}</span>
</span>
<span style="width: 90px; text-align: center">
<span style="color: #388e3c" :class="` ${o.ids.length > 0 ? 'text-red' : ''}`" class="text">
{{ o.ids.length }}
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import MyEchart from '@/components/echarts/MyEchart.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache'
import { useDictData } from '@/stores/dictData'
const dictData = useDictData()
const prop = defineProps({
w: { type: [String, Number] },
h: { type: [String, Number] },
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: [String, Number] },
timeValue: { type: Object },
searchKey: { type: [String, Number] }
})
const headerHeight = ref(57)
const TableHeaderRef = ref()
const monitoringPoints = ref({
runNum: 0,
abnormalNum: 0
})
const segmented = ref('base')
const percentage = ref({})
const segmentedList = ref([
{
label: '基础指标',
value: 'base',
num: 0
},
{
label: '稳态指标',
value: 'harmonic',
num: 0
},
{
label: '暂态指标',
value: 'event',
num: 0
}
])
const abnormal: any = ref([])
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height
}
// 计算是否全屏展示
const fullscreen = computed(() => {
const w = Number(prop.w)
const h = Number(prop.h)
if (!isNaN(w) && !isNaN(h) && w === 12 && h === 6) {
// 执行相应逻辑
return true
} else {
return false
}
})
const tableStore: any = new TableStore({
url: '/device-boot/dataVerify/getMonitorVerifyData',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
if (prop.timeValue && Array.isArray(prop.timeValue)) {
tableStore.table.params.searchBeginTime = prop.timeValue[0]
tableStore.table.params.searchEndTime = prop.timeValue[1]
}
},
loadCallback: () => {
segmentedList.value[0].num = 0
segmentedList.value[1].num = 0
segmentedList.value[2].num = 0
monitoringPoints.value.runNum = tableStore.table.data.runNum //总数
monitoringPoints.value.abnormalNum = tableStore.table.data.abnormalNum //异常测点数
abnormal.value = tableStore.table.data.targetList
abnormal.value.forEach(item => {
const { remark, ids } = item
if (remark === 'base') segmentedList.value[0].num += ids.length
else if (remark === 'harmonic') segmentedList.value[1].num += ids.length
else if (remark === 'event') segmentedList.value[2].num += ids.length
})
echart()
}
})
tableStore.table.params.deptId = dictData.state.area[0].id
tableStore.table.params.alarmDayLimit = 5
tableStore.table.params.warnDayLimit = 1
tableStore.table.params.lineRunFlag = 0
const echart = () => {
percentage.value = {
color: ['#FF9100'],
options: {
dataZoom: null,
toolbox: {
show: false
},
grid: {
top: '0%',
left: '0%',
right: '0%',
bottom: '0%'
},
tooltip: {
show: false
},
legend: {
show: false
},
yAxis: {
show: false,
data: ['']
},
xAxis: [
{
show: false,
type: 'value'
}
],
series: [
{
name: '异常总数',
type: 'bar',
barWidth: 12,
data: [100],
z: 0,
zlevel: 0,
itemStyle: {
normal: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{
offset: 1,
color: '#57bc6e' // 100% 处的颜色
}
],
global: false // 缺省为 false
}
}
}
},
{
name: '异常占比',
type: 'bar',
barWidth: 13,
data: [
(monitoringPoints.value.abnormalNum / monitoringPoints.value.runNum) * 100 == 0
? ''
: ((monitoringPoints.value.abnormalNum / monitoringPoints.value.runNum) * 100).toFixed(2)
],
z: 0,
zlevel: 0,
itemStyle: {
normal: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{
offset: 0,
color: '#FF9100' // 0% 处的颜色
},
{
offset: 1,
color: '#FF9100' // 100% 处的颜色
}
],
global: false // 缺省为 false
}
}
}
},
{
type: 'pictorialBar',
itemStyle: {
normal: {
color: '#fff'
}
},
symbolRepeat: 50,
// symbolMargin: 300,
symbol: 'rect',
symbolClip: true,
symbolSize: [2, 20],
symbolPosition: 'start',
symbolOffset: [0, 0],
data: [100],
z: 1,
zlevel: 0
},
{
name: '',
type: 'bar',
barGap: '-110%',
data: [100],
barWidth: 18,
itemStyle: {
normal: {
color: 'transparent',
barBorderColor: 'rgb(148,217,249)',
barBorderWidth: 1
}
},
z: 2
}
]
}
}
}
const change = () => {
tableStore.table.loading = true
setTimeout(() => {
tableStore.table.loading = false
}, 500)
}
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
watch(
() => prop.searchKey,
val => {
tableStore.index()
}
)
// watch(
// () => prop.timeValue,
// val => {
// tableStore.index()
// },
// {
// deep: true
// }
// )
</script>
<style lang="scss" scoped>
@import '@/assets/font/iconfont.css';
.monitoringPoints {
display: flex;
.statistics {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-bottom: 10px;
.divBox {
width: 100%;
height: 70px;
padding: 10px;
display: flex;
.iconfont {
font-size: 40px;
margin-right: 5px;
}
.divBox_title {
font-weight: 550;
}
.divBox_num {
font-size: 20px;
font-weight: 550;
margin-left: auto;
font-family: AlimamaDongFangDaKai;
}
align-items: center;
// text-align: center;
border-radius: 5px;
&:nth-child(1) {
background-color: #eef8f0;
}
&:nth-child(2) {
background-color: #fff6ed;
}
&:nth-child(3) {
background-color: #e5f8f6;
}
}
}
}
.detail {
flex: 1;
}
.abnormal {
width: 100%;
background-color: #f3f6f9;
border-radius: 5px;
display: flex;
// justify-content: space-between;
align-items: center;
padding: 5px 0px 5px 10px;
.iconDiv {
display: flex;
align-items: center;
div {
width: 4px;
height: 18px;
margin-right: 5px;
background-color: var(--el-color-primary);
}
}
.text {
font-weight: 700;
font-size: 16px;
font-family: 'Source Code Pro', monospace;
text-align: center;
// font-feature-settings: 'tnum';
}
}
.header {
display: flex;
text-align: center;
font-weight: 700;
padding: 5px;
}
:deep(.el-card__header) {
padding: 10px;
span {
font-weight: 600;
}
}
:deep(.el-card__body) {
padding: 10px;
}
.iconFont {
font-size: 18px;
display: inline-block;
vertical-align: middle;
}
.form {
position: relative;
.form_but {
position: absolute;
right: -22px;
}
}
.card-header {
font-size: 16px;
}
:deep(.table_name) {
color: var(--el-color-primary);
cursor: pointer;
text-underline-offset: 4px;
}
.echartTitle {
display: flex;
justify-content: space-between;
div:nth-child(2) {
font-size: 16px;
color: #ff6600;
}
}
.title {
font-size: 14px;
font-weight: 600;
padding: 0 5px 5px;
}
:deep(.el-segmented__item-selected, ) {
clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}
:deep(.el-segmented__item, ) {
clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
position: relative;
}
:deep(.el-segmented) {
clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%);
}
.text-red {
color: #ff9100 !important;
}
.segmentedIcon {
position: absolute;
top: 1px;
right: calc(50% - 44px);
height: 18px !important;
line-height: 19px;
padding: 0 4px;
font-size: 12px;
background: #ff9100;
color: #fff;
border-radius: 8px;
}
</style>

View File

@@ -0,0 +1,500 @@
<template>
<div>
<!--监测点数据完整性 -->
<TableHeader
:showReset="false"
ref="TableHeaderRef"
@selectChange="selectChange"
datePicker
v-if="fullscreen"
></TableHeader>
<div
class="monitoringPoints"
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`,
overflow: 'auto'
}"
v-loading="tableStore.table.loading"
>
<div style="flex: 1">
<div class="title">监测点统计</div>
<div>
<div class="statistics">
<div class="divBox">
<span class="iconfont icon-qiyezongshu" style="color: #57bc6e"></span>
<span class="divBox_title">监测点总数</span>
<span class="divBox_num" style="color: #57bc6e">
{{ monitoringPoints.runNum }}
</span>
</div>
<div class="divBox mt10">
<span class="iconfont icon-igw-f-warning-data" style="color: #ff6600"></span>
<span class="divBox_title">低于90%监测点数</span>
<span class="divBox_num" style="color: #57bc6e">
{{ monitoringPoints.abnormalNum }}
</span>
</div>
</div>
<div class="echartTitle">
<div class="title">总的数据完整性</div>
<div>
<div>{{ monitoringPoints.totalOnlineRate }}%</div>
</div>
</div>
<div style="height: 30px">
<MyEchart :options="percentage"></MyEchart>
</div>
</div>
</div>
<div style="flex: 2" class="ml15">
<div class="title">完整性统计</div>
<div class="mb5" style="height: 40px">
<el-segmented
style="height: 100%"
v-model="segmented"
:props="props"
:options="segmentedList"
block
@change="tableStore.index()"
></el-segmented>
</div>
<div class="header">
<span style="width: 110px; text-align: left">
{{
segmented == 'Power_Network'
? '区域'
: segmented == 'Manufacturer'
? '终端厂家'
: '电网标志'
}}
</span>
<span style="width: 90px">监测点总数</span>
<span style="flex: 1">低于90%监测点数</span>
<span style="width: 80px">完整性(%)</span>
</div>
<div
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px - 105px )`,
overflow: 'auto'
}"
>
<div v-for="o in abnormal" class="abnormal mb10">
<span style="width: 110px; height: 24px" class="iconDiv">
<div :style="{ backgroundColor: o.citTotalOnlineRate < 90 ? '#FF9100' : '' }"></div>
{{ o.citName }}
</span>
<!-- 监测点总数 -->
<span style="width: 90px; color: #388e3c" class="text">
{{ o.citTotalNum }}
</span>
<!-- 低于90%监测点数 -->
<span style="flex: 1; color: #388e3c" class="text">
{{ o.citBelowNum }}
</span>
<span
style="width: 80px; color: #388e3c"
:class="` ${o.citTotalOnlineRate < 90 ? 'text-red' : ''}`"
class="text"
>
{{ o.citTotalOnlineRate }}
</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import MyEchart from '@/components/echarts/MyEchart.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache'
import { useDictData } from '@/stores/dictData'
const dictData = useDictData()
const prop = defineProps({
w: { type: [String, Number] },
h: { type: [String, Number] },
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: [String, Number] },
timeValue: { type: Object },
searchKey: { type: [String, Number] }
})
const headerHeight = ref(57)
const TableHeaderRef = ref()
const monitoringPoints = ref({
runNum: 0,
abnormalNum: 0,
totalOnlineRate: 0
})
const segmented = ref('Power_Network')
const percentage = ref({})
const segmentedList = dictData.getBasicData('Statistical_Type', ['Report_Type', 'Voltage_Level', 'Load_Type'])
const props = {
value: 'code',
label: 'name'
}
const abnormal: any = ref([])
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height
}
// 计算是否全屏展示
const fullscreen = computed(() => {
const w = Number(prop.w)
const h = Number(prop.h)
if (!isNaN(w) && !isNaN(h) && w === 12 && h === 6) {
// 执行相应逻辑
return true
} else {
return false
}
})
const tableStore: any = new TableStore({
url: '/device-boot/LineIntegrityData/data',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
if (prop.timeValue && Array.isArray(prop.timeValue)) {
tableStore.table.params.searchBeginTime = prop.timeValue[0]
tableStore.table.params.searchEndTime = prop.timeValue[1]
}
tableStore.table.params.statisticalType = segmentedList.filter(item => item.code === segmented.value)[0]
},
loadCallback: () => {
monitoringPoints.value.runNum = tableStore.table.data.totalNum
monitoringPoints.value.abnormalNum = tableStore.table.data.belowNum
monitoringPoints.value.totalOnlineRate = tableStore.table.data.totalOnlineRate - 0
abnormal.value = tableStore.table.data.citDetailList.filter((k: any) => {
if (tableStore.table.params.statisticalType.name == '终端厂家') {
return k.citTotalNum != 0
} else {
return !k.citName.includes('上送')
}
})
}
})
tableStore.table.params.deptIndex = dictData.state.area[0].id
tableStore.table.params.lineRunFlag = 0
const echart = () => {
percentage.value = {
color: ['#FF9100'],
options: {
dataZoom: null,
toolbox: {
show: false
},
grid: {
top: '0%',
left: '0%',
right: '0%',
bottom: '0%'
},
tooltip: {
show: false
},
legend: {
show: false
},
yAxis: {
show: false,
data: ['']
},
xAxis: [
{
show: false,
type: 'value'
}
],
series: [
{
name: '',
type: 'bar',
barWidth: 12,
data: [100],
z: 0,
zlevel: 0,
itemStyle: {
normal: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{
offset: 1,
color: '#FF9100' // 100% 处的颜色
}
],
global: false // 缺省为 false
}
}
}
},
{
name: '',
type: 'bar',
barWidth: 13,
data: [
(monitoringPoints.value.abnormalNum / monitoringPoints.value.runNum) * 100 == 0
? ''
: ((monitoringPoints.value.abnormalNum / monitoringPoints.value.runNum) * 100).toFixed(2)
],
z: 0,
zlevel: 0,
itemStyle: {
normal: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{
offset: 0,
color: '#57bc6e ' // 0% 处的颜色
},
{
offset: 1,
color: '#57bc6e' // 100% 处的颜色
}
],
global: false // 缺省为 false
}
}
}
},
{
type: 'pictorialBar',
itemStyle: {
normal: {
color: '#fff'
}
},
symbolRepeat: 50,
// symbolMargin: 300,
symbol: 'rect',
symbolClip: true,
symbolSize: [2, 20],
symbolPosition: 'start',
symbolOffset: [0, 0],
data: [100],
z: 1,
zlevel: 0
},
{
name: '',
type: 'bar',
barGap: '-110%',
data: [100],
barWidth: 18,
itemStyle: {
normal: {
color: 'transparent',
barBorderColor: 'rgb(148,217,249)',
barBorderWidth: 1
}
},
z: 2
}
]
}
}
}
provide('tableStore', tableStore)
onMounted(() => {
setTimeout(() => {
echart()
}, 100)
tableStore.index()
})
watch(
() => prop.searchKey,
val => {
tableStore.index()
}
)
// watch(
// () => prop.timeValue,
// val => {
// tableStore.index()
// },
// {
// deep: true
// }
// )
</script>
<style lang="scss" scoped>
@import '@/assets/font/iconfont.css';
.monitoringPoints {
display: flex;
.statistics {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-bottom: 10px;
.divBox {
width: 100%;
height: 70px;
padding: 10px;
display: flex;
.iconfont {
font-size: 40px;
margin-right: 5px;
}
.divBox_title {
font-weight: 550;
}
.divBox_num {
font-size: 20px;
font-weight: 550;
margin-left: auto;
font-family: AlimamaDongFangDaKai;
}
align-items: center;
// text-align: center;
border-radius: 5px;
&:nth-child(1) {
background-color: #eef8f0;
}
&:nth-child(2) {
background-color: #fff6ed;
}
&:nth-child(3) {
background-color: #e5f8f6;
}
}
}
}
.detail {
flex: 1;
}
.abnormal {
width: 100%;
background-color: #f3f6f9;
border-radius: 5px;
display: flex;
// justify-content: space-between;
align-items: center;
padding: 5px 0px 5px 10px;
.iconDiv {
display: flex;
align-items: center;
div {
width: 4px;
height: 18px;
margin-right: 5px;
background-color: var(--el-color-primary);
}
}
.text {
font-weight: 700;
font-size: 16px;
font-family: 'Source Code Pro', monospace;
text-align: center;
// font-feature-settings: 'tnum';
}
}
.header {
display: flex;
text-align: center;
font-weight: 700;
padding: 5px;
}
:deep(.el-card__header) {
padding: 10px;
span {
font-weight: 600;
}
}
:deep(.el-card__body) {
padding: 10px;
}
.iconFont {
font-size: 18px;
display: inline-block;
vertical-align: middle;
}
.form {
position: relative;
.form_but {
position: absolute;
right: -22px;
}
}
.card-header {
font-size: 16px;
}
:deep(.table_name) {
color: var(--el-color-primary);
cursor: pointer;
text-underline-offset: 4px;
}
.echartTitle {
display: flex;
justify-content: space-between;
div:nth-child(2) {
font-size: 16px;
color: #ff6600;
}
}
.title {
font-size: 14px;
font-weight: 600;
padding: 0 5px 5px;
}
:deep(.el-segmented__item-selected, ) {
clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}
:deep(.el-segmented__item, ) {
clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
position: relative;
}
:deep(.el-segmented) {
clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%);
}
.text-red {
color: #ff9100 !important;
}
.segmentedIcon {
position: absolute;
top: 1px;
left: 100px;
height: 18px !important;
line-height: 19px;
padding: 0 4px;
font-size: 12px;
background: #ff9100;
color: #fff;
border-radius: 8px;
}
</style>

View File

@@ -0,0 +1,500 @@
<template>
<div>
<!--终端在线率 -->
<TableHeader
:showReset="false"
ref="TableHeaderRef"
@selectChange="selectChange"
datePicker
v-if="fullscreen"
>
</TableHeader>
<div
class="monitoringPoints"
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`,
overflow: 'auto'
}"
v-loading="tableStore.table.loading"
>
<div style="flex: 1">
<div class="title">终端统计</div>
<div>
<div class="statistics">
<div class="divBox">
<span class="iconfont icon-qiyezongshu" style="color: #57bc6e"></span>
<span class="divBox_title">终端总数</span>
<span class="divBox_num" style="color: #57bc6e">
{{ monitoringPoints.runNum }}
</span>
</div>
<div class="divBox mt10">
<span class="iconfont icon-igw-f-warning-data" style="color: #ff6600"></span>
<span class="divBox_title">低于90%终端数</span>
<span class="divBox_num" style="color: #57bc6e">
{{ monitoringPoints.abnormalNum }}
</span>
</div>
</div>
<div class="echartTitle">
<div class="title">总的数据在线率</div>
<div>{{ monitoringPoints.totalOnlineRate }}%</div>
</div>
<div style="height: 30px">
<MyEchart :options="percentage"></MyEchart>
</div>
</div>
</div>
<div style="flex: 2" class="ml15">
<div class="title">在线率统计</div>
<div class="mb5" style="height: 40px">
<el-segmented
style="height: 100%"
v-model="segmented"
:props="props"
:options="segmentedList"
block
@change="tableStore.index()"
></el-segmented>
</div>
<div class="header">
<span style="width: 110px; text-align: left">
{{
segmented == 'Power_Network'
? '区域'
: segmented == 'Manufacturer'
? '终端厂家'
: '电网标志'
}}
</span>
<span style="width: 90px">终端总数</span>
<span style="flex: 1">低于90%终端数</span>
<span style="width: 80px">在线率(%)</span>
</div>
<div
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px - 105px )`,
overflow: 'auto'
}"
>
<div v-for="o in abnormal" class="abnormal mb10">
<span style="width: 110px; height: 24px" class="iconDiv">
<div :style="{ backgroundColor: o.citTotalOnlineRate < 90 ? '#FF9100' : '' }"></div>
{{ o.citName }}
</span>
<!-- 终端总数 -->
<span style="width: 90px; color: #388e3c" class="text">
{{ o.citTotalNum }}
</span>
<!-- 低于90%终端数 -->
<span style="flex: 1; color: #388e3c" class="text">
{{ o.citBelowNum }}
</span>
<span
style="width: 80px; color: #388e3c"
:class="` ${o.citTotalOnlineRate < 90 ? 'text-red' : ''}`"
class="text"
>
{{ o.citTotalOnlineRate }}
</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import MyEchart from '@/components/echarts/MyEchart.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache'
import { useDictData } from '@/stores/dictData'
const dictData = useDictData()
const prop = defineProps({
w: { type: [String, Number] },
h: { type: [String, Number] },
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: [String, Number] },
timeValue: { type: Object },
searchKey: { type: [String, Number] }
})
const headerHeight = ref(57)
const TableHeaderRef = ref()
const monitoringPoints = ref({
runNum: 0,
abnormalNum: 0,
totalOnlineRate: 0
})
const segmented = ref('Power_Network')
const percentage = ref({})
const segmentedList = dictData.getBasicData('Statistical_Type', ['Report_Type', 'Voltage_Level', 'Load_Type'])
const props = {
value: 'code',
label: 'name'
}
const abnormal: any = ref([])
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height
}
// 计算是否全屏展示
const fullscreen = computed(() => {
const w = Number(prop.w)
const h = Number(prop.h)
if (!isNaN(w) && !isNaN(h) && w === 12 && h === 6) {
// 执行相应逻辑
return true
} else {
return false
}
})
const tableStore: any = new TableStore({
url: '/device-boot/onLineRate/deviceOnlineRateInfo',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
if (prop.timeValue && Array.isArray(prop.timeValue)) {
tableStore.table.params.searchBeginTime = prop.timeValue[0]
tableStore.table.params.searchEndTime = prop.timeValue[1]
}
tableStore.table.params.statisticalType = segmentedList.filter(item => item.code === segmented.value)[0]
},
loadCallback: () => {
monitoringPoints.value.runNum = tableStore.table.data.totalNum
monitoringPoints.value.abnormalNum = tableStore.table.data.belowNum
monitoringPoints.value.totalOnlineRate = tableStore.table.data.totalOnlineRate - 0
abnormal.value = tableStore.table.data.citDetailList.filter((k: any) => {
if (tableStore.table.params.statisticalType.name == '终端厂家') {
return k.citTotalNum != 0
} else {
return !k.citName.includes('上送')
}
})
}
})
tableStore.table.params.deptIndex = dictData.state.area[0].id
tableStore.table.params.lineRunFlag = 0
const echart = () => {
percentage.value = {
color: ['#FF9100'],
options: {
dataZoom: null,
toolbox: {
show: false
},
grid: {
top: '0%',
left: '0%',
right: '0%',
bottom: '0%'
},
tooltip: {
show: false
},
legend: {
show: false
},
yAxis: {
show: false,
data: ['']
},
xAxis: [
{
show: false,
type: 'value'
}
],
series: [
{
name: '',
type: 'bar',
barWidth: 12,
data: [100],
z: 0,
zlevel: 0,
itemStyle: {
normal: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{
offset: 1,
color: '#FF9100' // 100% 处的颜色
}
],
global: false // 缺省为 false
}
}
}
},
{
name: '',
type: 'bar',
barWidth: 13,
data: [
(monitoringPoints.value.abnormalNum / monitoringPoints.value.runNum) * 100 == 0
? ''
: ((monitoringPoints.value.abnormalNum / monitoringPoints.value.runNum) * 100).toFixed(2)
],
z: 0,
zlevel: 0,
itemStyle: {
normal: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{
offset: 0,
color: '#57bc6e' // 0% 处的颜色
},
{
offset: 1,
color: '#57bc6e' // 100% 处的颜色
}
],
global: false // 缺省为 false
}
}
}
},
{
type: 'pictorialBar',
itemStyle: {
normal: {
color: '#fff'
}
},
symbolRepeat: 50,
// symbolMargin: 300,
symbol: 'rect',
symbolClip: true,
symbolSize: [2, 20],
symbolPosition: 'start',
symbolOffset: [0, 0],
data: [100],
z: 1,
zlevel: 0
},
{
name: '',
type: 'bar',
barGap: '-110%',
data: [100],
barWidth: 18,
itemStyle: {
normal: {
color: 'transparent',
barBorderColor: 'rgb(148,217,249)',
barBorderWidth: 1
}
},
z: 2
}
]
}
}
}
provide('tableStore', tableStore)
onMounted(() => {
setTimeout(() => {
echart()
}, 100)
tableStore.index()
})
watch(
() => prop.searchKey,
val => {
tableStore.index()
}
)
// watch(
// () => prop.timeValue,
// val => {
// tableStore.index()
// },
// {
// deep: true
// }
// )
</script>
<style lang="scss" scoped>
@import '@/assets/font/iconfont.css';
.monitoringPoints {
display: flex;
.statistics {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-bottom: 10px;
.divBox {
width: 100%;
height: 70px;
padding: 10px;
display: flex;
.iconfont {
font-size: 40px;
margin-right: 5px;
}
.divBox_title {
font-weight: 550;
}
.divBox_num {
font-size: 20px;
font-weight: 550;
margin-left: auto;
font-family: AlimamaDongFangDaKai;
}
align-items: center;
// text-align: center;
border-radius: 5px;
&:nth-child(1) {
background-color: #eef8f0;
}
&:nth-child(2) {
background-color: #fff6ed;
}
&:nth-child(3) {
background-color: #e5f8f6;
}
}
}
}
.detail {
flex: 1;
}
.abnormal {
width: 100%;
background-color: #f3f6f9;
border-radius: 5px;
display: flex;
// justify-content: space-between;
align-items: center;
padding: 5px 0px 5px 10px;
.iconDiv {
display: flex;
align-items: center;
div {
width: 4px;
height: 18px;
margin-right: 5px;
background-color: var(--el-color-primary);
}
}
.text {
font-weight: 700;
font-size: 16px;
font-family: 'Source Code Pro', monospace;
text-align: center;
// font-feature-settings: 'tnum';
}
}
.header {
display: flex;
text-align: center;
font-weight: 700;
padding: 5px;
}
:deep(.el-card__header) {
padding: 10px;
span {
font-weight: 600;
}
}
:deep(.el-card__body) {
padding: 10px;
}
.iconFont {
font-size: 18px;
display: inline-block;
vertical-align: middle;
}
.form {
position: relative;
.form_but {
position: absolute;
right: -22px;
}
}
.card-header {
font-size: 16px;
}
:deep(.table_name) {
color: var(--el-color-primary);
cursor: pointer;
text-underline-offset: 4px;
}
.echartTitle {
display: flex;
justify-content: space-between;
div:nth-child(2) {
font-size: 16px;
color: #ff6600;
}
}
.title {
font-size: 14px;
font-weight: 600;
padding: 0 5px 5px;
}
:deep(.el-segmented__item-selected, ) {
clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}
:deep(.el-segmented__item, ) {
clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
position: relative;
}
:deep(.el-segmented) {
clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%);
}
.text-red {
color: #ff9100 !important;
}
.segmentedIcon {
position: absolute;
top: 1px;
left: 100px;
height: 18px !important;
line-height: 19px;
padding: 0 4px;
font-size: 12px;
background: #ff9100;
color: #fff;
border-radius: 8px;
}
</style>

View File

@@ -0,0 +1,483 @@
<template>
<div>
<!--监测点数据完整性 -->
<TableHeader
:showReset="false"
ref="TableHeaderRef"
@selectChange="selectChange"
datePicker
v-if="fullscreen"
></TableHeader>
<div
class="monitoringPoints"
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`,
overflow: 'auto'
}"
v-loading="tableStore.table.loading"
>
<div style="flex: 1">
<div class="title">终端统计</div>
<div
class="box1"
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px - 30px )`,
overflow: 'auto'
}"
>
<div class="statistics">
<div class="divBox div1">
<span class="iconfont icon-qiyezongshu" style="color: #57bc6e"></span>
<span class="divBox_title">终端总数</span>
<span class="divBox_num text-style" style="color: #57bc6e">
{{ statisticsList.allNum }}
</span>
</div>
<div class="divBox div2">
<span class="iconfont icon-zaiyunshebei" style="color: #67c23a"></span>
<span class="divBox_title">在运终端数</span>
<span class="divBox_num text-style" style="color: #67c23a">
{{ statisticsList.runNum }}
</span>
</div>
</div>
<div class="statistics">
<div class="divBox div3">
<span
class="iconfont icon-yichanglei_14feizhinengbiaozaiyunyichang"
style="color: #ffbf00"
></span>
<span class="divBox_title">调试终端数</span>
<span class="divBox_num text-style" style="color: #ffbf00">
{{ statisticsList.checkNum }}
</span>
</div>
<div class="divBox div4">
<span class="iconfont icon-tingyunshijianguanli" style="color: #f56c6c"></span>
<span class="divBox_title">停运终端数</span>
<span class="divBox_num text-style" style="color: #f56c6c">
{{ statisticsList.stopRunNum }}
</span>
</div>
</div>
</div>
</div>
<div style="flex: 2" class="ml15">
<div class="title">终端运行统计</div>
<div class="mb5" style="height: 40px">
<el-segmented
style="height: 100%"
v-model="segmented"
:props="props"
:options="segmentedList"
block
@change="tableStore.index()"
></el-segmented>
</div>
<div class="header">
<span style="width: 110px; text-align: left">
{{
segmented == 'Power_Network'
? '区域'
: segmented == 'Manufacturer'
? '终端厂家'
: '电网标志'
}}
</span>
<span style="width: 90px">终端总数</span>
<span style="flex: 1">完整性(%)</span>
<span style="flex: 1">在线率(%)</span>
<span style="flex: 1">异常率(%)</span>
</div>
<div
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px - 105px )`,
overflow: 'auto'
}"
>
<div v-for="o in abnormal" class="abnormal mb10">
<span style="width: 110px; height: 24px" class="iconDiv">
<div :style="{ backgroundColor: o.citTotalOnlineRate < 90 ? '#FF9100' : '' }"></div>
{{ o.name }}
</span>
<!-- 终端总数 -->
<span style="width: 90px; color: #388e3c" class="text">
{{ o.count }}
</span>
<!-- -->
<sp
style="flex: 1; color: #388e3c"
class="text"
:class="` ${o.integrity < 90 ? 'text-red' : ''}`"
>
{{ o.integrity }}
</sp>
<span
style="flex: 1; color: #388e3c"
:class="` ${o.online < 90 ? 'text-red' : ''}`"
class="text"
>
{{ o.online }}
</span>
<span
style="flex: 1; color: #388e3c"
:class="` ${o.qualified > 10 ? 'text-red' : ''}`"
class="text"
>
{{ o.qualified }}
</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import MyEchart from '@/components/echarts/MyEchart.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache'
import { useDictData } from '@/stores/dictData'
const dictData = useDictData()
const prop = defineProps({
w: { type: [String, Number] },
h: { type: [String, Number] },
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: [String, Number] },
timeValue: { type: Object },
searchKey: { type: [String, Number] }
})
const headerHeight = ref(57)
const TableHeaderRef = ref()
const monitoringPoints = ref({
runNum: 0,
abnormalNum: 0,
totalOnlineRate: 0
})
const segmented = ref('Power_Network')
const percentage = ref({})
const segmentedList = dictData.getBasicData('Statistical_Type', ['Report_Type', 'Voltage_Level', 'Load_Type'])
const props = {
value: 'code',
label: 'name'
}
const statisticsList: any = ref({
allNum: 0,
runNum: 0,
checkNum: 0,
stopRunNum: 0
})
const abnormal: any = ref([])
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height
}
const totalData = ref([])
// 计算是否全屏展示
const fullscreen = computed(() => {
const w = Number(prop.w)
const h = Number(prop.h)
if (!isNaN(w) && !isNaN(h) && w === 12 && h === 6) {
// 执行相应逻辑
return true
} else {
return false
}
})
const tableStore: any = new TableStore({
url: '/device-boot/deviceRunEvaluate/getRunEvaluateInfo',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
if (prop.timeValue && Array.isArray(prop.timeValue)) {
tableStore.table.params.searchBeginTime = prop.timeValue[0]
tableStore.table.params.searchEndTime = prop.timeValue[1]
}
tableStore.table.params.statisticalType = segmentedList.filter(item => item.code === segmented.value)[0]
},
loadCallback: () => {
totalData.value = Array.from(
tableStore.table.data
.map((item: any) => item.list)
.flat()
.reduce((map: any, item: any) => {
if (!map.has(item.id)) {
map.set(item.id, item)
}
return map
}, new Map())
.values()
)
// tableStore.table.data
statisticsList.value.allNum = totalData.value.length
statisticsList.value.runNum = totalData.value.filter(item => item.runFlag === '运行').length
statisticsList.value.checkNum = totalData.value.filter(item => item.runFlag === '调试').length
statisticsList.value.stopRunNum = totalData.value.filter(item => item.runFlag === '停运').length
abnormal.value = tableStore.table.data.filter((k: any) => {
if (tableStore.table.params.statisticalType.name == '终端厂家') {
return k.count != 0
} else {
return !k.name.includes('上送')
}
})
}
})
tableStore.table.params.deptIndex = dictData.state.area[0].id
tableStore.table.params.lineRunFlag = 0
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
watch(
() => prop.searchKey,
val => {
tableStore.index()
}
)
// watch(
// () => prop.timeKey,
// val => {
// tableStore.index()
// }
// )
// watch(
// () => prop.timeValue,
// val => {
// tableStore.index()
// },
// {
// deep: true
// }
// )
</script>
<style lang="scss" scoped>
@import '@/assets/font/iconfont.css';
.monitoringPoints {
display: flex;
}
.detail {
flex: 1;
}
.abnormal {
width: 100%;
background-color: #f3f6f9;
border-radius: 5px;
display: flex;
// justify-content: space-between;
align-items: center;
padding: 5px 0px 5px 10px;
.iconDiv {
display: flex;
align-items: center;
div {
width: 4px;
height: 18px;
margin-right: 5px;
background-color: var(--el-color-primary);
}
}
.text {
font-weight: 700;
font-size: 16px;
font-family: 'Source Code Pro', monospace;
text-align: center;
// font-feature-settings: 'tnum';
}
}
.header {
display: flex;
text-align: center;
font-weight: 700;
padding: 5px;
}
:deep(.el-card__header) {
padding: 10px;
span {
font-weight: 600;
}
}
:deep(.el-card__body) {
padding: 10px;
}
.iconFont {
font-size: 18px;
display: inline-block;
vertical-align: middle;
}
.form {
position: relative;
.form_but {
position: absolute;
right: -22px;
}
}
.card-header {
font-size: 16px;
}
:deep(.table_name) {
color: var(--el-color-primary);
cursor: pointer;
text-underline-offset: 4px;
}
.echartTitle {
display: flex;
justify-content: space-between;
div:nth-child(2) {
font-size: 16px;
color: #ff6600;
}
}
.title {
font-size: 14px;
font-weight: 600;
padding: 0 5px 5px;
}
:deep(.el-segmented__item-selected, ) {
clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}
:deep(.el-segmented__item, ) {
clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
position: relative;
}
:deep(.el-segmented) {
clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%);
}
.text-red {
color: #ff9100 !important;
}
.segmentedIcon {
position: absolute;
top: 1px;
left: 100px;
height: 18px !important;
line-height: 19px;
padding: 0 4px;
font-size: 12px;
background: #ff9100;
color: #fff;
border-radius: 8px;
}
.hexagon {
position: relative;
width: 100px;
height: 55px;
background-color: #19a094;
margin: 50px auto;
&::before {
border-bottom: 27.5px solid #19a094;
}
&::after {
border-top: 27.5px solid #19a094;
}
}
.hexagon::before,
.hexagon::after {
content: '';
position: absolute;
width: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
}
.hexagon::before {
bottom: 98%;
}
.hexagon::after {
top: 98%;
}
.hexagon1 {
background-color: #2e8b57;
&::before {
border-bottom: 27.5px solid #2e8b57;
}
&::after {
border-top: 27.5px solid #2e8b57;
}
}
.hexagon2 {
background-color: #ffbf00;
&::before {
border-bottom: 27.5px solid #ffbf00;
}
&::after {
border-top: 27.5px solid #ffbf00;
}
}
.hexagon3 {
background-color: #a52a2a;
&::before {
border-bottom: 27.5px solid #a52a2a;
}
&::after {
border-top: 27.5px solid #a52a2a;
}
}
.statistics {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.divBox {
width: 100%;
height: 70px;
padding: 10px;
display: flex;
margin-bottom: 10px;
.iconfont {
font-size: 40px;
margin-right: 5px;
}
.divBox_title {
font-weight: 550;
}
.divBox_num {
font-size: 20px;
font-weight: 550;
margin-left: auto;
font-family: AlimamaDongFangDaKai;
}
align-items: center;
// text-align: center;
border-radius: 5px;
}
.div1 {
background-color: #eef8f0;
}
.div2 {
background-color: #67c23a24;
}
.div3 {
background-color: #ffbf0024;
}
.div4 {
background-color: #f56c6c24;
}
}
</style>

View File

@@ -0,0 +1,450 @@
<template>
<div>
<!--终端运行评价 -->
<TableHeader
:showReset="false"
ref="TableHeaderRef"
@selectChange="selectChange"
datePicker
v-if="fullscreen"
></TableHeader>
<div
class="monitoringPoints"
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`,
overflow: 'auto'
}"
v-loading="tableStore.table.loading"
>
<div style="flex: 1">
<div class="title">终端统计</div>
<div style="height: 135px" class="box1">
<div class="boxDiv hexagon">
<div style="color: #fff">100</div>
<div class="mt10 divBot">总数</div>
</div>
<div class="boxDiv hexagon hexagon1">
<div style="color: #fff">50</div>
<div class="mt10 divBot">在运</div>
</div>
</div>
<div style="height: 135px" class="box1">
<div class="boxDiv hexagon hexagon2">
<div style="color: #fff">25</div>
<div class="mt10 divBot">检修</div>
</div>
<div class="boxDiv hexagon hexagon3">
<div style="color: #fff">25</div>
<div class="mt10 divBot">停运</div>
</div>
</div>
</div>
<div style="flex: 2" class="ml15">
<div class="title">终端运行评价</div>
<div class="mb5" style="height: 40px">
<el-segmented style="height: 100%" v-model="segmented" :options="segmentedList" block>
<template #default="scope">
<div>
<div>{{ typeof scope.item === 'object' ? scope.item.label : scope.item }}</div>
</div>
</template>
</el-segmented>
</div>
<div class="header">
<span style="width: 110px; text-align: left">
{{ segmented == 0 ? '区域' : segmented == 1 ? '终端厂家' : '电网标志' }}
</span>
<span style="flex: 1">在运终端数</span>
<span style="width: 80px">评价</span>
</div>
<div
:style="{
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px - 105px )`,
overflow: 'auto'
}"
>
<div v-for="o in abnormal" class="abnormal mb10">
<span style="width: 110px; height: 24px" class="iconDiv">
<div :style="{ backgroundColor: o.integrity < 90 ? '#FF9100' : '' }"></div>
{{ o.targetName }}
</span>
<!-- 在运终端数 -->
<span style="flex: 1; color: #388e3c" class="text">
{{ o.rangeDesc }}
</span>
<span
style="width: 80px; color: #388e3c"
:class="` ${o.integrity < 90 ? 'text-red' : ''}`"
class="text"
>
{{ o.integrity }}
</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import MyEchart from '@/components/echarts/MyEchart.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache'
import { useDictData } from '@/stores/dictData'
const dictData = useDictData()
const prop = defineProps({
w: { type: [String, Number] },
h: { type: [String, Number] },
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: [String, Number] },
timeValue: { type: Object }
})
const headerHeight = ref(57)
const TableHeaderRef = ref()
const monitoringPoints = ref({
runNum: 110,
abnormalNum: 10
})
const segmented = ref(0)
const percentage = ref({})
const segmentedList = ref([
{
label: '区域',
value: 0,
num: 0
},
{
label: '终端厂家',
value: 1,
num: 0
},
{
label: '电网标志',
value: 2,
num: 0
}
])
const abnormal: any = ref([
{
targetName: '唐山',
rangeDesc: 21,
length: 21,
integrity: '优秀'
},
{
targetName: '唐山',
rangeDesc: 21,
length: 21,
integrity: '优秀'
},
{
targetName: '唐山',
rangeDesc: 21,
length: 21,
integrity: '优秀'
},
{
targetName: '唐山',
rangeDesc: 21,
length: 21,
integrity: '优秀'
},
{
targetName: '唐山',
rangeDesc: 21,
length: 21,
integrity: '优秀'
},
{
targetName: '唐山',
rangeDesc: 21,
length: 21,
integrity: '优秀'
},
{
targetName: '唐山',
rangeDesc: 21,
length: 21,
integrity: '优秀'
},
{
targetName: '唐山',
rangeDesc: 21,
length: 21,
integrity: '优秀'
},
{
targetName: '唐山',
rangeDesc: 21,
length: 21,
integrity: 92
}
])
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height
}
// 计算是否全屏展示
const fullscreen = computed(() => {
const w = Number(prop.w)
const h = Number(prop.h)
if (!isNaN(w) && !isNaN(h) && w === 12 && h === 6) {
// 执行相应逻辑
return true
} else {
return false
}
})
const value = ref(new Date())
const list = ref()
const tableStore: any = new TableStore({
url: '/device-boot/deviceRunEvaluate/getRunEvaluateInfo',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
if (prop.timeValue && Array.isArray(prop.timeValue)) {
tableStore.table.params.searchBeginTime = prop.timeValue[0]
tableStore.table.params.searchEndTime = prop.timeValue[1]
}
},
loadCallback: () => {
list.value = tableStore.table.data
}
})
tableStore.table.params.deptId = dictData.state.area[0].id
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue,
val => {
tableStore.index()
},
{
deep: true
}
)
</script>
<style lang="scss" scoped>
.monitoringPoints {
display: flex;
}
.detail {
flex: 1;
}
.abnormal {
width: 100%;
background-color: #f3f6f9;
border-radius: 5px;
display: flex;
// justify-content: space-between;
align-items: center;
padding: 5px 0px 5px 10px;
.iconDiv {
display: flex;
align-items: center;
div {
width: 4px;
height: 18px;
margin-right: 5px;
background-color: var(--el-color-primary);
}
}
.text {
font-weight: 700;
font-size: 16px;
font-family: 'Source Code Pro', monospace;
text-align: center;
// font-feature-settings: 'tnum';
}
}
.header {
display: flex;
text-align: center;
font-weight: 700;
padding: 5px;
}
:deep(.el-card__header) {
padding: 10px;
span {
font-weight: 600;
}
}
:deep(.el-card__body) {
padding: 10px;
}
.iconFont {
font-size: 18px;
display: inline-block;
vertical-align: middle;
}
.form {
position: relative;
.form_but {
position: absolute;
right: -22px;
}
}
.card-header {
font-size: 16px;
}
:deep(.table_name) {
color: var(--el-color-primary);
cursor: pointer;
text-underline-offset: 4px;
}
.echartTitle {
display: flex;
justify-content: space-between;
div:nth-child(2) {
font-size: 16px;
color: #ff6600;
}
}
.title {
font-size: 14px;
font-weight: 600;
padding: 0 5px 5px;
}
:deep(.el-segmented__item-selected, ) {
clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}
:deep(.el-segmented__item, ) {
clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
position: relative;
}
:deep(.el-segmented) {
clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%);
}
.text-red {
color: #ff9100 !important;
}
.segmentedIcon {
position: absolute;
top: 1px;
left: 100px;
height: 18px !important;
line-height: 19px;
padding: 0 4px;
font-size: 12px;
background: #ff9100;
color: #fff;
border-radius: 8px;
}
.box1 {
display: flex;
align-items: center;
justify-content: space-around;
.boxDiv {
// flex: 1;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
margin: 0 5px;
div:nth-child(1) {
position: absolute;
font-size: 30px;
top: -10px;
font-weight: 700;
}
.divBot {
font-size: 16px;
position: absolute;
top: 20px;
}
color: #fff;
}
}
.hexagon {
position: relative;
width: 100px;
height: 55px;
background-color: #19a094;
margin: 50px auto;
&::before {
border-bottom: 27.5px solid #19a094;
}
&::after {
border-top: 27.5px solid #19a094;
}
}
.hexagon::before,
.hexagon::after {
content: '';
position: absolute;
width: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
}
.hexagon::before {
bottom: 98%;
}
.hexagon::after {
top: 98%;
}
.hexagon1 {
background-color: #2e8b57;
&::before {
border-bottom: 27.5px solid #2e8b57;
}
&::after {
border-top: 27.5px solid #2e8b57;
}
}
.hexagon2 {
background-color: #ffbf00;
&::before {
border-bottom: 27.5px solid #ffbf00;
}
&::after {
border-top: 27.5px solid #ffbf00;
}
}
.hexagon3 {
background-color: #a52a2a;
&::before {
border-bottom: 27.5px solid #a52a2a;
}
&::after {
border-top: 27.5px solid #a52a2a;
}
}
</style>

View File

@@ -15,8 +15,9 @@ import { color, gradeColor3 } from './color'
import { useConfig } from '@/stores/config' import { useConfig } from '@/stores/config'
const config = useConfig() const config = useConfig()
// import { nextTick } from 'process' // import { nextTick } from 'process'
const emit = defineEmits(['triggerPoint', 'group']) const emit = defineEmits(['triggerPoint', 'group', 'echartClick'])
color[0] = config.layout.elementUiPrimary[0] color[0] = config.layout.elementUiPrimary[0]
const chartRef = ref<HTMLDivElement>() const chartRef = ref<HTMLDivElement>()
const props = defineProps(['options', 'isInterVal', 'pieInterVal']) const props = defineProps(['options', 'isInterVal', 'pieInterVal'])
@@ -70,6 +71,8 @@ const initChart = () => {
const value = const value =
item.value === 3.14159 || item.value === 0.14159 item.value === 3.14159 || item.value === 0.14159
? '暂无数据' ? '暂无数据'
: item.value === 0.14158
? 0
: Math.round(item.value * 100) / 100 // 处理特殊值 : Math.round(item.value * 100) / 100 // 处理特殊值
tips += `<div style=" display: flex;justify-content: space-between;"> tips += `<div style=" display: flex;justify-content: space-between;">
<span>${item.marker} <span>${item.marker}
@@ -153,6 +156,8 @@ const initChart = () => {
chart.on('click', function (params) { chart.on('click', function (params) {
if (params.seriesName == '暂态触发点') { if (params.seriesName == '暂态触发点') {
emit('triggerPoint', params.data) emit('triggerPoint', params.data)
} else {
emit('echartClick', params)
} }
}) })
@@ -164,7 +169,7 @@ const handlerBar = (options: any) => {
if (Array.isArray(options.series)) { if (Array.isArray(options.series)) {
options.series.forEach((item: any) => { options.series.forEach((item: any) => {
if (item.type === 'bar') { if (item.type === 'bar') {
item.barMinHeight = 10 item.barMinHeight = 0
item.barMaxWidth = 20 item.barMaxWidth = 20
item.itemStyle = Object.assign( item.itemStyle = Object.assign(
{ {

View File

@@ -7,7 +7,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onBeforeUnmount, ref, watch, onMounted, defineEmits } from 'vue' import { onBeforeUnmount, ref, watch, onMounted, } from 'vue'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import 'echarts-gl' import 'echarts-gl'
import 'echarts-liquidfill' import 'echarts-liquidfill'
@@ -19,14 +19,21 @@ const myCharts = ref()
const showCircle = ref(false) const showCircle = ref(false)
const fetchConfig = async (name: string) => { const fetchConfig = async (name: string) => {
const res = await import(`../../assets/map/${name.replace(/市$/, "")}.json`) try {
return res.default // 处理城市名称(去掉末尾的"市")并尝试导入对应文件
const res = await import(`../../assets/map/${name.replace(/市$/, '')}.json`)
return res.default
} catch (error) {
const chinaRes = await import(`../../assets/map/中国.json`) // 请确认中国文件的实际命名
return chinaRes.default
}
// const res = await import(`../../assets/map/${name.replace(/市$/, "")}.json`)
// return res.default
// GetEchar(res.default) // GetEchar(res.default)
} }
// fetchConfig() // fetchConfig()
const emit = defineEmits(['getRegionByRegion', 'eliminate', 'clickMap']) const emit = defineEmits(['getRegionByRegion', 'eliminate', 'clickMap'])
onMounted(() => { })
const GetEchar = async (name: string) => { const GetEchar = async (name: string) => {
let chartDom = document.getElementById('chartMap') let chartDom = document.getElementById('chartMap')
@@ -36,6 +43,7 @@ const GetEchar = async (name: string) => {
name == dictData.state.area?.[0].name ? (showCircle.value = false) : (showCircle.value = true) name == dictData.state.area?.[0].name ? (showCircle.value = false) : (showCircle.value = true)
echarts.registerMap(name, await fetchConfig(name)) //注册可用的地图 echarts.registerMap(name, await fetchConfig(name)) //注册可用的地图
let option = { let option = {
title: { title: {
left: 'center', left: 'center',
@@ -91,6 +99,7 @@ const GetEchar = async (name: string) => {
// top: 10, // top: 10,
// bottom: 0, // bottom: 0,
roam: true, roam: true,
label: { label: {
normal: { normal: {
show: true, show: true,
@@ -170,6 +179,7 @@ const GetEchar = async (name: string) => {
}, 0) }, 0)
window.addEventListener('resize', resizeHandler) window.addEventListener('resize', resizeHandler)
const flag1 = ref(true) const flag1 = ref(true)
// 点击事件 // 点击事件
myCharts.value.off('click') myCharts.value.off('click')
myCharts.value.on('click', (e: any) => { myCharts.value.on('click', (e: any) => {

View File

@@ -1,441 +1,499 @@
<template> <template>
<div v-loading="loading"> <div v-loading="loading">
<div> <div>
<div id="boxi" :style="`height:${vh};overflow: hidden;`"> <div id="boxi" :style="`height:${vh};overflow: hidden;`">
<div class="bx" id="wave"></div> <div class="bx" id="wave"></div>
</div> </div>
<el-tabs type="border-card"> <el-tabs type="border-card">
<el-tab-pane label="暂态波形上送" :style="'height:' + vhh"> <el-tab-pane label="暂态波形上送" :style="'height:' + vhh">
<el-table stripe :data="Data" :height="height" border style="width: 100%" <vxe-table
header-cell-class-name="table_header"> stripe
<el-table-column align="center" prop="number" label="事件段"></el-table-column> :data="Data"
<el-table-column align="center" prop="number" label="波形起始点相位(°)"> :height="height"
<el-table-column align="center" prop="number" label="A相"></el-table-column> border
<el-table-column align="center" prop="number" label="B相"></el-table-column> style="width: 100%"
<el-table-column align="center" prop="number" label="C相"></el-table-column> header-cell-class-name="table_header"
</el-table-column> >
<el-table-column align="center" prop="number" label="跳变段电压变化率(V/ms)"> <vxe-column align="center" field="number" title="事件段"></vxe-column>
<el-table-column align="center" prop="number" label="A相"></el-table-column> <vxe-colgroup align="center" field="number1" title="波形起始点相位(°)">
<el-table-column align="center" prop="number" label="B相"></el-table-column> <vxe-column align="center" field="number2" title="A相"></vxe-column>
<el-table-column align="center" prop="number" label="C相"></el-table-column> <vxe-column align="center" field="number3" title="B相"></vxe-column>
</el-table-column> <vxe-column align="center" field="number4" title="C相"></vxe-column>
<el-table-column align="center" prop="number" label="相位跳变(°)"> </vxe-colgroup>
<el-table-column align="center" prop="number" label="A相"></el-table-column> <vxe-colgroup align="center" field="number" title="跳变段电压变化率(V/ms)">
<el-table-column align="center" prop="number" label="B相"></el-table-column> <vxe-column align="center" field="number5" title="A相"></vxe-column>
<el-table-column align="center" prop="number" label="C相"></el-table-column> <vxe-column align="center" field="number6" title="B相"></vxe-column>
</el-table-column> <vxe-column align="center" field="number7" title="C相"></vxe-column>
<el-table-column align="center" prop="number" label="总分段数目"></el-table-column> </vxe-colgroup>
<el-table-column align="center" prop="number" label="三相电压不平衡度(%)" width="180"></el-table-column> <vxe-colgroup align="center" field="number" title="相位跳变(°)">
<el-table-column align="center" prop="number" label="暂降类型"></el-table-column> <vxe-column align="center" field="number8" title="A相"></vxe-column>
<el-table-column align="center" prop="number" label="暂降原因"></el-table-column> <vxe-column align="center" field="number9" title="B相"></vxe-column>
</el-table> <vxe-column align="center" field="number10" title="C相"></vxe-column>
</el-tab-pane> </vxe-colgroup>
</el-tabs> <vxe-column align="center" field="number11" title="总分段数目"></vxe-column>
</div> <vxe-column
</div> align="center"
</template> field="number12"
<script> title="三相电压不平衡度(%)"
import { downloadWaveFile, getMonitorEventAnalyseWave } from '@/api/event-boot/transient' width="180"
import { mainHeight } from '@/utils/layout' ></vxe-column>
import * as echarts from 'echarts' <vxe-column align="center" field="number13" title="触发类型"></vxe-column>
import url from '@/assets/img/point.png' <vxe-column align="center" field="number14" title="暂降原因"></vxe-column>
import $ from 'jquery' </vxe-table>
export default { </el-tab-pane>
props: { </el-tabs>
flag: { </div>
type: Boolean, </div>
default: false </template>
}, <script>
DColor: { import { downloadWaveFile, getMonitorEventAnalyseWave } from '@/api/event-boot/transient'
type: Boolean, import { mainHeight } from '@/utils/layout'
default: false import * as echarts from 'echarts'
}, import url from '@/assets/img/point.png'
boxoList: { import $ from 'jquery'
type: [Object, Array] export default {
}, props: {
GJList: { flag: {
type: [Object, Array] type: Boolean,
} default: false
}, },
data() { DColor: {
return { type: Boolean,
loading: true, default: false
},
valA: 0, boxoList: {
isOpen: false, type: [Object, Array]
time: '', },
type: '', GJList: {
severity: '', type: [Object, Array]
iphasic: '', }
eventValue: '', },
persistTime: '', data() {
lineName: '', return {
subName: '', loading: true,
waveDatas: [],
valA: 0,
Data: [], isOpen: false,
height: null, time: '',
vhh: null, type: '',
ptpass: '', severity: '',
waveHeight: undefined, iphasic: '',
$wave: undefined, eventValue: '',
color: '#006565', persistTime: '',
charts: {}, lineName: '',
arrpoints: [], subName: '',
titles: '', waveDatas: [],
vh: null,
vw: null, Data: [
zoom: '' {
} number: 1,
}, number1: 0,
created() { }, number2: 0,
watch: { number3: 0,
value: function (a, b) { number4: 0,
if (a == 2) { number5: 0,
// $("#wave1").remove(); number6: 0,
this.initWaves() number7: 0,
} else { number8: 0,
$('#wave1').remove() number9: 0,
this.initWaves() number10: 0,
} number11: 1,
} number12: 0,
}, number13: '其他',
mounted() { number14: '其他'
this.setHeight() }
window.addEventListener('resize', this.setHeight) ],
this.$wave = $('#wave').eq(0) height: null,
this.$nextTick(() => { vhh: null,
this.query() ptpass: '',
}) waveHeight: undefined,
}, $wave: undefined,
beforeDestroy() { color: '#006565',
window.removeEventListener('resize', this.setHeight) charts: {},
}, arrpoints: [],
methods: { titles: '',
setHeight() { vh: null,
this.zoom = 1 / document.body.style.zoom vw: null,
if (this.flag) { zoom: ''
// console.log(123); }
this.vh = mainHeight(250).height },
} else { created() {},
// console.log(3333); watch: {
this.vh = mainHeight(270).height value: function (a, b) {
} if (a == 2) {
}, // $("#wave1").remove();
query() { this.initWaves()
this.loading = true } else {
this.initWave() $('#wave1').remove()
}, this.initWaves()
}
//开始画图 }
initWave() { },
//清除之前增加的div mounted() {
// $("#wave ~ .bx1").remove(); this.setHeight()
$('div.bx1').remove() window.addEventListener('resize', this.setHeight)
//设置暂降触发点的位置 一次值与二次值Y轴不同不是计算出来的 this.$wave = $('#wave').eq(0)
// var height = $(window).height() - 90; this.$nextTick(() => {
var picHeight this.query()
var show = true })
},
//var v = $("#interval").val(); beforeDestroy() {
var isvisible = false window.removeEventListener('resize', this.setHeight)
},
picHeight = this.vh methods: {
// this.$wave.css('height', picHeight) setHeight() {
// this.$wave.css('width', '100%') this.zoom = 1 / document.body.style.zoom
$('#wave').css('height', picHeight) if (this.flag) {
$('#wave').css('width', this.vw) // console.log(123);
this.vh = mainHeight(280).height
var adata = [] } else {
var bdata = [] // console.log(3333);
var cdata = [] this.vh = mainHeight(305).height
var max = 0 }
var min = 0 },
//绘制横向第一个波形图 query() {
this.GJList.smp_x.forEach((item, ind) => { this.loading = true
if (this.GJList.smp_a[ind] > max) { this.initWave()
max = this.GJList.smp_a[ind] },
} else if (this.GJList.smp_a[ind] < min) {
min = this.GJList.smp_a[ind] //开始画图
} initWave() {
if (this.GJList.smp_b[ind] > max) { //清除之前增加的div
max = this.GJList.smp_b[ind] // $("#wave ~ .bx1").remove();
} else if (this.GJList.smp_b[ind] < min) { $('div.bx1').remove()
min = this.GJList.smp_b[ind] //设置暂降触发点的位置 一次值与二次值Y轴不同不是计算出来的
} // var height = $(window).height() - 90;
if (this.GJList.smp_c[ind] > max) { var picHeight
max = this.GJList.smp_c[ind] var show = true
} else if (this.GJList.smp_c[ind] < min) {
min = this.GJList.smp_c[ind] //var v = $("#interval").val();
} var isvisible = false
adata.push([item, this.GJList.smp_a[ind]]) picHeight = this.vh
bdata.push([item, this.GJList.smp_b[ind]]) // this.$wave.css('height', picHeight)
cdata.push([item, this.GJList.smp_c[ind]]) // this.$wave.css('width', '100%')
}) $('#wave').css('height', picHeight)
//绘制瞬时波形图 $('#wave').css('width', this.vw)
// const echarts = require('echarts')
let wave = document.getElementById('wave') var adata = []
let _this = this var bdata = []
var myChartes = echarts.init(wave) var cdata = []
let echartsColor = { var max = 0
WordColor: '#000', var min = 0
thread: '#000000', //绘制横向第一个波形图
FigureColor: [ this.GJList.smp_x.forEach((item, ind) => {
'#07CCCA ', if (this.GJList.smp_a[ind] > max) {
'#00BFF5', max = this.GJList.smp_a[ind]
'#FFBF00', } else if (this.GJList.smp_a[ind] < min) {
'#77DA63', min = this.GJList.smp_a[ind]
'#D5FF6B', }
'#Ff6600', if (this.GJList.smp_b[ind] > max) {
'#FF9100', max = this.GJList.smp_b[ind]
'#5B6E96', } else if (this.GJList.smp_b[ind] < min) {
'#66FFCC', min = this.GJList.smp_b[ind]
'#B3B3B3', }
'#FF00FF', if (this.GJList.smp_c[ind] > max) {
'#CC00FF', max = this.GJList.smp_c[ind]
'#FF9999' } else if (this.GJList.smp_c[ind] < min) {
] min = this.GJList.smp_c[ind]
} }
var option = {
tooltip: { adata.push([item, this.GJList.smp_a[ind]])
top: '10px', bdata.push([item, this.GJList.smp_b[ind]])
trigger: 'axis', cdata.push([item, this.GJList.smp_c[ind]])
borderColor: 'grey', })
backgroundColor: '#fff', //绘制瞬时波形图
style: { // const echarts = require('echarts')
color: '#000', let wave = document.getElementById('wave')
fontSize: '15px', let _this = this
padding: 10 var myChartes = echarts.init(wave)
}, let echartsColor = {
formatter: function (params) { WordColor: '#000',
// console.log(params) thread: '#000000',
var tips = '' FigureColor: [
tips += '时刻:' + params[0].data[0] + '</br/>' '#07CCCA ',
'#00BFF5',
for (var i = 0; i < params.length; i++) { '#FFBF00',
if (params[i].seriesName != '暂降触发点') { '#77DA63',
tips += params[i].seriesName + ':' + params[i].value[1] + '<br/>' '#D5FF6B',
} '#Ff6600',
} '#FF9100',
return tips '#5B6E96',
}, '#66FFCC',
// axisPointer: { '#B3B3B3',
// type: "cross", '#FF00FF',
// label: { '#CC00FF',
// color: "#fff", '#FF9999'
// fontSize: 16, ]
// }, }
// }, console.log('🚀 ~ this.boxoList:', this.boxoList)
textStyle: {
color: '#fff', var option = {
fontStyle: 'normal', tooltip: {
opacity: 0.35, top: '10px',
fontSize: 14 trigger: 'axis',
}, borderColor: 'grey',
backgroundColor: 'rgba(0,0,0,0.55)', backgroundColor: '#fff',
borderWidth: 0 style: {
}, color: '#000',
fontSize: '15px',
title: { padding: 10
left: 'center', },
text: '发生时刻:' + this.boxoList.startTime + ' PT变化:' + this.boxoList.measurementPointName, formatter: function (params) {
textStyle: { // console.log(params)
fontSize: 16, var tips = ''
color: _this.DColor ? '#fff' : echartsColor.WordColor tips += '时刻:' + params[0].data[0] + '</br/>'
}
}, for (var i = 0; i < params.length; i++) {
legend: { if (params[i].seriesName != '暂降触发点') {
left: '5%', tips += params[i].seriesName + ':' + params[i].value[1] + '<br/>'
top: '20', }
verticalAlign: 'top', }
enabled: true, return tips
itemDistance: 5, },
textStyle: { // axisPointer: {
color: _this.DColor ? '#fff' : echartsColor.WordColor, // type: "cross",
rich: { // label: {
a: { // color: "#fff",
verticalAlign: 'middle' // fontSize: 16,
} // },
}, // },
textStyle: {
padding: [2, 0, 0, 0] //[上、右、下、左] color: '#fff',
} fontStyle: 'normal',
}, opacity: 0.35,
toolbox: { fontSize: 14
show: false, },
feature: { backgroundColor: 'rgba(0,0,0,0.55)',
//restore: {}, borderWidth: 0
saveAsImage: { },
iconStyle: {
borderColor: _this.DColor ? '#fff' : echartsColor.WordColor title: {
} left: 'center',
} text: '发生时刻:' + this.boxoList.startTime + ' PT变化:' + this.boxoList.pt,
} textStyle: {
}, fontSize: 16,
xAxis: { color: _this.DColor ? '#fff' : echartsColor.WordColor
type: 'value', }
name: '时刻', },
boundaryGap: false, legend: {
min: this.GJList.smp_x[0], left: '5%',
max: this.GJList.smp_x[this.GJList.smp_x.length - 1] + 1, top: '20',
title: { verticalAlign: 'top',
text: 'ms', enabled: true,
textStyle: { itemDistance: 5,
fontSize: 12, textStyle: {
color: _this.DColor ? '#fff' : echartsColor.WordColor color: _this.DColor ? '#fff' : echartsColor.WordColor,
}, rich: {
enabled: true, a: {
align: 'high' verticalAlign: 'middle'
}, }
splitLine: { },
show: false
}, padding: [2, 0, 0, 0] //[上、右、下、左]
axisTick: { }
alignWithLabel: true },
}, toolbox: {
axisLine: { show: false,
lineStyle: { feature: {
color: _this.DColor ? '#fff' : echartsColor.thread //restore: {},
}, saveAsImage: {
onZero: false //-----------重点 iconStyle: {
}, borderColor: _this.DColor ? '#fff' : echartsColor.WordColor
axisLabel: { }
color: _this.DColor ? '#fff' : echartsColor.WordColor, }
formatter: function (value, index) { }
if (_this.valA != (value - 0).toFixed(0)) { },
_this.valA = (value - 0).toFixed(0) xAxis: {
return (value - 0).toFixed(0) type: 'value',
} name: '时刻',
} boundaryGap: false,
//rotate:39 min: this.GJList.smp_x[0],
} max: this.GJList.smp_x[this.GJList.smp_x.length - 1] + 1,
// data: this.syncExtremes, title: {
}, text: 'ms',
yAxis: { textStyle: {
type: 'value', fontSize: 12,
name: 'kV', color: _this.DColor ? '#fff' : echartsColor.WordColor
title: { },
align: 'high', enabled: true,
offset: 0, align: 'high'
text: 'kV', },
rotation: 0, splitLine: {
y: -10 show: false
}, },
axisTick: {
boundaryGap: [0, '100%'], alignWithLabel: true
showLastLabel: true, },
max: (max + 10).toFixed(2), axisLine: {
min: (min - 10).toFixed(2), lineStyle: {
opposite: false, color: _this.DColor ? '#fff' : echartsColor.thread
nameTextStyle: { },
color: _this.DColor ? '#fff' : echartsColor.WordColor onZero: false //-----------重点
}, },
//minInterval: 1, axisLabel: {
type: 'value', color: _this.DColor ? '#fff' : echartsColor.WordColor,
axisLine: { formatter: function (value, index) {
show: true, if (_this.valA != (value - 0).toFixed(0)) {
lineStyle: { _this.valA = (value - 0).toFixed(0)
color: _this.DColor ? '#fff' : echartsColor.thread return (value - 0).toFixed(0)
}, }
onZero: false //-----------重点 }
}, //rotate:39
axisLabel: { }
color: _this.DColor ? '#fff' : echartsColor.WordColor, // data: this.syncExtremes,
formatter: function (value, index) { },
return (value - 0).toFixed(2) yAxis: {
} type: 'value',
}, name: 'kV',
splitLine: { title: {
lineStyle: { align: 'high',
// 使用深浅的间隔色 offset: 0,
color: [_this.DColor ? '#fff' : echartsColor.thread], text: 'kV',
type: 'dashed', rotation: 0,
opacity: 0.5 y: -10
} },
}
}, boundaryGap: [0, '100%'],
grid: { showLastLabel: true,
left: '1%', max: (max + 10).toFixed(2),
right: '40px', min: (min - 10).toFixed(2),
bottom: '40px', opposite: false,
top: '55px', nameTextStyle: {
containLabel: true color: _this.DColor ? '#fff' : echartsColor.WordColor
}, },
dataZoom: [ //minInterval: 1,
{ type: 'value',
type: 'inside', axisLine: {
height: 13, show: true,
start: 0, lineStyle: {
bottom: '20px', color: _this.DColor ? '#fff' : echartsColor.thread
end: 100 },
}, onZero: false //-----------重点
{ },
start: 0, axisLabel: {
height: 13, color: _this.DColor ? '#fff' : echartsColor.WordColor,
bottom: '20px', formatter: function (value, index) {
end: 100 return (value - 0).toFixed(2)
} }
], },
series: [ splitLine: {
{ lineStyle: {
name: 'A相', // 使用深浅的间隔色
type: 'line', color: [_this.DColor ? '#fff' : echartsColor.thread],
smooth: true, type: 'dashed',
symbol: 'none', opacity: 0.5
sampling: 'lttb', }
itemStyle: { }
color: '#DAA520' },
}, grid: {
data: adata left: '1%',
}, right: '40px',
{ bottom: '40px',
name: 'B相', top: '55px',
type: 'line', containLabel: true
smooth: true, },
symbol: 'none', dataZoom: [
sampling: 'lttb', {
itemStyle: { type: 'inside',
color: '#2E8B57' height: 13,
}, start: 0,
data: bdata bottom: '20px',
}, end: 100
{ },
name: 'C相', {
type: 'line', start: 0,
smooth: true, height: 13,
symbol: 'none', bottom: '20px',
sampling: 'lttb', end: 100
itemStyle: { }
color: '#A52a2a' ],
}, series: [
data: cdata {
}, name: '跳变期',
{ type: 'line',
name: '暂降触发点', data: [],
type: 'scatter', showSymbol: true, // 强制显示标记
symbol: 'image://' + url, symbol: 'rect', // 标记形状为方块
itemStyle: { symbolSize: 10, // 方块大小
width: 16, itemStyle: {
height: 16 color: '#888888', // 方块颜色为灰色
}, borderWidth: 0
data: [[0, min]] },
}
] markArea: {
} silent: true, // 不响应交互
itemStyle: { color: '#ccc' },
myChartes.setOption(option) data: [
// window.echartsArr.push(myChartes) [
setTimeout(() => { { xAxis: '0' }, // 第一个跳变期起始
myChartes.resize() { xAxis: '5' } // 第一个跳变期结束
this.loading = false ],
}, 400) [
{ xAxis: '210' }, // 第二个跳变期起始
//第一个波形图数据绘制完毕后,绘制后续的波形图 { xAxis: '220' } // 第二个跳变期结束
]
// let waveDatasTemp = waveDatas.slice(1); ]
// waveDatasTemp.reverse(); }
} },
} {
} name: 'A相',
</script> type: 'line',
smooth: true,
symbol: 'none',
sampling: 'lttb',
itemStyle: {
color: '#DAA520'
},
data: adata
},
{
name: 'B相',
type: 'line',
smooth: true,
symbol: 'none',
sampling: 'lttb',
itemStyle: {
color: '#2E8B57'
},
data: bdata
},
{
name: 'C相',
type: 'line',
smooth: true,
symbol: 'none',
sampling: 'lttb',
itemStyle: {
color: '#A52a2a'
},
data: cdata
},
{
name: '暂降触发点',
type: 'scatter',
symbol: 'image://' + url,
itemStyle: {
width: 16,
height: 16
},
data: [[0, min]]
}
]
}
myChartes.setOption(option)
// window.echartsArr.push(myChartes)
setTimeout(() => {
myChartes.resize()
this.loading = false
}, 400)
//第一个波形图数据绘制完毕后,绘制后续的波形图
// let waveDatasTemp = waveDatas.slice(1);
// waveDatasTemp.reverse();
}
}
}
</script>

View File

@@ -1,14 +1,17 @@
export let color = [ export const color = [
'#07CCCA', '#07CCCA',
'#00BFF5', '#00BFF5',
'#FFBF00', '#FFBF00',
'#77DA63', '#77DA63',
'#D5FF6B', '#D5FF6B',
'#Ff6600', '#Ff6600',
'#FF9100', '#FF9100',
'#5B6E96', '#5B6E96',
'#66FFCC', '#66FFCC',
'#B3B' '#B266FF',
] '#FF6680',
export const gradeColor3 = ['#339966', '#FFCC33', '#A52a2a'] '#40A0FF',
export const gradeColor5 = ['#00CC00', '#99CC99', '#FF9900', '#996600', '#A52a2a'] '#33CC99'
]
export const gradeColor3 = ['#339966', '#FFCC33', '#A52a2a']
export const gradeColor5 = ['#00CC00', '#99CC99', '#FF9900', '#996600', '#A52a2a']

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,322 @@
// 辅助函数
const getMax = (temp, tempA, tempB, tempC) => {
temp = temp > tempA ? temp : tempA
temp = temp > tempB ? temp : tempB
if (tempC !== undefined) {
temp = temp > tempC ? temp : tempC
}
return temp
}
const getMaxTwo = (temp, tempA, tempB) => {
temp = temp > tempA ? temp : tempA
temp = temp > tempB ? temp : tempB
return temp
}
const getMin = (temp, tempA, tempB, tempC) => {
temp = temp < tempA ? temp : tempA
temp = temp < tempB ? temp : tempB
if (tempC !== undefined) {
temp = temp < tempC ? temp : tempC
}
return temp
}
const getMinOpen = (temp, tempA, tempB) => {
temp = temp < tempA ? temp : tempA
temp = temp < tempB ? temp : tempB
return temp
}
// 数据处理函数
const fliteWaveData = (wp, step, iphasicValue, isOpen) => {
const rmsData = wp.listRmsData
const pt = Number(wp.pt) / 1000
const ct = Number(wp.ct)
const titleList = wp.waveTitle
let xishu = pt
let aTitle = '',
bTitle = '',
cTitle = '',
unit = '电压'
let rmsvFirstX = 0,
rmsvFirstY = 0,
rmsvSecondX = 0,
rmsvSecondY = 0,
firstZhou = 'a',
secondeZhou = 'a'
let ifmax = 0,
ifmin = 0,
ismax = 0,
ismin = 0,
rfmax = 0,
rfmin = 0,
rsmax = 0,
rsmin = 0
const shunshiFA = []
const shunshiFB = []
const shunshiFC = []
const shunshiSA = []
const shunshiSB = []
const shunshiSC = []
const rmsFA = []
const rmsFB = []
const rmsFC = []
const rmsSA = []
const rmsSB = []
const rmsSC = []
if (titleList[iphasicValue * step + 1]?.substring(0, 1) !== 'U') {
xishu = ct
unit = '电流'
}
for (let i = 1; i <= iphasicValue; i++) {
switch (i) {
case 1:
aTitle = titleList[iphasicValue * step + i]?.substring(1) || ''
break
case 2:
bTitle = titleList[iphasicValue * step + i]?.substring(1) || ''
break
case 3:
cTitle = titleList[iphasicValue * step + i]?.substring(1) || ''
break
}
}
if (rmsData[0] && rmsData[0][iphasicValue * step + 1] !== undefined) {
rfmax = rmsData[0][iphasicValue * step + 1] * xishu
rfmin = rmsData[0][iphasicValue * step + 1] * xishu
rmsvFirstY = rmsData[0][iphasicValue * step + 1] * xishu
rmsvFirstX = rmsData[0][0]
rsmax = rmsData[0][iphasicValue * step + 1]
rsmin = rmsData[0][iphasicValue * step + 1]
rmsvSecondY = rmsData[0][iphasicValue * step + 1]
rmsvSecondX = rmsData[0][0]
}
for (let rms = 0; rms < rmsData.length; rms++) {
if (!rmsData[rms] || rmsData[rms][iphasicValue * step + 1] === undefined) {
break
}
switch (iphasicValue) {
case 1:
const rmsFirstA = rmsData[rms][iphasicValue * step + 1] * xishu
rmsFA.push([rmsData[rms][0], rmsFirstA])
rfmax = rfmax > rmsFirstA ? rfmax : rmsFirstA
rfmin = rfmin < rmsFirstA ? rfmin : rmsFirstA
if (rfmin < rmsvFirstY) {
rmsvFirstY = rfmin
firstZhou = 'a'
rmsvFirstX = rmsData[rms][0]
}
const rmsSecondA = rmsData[rms][iphasicValue * step + 1]
rmsSA.push([rmsData[rms][0], rmsSecondA])
rsmax = rsmax > rmsSecondA ? rsmax : rmsSecondA
rsmin = rsmin < rmsSecondA ? rsmin : rmsSecondA
if (rsmin < rmsvSecondY) {
rmsvSecondY = rsmin
secondeZhou = 'a'
rmsvSecondX = rmsData[rms][0]
}
break
case 2:
const rmsFirstA2 = rmsData[rms][iphasicValue * step + 1] * xishu
const rmsFirstB2 = rmsData[rms][iphasicValue * step + 2] * xishu
rmsFA.push([rmsData[rms][0], rmsFirstA2])
rmsFB.push([rmsData[rms][0], rmsFirstB2])
rfmax = getMaxTwo(rfmax, rmsFirstA2, rmsFirstB2)
rfmin = getMinOpen(rfmin, rmsFirstA2, rmsFirstB2)
if (rfmin < rmsvFirstY) {
rmsvFirstY = rfmin
if (rfmin === rmsFirstA2) {
firstZhou = 'a'
} else if (rfmin === rmsFirstB2) {
firstZhou = 'b'
}
rmsvFirstX = rmsData[rms][0]
}
const rmsSecondA2 = rmsData[rms][iphasicValue * step + 1]
const rmsSecondB2 = rmsData[rms][iphasicValue * step + 2]
rmsSA.push([rmsData[rms][0], rmsSecondA2])
rmsSB.push([rmsData[rms][0], rmsSecondB2])
rsmax = getMaxTwo(rsmax, rmsSecondA2, rmsSecondB2)
rsmin = getMinOpen(rsmin, rmsSecondA2, rmsSecondB2)
if (rsmin < rmsvSecondY) {
rmsvSecondY = rsmin
if (rsmin === rmsSecondA2) {
secondeZhou = 'a'
} else if (rsmin === rmsSecondB2) {
secondeZhou = 'b'
}
rmsvSecondX = rmsData[rms][0]
}
break
case 3:
const rmsFirstA3 = rmsData[rms][iphasicValue * step + 1] * xishu
const rmsFirstB3 = rmsData[rms][iphasicValue * step + 2] * xishu
const rmsFirstC3 = rmsData[rms][iphasicValue * step + 3] * xishu
rmsFA.push([rmsData[rms][0], rmsFirstA3])
rmsFB.push([rmsData[rms][0], rmsFirstB3])
rmsFC.push([rmsData[rms][0], rmsFirstC3])
rfmax = getMax(rfmax, rmsFirstA3, rmsFirstB3, rmsFirstC3)
rfmin = isOpen
? getMinOpen(rfmin, rmsFirstA3, rmsFirstC3)
: getMin(rfmin, rmsFirstA3, rmsFirstB3, rmsFirstC3)
if (rfmin < rmsvFirstY) {
rmsvFirstY = rfmin
if (rfmin === rmsFirstA3) {
firstZhou = 'a'
} else if (rfmin === rmsFirstB3) {
firstZhou = 'b'
} else {
firstZhou = 'c'
}
rmsvFirstX = rmsData[rms][0]
}
const rmsSecondA3 = rmsData[rms][iphasicValue * step + 1]
const rmsSecondB3 = rmsData[rms][iphasicValue * step + 2]
const rmsSecondC3 = rmsData[rms][iphasicValue * step + 3]
rmsSA.push([rmsData[rms][0], rmsSecondA3])
rmsSB.push([rmsData[rms][0], rmsSecondB3])
rmsSC.push([rmsData[rms][0], rmsSecondC3])
rsmax = getMax(rsmax, rmsSecondA3, rmsSecondB3, rmsSecondC3)
rsmin = isOpen
? getMinOpen(rsmin, rmsSecondA3, rmsSecondC3)
: getMin(rsmin, rmsSecondA3, rmsSecondB3, rmsSecondC3)
if (rsmin < rmsvSecondY) {
rmsvSecondY = rsmin
if (rsmin === rmsSecondA3) {
secondeZhou = 'a'
} else if (rsmin === rmsSecondB3) {
secondeZhou = 'b'
} else {
secondeZhou = 'c'
}
rmsvSecondX = rmsData[rms][0]
}
break
}
}
const instantF = { max: ifmax, min: ifmin }
const instantS = { max: ismax, min: ismin }
const RMSF = { max: rfmax, min: rfmin }
const RMSS = { max: rsmax, min: rsmin }
const RMSFMinDetail = { rmsvFirstX, rmsvFirstY, firstZhou }
const RMSSMinDetail = { rmsvSecondX, rmsvSecondY, secondeZhou }
const shunshiF = { shunshiFA, shunshiFB, shunshiFC }
const shunshiS = { shunshiSA, shunshiSB, shunshiSC }
const RMSFWave = { rmsFA, rmsFB, rmsFC }
const RMSSWave = { rmsSA, rmsSB, rmsSC }
const title = { aTitle, bTitle, cTitle, unit }
return {
instantF,
instantS,
RMSF,
RMSS,
RMSFMinDetail,
RMSSMinDetail,
shunshiF,
shunshiS,
RMSFWave,
RMSSWave,
title,
unit
}
}
// 监听消息
self.onmessage = function (e) {
const { wp, isOpen, value, boxoList, requestId } = e.data
try {
const iphasicValue = wp.iphasic || 1
const picCounts = (wp.waveTitle.length - 1) / iphasicValue
const waveDatas = []
for (let i = 0; i < picCounts; i++) {
const data = fliteWaveData(wp, i, iphasicValue, isOpen, boxoList)
waveDatas.push(data)
}
// 处理标题
let titles = ''
if (boxoList.systemType == 'pms') {
titles =
'变电站名称:' +
boxoList.powerStationName +
' 监测点名称:' +
boxoList.measurementPointName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'%  持续时间:' +
boxoList.duration +
's'
} else if (boxoList.systemType == 'ZL') {
titles =
(boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) +
' 监测点名称:' +
boxoList.equipmentName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
boxoList.evtParamVVaDepth +
'% 持续时间:' +
boxoList.evtParamTm +
's'
} else if (boxoList.systemType == 'YPT') {
titles =
(boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) +
' 监测点名称:' +
boxoList.lineName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' +
boxoList.persistTime +
's'
} else {
titles =
' 变电站名称:' +
boxoList.subName +
' 监测点名称:' +
boxoList.lineName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' +
boxoList.duration +
's'
}
// 发送处理结果回主线程
self.postMessage({
requestId,
titles: titles,
success: true,
waveDatas,
time: wp.time,
type: wp.waveType,
severity: wp.yzd,
iphasic: iphasicValue
})
} catch (error) {
self.postMessage({
requestId,
success: false,
error: error.message
})
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,207 @@
// waveData.worker.js
self.addEventListener('message', function (e) {
const { wp, value, iphasic, isOpen, boxoList, requestId } = e.data
// 处理波形数据的函数
const fliteWaveData = (wp, step) => {
// 将原有的fliteWaveData函数实现复制到这里
const shunData = wp.listWaveData
const pt = Number(wp.pt) / 1000
const ct = Number(wp.ct)
const titleList = wp.waveTitle
let xishu = pt
let aTitle = '',
bTitle = '',
cTitle = '',
unit = '电压'
let ifmax = 0,
ifmin = 0,
ismax = 0,
ismin = 0
const shunshiFA = []
const shunshiFB = []
const shunshiFC = []
const shunshiSA = []
const shunshiSB = []
const shunshiSC = []
if (shunData.length > 0) {
if (titleList[iphasic * step + 1]?.substring(0, 1) !== 'U') {
xishu = ct
unit = '电流'
}
for (let i = 1; i <= iphasic; i++) {
switch (i) {
case 1:
aTitle = titleList[iphasic * step + i]?.substring(1) || ''
break
case 2:
bTitle = titleList[iphasic * step + i]?.substring(1) || ''
break
case 3:
cTitle = titleList[iphasic * step + i]?.substring(1) || ''
break
}
}
if (shunData[0][iphasic * step + 1] !== undefined) {
ifmax = shunData[0][iphasic * step + 1] * xishu
ifmin = shunData[0][iphasic * step + 1] * xishu
ismax = shunData[0][iphasic * step + 1]
ismin = shunData[0][iphasic * step + 1]
}
for (let shun = 0; shun < shunData.length; shun++) {
if (shunData[shun][iphasic * step + 1] === undefined) {
break
}
switch (iphasic) {
case 1:
const shunFirstA = shunData[shun][iphasic * step + 1] * xishu
shunshiFA.push([shunData[shun][0], shunFirstA])
ifmax = Math.max(ifmax, shunFirstA)
ifmin = Math.min(ifmin, shunFirstA)
const shunSecondA = shunData[shun][iphasic * step + 1]
shunshiSA.push([shunData[shun][0], shunSecondA])
ismax = Math.max(ismax, shunSecondA)
ismin = Math.min(ismin, shunSecondA)
break
case 2:
const shunFirstA2 = shunData[shun][iphasic * step + 1] * xishu
const shunFirstB2 = shunData[shun][iphasic * step + 2] * xishu
shunshiFA.push([shunData[shun][0], shunFirstA2])
shunshiFB.push([shunData[shun][0], shunFirstB2])
ifmax = Math.max(ifmax, shunFirstA2, shunFirstB2)
ifmin = Math.min(ifmin, shunFirstA2, shunFirstB2)
const shunSecondA2 = shunData[shun][iphasic * step + 1]
const shunSecondB2 = shunData[shun][iphasic * step + 2]
shunshiSA.push([shunData[shun][0], shunSecondA2])
shunshiSB.push([shunData[shun][0], shunSecondB2])
ismax = Math.max(ismax, shunSecondA2, shunSecondB2)
ismin = Math.min(ismin, shunSecondA2, shunSecondB2)
break
case 3:
const shunFirstA3 = shunData[shun][iphasic * step + 1] * xishu
const shunFirstB3 = shunData[shun][iphasic * step + 2] * xishu
const shunFirstC3 = shunData[shun][iphasic * step + 3] * xishu
shunshiFA.push([shunData[shun][0], shunFirstA3])
shunshiFB.push([shunData[shun][0], shunFirstB3])
shunshiFC.push([shunData[shun][0], shunFirstC3])
ifmax = Math.max(ifmax, shunFirstA3, shunFirstB3, shunFirstC3)
ifmin = isOpen
? Math.min(ifmin, shunFirstA3, shunFirstC3)
: Math.min(ifmin, shunFirstA3, shunFirstB3, shunFirstC3)
const shunSecondA3 = shunData[shun][iphasic * step + 1]
const shunSecondB3 = shunData[shun][iphasic * step + 2]
const shunSecondC3 = shunData[shun][iphasic * step + 3]
shunshiSA.push([shunData[shun][0], shunSecondA3])
shunshiSB.push([shunData[shun][0], shunSecondB3])
shunshiSC.push([shunData[shun][0], shunSecondC3])
ismax = Math.max(ismax, shunSecondA3, shunSecondB3, shunSecondC3)
ismin = isOpen
? Math.min(ismin, shunSecondA3, shunSecondC3)
: Math.min(ismin, shunSecondA3, shunSecondB3, shunSecondC3)
break
}
}
}
const instantF = { max: ifmax, min: ifmin }
const instantS = { max: ismax, min: ismin }
const shunshiF = { shunshiFA, shunshiFB, shunshiFC }
const shunshiS = { shunshiSA, shunshiSB, shunshiSC }
const title = { aTitle, bTitle, cTitle, unit }
return { instantF, instantS, shunshiF, shunshiS, title, unit }
}
// 处理标题
let titles = ''
if (boxoList.systemType == 'pms') {
titles =
'变电站名称:' +
boxoList.powerStationName +
' 监测点名称:' +
boxoList.measurementPointName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' +
boxoList.duration +
's'
} else if (boxoList.systemType == 'ZL') {
titles =
(boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) +
' 监测点名称:' +
boxoList.equipmentName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
boxoList.evtParamVVaDepth +
'% 持续时间:' +
boxoList.evtParamTm +
's'
} else if (boxoList.systemType == 'YPT') {
titles =
(boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) +
' 监测点名称:' +
boxoList.lineName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' +
boxoList.persistTime +
's'
} else {
titles =
'变电站名称:' +
boxoList.subName +
' 监测点名称:' +
boxoList.lineName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' +
boxoList.duration +
's'
}
const iphasicValue = wp.iphasic || 1
const picCounts = (wp.waveTitle.length - 1) / iphasicValue
const waveDatas = []
for (let i = 0; i < picCounts; i++) {
const data = fliteWaveData(wp, i)
waveDatas.push(data)
}
const time = wp.time
const type = wp.waveType
let severity = wp.yzd
if (severity < 0) {
severity = '/'
type = '/'
}
// 将处理结果发送回主线程
self.postMessage({
requestId,
success: true,
waveDatas,
time,
type,
severity,
titles,
iphasic: iphasicValue
})
})

File diff suppressed because it is too large Load Diff

View File

@@ -1,345 +0,0 @@
<template>
<div>
<!-- <MyEChart style="height: 400px;width: 100%" v-for="item in echartsList" :options="item" /> -->
<div id="container0" style="height:400px;width:100%;"></div>
<div id="container1" style="height:400px;width:100%;"></div>
</div>
</template>
<script setup lang='ts'>
import MyEChart from '@/components/echarts/MyEchart.vue'
import Highcharts from 'highcharts';
import { ref, reactive, onUnmounted } from 'vue'
const props = defineProps({
wp: {
type: Object,
},
boxoList: {
type: Object,
},
value: {
type: Number,
default: 1
},
})
// let data = [[-100, -3.41, -3.39, -3.34, 1, 2, 3], [-99.92, -5.19, -5.23, -5.19, 4, 5, 6], [-99.84, -7.28, -7.26, -7.26, 10, 20, 30]]
const echartsList: any = ref([])
const SA:any = ref([])
const SB:any = ref([])
const SC:any = ref([])
const info = () => {
let result = props.wp?.listWaveData.map(item => {
let A = [[item[0], item[1]], [item[0], item[4]],];
let B = [[item[0], item[2]], [item[0], item[5]],]; // 注意item[7] 会是 undefined需要确保数据长度或调整索引
let C = [[item[0], item[3]], [item[0], item[6]],]; // 根据要求,这里 C 的第二个和第三个子数组的第二个元素取自 subArray[4] 和 subArray[6]
// 由于 subArray[7] 在原始数据中不存在,我们可以使用 subArray[5] 的下一个有效索引 subArray[6](对于 B 的第三个子数组的第二个元素)
return { A, B, C };
}).reduce((acc, { A, B, C }) => {
acc.A[0].push(A[0]);
acc.A[1].push(A[1]);
acc.B[0].push(B[0]);
acc.B[1].push(B[1]);
acc.C[0].push(C[0]);
acc.C[1].push(C[1]);
return acc;
}, { A: [[],[]], B: [[],[]], C: [[],[]] });
SA.value = result.A;
SB.value = result.B;
SC.value = result.C;
console.log( SA.value );
console.log( SB.value );
console.log( SC.value);
let num = (props.wp?.waveTitle.length - 1) / 3
for (let i = 0; i < num; i++) {
// A.value = []
// B.value = []
// C.value = []
// props.wp?.listWaveData.forEach((item: any,) => {
// A.value.push([item[0], item[i * 3 + 1]])
// B.value.push([item[0], item[i * 3 + 2]])
// C.value.push([item[0], item[i * 3 + 3]])
// })
setTimeout(() => {
// echartsList.value.push({
// title: {
// text: i == 0 ? '123' : '',
// x: 'center',
// },
// tooltip: {
// axisPointer: {
// type: 'cross',
// label: {
// color: '#fff',
// fontSize: 16
// }
// },
// textStyle: {
// color: '#fff',
// fontStyle: 'normal',
// opacity: 0.35,
// fontSize: 14
// },
// backgroundColor: 'rgba(0,0,0,0.55)',
// borderWidth: 0,
// },
// dataZoom: [
// {
// type: 'inside',
// height: 13,
// start: 0,
// bottom: '20px',
// end: 25
// },
// {
// start: 0,
// height: 13,
// bottom: '20px',
// end: 25
// }
// ],
// xAxis: {
// // data: data.filter(item => item.phaseType == 'A').map(item => item.time),
// name: '时间',
// type: 'value',
// axisLine: {
// show: true,
// onZero: false //-----------重点
// },
// // splitLine: {
// // show: false,
// // }
// },
// yAxis: {
// type: 'value',
// name: name,
// // splitLine: {
// // show: false,
// // }
// // max: max,
// // min: min
// },
// // legend: {
// // data: ['A', 'B', 'C']
// // // selectedMode: false,
// // },
// grid: {
// top: '30px',
// left: '30px'
// },
// color: ['#DAA520', '#2E8B57', '#A52a2a'],
// series: [
// {
// name: 'A相',
// type: 'line',
// smooth: true,
// symbol: 'none',
// // 开启渐进式渲染
// progressive: 2000,
// // 渲染阈值,大于此值则启动渐进渲染
// progressiveThreshold: 5000,
// sampling: 'average',
// data: A
// },
// {
// name: 'B相',
// type: 'line',
// smooth: true,
// symbol: 'none',
// // 开启渐进式渲染
// progressive: 2000,
// // 渲染阈值,大于此值则启动渐进渲染
// progressiveThreshold: 5000,
// sampling: 'average',
// data: B
// },
// {
// name: 'C相',
// type: 'line',
// smooth: true,
// symbol: 'none',
// // 开启渐进式渲染
// progressive: 2000,
// // 渲染阈值,大于此值则启动渐进渲染
// progressiveThreshold: 5000,
// sampling: 'average',
// data: C
// }
// ],
// options: {
// animation: false,
// dataZoom: [{
// type: 'inside',
// height: 13,
// start: 0,
// bottom: '20px',
// end: 10
// },
// {
// start: 0,
// height: 13,
// bottom: '20px',
// end: 10
// }]
// }
// })
Highcharts.chart(`container${i}`, {
chart: {
zooming: {
type: 'x'
}
},
title: {
text: '123',
align: 'left'
},
subtitle: {
text: 'Using the Boost module',
align: 'left'
},
accessibility: {
screenReaderSection: {
beforeChartFormat: '<{headingTagName}>' +
'{chartTitle}</{headingTagName}><div>{chartSubtitle}</div>' +
'<div>{chartLongdesc}</div><div>{xAxisDescription}</div><div>' +
'{yAxisDescription}</div>'
}
},
tooltip: {
},
xAxis: {
type: 'datetime'
},
series: [
{
name: 'A相',
type: 'line',
lineWidth: 0.5,
data: SA.value[i]
},
{
name: 'B相',
type: 'line',
lineWidth: 0.5,
data: SB.value[i]
},
{
name: 'C相',
type: 'line',
lineWidth: 0.5,
data: SC.value[i]
}
],
});
}, 0);
}
}
var init = () => {
Highcharts.chart('container', {
chart: {
type: 'spline'
},
title: {
text: 'Snow depth at Vikjafjellet, Norway'
},
subtitle: {
text: 'Irregular time data in Highcharts JS'
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
// don't display the year
month: '%e. %b',
year: '%b'
},
title: {
text: 'Date'
}
},
yAxis: {
title: {
text: 'Snow depth (m)'
},
min: 0
},
// tooltip: {
// headerFormat: '<b>{series.name}</b><br>',
// pointFormat: '{point.x:%e. %b}: {point.y:.2f} m'
// },
plotOptions: {
series: {
marker: {
symbol: 'circle',
fillColor: '#FFFFFF',
enabled: true,
radius: 2.5,
lineWidth: 1,
lineColor: null
}
}
},
colors: ['#6CF', '#39F', '#06C', '#036', '#000'],
series: [
]
});
}
onMounted(() => {
info()
// init();
})
onUnmounted(() => {
SA.value = []
SB.value = []
SC.value = []
})
</script>
<style lang="scss" scoped></style>

View File

@@ -1,190 +1,177 @@
<template> <template>
<div v-if="view2"> <div v-if="view2">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<span style="font-size: 14px; line-height: 30px">值类型选择:</span> <!-- <span style="font-size: 14px; line-height: 30px">值类型选择:</span>
<el-select <el-select
style="min-width: 200px; width: 200px" style="min-width: 200px; width: 200px"
@change="changeView" @change="changeView"
v-model="value" v-model="value"
placeholder="请选择值类型" placeholder="请选择值类型"
> >
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
></el-option> ></el-option>
</el-select> </el-select> -->
<!-- <el-button v-if="view2 && senior" class="ml10" type="primary" <el-radio-group v-model.trim="value" @change="changeView">
@click="AdvancedAnalytics">高级分析</el-button> --> <el-radio-button label="一次值" :value="1" />
</el-col> <el-radio-button label="二次值" :value="2" />
<el-col :span="12"> </el-radio-group>
<el-button <!-- <el-button v-if="view2 && senior" class="ml10" type="primary" @click="AdvancedAnalytics">
@click="backbxlb" 高级分析
class="el-icon-refresh-right" </el-button> -->
icon="el-icon-CloseBold" </el-col>
style="float: right" <el-col :span="12">
> <el-button @click="backbxlb" icon="el-icon-Back" style="float: right">返回</el-button>
返回 </el-col>
</el-button> </el-row>
</el-col> <div v-loading="loading" style="height: calc(100vh - 190px)" class="mt10">
</el-row> <el-tabs v-if="view4" type="border-card" v-model="bxactiveName"
<div v-loading="loading" style="height: calc(100vh - 190px)"> @tab-click="bxhandleClick">
<el-tabs v-if="view4" class="default-main" v-model="bxactiveName" @tab-click="bxhandleClick"> <el-tab-pane label="瞬时波形" name="ssbx" class="boxbx pt10 pb10"
<el-tab-pane :style="'height:' + bxecharts + ';overflow-y: scroll;'">
label="瞬时波形" <shushiboxi ref="shushiboxiRef" v-if="bxactiveName == 'ssbx' && showBoxi" :value="value"
name="ssbx" :parentHeight="parentHeight" :boxoList="boxoList" :wp="wp"></shushiboxi>
class="boxbx pt10 pb10" </el-tab-pane>
:style="'height:' + bxecharts + ';overflow-y: scroll;'" <el-tab-pane label="RMS波形" class="boxbx pt10 pb10" name="rmsbx"
> :style="'height:' + bxecharts + ';overflow-y: scroll;'">
<shushiboxi <rmsboxi ref="rmsboxiRef" v-if="bxactiveName == 'rmsbx' && showBoxi" :value="value"
ref="shushiboxiRef" :parentHeight="parentHeight" :boxoList="boxoList" :wp="wp"></rmsboxi>
v-if="bxactiveName == 'ssbx' && showBoxi" </el-tab-pane>
:value="value" </el-tabs>
:parentHeight="parentHeight" <el-empty v-else description="暂无数据" style="height: calc(100vh - 190px)" />
:boxoList="boxoList" </div>
:wp="wp" </div>
></shushiboxi> <div v-if="view3" class="pd10">
</el-tab-pane> <span style="font-weight: 500; font-size: 22px">高级分析</span>
<el-tab-pane <el-button icon="el-icon-Back" @click="gaoBack" style="float: right">返回</el-button>
label="RMS波形" <analytics :flag="true" :GJList="GJList" :boxoList="boxoList"></analytics>
class="boxbx pt10 pb10" </div>
name="rmsbx" </template>
:style="'height:' + bxecharts + ';overflow-y: scroll;'" <script setup lang="ts">
> import shushiboxi from '@/components/echarts/shushiboxi.vue'
<rmsboxi import rmsboxi from '@/components/echarts/rmsboxi.vue'
ref="rmsboxiRef" import analytics from '@/components/echarts/analytics.vue'
v-if="bxactiveName == 'rmsbx' && showBoxi" import { ref, shallowRef } from 'vue'
:value="value" import { analysis } from '@/api/advance-boot/analyse'
:parentHeight="parentHeight" import { mainHeight } from '@/utils/layout'
:boxoList="boxoList" import { getMonitorEventAnalyseWave, downloadWaveFile } from '@/api/event-boot/transient'
:wp="wp" import { buildWaveStoreKey, registerWaveRaw, buildSlimWp, releaseWaveRaw } from '@/utils/waveRawStore'
></rmsboxi> import { clearWaveCache } from '@/utils/waveCache'
</el-tab-pane> const emit = defineEmits(['backbxlb'])
</el-tabs> interface Props {
<el-empty v-else description="暂无数据" style="height: calc(100vh - 190px)" /> // boxoList: any
</div> // wp: any,
</div> senior?: boolean
<div v-if="view3" class="pd10"> }
<span style="font-weight: 500; font-size: 22px">高级分析</span>
<el-button icon="el-icon-Back" @click="gaoBack" style="float: right">返回</el-button> const props = withDefaults(defineProps<Props>(), {
<analytics :flag="true" :GJList="GJList" :boxoList="boxoList"></analytics> senior: false
</div> })
</template> const parentHeight = ref(0)
<script setup lang="ts"> const loading = ref(true)
import shushiboxi from '@/components/echarts/shushiboxi.vue' const bxactiveName = ref('ssbx')
import rmsboxi from '@/components/echarts/rmsboxi.vue' const rmsboxiRef = ref()
import analytics from '@/components/echarts/analytics.vue' const value = ref(1)
import { ref, reactive } from 'vue' const options = ref([
import { analysis } from '@/api/advance-boot/analyse' {
import { mainHeight } from '@/utils/layout' value: 1,
import { getMonitorEventAnalyseWave, downloadWaveFile } from '@/api/event-boot/transient' label: '一次值'
const emit = defineEmits(['backbxlb']) },
interface Props { {
// boxoList: any value: 2,
// wp: any, label: '二次值'
senior?: boolean }
} ])
const shushiboxiRef = ref()
const props = withDefaults(defineProps<Props>(), { const bxecharts = ref(mainHeight(145).height as any)
senior: false const view2 = ref(true)
}) const boxoList: any = ref(null)
const parentHeight = ref(0) const wp = shallowRef<any>(null)
const loading = ref(true) const showBoxi = ref(true)
const bxactiveName = ref('ssbx') const view3 = ref(false)
const rmsboxiRef = ref() const view4 = ref(false)
const value = ref(1) const GJList = ref({})
const options = ref([
{ const open = async (row: any) => {
value: 1, loading.value = true
label: '一次值' await getMonitorEventAnalyseWave({ id: row.eventId, systemType: 0 })
}, .then(res => {
{ row.loading = false
value: 2, if (res != undefined) {
label: '二次值' boxoList.value = row
} boxoList.value.pt = res.data.pt
]) const storeKey = buildWaveStoreKey(row)
const shushiboxiRef = ref() registerWaveRaw(storeKey, res.data)
const bxecharts = ref(mainHeight(95).height as any) wp.value = buildSlimWp(res.data, storeKey)
const view2 = ref(true) loading.value = false
const boxoList = ref(null) view4.value = true
const wp = ref(null) }
const showBoxi = ref(true) })
const view3 = ref(false) .catch(() => {
const view4 = ref(false) loading.value = false
const GJList = ref([]) backbxlb()
})
const open = async (row: any) => { }
loading.value = true const bxhandleClick = (tab: any) => {
await getMonitorEventAnalyseWave({ id: row.eventId, systemType: 0 }) loading.value = true
.then(res => { if (tab.name == 'ssbx') {
row.loading = false bxactiveName.value = 'ssbx'
if (res != undefined) { } else if (tab.name == 'rmsbx') {
boxoList.value = row bxactiveName.value = 'rmsbx'
wp.value = res.data }
loading.value = false setTimeout(() => {
view4.value = true loading.value = false
} }, 0)
}) // console.log(tab, event);
.catch(() => { }
loading.value = false const backbxlb = () => {
}) const storeKey = wp.value?.waveStoreKey
} releaseWaveRaw(storeKey, 'all')
const bxhandleClick = (tab: any) => { clearWaveCache()
if (shushiboxiRef.value) shushiboxiRef.value.backbxlb() boxoList.value = null
if (rmsboxiRef.value) rmsboxiRef.value.backbxlb() wp.value = null
loading.value = true
if (tab.name == 'ssbx') { emit('backbxlb')
bxactiveName.value = 'ssbx' }
} else if (tab.name == 'rmsbx') { const setHeight = (h: any, vh: any) => {
bxactiveName.value = 'rmsbx' if (h != false) {
} parentHeight.value = h
setTimeout(() => { }
loading.value = false
}, 0) setTimeout(() => {
// console.log(tab, event); bxecharts.value = mainHeight(vh).height
} }, 100)
const backbxlb = () => { }
boxoList.value = null // 高级分析
wp.value = null const AdvancedAnalytics = () => {
if (shushiboxiRef.value) shushiboxiRef.value.backbxlb() analysis({
if (rmsboxiRef.value) rmsboxiRef.value.backbxlb() eventIndex: boxoList.value.eventId
}).then(res => {
emit('backbxlb') // GJList.value = res.data
} // view3.value = true
const setHeight = (h: any, vh: any) => { // view2.value = false
if (h != false) { })
parentHeight.value = h GJList.value = {}
} view3.value = true
view2.value = false
setTimeout(() => { }
bxecharts.value = mainHeight(vh).height const changeView = () => {
}, 100) shushiboxiRef.value?.backbxlb?.()
} rmsboxiRef.value?.backbxlb?.()
// 高级分析 showBoxi.value = false
const AdvancedAnalytics = () => { setTimeout(() => {
analysis({ showBoxi.value = true
eventIndex: boxoList.value.eventId }, 0)
}).then(res => { }
GJList.value = res.data const gaoBack = () => {
view3.value = true view2.value = true
view2.value = false view3.value = false
}) }
} defineExpose({ open, setHeight })
const changeView = () => { </script>
if (shushiboxiRef.value) shushiboxiRef.value.backbxlb() <style lang="scss" scoped></style>
if (rmsboxiRef.value) rmsboxiRef.value.backbxlb()
showBoxi.value = false
setTimeout(() => {
showBoxi.value = true
}, 0)
}
const gaoBack = () => {
view2.value = true
view3.value = false
}
defineExpose({ open, setHeight })
</script>
<style lang="scss" scoped></style>

Some files were not shown because too many files have changed in this diff Show More